From: divverent Date: Mon, 12 Mar 2012 09:21:55 +0000 (+0000) Subject: introducing "scr_loadingscreen_firstforstartup" X-Git-Tag: xonotic-v0.8.0~96^2~281 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=d6f8468a651dc24bae9974b0b37e4d1fb04cacda;p=xonotic%2Fdarkplaces.git introducing "scr_loadingscreen_firstforstartup" make first loading.tga screen a special startup splash-screen, that shows only once on client startup From: nyov git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11754 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index 30026988..9e414372 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1119,7 +1119,7 @@ static void CL_BeginDownloads(qboolean aborteddownload) + cl.loadsound_total * LOADPROGRESSWEIGHT_SOUND ) ); - SCR_BeginLoadingPlaque(); + SCR_BeginLoadingPlaque(false); } for (;cl.loadmodel_current < cl.loadmodel_total;cl.loadmodel_current++) { @@ -1651,7 +1651,7 @@ static void CL_ParseServerInfo (void) // if server is active, we already began a loading plaque if (!sv.active) { - SCR_BeginLoadingPlaque(); + SCR_BeginLoadingPlaque(false); S_StopAllSounds(); // free q3 shaders so that any newly downloaded shaders will be active Mod_FreeQ3Shaders(); diff --git a/cl_screen.c b/cl_screen.c index 6cdc3dd6..f1ae5669 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -39,6 +39,7 @@ cvar_t scr_loadingscreen_scale = {0, "scr_loadingscreen_scale","1", "scale facto 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_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_infobar_height = {0, "scr_infobar_height", "8", "the height of the infobar items"}; @@ -709,13 +710,13 @@ SCR_BeginLoadingPlaque ================ */ -void SCR_BeginLoadingPlaque (void) +void SCR_BeginLoadingPlaque (qboolean startup) { // save console log up to this point to log_file if it was set by configs Log_Start(); Host_StartVideo(); - SCR_UpdateLoadingScreen(false); + SCR_UpdateLoadingScreen(false, startup); } //============================================================================= @@ -916,6 +917,7 @@ void CL_Screen_Init(void) Cvar_RegisterVariable (&scr_loadingscreen_scale_base); Cvar_RegisterVariable (&scr_loadingscreen_scale_limit); Cvar_RegisterVariable (&scr_loadingscreen_count); + Cvar_RegisterVariable (&scr_loadingscreen_firstforstartup); Cvar_RegisterVariable (&scr_loadingscreen_barcolor); Cvar_RegisterVariable (&scr_loadingscreen_barheight); Cvar_RegisterVariable (&scr_infobar_height); @@ -1890,7 +1892,7 @@ static void SCR_SetLoadingScreenTexture(void) void SCR_UpdateLoadingScreenIfShown(void) { if(loadingscreendone) - SCR_UpdateLoadingScreen(loadingscreencleared); + SCR_UpdateLoadingScreen(loadingscreencleared, false); } void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_parent) @@ -2128,7 +2130,7 @@ static void SCR_DrawLoadingScreen_SharedFinish (qboolean clear) VID_Finish(); } -void SCR_UpdateLoadingScreen (qboolean clear) +void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) { keydest_t old_key_dest; int old_key_consoleactive; @@ -2144,7 +2146,17 @@ void SCR_UpdateLoadingScreen (qboolean clear) clear |= loadingscreencleared; if(!loadingscreendone) - loadingscreenpic_number = rand() % (scr_loadingscreen_count.integer > 1 ? scr_loadingscreen_count.integer : 1); + { + if(startup && scr_loadingscreen_firstforstartup.integer) + loadingscreenpic_number = 0; + else if(scr_loadingscreen_firstforstartup.integer) + if(scr_loadingscreen_count.integer > 1) + loadingscreenpic_number = rand() % (scr_loadingscreen_count.integer - 1) + 1; + else + loadingscreenpic_number = 0; + else + loadingscreenpic_number = rand() % (scr_loadingscreen_count.integer > 1 ? scr_loadingscreen_count.integer : 1); + } if(clear) SCR_ClearLoadingScreenTexture(); diff --git a/gl_draw.c b/gl_draw.c index 581ef1a2..17213e56 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1018,7 +1018,7 @@ static void gl_draw_start(void) LoadFont(false, va(vabuf, sizeof(vabuf), "gfx/font_%s", dp_fonts.f[i].title), &dp_fonts.f[i], 1, 0); // draw the loading screen so people have something to see in the newly opened window - SCR_UpdateLoadingScreen(true); + SCR_UpdateLoadingScreen(true, true); } static void gl_draw_shutdown(void) diff --git a/host.c b/host.c index 62530e08..2e503035 100644 --- a/host.c +++ b/host.c @@ -1300,7 +1300,7 @@ static void Host_Init (void) } // put up the loading image so the user doesn't stare at a black screen... - SCR_BeginLoadingPlaque(); + SCR_BeginLoadingPlaque(true); if (cls.state != ca_dedicated) { diff --git a/screen.h b/screen.h index b88a80d5..68a2998d 100644 --- a/screen.h +++ b/screen.h @@ -26,10 +26,10 @@ void CL_Screen_Init (void); void CL_UpdateScreen (void); void SCR_CenterPrint(const char *str); -void SCR_BeginLoadingPlaque (void); +void SCR_BeginLoadingPlaque (qboolean startup); // invoke refresh of loading plaque (nothing else seen) -void SCR_UpdateLoadingScreen(qboolean clear); +void SCR_UpdateLoadingScreen(qboolean clear, qboolean startup); void SCR_UpdateLoadingScreenIfShown(void); // pushes an item on the loading screen diff --git a/sv_main.c b/sv_main.c index d13bffd0..b2e70f3b 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3241,7 +3241,7 @@ void SV_SpawnServer (const char *server) if (cls.state != ca_dedicated) { - SCR_BeginLoadingPlaque(); + SCR_BeginLoadingPlaque(false); S_StopAllSounds(); } diff --git a/vid_shared.c b/vid_shared.c index cee0ebaf..7d8485c3 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1873,7 +1873,7 @@ void VID_Restart_f(void) if (!vid_opened) { - SCR_BeginLoadingPlaque(); + SCR_BeginLoadingPlaque(false); return; }