From: havoc Date: Wed, 26 Oct 2005 10:09:28 +0000 (+0000) Subject: fix stupid bug introduced by merging CL_DecayLights into CL_UpdateLights, fixed by... X-Git-Tag: xonotic-v0.1.0preview~4514 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7c48720e682da4de2175f5777dcd6ccecd4c850b;p=xonotic%2Fdarkplaces.git fix stupid bug introduced by merging CL_DecayLights into CL_UpdateLights, fixed by splitting them again, now glowing entities should work again git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5770 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index 6c8e851e..ca17674c 100644 --- a/cl_main.c +++ b/cl_main.c @@ -548,13 +548,12 @@ dlightsetup: dl->specularscale = specularscale; } -void CL_UpdateLights(void) +// called before entity relinking +void CL_DecayLights(void) { - int i, j, k, l, oldmax; + int i, oldmax; dlight_t *dl; - float time, frac, f; - - r_refdef.numlights = 0; + float time, f; time = cl.time - cl.oldtime; oldmax = cl_activedlights; @@ -568,16 +567,32 @@ void CL_UpdateLights(void) { dl->radius = dl->radius - time * dl->decay; cl_activedlights = i + 1; - if (r_dynamic.integer) - { - R_RTLight_Update(dl, false); - r_refdef.lights[r_refdef.numlights++] = dl; - } } else dl->radius = 0; } } +} + +// called after entity relinking +void CL_UpdateLights(void) +{ + int i, j, k, l; + dlight_t *dl; + float frac, f; + + r_refdef.numlights = 0; + if (r_dynamic.integer) + { + for (i = 0, dl = cl_dlights;i < cl_activedlights;i++, dl++) + { + if (dl->radius) + { + R_RTLight_Update(dl, false); + r_refdef.lights[r_refdef.numlights++] = dl; + } + } + } // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright @@ -1349,7 +1364,7 @@ int CL_ReadFromServer(void) { // prepare for a new frame CL_LerpPlayer(CL_LerpPoint()); - CL_UpdateLights(); + CL_DecayLights(); CL_ClearTempEntities(); V_DriftPitch(); V_FadeViewFlashs(); @@ -1371,6 +1386,8 @@ int CL_ReadFromServer(void) // run cgame code (which can add more entities) CL_CGVM_Frame(); + CL_UpdateLights(); + // update view blend V_CalcViewBlend(); }