Dont always call R_PointInSubsector if thing has not moved in P_CheckPosition

https://github.com/Indev450/SRB2Kart-Saturn/pull/148
This commit is contained in:
NepDisk 2025-06-28 23:28:26 -04:00
parent e2524356da
commit e456d59c0e
2 changed files with 28 additions and 8 deletions

View file

@ -1783,7 +1783,11 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *re
g_tm.bbox[BOXRIGHT] = x + g_tm.thing->radius;
g_tm.bbox[BOXLEFT] = x - g_tm.thing->radius;
newsubsec = R_PointInSubsector(x, y);
if (thing->x != x || thing->y != y || thing->subsector == NULL)
newsubsec = R_PointInSubsector(x, y);
else
newsubsec = thing->subsector;
g_tm.ceilingline = NULL;
g_tm.blocking = false;
@ -1821,7 +1825,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *re
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
{
fixed_t topheight, bottomheight;
fixed_t topheight, bottomheight, midheight;
if (!(rover->fofflags & FOF_EXISTS))
continue;
@ -1895,10 +1899,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *re
continue;
}
delta1 = thing->z - (bottomheight
+ ((topheight - bottomheight)/2));
delta2 = thingtop - (bottomheight
+ ((topheight - bottomheight)/2));
midheight = (bottomheight + ((topheight - bottomheight)/2));
delta1 = thing->z - midheight;
delta2 = thingtop - midheight;
if (topheight > g_tm.floorz && abs(delta1) < abs(delta2)
&& !(rover->fofflags & FOF_REVERSEPLATFORM))
@ -1936,6 +1940,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *re
BMBOUNDFIX(xl, xh, yl, yh);
// Check polyobjects and see if g_tm.floorz/g_tm.ceilingz need to be altered
// do we really have to iterate through the complete blockmap for polyobjects if there are no polyobjects on the map?
if (numPolyObjects)
{
validcount++;
@ -2122,7 +2128,11 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
g_tm.bbox[BOXRIGHT] = x + thiscam->radius;
g_tm.bbox[BOXLEFT] = x - thiscam->radius;
newsubsec = R_PointInSubsector(x, y);
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
newsubsec = R_PointInSubsector(x, y);
else
newsubsec = thiscam->subsector;
g_tm.ceilingline = NULL;
mapcampointer = thiscam;
@ -2201,6 +2211,8 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
BMBOUNDFIX(xl, xh, yl, yh);
// Check polyobjects and see if g_tm.floorz/g_tm.ceilingz need to be altered
// do we really have to iterate through the complete blockmap for polyobjects if there are no polyobjects on the map?
if (numPolyObjects)
{
validcount++;
@ -2292,7 +2304,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
//
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
{
subsector_t *s = R_PointInSubsector(x, y);
subsector_t *s = NULL;
boolean retval = true;
UINT8 i;
@ -2352,6 +2364,11 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
g_tm.floatok = true;
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
s = R_PointInSubsector(x, y);
else
s = thiscam->subsector;
if (g_tm.ceilingz - thiscam->z < thiscam->height)
{
if (s == thiscam->subsector && g_tm.ceilingz >= thiscam->z)

View file

@ -2648,6 +2648,9 @@ static boolean P_PlayerPolyObjectZMovement(mobj_t *mo)
msecnode_t *node;
boolean stopmovecut = false;
if (!numPolyObjects)
return false;
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
sector_t *sec = node->m_sector;