From cadbd997f5c083261e73e8e3ab6a9c60d0ad8a77 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 4 Apr 2009 21:04:12 +0000 Subject: [PATCH] more loading screen improvements (weighting for different content types; don't update too often for keepalives; only show model name) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8866 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++----- cl_screen.c | 12 +++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 26dba1d0..f7d1b4b2 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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); diff --git a/cl_screen.c b/cl_screen.c index 1c963db7..ed6f31dc 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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; } -- 2.39.2