This commit is contained in:
Major Cooke 2023-01-21 11:32:54 -06:00
parent 9535d12982
commit bf803ce2e9
5 changed files with 13 additions and 6 deletions

View file

@ -285,7 +285,7 @@ void FLevelLocals::ClearLevelData(bool fullgc)
auto it = GetThinkerIterator<AActor>(NAME_None, STAT_TRAVELLING);
for (AActor *actor = it.Next(); actor != nullptr; actor = it.Next())
{
actor->BlockingLine = nullptr;
actor->BlockingLine = actor->MovementBlockingLine = nullptr;
actor->BlockingFloor = actor->BlockingCeiling = actor->Blocking3DFloor = nullptr;
}
}

View file

@ -1215,6 +1215,7 @@ public:
AActor *BlockingMobj; // Actor that blocked the last move
line_t *BlockingLine; // Line that blocked the last move
line_t *MovementBlockingLine; // Line that stopped the Actor's movement in P_XYMovement
sector_t *Blocking3DFloor; // 3D floor that blocked the last move (if any)
sector_t *BlockingCeiling; // Sector that blocked the last move (ceiling plane slope)
sector_t *BlockingFloor; // Sector that blocked the last move (floor plane slope)

View file

@ -310,6 +310,7 @@ void AActor::Serialize(FSerializer &arc)
A("smokecounter", smokecounter)
("blockingmobj", BlockingMobj)
A("blockingline", BlockingLine)
A("movementblockingline", MovementBlockingLine)
A("blocking3dfloor", Blocking3DFloor)
A("blockingceiling", BlockingCeiling)
A("blockingfloor", BlockingFloor)
@ -1967,7 +1968,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
{
// blocked move
AActor *BlockingMobj = mo->BlockingMobj;
line_t *BlockingLine = mo->BlockingLine;
line_t *BlockingLine = mo->MovementBlockingLine = mo->BlockingLine;
// [ZZ]
if (!BlockingLine && !BlockingMobj) // hit floor or ceiling while XY movement - sector actions
@ -4038,6 +4039,7 @@ void AActor::Tick ()
// Handle X and Y velocities
BlockingMobj = nullptr;
MovementBlockingLine = nullptr;
sector_t* oldBlockingCeiling = BlockingCeiling;
sector_t* oldBlockingFloor = BlockingFloor;
Blocking3DFloor = nullptr;

View file

@ -1539,20 +1539,21 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, LookForPlayers, P_LookForPlayers)
ACTION_RETURN_BOOL(P_LookForPlayers(self, allaround, params));
}
static int CheckMonsterUseSpecials(AActor *self)
static int CheckMonsterUseSpecials(AActor *self, line_t *blocking)
{
spechit_t spec;
int good = 0;
if (!(self->flags6 & MF6_NOTRIGGER))
{
auto checkLine = blocking ? blocking : self->BlockingLine;
while (spechit.Pop (spec))
{
// [RH] let monsters push lines, as well as use them
if (((self->flags4 & MF4_CANUSEWALLS) && P_ActivateLine (spec.line, self, 0, SPAC_Use)) ||
((self->flags2 & MF2_PUSHWALL) && P_ActivateLine (spec.line, self, 0, SPAC_Push)))
{
good |= spec.line == self->BlockingLine ? 1 : 2;
good |= spec.line == checkLine ? 1 : 2;
}
}
}
@ -1564,8 +1565,9 @@ static int CheckMonsterUseSpecials(AActor *self)
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckMonsterUseSpecials, CheckMonsterUseSpecials)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_POINTER(blocking, line_t);
ACTION_RETURN_INT(CheckMonsterUseSpecials(self));
ACTION_RETURN_INT(CheckMonsterUseSpecials(self, blocking));
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_Wander, A_Wander)
@ -2055,6 +2057,7 @@ DEFINE_FIELD(AActor, lastbump)
DEFINE_FIELD(AActor, DesignatedTeam)
DEFINE_FIELD(AActor, BlockingMobj)
DEFINE_FIELD(AActor, BlockingLine)
DEFINE_FIELD(AActor, MovementBlockingLine)
DEFINE_FIELD(AActor, Blocking3DFloor)
DEFINE_FIELD(AActor, BlockingCeiling)
DEFINE_FIELD(AActor, BlockingFloor)

View file

@ -202,6 +202,7 @@ class Actor : Thinker native
native int DesignatedTeam;
native Actor BlockingMobj;
native Line BlockingLine;
native Line MovementBlockingLine;
native Sector Blocking3DFloor;
native Sector BlockingCeiling;
native Sector BlockingFloor;
@ -698,7 +699,7 @@ class Actor : Thinker native
native void CheckFakeFloorTriggers (double oldz, bool oldz_has_viewheight = false);
native bool CheckFor3DFloorHit(double z, bool trigger);
native bool CheckFor3DCeilingHit(double z, bool trigger);
native int CheckMonsterUseSpecials();
native int CheckMonsterUseSpecials(Line blocking = null);
native bool CheckMissileSpawn(double maxdist);
native bool CheckPosition(Vector2 pos, bool actorsonly = false, FCheckPosition tm = null);