+ 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))
+ {
+ if ((targetnames < 8192) && (strlen(value) + 1 + targetnamebufferpos <= 65536))
+ {
+ targetname[targetnames] = targetnamebuffer + targetnamebufferpos;
+ strcpy(targetnamebuffer + targetnamebufferpos, value);
+ targetnamebufferpos += strlen(value) + 1;
+ targetnameorigintofillin = targetnames++;
+ }
+ }
+ else if (!strcmp("target", key))
+ if (strlen(value) < sizeof(light_target))
+ strcpy(light_target, value);
+ }
+ if (targetnameorigintofillin >= 0)
+ VectorCopy(targetnametemporigin, targetnameorigin[targetnameorigintofillin]);
+ if (light_enable && staticlights < MAX_STATICLIGHTS && light_light != 0)
+ {
+ VectorCopy(light_origin, staticlight[staticlights].origin);
+ staticlight[staticlights].color[0] = light_light * light_lightcolor[0] * light_color[0];
+ staticlight[staticlights].color[1] = light_light * light_lightcolor[1] * light_color[1];
+ staticlight[staticlights].color[2] = light_light * light_lightcolor[2] * light_color[2];
+ VectorCopy(light_direction, staticlight[staticlights].direction);
+ staticlight[staticlights].cone = light_cone;
+ staticlight[staticlights].distancescale = light_distancescale;
+ staticlight[staticlights].fadetype = light_fadetype;
+ staticlight[staticlights].style = light_style;
+ if (light_target && (targets < 8192) && (strlen(value) + 1 + targetnamebufferpos <= 65536))
+ {
+ target[staticlights] = targetnamebuffer + targetnamebufferpos;
+ strcpy(targetnamebuffer + targetnamebufferpos, value);
+ targetnamebufferpos += strlen(value) + 1;
+ }
+ else
+ target[staticlights] = NULL;
+ staticlight[staticlights].lightsubtract = 0;
+ if (light_lightradius)
+ {
+ staticlight[staticlights].fadetype = LIGHTFADE_LDIVX2;
+ staticlight[staticlights].lightsubtract = max(staticlight[staticlights].color[0], max(staticlight[staticlights].color[1], staticlight[staticlights].color[2])) * 0.5f / (light_lightradius * light_distancescale * light_lightradius * light_distancescale * (1.0f / 65536.0f) + 1.0f);
+ }
+ staticlights++;
+ }
+ }
+ if (cl.worldmodel->ishlbsp)
+ n = LIGHTFADE_LDIVX2;
+ else if (tyrlite)
+ n = LIGHTFADE_LMINUSX;
+ else if (hlight)
+ n = LIGHTFADE_LDIVX2;
+ else
+ n = LIGHTFADE_LMINUSX;
+ for (i = 0;i < staticlights;i++)
+ {
+ if (staticlight[i].fadetype == LIGHTFADE_DEFAULT)
+ staticlight[i].fadetype = n;
+ if (target[i])
+ {
+ for (j = 0;j < targetnames;j++)
+ {
+ if (!strcmp(target[i], targetname[j]))
+ {
+ VectorSubtract(targetnameorigin[j], staticlight[i].origin, v);
+ VectorNormalize(v);
+ VectorCopy(v, staticlight[i].direction);
+ break;
+ }
+ }
+ }
+ if (staticlight[i].direction[0] == 0 && staticlight[i].direction[1] == 0 && staticlight[i].direction[2] == 0)
+ staticlight[i].cone = 0;
+ }
+}
+
+/*
+=====================
+CL_SignonReply
+
+An svc_signonnum has been received, perform a client side setup
+=====================
+*/
+static void CL_SignonReply (void)
+{
+ char str[8192];
+
+Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
+
+ switch (cls.signon)
+ {
+ case 1:
+ MSG_WriteByte (&cls.message, clc_stringcmd);
+ MSG_WriteString (&cls.message, "prespawn");
+ break;
+
+ case 2:
+ MSG_WriteByte (&cls.message, clc_stringcmd);
+ MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
+
+ MSG_WriteByte (&cls.message, clc_stringcmd);
+ MSG_WriteString (&cls.message, va("color %i %i\n", cl_color.integer >> 4, cl_color.integer & 15));
+
+ if (cl_pmodel.integer)
+ {
+ MSG_WriteByte (&cls.message, clc_stringcmd);
+ MSG_WriteString (&cls.message, va("pmodel %i\n", cl_pmodel.integer));