+ {
+ f = dl->radius - time * dl->decay;
+ if (cl.time < dl->die && f > 0)
+ {
+ dl->radius = dl->radius - time * dl->decay;
+ cl_activedlights = i + 1;
+ }
+ 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
+ f = cl.time * 10;
+ i = (int)floor(f);
+ frac = f - i;
+ for (j = 0;j < MAX_LIGHTSTYLES;j++)
+ {
+ if (!cl_lightstyle || !cl_lightstyle[j].length)
+ {
+ r_refdef.lightstylevalue[j] = 256;
+ continue;
+ }
+ k = i % cl_lightstyle[j].length;
+ l = (i-1) % cl_lightstyle[j].length;
+ k = cl_lightstyle[j].map[k] - 'a';
+ l = cl_lightstyle[j].map[l] - 'a';
+ r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
+ }