/* ===================== CL_MapLoading A local server is starting to load a map, so update the screen to let the user know about it, then dump all client memory on the hunk from cgame, ui, and renderer ===================== */ void CL_MapLoading( void ) { if ( !com_cl_running->integer ) { return; } Con_Close(); cls.keyCatchers = 0; // if we are already connected to the local host, stay connected if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) { cls.state = CA_CONNECTED; // so the connect screen is drawn memset( cls.updateInfoString, 0, sizeof( cls.updateInfoString ) ); // memset( clc.serverMessage, 0, sizeof( clc.serverMessage ) ); memset( &cl.gameState, 0, sizeof( cl.gameState ) ); clc.lastPacketSentTime = -9999; SCR_UpdateScreen(); } else { // clear nextmap so the cinematic shutdown doesn't execute it Cvar_Set( "nextmap", "" ); CL_Disconnect(); Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) ); cls.state = CA_CHALLENGING; // so the connect screen is drawn cls.keyCatchers = 0; SCR_UpdateScreen(); clc.connectTime = -RETRANSMIT_TIMEOUT; NET_StringToAdr( cls.servername, &clc.serverAddress); // we don't need a challenge on the localhost CL_CheckForResend(); } CL_FlushMemory(); }
/* ================== CL_SendCommand ================== */ void CL_SendCommand( void ) { // send intentions now CL_SendCmd (); // resend a connection request if necessary CL_CheckForResend (); }
void CL_SendCommand(void) { /* update windowed_mouse cvar */ CL_UpdateWindowedMouse(); /* get new key events */ Sys_SendKeyEvents(); /* process console commands */ Cbuf_Execute(); /* fix any cheating cvars */ CL_FixCvarCheats(); /* send intentions now */ CL_SendCmd(); /* resend a connection request if necessary */ CL_CheckForResend(); }
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++; }
void CL_BeginServerConnect(void) { connect_time = 0; CL_CheckForResend(); }
void CL_Frame(int packetdelta, int renderdelta, int timedelta, qboolean packetframe, qboolean renderframe) { static int lasttimecalled; // Dedicated? if (dedicated->value) { return; } // Calculate simulation time. cls.nframetime = packetdelta / 1000000.0f; cls.rframetime = renderdelta / 1000000.0f; cls.realtime = curtime; cl.time += timedelta / 1000; // Don't extrapolate too far ahead. if (cls.nframetime > 0.5f) { cls.nframetime = 0.5f; } if (cls.rframetime > 0.5f) { cls.rframetime = 0.5f; } // if in the debugger last frame, don't timeout. if (timedelta > 5000000) { cls.netchan.last_received = Sys_Milliseconds(); } // Reset power shield / power screen sound counter. num_power_sounds = 0; if (!cl_timedemo->value) { // Don't throttle too much when connecting / loading. if ((cls.state == ca_connected) && (packetdelta > 100000)) { packetframe = true; } } // Run HTTP downloads more often while connecting. #ifdef USE_CURL if (cls.state == ca_connected) { CL_RunHTTPDownloads(); } #endif // Update input stuff. if (packetframe || renderframe) { CL_ReadPackets(); CL_UpdateWindowedMouse(); IN_Update(); Cbuf_Execute(); CL_FixCvarCheats(); if (cls.state > ca_connecting) { CL_RefreshCmd(); } else { CL_RefreshMove(); } } if (cls.forcePacket || userinfo_modified) { packetframe = true; cls.forcePacket = false; } if (packetframe) { CL_SendCmd(); CL_CheckForResend(); // Run HTTP downloads during game. #ifdef USE_CURL CL_RunHTTPDownloads(); #endif } if (renderframe) { VID_CheckChanges(); CL_PredictMovement(); if (!cl.refresh_prepped && (cls.state == ca_active)) { CL_PrepRefresh(); } /* update the screen */ if (host_speeds->value) { time_before_ref = Sys_Milliseconds(); } SCR_UpdateScreen(); if (host_speeds->value) { time_after_ref = Sys_Milliseconds(); } /* update audio */ S_Update(cl.refdef.vieworg, cl.v_forward, cl.v_right, cl.v_up); /* advance local effects for next frame */ CL_RunDLights(); CL_RunLightStyles(); SCR_RunCinematic(); SCR_RunConsole(); /* Update framecounter */ cls.framecount++; if (log_stats->value) { if (cls.state == ca_active) { if (!lasttimecalled) { lasttimecalled = Sys_Milliseconds(); if (log_stats_file) { fprintf(log_stats_file, "0\n"); } } else { int now = Sys_Milliseconds(); if (log_stats_file) { fprintf(log_stats_file, "%d\n", now - lasttimecalled); } lasttimecalled = now; } } } } }
void CL_Frame ( int msec,float fractionMsec ) { if ( !com_cl_running->integer ) { return; } // load the ref / cgame if needed CL_StartHunkUsers(); if ( cls.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & 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 { UI_SetActiveMenu( "mainMenu",NULL ); } } // 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; } if ( cl_timegraph->integer ) { SCR_DebugGraph ( cls.realFrametime * 0.25, 0 ); } // 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 (S_COLOR_YELLOW "%s", SE_GetString("CON_TEXT_SKIPPING")); SCR_UpdateScreen(); } } else { // update the screen SCR_UpdateScreen(); } // update audio S_Update(); // advance local effects for next frame SCR_RunCinematic(); Con_RunConsole(); cls.framecount++; }
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++; }
void CL_BeginServerConnect(void) { connect_time = -999; // CL_CheckForResend() will fire immediately CL_CheckForResend(); }