From ac6244346ed7754e5d178393cb5116ecc7cefe16 Mon Sep 17 00:00:00 2001 From: vortex Date: Thu, 9 Aug 2012 18:38:54 +0000 Subject: [PATCH] New cvar scr_loadingscreen_maxfps (default 10) which restricts maximum number of loading screen updates per second. This will halve loading times of quake maps with vid_vsync 1 as it really spends more time on drawing loading screen than on actual loading there. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11840 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_screen.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cl_screen.c b/cl_screen.c index 0989a4b1..42b86ed7 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -42,6 +42,7 @@ cvar_t scr_loadingscreen_count = {0, "scr_loadingscreen_count","1", "number of l cvar_t scr_loadingscreen_firstforstartup = {0, "scr_loadingscreen_firstforstartup","0", "remove loading.tga from random scr_loadingscreen_count selection and only display it on client startup, 0 = normal, 1 = firstforstartup"}; cvar_t scr_loadingscreen_barcolor = {0, "scr_loadingscreen_barcolor", "0 0 1", "rgb color of loadingscreen progress bar"}; cvar_t scr_loadingscreen_barheight = {0, "scr_loadingscreen_barheight", "8", "the height of the loadingscreen progress bar"}; +cvar_t scr_loadingscreen_maxfps = {0, "scr_loadingscreen_maxfps", "10", "restrict maximal FPS for loading screen so it will not update very often (this will make lesser loading times on a maps loading large number of models)"}; cvar_t scr_infobar_height = {0, "scr_infobar_height", "8", "the height of the infobar items"}; cvar_t vid_conwidth = {CVAR_SAVE, "vid_conwidth", "640", "virtual width of 2D graphics system"}; cvar_t vid_conheight = {CVAR_SAVE, "vid_conheight", "480", "virtual height of 2D graphics system"}; @@ -917,6 +918,7 @@ void CL_Screen_Init(void) Cvar_RegisterVariable (&scr_loadingscreen_firstforstartup); Cvar_RegisterVariable (&scr_loadingscreen_barcolor); Cvar_RegisterVariable (&scr_loadingscreen_barheight); + Cvar_RegisterVariable (&scr_loadingscreen_maxfps); Cvar_RegisterVariable (&scr_infobar_height); Cvar_RegisterVariable (&scr_showram); Cvar_RegisterVariable (&scr_showturtle); @@ -2127,6 +2129,8 @@ static void SCR_DrawLoadingScreen_SharedFinish (qboolean clear) VID_Finish(); } +static float loadingscreen_lastupdate; + void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) { keydest_t old_key_dest; @@ -2136,6 +2140,15 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) if (vid_hidden || cls.state == ca_dedicated) return; + // limit update rate + if (scr_loadingscreen_maxfps.value) + { + float t = Sys_DirtyTime(); + if ((t - loadingscreen_lastupdate) < 1.0f/scr_loadingscreen_maxfps.value) + return; + loadingscreen_lastupdate = t; + } + if(!scr_loadingscreen_background.integer) clear = true; -- 2.39.2