mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- 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:
parent
3c83775273
commit
026d355096
4 changed files with 24 additions and 37 deletions
|
@ -632,7 +632,7 @@ void EraseScreen(int nVal)
|
||||||
|
|
||||||
bool GameInterface::CanSave()
|
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()
|
::GameStats GameInterface::getStats()
|
||||||
|
|
|
@ -29,7 +29,6 @@ BEGIN_PS_NS
|
||||||
/* bjd - the content of the ra.* files originally resided in gun.c I think... */
|
/* bjd - the content of the ra.* files originally resided in gun.c I think... */
|
||||||
|
|
||||||
RA Ra[kMaxPlayers]; // one Ra for each player
|
RA Ra[kMaxPlayers]; // one Ra for each player
|
||||||
short RaCount;
|
|
||||||
|
|
||||||
static actionSeq RaSeq[] = {
|
static actionSeq RaSeq[] = {
|
||||||
{2, 1},
|
{2, 1},
|
||||||
|
@ -38,12 +37,29 @@ static actionSeq RaSeq[] = {
|
||||||
{2, 0}
|
{2, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SavegameHelper sghra("ra",
|
FSerializer& Serialize(FSerializer& arc, const char* keyname, RA& w, RA* def)
|
||||||
SA(Ra),
|
{
|
||||||
SV(RaCount),
|
if (arc.BeginObject(keyname))
|
||||||
nullptr);
|
{
|
||||||
|
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)
|
void FreeRa(short nPlayer)
|
||||||
{
|
{
|
||||||
int nRun = Ra[nPlayer].nRun;
|
int nRun = Ra[nPlayer].nRun;
|
||||||
|
@ -93,7 +109,6 @@ int BuildRa(short nPlayer)
|
||||||
|
|
||||||
void InitRa()
|
void InitRa()
|
||||||
{
|
{
|
||||||
RaCount = 0;
|
|
||||||
memset(Ra, 0, sizeof(RA) * kMaxPlayers);
|
memset(Ra, 0, sizeof(RA) * kMaxPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
END_PS_NS
|
||||||
|
|
|
@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
|
void SerializeRa(FSerializer& arc);
|
||||||
void SerializeRand(FSerializer& arc);
|
void SerializeRand(FSerializer& arc);
|
||||||
void SerializeRunList(FSerializer& arc);
|
void SerializeRunList(FSerializer& arc);
|
||||||
void SerializeSequence(FSerializer& arc);
|
void SerializeSequence(FSerializer& arc);
|
||||||
|
@ -65,6 +66,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
{
|
{
|
||||||
if (arc.BeginObject("exhumed"))
|
if (arc.BeginObject("exhumed"))
|
||||||
{
|
{
|
||||||
|
SerializeRa(arc);
|
||||||
SerializeRand(arc);
|
SerializeRand(arc);
|
||||||
SerializeRunList(arc);
|
SerializeRunList(arc);
|
||||||
SerializeSequence(arc);
|
SerializeSequence(arc);
|
||||||
|
|
Loading…
Reference in a new issue