diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 68546f671..e0c4a0bbc 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -529,7 +529,7 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg, extracolormap_t *colo return (FUINT)finallight; } -static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t *sector, const boolean fof) +static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t *sector, const boolean reverseLight) { INT16 finallight = lightnum; @@ -539,7 +539,7 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t if (slope != NULL && sector != NULL && HWR_ApplyLightOffset(lightnum, sector)) { const INT16 offset = (cv_glfakecontrast.value == 2) ? slope->hwLightOffset : ((INT16)slope->lightOffset * 8); - finallight += (fof ? -offset : offset); + finallight += ((reverseLight && maplighting.directional) ? -offset : offset); finallight = CLAMP(finallight, 0, 255); } @@ -703,7 +703,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool SETUP3DVERT(v3d, pv->x, pv->y); if (slope) - lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL)); + lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector && !isceiling) || (!FOFsector && isceiling)); HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));