/* ================= CL_Vid_Restart_f Restart the video subsystem ================= */ void CL_Vid_Restart_f( void ) { S_StopAllSounds(); // don't let them loop during the restart S_BeginRegistration(); // all sound handles are now invalid CL_ShutdownRef(); CL_ShutdownUI(); CL_ShutdownCGame(); //rww - sof2mp does this here, but it seems to cause problems in this codebase. // CM_ClearMap(); CL_InitRef(); cls.rendererStarted = qfalse; cls.uiStarted = qfalse; cls.cgameStarted = qfalse; cls.soundRegistered = qfalse; #ifdef _IMMERSION CL_ShutdownFF(); cls.forceStarted = qfalse; #endif // _IMMERSION #ifdef _XBOX vidRestartReloadMap = qtrue; #endif // unpause so the cgame definately gets a snapshot and renders a frame Cvar_Set( "cl_paused", "0" ); }
/* ================= CL_Vid_Restart_f Restart the video subsystem ================= */ void CL_Vid_Restart_f( void ) { S_StopAllSounds(); // don't let them loop during the restart S_BeginRegistration(); // all sound handles are now invalid CL_ShutdownRef(); CL_ShutdownUI(); CL_ShutdownCGame(); CL_InitRef(); cls.rendererStarted = qfalse; cls.uiStarted = qfalse; cls.cgameStarted = qfalse; cls.soundRegistered = qfalse; // unpause so the cgame definately gets a snapshot and renders a frame Cvar_Set( "cl_paused", "0" ); }
/* =============== CL_Shutdown =============== */ void CL_Shutdown( void ) { static qboolean recursive = qfalse; if ( !com_cl_running || !com_cl_running->integer ) { return; } Com_Printf( "----- CL_Shutdown -----\n" ); if ( recursive ) { printf ("recursive shutdown\n"); return; } recursive = qtrue; CL_ShutdownUI(); CL_Disconnect(); S_Shutdown(); CL_ShutdownRef(); #ifdef _IMMERSION CL_ShutdownFF(); #endif // _IMMERSION Cmd_RemoveCommand ("cmd"); Cmd_RemoveCommand ("configstrings"); Cmd_RemoveCommand ("clientinfo"); Cmd_RemoveCommand ("snd_restart"); Cmd_RemoveCommand ("vid_restart"); Cmd_RemoveCommand ("disconnect"); Cmd_RemoveCommand ("cinematic"); Cmd_RemoveCommand ("ingamecinematic"); Cmd_RemoveCommand ("pause"); Cvar_Set( "cl_running", "0" ); recursive = qfalse; memset( &cls, 0, sizeof( cls ) ); Com_Printf( "-----------------------\n" ); }
/* =============== CL_Shutdown =============== */ void CL_Shutdown( void ) { static qboolean recursive = qfalse; if ( !com_cl_running || !com_cl_running->integer ) { return; } Com_Printf( "----- CL_Shutdown -----\n" ); if ( recursive ) { Com_Printf( "WARNING: Recursive shutdown\n" ); return; } recursive = qtrue; CL_ShutdownUI(); CL_Disconnect(); S_Shutdown(); CL_ShutdownRef(qfalse); Cmd_RemoveCommand ("cmd"); Cmd_RemoveCommand ("configstrings"); Cmd_RemoveCommand ("clientinfo"); Cmd_RemoveCommand ("snd_restart"); Cmd_RemoveCommand ("vid_restart"); Cmd_RemoveCommand ("disconnect"); Cmd_RemoveCommand ("cinematic"); Cmd_RemoveCommand ("ingamecinematic"); Cmd_RemoveCommand ("uimenu"); Cmd_RemoveCommand ("datapad"); Cmd_RemoveCommand ("endscreendissolve"); Cvar_Set( "cl_running", "0" ); recursive = qfalse; memset( &cls, 0, sizeof( cls ) ); Com_Printf( "-----------------------\n" ); }
int Win_Main( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { char cwd[MAX_OSPATH]; int startTime, endTime; // should never get a previous instance in Win32 if ( hPrevInstance ) { return 0; } if( setjmp( sys_exitframe ) ) { //make sure that any subsystems that may have spawned threads go down __try { #if !defined(DEDICATED) S_Shutdown(); CL_ShutdownRef(); #endif } __finally { //wheeeee... Com_ReleaseMemory(); } return sys_retcode; } #ifdef EXCEPTION_HANDLER WinSetExceptionVersion( Q3_VERSION ); #endif g_wv.hInstance = hInstance; Q_strncpyz( sys_cmdline, lpCmdLine, sizeof( sys_cmdline ) ); // done before Com/Sys_Init since we need this for error output Sys_CreateConsole(); // no abort/retry/fail errors SetErrorMode( SEM_FAILCRITICALERRORS ); // get the initial time base Sys_Milliseconds(); Com_Init( sys_cmdline ); NET_Init(); #ifndef DEDICATED IN_Init(); // fretn - directinput must be inited after video etc #endif _getcwd( cwd, sizeof( cwd ) ); Com_Printf( "Working directory: %s\n", cwd ); // hide the early console since we've reached the point where we // have a working graphics subsystems #if defined (_WIN32) && !defined (_DEBUG) if ( !com_dedicated->integer && !com_viewlog->integer ) { Sys_ShowConsole( 0, qfalse ); } #endif SetFocus( g_wv.hWnd ); // main game loop while( 1 ) { // if not running as a game client, sleep a bit if( g_wv.isMinimized || ( com_dedicated && com_dedicated->integer ) ) { Sleep( 5 ); } // set low precision every frame, because some system calls // reset it arbitrarily //_controlfp( _PC_24, _MCW_PC ); //_controlfp( -1, _MCW_EM ); // no exceptions, even if some crappy // syscall turns them back on! startTime = Sys_Milliseconds(); // make sure mouse and joystick are only called once a frame IN_Frame(); // run the game //Com_FrameExt(); Com_Frame(); endTime = Sys_Milliseconds(); totalMsec += endTime - startTime; countMsec++; } // never gets here }