diff --git a/src/p_map.c b/src/p_map.c index 39d4e5e7f..ae2b959a8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2394,15 +2394,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); + INT32 special = 0; + if (thing->player) { + special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1); + // If using type Section1:13, double the maxstep. if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + || special == 13) maxstep <<= 1; // If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls) else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12) + || special == 12) maxstep = 0; } @@ -2448,7 +2452,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (maxstep > 0 && !( thing->player && ( P_PlayerTouchingSectorSpecial(thing->player, 1, 14) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + || special == 14) )) // Step down { // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS @@ -2614,7 +2618,6 @@ static boolean P_ThingHeightClip(mobj_t *thing) { boolean floormoved; fixed_t oldfloorz = thing->floorz; - boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); if (thing->flags & MF_NOCLIPHEIGHT) return true; @@ -2635,6 +2638,8 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (tmfloorz > oldfloorz+thing->height) return true; + const boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); + if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved) { if (thing->eflags & MFE_VERTICALFLIP) @@ -3949,9 +3954,9 @@ void P_DelSeclist(msecnode_t *node) static inline boolean PIT_GetSectors(line_t *ld) { - if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || - tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] || - tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || + if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || + tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] || + tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) return true; @@ -4071,7 +4076,7 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y) * Must clear tmthing at tic end, as it might contain a pointer to a removed thinker, or the level might have ended/been ended and we clear the objects it was pointing too. Hopefully we don't need to carry this between tics for sync. */ void P_MapStart(void) { - if (tmthing) + if (UNLIKELY(tmthing)) I_Error("P_MapStart: tmthing set!"); } diff --git a/src/p_mobj.c b/src/p_mobj.c index ff0a35949..476c96208 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9210,7 +9210,7 @@ void P_PushableThinker(mobj_t *mobj) sec = mobj->subsector->sector; - if (GETSECSPECIAL(sec->special, 2) == 1 && mobj->z == sec->floorheight) + if (mobj->z == sec->floorheight && GETSECSPECIAL(sec->special, 2) == 1) P_LinedefExecute(sec->tag, mobj, sec); { sector_t *sec2; diff --git a/src/p_user.c b/src/p_user.c index c3feff198..8fbaa204c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -795,7 +795,7 @@ boolean P_IsObjectInGoop(mobj_t *mo) // boolean P_IsObjectOnGround(mobj_t *mo) { - if (P_IsObjectInGoop(mo)) + if (UNLIKELY(P_IsObjectInGoop(mo))) { // but I don't want you to ever 'stand' while submerged in goo. // You're in constant vertical momentum, even if you get stuck on something.