Added lightstyle interpolation.
authortomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Aug 2004 22:50:53 +0000 (22:50 +0000)
committertomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Aug 2004 22:50:53 +0000 (22:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4334 d7cf8633-e32d-0410-b094-e92efae38249

r_light.c

index c5ec8b2..d0c977d 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -86,11 +86,13 @@ R_UpdateLights
 */
 void R_UpdateLights(void)
 {
-       int i, j, k;
+       float frac;
+       int i, j, k, l;
 
 // light animations
 // 'm' is normal light, 'a' is no light, 'z' is double bright
        i = (int)(cl.time * 10);
+       frac = (cl.time * 10) - i;
        for (j = 0;j < MAX_LIGHTSTYLES;j++)
        {
                if (!cl_lightstyle || !cl_lightstyle[j].length)
@@ -99,9 +101,10 @@ void R_UpdateLights(void)
                        continue;
                }
                k = i % cl_lightstyle[j].length;
+               l = (i-1) % cl_lightstyle[j].length;
                k = cl_lightstyle[j].map[k] - 'a';
-               k = k*22;
-               d_lightstylevalue[j] = k;
+               l = cl_lightstyle[j].map[l] - 'a';
+               d_lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
        }
 
        r_numdlights = 0;