X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=cl_main.c;h=ca17674c8b3f70f2b799cb4c5f50fd227338a23a;hb=7c48720e682da4de2175f5777dcd6ccecd4c850b;hp=6c8e851ee546ebc2ca69f0aa411e016040a8b27c;hpb=28518d468abf40ed92227387e69ccb5b534e4afb;p=xonotic%2Fdarkplaces.git 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(); }