From aea346f1f3bd85411ee9095099954c3dec554175 Mon Sep 17 00:00:00 2001 From: Boondorl <59555366+Boondorl@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:15:40 -0500 Subject: [PATCH] Improved Slam functionality: *Added ONLYSLAMSOLID flag to ignore non-solid Actors that aren't shootable while SKULLFLY is on. *Added Slam state that gets entered when slamming an Actor. --- src/namedef_custom.h | 1 + src/playsim/actor.h | 1 + src/playsim/p_mobj.cpp | 15 +++++++++++++-- src/scripting/thingdef_data.cpp | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/namedef_custom.h b/src/namedef_custom.h index 371e94377..16f6a022a 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -348,6 +348,7 @@ xx(Idle) xx(GenericFreezeDeath) xx(GenericCrush) xx(DieFromSpawn) +xx(Slam) // Bounce state names xx(Bounce) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 3bf44994d..731c97942 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -429,6 +429,7 @@ enum ActorFlag8 MF8_CROSSLINECHECK = 0x10000000, // [MC]Enables CanCrossLine virtual MF8_MASTERNOSEE = 0x20000000, // Don't show object in first person if their master is the current camera. MF8_ADDLIGHTLEVEL = 0x40000000, // [MC] Actor light level is additive with sector. + MF8_ONLYSLAMSOLID = 0x80000000, // [B] Things with skullfly will ignore non-solid Actors. }; // --- mobj.renderflags --- diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 588acf1ab..c731369b8 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -3140,6 +3140,12 @@ DEFINE_ACTION_FUNCTION(AActor, Howl) bool AActor::Slam (AActor *thing) { + if ((flags8 & MF8_ONLYSLAMSOLID) + && !(thing->flags & MF_SOLID) && !(thing->flags & MF_SHOOTABLE)) + { + return true; + } + flags &= ~MF_SKULLFLY; Vel.Zero(); if (health > 0) @@ -3152,8 +3158,13 @@ bool AActor::Slam (AActor *thing) // The charging monster may have died by the target's actions here. if (health > 0) { - if (SeeState != NULL && !(flags8 & MF8_RETARGETAFTERSLAM)) SetState (SeeState); - else SetIdle(); + FState *slam = FindState(NAME_Slam); + if (slam != NULL) + SetState(slam); + else if (SeeState != NULL && !(flags8 & MF8_RETARGETAFTERSLAM)) + SetState (SeeState); + else + SetIdle(); } } else diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 7eaebda6c..96a788da3 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -343,6 +343,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF8, CROSSLINECHECK, AActor, flags8), DEFINE_FLAG(MF8, MASTERNOSEE, AActor, flags8), DEFINE_FLAG(MF8, ADDLIGHTLEVEL, AActor, flags8), + DEFINE_FLAG(MF8, ONLYSLAMSOLID, AActor, flags8), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),