Split nq's colors into topcolor/bottomcolor.

The protocol is not affected: the incoming colors byte is split into the
two fields when read from the packet. This simplifies a lot of code
elsewhere.
This commit is contained in:
Bill Currie 2012-05-26 12:04:23 +09:00
parent afec630d1a
commit bf751cafe0
3 changed files with 17 additions and 19 deletions

View File

@ -57,7 +57,8 @@ typedef struct
char name[MAX_SCOREBOARDNAME];
float entertime;
int frags;
int colors; // two 4 bit fields
int topcolor;
int bottomcolor;
} scoreboard_t;

View File

@ -533,8 +533,8 @@ CL_ParseUpdate (int bits)
ent->skinnum = skin;
if (num <= cl.maxclients) {
ent->skin = mod_funcs->Skin_SetColormap (ent->skin, num);
mod_funcs->Skin_SetTranslation (num, cl.scores[num].colors >> 4,
cl.scores[num].colors & 0xf);
mod_funcs->Skin_SetTranslation (num, cl.scores[num].topcolor,
cl.scores[num].bottomcolor);
}
}
@ -1053,10 +1053,13 @@ CL_ParseServerMessage (void)
} else {
entity_t *ent = &cl_entities[i+1];
byte col = MSG_ReadByte (net_message);
if (col != cl.scores[i].colors)
mod_funcs->Skin_SetTranslation (i + 1, col >> 4,
col & 0xf);
cl.scores[i].colors = col;
byte top = col >> 4;
byte bot = col & 0xf;
if (top != cl.scores[i].topcolor
|| bot != cl.scores[i].bottomcolor)
mod_funcs->Skin_SetTranslation (i + 1, top, bot);
cl.scores[i].topcolor = top;
cl.scores[i].bottomcolor = bot;
ent->skin = mod_funcs->Skin_SetColormap (ent->skin, i + 1);
}
break;

View File

@ -596,10 +596,8 @@ draw_frags (view_t *view)
continue;
// draw background
top = (((unsigned) s->colors) >> 4) & 0x0f;
bottom = s->colors & 0x0f;
top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom);
top = Sbar_ColorForMap (s->topcolor);
bottom = Sbar_ColorForMap (s->bottomcolor);
draw_fill (view, x + 4, 1, 28, 4, top);
draw_fill (view, x + 4, 5, 28, 3, bottom);
@ -811,10 +809,8 @@ draw_rogue_face (view_t *view)
s = &cl.scores[cl.viewentity - 1];
top = (((unsigned) s->colors) >> 4) & 0x0f;
bottom = s->colors & 0x0f;
top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom);
top = Sbar_ColorForMap (s->topcolor);
bottom = Sbar_ColorForMap (s->bottomcolor);
draw_pic (view, 112, 0, rsb_teambord);
draw_fill (view, 113, 3, 22, 9, top);
@ -1052,10 +1048,8 @@ Sbar_DeathmatchOverlay (view_t *view)
continue;
// draw background
top = (((unsigned) s->colors) >> 4) & 0x0f;
bottom = s->colors & 0x0f;
top = Sbar_ColorForMap (top);
bottom = Sbar_ColorForMap (bottom);
top = Sbar_ColorForMap (s->topcolor);
bottom = Sbar_ColorForMap (s->bottomcolor);
draw_fill (view, x, y, 40, 4, top);
draw_fill (view, x, y + 4, 40, 4, bottom);