X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=cl_screen.c;h=dfc556187ece9948d970244709d5f7f938e2275f;hb=6037bd95e06be7ae06198464b5871fb567077092;hp=f1ae56690bc8dac6392aac19e08c7f93dfa67e9e;hpb=d6f8468a651dc24bae9974b0b37e4d1fb04cacda;p=xonotic%2Fdarkplaces.git diff --git a/cl_screen.c b/cl_screen.c index f1ae5669..dfc55618 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -38,10 +38,12 @@ cvar_t scr_loadingscreen_background = {0, "scr_loadingscreen_background","0", "s cvar_t scr_loadingscreen_scale = {0, "scr_loadingscreen_scale","1", "scale factor of the background"}; cvar_t scr_loadingscreen_scale_base = {0, "scr_loadingscreen_scale_base","0", "0 = console pixels, 1 = video pixels"}; cvar_t scr_loadingscreen_scale_limit = {0, "scr_loadingscreen_scale_limit","0", "0 = no limit, 1 = until first edge hits screen edge, 2 = until last edge hits screen edge, 3 = until width hits screen width, 4 = until height hits screen height"}; +cvar_t scr_loadingscreen_picture = {CVAR_SAVE, "scr_loadingscreen_picture", "gfx/loading", "picture shown during loading"}; cvar_t scr_loadingscreen_count = {0, "scr_loadingscreen_count","1", "number of loading screen files to use randomly (named loading.tga, loading2.tga, loading3.tga, ...)"}; 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"}; @@ -236,9 +238,6 @@ static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, float *c; DrawQ_Fill(graphx, graphy, graphwidth, graphheight + textsize * 2, 0, 0, 0, 0.5, 0); // draw the bar graph itself - // advance the packet counter because it is the latest packet column being - // built up and should come last - packetcounter = (packetcounter + 1) % NETGRAPH_PACKETS; memset(g, 0, sizeof(g)); for (j = 0;j < NETGRAPH_PACKETS;j++) { @@ -916,10 +915,12 @@ void CL_Screen_Init(void) Cvar_RegisterVariable (&scr_loadingscreen_scale); Cvar_RegisterVariable (&scr_loadingscreen_scale_base); Cvar_RegisterVariable (&scr_loadingscreen_scale_limit); + Cvar_RegisterVariable (&scr_loadingscreen_picture); Cvar_RegisterVariable (&scr_loadingscreen_count); 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); @@ -2048,7 +2049,7 @@ static void SCR_DrawLoadingScreen_SharedSetup (qboolean clear) R_Mesh_Start(); R_EntityMatrix(&identitymatrix); // draw the loading plaque - loadingscreenpic = Draw_CachePic_Flags (loadingscreenpic_number ? va(vabuf, sizeof(vabuf), "gfx/loading%d", loadingscreenpic_number+1) : "gfx/loading", loadingscreenpic_number ? CACHEPICFLAG_NOTPERSISTENT : 0); + loadingscreenpic = Draw_CachePic_Flags (loadingscreenpic_number ? va(vabuf, sizeof(vabuf), "%s%d", scr_loadingscreen_picture.string, loadingscreenpic_number+1) : scr_loadingscreen_picture.string, loadingscreenpic_number ? CACHEPICFLAG_NOTPERSISTENT : 0); w = loadingscreenpic->width; h = loadingscreenpic->height; @@ -2130,6 +2131,8 @@ static void SCR_DrawLoadingScreen_SharedFinish (qboolean clear) VID_Finish(); } +static double loadingscreen_lastupdate; + void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) { keydest_t old_key_dest; @@ -2139,6 +2142,15 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) if (vid_hidden || cls.state == ca_dedicated) return; + // limit update rate + if (scr_loadingscreen_maxfps.value) + { + double t = Sys_DirtyTime(); + if ((t - loadingscreen_lastupdate) < 1.0f/scr_loadingscreen_maxfps.value) + return; + loadingscreen_lastupdate = t; + } + if(!scr_loadingscreen_background.integer) clear = true;