some tiny optimizations
This commit is contained in:
1 parent
267ccae3a9
commit
7b64b22012
3 files changed
+15
-10
No files matched your search
+13
-8
@@ -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!");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user