/* ================== SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. ================== */ void SCR_UpdateScreen( void ) { static dynvar_t *updatescreen = NULL; int numframes; int i; float separation[2]; if( !updatescreen ) updatescreen = Dynvar_Create( "updatescreen", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY ); // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if( cls.disable_screen ) { if( Sys_Milliseconds() - cls.disable_screen > 120000 ) { cls.disable_screen = 0; Com_Printf( "Loading plaque timed out.\n" ); } return; } if( !scr_initialized || !con_initialized || !cls.mediaInitialized ) return; // not initialized yet /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ if( cl_stereo_separation->value > 1.0 ) Cvar_SetValue( "cl_stereo_separation", 1.0 ); else if( cl_stereo_separation->value < 0 ) Cvar_SetValue( "cl_stereo_separation", 0.0 ); if( cl_stereo->integer ) { numframes = 2; separation[0] = -cl_stereo_separation->value / 2; separation[1] = cl_stereo_separation->value / 2; } else { separation[0] = 0; separation[1] = 0; numframes = 1; } for( i = 0; i < numframes; i++ ) { R_BeginFrame( separation[i], scr_forceclear->integer ? qtrue : qfalse ); if( scr_draw_loading == 2 ) { // loading plaque over black screen scr_draw_loading = 0; CL_UIModule_DrawConnectScreen( qtrue ); } // if a cinematic is supposed to be running, handle menus // and console specially else if( SCR_GetCinematicTime() > 0 ) { SCR_DrawCinematic(); } else if( cls.state == CA_DISCONNECTED ) { CL_UIModule_Refresh( qtrue ); SCR_DrawConsole(); } else if( cls.state == CA_CONNECTING || cls.state == CA_CONNECTED || cls.state == CA_HANDSHAKE ) { CL_UIModule_DrawConnectScreen( qtrue ); } else if( cls.state == CA_LOADING ) { SCR_RenderView( separation[i] ); CL_UIModule_DrawConnectScreen( qfalse ); } else if( cls.state == CA_ACTIVE ) { SCR_RenderView( separation[i] ); CL_UIModule_Refresh( qfalse ); if( scr_timegraph->integer ) SCR_DebugGraph( cls.frametime*300, 1, 1, 1 ); if( scr_debuggraph->integer || scr_timegraph->integer || scr_netgraph->integer ) SCR_DrawDebugGraph(); SCR_DrawConsole(); } // wsw : aiwa : call any listeners so they can draw their stuff Dynvar_CallListeners( updatescreen, NULL ); R_EndFrame(); } }
/* * SCR_UpdateScreen * * This is called every frame, and can also be called explicitly to flush * text to the screen. */ void SCR_UpdateScreen( void ) { static dynvar_t *updatescreen = NULL; int numframes; int i; float separation[2]; qboolean scr_cinematic; if( !updatescreen ) updatescreen = Dynvar_Create( "updatescreen", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY ); // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if( cls.disable_screen ) { if( Sys_Milliseconds() - cls.disable_screen > 120000 ) { cls.disable_screen = 0; Com_Printf( "Loading plaque timed out.\n" ); } return; } if( !scr_initialized || !con_initialized || !cls.mediaInitialized ) return; // not initialized yet Con_CheckResize(); SCR_CheckSystemFontsModified(); /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ if( cl_stereo_separation->value > 1.0 ) Cvar_SetValue( "cl_stereo_separation", 1.0 ); else if( cl_stereo_separation->value < 0 ) Cvar_SetValue( "cl_stereo_separation", 0.0 ); if( cl_stereo->integer ) { numframes = 2; separation[0] = -cl_stereo_separation->value / 2; separation[1] = cl_stereo_separation->value / 2; } else { separation[0] = 0; separation[1] = 0; numframes = 1; } // avoid redrawing fullscreen cinematics unless damaged by console drawing scr_cinematic = cls.state == CA_CINEMATIC ? qtrue : qfalse; // if( scr_cinematic && !cl.cin.redraw && !scr_con_current && !scr_con_previous ) { // return; // } if( cls.cgameActive && cls.state < CA_LOADING ) { // this is when we've finished loading cgame media and are waiting // for the first valid snapshot to arrive. keep the loading screen untouched return; } for( i = 0; i < numframes; i++ ) { re.BeginFrame( separation[i], scr_cinematic || scr_forceclear->integer ? qtrue : qfalse ); if( scr_draw_loading == 2 ) { // loading plaque over black screen scr_draw_loading = 0; CL_UIModule_UpdateConnectScreen( qtrue ); } // if a cinematic is supposed to be running, handle menus // and console specially else if( scr_cinematic ) { SCR_DrawCinematic(); SCR_DrawConsole(); } else if( cls.state == CA_DISCONNECTED ) { CL_UIModule_Refresh( qtrue, qtrue ); SCR_DrawConsole(); } else if( cls.state == CA_GETTING_TICKET || cls.state == CA_CONNECTING || cls.state == CA_CONNECTED || cls.state == CA_HANDSHAKE ) { CL_UIModule_UpdateConnectScreen( qtrue ); } else if( cls.state == CA_LOADING ) { SCR_RenderView( separation[i] ); CL_UIModule_UpdateConnectScreen( qfalse ); } else if( cls.state == CA_ACTIVE ) { SCR_RenderView( separation[i] ); CL_UIModule_Refresh( qfalse, qtrue ); if( scr_timegraph->integer ) SCR_DebugGraph( cls.frametime*300, 1, 1, 1 ); if( scr_debuggraph->integer || scr_timegraph->integer || scr_netgraph->integer ) SCR_DrawDebugGraph(); SCR_DrawConsole(); } // wsw : aiwa : call any listeners so they can draw their stuff Dynvar_CallListeners( updatescreen, NULL ); re.EndFrame(); } }
/* * CL_UIModule_UpdateConnectScreen */ void CL_UIModule_UpdateConnectScreen( qboolean backGround ) { if( uie ) { int downloadType, downloadSpeed; if( cls.download.web ) downloadType = DOWNLOADTYPE_WEB; else if( cls.download.filenum ) downloadType = DOWNLOADTYPE_SERVER; else downloadType = DOWNLOADTYPE_NONE; if( downloadType ) { #if 0 #define DLSAMPLESCOUNT 32 #define DLSSAMPLESMASK ( DLSAMPLESCOUNT-1 ) int i, samples; size_t downloadedSize; unsigned int downloadTime; static int lastFrameCount = 0, frameCount = 0; static unsigned int downloadSpeeds[DLSAMPLESCOUNT]; float avDownloadSpeed; downloadedSize = (size_t)( cls.download.size * cls.download.percent ) - cls.download.baseoffset; downloadTime = Sys_Milliseconds() - cls.download.timestart; if( downloadTime > 200 ) { downloadSpeed = ( downloadedSize / 1024.0f ) / ( downloadTime * 0.001f ); if( cls.framecount > lastFrameCount + DLSAMPLESCOUNT ) frameCount = 0; lastFrameCount = cls.framecount; downloadSpeeds[frameCount & DLSSAMPLESMASK] = downloadSpeed; frameCount = max( frameCount + 1, 1 ); samples = min( frameCount, DLSAMPLESCOUNT ); for( avDownloadSpeed = 0.0f, i = 0; i < samples; i++ ) avDownloadSpeed += downloadSpeeds[i]; avDownloadSpeed /= samples; downloadSpeed = (int)avDownloadSpeed; } else { lastFrameCount = -1; downloadSpeed = 0; } #else size_t downloadedSize; unsigned int downloadTime; downloadedSize = (size_t)( cls.download.size * cls.download.percent ) - cls.download.baseoffset; downloadTime = Sys_Milliseconds() - cls.download.timestart; downloadSpeed = downloadTime ? ( downloadedSize / 1024.0f ) / ( downloadTime * 0.001f ) : 0; #endif } else { downloadSpeed = 0; } uie->UpdateConnectScreen( cls.servername, cls.rejected ? cls.rejectmessage : NULL, downloadType, cls.download.name, cls.download.percent * 100.0f, downloadSpeed, cls.connect_count, backGround ); CL_UIModule_Refresh( backGround, qfalse ); } }
/* * SCR_UpdateScreen * * This is called every frame, and can also be called explicitly to flush * text to the screen. */ void SCR_UpdateScreen( void ) { static dynvar_t *updatescreen = NULL; int numframes; int i; float separation[2]; bool cinematic; bool forcevsync, forceclear; if( !updatescreen ) updatescreen = Dynvar_Create( "updatescreen", false, DYNVAR_WRITEONLY, DYNVAR_READONLY ); // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if( cls.disable_screen ) { if( Sys_Milliseconds() - cls.disable_screen > 120000 ) { cls.disable_screen = 0; Com_Printf( "Loading plaque timed out.\n" ); } return; } if( !scr_initialized || !con_initialized || !cls.mediaInitialized || !re.ScreenEnabled() ) return; // not ready yet Con_CheckResize(); SCR_CheckSystemFontsModified(); /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ if( cl_stereo_separation->value > 1.0 ) Cvar_SetValue( "cl_stereo_separation", 1.0 ); else if( cl_stereo_separation->value < 0 ) Cvar_SetValue( "cl_stereo_separation", 0.0 ); if( cl_stereo->integer ) { numframes = 2; separation[0] = -cl_stereo_separation->value / 2; separation[1] = cl_stereo_separation->value / 2; } else { separation[0] = 0; separation[1] = 0; numframes = 1; } cinematic = cls.state == CA_CINEMATIC ? true : false; forcevsync = cinematic; forceclear = cinematic; for( i = 0; i < numframes; i++ ) { re.BeginFrame( separation[i], forceclear, forcevsync ); if( scr_draw_loading == 2 ) { // loading plaque over APP_STARTUP_COLOR screen scr_draw_loading = 0; CL_UIModule_UpdateConnectScreen( true ); } // if a cinematic is supposed to be running, handle menus // and console specially else if( cinematic ) { SCR_DrawCinematic(); SCR_DrawConsole(); } else if( cls.state == CA_DISCONNECTED ) { CL_UIModule_Refresh( true, true ); SCR_DrawConsole(); } else if( cls.state == CA_GETTING_TICKET || cls.state == CA_CONNECTING || cls.state == CA_HANDSHAKE ) { CL_UIModule_UpdateConnectScreen( true ); } else if( cls.state == CA_CONNECTED ) { if( cls.cgameActive ) { CL_UIModule_UpdateConnectScreen( false ); SCR_RenderView( separation[i] ); } else { CL_UIModule_UpdateConnectScreen( true ); } } else if( cls.state == CA_ACTIVE ) { SCR_RenderView( separation[i] ); CL_UIModule_Refresh( false, true ); if( scr_timegraph->integer ) SCR_DebugGraph( cls.frametime*300, 1, 1, 1 ); if( scr_debuggraph->integer || scr_timegraph->integer || scr_netgraph->integer ) SCR_DrawDebugGraph(); SCR_DrawConsole(); } // wsw : aiwa : call any listeners so they can draw their stuff Dynvar_CallListeners( updatescreen, NULL ); re.EndFrame(); } }