]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
more loading screen improvements (weighting for different content types; don't update...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Apr 2009 21:04:12 +0000 (21:04 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Apr 2009 21:04:12 +0000 (21:04 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8866 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
cl_screen.c

index 26dba1d0efa45d435fe86b8c917835f7123e2cb0..f7d1b4b260a611d609929a323253506dbdf83502 100644 (file)
@@ -290,6 +290,7 @@ void CL_KeepaliveMessage (qboolean readmessages)
 {
        float time;
        static double nextmsg = -1;
+       static double nextupdate = -1;
 #if 0
        static double lasttime = -1;
 #endif
@@ -297,7 +298,14 @@ void CL_KeepaliveMessage (qboolean readmessages)
        qboolean oldbadread;
        sizebuf_t old;
 
-       SCR_UpdateLoadingScreenIfShown();
+       if(cls.state != ca_dedicated)
+       {
+               if((time = Sys_DoubleTime()) >= nextupdate)
+               {
+                       SCR_UpdateLoadingScreenIfShown();
+                       nextupdate = time + 2;
+               }
+       }
 
        // no need if server is local and definitely not if this is a demo
        if (!cls.netcon || cls.protocol == PROTOCOL_QUAKEWORLD || cls.signon >= SIGNONS)
@@ -979,6 +987,11 @@ static void CL_UpdateItemsAndWeapon(void)
        cl.activeweapon = cl.stats[STAT_ACTIVEWEAPON];
 }
 
+#define DOWNLOADPROGRESSWEIGHT_SOUND            1.0
+#define DOWNLOADPROGRESSWEIGHT_MODEL            4.0
+#define DOWNLOADPROGRESSWEIGHT_WORLDMODEL      30.0
+#define DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT 32.0
+
 void CL_BeginDownloads(qboolean aborteddownload)
 {
        // quakeworld works differently
@@ -1030,12 +1043,31 @@ void CL_BeginDownloads(qboolean aborteddownload)
                if(cl.loadmodel_current == 1)
                {
                        // worldmodel counts as 16 models (15 + world model setup), for better progress bar
-                       SCR_PushLoadingScreen(false, "Loading precached models", (cl.loadmodel_total + 15) / (float) (cl.loadmodel_total + cl.loadsound_total + 15));
+                       SCR_PushLoadingScreen(false, "Loading precached models",
+                               (
+                                       (cl.loadmodel_total - 1) * DOWNLOADPROGRESSWEIGHT_MODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                               ) / (
+                                       (cl.loadmodel_total - 1) * DOWNLOADPROGRESSWEIGHT_MODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                               +       cl.loadsound_total * DOWNLOADPROGRESSWEIGHT_SOUND
+                               )
+                       );
                        SCR_BeginLoadingPlaque();
                }
                for (;cl.loadmodel_current < cl.loadmodel_total;cl.loadmodel_current++)
                {
-                       SCR_PushLoadingScreen(true, cl.model_name[cl.loadmodel_current], (cl.loadmodel_current == 1 ? 15.0 : 1.0) / cl.loadmodel_total);
+                       SCR_PushLoadingScreen(true, cl.model_name[cl.loadmodel_current],
+                               (
+                                       (cl.loadmodel_current == 1) ? DOWNLOADPROGRESSWEIGHT_WORLDMODEL : DOWNLOADPROGRESSWEIGHT_MODEL
+                               ) / (
+                                       (cl.loadmodel_total - 1) * DOWNLOADPROGRESSWEIGHT_MODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                               )
+                       );
                        if (cl.model_precache[cl.loadmodel_current] && cl.model_precache[cl.loadmodel_current]->Draw)
                        {
                                SCR_PopLoadingScreen(false);
@@ -1059,7 +1091,15 @@ void CL_BeginDownloads(qboolean aborteddownload)
                        if (cl.model_precache[cl.loadmodel_current] && cl.model_precache[cl.loadmodel_current]->Draw && cl.loadmodel_current == 1)
                        {
                                // we now have the worldmodel so we can set up the game world
-                               SCR_PushLoadingScreen(true, "world model setup", 1.0 / cl.loadmodel_total);
+                               SCR_PushLoadingScreen(true, "world model setup",
+                                       (
+                                               DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                                       ) / (
+                                               (cl.loadmodel_total - 1) * DOWNLOADPROGRESSWEIGHT_MODEL
+                                       +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL
+                                       +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                                       )
+                               );
                                CL_SetupWorldModel();
                                SCR_PopLoadingScreen(true);
                                if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer)
@@ -1079,7 +1119,16 @@ void CL_BeginDownloads(qboolean aborteddownload)
        {
                // loading sounds
                if(cl.loadsound_current == 1)
-                       SCR_PushLoadingScreen(false, "Loading precached sounds", cl.loadsound_total / (float) (cl.loadmodel_total + cl.loadsound_total + 15));
+                       SCR_PushLoadingScreen(false, "Loading precached sounds",
+                               (
+                                       cl.loadsound_total * DOWNLOADPROGRESSWEIGHT_SOUND
+                               ) / (
+                                       (cl.loadmodel_total - 1) * DOWNLOADPROGRESSWEIGHT_MODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL
+                               +       DOWNLOADPROGRESSWEIGHT_WORLDMODEL_INIT
+                               +       cl.loadsound_total * DOWNLOADPROGRESSWEIGHT_SOUND
+                               )
+                       );
                for (;cl.loadsound_current < cl.loadsound_total;cl.loadsound_current++)
                {
                        SCR_PushLoadingScreen(true, cl.sound_name[cl.loadsound_current], 1.0 / cl.loadsound_total);
index 1c963db773337f3b2b155db31f6c2d54e3388928..ed6f31dcf3ff92e122e322ffd4d7586423dc9a97 100644 (file)
@@ -1675,6 +1675,7 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
        float total;
 
        total = 0;
+#if 0
        if(s)
        {
                total += SCR_DrawLoadingStack_r(s->prev, y);
@@ -1689,6 +1690,17 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
                        total += size;
                }
        }
+#else
+       if(s)
+       {
+               len = strlen(s->msg);
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(s->msg, len, true, FONT_INFOBAR) * size) / 2;
+               y -= size;
+               DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, 1, 0);
+               DrawQ_String_Font(x, y, s->msg, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
+               total += size;
+       }
+#endif
        return total;
 }