From 7c1c47b573b00182f0f2b15ee87ac71be4d943fa Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 Jan 2001 10:19:23 +0000 Subject: [PATCH] clean up skin selection code a little --- source/gl_rmain.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/source/gl_rmain.c b/source/gl_rmain.c index c58f05b..ca77a5e 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -722,7 +722,9 @@ R_DrawAliasModel (entity_t *e) float an; int anim; qboolean torch = false; + int texture; int fb_texture = 0; + int skinnum; clmodel = currententity->model; @@ -825,6 +827,16 @@ R_DrawAliasModel (entity_t *e) 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 // seperately for the players. Heads are just uncolored. if (currententity->scoreboard && !gl_nocolors->int_val) { @@ -836,24 +848,18 @@ R_DrawAliasModel (entity_t *e) CL_NewTranslation (i); } skin = currententity->scoreboard->skin; - if (i >= 0 && i < MAX_CLIENTS) - glBindTexture (GL_TEXTURE_2D, playertextures + i); + if (skin && i >= 0 && i < MAX_CLIENTS) + texture = playertextures + i; + else + skin = 0; if (gl_fb_models->int_val) { if (skin) 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) glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);