Cleanup old code

Console commands cleanup
This commit is contained in:
cholleme 2003-06-25 09:44:54 +00:00
parent a79d857eea
commit 4aae63a512
2 changed files with 8 additions and 206 deletions

View file

@ -97,29 +97,19 @@ cvar_t cg_showentities = {"cg_showentities","1"};
cvar_t cg_showviewmodel = {"cg_showviewmodel","1"};
cvar_t r_fullbright = {"r_fullbright","0"};
cvar_t r_lightmap = {"r_lightmap","0"};
cvar_t r_shadows = {"r_shadows","0"};
//cvar_t r_mirroralpha = {"r_mirroralpha","1"};
cvar_t r_wateralpha = {"r_wateralpha","0.5"};//PENTA: different default
cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
cvar_t gl_finish = {"gl_finish","0"};
cvar_t gl_clear = {"gl_clear","0"};
cvar_t gl_cull = {"gl_cull","1"};
//cvar_t gl_texsort = {"gl_texsort","1"};
cvar_t gl_polyblend = {"gl_polyblend","1"};
cvar_t gl_flashblend = {"gl_flashblend","1"};
cvar_t gl_playermip = {"gl_playermip","0"};
cvar_t gl_nocolors = {"gl_nocolors","0"};
//cvar_t gl_keeptjunctions = {"gl_keeptjunctions","0"}; PENTA: Don't remove t-junctions
cvar_t gl_reporttjunctions = {"gl_reporttjunctions","0"};
cvar_t gl_doubleeyes = {"gl_doubleeys", "1"};
cvar_t gl_watershader = {"gl_watershader","1"};//PENTA: water shaders ON/OFF
cvar_t gl_calcdepth = {"gl_calcdepth","0"};
cvar_t sh_lightmapbright = {"sh_lightmapbright","1.0"};//PENTA: brightness of lightmaps
cvar_t sh_radiusscale = {"sh_radiusscale","0.0"};//PENTA: brightness of lightmaps
cvar_t sh_visiblevolumes = {"sh_visiblevolumes","0"};//PENTA: draw shadow volumes on/off
cvar_t sh_entityshadows = {"sh_entityshadows","1"};//PENTA: entities cast shadows on/off
cvar_t sh_meshshadows = {"sh_meshshadows","1"};//PENTA: entities cast shadows on/off
@ -137,7 +127,6 @@ cvar_t sh_infinitevolumes = {"sh_infinitevolumes","0", true};//PENTA: Nvidia in
cvar_t sh_noscissor = {"sh_noscissor","0"};//PENTA: no scissoring
cvar_t sh_nocleversave = {"sh_nocleversave","0"};//PENTA: don't change light drawing order to reduce stencil clears
cvar_t sh_bumpmaps = {"sh_bumpmaps","1"};//PENTA: enable disable bump mapping
cvar_t sh_colormaps = {"sh_colormaps","1"};//PENTA: enable disable textures on the world (light will remain)
cvar_t sh_playershadow = {"sh_playershadow","1"};//PENTA: the player casts a shadow (the one YOU are playing with, others always cast shadows)
cvar_t sh_nocache = {"sh_nocache","0"};
cvar_t sh_glares = {"sh_glares","0",true};
@ -916,15 +905,6 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
anim = (int)(cl.time*10) & 3;
if (paliashdr->shader->numcolorstages > 0)
GL_BindAdvanced(paliashdr->shader->colorstages[0].texture[0]);
// we can't dynamically colormap textures, so they are cached
// seperately for the players. Heads are just uncolored.
if (currententity->colormap != vid.colormap && !gl_nocolors.value)
{
i = currententity - cl_entities;
if (i >= 1 && i<=cl.maxclients /* && !strcmp (currententity->model->name, "progs/player.mdl") */)
GL_Bind(playertextures - 1 + i);
}
}
//XYZ
@ -1612,7 +1592,7 @@ qboolean R_ShouldDrawViewModel (void)
return true;
}
extern cvar_t v_gamma;
extern cvar_t r_intensity;
/*
============
R_AdjustGamma
@ -1620,16 +1600,16 @@ R_AdjustGamma
*/
void R_AdjustGamma(void) //Gamma - Eradicator
{
if (v_gamma.value < 0.2f)
v_gamma.value = 0.2f;
if (v_gamma.value >= 1)
if (r_intensity.value < 0.2f)
r_intensity.value = 0.2f;
if (r_intensity.value >= 1)
{
v_gamma.value = 1;
r_intensity.value = 1;
return;
}
glBlendFunc (GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
glColor4f (1, 1, 1, v_gamma.value );
glColor4f (1, 1, 1, r_intensity.value );
glBegin (GL_QUADS);
glVertex3f (10, 100, 100);
glVertex3f (10, -100, 100);
@ -1681,7 +1661,7 @@ void R_PolyBlend (void)
}
if (v_gamma.value != 1) //Gamma - Eradicator
if (r_intensity.value != 1) //Gamma - Eradicator
R_AdjustGamma();
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -2057,13 +2037,6 @@ void R_SetupGL (void)
glGetDoublev (GL_PROJECTION_MATRIX, r_Dproject_matrix);
glGetIntegerv (GL_VIEWPORT, (GLint *) r_Iviewport); // <AWE> added cast.
ExtractFrustum();
//
// set drawing parms
//
if (gl_cull.value)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);

