+ else if (!strcmp("light", key))
+ ambientlight = atof(value);
+ else if (!strcmp("sunlight", key))
+ {
+ sunlight = atof(value);
+ tyrlite = true;
+ }
+ else if (!strcmp("sun_color", key))
+ {
+ if (scanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3)
+ VectorCopy(v, sunlightcolor);
+ tyrlite = true;
+ }
+ else if (!strcmp("sun_mangle", key))
+ {
+ if (scanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3)
+ AngleVectors(v, sunlightdirection, NULL, NULL);
+ tyrlite = true;
+ }
+ else if (!strcmp("origin", key))
+ {
+ if (scanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3)
+ {
+ VectorCopy(v, targetnametemporigin);
+ VectorCopy(v, light_origin);
+ }
+ }
+ else if (!strcmp("targetname", key))
+ {
+ if ((targetnames < 8192) && (strlen(value) + 1 + targetnamebufferpos <= 65536))
+ {
+ targetname[targetnames] = targetnamebuffer + targetnamebufferpos;
+ strcpy(targetnamebuffer + targetnamebufferpos, value);
+ targetnamebufferpos += strlen(value) + 1;
+ targetnameorigintofillin = targetnames++;
+ }
+ }
+ }
+ if (targetnameorigintofillin >= 0)
+ VectorCopy(targetnametemporigin, targetnameorigin[targetnameorigintofillin]);
+
+ if (sunlight)
+ {
+ r_sunlightenabled = true;
+ VectorScale(sunlightcolor, sunlight, r_sunlightcolor);
+ VectorCopy(sunlightdirection, r_sunlightdirection);
+ }
+ VectorScale(ambientcolor, ambientlight, r_light_ambientcolor);
+
+ while(1)
+ {
+ data = COM_Parse(data);
+ if (!data)
+ break; // done
+ if (com_token[0] != '{')
+ break; // error
+ light_light = 0;
+ light_lightcolor[0] = light_lightcolor[1] = light_lightcolor[2] = 1.0f;
+ light_color[0] = light_color[1] = light_color[2] = 1.0f;
+ light_direction[0] = light_direction[1] = light_direction[2] = 0.0f;
+ light_cone = -cos(20*M_PI/180);
+ light_distancescale = 1.0f;
+ light_fadetype = LIGHTFADE_DEFAULT; // replaced later when light util is identified
+ light_style = 0;
+ light_lightradius = 0;
+ light_enable = false;
+ targetnameorigintofillin = -1;
+ targetnametemporigin[0] = 0;
+ targetnametemporigin[1] = 0;
+ targetnametemporigin[2] = 0;
+ while (1)