fix nq's skin code so it doesn't upload skins every frame

This commit is contained in:
Bill Currie 2001-05-27 04:23:39 +00:00
parent 792aac270c
commit 04d4df1e19
3 changed files with 23 additions and 4 deletions

View file

@ -83,9 +83,11 @@ typedef struct entity_s
vec3_t msg_origins[2]; // last two updates (0 is newest)
vec3_t msg_angles[2]; // last two updates (0 is newest)
struct model_s *model; // NULL = no model
struct model_s *_model; // for nq skin support
int frame;
byte *colormap;
int skinnum; // for Alias models
int _skinnum; // for nq skin support
struct skin_s *skin;
struct player_info_s *scoreboard; // identify player

View file

@ -64,6 +64,7 @@ typedef struct
float entertime;
int frags;
int colors; // two 4 bit fields
int _colors;
byte translations[VID_GRADES*256];
} scoreboard_t;

View file

@ -126,6 +126,7 @@ CL_NewTranslation (int slot, skin_t *skin)
int top, bottom;
byte *dest;
model_t *model;
entity_t *entity;
int skinnum;
if (slot > cl.maxclients)
@ -135,12 +136,27 @@ CL_NewTranslation (int slot, skin_t *skin)
dest = player->translations;
top = (player->colors & 0xf0) >> 4;
bottom = player->colors & 15;
model = cl_entities[1 + slot].model;
skinnum = cl_entities[1 + slot].skinnum;
entity = &cl_entities[1 + slot];
model = entity->model;
skinnum = entity->skinnum;
memset (skin, 0, sizeof (*skin)); //XXX external skins not yet supported
if (!model)
return;
Skin_Set_Translate (top, bottom, dest);
memset (skin, 0, sizeof (*skin));
skin->texture = skin_textures + slot; //FIXME
skin->data.texels = 0; //FIXME
if (player->colors == player->_colors
&& entity->model == entity->_model
&& entity->skinnum == entity->_skinnum)
return;
player->_colors = player->colors;
entity->_model = entity->model;
entity->_skinnum = entity->skinnum;
Skin_Set_Translate (top, bottom, dest);
Skin_Do_Translation_Model (model, skinnum, slot, skin);
}