Skip to content

Commit

Permalink
Many fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed May 11, 2012
1 parent 1169b00 commit aec1965
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 41 deletions.
10 changes: 4 additions & 6 deletions Engine/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ void InitGameLoop()
if (GetgVarInt(SLOT_KBD_ROTATE_SPEED) == 0)
SetDirectgVarInt(SLOT_KBD_ROTATE_SPEED,60);

//needed for znemesis
SetDirectgVarInt(SLOT_CPU, 1);
SetDirectgVarInt(SLOT_PLATFORM, 0);
SetDirectgVarInt(SLOT_WIN958, 0);

//\Hack


Expand Down Expand Up @@ -107,7 +102,10 @@ void EasterEggsAndDebug()
// int ii2 = atoi(abc);
// SetgVarInt(ii,ii2);
// }

if (CheckKeyboardMessage("Q",1))
{
printf("94 %d\n3263 %d\n",GetgVarInt(94),GetgVarInt(3263));
}

#ifdef GAME_ZGI
if (CheckKeyboardMessage("IMNOTDEAF",9))
Expand Down
12 changes: 6 additions & 6 deletions Engine/src/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ void DrawAnimImage(anim_surf *anim, int x, int y, int frame)
int32_t frames = anim->info.frames;
if (frame >= frames)
{
#ifdef TRACE
printf("Error, required frame(%d) of animation is out of range (%d) \n",frame,anim->info.frames);
#endif
//#ifdef TRACE
// printf("Error, required frame(%d) of animation is out of range (%d) \n",frame,anim->info.frames);
//#endif
return;
}

