From 6ca806a8c0395e4283a7be477e9d1a06782317a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 31 Dec 2016 20:44:16 +0000 Subject: [PATCH] Fix FOF lighting being stupid with repeating midtextures. --- src/r_defs.h | 1 + src/r_segs.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/r_defs.h b/src/r_defs.h index 2c5860ee..e1ffca7e 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -203,6 +203,7 @@ typedef struct r_lightlist_s fixed_t heightstep; fixed_t botheight; fixed_t botheightstep; + fixed_t startheight; // for repeating midtextures INT16 lightlevel; extracolormap_t *extra_colormap; lighttable_t *rcolormap; diff --git a/src/r_segs.c b/src/r_segs.c index ab501082..8f271bfe 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -394,6 +394,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rlight->height = (centeryfrac) - FixedMul((light->height - viewz), spryscale); rlight->heightstep = -FixedMul(rw_scalestep, (light->height - viewz)); #endif + rlight->startheight = rlight->height; // keep starting value here to reset for each repeat rlight->lightlevel = *light->lightlevel; rlight->extra_colormap = light->extra_colormap; rlight->flags = light->flags; @@ -487,6 +488,14 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { rw_scalestep = ds->scalestep; spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + if (dc_numlights) + { // reset all lights to their starting heights + for (i = 0; i < dc_numlights; i++) + { + rlight = &dc_lightlist[i]; + rlight->height = rlight->startheight; + } + } } #ifndef ESLOPE