From e8004238adab829f8618c67af7c56b1e3592d39c Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 19 Oct 2009 22:29:30 +0000 Subject: [PATCH] fix a crash when r_shadow_lightattenuation* cvars are changed which was not freeing shadowmaps before freeing the texture pool fix a bug where flickering/switchable lights always showed coronas git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9352 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 137e21cf..938f28e1 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -1694,6 +1694,7 @@ static void R_Shadow_MakeTextures(void) int x, y, z; float intensity, dist; unsigned int *data; + R_Shadow_FreeShadowMaps(); R_FreeTexturePool(&r_shadow_texturepool); r_shadow_texturepool = R_AllocTexturePool(); r_shadow_attenlinearscale = r_shadow_lightattenuationlinearscale.value; @@ -4509,7 +4510,7 @@ void R_BeginCoronaQuery(rtlight_t *rtlight, float scale, qboolean usequery) float zdist; vec3_t centerorigin; // if it's too close, skip it - if (VectorLength(rtlight->color) < (1.0f / 256.0f)) + if (VectorLength(rtlight->currentcolor) < (1.0f / 256.0f)) return; zdist = (DotProduct(rtlight->shadoworigin, r_refdef.view.forward) - DotProduct(r_refdef.view.origin, r_refdef.view.forward)); if (zdist < 32) @@ -4558,7 +4559,7 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) if (CL_TraceLine(r_refdef.view.origin, rtlight->shadoworigin, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID, true, false, NULL, false).fraction < 1) return; } - VectorScale(rtlight->color, cscale, color); + VectorScale(rtlight->currentcolor, cscale, color); if (VectorLength(color) > (1.0f / 256.0f)) R_DrawSprite(GL_ONE, GL_ONE, r_shadow_lightcorona, NULL, true, false, rtlight->shadoworigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale, color[0], color[1], color[2], 1); } -- 2.39.2