diff --git a/src/p_map.c b/src/p_map.c index 70aaa16ba..7f6fecac7 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1290,7 +1290,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) tm.ceilingrover = NULL; tm.ceilingslope = NULL; tm.ceilingpic = -1; - tm.floorthing = thing; // needed for side collision + P_SetTarget(&tm.floorthing, thing); // needed for side collision } else if (topz < tm.ceilingz && tm.thing->z <= thing->z+thing->height) { @@ -1298,7 +1298,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) tm.ceilingrover = NULL; tm.ceilingslope = NULL; tm.ceilingpic = -1; - tm.floorthing = thing; // thing we may stand on + P_SetTarget(&tm.floorthing, thing); // thing we may stand on } } else @@ -1334,7 +1334,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) tm.floorrover = NULL; tm.floorslope = NULL; tm.floorpic = -1; - tm.floorthing = thing; // needed for side collision + P_SetTarget(&tm.floorthing, thing); // needed for side collision } else if (topz > tm.floorz && tm.thing->z+tm.thing->height >= thing->z) { @@ -1342,7 +1342,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) tm.floorrover = NULL; tm.floorslope = NULL; tm.floorpic = -1; - tm.floorthing = thing; // thing we may stand on + P_SetTarget(&tm.floorthing, thing); // thing we may stand on } } } @@ -1878,8 +1878,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) } // tm.floorthing is set when tm.floorz comes from a thing's top - tm.floorthing = NULL; - tm.hitthing = NULL; + P_SetTarget(&tm.floorthing, NULL); + P_SetTarget(&tm.hitthing, NULL); validcount++; @@ -1898,9 +1898,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) for (by = yl; by <= yh; by++) { if (!P_BlockThingsIterator(bx, by, PIT_CheckThing)) + { blockval = false; + } else - tm.hitthing = tm.floorthing; + { + P_SetTarget(&tm.hitthing, tm.floorthing); + } + if (P_MobjWasRemoved(tm.thing)) return false; } @@ -2282,7 +2287,7 @@ BlockItReturn_t PIT_PushableMoved(mobj_t *thing) // These are all non-static map variables that are changed for each and every single mobj // See, changing player's momx/y would possibly trigger stuff as if the player were running somehow, so this must be done to keep the player standing // All this so players can ride gargoyles! - tm_t oldtm = {0}; + tm_t oldtm = tm; // Move the player P_TryMove(thing, thing->x + stand->momx, thing->y + stand->momy, true); @@ -2446,8 +2451,11 @@ increment_move if (tm.ceilingz - tm.floorz < thing->height) { - if (tm.floorthing) - tm.hitthing = tm.floorthing; + if (tm.floorthing != NULL) + { + P_SetTarget(&tm.hitthing, tm.floorthing); + } + return false; // doesn't fit } diff --git a/src/p_mobj.c b/src/p_mobj.c index 0e86c533f..8927f8093 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9027,7 +9027,9 @@ void P_MobjThinker(mobj_t *mobj) mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_SLOPELAUNCHED); - tm.floorthing = tm.hitthing = NULL; + // sal: what the hell? is there any reason this isn't done, like, literally ANYWHERE else? + P_SetTarget(&tm.floorthing, NULL); + P_SetTarget(&tm.hitthing, NULL); // Check for sector special actions P_CheckMobjTouchingSectorActions(mobj);