- fixed some issues with projectile ownership.

Some init code was run here that should not be run. Added a new flag to handle this case without major code explosion.
This commit is contained in:
Christoph Oelckers 2022-12-23 10:36:07 +01:00
parent c73830992f
commit e15517cf57
6 changed files with 23 additions and 11 deletions

View file

@ -172,6 +172,7 @@ static FFlagDef DukeActorFlagDefs[] =
DEFINE_FLAG(SFLAG3, FORCERUNCON, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, BIGHEALTH, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, NOGRAVITY, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, SIMPLEINIT, DDukeActor, flags3),
};

View file

@ -406,6 +406,7 @@ enum sflags3_t
SFLAG3_FORCERUNCON = 0x00000010, // by default only STAT_ACTOR runs CON - this enables it for other statnums as well, provided they run Tick()
SFLAG3_BIGHEALTH = 0x00000020,
SFLAG3_NOGRAVITY = 0x00000040, // disables makeitfall.
SFLAG3_SIMPLEINIT = 0x00000080, // Internal: skip default init stuff in DukeActor::Initialize.
};

View file

@ -129,6 +129,12 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
act->curAction = &actions[sa[1]];
act->curMove = &moves[sa[2]];
act->spr.hitag = sa[3];
// remove script info if it is completely empty and no animation is set.
if (act->curAction->name == NAME_Name && act->curMove->name == NAME_Name && *sa == concmd_enda)
{
sa = nullptr;
}
}
else
{
@ -156,7 +162,12 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
DDukeActor* SpawnActor(sectortype* whatsectp, const DVector3& pos, PClassActor* cls, int8_t s_shd, const DVector2& scale, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat)
{
auto actor = CreateActor(whatsectp, pos, cls, s_shd, scale, s_ang, s_vel, s_zvel, s_ow, s_stat);
if (actor) spawninit(s_ow, actor, nullptr);
if (actor)
{
actor->flags3 |= SFLAG3_SIMPLEINIT; // at this point we only want to run custom Initialize code, but not the default for scripted actors, even if this one has scripts.
spawninit(s_ow, actor, nullptr);
actor->flags3 &= ~SFLAG3_SIMPLEINIT; // from now on act normally.
}
return actor;
}

View file

@ -62,3 +62,11 @@ class DukeGlassPieces2 : DukeGlassPieces
}
}
class RedneckPopcorn : DukeGlassPieces
{
default
{
pic "POPCORN";
}
}

View file

@ -71,15 +71,6 @@ class RedneckJoe9000 : DukeActor
}
}
class RedneckPopcorn : DukeActor
{
default
{
pic "POPCORN";
}
}
class RedneckBellSwitch : DukeActor
{
default

View file

@ -253,7 +253,7 @@ class DukeActor : CoreActor native
virtual void Initialize()
{
if (!self.badguy() && self.scripted())
if (!self.bSIMPLEINIT && !self.badguy() && self.scripted())
{
if (!self.mapSpawned) self.lotag = 0;