From 92cbb08fd244fed352d4a4ebaa9eb17bd230cbdf Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 21 May 2020 18:57:50 +0000 Subject: [PATCH] Fix missing loading screen text. A redraw must always occur when pushing. A DrawQ_Finish call is also required. For loading text to work early in startup, Mod_Mesh_Create must be called early as well. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12552 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 1 + cl_parse.c | 15 +++++++-------- cl_screen.c | 26 +++++++++----------------- model_shared.c | 10 +++++----- screen.h | 2 +- snd_mem.c | 2 +- 6 files changed, 24 insertions(+), 32 deletions(-) diff --git a/cl_main.c b/cl_main.c index b0c913d0..4256fc2d 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2395,6 +2395,7 @@ static void CL_MeshEntities_Init(void) ent = cl_meshentities + i; ent->state_current.active = true; ent->render.model = cl_meshentitymodels + i; + Mod_Mesh_Create(ent->render.model, cl_meshentitynames[i]); ent->render.alpha = 0.999999f; // not quite 1 so that MATERIALFLAG_ALPHA is always set. ent->render.flags = RENDER_SHADOW | RENDER_LIGHT; ent->render.framegroupblend[0].lerp = 1; diff --git a/cl_parse.c b/cl_parse.c index d0af710c..7f2cdff4 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1095,7 +1095,7 @@ static void CL_BeginDownloads(qboolean aborteddownload) // if we got here... // curl is done, so let's start with the business if(!cl.loadbegun) - SCR_PushLoadingScreen(false, "Loading precaches", 1); + SCR_PushLoadingScreen("Loading precaches", 1); cl.loadbegun = true; // if already downloading something from the previous level, don't stop it @@ -1130,7 +1130,7 @@ static 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", + SCR_PushLoadingScreen("Loading precached models", ( (cl.loadmodel_total - 1) * LOADPROGRESSWEIGHT_MODEL + LOADPROGRESSWEIGHT_WORLDMODEL @@ -1142,11 +1142,10 @@ static void CL_BeginDownloads(qboolean aborteddownload) + cl.loadsound_total * LOADPROGRESSWEIGHT_SOUND ) ); - SCR_BeginLoadingPlaque(false); } for (;cl.loadmodel_current < cl.loadmodel_total;cl.loadmodel_current++) { - SCR_PushLoadingScreen(false, cl.model_name[cl.loadmodel_current], + SCR_PushLoadingScreen(cl.model_name[cl.loadmodel_current], ( (cl.loadmodel_current == 1) ? LOADPROGRESSWEIGHT_WORLDMODEL : LOADPROGRESSWEIGHT_MODEL ) / ( @@ -1160,7 +1159,7 @@ static void CL_BeginDownloads(qboolean aborteddownload) SCR_PopLoadingScreen(false); if(cl.loadmodel_current == 1) { - SCR_PushLoadingScreen(false, cl.model_name[cl.loadmodel_current], 1.0 / cl.loadmodel_total); + SCR_PushLoadingScreen(cl.model_name[cl.loadmodel_current], 1.0 / cl.loadmodel_total); SCR_PopLoadingScreen(false); } continue; @@ -1183,7 +1182,7 @@ static 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", + SCR_PushLoadingScreen("world model setup", ( LOADPROGRESSWEIGHT_WORLDMODEL_INIT ) / ( @@ -1211,7 +1210,7 @@ static void CL_BeginDownloads(qboolean aborteddownload) { // loading sounds if(cl.loadsound_current == 1) - SCR_PushLoadingScreen(false, "Loading precached sounds", + SCR_PushLoadingScreen("Loading precached sounds", ( cl.loadsound_total * LOADPROGRESSWEIGHT_SOUND ) / ( @@ -1223,7 +1222,7 @@ static void CL_BeginDownloads(qboolean aborteddownload) ); for (;cl.loadsound_current < cl.loadsound_total;cl.loadsound_current++) { - SCR_PushLoadingScreen(false, cl.sound_name[cl.loadsound_current], 1.0 / cl.loadsound_total); + SCR_PushLoadingScreen(cl.sound_name[cl.loadsound_current], 1.0 / cl.loadsound_total); if (cl.sound_precache[cl.loadsound_current] && S_IsSoundPrecached(cl.sound_precache[cl.loadsound_current])) { SCR_PopLoadingScreen(false); diff --git a/cl_screen.c b/cl_screen.c index 94d6ed10..33963221 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2162,11 +2162,11 @@ static void SCR_DrawScreen (void) // draw the loading screen for a while if we're still connecting and not forcing the console or menu to show up char temp[64]; if (cls.signon > 0) - SCR_PushLoadingScreen(false, va(temp, sizeof(temp), "Connect: Signon stage %i of %i", cls.signon, SIGNONS), 1.0); + SCR_PushLoadingScreen(va(temp, sizeof(temp), "Connect: Signon stage %i of %i", cls.signon, SIGNONS), 1.0); else if (cls.connect_remainingtries > 0) - SCR_PushLoadingScreen(false, va(temp, sizeof(temp), "Connect: Trying... %i", cls.connect_remainingtries), 1.0); + SCR_PushLoadingScreen(va(temp, sizeof(temp), "Connect: Trying... %i", cls.connect_remainingtries), 1.0); else - SCR_PushLoadingScreen(false, va(temp, sizeof(temp), "Connect: Waiting %i seconds for reply", 10 + cls.connect_remainingtries), 1.0); + SCR_PushLoadingScreen(va(temp, sizeof(temp), "Connect: Waiting %i seconds for reply", 10 + cls.connect_remainingtries), 1.0); SCR_DrawLoadingScreen(true); SCR_PopLoadingScreen(false); } @@ -2313,11 +2313,10 @@ static void SCR_SetLoadingScreenTexture(void) void SCR_UpdateLoadingScreenIfShown(void) { - if(loadingscreendone) SCR_UpdateLoadingScreen(loadingscreencleared, false); } -void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_parent) +void SCR_PushLoadingScreen (const char *msg, float len_in_parent) { loadingscreenstack_t *s = (loadingscreenstack_t *) Z_Malloc(sizeof(loadingscreenstack_t)); s->prev = loadingscreenstack; @@ -2339,7 +2338,6 @@ void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_paren s->absolute_loading_amount_len = 1; } - if(redraw) SCR_UpdateLoadingScreenIfShown(); } @@ -2545,13 +2543,6 @@ static void SCR_DrawLoadingScreen (qboolean clear) SCR_DrawLoadingStack(); } -static void SCR_DrawLoadingScreen_SharedFinish (qboolean clear) -{ - R_Mesh_Finish(); - // refresh - VID_Finish(); -} - static double loadingscreen_lastupdate; static void SCR_UpdateVars(void); @@ -2574,10 +2565,7 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) loadingscreen_lastupdate = t; } - SCR_UpdateVars(); - // set up the r_texture_gammaramps texture which we need for rendering the loadingscreenpic - VID_UpdateGamma(); R_UpdateVariables(); if(!scr_loadingscreen_background.integer) @@ -2630,7 +2618,11 @@ void SCR_UpdateLoadingScreen (qboolean clear, qboolean startup) SCR_DrawLoadingScreen(clear); } #endif - SCR_DrawLoadingScreen_SharedFinish(clear); + + R_Mesh_Finish(); + DrawQ_Finish(); + // refresh + VID_Finish(); // this goes into the event loop, and should prevent unresponsive cursor on vista old_key_dest = key_dest; diff --git a/model_shared.c b/model_shared.c index 1e546719..811b26cb 100644 --- a/model_shared.c +++ b/model_shared.c @@ -65,7 +65,7 @@ static void mod_start(void) int nummodels = (int)Mem_ExpandableArray_IndexRange(&models); dp_model_t *mod; - SCR_PushLoadingScreen(false, "Loading models", 1.0); + SCR_PushLoadingScreen("Loading models", 1.0); count = 0; for (i = 0;i < nummodels;i++) if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*') @@ -75,7 +75,7 @@ static void mod_start(void) if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*') if (mod->used) { - SCR_PushLoadingScreen(true, mod->name, 1.0 / count); + SCR_PushLoadingScreen(mod->name, 1.0 / count); Mod_LoadModel(mod, true, false); SCR_PopLoadingScreen(false); } @@ -458,7 +458,7 @@ dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk) if (developer_loading.integer) Con_Printf("loading model %s\n", mod->name); - SCR_PushLoadingScreen(true, mod->name, 1); + SCR_PushLoadingScreen(mod->name, 1); // LadyHavoc: unload the existing model in this slot (if there is one) if (mod->loaded || mod->mempool) @@ -638,7 +638,7 @@ void Mod_Reload(void) int nummodels = (int)Mem_ExpandableArray_IndexRange(&models); dp_model_t *mod; - SCR_PushLoadingScreen(false, "Reloading models", 1.0); + SCR_PushLoadingScreen("Reloading models", 1.0); count = 0; for (i = 0;i < nummodels;i++) if ((mod = (dp_model_t *) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*' && mod->used) @@ -646,7 +646,7 @@ void Mod_Reload(void) for (i = 0;i < nummodels;i++) if ((mod = (dp_model_t *) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*' && mod->used) { - SCR_PushLoadingScreen(true, mod->name, 1.0 / count); + SCR_PushLoadingScreen(mod->name, 1.0 / count); Mod_LoadModel(mod, true, true); SCR_PopLoadingScreen(false); } diff --git a/screen.h b/screen.h index 4d473244..02321150 100644 --- a/screen.h +++ b/screen.h @@ -33,7 +33,7 @@ void SCR_UpdateLoadingScreen(qboolean clear, qboolean startup); void SCR_UpdateLoadingScreenIfShown(void); // pushes an item on the loading screen -void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_parent); +void SCR_PushLoadingScreen (const char *msg, float len_in_parent); void SCR_PopLoadingScreen (qboolean redraw); void SCR_ClearLoadingScreen (qboolean redraw); diff --git a/snd_mem.c b/snd_mem.c index 3991356c..5588c642 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -102,7 +102,7 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain) if (developer_loading.integer) Con_Printf("loading sound %s\n", sfx->name); - SCR_PushLoadingScreen(true, sfx->name, 1); + SCR_PushLoadingScreen(sfx->name, 1); // LadyHavoc: if the sound filename does not begin with sound/, try adding it if (strncasecmp(sfx->name, "sound/", 6)) -- 2.39.2