diff --git a/Quake/cl_parse.c b/Quake/cl_parse.c index d534f365..7f216ed0 100644 --- a/Quake/cl_parse.c +++ b/Quake/cl_parse.c @@ -1764,16 +1764,21 @@ static void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added ar } +#define CL_SetStati(stat, val) cl.statsf[stat] = (cl.stats[stat] = val) +#define CL_SetHudStat(stat, val) if (cl.stats[stat] != val)Sbar_Changed(); CL_SetStati(stat,val) + /* ================== CL_ParseClientdata Server information pertaining to this client only + +Spike -- tweaked this function to ensure float stats get set as well as int ones (so csqc can't get confused). ================== */ static void CL_ParseClientdata (void) { - int i, j; + int i; int bits; //johnfitz bits = (unsigned short)MSG_ReadShort (); //johnfitz -- read bits here isntead of in CL_ParseServerMessage() @@ -1789,14 +1794,14 @@ static void CL_ParseClientdata (void) bits |= SU_ITEMS; if (bits & SU_VIEWHEIGHT) - cl.stats[STAT_VIEWHEIGHT] = MSG_ReadChar (); + CL_SetStati(STAT_VIEWHEIGHT, MSG_ReadChar ()); else if (cl.protocol != PROTOCOL_VERSION_DP7) - cl.stats[STAT_VIEWHEIGHT] = DEFAULT_VIEWHEIGHT; + CL_SetStati(STAT_VIEWHEIGHT, DEFAULT_VIEWHEIGHT); if (bits & SU_IDEALPITCH) - cl.statsf[STAT_IDEALPITCH] = MSG_ReadChar (); + CL_SetStati(STAT_IDEALPITCH, MSG_ReadChar ()); else - cl.statsf[STAT_IDEALPITCH] = 0; + CL_SetStati(STAT_IDEALPITCH, 0); VectorCopy (cl.mvelocity[0], cl.mvelocity[1]); for (i = 0; i < 3; i++) @@ -1819,13 +1824,15 @@ static void CL_ParseClientdata (void) //johnfitz -- update v_punchangles if (v_punchangles[0][0] != cl.punchangle[0] || v_punchangles[0][1] != cl.punchangle[1] || v_punchangles[0][2] != cl.punchangle[2]) { + v_punchangles_times[1] = v_punchangles_times[0]; + v_punchangles_times[0] = cl.mtime[0]; VectorCopy (v_punchangles[0], v_punchangles[1]); VectorCopy (cl.punchangle, v_punchangles[0]); } //johnfitz if (bits & SU_ITEMS) - cl.stats[STAT_ITEMS] = MSG_ReadLong (); + CL_SetStati(STAT_ITEMS, MSG_ReadLong ()); cl.onground = (bits & SU_ONGROUND) != 0; cl.inwater = (bits & SU_INWATER) != 0; @@ -1836,101 +1843,66 @@ static void CL_ParseClientdata (void) } else { + unsigned short weaponframe = 0; + unsigned short armourval = 0; + unsigned short weaponmodel = 0; + unsigned int activeweapon; + short health; + unsigned short ammo; + unsigned short ammovals[4]; + if (bits & SU_WEAPONFRAME) - cl.stats[STAT_WEAPONFRAME] = MSG_ReadByte (); - else - cl.stats[STAT_WEAPONFRAME] = 0; - + weaponframe = MSG_ReadByte (); if (bits & SU_ARMOR) - i = MSG_ReadByte (); - else - i = 0; - if (cl.stats[STAT_ARMOR] != i) - { - cl.stats[STAT_ARMOR] = i; - Sbar_Changed (); - } - + armourval = MSG_ReadByte (); if (bits & SU_WEAPON) { if (cl.protocol == PROTOCOL_VERSION_BJP3) - i = MSG_ReadShort(); + weaponmodel = MSG_ReadShort(); else - i = MSG_ReadByte (); + weaponmodel = MSG_ReadByte (); } - else - i = 0; - if (cl.stats[STAT_WEAPON] != i) - { - cl.stats[STAT_WEAPON] = i; - Sbar_Changed (); - } - - i = MSG_ReadShort (); - if (cl.stats[STAT_HEALTH] != i) - { - cl.stats[STAT_HEALTH] = i; - Sbar_Changed (); - } - - i = MSG_ReadByte (); - if (cl.stats[STAT_AMMO] != i) - { - cl.stats[STAT_AMMO] = i; - Sbar_Changed (); - } - + health = MSG_ReadShort (); + ammo = MSG_ReadByte (); for (i = 0; i < 4; i++) - { - j = MSG_ReadByte (); - if (cl.stats[STAT_SHELLS+i] != j) - { - cl.stats[STAT_SHELLS+i] = j; - Sbar_Changed (); - } - } - - i = MSG_ReadByte (); - - if (standard_quake) - { - if (cl.stats[STAT_ACTIVEWEAPON] != i) - { - cl.stats[STAT_ACTIVEWEAPON] = i; - Sbar_Changed (); - } - } - else - { - if (cl.stats[STAT_ACTIVEWEAPON] != (1<