Navigation Menu

Skip to content

Commit

Permalink
- fixed the extremely long standing bug that Lost Souls didn't reacqu…
Browse files Browse the repository at this point in the history
…ire their target when slamming into something.

This was one of that annoying old design mistakes where Doom and Heretic features were poorly merged together. The Heretic Gargoyle uses very similar coding but performs a subtly different action when actually hitting another actor. This different action was made the default, even for the Lost Soul.
It has now been changed that both monsters use their original action, being distinguished by an actor flag. For compatibility with custom definitions Heretic's behavior, which has been the default in ZDoom will be the preferred one. The one of the Lost Soul can be reactivated by a flag.
  • Loading branch information
coelckers committed Aug 11, 2019
1 parent 5953f49 commit cf74118
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
23 changes: 11 additions & 12 deletions src/gamedata/d_dehacked.cpp
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand Down
1 change: 1 addition & 0 deletions src/playsim/actor.h
Expand Up @@ -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 ---
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_mobj.cpp
Expand Up @@ -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();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/scripting/thingdef_data.cpp
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/doom/lostsoul.zs
Expand Up @@ -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";
Expand Down

0 comments on commit cf74118

Please sign in to comment.