-/*
-==================
-R_AnimateLight
-==================
-*/
-void R_AnimateLight (void)
-{
- int i, j, k;
-
-//
-// light animations
-// 'm' is normal light, 'a' is no light, 'z' is double bright
- i = (int)(cl.time * 10);
- for (j = 0;j < MAX_LIGHTSTYLES;j++)
- {
- if (!cl_lightstyle || !cl_lightstyle[j].length)
- {
- d_lightstylevalue[j] = 256;
- continue;
- }
- k = i % cl_lightstyle[j].length;
- k = cl_lightstyle[j].map[k] - 'a';
- k = k*22;
- d_lightstylevalue[j] = k;
- }
-}
-
-
-void R_BuildLightList(void)
-{
- int i;
- dlight_t *cd;
- rdlight_t *rd;
-
- r_numdlights = 0;
- c_dlights = 0;
-
- if (!r_dynamic.integer || !cl_dlights)
- return;
-
- for (i = 0;i < MAX_DLIGHTS;i++)
- {
- cd = cl_dlights + i;
- if (cd->radius <= 0)
- continue;
- rd = &r_dlight[r_numdlights++];
- VectorCopy(cd->origin, rd->origin);
- VectorScale(cd->color, cd->radius * 64.0f, rd->light);
- rd->cullradius2 = DotProduct(rd->light, rd->light) * (0.25f / (64.0f * 64.0f)) + 4096.0f;
- // clamp radius to avoid overflowing division table in lightmap code
- if (rd->cullradius2 > (2048.0f * 2048.0f))
- rd->cullradius2 = (2048.0f * 2048.0f);
- rd->cullradius = sqrt(rd->cullradius2);
- rd->subtract = 1.0f / rd->cullradius2;
- rd->ent = cd->ent;
- c_dlights++; // count every dlight in use
- }
-}
-