mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 08:21:59 +00:00
fix nq's skin code so it doesn't upload skins every frame
This commit is contained in:
parent
792aac270c
commit
04d4df1e19
3 changed files with 23 additions and 4 deletions
|
@ -83,9 +83,11 @@ typedef struct entity_s
|
||||||
vec3_t msg_origins[2]; // last two updates (0 is newest)
|
vec3_t msg_origins[2]; // last two updates (0 is newest)
|
||||||
vec3_t msg_angles[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; // NULL = no model
|
||||||
|
struct model_s *_model; // for nq skin support
|
||||||
int frame;
|
int frame;
|
||||||
byte *colormap;
|
byte *colormap;
|
||||||
int skinnum; // for Alias models
|
int skinnum; // for Alias models
|
||||||
|
int _skinnum; // for nq skin support
|
||||||
struct skin_s *skin;
|
struct skin_s *skin;
|
||||||
|
|
||||||
struct player_info_s *scoreboard; // identify player
|
struct player_info_s *scoreboard; // identify player
|
||||||
|
|
|
@ -64,6 +64,7 @@ typedef struct
|
||||||
float entertime;
|
float entertime;
|
||||||
int frags;
|
int frags;
|
||||||
int colors; // two 4 bit fields
|
int colors; // two 4 bit fields
|
||||||
|
int _colors;
|
||||||
byte translations[VID_GRADES*256];
|
byte translations[VID_GRADES*256];
|
||||||
} scoreboard_t;
|
} scoreboard_t;
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ CL_NewTranslation (int slot, skin_t *skin)
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
byte *dest;
|
byte *dest;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
|
entity_t *entity;
|
||||||
int skinnum;
|
int skinnum;
|
||||||
|
|
||||||
if (slot > cl.maxclients)
|
if (slot > cl.maxclients)
|
||||||
|
@ -135,12 +136,27 @@ CL_NewTranslation (int slot, skin_t *skin)
|
||||||
dest = player->translations;
|
dest = player->translations;
|
||||||
top = (player->colors & 0xf0) >> 4;
|
top = (player->colors & 0xf0) >> 4;
|
||||||
bottom = player->colors & 15;
|
bottom = player->colors & 15;
|
||||||
model = cl_entities[1 + slot].model;
|
entity = &cl_entities[1 + slot];
|
||||||
skinnum = cl_entities[1 + slot].skinnum;
|
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->texture = skin_textures + slot; //FIXME
|
||||||
skin->data.texels = 0; //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);
|
Skin_Do_Translation_Model (model, skinnum, slot, skin);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue