From: lordhavoc Date: Thu, 17 Jan 2002 01:30:08 +0000 (+0000) Subject: removed no longer used static light parsing code X-Git-Tag: RELEASE_0_2_0_RC1~719 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1849f4b5a0b51050a3a04f251f96e6a4cc3c52f6;p=xonotic%2Fdarkplaces.git removed no longer used static light parsing code git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1353 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/buildnumber.c b/buildnumber.c index b15d6c2a..37ef3341 100644 --- a/buildnumber.c +++ b/buildnumber.c @@ -1,4 +1,4 @@ -#define BUILDNUMBER 656 +#define BUILDNUMBER 659 int buildnumber = BUILDNUMBER; diff --git a/cl_parse.c b/cl_parse.c index c2268e5c..d7661dd4 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -289,358 +289,6 @@ void CL_ParseEntityLump(char *entdata) } } -/* -//this code is going to be removed - -#define MAX_STATICLIGHTS 2048 -// tyrlite types -#define LIGHTFADE_LMINUSX 0 // light, arghlite, others? -#define LIGHTFADE_LDIVX 1 -#define LIGHTFADE_LDIVX2 2 // hlight -#define LIGHTFADE_L 3 -#define LIGHTFADE_DEFAULT 999999 // light util not yet identified, switched later - -typedef struct -{ - int fadetype; // one of the LIGHTFADE_ values - int style; - vec3_t origin; - vec_t distancescale; // attenuation - - // spotlights - vec3_t direction; // direction - vec_t cone; // cone cosine, any light cosine outside this range is suddenly black - - // LIGHTFADE_LMINUSX - vec_t light; - vec3_t color; - - // LIGHTFADE_LDIVX and LIGHTFADE_LDIVX2 - vec3_t light2; // light * color - vec_t lightsubtract; // hlight feature -} -staticlight_t; - -extern staticlight_t staticlight[MAX_STATICLIGHTS]; -extern int staticlights; - -extern int r_sunlightenabled; -extern vec3_t r_sunlightdirection, r_sunlightcolor; -extern vec3_t r_light_ambientcolor; - - - -staticlight_t staticlight[MAX_STATICLIGHTS]; -int staticlights; - -int r_sunlightenabled; -vec3_t r_sunlightdirection, r_sunlightcolor; -vec3_t r_light_ambientcolor; - -void CL_ParseEntityLump(char *entdata) -{ - char *data; - char key[128], value[4096]; - char targetnamebuffer[65536]; - char *targetname[8192], *target[MAX_STATICLIGHTS], light_target[256]; - vec3_t targetnameorigin[8192], v; - int targets, targetnames, targetnamebufferpos, targetnameorigintofillin; - int i, j, n; - float f1, f2, f3, f4; - float ambientlight, ambientcolor[3], sunlight, sunlightdirection[3], sunlightcolor[3]; - int light_fadetype, light_style, hlight, tyrlite, light_enable; - float light_origin[3], light_light, light_distancescale, light_lightcolor[3], light_color[3], light_direction[3], light_cone, light_lightradius; - FOG_clear(); // LordHavoc: no fog until set - R_SetSkyBox(""); // LordHavoc: no environment mapped sky until set - r_sunlightenabled = false; - staticlights = 0; - data = entdata; - if (!data) - return; - data = COM_Parse(data); - if (!data) - return; // error - if (com_token[0] != '{') - return; // error - hlight = false; - tyrlite = false; - ambientlight = 0; - ambientcolor[0] = ambientcolor[1] = ambientcolor[2] = 1; - sunlight = 0; - sunlightcolor[0] = sunlightcolor[1] = sunlightcolor[2] = 1; - sunlightdirection[0] = 0; - sunlightdirection[1] = 0; - sunlightdirection[2] = -1; - targets = 0; - targetnames = 0; - targetnamebufferpos = 0; - while (1) - { - data = COM_Parse(data); - if (!data) - return; // error - if (com_token[0] == '}') - break; // end of worldspawn - 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("sky", key)) - R_SetSkyBox(value); - else if (!strcmp("skyname", key)) // non-standard, introduced by QuakeForge... sigh. - R_SetSkyBox(value); - else if (!strcmp("qlsky", key)) // non-standard, introduced by QuakeLives (EEK) - R_SetSkyBox(value); - else if (!strcmp("fog", key)) - sscanf(value, "%f %f %f %f", &fog_density, &fog_red, &fog_green, &fog_blue); - else if (!strcmp("fog_density", key)) - fog_density = atof(value); - else if (!strcmp("fog_red", key)) - fog_red = atof(value); - else if (!strcmp("fog_green", key)) - fog_green = atof(value); - else if (!strcmp("fog_blue", key)) - fog_blue = atof(value); - 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 (sscanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3) - VectorCopy(v, sunlightcolor); - tyrlite = true; - } - else if (!strcmp("sun_mangle", key)) - { - if (sscanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3) - AngleVectors(v, sunlightdirection, NULL, NULL); - tyrlite = true; - } - } - - 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; - VectorClear(light_origin); - 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; - while (1) - { - 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 = sscanf(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 = sscanf(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 = sscanf(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 (sscanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3) - 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++; - } - } - else if (!strcmp("target", key)) - if (strlen(value) < sizeof(light_target)) - strcpy(light_target, value); - } - if (targetnameorigintofillin >= 0) - VectorCopy(light_origin, targetnameorigin[targetnameorigintofillin]); - if (light_enable && staticlights < MAX_STATICLIGHTS && light_light != 0) - { - if (light_target[0] && (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].fadetype = light_fadetype; - staticlight[staticlights].style = light_style; - VectorCopy(light_origin, staticlight[staticlights].origin); - staticlight[staticlights].distancescale = light_distancescale; - // these are often altered later by the target name linking - VectorCopy(light_direction, staticlight[staticlights].direction); - staticlight[staticlights].cone = light_cone; - - staticlight[staticlights].light = light_light; - staticlight[staticlights].color[0] = light_lightcolor[0] * light_color[0]; - staticlight[staticlights].color[1] = light_lightcolor[1] * light_color[1]; - staticlight[staticlights].color[2] = light_lightcolor[2] * light_color[2]; - - staticlight[staticlights].light2[0] = light_light * light_lightcolor[0] * light_color[0]; - staticlight[staticlights].light2[1] = light_light * light_lightcolor[1] * light_color[1]; - staticlight[staticlights].light2[2] = light_light * light_lightcolor[2] * light_color[2]; - 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 (light_hlight.integer) - 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