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.
This commit is contained in:
Boondorl 2022-11-10 16:15:40 -05:00 committed by Christoph Oelckers
parent 15e00f22e8
commit aea346f1f3
4 changed files with 16 additions and 2 deletions

View file

@ -348,6 +348,7 @@ xx(Idle)
xx(GenericFreezeDeath)
xx(GenericCrush)
xx(DieFromSpawn)
xx(Slam)
// Bounce state names
xx(Bounce)

View file

@ -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 ---

View file

@ -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

View file

@ -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),