clean up skin selection code a little

This commit is contained in:
Bill Currie 2001-01-20 10:19:23 +00:00
parent 77f217bf89
commit 7c1c47b573

View file

@ -722,7 +722,9 @@ R_DrawAliasModel (entity_t *e)
float an; float an;
int anim; int anim;
qboolean torch = false; qboolean torch = false;
int texture;
int fb_texture = 0; int fb_texture = 0;
int skinnum;
clmodel = currententity->model; clmodel = currententity->model;
@ -825,6 +827,16 @@ R_DrawAliasModel (entity_t *e)
anim = (int) (cl.time * 10) & 3; anim = (int) (cl.time * 10) & 3;
skinnum = currententity->skinnum;
if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) {
Con_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum);
skinnum = 0;
}
texture = paliashdr->gl_texturenum[skinnum][anim];
if (gl_fb_models->int_val)
fb_texture = paliashdr->gl_fb_texturenum[skinnum][anim];
// we can't dynamically colormap textures, so they are cached // we can't dynamically colormap textures, so they are cached
// seperately for the players. Heads are just uncolored. // seperately for the players. Heads are just uncolored.
if (currententity->scoreboard && !gl_nocolors->int_val) { if (currententity->scoreboard && !gl_nocolors->int_val) {
@ -836,24 +848,18 @@ R_DrawAliasModel (entity_t *e)
CL_NewTranslation (i); CL_NewTranslation (i);
} }
skin = currententity->scoreboard->skin; skin = currententity->scoreboard->skin;
if (i >= 0 && i < MAX_CLIENTS) if (skin && i >= 0 && i < MAX_CLIENTS)
glBindTexture (GL_TEXTURE_2D, playertextures + i); texture = playertextures + i;
else
skin = 0;
if (gl_fb_models->int_val) { if (gl_fb_models->int_val) {
if (skin) if (skin)
fb_texture = skin->fb_texture; fb_texture = skin->fb_texture;
else
fb_texture = paliashdr->gl_fb_texturenum[currententity->skinnum]
[anim];
} }
} else {
glBindTexture (GL_TEXTURE_2D,
paliashdr->gl_texturenum[currententity->skinnum][anim]);
if (clmodel->hasfullbrights && gl_fb_models->int_val &&
paliashdr->gl_fb_texturenum[currententity->skinnum][anim])
fb_texture = paliashdr->gl_fb_texturenum[currententity->skinnum]
[anim];
} }
glBindTexture (GL_TEXTURE_2D, texture);
if (gl_affinemodels->int_val) if (gl_affinemodels->int_val)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);