]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
simplified dlight fading code
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Jul 2003 00:16:05 +0000 (00:16 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Jul 2003 00:16:05 +0000 (00:16 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3350 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c

index eff737868e6636d7dc6f48114f2266bbcab56328..18503b6ee6de09c68af24a314daf22159c414b22 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -456,22 +456,9 @@ void CL_DecayLights(void)
        float time;
 
        time = cl.time - cl.oldtime;
-
-       dl = cl_dlights;
-       for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
-       {
-               if (!dl->radius)
-                       continue;
-               if (dl->die < cl.time)
-               {
-                       dl->radius = 0;
-                       continue;
-               }
-
-               dl->radius -= time*dl->decay;
-               if (dl->radius < 0)
-                       dl->radius = 0;
-       }
+       for (i = 0, dl = cl_dlights;i < MAX_DLIGHTS;i++, dl++)
+               if (dl->radius)
+                       dl->radius = (cl.time < dl->die) ? max(0, dl->radius - time * dl->decay) : 0;
 }
 
 extern qboolean Nehahrademcompatibility;