Add progress bar for file loading

This commit is contained in:
Ashnal 2020-06-27 23:26:38 -04:00
parent 9d9105929b
commit d96c938dbf

View file

@ -1167,7 +1167,7 @@ static inline void CL_DrawConnectionStatus(void)
// Draw background fade
V_DrawFadeScreen(0xFF00, 16);
if (cl_mode != CL_DOWNLOADFILES
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES
#ifdef HAVE_CURL
&& cl_mode != CL_DOWNLOADHTTPFILES
#endif
@ -1221,11 +1221,32 @@ static inline void CL_DrawConnectionStatus(void)
cltext = M_GetText("Connecting to server...");
break;
}
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-32, V_YELLOWMAP, cltext);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, cltext);
}
else
{
if (lastfilenum != -1)
if (cl_mode == CL_LOADFILES)
{
INT32 totalfileslength;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Press ESC to abort");
//ima just count files here
INT32 loadcompletednum = 0;
INT32 i;
for (i = 0; i < fileneedednum; i++)
if (fileneeded[i].status == FS_OPEN)
loadcompletednum++;
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP, "Loading server addons...");
totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum+1)) * 256);
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %2u/%2u Files",loadcompletednum,fileneedednum+1));
}
else if (lastfilenum != -1)
{
// Draw the bottom box.
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-58-8, 32, 1);