- fixed a few issues and added some savegame debug code for Shadow Warrior.

This commit is contained in:
Christoph Oelckers 2020-01-05 18:49:19 +01:00
parent 2dc0de5824
commit 83292c9dd6
6 changed files with 68 additions and 7 deletions

View file

@ -110,6 +110,7 @@ error:
bool CompositeSavegameWriter::WriteToFile() bool CompositeSavegameWriter::WriteToFile()
{ {
if (subfiles.Size() == 0) return false;
TArray<FCompressedBuffer> compressed(subfiles.Size(), 1); TArray<FCompressedBuffer> compressed(subfiles.Size(), 1);
for (unsigned i = 0; i < subfiles.Size(); i++) for (unsigned i = 0; i < subfiles.Size(); i++)
{ {

View file

@ -2634,7 +2634,14 @@ void RunLevel(void)
D_ProcessEvents(); D_ProcessEvents();
faketimerhandler(); faketimerhandler();
MoveLoop(); if (M_Active())
{
ototalclock = (int)totalclock;
}
else
{
MoveLoop();
}
drawscreen(Player + screenpeek); drawscreen(Player + screenpeek);

View file

@ -116,7 +116,7 @@ void UpdateMiniBar(PLAYERp pp)
INVENTORY_DATAp id; INVENTORY_DATAp id;
extern SWBOOL PanelUpdateMode; extern SWBOOL PanelUpdateMode;
#define MINI_BAR_Y 174 #define MINI_BAR_Y 174
#define MINI_BAR_HEALTH_BOX_PIC 2437 #define MINI_BAR_HEALTH_BOX_PIC 2437
#define MINI_BAR_AMMO_BOX_PIC 2437 #define MINI_BAR_AMMO_BOX_PIC 2437

View file

@ -50,6 +50,7 @@ inline void MCLOSE_WRITE(FileWriter* handle)
inline void MCLOSE_READ(FileReader* handle) inline void MCLOSE_READ(FileReader* handle)
{ {
handle->Close();
FinishSavegameRead(); FinishSavegameRead();
} }

View file

@ -162,7 +162,7 @@ int SaveSymDataInfo(MFILE_WRITE fil, void *ptr)
fp = fopen("savegame symbols missing.txt", "a"); fp = fopen("savegame symbols missing.txt", "a");
if (fp) if (fp)
{ {
fprintf(fp,"data %p\n",ptr); fprintf(fp,"data %p - reference variable xdim at %p\n",ptr, &xdim);
fclose(fp); fclose(fp);
} }
return 1; return 1;
@ -184,7 +184,7 @@ static int SaveSymCodeInfo_raw(MFILE_WRITE fil, void *ptr)
fp = fopen("savegame symbols missing.txt", "a"); fp = fopen("savegame symbols missing.txt", "a");
if (fp) if (fp)
{ {
fprintf(fp,"code %p\n",ptr); fprintf(fp,"code %p - reference function SaveSymDataInfo at %p\n",ptr, SaveSymDataInfo);
fclose(fp); fclose(fp);
} }
return 1; return 1;
@ -295,22 +295,36 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
////// //////
saveisshot |= SaveSymDataInfo(fil, pp->remote_sprite); saveisshot |= SaveSymDataInfo(fil, pp->remote_sprite);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->remote.sop_control); saveisshot |= SaveSymDataInfo(fil, pp->remote.sop_control);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->sop_remote); saveisshot |= SaveSymDataInfo(fil, pp->sop_remote);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->sop); saveisshot |= SaveSymDataInfo(fil, pp->sop);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->hi_sectp); saveisshot |= SaveSymDataInfo(fil, pp->hi_sectp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->lo_sectp); saveisshot |= SaveSymDataInfo(fil, pp->lo_sectp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->hi_sp); saveisshot |= SaveSymDataInfo(fil, pp->hi_sp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->lo_sp); saveisshot |= SaveSymDataInfo(fil, pp->lo_sp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->last_camera_sp); saveisshot |= SaveSymDataInfo(fil, pp->last_camera_sp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->SpriteP); saveisshot |= SaveSymDataInfo(fil, pp->SpriteP);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->UnderSpriteP); saveisshot |= SaveSymDataInfo(fil, pp->UnderSpriteP);
assert(!saveisshot);
saveisshot |= SaveSymCodeInfo(fil, pp->DoPlayerAction); saveisshot |= SaveSymCodeInfo(fil, pp->DoPlayerAction);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->sop_control); saveisshot |= SaveSymDataInfo(fil, pp->sop_control);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, pp->sop_riding); saveisshot |= SaveSymDataInfo(fil, pp->sop_riding);
assert(!saveisshot);
} }
#if PANEL_SAVE #if PANEL_SAVE
@ -334,16 +348,24 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(psp, sizeof(PANEL_SPRITE),1,fil); MWRITE(psp, sizeof(PANEL_SPRITE),1,fil);
saveisshot |= SaveSymDataInfo(fil, psp->PlayerP); saveisshot |= SaveSymDataInfo(fil, psp->PlayerP);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, psp->State); saveisshot |= SaveSymDataInfo(fil, psp->State);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, psp->RetractState); saveisshot |= SaveSymDataInfo(fil, psp->RetractState);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, psp->PresentState); saveisshot |= SaveSymDataInfo(fil, psp->PresentState);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, psp->ActionState); saveisshot |= SaveSymDataInfo(fil, psp->ActionState);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, psp->RestState); saveisshot |= SaveSymDataInfo(fil, psp->RestState);
assert(!saveisshot);
saveisshot |= SaveSymCodeInfo(fil, psp->PanelSpriteFunc); saveisshot |= SaveSymCodeInfo(fil, psp->PanelSpriteFunc);
assert(!saveisshot);
for (j = 0; j < SIZ(psp->over); j++) for (j = 0; j < SIZ(psp->over); j++)
{ {
saveisshot |= SaveSymDataInfo(fil, psp->over[j].State); saveisshot |= SaveSymDataInfo(fil, psp->over[j].State);
assert(!saveisshot);
} }
ndx++; ndx++;
@ -431,23 +453,41 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
} }
saveisshot |= SaveSymDataInfo(fil, u->WallP); saveisshot |= SaveSymDataInfo(fil, u->WallP);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->State); saveisshot |= SaveSymDataInfo(fil, u->State);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->Rot); saveisshot |= SaveSymDataInfo(fil, u->Rot);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->StateStart); saveisshot |= SaveSymDataInfo(fil, u->StateStart);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->StateEnd); saveisshot |= SaveSymDataInfo(fil, u->StateEnd);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->StateFallOverride); saveisshot |= SaveSymDataInfo(fil, u->StateFallOverride);
assert(!saveisshot);
saveisshot |= SaveSymCodeInfo(fil, u->ActorActionFunc); saveisshot |= SaveSymCodeInfo(fil, u->ActorActionFunc);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->ActorActionSet); saveisshot |= SaveSymDataInfo(fil, u->ActorActionSet);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->Personality); saveisshot |= SaveSymDataInfo(fil, u->Personality);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->Attrib); saveisshot |= SaveSymDataInfo(fil, u->Attrib);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->sop_parent); saveisshot |= SaveSymDataInfo(fil, u->sop_parent);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->hi_sectp); saveisshot |= SaveSymDataInfo(fil, u->hi_sectp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->lo_sectp); saveisshot |= SaveSymDataInfo(fil, u->lo_sectp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->hi_sp); saveisshot |= SaveSymDataInfo(fil, u->hi_sp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->lo_sp); saveisshot |= SaveSymDataInfo(fil, u->lo_sp);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->SpriteP); saveisshot |= SaveSymDataInfo(fil, u->SpriteP);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->PlayerP); saveisshot |= SaveSymDataInfo(fil, u->PlayerP);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, u->tgt_sp); saveisshot |= SaveSymDataInfo(fil, u->tgt_sp);
assert(!saveisshot);
} }
} }
ndx = -1; ndx = -1;
@ -464,10 +504,15 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
sop = &SectorObject[ndx]; sop = &SectorObject[ndx];
saveisshot |= SaveSymCodeInfo(fil, sop->PreMoveAnimator); saveisshot |= SaveSymCodeInfo(fil, sop->PreMoveAnimator);
assert(!saveisshot);
saveisshot |= SaveSymCodeInfo(fil, sop->PostMoveAnimator); saveisshot |= SaveSymCodeInfo(fil, sop->PostMoveAnimator);
assert(!saveisshot);
saveisshot |= SaveSymCodeInfo(fil, sop->Animator); saveisshot |= SaveSymCodeInfo(fil, sop->Animator);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, sop->controller); saveisshot |= SaveSymDataInfo(fil, sop->controller);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, sop->sp_child); saveisshot |= SaveSymDataInfo(fil, sop->sp_child);
assert(!saveisshot);
} }
@ -554,10 +599,13 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
else else
{ {
saveisshot |= SaveSymDataInfo(fil, a->ptr); saveisshot |= SaveSymDataInfo(fil, a->ptr);
assert(!saveisshot);
} }
saveisshot |= SaveSymCodeInfo(fil, a->callback); saveisshot |= SaveSymCodeInfo(fil, a->callback);
assert(!saveisshot);
saveisshot |= SaveSymDataInfo(fil, a->callbackdata); saveisshot |= SaveSymDataInfo(fil, a->callbackdata);
assert(!saveisshot);
} }
#else #else
@ -606,7 +654,10 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(oldipos,sizeof(oldipos),1,fil); MWRITE(oldipos,sizeof(oldipos),1,fil);
MWRITE(bakipos,sizeof(bakipos),1,fil); MWRITE(bakipos,sizeof(bakipos),1,fil);
for (i = numinterpolations - 1; i >= 0; i--) for (i = numinterpolations - 1; i >= 0; i--)
{
saveisshot |= SaveSymDataInfo(fil, curipos[i]); saveisshot |= SaveSymDataInfo(fil, curipos[i]);
assert(!saveisshot);
}
// short interpolations // short interpolations
MWRITE(&short_numinterpolations,sizeof(short_numinterpolations),1,fil); MWRITE(&short_numinterpolations,sizeof(short_numinterpolations),1,fil);
@ -614,8 +665,10 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(short_oldipos,sizeof(short_oldipos),1,fil); MWRITE(short_oldipos,sizeof(short_oldipos),1,fil);
MWRITE(short_bakipos,sizeof(short_bakipos),1,fil); MWRITE(short_bakipos,sizeof(short_bakipos),1,fil);
for (i = short_numinterpolations - 1; i >= 0; i--) for (i = short_numinterpolations - 1; i >= 0; i--)
{
saveisshot |= SaveSymDataInfo(fil, short_curipos[i]); saveisshot |= SaveSymDataInfo(fil, short_curipos[i]);
assert(!saveisshot);
}
// parental lock // parental lock
for (i = 0; i < (int)SIZ(otlist); i++) for (i = 0; i < (int)SIZ(otlist); i++)
@ -681,7 +734,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(BossSpriteNum, sizeof(BossSpriteNum), 1, fil); MWRITE(BossSpriteNum, sizeof(BossSpriteNum), 1, fil);
//MWRITE(&Zombies, sizeof(Zombies), 1, fil); //MWRITE(&Zombies, sizeof(Zombies), 1, fil);
MCLOSE_WRITE(fil);
if (!saveisshot) if (!saveisshot)
return FinishSavegameWrite(); return FinishSavegameWrite();

View file

@ -1321,7 +1321,7 @@ OptionMenu SoundOptions //protected
Option "$SNDMNU_MIDIDEVICE", "snd_mididevice", "MidiDevices" Option "$SNDMNU_MIDIDEVICE", "snd_mididevice", "MidiDevices"
//StaticText " " //StaticText " "
//Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff" //Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff"
Slider "$SNDMNU_ LS", "snd_numchannels", 64, 128, 8, 0 Slider "$SNDMNU_CHANNELS", "snd_numchannels", 64, 128, 8, 0
staticText "" staticText ""
ifgame (Blood, ShadowWarrior, Redneck, RedneckRides) ifgame (Blood, ShadowWarrior, Redneck, RedneckRides)
{ {