/* ============================ CL_StartHunkUsers After the server has cleared the hunk, these will need to be restarted This is the only place that any of these functions are called from ============================ */ void CL_StartHunkUsers( void ) { if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { cls.rendererStarted = qtrue; CL_InitRenderer(); } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } //we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } // if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) { cls.cgameStarted = qtrue; CL_InitCGame(); } }
/* ============================ CL_StartHunkUsers After the server has cleared the hunk, these will need to be restarted This is the only place that any of these functions are called from ============================ */ void CL_StartHunkUsers( void ) { if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { #ifdef _XBOX //if ((!com_sv_running->integer || com_errorEntered) && !vidRestartReloadMap) //{ // // free up some memory // extern void SV_ClearLastLevel(void); // SV_ClearLastLevel(); //} #endif cls.rendererStarted = qtrue; re.BeginRegistration( &cls.glconfig ); // load character sets // cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" ); cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" ); cls.whiteShader = re.RegisterShader( "white" ); cls.consoleShader = re.RegisterShader( "console" ); g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2; kg.g_consoleField.widthInChars = g_console_field_width; } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } #if !defined (_XBOX) //i guess xbox doesn't want the ui loaded all the time? //we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } #endif // if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) { cls.cgameStarted = qtrue; CL_InitCGame(); } }
/* ============================ CL_StartHunkUsers After the server has cleared the hunk, these will need to be restarted This is the only place that any of these functions are called from ============================ */ void CL_StartHunkUsers( void ) { if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { cls.rendererStarted = qtrue; re.BeginRegistration( &cls.glconfig ); // load character sets // cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" ); cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" ); cls.whiteShader = re.RegisterShader( "white" ); cls.consoleShader = re.RegisterShader( "console" ); g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2; kg.g_consoleField.widthInChars = g_console_field_width; } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } //we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } // if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) { cls.cgameStarted = qtrue; CL_InitCGame(); } }
void CL_Frame ( int msec,float fractionMsec ) { if ( !com_cl_running->integer ) { return; } // load the ref / cgame if needed CL_StartHunkUsers(); #if defined (_XBOX)// && !defined(_DEBUG) // Play the intro movies once static bool firstRun = true; if(firstRun) { // SP_DoLicense(); SP_DisplayLogos(); } #endif #if defined (_XBOX) //xbox doesn't load ui in StartHunkUsers, so check it here // load ui if needed if ( !cls.uiStarted && cls.state != CA_CINEMATIC) { cls.uiStarted = qtrue; SCR_StopCinematic(); CL_InitUI(); } #endif if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI ) && !com_sv_running->integer ) { // if disconnected, bring up the menu if (!CL_CheckPendingCinematic()) // this avoid having the menu flash for one frame before pending cinematics { #ifdef _XBOX if (firstRun) { UI_SetActiveMenu("splashMenu", NULL); } else #endif UI_SetActiveMenu( "mainMenu",NULL ); } } #ifdef _XBOX firstRun = false; #endif // if recording an avi, lock to a fixed fps if ( cl_avidemo->integer ) { // save the current screen if ( cls.state == CA_ACTIVE ) { if (cl_avidemo->integer > 0) { Cbuf_ExecuteText( EXEC_NOW, "screenshot silent\n" ); } else { Cbuf_ExecuteText( EXEC_NOW, "screenshot_tga silent\n" ); } } // fixed time for next frame if (cl_avidemo->integer > 0) { msec = 1000 / cl_avidemo->integer; } else { msec = 1000 / -cl_avidemo->integer; } } // save the msec before checking pause cls.realFrametime = msec; // decide the simulation time cls.frametime = msec; if(cl_framerate->integer) { avgFrametime+=msec; char mess[256]; if(!(frameCount&0x1f)) { sprintf(mess,"Frame rate=%f\n\n",1000.0f*(1.0/(avgFrametime/32.0f))); // OutputDebugString(mess); Com_Printf(mess); avgFrametime=0.0f; } frameCount++; } cls.frametimeFraction=fractionMsec; cls.realtime += msec; cls.realtimeFraction+=fractionMsec; if (cls.realtimeFraction>=1.0f) { if (cl_newClock&&cl_newClock->integer) { cls.realtime++; } cls.realtimeFraction-=1.0f; } #ifndef _XBOX if ( cl_timegraph->integer ) { SCR_DebugGraph ( cls.realFrametime * 0.25, 0 ); } #endif #ifdef _XBOX //Check on the hot swappable button states. CL_UpdateHotSwap(); #endif // see if we need to update any userinfo CL_CheckUserinfo(); // if we haven't gotten a packet in a long time, // drop the connection CL_CheckTimeout(); // send intentions now CL_SendCmd(); // resend a connection request if necessary CL_CheckForResend(); // decide on the serverTime to render CL_SetCGameTime(); if (cl_pano->integer && cls.state == CA_ACTIVE) { //grab some panoramic shots int i = 1; int pref = cl_pano->integer; int oldnoprint = cl_noprint->integer; Con_Close(); cl_noprint->integer = 1; //hide the screen shot msgs for (; i <= cl_panoNumShots->integer; i++) { Cvar_SetValue( "pano", i ); SCR_UpdateScreen();// update the screen Cbuf_ExecuteText( EXEC_NOW, va("screenshot %dpano%02d\n", pref, i) ); //grab this screen } Cvar_SetValue( "pano", 0 ); //done cl_noprint->integer = oldnoprint; } if (cl_skippingcin->integer && !cl_endcredits->integer && !com_developer->integer ) { if (cl_skippingcin->modified){ S_StopSounds(); //kill em all but music cl_skippingcin->modified=qfalse; Com_Printf (va(S_COLOR_YELLOW"%s"), SE_GetString("CON_TEXT_SKIPPING")); SCR_UpdateScreen(); } } else { // update the screen SCR_UpdateScreen(); #if defined(_XBOX) && !defined(FINAL_BUILD) if (D3DPERF_QueryRepeatFrame()) SCR_UpdateScreen(); #endif } // update audio S_Update(); #ifdef _IMMERSION FF_Update(); #endif // _IMMERSION // advance local effects for next frame SCR_RunCinematic(); Con_RunConsole(); cls.framecount++; }
/* ============================ CL_StartHunkUsers After the server has cleared the hunk, these will need to be restarted This is the only place that any of these functions are called from ============================ */ void CL_StartHunkUsers( void ) { if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { #ifdef _XBOX //if ((!com_sv_running->integer || com_errorEntered) && !vidRestartReloadMap) //{ // // free up some memory // extern void SV_ClearLastLevel(void); // SV_ClearLastLevel(); //} #endif cls.rendererStarted = qtrue; re.BeginRegistration( &cls.glconfig ); // load character sets // cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" ); cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" ); cls.whiteShader = re.RegisterShader( "white" ); cls.consoleShader = re.RegisterShader( "console" ); g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2; kg.g_consoleField.widthInChars = g_console_field_width; #ifndef _IMMERSION //------- // The latest Immersion Force Feedback system initializes here, not through // win32 input system. Therefore, the window handle is valid :) //------- // now that the renderer has started up we know that the global hWnd is now valid, // so we can now go ahead and (re)setup the input stuff that needs hWnds for DI... // (especially Force feedback)... // static qboolean bOnceOnly = qfalse; // only do once, not every renderer re-start if (!bOnceOnly) { bOnceOnly = qtrue; extern void Sys_In_Restart_f( void ); Sys_In_Restart_f(); } #ifdef _XBOX if (vidRestartReloadMap) { int checksum; CM_LoadMap(va("maps/%s.bsp", cl_mapname->string), qfalse, &checksum); RE_LoadWorldMap(va("maps/%s.bsp", cl_mapname->string)); vidRestartReloadMap = qfalse; } #endif // _XBOX #endif // _IMMERSION } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } #ifdef _IMMERSION if ( !cls.forceStarted ) { cls.forceStarted = qtrue; CL_InitFF(); } #endif // _IMMERSION #if !defined (_XBOX) //i guess xbox doesn't want the ui loaded all the time? //we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } #endif // if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) { cls.cgameStarted = qtrue; CL_InitCGame(); } }
void CL_Frame ( int msec,float fractionMsec ) { checkAutoSave(); //saves the game immediately after starting a level if ( !com_cl_running->integer ) { return; } // load the ref / cgame if needed CL_StartHunkUsers(); #if defined (_XBOX)// && !defined(_DEBUG) // Play the intro movies once extern bool Sys_QuickStart( void ); static bool firstRun = true; if(firstRun) { // SP_DoLicense(); SP_DisplayLogos(); } #endif #if defined (_XBOX) //xbox doesn't load ui in StartHunkUsers, so check it here // load ui if needed if ( !cls.uiStarted && cls.state != CA_CINEMATIC) { cls.uiStarted = qtrue; SCR_StopCinematic(); CL_InitUI(); } #endif if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI ) && !com_sv_running->integer ) { // if disconnected, bring up the menu #ifdef _XBOX if (firstRun && !Sys_QuickStart()) { // Fresh boot UI_SetActiveMenu("splashMenu", NULL); } else if (firstRun) { // Came from MP: UI_SetActiveMenu("mainMenu", NULL); extern void XB_Startup( XBStartupState startupState ); XB_Startup( STARTUP_LOAD_SETTINGS ); } else { #ifdef XBOX_DEMO // Quitting the demo returns to the IIS, and restores settings: Settings.RestoreDefaults(); Settings.SetAll(); UI_SetActiveMenu("splashMenu", NULL); #else UI_SetActiveMenu("mainMenu", NULL); #endif } #else if (!CL_CheckPendingCinematic()) // this avoid having the menu flash for one frame before pending cinematics { UI_SetActiveMenu("mainMenu", NULL); } #endif S_StartBackgroundTrack("music/mp/MP_action4.mp3","",0); } #ifdef _XBOX firstRun = false; #endif // if recording an avi, lock to a fixed fps if ( cl_avidemo->integer ) { // save the current screen if ( cls.state == CA_ACTIVE ) { if (cl_avidemo->integer > 0) { Cbuf_ExecuteText( EXEC_NOW, "screenshot silent\n" ); } else { Cbuf_ExecuteText( EXEC_NOW, "screenshot_tga silent\n" ); } } // fixed time for next frame if (cl_avidemo->integer > 0) { msec = 1000 / cl_avidemo->integer; } else { msec = 1000 / -cl_avidemo->integer; } } // save the msec before checking pause cls.realFrametime = msec; // decide the simulation time cls.frametime = msec; //if(cl_framerate->integer) //{ // avgFrametime+=msec; // char mess[256]; // if(!(frameCount&0x1f)) // { // sprintf(mess,"Frame rate=%f\n\n",1000.0f*(1.0/(avgFrametime/32.0f))); //// OutputDebugString(mess); // Com_Printf(mess); // avgFrametime=0.0f; // } // frameCount++; //} // Always calculate framerate, bias the LOD if low avgFrametime+=msec; extern bool in_camera; float framerate = 1000.0f*(1.0/(avgFrametime/32.0f)); static int lodFrameCount = 0; int bias = Cvar_VariableIntegerValue("r_lodbias"); if(!(frameCount&0x1f)) { if(cl_framerate->integer) { char mess[256]; sprintf(mess,"Frame rate=%f LOD=%d\n\n",framerate,bias); Com_Printf(mess); } avgFrametime=0.0f; // If we drop below 20FPS, pull down the LOD bias if(framerate < 20.0f && bias == 0) { bias++; Cvar_SetValue("r_lodbias", bias); lodFrameCount = -1; } lodFrameCount++; if(lodFrameCount==5 && bias > 0) { bias--; Cvar_SetValue("r_lodBias", bias); lodFrameCount = 0; } } frameCount++; if(in_camera) { // No LOD stuff during cutscenes Cvar_SetValue("r_lodBias", 0); } cls.frametimeFraction=fractionMsec; cls.realtime += msec; cls.realtimeFraction+=fractionMsec; if (cls.realtimeFraction>=1.0f) { if (cl_newClock&&cl_newClock->integer) { cls.realtime++; } cls.realtimeFraction-=1.0f; } #ifndef _XBOX if ( cl_timegraph->integer ) { SCR_DebugGraph ( cls.realFrametime * 0.25, 0 ); } #endif #ifdef _XBOX //Check on the hot swappable button states. CL_UpdateHotSwap(); #endif // see if we need to update any userinfo CL_CheckUserinfo(); // if we haven't gotten a packet in a long time, // drop the connection CL_CheckTimeout(); // send intentions now CL_SendCmd(); // resend a connection request if necessary CL_CheckForResend(); // decide on the serverTime to render CL_SetCGameTime(); if (cl_pano->integer && cls.state == CA_ACTIVE) { //grab some panoramic shots int i = 1; int pref = cl_pano->integer; int oldnoprint = cl_noprint->integer; Con_Close(); cl_noprint->integer = 1; //hide the screen shot msgs for (; i <= cl_panoNumShots->integer; i++) { Cvar_SetValue( "pano", i ); SCR_UpdateScreen();// update the screen Cbuf_ExecuteText( EXEC_NOW, va("screenshot %dpano%02d\n", pref, i) ); //grab this screen } Cvar_SetValue( "pano", 0 ); //done cl_noprint->integer = oldnoprint; } if (cl_skippingcin->integer && !cl_endcredits->integer && !com_developer->integer ) { if (cl_skippingcin->modified){ S_StopSounds(); //kill em all but music cl_skippingcin->modified=qfalse; Com_Printf (va(S_COLOR_YELLOW"%s"), SE_GetString("CON_TEXT_SKIPPING")); SCR_UpdateScreen(); } } else { // update the screen SCR_UpdateScreen(); #if defined(_XBOX) && !defined(FINAL_BUILD) if (D3DPERF_QueryRepeatFrame()) SCR_UpdateScreen(); #endif } // update audio S_Update(); #ifdef _IMMERSION FF_Update(); #endif // _IMMERSION // advance local effects for next frame SCR_RunCinematic(); Con_RunConsole(); cls.framecount++; }