+ data = COM_Parse(data);
+ if (!data)
+ return; // error
+ if (com_token[0] == '}')
+ break;
+ if (com_token[0] == '_')
+ strcpy(key, com_token + 1);
+ else
+ strcpy(key, com_token);
+ while (key[strlen(key)-1] == ' ') // remove trailing spaces
+ key[strlen(key)-1] = 0;
+ data = COM_Parse(data);
+ if (!data)
+ return; // error
+ strcpy(value, com_token);
+ if (!strcmp("light", key))
+ {
+ n = scanf(value, "%f %f %f %f", &f1, &f2, &f3, &f4);
+ switch(n)
+ {
+ case 1:
+ // id light, arghlite, tyrlite, others
+ light_light = f1;
+ light_lightcolor[0] = light_lightcolor[1] = light_lightcolor[2] = 1.0f;
+ break;
+ case 3:
+ // hlight specific (supports all 3 light formats, but this one is unique to it)
+ hlight = true;
+ light_light = max(f1, max(f2, f3));
+ light_lightcolor[0] = f1 / light_light;
+ light_lightcolor[1] = f2 / light_light;
+ light_lightcolor[2] = f3 / light_light;
+ break;
+ case 4:
+ // halflife
+ hlight = true; // unless this is a halflife map, probably hlight
+ light_light = f4;
+ light_lightcolor[0] = f1 * (1.0f / 255.0f);
+ light_lightcolor[1] = f1 * (1.0f / 255.0f);
+ light_lightcolor[2] = f1 * (1.0f / 255.0f);
+ break;
+ default:
+ // error
+ break;
+ }
+ }
+ else if (!strcmp("color", key))
+ {
+ n = scanf(value, "%f %f %f", &f1, &f2, &f3);
+ if (n == 3)
+ {
+ light_color[0] = f1;
+ light_color[1] = f2;
+ light_color[2] = f3;
+ }
+ // n != 3 is an error
+ }
+ else if (!strcmp("wait", key))
+ light_distancescale = atof(value);
+ else if (!strcmp("delay", key))
+ {
+ light_fadetype = atoi(value);
+ tyrlite = true;
+ }
+ else if (!strcmp("angle", key))
+ light_cone = -cos(atof(value) * M_PI / 360);
+ else if (!strcmp("mangle", key))
+ {
+ n = scanf(value, "%f %f %f", &v[0], &v[1], &v[2]);
+ if (n == 3)
+ AngleVectors(v, light_direction, NULL, NULL);
+ // n != 3 is an error
+ tyrlite = true;
+ }
+ else if (!strcmp("style", key))
+ {
+ n = atoi(value);
+ if (n >= 0 && n < MAX_LIGHTSTYLES)
+ light_style = n;
+ }
+ else if (!strcmp("lightradius", key))
+ {
+ hlight = true;
+ light_lightradius = atof(value);
+ }
+ else if (!strcmp("classname", key))
+ if (!strncmp(value, "light", 5))
+ light_enable = true;
+ else if (!strcmp("origin", key))
+ {
+ if (scanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3)
+ VectorCopy(v, targetnametemporigin);
+ }
+ else if (!strcmp("targetname", key))