if (cl.loadmodel_current < cl.loadmodel_total)
{
// loading models
-
+ 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_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);
if (cl.model_precache[cl.loadmodel_current] && cl.model_precache[cl.loadmodel_current]->Draw)
+ {
+ SCR_PopLoadingScreen(false);
+ if(cl.loadmodel_current == 1)
+ {
+ SCR_PushLoadingScreen(false, cl.model_name[cl.loadmodel_current], 1.0 / cl.loadmodel_total);
+ SCR_PopLoadingScreen(false);
+ }
continue;
+ }
CL_KeepaliveMessage(true);
cl.model_precache[cl.loadmodel_current] = Mod_ForName(cl.model_name[cl.loadmodel_current], false, false, cl.model_name[cl.loadmodel_current][0] == '*' ? cl.model_name[1] : NULL);
+ SCR_PopLoadingScreen(false);
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);
CL_SetupWorldModel();
+ SCR_PopLoadingScreen(true);
if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer)
{
cl.loadfinished = true;
}
}
}
-
+ SCR_PopLoadingScreen(false);
// finished loading models
}
if (cl.loadsound_current < cl.loadsound_total)
{
// loading sounds
-
+ if(cl.loadsound_current == 1)
+ SCR_PushLoadingScreen(false, "Loading precached sounds", cl.loadsound_total / (float) (cl.loadmodel_total + cl.loadsound_total + 15));
for (;cl.loadsound_current < cl.loadsound_total;cl.loadsound_current++)
{
+ SCR_PushLoadingScreen(true, 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);
continue;
+ }
CL_KeepaliveMessage(true);
// Don't lock the sfx here, S_ServerSounds already did that
cl.sound_precache[cl.loadsound_current] = S_PrecacheSound(cl.sound_name[cl.loadsound_current], false, false);
+ SCR_PopLoadingScreen(false);
}
-
+ SCR_PopLoadingScreen(false);
// finished loading sounds
}
// finished loading sounds
}
+ SCR_PopLoadingScreen(false);
+
if (!cl.loadfinished)
{
cl.loadfinished = true;
if(cl.loadbegun)
Con_Printf("cl_begindownloads is only valid once per match\n");
else
+ {
+ SCR_PushLoadingScreen(false, "Loading precaches", 1);
CL_BeginDownloads(false);
+ }
}
void CL_StopDownload(int size, int crc)
}
loadingscreenstack_t;
static loadingscreenstack_t *loadingscreenstack = NULL;
+static double loadingscreentime;
-void SCR_PushLoadingScreen (const char *msg, float len_in_parent)
+void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_parent)
{
loadingscreenstack_t *s = (loadingscreenstack_t *) Z_Malloc(sizeof(loadingscreenstack_t));
s->prev = loadingscreenstack;
if(s->prev)
{
s->absolute_loading_amount_min = s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len * s->prev->relative_completion;
- s->absolute_loading_amount_len = s->prev->absolute_loading_amount_len * len_in_parent;
+ s->absolute_loading_amount_len = s->prev->absolute_loading_amount_len * len_in_parent;
+ if(s->absolute_loading_amount_len > s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len - s->absolute_loading_amount_min)
+ s->absolute_loading_amount_len = s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len - s->absolute_loading_amount_min;
}
else
{
s->absolute_loading_amount_len = 1;
}
- SCR_UpdateLoadingScreen(true);
+ if(redraw && realtime == loadingscreentime)
+ SCR_UpdateLoadingScreen(true);
}
-void SCR_PopLoadingScreen ()
+void SCR_PopLoadingScreen (qboolean redraw)
{
loadingscreenstack_t *s = loadingscreenstack;
loadingscreenstack = s->prev;
if(s->prev)
s->prev->relative_completion = (s->absolute_loading_amount_min + s->absolute_loading_amount_len - s->prev->absolute_loading_amount_min) / s->prev->absolute_loading_amount_len;
Z_Free(s);
- SCR_UpdateLoadingScreen(true);
+
+ if(redraw && realtime == loadingscreentime)
+ SCR_UpdateLoadingScreen(true);
}
static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
static void SCR_DrawLoadingStack()
{
float height;
+ float verts[12];
+ float colors[16];
height = SCR_DrawLoadingStack_r(loadingscreenstack, vid_conheight.integer);
if(loadingscreenstack)
{
- height = 32; // sorry, using the normal one is ugly
- DrawQ_Fill((vid_conwidth.integer + 2) * loadingscreenstack->absolute_loading_amount_min - 2, vid_conheight.integer - height, 2, height, 1, 0, 0, 1, DRAWFLAG_ADDITIVE);
+ // height = 32; // sorry, using the normal one is ugly
+ //DrawQ_Fill((vid_conwidth.integer + 2) * loadingscreenstack->absolute_loading_amount_min - 2, vid_conheight.integer - height, 2, height, 1, 0, 0, 1, DRAWFLAG_ADDITIVE);
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ GL_Color(1, 1, 1, 1);
+ R_Mesh_VertexPointer(verts, 0, 0);
+ R_Mesh_ColorPointer(colors, 0, 0);
+ R_Mesh_ResetTextureState();
+ R_SetupGenericShader(false);
+ verts[2] = verts[5] = verts[8] = verts[11] = 0;
+ verts[0] = verts[9] = (vid_conwidth.integer + 2) * loadingscreenstack->absolute_loading_amount_min - 2;
+ verts[1] = verts[4] = vid_conheight.integer - 32;
+ verts[3] = verts[6] = (vid_conwidth.integer + 2) * loadingscreenstack->absolute_loading_amount_min;
+ verts[7] = verts[10] = vid_conheight.integer;
+ colors[0] = colors[1] = colors[2] = colors[4] = colors[5] = colors[6] = colors[8] = colors[9] = colors[10] = colors[11] = colors[12] = colors[13] = colors[14] = colors[15] = 1;
+ colors[3] = colors[7] = 0;
+ R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
}
}
float vertex3f[12];
float texcoord2f[8];
+ loadingscreentime = realtime;
+
// don't do anything if not initialized yet
if (vid_hidden || !scr_refresh.integer)
return;
int nummodels = Mem_ExpandableArray_IndexRange(&models);
dp_model_t *mod;
- SCR_PushLoadingScreen("Loading models", 1.0);
+ SCR_PushLoadingScreen(false, "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] != '*')
if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*')
if (mod->used)
{
- SCR_PushLoadingScreen(mod->name, 1.0 / count);
+ SCR_PushLoadingScreen(true, mod->name, 1.0 / count);
Mod_LoadModel(mod, true, false);
- SCR_PopLoadingScreen();
+ SCR_PopLoadingScreen(false);
}
- SCR_PopLoadingScreen();
+ SCR_PopLoadingScreen(false);
}
static void mod_shutdown(void)
if (developer_loading.integer)
Con_Printf("loading model %s\n", mod->name);
- SCR_PushLoadingScreen(mod->name, 1);
+ SCR_PushLoadingScreen(true, mod->name, 1);
// LordHavoc: unload the existing model in this slot (if there is one)
if (mod->loaded || mod->mempool)
Con_Printf ("Mod_LoadModel: %s not found\n", mod->name);
}
- SCR_PopLoadingScreen();
+ SCR_PopLoadingScreen(false);
return mod;
}
int nummodels = Mem_ExpandableArray_IndexRange(&models);
dp_model_t *mod;
- SCR_PushLoadingScreen("Reloading models", 1.0);
+ SCR_PushLoadingScreen(false, "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)
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(mod->name, 1.0 / count);
+ SCR_PushLoadingScreen(true, mod->name, 1.0 / count);
Mod_LoadModel(mod, true, true);
- SCR_PopLoadingScreen();
+ SCR_PopLoadingScreen(false);
}
- SCR_PopLoadingScreen();
+ SCR_PopLoadingScreen(false);
}
unsigned char *mod_base;
void SCR_UpdateLoadingScreen(qboolean clear);
// pushes an item on the loading screen
-void SCR_PushLoadingScreen (const char *msg, float len_in_parent);
-void SCR_PopLoadingScreen ();
+void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_parent);
+void SCR_PopLoadingScreen (qboolean redraw);
extern float scr_con_current; // current height of displayed console