diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index 1f14f8e6add..c86f8016cf3 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -352,14 +352,8 @@ inline double DEHToDouble(int acsval) static void PushTouchedActor(PClassActor *cls) { - for(unsigned i = 0; i < TouchedActors.Size(); i++) - { - if (TouchedActors[i] == cls) - { - return; - } - } - TouchedActors.Push(cls); + if (TouchedActors.Find(cls) == TouchedActors.Size()) + TouchedActors.Push(cls); } @@ -3012,6 +3006,13 @@ void FinishDehPatch () unsigned int touchedIndex; unsigned int nameindex = 0; + // For compatibility all potentially altered actors now using A_SkullFly need to be set to the original slamming behavior. + // Since this flag does not affect anything else let's just set it for everything, it will just be ignored by non-charging things. + for (auto cls : InfoNames) + { + GetDefaultByType(cls)->flags8 |= MF8_RETARGETAFTERSLAM; + } + for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex) { PClassActor *subclass; @@ -3077,10 +3078,8 @@ void FinishDehPatch () } } // Now that all Dehacked patches have been processed, it's okay to free StateMap. - StateMap.Clear(); - StateMap.ShrinkToFit(); - TouchedActors.Clear(); - TouchedActors.ShrinkToFit(); + StateMap.Reset(); + TouchedActors.Reset(); EnglishStrings.Clear(); GStrings.SetDehackedStrings(std::move(DehStrings)); diff --git a/src/playsim/actor.h b/src/playsim/actor.h index bc61966d0d4..e2114d109f2 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -409,6 +409,7 @@ enum ActorFlag8 MF8_HITOWNER = 0x00000010, // projectile can hit the actor that fired it MF8_NOFRICTION = 0x00000020, // friction doesn't apply to the actor at all MF8_NOFRICTIONBOUNCE = 0x00000040, // don't bounce off walls when on icy floors + MF8_RETARGETAFTERSLAM = 0x00000080 // Forces jumping to the idle state after slamming into something }; // --- mobj.renderflags --- diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 10a420fa727..6fce5d039d5 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -3132,7 +3132,7 @@ bool AActor::Slam (AActor *thing) // The charging monster may have died by the target's actions here. if (health > 0) { - if (SeeState != NULL) SetState (SeeState); + if (SeeState != NULL && !(flags8 & MF8_RETARGETAFTERSLAM)) SetState (SeeState); else SetIdle(); } } diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 7eed56ad758..43982bc25fd 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -321,6 +321,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF8, HITOWNER, AActor, flags8), DEFINE_FLAG(MF8, NOFRICTION, AActor, flags8), DEFINE_FLAG(MF8, NOFRICTIONBOUNCE, AActor, flags8), + DEFINE_FLAG(MF8, RETARGETAFTERSLAM, AActor, flags8), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), diff --git a/wadsrc/static/zscript/actors/doom/lostsoul.zs b/wadsrc/static/zscript/actors/doom/lostsoul.zs index 89086bf17fb..055781079f0 100644 --- a/wadsrc/static/zscript/actors/doom/lostsoul.zs +++ b/wadsrc/static/zscript/actors/doom/lostsoul.zs @@ -15,7 +15,7 @@ class LostSoul : Actor Damage 3; PainChance 256; Monster; - +FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH +ZDOOMTRANS; + +FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH +ZDOOMTRANS +RETARGETAFTERSLAM AttackSound "skull/melee"; PainSound "skull/pain"; DeathSound "skull/death";