- removed the old actor savegame code and instead implemented a virtual Serialize function.

This isn't hooked up yet, currently savegames are non-functional. They will come back once the global actor arrays are no longer relevant for maintenance.
This commit is contained in:
Christoph Oelckers 2021-12-05 09:20:41 +01:00
parent e79cd8d87f
commit 4cecb6f955
11 changed files with 101 additions and 127 deletions

View file

@ -75,7 +75,6 @@ extern FString BackupSaveGame;
int SaveVersion;
void SerializeMap(FSerializer &arc);
FixedBitArray<MAXSPRITES> activeSprites;
CVAR(String, cl_savedir, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -653,33 +652,17 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
}
void DCoreActor::Serialize(FSerializer& arc)
{
// nothing here yet.
}
void SerializeMap(FSerializer& arc)
{
// create a map of all used sprites so that we can use that elsewhere to only save what's needed.
activeSprites.Zero();
if (arc.isWriting())
{
for (int i=0; i<MAXSPRITES;i++)
{
if (sprite[i].statnum != MAXSTATUS)
{
activeSprites.Set(i);
}
}
}
else
{
memset(sprite, 0, sizeof(sprite[0]) * MAXSPRITES);
InitSpriteLists();
zsp = sprite[0];
}
if (arc.BeginObject("engine"))
{
arc.SerializeMemory("activesprites", activeSprites.Storage(), activeSprites.StorageSize())
.SparseArray("sprites", sprite, MAXSPRITES, activeSprites)
.SparseArray("spriteext", spriteext, MAXSPRITES, activeSprites)
("numsectors", numsectors)
arc("numsectors", numsectors)
("sectors", sector, sectorbackup)
("numwalls", numwalls)
("walls", wall, wallbackup)