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 // serverinfo mirrors
int chase; int chase;
int sv_cshifts;
int no_pogo_stick; int no_pogo_stick;
int teamplay; int teamplay;
int watervis; int watervis;

View file

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

View file

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