]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
introducing "scr_loadingscreen_firstforstartup"
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 12 Mar 2012 09:21:55 +0000 (09:21 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 12 Mar 2012 09:21:55 +0000 (09:21 +0000)
make first loading.tga screen a special startup splash-screen,
that shows only once on client startup

From: nyov <nyov@nexnode.net>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11754 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
cl_screen.c
gl_draw.c
host.c
screen.h
sv_main.c
vid_shared.c

index 30026988f6c97c2679231c4db50bc86db8685d1b..9e414372afeba4ea282a2578d5baec6c2d157c5e 100644 (file)
@@ -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();
index 6cdc3dd6a18abe6541f6387439d152884aab92ec..f1ae56690bc8dac6392aac19e08c7f93dfa67e9e 100644 (file)
@@ -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();
index 581ef1a22dc8c5fce5df2fab1f86c17e934a08e1..17213e566db0be1d09e6ca02d42d9e59f1cf59f2 100644 (file)
--- 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 62530e0833b57e4daa9557abc2b4ea6933305152..2e5030350f4f8a40e2c26189c8cbf7a77cc4eb58 100644 (file)
--- 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)
        {
index b88a80d53ca1cf0f15d7ae81b543f6d612eb3ce9..68a2998d78535d730dc3eb4398645f96d63e4bf0 100644 (file)
--- 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
index d13bffd05d225c2c154ffc7f521ba51e130c039f..b2e70f3b31b02d779bc8190d4d0d9f932a769956 100644 (file)
--- 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();
        }
 
index cee0ebaf67d73484955c332c8901054c149c99ae..7d8485c336cb7f091acf576d8f02054caf115ea2 100644 (file)
@@ -1873,7 +1873,7 @@ void VID_Restart_f(void)
 
        if (!vid_opened)
        {
-               SCR_BeginLoadingPlaque();
+               SCR_BeginLoadingPlaque(false);
                return;
        }