cache the cshifts serverinfo value for further reduction of Info_ValueForKey

calls.
This commit is contained in:
Bill Currie 2001-11-11 07:02:38 +00:00
parent e435414b4b
commit fe50e4b1e5
4 changed files with 21 additions and 13 deletions

View File

@ -261,6 +261,7 @@ typedef struct
// serverinfo mirrors
int chase;
int sv_cshifts;
int no_pogo_stick;
int teamplay;
int watervis;

View File

@ -596,17 +596,22 @@ CL_FullServerinfo_f (void)
else
Con_Printf ("Invalid QSG Protocol number: %s", p);
}
cl.chase = cl.sv_cshifts = cl.no_pogo_stick = cl.teamplay = 0;
if ((p = Info_ValueForKey (cl.serverinfo, "chase")) && *p) {
cl.chase = atof (p);
cl.chase = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "cshifts")) && *p) {
cl.sv_cshifts = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "no_pogo_stick")) && *p) {
cl.no_pogo_stick = atof (p);
cl.no_pogo_stick = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "teamplay")) && *p) {
cl.teamplay = atof (p);
cl.teamplay = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "watervis")) && *p) {
cl.watervis = atof (p);
cl.watervis = atoi (p);
}
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
//FIXME didn't actually do anything anyway
@ -1453,7 +1458,7 @@ Host_Frame (float time)
// fetch results from server
CL_ReadPackets ();
if (cl.no_pogo_stick)
if (cl.no_pogo_stick && !no_pogo_stick->int_val)
Cvar_Set (no_pogo_stick, "1");
// send intentions now

View File

@ -1041,6 +1041,12 @@ CL_ServerInfo (void)
Info_SetValueForKey (cl.serverinfo, key, value, 0);
if (strequal (key, "chase")) {
cl.chase = atoi (value);
} else if (strequal (key, "cshifts")) {
cl.sv_cshifts = atoi (value);
} else if (strequal (key, "no_pogo_stick")) {
cl.no_pogo_stick = atoi (value);
} else if (strequal (key, "teamplay")) {
cl.teamplay = atoi (value);
} else if (strequal (key, "watervis")) {
cl.watervis = atoi (value);
}

View File

@ -258,8 +258,7 @@ V_ParseDamage (void)
cl.faceanimtime = cl.time + 0.2; // but sbar face into pain frame
if (cl_cshift_damage->int_val
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) &
INFO_CSHIFT_DAMAGE)) {
|| (cl.sv_cshifts & INFO_CSHIFT_DAMAGE)) {
cl.cshifts[CSHIFT_DAMAGE].percent += 3 * count;
cl.cshifts[CSHIFT_DAMAGE].percent =
@ -313,8 +312,7 @@ void
V_BonusFlash_f (void)
{
if (!cl_cshift_bonus->int_val
&& !(atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) &
INFO_CSHIFT_BONUS))
&& !(cl.sv_cshifts & INFO_CSHIFT_BONUS))
return;
cl.cshifts[CSHIFT_BONUS].destcolor[0] = 215;
@ -332,8 +330,7 @@ void
V_SetContentsColor (int contents)
{
if (!cl_cshift_contents->int_val
&& !(atoi (Info_ValueForKey (cl.serverinfo, "cshifts")) &
INFO_CSHIFT_CONTENTS)) {
&& !(cl.sv_cshifts & INFO_CSHIFT_CONTENTS)) {
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
return;
}
@ -443,8 +440,7 @@ V_PrepBlend (void)
int i, j;
if (cl_cshift_powerup->int_val
|| (atoi (Info_ValueForKey (cl.serverinfo, "cshifts"))
& INFO_CSHIFT_POWERUP))
|| (cl.sv_cshifts & INFO_CSHIFT_POWERUP))
V_CalcPowerupCshift ();
vid.cshift_changed = false;