R_ProjectSprite: move fakeflat clipping before light maths

so if applicable we have slightly less work
This commit is contained in:
Alug committed 2025-11-27 17:43:40 +01:00
1 parent 306f7d455e
commit c81cd48552
1 file changed
+27 -23
+27 -23
View File
@@ -1612,6 +1612,33 @@ static void R_ProjectSprite(mobj_t *thing)
return;
}
// killough 3/27/98: exclude things totally separated
// from the viewer, by either water or fake ceilings
// killough 4/11/98: improve sprite clipping for underwater/fake ceilings
heightsec = thing->subsector->sector->heightsec;
if (viewplayer && viewplayer->mo && viewplayer->mo->subsector)
phs = viewplayer->mo->subsector->sector->heightsec;
else
phs = -1;
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{
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;
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;
}
if (thing->frame & FF_ABSOLUTELIGHTLEVEL)
{
const UINT8 n = R_ThingLightLevel(thing);
@@ -1689,29 +1716,6 @@ static void R_ProjectSprite(mobj_t *thing)
lights_array = scalelight[lightnum];
}
heightsec = thing->subsector->sector->heightsec;
if (viewplayer && viewplayer->mo && viewplayer->mo->subsector)
phs = viewplayer->mo->subsector->sector->heightsec;
else
phs = -1;
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{
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;
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;
}
// store information in a vissprite
vis = R_NewVisSprite();
vis->heightsec = heightsec; //SoM: 3/17/2000