View file

@ -188,11 +188,8 @@ void R_Init (void)
Cvar_RegisterVariable (&r_fullbright);
Cvar_RegisterVariable (&cg_showentities);
Cvar_RegisterVariable (&cg_showviewmodel);
Cvar_RegisterVariable (&r_shadows);
// Cvar_RegisterVariable (&r_mirroralpha);
Cvar_RegisterVariable (&r_wateralpha);
Cvar_RegisterVariable (&r_dynamic);
Cvar_RegisterVariable (&r_novis);
Cvar_RegisterVariable (&gl_finish);
Cvar_RegisterVariable (&gl_clear);
@ -201,21 +198,10 @@ void R_Init (void)
if (gl_mtexable)
Cvar_SetValue ("gl_texsort", 0.0);
*/
Cvar_RegisterVariable (&gl_cull);
Cvar_RegisterVariable (&gl_polyblend);
Cvar_RegisterVariable (&gl_flashblend);
Cvar_RegisterVariable (&gl_playermip);
Cvar_RegisterVariable (&gl_nocolors);
// Cvar_RegisterVariable (&gl_keeptjunctions); PENTA: don't remove t-junctions
Cvar_RegisterVariable (&gl_reporttjunctions);
Cvar_RegisterVariable (&gl_doubleeyes);
Cvar_RegisterVariable (&gl_watershader);//PENTA: register our vars.
Cvar_RegisterVariable (&gl_calcdepth);
Cvar_RegisterVariable (&sh_lightmapbright);
Cvar_RegisterVariable (&sh_radiusscale);
Cvar_RegisterVariable (&sh_visiblevolumes);
Cvar_RegisterVariable (&sh_entityshadows);
Cvar_RegisterVariable (&sh_meshshadows);
@ -233,7 +219,6 @@ void R_Init (void)
Cvar_RegisterVariable (&sh_noscissor);
Cvar_RegisterVariable (&sh_nocleversave);
Cvar_RegisterVariable (&sh_bumpmaps);
Cvar_RegisterVariable (&sh_colormaps);
Cvar_RegisterVariable (&sh_playershadow);
Cvar_RegisterVariable (&sh_nocache);
Cvar_RegisterVariable (&sh_glares);
@ -279,162 +264,6 @@ void R_Init (void)
texture_extension_number += 16;
}
/*
===============
R_TranslatePlayerSkin
Translates a skin texture by the per-player color lookup
===============
*/
void R_TranslatePlayerSkin (int playernum)
{
int top, bottom;
byte translate[256];
unsigned translate32[256];
int i, j, s;
model_t *model;
alias3data_t *data;
aliashdr_t *paliashdr;
byte *original;
static unsigned pixels[512*256], *out; // <AWE> added "static" otherwise array has to be <32kb.
unsigned scaled_width, scaled_height;
int inwidth, inheight;
byte *inrow;
unsigned frac, fracstep;
GL_DisableMultitexture();
top = cl.scores[playernum].colors & 0xf0;
bottom = (cl.scores[playernum].colors &15)<<4;
for (i=0 ; i<256 ; i++)
translate[i] = i;
for (i=0 ; i<16 ; i++)
{
if (top < 128) // the artists made some backwards ranges. sigh.
translate[TOP_RANGE+i] = top+i;
else
translate[TOP_RANGE+i] = top+15-i;
if (bottom < 128)
translate[BOTTOM_RANGE+i] = bottom+i;
else
translate[BOTTOM_RANGE+i] = bottom+15-i;
}
//
// locate the original skin pixels
//
currententity = &cl_entities[1+playernum];
model = currententity->model;
if (!model)
return; // player doesn't have a model yet
if (model->type != mod_alias)
return; // only translate skins on alias models
// HACK HACK HACK -> garanted to work with original player model _ONLY_
data = (alias3data_t *)Mod_Extradata (model);
paliashdr = (aliashdr_t *)((char*)data + data->ofsSurfaces[0]);
s = paliashdr->skinwidth * paliashdr->skinheight;
if (currententity->skinnum < 0 || currententity->skinnum >= paliashdr->numskins) {
Con_Printf("(%d): Invalid player skin #%d\n", playernum, currententity->skinnum);
original = (byte *)paliashdr + paliashdr->texels[0];
} else
original = (byte *)paliashdr + paliashdr->texels[currententity->skinnum];
if (s & 3)
Sys_Error ("R_TranslateSkin: s&3");
inwidth = paliashdr->skinwidth;
inheight = paliashdr->skinheight;
// because this happens during gameplay, do it fast
// instead of sending it through gl_upload 8
GL_Bind(playertextures + playernum);
#if 0
byte translated[320*200];
for (i=0 ; i<s ; i+=4)
{
translated[i] = translate[original[i]];
translated[i+1] = translate[original[i+1]];
translated[i+2] = translate[original[i+2]];
translated[i+3] = translate[original[i+3]];
}
// don't mipmap these, because it takes too long
GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight, false, false, true);
#else
scaled_width = gl_max_size.value < 512 ? gl_max_size.value : 512;
scaled_height = gl_max_size.value < 256 ? gl_max_size.value : 256;
// allow users to crunch sizes down even more if they want
scaled_width >>= (int)gl_playermip.value;
scaled_height >>= (int)gl_playermip.value;
/*
if (VID_Is8bit() && gl_palettedtex == true) { // 8bit texture upload <AWE> requires EXT_paletted_texture
byte *out2;
out2 = (byte *)pixels;
memset(pixels, 0, sizeof(pixels));
fracstep = inwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out2 += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=4)
{
out2[j] = translate[inrow[frac>>16]];
frac += fracstep;
out2[j+1] = translate[inrow[frac>>16]];
frac += fracstep;
out2[j+2] = translate[inrow[frac>>16]];
frac += fracstep;
out2[j+3] = translate[inrow[frac>>16]];
frac += fracstep;
}
}
GL_Upload8_EXT ((byte *)pixels, scaled_width, scaled_height, false, false);
return;
}
*/
for (i=0 ; i<256 ; i++)
translate32[i] = d_8to24table[translate[i]];
out = pixels;
fracstep = inwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
{
inrow = original + inwidth*(i*inheight/scaled_height);
frac = fracstep >> 1;
for (j=0 ; j<scaled_width ; j+=4)
{
out[j] = translate32[inrow[frac>>16]];
frac += fracstep;
out[j+1] = translate32[inrow[frac>>16]];
frac += fracstep;
out[j+2] = translate32[inrow[frac>>16]];
frac += fracstep;
out[j+3] = translate32[inrow[frac>>16]];
frac += fracstep;
}
}
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#endif
}
/*
===============
R_NewMap