diff --git a/src/p_setup.c b/src/p_setup.c index a8ee275cf..69d7b3caa 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -582,9 +582,6 @@ static void P_LoadRawSegs(UINT8 *data) else li->backsector = 0; - li->numlights = 0; - li->rlights = NULL; - P_UpdateSegLightOffset(li); } } diff --git a/src/r_defs.h b/src/r_defs.h index abb875fcf..c130547db 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -558,9 +558,6 @@ typedef struct seg_s float flength; // length of the seg, used by hardware renderer #endif - // Why slow things down by calculating lightlists for every thick side? - size_t numlights; - r_lightlist_t *rlights; polyobj_t *polyseg; boolean dontrenderme; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index f01c026c9..557f753b4 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -31,6 +31,9 @@ #include "core/memory.h" #include "core/thread_pool.h" +#define HEIGHTBITS 12 +#define HEIGHTUNIT (1<numlights = frontsector->numlights; - if (dc->numlights >= dc->maxlights) + if (dc->numlights > dc->maxlights) { dc->maxlights = dc->numlights; - dc->lightlist = static_cast(Z_Realloc(dc->lightlist, sizeof (*dc->lightlist) * dc->maxlights, PU_STATIC, NULL)); + dc->lightlist = static_cast(Z_Frame_Alloc(sizeof (*dc->lightlist) * dc->maxlights)); } for (i = 0; i < dc->numlights; i++) @@ -666,10 +669,10 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf { dc->numlights = frontsector->numlights; - if (dc->numlights >= dc->maxlights) + if (dc->numlights > dc->maxlights) { dc->maxlights = dc->numlights; - dc->lightlist = static_cast(Z_Realloc(dc->lightlist, sizeof (*dc->lightlist) * dc->maxlights, PU_STATIC, NULL)); + dc->lightlist = static_cast(Z_Frame_Alloc(sizeof (*dc->lightlist) * dc->maxlights)); } for (i = p = 0; i < dc->numlights; i++) @@ -1136,8 +1139,6 @@ static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bott // textures. // CALLED: CORE LOOPING ROUTINE. // -#define HEIGHTBITS 12 -#define HEIGHTUNIT (1<numlights; dc.maxlights = dc.numlights; - - if (dc.numlights >= dc.maxlights) - { - dc.maxlights = dc.numlights; - dc.lightlist = static_cast(Z_Realloc(dc.lightlist, sizeof (*dc.lightlist) * dc.maxlights, PU_STATIC, NULL)); - } + dc.lightlist = static_cast(Z_Frame_Alloc(sizeof(*dc.lightlist) * dc.maxlights)); for (i = p = 0; i < dc.numlights; i++) {