mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Merge branch 'remove-maxradius' into 'next'
Remove MAXRADIUS adjustment from bounding box calculations See merge request STJr/SRB2!2566
This commit is contained in:
commit
14606ebe30
5 changed files with 43 additions and 55 deletions
|
@ -254,11 +254,10 @@ static int lib_searchBlockmap(lua_State *L)
|
|||
}
|
||||
else // mobj and function only - search around mobj's radius by default
|
||||
{
|
||||
fixed_t radius = mobj->radius + MAXRADIUS;
|
||||
x1 = mobj->x - radius;
|
||||
x2 = mobj->x + radius;
|
||||
y1 = mobj->y - radius;
|
||||
y2 = mobj->y + radius;
|
||||
x1 = mobj->x - mobj->radius;
|
||||
x2 = mobj->x + mobj->radius;
|
||||
y1 = mobj->y - mobj->radius;
|
||||
y2 = mobj->y + mobj->radius;
|
||||
}
|
||||
lua_settop(L, 2); // pop everything except function, mobj
|
||||
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
|
||||
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
|
||||
|
||||
// MAXRADIUS is for precalculated sector block boxes
|
||||
// the spider demon is larger,
|
||||
// but we do not have any moving sectors nearby
|
||||
#define MAXRADIUS (32*FRACUNIT)
|
||||
|
||||
// max Z move up or down without jumping
|
||||
// above this, a height difference is considered as a 'dropoff'
|
||||
#define MAXSTEPMOVE (24*FRACUNIT)
|
||||
|
|
66
src/p_map.c
66
src/p_map.c
|
@ -36,6 +36,9 @@
|
|||
|
||||
#include "m_perfstats.h" // ps_checkposition_calls
|
||||
|
||||
// Formerly called MAXRADIUS
|
||||
#define MAXTRYMOVE (32*FRACUNIT)
|
||||
|
||||
fixed_t tmbbox[4];
|
||||
mobj_t *tmthing;
|
||||
static INT32 tmflags;
|
||||
|
@ -2165,15 +2168,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
}
|
||||
}
|
||||
|
||||
// The bounding box is extended by MAXRADIUS
|
||||
// because mobj_ts are grouped into mapblocks
|
||||
// based on their origin point, and can overlap
|
||||
// into adjacent blocks by up to MAXRADIUS units.
|
||||
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -2393,11 +2391,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
}
|
||||
}
|
||||
|
||||
// The bounding box is extended by MAXRADIUS
|
||||
// because mobj_ts are grouped into mapblocks
|
||||
// based on their origin point, and can overlap
|
||||
// into adjacent blocks by up to MAXRADIUS units.
|
||||
|
||||
xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
@ -2528,16 +2521,16 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
}
|
||||
|
||||
do {
|
||||
if (x-tryx > MAXRADIUS)
|
||||
tryx += MAXRADIUS;
|
||||
else if (x-tryx < -MAXRADIUS)
|
||||
tryx -= MAXRADIUS;
|
||||
if (x-tryx > MAXTRYMOVE)
|
||||
tryx += MAXTRYMOVE;
|
||||
else if (x-tryx < -MAXTRYMOVE)
|
||||
tryx -= MAXTRYMOVE;
|
||||
else
|
||||
tryx = x;
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
tryy -= MAXRADIUS;
|
||||
if (y-tryy > MAXTRYMOVE)
|
||||
tryy += MAXTRYMOVE;
|
||||
else if (y-tryy < -MAXTRYMOVE)
|
||||
tryy -= MAXTRYMOVE;
|
||||
else
|
||||
tryy = y;
|
||||
|
||||
|
@ -2683,7 +2676,7 @@ increment_move
|
|||
floatok = false;
|
||||
|
||||
// This makes sure that there are no freezes from computing extremely small movements.
|
||||
// Originally was MAXRADIUS/2, but that can cause some bad inconsistencies for small players.
|
||||
// Originally was MAXTRYMOVE/2, but that can cause some bad inconsistencies for small players.
|
||||
radius = max(radius, thing->scale);
|
||||
|
||||
// And we also have to prevent Big Large (tm) movements, as those can skip too far
|
||||
|
@ -2872,10 +2865,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
{
|
||||
INT32 xl, xh, yl, yh;
|
||||
|
||||
yh = (unsigned)(thing->y + MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(thing->y - MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(thing->x + MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(thing->x - MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(thing->y + thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(thing->y - thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(thing->x + thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(thing->x - thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
|
@ -2947,16 +2940,16 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tryx = thing->x;
|
||||
tryy = thing->y;
|
||||
do {
|
||||
if (x-tryx > MAXRADIUS)
|
||||
tryx += MAXRADIUS;
|
||||
else if (x-tryx < -MAXRADIUS)
|
||||
tryx -= MAXRADIUS;
|
||||
if (x-tryx > MAXTRYMOVE)
|
||||
tryx += MAXTRYMOVE;
|
||||
else if (x-tryx < -MAXTRYMOVE)
|
||||
tryx -= MAXTRYMOVE;
|
||||
else
|
||||
tryx = x;
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
tryy -= MAXRADIUS;
|
||||
if (y-tryy > MAXTRYMOVE)
|
||||
tryy += MAXTRYMOVE;
|
||||
else if (y-tryy < -MAXTRYMOVE)
|
||||
tryy -= MAXTRYMOVE;
|
||||
else
|
||||
tryy = y;
|
||||
|
||||
|
@ -4215,7 +4208,8 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 dama
|
|||
INT32 xl, xh, yl, yh;
|
||||
fixed_t dist;
|
||||
|
||||
dist = FixedMul(damagedist, spot->scale) + MAXRADIUS;
|
||||
dist = FixedMul(damagedist, spot->scale);
|
||||
|
||||
yh = (unsigned)(spot->y + dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(spot->x + dist - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
|
|
|
@ -9337,10 +9337,10 @@ static void P_PointPushThink(mobj_t *mobj)
|
|||
radius = mobj->spawnpoint->args[0] << FRACBITS;
|
||||
|
||||
pushmobj = mobj;
|
||||
xl = (unsigned)(mobj->x - radius - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(mobj->x + radius - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(mobj->y - radius - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(mobj->y + radius - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
xl = (unsigned)(mobj->x - radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
xh = (unsigned)(mobj->x + radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(mobj->y - radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(mobj->y + radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
P_DoBlockThingsIterate(xl, yl, xh, yh, PIT_PushThing);
|
||||
}
|
||||
|
|
|
@ -927,11 +927,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line)
|
|||
if (!(po->flags & POF_SOLID))
|
||||
return hitflags;
|
||||
|
||||
// adjust linedef bounding box to blockmap, extend by MAXRADIUS
|
||||
linebox[BOXLEFT] = (unsigned)(line->bbox[BOXLEFT] - bmaporgx - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXRIGHT] = (unsigned)(line->bbox[BOXRIGHT] - bmaporgx + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXBOTTOM] = (unsigned)(line->bbox[BOXBOTTOM] - bmaporgy - MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXTOP] = (unsigned)(line->bbox[BOXTOP] - bmaporgy + MAXRADIUS) >> MAPBLOCKSHIFT;
|
||||
// adjust linedef bounding box to blockmap
|
||||
linebox[BOXLEFT] = (unsigned)(line->bbox[BOXLEFT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXRIGHT] = (unsigned)(line->bbox[BOXRIGHT] - bmaporgx) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXBOTTOM] = (unsigned)(line->bbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
linebox[BOXTOP] = (unsigned)(line->bbox[BOXTOP] - bmaporgy) >> MAPBLOCKSHIFT;
|
||||
|
||||
// check all mobj blockmap cells the line contacts
|
||||
for (y = linebox[BOXBOTTOM]; y <= linebox[BOXTOP]; ++y)
|
||||
|
|
Loading…
Reference in a new issue