mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- added savegame support for the new actor management.
This commit is contained in:
parent
2dda3ee505
commit
74da3e5fa7
6 changed files with 49 additions and 22 deletions
|
@ -195,7 +195,6 @@ static DObject **SweepList(DObject **p, size_t count, size_t *finalize_count)
|
|||
|
||||
// However, this can happen during deletion of the thinker list while cleaning up
|
||||
// from a savegame error so we can't assume that any thinker that gets here is an error.
|
||||
assert(!curr->IsKindOf("CoreActor"));
|
||||
|
||||
curr->Destroy();
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ static void RemoveActorStat(DCoreActor* actor)
|
|||
|
||||
auto prevp = prev ? &prev->nextStat : &firstEntry;
|
||||
auto nextp = next ? &next->prevStat : &lastEntry;
|
||||
|
||||
assert(*prevp == actor);
|
||||
assert(*nextp == actor);
|
||||
|
||||
|
@ -364,7 +365,7 @@ DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail)
|
|||
|
||||
void DCoreActor::OnDestroy()
|
||||
{
|
||||
assert(spr.statnum >= 0 && spr.statnum < MAXSTATUS);
|
||||
if(link_stat == INT_MAX) return;
|
||||
|
||||
int stat = link_stat;
|
||||
RemoveActorStat(this);
|
||||
|
@ -395,11 +396,10 @@ void InitSpriteLists()
|
|||
TSpriteIterator<DCoreActor> it;
|
||||
while (auto actor = it.Next())
|
||||
allActors.Push(actor);
|
||||
for (auto& act : allActors)
|
||||
{
|
||||
if (!(act->ObjectFlags & OF_EuthanizeMe))
|
||||
act->Destroy();
|
||||
}
|
||||
|
||||
// clear all lists manually before doing any mass destruction.
|
||||
// This may also be called in error situations where the list has become corrupted,
|
||||
// so we should not depend on its consistency anymore.
|
||||
for (auto& stat : statList)
|
||||
{
|
||||
stat.firstEntry = stat.lastEntry = nullptr;
|
||||
|
@ -408,6 +408,16 @@ void InitSpriteLists()
|
|||
{
|
||||
sect.firstEntry = sect.lastEntry = nullptr;
|
||||
}
|
||||
|
||||
for (auto& act : allActors)
|
||||
{
|
||||
if (!(act->ObjectFlags & OF_EuthanizeMe))
|
||||
{
|
||||
act->link_stat = INT_MAX;
|
||||
act->prevStat = act->nextStat = act->prevSect = act->nextSect = nullptr;
|
||||
act->Destroy();
|
||||
}
|
||||
}
|
||||
Numsprites = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ static void SerializeGlobals(FSerializer& arc)
|
|||
|
||||
static void SerializeSession(FSerializer& arc)
|
||||
{
|
||||
arc.ReadObjects(false);
|
||||
SerializeMap(arc);
|
||||
SerializeStatistics(arc);
|
||||
SECRET_Serialize(arc);
|
||||
|
@ -510,7 +511,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
{
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("wallptr", c.wallptr, def->wallptr)
|
||||
arc("firstentry", c.firstEntry)
|
||||
("lastentry", c.lastEntry)
|
||||
("wallptr", c.wallptr, def->wallptr)
|
||||
("wallnum", c.wallnum, def->wallnum)
|
||||
("ceilingz", c.ceilingz, def->ceilingz)
|
||||
("floorz", c.floorz, def->floorz)
|
||||
|
@ -651,11 +654,27 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
|
|||
return arc;
|
||||
}
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, ActorStatList& c, ActorStatList* def)
|
||||
{
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("firstentry", c.firstEntry)
|
||||
("lastentry", c.lastEntry)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
void DCoreActor::Serialize(FSerializer& arc)
|
||||
{
|
||||
// nothing here yet.
|
||||
arc("sprite", spr)
|
||||
Super::Serialize(arc);
|
||||
arc("link_stat", link_stat)
|
||||
("link_sector", link_sector)
|
||||
("prevstat", prevStat)
|
||||
("nextstat", nextStat)
|
||||
("prevsect", prevSect)
|
||||
("nextsect", nextSect)
|
||||
("sprite", spr)
|
||||
("spriteext", sprext);
|
||||
|
||||
if (arc.isReading()) spsmooth = {};
|
||||
|
@ -666,7 +685,8 @@ void SerializeMap(FSerializer& arc)
|
|||
{
|
||||
if (arc.BeginObject("engine"))
|
||||
{
|
||||
arc("numsectors", numsectors)
|
||||
arc.Array("statlist", statList, MAXSTATUS)
|
||||
("numsectors", numsectors)
|
||||
("sectors", sector, sectorbackup)
|
||||
("numwalls", numwalls)
|
||||
("walls", wall, wallbackup)
|
||||
|
|
|
@ -69,15 +69,15 @@ const char *GetVersionString();
|
|||
#define SAVESIG_SW GAMENAME ".ShadowWarrior"
|
||||
#define SAVESIG_PS GAMENAME ".Exhumed"
|
||||
|
||||
#define MINSAVEVER_DN3D 10
|
||||
#define MINSAVEVER_BLD 12
|
||||
#define MINSAVEVER_SW 13
|
||||
#define MINSAVEVER_PS 15
|
||||
#define MINSAVEVER_DN3D 16
|
||||
#define MINSAVEVER_BLD 16
|
||||
#define MINSAVEVER_SW 16
|
||||
#define MINSAVEVER_PS 16
|
||||
|
||||
#define SAVEVER_DN3D 12
|
||||
#define SAVEVER_BLD 12
|
||||
#define SAVEVER_SW 13
|
||||
#define SAVEVER_PS 15
|
||||
#define SAVEVER_DN3D 16
|
||||
#define SAVEVER_BLD 16
|
||||
#define SAVEVER_SW 16
|
||||
#define SAVEVER_PS 16
|
||||
|
||||
#define NETGAMEVERSION 1
|
||||
|
||||
|
|
|
@ -73,13 +73,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, GameVarValue& w, G
|
|||
case 0:
|
||||
{
|
||||
// pointless to handle now, fix when saving works again.
|
||||
#pragma message(" fix me!");
|
||||
#if 0
|
||||
DDukeActor* a = arc.isWriting() ? w.actor() : nullptr;
|
||||
arc("actor", a);
|
||||
if (arc.isReading()) w = GameVarValue(a);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
|
|
|
@ -298,6 +298,7 @@ void DDukeActor::Serialize(FSerializer& arc)
|
|||
|
||||
Super::Serialize(arc);
|
||||
|
||||
if (arc.isReading()) s = &spr;
|
||||
arc("cgg", cgg)
|
||||
("spriteextra", spriteextra)
|
||||
("picnum", picnum)
|
||||
|
|
Loading…
Reference in a new issue