R_ProjectSprite: make sprite clipping work with sloped fake floors/ceilings

1849d5aade
This commit is contained in:
NepDisk 2025-11-29 17:00:12 -05:00
parent 116407f68a
commit 9b99d2fd91
2 changed files with 22 additions and 12 deletions

View file

@ -5072,13 +5072,18 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{
if (gl_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ?
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) :
gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight))
fixed_t secheight;
secheight = P_GetSectorFloorZAt(&sectors[heightsec], viewx, viewy);
if (viewz < P_GetSectorFloorZAt(&sectors[phs], interp.x, interp.y) ?
interp.z >= secheight :
gzt < secheight)
return;
if (gl_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ?
gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gl_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) :
FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight))
secheight = P_GetSectorCeilingZAt(&sectors[heightsec], viewx, viewy);
if (viewz > P_GetSectorCeilingZAt(&sectors[phs], interp.x, interp.y) ?
gzt < secheight && viewz >= secheight :
interp.z >= secheight)
return;
}

View file

@ -2412,13 +2412,18 @@ static void R_ProjectSprite(mobj_t *thing)
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{
if (viewz < sectors[phs].floorheight ?
interp.z >= sectors[heightsec].floorheight :
gzt < sectors[heightsec].floorheight)
fixed_t secheight;
secheight = P_GetSectorFloorZAt(&sectors[heightsec], viewx, viewy);
if (viewz < P_GetSectorFloorZAt(&sectors[phs], interp.x, interp.y) ?
interp.z >= secheight :
gzt < secheight)
return;
if (viewz > sectors[phs].ceilingheight ?
gzt < sectors[heightsec].ceilingheight && viewz >= sectors[heightsec].ceilingheight :
interp.z >= sectors[heightsec].ceilingheight)
secheight = P_GetSectorCeilingZAt(&sectors[heightsec], viewx, viewy);
if (viewz > P_GetSectorCeilingZAt(&sectors[phs], interp.x, interp.y) ?
gzt < secheight && viewz >= secheight :
interp.z >= secheight)
return;
}