mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Avoid processing skins every frame.
Processing skins every frame would slow things down unnecessarily, so call the skin functions only when something changes.
This commit is contained in:
parent
6df8867d69
commit
4d66fc175a
5 changed files with 16 additions and 13 deletions
|
@ -313,6 +313,8 @@ typedef struct {
|
||||||
byte colormap;
|
byte colormap;
|
||||||
byte skinnum;
|
byte skinnum;
|
||||||
|
|
||||||
|
struct skin_s *skin;
|
||||||
|
|
||||||
// QSG 2
|
// QSG 2
|
||||||
byte alpha;
|
byte alpha;
|
||||||
byte scale;
|
byte scale;
|
||||||
|
|
|
@ -81,6 +81,7 @@ typedef struct player_info_s
|
||||||
int bottomcolor;
|
int bottomcolor;
|
||||||
struct info_key_s *skinname;
|
struct info_key_s *skinname;
|
||||||
struct info_key_s *team;
|
struct info_key_s *team;
|
||||||
|
struct skin_s *skin;
|
||||||
|
|
||||||
int _topcolor;
|
int _topcolor;
|
||||||
int _bottomcolor;
|
int _bottomcolor;
|
||||||
|
|
|
@ -108,8 +108,12 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
||||||
if (bits & U_FRAME)
|
if (bits & U_FRAME)
|
||||||
to->frame = MSG_ReadByte (net_message);
|
to->frame = MSG_ReadByte (net_message);
|
||||||
|
|
||||||
if (bits & U_COLORMAP)
|
if (bits & U_COLORMAP) {
|
||||||
to->colormap = MSG_ReadByte (net_message);
|
byte cmap = MSG_ReadByte (net_message);
|
||||||
|
if (cmap != to->colormap)
|
||||||
|
to->skin = Skin_SetColormap (to->skin, cmap);
|
||||||
|
to->colormap = cmap;
|
||||||
|
}
|
||||||
|
|
||||||
if (bits & U_SKIN)
|
if (bits & U_SKIN)
|
||||||
to->skinnum = MSG_ReadByte (net_message);
|
to->skinnum = MSG_ReadByte (net_message);
|
||||||
|
|
|
@ -242,12 +242,7 @@ CL_LinkPacketEntities (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set colormap
|
// set colormap
|
||||||
if (s1->colormap && (s1->colormap <= MAX_CLIENTS)
|
ent->skin = s1->skin;
|
||||||
&& cl.players[s1->colormap - 1].name[0]) {
|
|
||||||
ent->skin = Skin_SetColormap (ent->skin, s1->colormap);
|
|
||||||
} else {
|
|
||||||
ent->skin = Skin_SetColormap (ent->skin, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
||||||
// Ender: Extend (Colormod) [QSG - Begin]
|
// Ender: Extend (Colormod) [QSG - Begin]
|
||||||
|
@ -469,7 +464,6 @@ CL_LinkPlayers (void)
|
||||||
|
|
||||||
ent->model = cl.model_precache[state->pls.modelindex];
|
ent->model = cl.model_precache[state->pls.modelindex];
|
||||||
ent->frame = state->pls.frame;
|
ent->frame = state->pls.frame;
|
||||||
ent->skin = Skin_SetColormap (ent->skin, j + 1);
|
|
||||||
ent->skinnum = state->pls.skinnum;
|
ent->skinnum = state->pls.skinnum;
|
||||||
|
|
||||||
CL_TransformEntity (ent, ang, false);
|
CL_TransformEntity (ent, ang, false);
|
||||||
|
@ -479,14 +473,15 @@ CL_LinkPlayers (void)
|
||||||
|
|
||||||
if (state->pls.modelindex == cl_playerindex) { //XXX
|
if (state->pls.modelindex == cl_playerindex) { //XXX
|
||||||
// use custom skin
|
// use custom skin
|
||||||
Skin_SetSkin (ent->skin, j + 1, info->skinname->value);
|
ent->skin = info->skin;
|
||||||
|
|
||||||
ent->min_light = min (cl.fbskins, cl_fb_players->value);
|
ent->min_light = min (cl.fbskins, cl_fb_players->value);
|
||||||
|
|
||||||
if (ent->min_light >= 1.0)
|
if (ent->min_light >= 1.0)
|
||||||
ent->fullbright = 1;
|
ent->fullbright = 1;
|
||||||
} else {
|
} else {
|
||||||
Skin_SetSkin (ent->skin, j + 1, 0);
|
// FIXME no team colors on nonstandard player models
|
||||||
|
ent->skin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stuff entity in map
|
// stuff entity in map
|
||||||
|
|
|
@ -1117,8 +1117,9 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
|
||||||
player->spectator = false;
|
player->spectator = false;
|
||||||
|
|
||||||
Skin_SetTranslation (slot + 1, player->topcolor, player->bottomcolor);
|
Skin_SetTranslation (slot + 1, player->topcolor, player->bottomcolor);
|
||||||
//XXX if (cls.state == ca_active)
|
player->skin = Skin_SetSkin (player->skin, slot + 1,
|
||||||
//XXX Skin_Find (player);
|
player->skinname->value);
|
||||||
|
player->skin = Skin_SetColormap (player->skin, slot + 1);
|
||||||
|
|
||||||
Sbar_Changed ();
|
Sbar_Changed ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue