centralize client state setting

This commit is contained in:
Bill Currie 2001-08-20 17:48:16 +00:00
parent a88db4b88c
commit 7df09a3487
4 changed files with 23 additions and 4 deletions

View file

@ -362,4 +362,6 @@ void Cvar_Info (struct cvar_s *var);
void CL_UpdateScreen (double realtime);
void CL_SetState (cactive_t state);
#endif // __client_h

View file

@ -75,7 +75,7 @@ CL_StopPlayback (void)
Qclose (cls.demofile);
cls.demoplayback = false;
cls.demofile = NULL;
cls.state = ca_disconnected;
CL_SetState (ca_disconnected);
if (cls.timedemo)
CL_FinishTimeDemo ();
@ -306,7 +306,7 @@ CL_PlayDemo_f (void)
}
cls.demoplayback = true;
cls.state = ca_connected;
CL_SetState (ca_connected);
cls.forcetrack = 0;
key_dest = key_game;
game_target = IMT_DEFAULT;

View file

@ -241,7 +241,7 @@ CL_Disconnect (void)
SZ_Clear (&cls.message);
NET_Close (cls.netcon);
cls.state = ca_disconnected;
CL_SetState (ca_disconnected);
if (sv.active)
Host_ShutdownServer (false);
}
@ -282,7 +282,7 @@ CL_EstablishConnection (const char *host)
Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host);
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
CL_SetState (ca_connected);
cls.signon = 0; // need all the signon messages
// before playing
key_dest = key_game;
@ -752,6 +752,22 @@ CL_SendCmd (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
Force_CenterView_f (void)
{

View file

@ -997,6 +997,7 @@ Host_Init (quakeparms_t *parms)
Sbar_Init ();
CL_Init ();
}
CL_SetState (ca_disconnected);
Cbuf_InsertText ("exec quake.rc\n");
Cmd_Exec_File (fs_usercfg->string);