- added mapSpawned member to DDukeActor

Duke uses the owner a lot to check if an actor was spawned at map start or in-game, but that depends a lot on stale pointers being maintained, which our garbage collected system does not allow. So this field now serves as a more reliable stand-in for these cases.
No actual changes yet.
This commit is contained in:
Christoph Oelckers 2022-12-13 10:36:45 +01:00
parent 9c1fc93e1c
commit 13e6718153
6 changed files with 6 additions and 0 deletions

View file

@ -259,6 +259,7 @@ void cacheit_d(void)
//---------------------------------------------------------------------------
void spriteinit_d(DDukeActor* actor, TArray<DDukeActor*>& actors)
{
actor->mapSpawned = true;
bool res = initspriteforspawn(actor);
if (res) spawninit_d(nullptr, actor, &actors);
}

View file

@ -399,6 +399,7 @@ void cacheit_r(void)
void spriteinit_r(DDukeActor* actor, TArray<DDukeActor*>& actors)
{
actor->mapSpawned = true;
bool res = initspriteforspawn(actor);
if (res) spawninit_r(nullptr, actor, &actors);
}

View file

@ -270,6 +270,7 @@ void DDukeActor::Serialize(FSerializer& arc)
("actorstayput", actorstayput)
("basepicnum", basepicnum)
("timetosleep", timetosleep)
("mapspawned", mapSpawned)
("floorz", floorz)
("ceilingz", ceilingz)
("lastvx", ovel.X)

View file

@ -47,6 +47,7 @@ public:
short attackertype, hitextra;
short tempval, basepicnum;
unsigned short timetosleep;
bool mapSpawned;
DVector2 ovel;
DAngle hitang;
double floorz, ceilingz;

View file

@ -224,6 +224,7 @@ DEFINE_FIELD(DDukeActor, hitextra)
DEFINE_FIELD(DDukeActor, movflag)
DEFINE_FIELD(DDukeActor, tempval)
DEFINE_FIELD(DDukeActor, timetosleep)
DEFINE_FIELD(DDukeActor, mapSpawned)
DEFINE_FIELD(DDukeActor, floorz)
DEFINE_FIELD(DDukeActor, ceilingz)
DEFINE_FIELD(DDukeActor, saved_ammo)

View file

@ -125,6 +125,7 @@ class DukeActor : CoreActor native
native int16 /*attackertype, hitang,*/ hitextra, movflag;
native int16 tempval; /*, dispicnum;*/
native int16 timetosleep;
native bool mapSpawned;
native double floorz, ceilingz;
native int saved_ammo;
native int palvals;