diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 5f7e6838f..3ea2d5502 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -532,7 +532,6 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t if (slope != NULL && sector != NULL && P_ApplyLightOffsetFine(lightnum, sector)) { const INT16 offset = (cv_glfakecontrast.value == 2) ? slope->hwLightOffset : ((INT16)slope->lightOffset * 8); - finallight += (fof ? -offset : offset); finallight = CLAMP(finallight, 0, 255); } diff --git a/src/p_slopes.c b/src/p_slopes.c index 52a262785..6d2a8c2c7 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -66,22 +66,22 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope) nY = FixedDiv(nY, nLen); /* - * if (slope is ceiling) - * { - * // There is no good way to calculate this condition here. - * // We reverse it in R_FindPlane now. - * nX = -nX; - * nY = -nY; - * } - */ + if (slope is ceiling) + { + // There is no good way to calculate this condition here. + // We reverse it in R_FindPlane now. + nX = -nX; + nY = -nY; + } + */ light = FixedMul(nX, FINECOSINE(maplighting.angle >> ANGLETOFINESHIFT)) + FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT)); - light = (light + FRACUNIT) / 2; + light = (light + FRACUNIT) / 2; } else { - light = FixedDiv(R_PointToAngle2(0, 0, abs(slope->d.x), abs(slope->d.y)), ANGLE_90); + light = FixedDiv(R_PointToAngle2(0, 0, abs(slope->normal.y), abs(slope->normal.x)), ANGLE_90); } const int delta = abs(slope->zdelta)*3/2; // *3/2, to make 60 degree slopes match walls. diff --git a/src/r_plane.cpp b/src/r_plane.cpp index df289faa0..45b021a7b 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -350,8 +350,8 @@ void R_ClearPlanes(void) angle = (viewangle-ANGLE_90)>>ANGLETOFINESHIFT; // scale will be unit scale at SCREENWIDTH/2 distance - basexscale = FixedDiv (FINECOSINE(angle), centerxfrac); - baseyscale = -FixedDiv (FINESINE(angle), centerxfrac); + basexscale = FixedDiv(FINECOSINE(angle), centerxfrac); + baseyscale = -FixedDiv(FINESINE(angle), centerxfrac); } static visplane_t *new_visplane(unsigned hash) @@ -440,20 +440,20 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, } } + if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT, lighting_sector)) + { + if (reverseLight && maplighting.directional == true) + { + lightlevel -= slope->lightOffset * 8; + } + else + { + lightlevel += slope->lightOffset * 8; + } + } + if (!pfloor) { - if (slope != NULL && P_ApplyLightOffset(lightlevel >> LIGHTSEGSHIFT, lighting_sector)) - { - if (reverseLight) - { - lightlevel -= slope->lightOffset * 8; - } - else - { - lightlevel += slope->lightOffset * 8; - } - } - hash = visplane_hash(picnum, lightlevel, height >> FRACBITS); for (check = visplanes[hash]; check; check = check->next)