mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
centralize client state setting so ancilliary operations can be guaranteed
to happen (eg, key binding table selection for console).
This commit is contained in:
parent
d5fa2cc321
commit
7aa7bb663a
5 changed files with 28 additions and 12 deletions
|
@ -326,6 +326,8 @@ void Cvar_Info (struct cvar_s *var);
|
|||
void CL_NetGraph (int swap);
|
||||
void CL_UpdateScreen (double realtime);
|
||||
|
||||
void CL_SetState (cactive_t state);
|
||||
|
||||
#define RSSHOT_WIDTH 320
|
||||
#define RSSHOT_HEIGHT 200
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ CL_StopPlayback (void)
|
|||
|
||||
Qclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.state = ca_disconnected;
|
||||
CL_SetState (ca_disconnected);
|
||||
cls.demoplayback = 0;
|
||||
demotime_cached = 0;
|
||||
|
||||
|
@ -752,7 +752,7 @@ CL_PlayDemo_f (void)
|
|||
}
|
||||
|
||||
cls.demoplayback = true;
|
||||
cls.state = ca_demostart;
|
||||
CL_SetState (ca_demostart);
|
||||
Netchan_Setup (&cls.netchan, net_from, 0);
|
||||
realtime = 0;
|
||||
}
|
||||
|
|
|
@ -495,7 +495,7 @@ CL_Disconnect (void)
|
|||
Netchan_Transmit (&cls.netchan, 6, final);
|
||||
Netchan_Transmit (&cls.netchan, 6, final);
|
||||
|
||||
cls.state = ca_disconnected;
|
||||
CL_SetState (ca_disconnected);
|
||||
|
||||
cls.demoplayback = cls.demorecording = cls.timedemo = false;
|
||||
|
||||
|
@ -824,7 +824,7 @@ CL_Changing_f (void)
|
|||
|
||||
S_StopAllSounds (true);
|
||||
cl.intermission = 0;
|
||||
cls.state = ca_connected; // not active anymore, but not
|
||||
CL_SetState (ca_connected); // not active anymore, but not
|
||||
// disconnected
|
||||
Con_Printf ("\nChanging map...\n");
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ CL_ConnectionlessPacket (void)
|
|||
Netchan_Setup (&cls.netchan, net_from, cls.qport);
|
||||
MSG_WriteChar (&cls.netchan.message, clc_stringcmd);
|
||||
MSG_WriteString (&cls.netchan.message, "new");
|
||||
cls.state = ca_connected;
|
||||
CL_SetState (ca_connected);
|
||||
Con_Printf ("Connected.\n");
|
||||
allowremotecmd = false; // localid required now for remote
|
||||
// cmds
|
||||
|
@ -1097,12 +1097,28 @@ Force_CenterView_f (void)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
CL_SetState (cactive_t state)
|
||||
{
|
||||
cls.state = state;
|
||||
if (cls.state == ca_active) {
|
||||
r_active = true;
|
||||
game_target = IMT_DEFAULT;
|
||||
key_dest = key_game;
|
||||
} else {
|
||||
r_active = false;
|
||||
game_target = IMT_CONSOLE;
|
||||
key_dest = key_console;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_Init (void)
|
||||
{
|
||||
char st[80];
|
||||
|
||||
cls.state = ca_disconnected;
|
||||
CL_SetState (ca_disconnected);
|
||||
|
||||
Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING, 0);
|
||||
Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING, 0);
|
||||
|
@ -1662,7 +1678,7 @@ Host_Init (void)
|
|||
|
||||
S_Init ();
|
||||
|
||||
cls.state = ca_disconnected;
|
||||
CL_SetState (ca_disconnected);
|
||||
Sbar_Init ();
|
||||
CL_Skin_Init ();
|
||||
CL_Init ();
|
||||
|
@ -1674,7 +1690,7 @@ Host_Init (void)
|
|||
|
||||
S_Init ();
|
||||
|
||||
cls.state = ca_disconnected;
|
||||
CL_SetState (ca_disconnected);
|
||||
CDAudio_Init ();
|
||||
Sbar_Init ();
|
||||
CL_Skin_Init ();
|
||||
|
|
|
@ -711,7 +711,7 @@ CL_ParseServerData (void)
|
|||
va (soundlist_name, cl.servercount, 0));
|
||||
|
||||
// now waiting for downloads, etc
|
||||
cls.state = ca_onserver;
|
||||
CL_SetState (ca_onserver);
|
||||
|
||||
CL_ClearBaselines ();
|
||||
}
|
||||
|
|
|
@ -141,9 +141,7 @@ CL_PredictMove (void)
|
|||
if (cls.state == ca_onserver) { // first update is the final signon
|
||||
// stage
|
||||
VID_SetCaption (cls.servername);
|
||||
cls.state = ca_active;
|
||||
key_dest = key_game;
|
||||
game_target = IMT_DEFAULT;
|
||||
CL_SetState (ca_active);
|
||||
}
|
||||
|
||||
if (cl_nopred->int_val) {
|
||||
|
|
Loading…
Reference in a new issue