mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fully fix drop shadows
It used the thing's floorz / ceilingz directly -- that wouldn't account for interpolated coordinates.
This commit is contained in:
parent
6b84557b78
commit
0adea2279b
1 changed files with 12 additions and 9 deletions
|
|
@ -1152,14 +1152,17 @@ fixed_t R_GetShadowZ(
|
||||||
mobj_t *thing, pslope_t **shadowslope,
|
mobj_t *thing, pslope_t **shadowslope,
|
||||||
fixed_t interpx, fixed_t interpy, fixed_t interpz)
|
fixed_t interpx, fixed_t interpy, fixed_t interpz)
|
||||||
{
|
{
|
||||||
|
fixed_t halfHeight = interpz + (thing->height >> 1);
|
||||||
boolean isflipped = thing->eflags & MFE_VERTICALFLIP;
|
boolean isflipped = thing->eflags & MFE_VERTICALFLIP;
|
||||||
|
fixed_t floorz = P_GetFloorZ(thing, thing->subsector->sector, interpx, interpy, NULL);
|
||||||
|
fixed_t ceilingz = P_GetCeilingZ(thing, thing->subsector->sector, interpx, interpy, NULL);
|
||||||
fixed_t z, groundz = isflipped ? INT32_MAX : INT32_MIN;
|
fixed_t z, groundz = isflipped ? INT32_MAX : INT32_MIN;
|
||||||
pslope_t *slope, *groundslope = NULL;
|
pslope_t *slope, *groundslope = NULL;
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
|
||||||
#define CHECKZ (isflipped ? z > interpz+thing->height/2 && z < groundz : z < interpz+thing->height/2 && z > groundz)
|
#define CHECKZ (isflipped ? z > halfHeight && z < groundz : z < halfHeight && z > groundz)
|
||||||
|
|
||||||
for (node = thing->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = thing->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
|
|
@ -1194,10 +1197,10 @@ fixed_t R_GetShadowZ(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isflipped ? (thing->ceilingz < groundz - (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2)))
|
if (isflipped ? (ceilingz < groundz - (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2)))
|
||||||
: (thing->floorz > groundz + (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2))))
|
: (floorz > groundz + (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2))))
|
||||||
{
|
{
|
||||||
groundz = isflipped ? thing->ceilingz : thing->floorz;
|
groundz = isflipped ? ceilingz : floorz;
|
||||||
groundslope = NULL;
|
groundslope = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1208,10 +1211,10 @@ fixed_t R_GetShadowZ(
|
||||||
{
|
{
|
||||||
INT32 xl, xh, yl, yh, bx, by;
|
INT32 xl, xh, yl, yh, bx, by;
|
||||||
|
|
||||||
xl = (unsigned)(thing->x - thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
xl = (unsigned)(interpx - thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||||
xh = (unsigned)(thing->x + thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
xh = (unsigned)(interpx + thing->radius - bmaporgx)>>MAPBLOCKSHIFT;
|
||||||
yl = (unsigned)(thing->y - thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
yl = (unsigned)(interpy - thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||||
yh = (unsigned)(thing->y + thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
yh = (unsigned)(interpy + thing->radius - bmaporgy)>>MAPBLOCKSHIFT;
|
||||||
|
|
||||||
BMBOUNDFIX(xl, xh, yl, yh);
|
BMBOUNDFIX(xl, xh, yl, yh);
|
||||||
|
|
||||||
|
|
@ -1248,7 +1251,7 @@ fixed_t R_GetShadowZ(
|
||||||
// We're inside it! Yess...
|
// We're inside it! Yess...
|
||||||
z = po->lines[0]->backsector->ceilingheight;
|
z = po->lines[0]->backsector->ceilingheight;
|
||||||
|
|
||||||
if (z < thing->z+thing->height/2 && z > groundz)
|
if (z < halfHeight && z > groundz)
|
||||||
{
|
{
|
||||||
groundz = z;
|
groundz = z;
|
||||||
groundslope = NULL;
|
groundslope = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue