]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix stupid bug introduced by merging CL_DecayLights into CL_UpdateLights, fixed by...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 26 Oct 2005 10:09:28 +0000 (10:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 26 Oct 2005 10:09:28 +0000 (10:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5770 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c

index 6c8e851ee546ebc2ca69f0aa411e016040a8b27c..ca17674c8b3f70f2b799cb4c5f50fd227338a23a 100644 (file)
--- 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();
        }