Switched checking files mode to use a progress bar

Changed the confirmation prompt use MB if >=10MB
Changed the ovearall progress bar to use MB if >=10MB
This commit is contained in:
Ashnal 2021-08-19 21:49:40 -04:00
parent 0241b73dbe
commit a35d4ea5f4

View file

@ -1177,7 +1177,7 @@ static inline void CL_DrawConnectionStatus(void)
// Draw background fade // Draw background fade
V_DrawFadeScreen(0xFF00, 16); V_DrawFadeScreen(0xFF00, 16);
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES
#ifdef HAVE_CURL #ifdef HAVE_CURL
&& cl_mode != CL_DOWNLOADHTTPFILES && cl_mode != CL_DOWNLOADHTTPFILES
#endif #endif
@ -1213,15 +1213,9 @@ static inline void CL_DrawConnectionStatus(void)
break; break;
#endif #endif
case CL_ASKFULLFILELIST: case CL_ASKFULLFILELIST:
case CL_CHECKFILES:
cltext = M_GetText("Checking server addon list ...");
break;
case CL_CONFIRMCONNECT: case CL_CONFIRMCONNECT:
cltext = ""; cltext = "";
break; break;
case CL_LOADFILES:
cltext = M_GetText("Loading server addons...");
break;
case CL_ASKJOIN: case CL_ASKJOIN:
case CL_WAITJOINRESPONSE: case CL_WAITJOINRESPONSE:
if (serverisfull) if (serverisfull)
@ -1243,7 +1237,29 @@ static inline void CL_DrawConnectionStatus(void)
} }
else else
{ {
if (cl_mode == CL_LOADFILES) if (cl_mode == CL_CHECKFILES)
{
INT32 totalfileslength;
INT32 checkednum = 0;
INT32 i;
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
//ima just count files here
for (i = 0; i < fileneedednum; i++)
if (fileneeded[i].status != FS_NOTCHECKED)
checkednum++;
// Loading progress
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Checking server addons...");
totalfileslength = (INT32)((checkednum/(double)(fileneedednum)) * 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",checkednum,fileneedednum));
}
else if (cl_mode == CL_LOADFILES)
{ {
INT32 totalfileslength; INT32 totalfileslength;
INT32 loadcompletednum = 0; INT32 loadcompletednum = 0;
@ -1321,7 +1337,7 @@ static inline void CL_DrawConnectionStatus(void)
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175); V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160); V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
if (totalfilesrequestedsize>>20 >= 100) //display in MB if over 100MB if (totalfilesrequestedsize>>20 >= 10) //display in MB if over 10MB
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20)); va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20));
else else
@ -2167,7 +2183,7 @@ static boolean CL_FinishedFileList(void)
} }
#ifndef NONET #ifndef NONET
if (totalfilesrequestedsize>>20 >= 100) if (totalfilesrequestedsize>>20 >= 10)
downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20)); downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20));
else else
downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10)); downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10));