mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
mirror the chase and watervis serverinfo keys in the cl struct so
Info_ValueForKey doesn't get hit so often.
This commit is contained in:
parent
e9c420c749
commit
7fcdffb42e
6 changed files with 20 additions and 8 deletions
|
@ -257,6 +257,10 @@ typedef struct
|
|||
int viewentity;
|
||||
float stdver;
|
||||
|
||||
// serverinfo mirrors
|
||||
int watervis;
|
||||
int chase;
|
||||
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
int num_entities; // stored bottom up in cl_entities array
|
||||
|
|
|
@ -143,8 +143,7 @@ vlen (vec3_t v)
|
|||
qboolean
|
||||
Cam_DrawViewModel (void)
|
||||
{
|
||||
if (atoi (Info_ValueForKey (cl.serverinfo, "chase"))
|
||||
&& chase_active->int_val)
|
||||
if (cl.chase && chase_active->int_val)
|
||||
return false;
|
||||
|
||||
if (!cl.spectator)
|
||||
|
@ -159,8 +158,7 @@ Cam_DrawViewModel (void)
|
|||
qboolean
|
||||
Cam_DrawPlayer (int playernum)
|
||||
{
|
||||
if (atoi (Info_ValueForKey (cl.serverinfo, "chase")) == 0
|
||||
|| chase_active->int_val == 0)
|
||||
if (cl.chase == 0 || chase_active->int_val == 0)
|
||||
return true;
|
||||
|
||||
if (cl.spectator && autocam && locked && cl_chasecam->int_val &&
|
||||
|
|
|
@ -522,7 +522,7 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
IN_Move ();
|
||||
|
||||
// adjust for chase camera angles
|
||||
if (atoi (Info_ValueForKey (cl.serverinfo, "chase"))
|
||||
if (cl.chase
|
||||
&& (chase_active->int_val == 2 || chase_active->int_val == 3))
|
||||
{
|
||||
vec3_t dir = {0,0,0}, forward, right, up;
|
||||
|
|
|
@ -593,6 +593,12 @@ CL_FullServerinfo_f (void)
|
|||
else
|
||||
Con_Printf ("Invalid QSG Protocol number: %s", p);
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "chase")) && *p) {
|
||||
cl.chase = atof (p);
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "watervis")) && *p) {
|
||||
cl.watervis = atof (p);
|
||||
}
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
|
||||
//FIXME didn't actually do anything anyway
|
||||
}
|
||||
|
@ -1473,7 +1479,7 @@ Host_Frame (float time)
|
|||
r_frametime = host_frametime;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (r_active && !atoi (Info_ValueForKey (cl.serverinfo, "watervis")))
|
||||
if (r_active && !cl.watervis && r_wateralpha->value != 1.0)
|
||||
Cvar_SetValue (r_wateralpha, 1);
|
||||
|
||||
CL_UpdateScreen (realtime);
|
||||
|
|
|
@ -1026,6 +1026,11 @@ CL_ServerInfo (void)
|
|||
Con_DPrintf ("SERVERINFO: %s=%s\n", key, value);
|
||||
|
||||
Info_SetValueForKey (cl.serverinfo, key, value, MAX_SERVERINFO_STRING, 0);
|
||||
if (strequal (key, "chase")) {
|
||||
cl.chase = atoi (value);
|
||||
} else if (strequal (key, "watervis")) {
|
||||
cl.watervis = atoi (value);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -729,8 +729,7 @@ V_CalcRefdef (void)
|
|||
} else
|
||||
oldz = cl.simorg[2];
|
||||
|
||||
if (atoi (Info_ValueForKey (cl.serverinfo, "chase"))
|
||||
&& chase_active->int_val)
|
||||
if (cl.chase && chase_active->int_val)
|
||||
Chase_Update ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue