Hipnotic/Rogue weapon mask comments and cleanup.

This too has been sitting around for a while. Taken from fitzquake.
This commit is contained in:
Bill Currie 2011-12-12 08:57:17 +09:00
parent d32fa834cc
commit 60c9d05d47
2 changed files with 9 additions and 1 deletions

View file

@ -792,6 +792,7 @@ CL_ParseClientdata (void)
Sbar_Changed (); Sbar_Changed ();
} }
} else { } else {
// hipnotic/rogue weapon "bit field" (stupid idea)
if (cl.stats[STAT_ACTIVEWEAPON] != (1 << i)) { if (cl.stats[STAT_ACTIVEWEAPON] != (1 << i)) {
cl.stats[STAT_ACTIVEWEAPON] = (1 << i); cl.stats[STAT_ACTIVEWEAPON] = (1 << i);
Sbar_Changed (); Sbar_Changed ();

View file

@ -747,8 +747,15 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
if (standard_quake) { if (standard_quake) {
MSG_WriteByte (msg, SVfloat (ent, weapon)); MSG_WriteByte (msg, SVfloat (ent, weapon));
} else { } else {
// NOTE: this is abysmally stupid. weapon is being treated as a
// radio button style bit mask, limiting the available weapons to
// 32. Sure, that's a lot of weapons, but still...
//
// Send the index of the lowest order set bit.
unsigned weapon;
weapon = (unsigned) SVfloat (ent, weapon);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (((int) SVfloat (ent, weapon)) & (1 << i)) { if (weapon & (1 << i)) {
MSG_WriteByte (msg, i); MSG_WriteByte (msg, i);
break; break;
} }