- serialize Ra as JSON, do not serialize Ramses.

The Ramses intermissions cannot be safely resumed from a savegame - so saving was blocked there, meaning that this data does not need to be saved.
This commit is contained in:
Christoph Oelckers 2020-11-30 00:29:34 +01:00
parent 3c83775273
commit 026d355096
4 changed files with 24 additions and 37 deletions

View File

@ -632,7 +632,7 @@ void EraseScreen(int nVal)
bool GameInterface::CanSave()
{
return gamestate == GS_LEVEL && !bRecord && !bPlayback && !paused && !bInDemo && nTotalPlayers == 1;
return gamestate == GS_LEVEL && !bRecord && !bPlayback && !paused && !bInDemo && nTotalPlayers == 1 && nFreeze == 0;
}
::GameStats GameInterface::getStats()

View File

@ -29,7 +29,6 @@ BEGIN_PS_NS
/* bjd - the content of the ra.* files originally resided in gun.c I think... */
RA Ra[kMaxPlayers]; // one Ra for each player
short RaCount;
static actionSeq RaSeq[] = {
{2, 1},
@ -38,12 +37,29 @@ static actionSeq RaSeq[] = {
{2, 0}
};
static SavegameHelper sghra("ra",
SA(Ra),
SV(RaCount),
nullptr);
FSerializer& Serialize(FSerializer& arc, const char* keyname, RA& w, RA* def)
{
if (arc.BeginObject(keyname))
{
arc ("frame", w.nFrame)
("action", w.nAction)
("sprite", w.nSprite)
("target", w.nTarget)
("run", w.nRun)
("ata", w.field_A)
("atc", w.field_C)
("player", w.nPlayer)
.EndObject();
}
return arc;
}
void SerializeRa(FSerializer& arc)
{
arc.Array("ra", Ra, PlayerCount);
}
void FreeRa(short nPlayer)
{
int nRun = Ra[nPlayer].nRun;
@ -93,7 +109,6 @@ int BuildRa(short nPlayer)
void InitRa()
{
RaCount = 0;
memset(Ra, 0, sizeof(RA) * kMaxPlayers);
}

View File

@ -451,34 +451,4 @@ void DoSpiritHead()
}
}
// This is only the static global data.
static SavegameHelper sghramses("ramses",
SA(cPupData),
SV(nPupData),
SV(nPixels),
SA(curx),
SA(cury),
SA(destvelx),
SA(destvely),
SA(pixelval),
SA(origy),
SA(origx),
SA(velx),
SA(vely),
SV(nMouthTile),
SV(nSpiritSprite),
SV(word_964E8),
SV(word_964EA),
SV(word_964EC),
SV(nSpiritRepeatX),
SV(nSpiritRepeatY),
SV(nPixelsToShow),
SV(nTalkTime),
SV(lHeadStartClock),
SV(lNextStateChange),
SV(nHeadStage),
SV(nHeadTimeStart),
nullptr
);
END_PS_NS

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
void SerializeRa(FSerializer& arc);
void SerializeRand(FSerializer& arc);
void SerializeRunList(FSerializer& arc);
void SerializeSequence(FSerializer& arc);
@ -65,6 +66,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
{
if (arc.BeginObject("exhumed"))
{
SerializeRa(arc);
SerializeRand(arc);
SerializeRunList(arc);
SerializeSequence(arc);