Expand All @@ -252,9 +252,9 @@ void DrawAnimImageToSurf(anim_surf *anim, int x, int y, int frame,SDL_Surface *s
int32_t frames = anim->info.frames;
if (frame >= frames)
{
#ifdef TRACE
printf("Error, required frame(%d) of animation is out of range (%d) \n",frame,anim->info.frames);
#endif
//#ifdef TRACE
// printf("Error, required frame(%d) of animation is out of range (%d) \n",frame,anim->info.frames);
//#endif
return;
}

Expand Down
24 changes: 12 additions & 12 deletions Engine/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ CXX = g++
MINGW = /usr/i486-mingw32
CC_WIN = i486-mingw32-gcc
CXX_WIN = i486-mingw32-g++
FLAGS = -Wall
LIBS = -lSDL -lSDL_image -lSDL_gfx -lSDLmain -lSDL_mixer -lSDL_ttf -lsmpeg -lrt
LIBS_WIN = -L$(MINGW)/lib/ -lmingw32 -lSDL -lSDL_image -lSDL_gfx -lSDLmain -lSDL_mixer -lSDL_ttf -lsmpeg -lSDL.dll -mwindows
LIBS = -Bstatic -lSDL -lSDL_image -lSDL_gfx -lSDLmain -lSDL_mixer -lSDL_ttf -lsmpeg
LIBS_WIN = -L$(MINGW)/lib/ -lmingw32 -lSDL -lSDL_image -lSDL_gfx -lSDLmain -lSDL_mixer -lSDL_ttf -lsmpeg -lSDL.dll -mwindows
TARGET = Zengine
TARGET_WIN = $(TARGET).exe
OBJS = \
actions.cpp\
Control.cpp\
Expand All @@ -27,27 +27,27 @@ OBJS = \
Subtitles.cpp\
Text.cpp\
Optimiz.cpp\
intro.cpp\
inventory.cpp\
loader.cpp\
mfile.cpp
mfile.cpp\
inventory.cpp\
intro.cpp

WINOBJ = \
win_funct.cpp

linux_zgi: $(OBJS)
$(CXX) $(FLAGS) -DGAME_ZGI -O3 -Os -o $(TARGET) $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/
$(CXX) $(FLAGS) -DWIDESCREEN -DGAME_ZGI -O3 -Os -o $(TARGET)_wide $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/
$(CXX) -Wno-write-strings -DGAME_ZGI -O3 -Os -o $(TARGET) $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/
$(CXX) -Wno-write-strings -DWIDESCREEN -DGAME_ZGI -O3 -Os -o $(TARGET)_wide $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/

linux_znem: $(OBJS)
$(CXX) $(FLAGS) -DGAME_NEMESIS -O3 -Os -o $(TARGET) $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/
$(CXX) -Wno-write-strings -DGAME_NEMESIS -O3 -Os -o $(TARGET) $(OBJS) $(LIBS) -I /usr/include/ -I /usr/include/SDL/

win32_zgi: $(OBJS) $(WINOBJ)
$(CXX_WIN) $(FLAGS) -DGAME_ZGI -O3 -Os -o $(TARGET).exe $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/
$(CXX_WIN) $(FLAGS) -DWIDESCREEN -DGAME_ZGI -O3 -Os -o $(TARGET)_wide.exe $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/
$(CXX_WIN) -Wno-write-strings -DGAME_ZGI -O3 -Os -o $(TARGET_WIN) $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/
$(CXX_WIN) -Wno-write-strings -DWIDESCREEN -DGAME_ZGI -O3 -Os -o $(TARGET_WIN) $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/

win32_znem: $(OBJS) $(WINOBJ)
$(CXX_WIN) $(FLAGS) -DGAME_NEMESIS -O3 -Os -o $(TARGET_WIN) $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/
$(CXX_WIN) -Wno-write-strings -DGAME_NEMESIS -O3 -Os -o $(TARGET_WIN) $(OBJS) $(WINOBJ) $(LIBS_WIN) -I $(MINGW)/include/ -I $(MINGW)/include/SDL/

clean:
rm -f $(TARGET) $(TARGET_DINGOO) *.o
44 changes: 33 additions & 11 deletions Engine/src/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ void Rend_DrawPanorama()

void Rend_PanaMouseInteract()
{
int32_t tt = *view_X;

if (KeyDown(SDLK_LEFT))
{
Expand Down Expand Up @@ -629,7 +630,6 @@ void Rend_PanaMouseInteract()
}
}

int32_t tt = *view_X;

if (tt < pana_Zero)
{
Expand Down Expand Up @@ -1841,31 +1841,36 @@ void Rend_EF_9_Draw(struct_effect *ef)
{
if (mp[xx] == 0)
{
if ((aa[xx] & 0xFF) <= 0x16)
if ((aa[xx] & 0xFF) <= 0x10)
mp[xx] = 1;
else
aa[xx] -= 0x0080808;
}
else
{
if ((aa[xx] & 0xFF) >= 0x7F)
if ((aa[xx] & 0xFF) >= 0xEF)
mp[xx] = 0;
else
aa[xx] += 0x0080808;
}

}

uint32_t tmp1 = aa[0];
int8_t tmp2 = mp[0];
int32_t shift_num = GetgVarInt(SLOT_EF9_SPEED);

for(int32_t xx=0; xx<clouds->w-1; xx++)
for(int32_t sn = 0; sn < shift_num; sn++)
{
aa[xx] = aa[xx+1];
mp[xx] = mp[xx+1];
uint32_t tmp1 = aa[0];
int8_t tmp2 = mp[0];

for(int32_t xx=0; xx<clouds->w-1; xx++)
{
aa[xx] = aa[xx+1];
mp[xx] = mp[xx+1];
}
aa[clouds->w-1] = tmp1;
mp[clouds->w-1] = tmp2;
}
aa[clouds->w-1] = tmp1;
mp[clouds->w-1] = tmp2;

aa += clouds->w;
mp += clouds->w;
Expand Down Expand Up @@ -1921,7 +1926,24 @@ void Rend_EF_9_Draw(struct_effect *ef)
if (mskpx[x] != 0)
{
uint32_t m_r, m_g, m_b;
COLOR_RGBA32(mskpx[x],m_r,m_g,m_b);
//COLOR_RGBA32(mskpx[x],m_r,m_g,m_b);

m_r = GetgVarInt(SLOT_EF9_R);
m_g = GetgVarInt(SLOT_EF9_G);
m_b = GetgVarInt(SLOT_EF9_B);

if (m_r >= 32)
m_r = 31;

if (m_g >= 32)
m_g = 31;

if (m_b >= 32)
m_b = 31;

m_r = FiveBitToEightBitLookupTable[m_r];
m_g = FiveBitToEightBitLookupTable[m_g];
m_b = FiveBitToEightBitLookupTable[m_b];

uint32_t c_r, c_g, c_b;
COLOR_RGBA32(cldpx[x],c_r,c_g,c_b);
Expand Down
10 changes: 10 additions & 0 deletions Engine/src/ScriptSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ void InitScriptsEngine()

memset(Flags,0x0,VAR_SLOTS_MAX * sizeof(uint8_t));

//needed for znemesis
SetDirectgVarInt(SLOT_CPU, 1);
SetDirectgVarInt(SLOT_PLATFORM, 0);
SetDirectgVarInt(SLOT_WIN958, 0);

ScrSys_LoadPreferences();
}

Expand Down Expand Up @@ -633,8 +638,13 @@ void FillStateBoxFromList(pzllst *lst)
{
puzzlenode *pzlnod=(puzzlenode *)DataMList(lst->_list);

#ifdef GAME_NEMESIS
//Nemesis don't use statebox, but this engine does
AddPuzzleToStateBox(pzlnod->slot,pzlnod);
#else
if (ScrSys_GetFlag(pzlnod->slot) & FLAG_ONCE_PER_I)
AddPuzzleToStateBox(pzlnod->slot,pzlnod);
#endif

StartMList(pzlnod->CritList);
while (!eofMList(pzlnod->CritList))
Expand Down
4 changes: 4 additions & 0 deletions Engine/src/ScriptSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
//To change - type DBGONOFF
#define SLOT_JAPANESEFONTS 75
#define SLOT_BRIGHTNESS 77
#define SLOT_EF9_B 91
#define SLOT_EF9_G 92
#define SLOT_EF9_R 93
#define SLOT_EF9_SPEED 94
#define SLOT_INV_STORAGE_S1 100
#define SLOT_INV_STORAGE_0 101
#define SLOT_INV_STORAGE_1 102
Expand Down
13 changes: 7 additions & 6 deletions Engine/src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,13 @@ int action_add(char *params, int aSlot , pzllst *owner)
printf(" action:add(%s)\n",params);
#endif

char slot[16],number[16];
int tmp;
sscanf(params,"%s %s",slot, number);
char number[16];
int slot;
// int tmp;
sscanf(params,"%d, %s",&slot, number);

tmp = GetIntVal(slot);
SetgVarInt(tmp, GetgVarInt(tmp) + GetIntVal(number));
//tmp = GetIntVal(slot);
SetgVarInt(slot, GetgVarInt(slot) + GetIntVal(number));

return ACTION_NORMAL;
}
Expand Down Expand Up @@ -936,7 +937,7 @@ int stopkiller(char *params, int aSlot , pzllst *owner, bool iskillfunc)
{
struct_action_res *nod = (struct_action_res *)DataMList(all);

if (nod->slot == slot)
if (nod->slot == slot && nod->node_type != NODE_TYPE_ANIMPRE)
{
ScrSys_DeleteNode(nod);

Expand Down

0 comments on commit aec1965

Please sign in to comment.