From 1b3050028e182bbf68ce8c1c87f7a41997fa2091 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 8 May 2026 14:36:42 +0200 Subject: [PATCH] save a few mobjfloorz/ceilingz calls in some cases gave a small speedup on my test setup (+~3fps) on slopes those are rather expensive --- src/p_maputl.cpp | 14 +++++++++----- src/p_user.c | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 37b31c4ac..3bb205afa 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -823,16 +823,20 @@ void P_SetThingPosition(mobj_t *thing) // sector's floor is the same height. if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector) { - tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); - tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); - if (thing->eflags & MFE_VERTICALFLIP) { + tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); + if (thing->z + thing->height >= tceilz) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (thing->z <= tfloorz) - thing->eflags |= MFE_JUSTSTEPPEDDOWN; + else + { + tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); + + if (thing->z <= tfloorz) + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } } } diff --git a/src/p_user.c b/src/p_user.c index 9eddcc36d..3b2f90dd7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1513,11 +1513,12 @@ static void P_CheckBouncySectors(player_t *player) continue; // this sector type is required for FOFs to be bouncy topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); - bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); if (player->mo->z > topheight) continue; + bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); + if (player->mo->z + player->mo->height < bottomheight) continue;