smol fix to slope light

This commit is contained in:
Alug committed 2024-08-17 16:31:09 +02:00
1 parent 87176cfd0b
commit 164d7399d2
3 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -434,12 +434,12 @@ static inline float P_SegLengthFloat(seg_t *seg)
void P_UpdateSegLightOffset(seg_t *li)
{
const UINT8 contrast = 8;
const fixed_t contrastFixed = ((fixed_t)contrast) * FRACUNIT;
fixed_t light = FRACUNIT;
fixed_t extralight = 0;
extralight = -((fixed_t)contrast*FRACUNIT) +
FixedDiv(AngleFixed(R_PointToAngle2(0, 0,
abs(li->v1->x - li->v2->x),
abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * ((fixed_t)contrast * 2);
light = FixedDiv(R_PointToAngle2(0, 0, abs(li->v1->x - li->v2->x), abs(li->v1->y - li->v2->y)), ANGLE_90);
extralight = -contrastFixed + FixedMul(light, contrastFixed * 2);
// Between -2 and 2 for software, -8 and 8 for hardware
li->lightOffset = FixedFloor((extralight / contrast) + (FRACUNIT / 2)) / FRACUNIT;
+1 -1
View File
@@ -52,7 +52,7 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
zMul = min(FRACUNIT, abs(slope->zdelta)*3/2); // *3/2, to make 60 degree slopes match walls.
contrastFixed = FixedMul(contrastFixed, zMul);
extralight = -contrastFixed + FixedMul(FixedDiv(AngleFixed(slopeDir), 90*FRACUNIT), (contrastFixed * 2));
extralight = -contrastFixed + FixedMul(FixedDiv(AngleFixed(slopeDir), ANGLE_90), (contrastFixed * 2));
// Between -2 and 2 for software, -8 and 8 for hardware
slope->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT;
+1 -1
View File
@@ -421,7 +421,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
if (slope != NULL)
{
lightlevel += (slope->lightOffset / 8);
lightlevel += slope->lightOffset * 8;
}
// This appears to fix the Nimbus Ruins sky bug.