Skip to content

Commit

Permalink
Localized fix to its own field
Browse files Browse the repository at this point in the history
  • Loading branch information
Boondorl authored and madame-rachelle committed Aug 2, 2023
1 parent 0cbbaec commit fe1acc7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/p_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ class AActor final : public DThinker

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)
Expand Down
9 changes: 3 additions & 6 deletions src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1971,7 +1972,6 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
FCheckPosition tm(!!(mo->flags2 & MF2_RIP));

DAngle oldangle = mo->Angles.Yaw;
line_t* blocker = nullptr;
do
{
if (mo->Level->i_compatflags & COMPATF_WALLRUN) pushtime++;
Expand All @@ -1987,7 +1987,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
{
// blocked move
AActor *BlockingMobj = mo->BlockingMobj;
line_t *BlockingLine = blocker = mo->BlockingLine;
line_t *BlockingLine = mo->MovementBlockingLine = mo->BlockingLine;

// [ZZ]
if (!BlockingLine && !BlockingMobj) // hit floor or ceiling while XY movement - sector actions
Expand Down Expand Up @@ -2189,9 +2189,6 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
}
} while (++step <= steps);

// Correctly update whether the Actor was truly blocked by a wall or not
mo->BlockingLine = blocker;

// Friction

if (player && player->mo == mo && player->cheats & CF_NOVELOCITY)
Expand Down Expand Up @@ -4061,7 +4058,7 @@ void AActor::Tick ()

// Handle X and Y velocities
BlockingMobj = nullptr;
BlockingLine = nullptr;
MovementBlockingLine = nullptr;
sector_t* oldBlockingCeiling = BlockingCeiling;
sector_t* oldBlockingFloor = BlockingFloor;
Blocking3DFloor = nullptr;
Expand Down
9 changes: 6 additions & 3 deletions src/scripting/vmthunks_actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fe1acc7

Please sign in to comment.