mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
Improve total downloads bar
Now has total file size AND number of files
This commit is contained in:
parent
cc78ef2c78
commit
f800159bb8
3 changed files with 30 additions and 3 deletions
|
@ -1255,6 +1255,7 @@ static inline void CL_DrawConnectionStatus(void)
|
|||
|
||||
INT32 dldlength;
|
||||
INT32 totalfileslength;
|
||||
UINT32 totaldldsize;
|
||||
static char tempname[28];
|
||||
fileneeded_t *file = &fileneeded[lastfilenum];
|
||||
char *filename = file->filename;
|
||||
|
@ -1292,12 +1293,26 @@ static inline void CL_DrawConnectionStatus(void)
|
|||
va("%3.1fK/s ", ((double)getbps)/1024));
|
||||
|
||||
// Download progress
|
||||
|
||||
if (fileneeded[lastfilenum].currentsize != fileneeded[lastfilenum].totalsize)
|
||||
totaldldsize = downloadcompletedsize+fileneeded[lastfilenum].currentsize; //Add in single file progress download if applicable
|
||||
else
|
||||
totaldldsize = downloadcompletedsize;
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP, "Overall Download Progress");
|
||||
totalfileslength = (INT32)((downloadcompletednum/(double)totalfilesrequestednum) * 256);
|
||||
totalfileslength = (INT32)((totaldldsize/(double)totalfilesrequestedsize) * 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,
|
||||
|
||||
if (totalfilesrequestedsize>>20 >= 100) //display in MB if over 100MB
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20));
|
||||
else
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
va(" %4uK/%4uK",totaldldsize>>10,totalfilesrequestedsize>>10));
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
va("%2u/%2u Files ",downloadcompletednum,totalfilesrequestednum));
|
||||
}
|
||||
else
|
||||
|
@ -2018,7 +2033,9 @@ static boolean CL_FinishedFileList(void)
|
|||
}
|
||||
|
||||
downloadcompletednum = 0;
|
||||
downloadcompletedsize = 0;
|
||||
totalfilesrequestednum = 0;
|
||||
totalfilesrequestedsize = 0;
|
||||
if (CL_SendRequestFile())
|
||||
{
|
||||
cl_mode = CL_DOWNLOADFILES;
|
||||
|
@ -2165,7 +2182,9 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
|||
#ifdef HAVE_CURL
|
||||
case CL_PREPAREHTTPFILES:
|
||||
downloadcompletednum = 0;
|
||||
downloadcompletedsize = 0;
|
||||
totalfilesrequestednum = 0;
|
||||
totalfilesrequestedsize = 0;
|
||||
if (http_source[0])
|
||||
{
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
|
@ -2173,6 +2192,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
|||
{
|
||||
curl_transfers++;
|
||||
totalfilesrequestednum++;
|
||||
totalfilesrequestedsize += fileneeded[i].totalsize;
|
||||
}
|
||||
|
||||
cl_mode = CL_DOWNLOADHTTPFILES;
|
||||
|
|
|
@ -109,7 +109,9 @@ char downloaddir[512] = "DOWNLOAD";
|
|||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
INT32 downloadcompletednum = 0;
|
||||
UINT32 downloadcompletedsize = 0;
|
||||
INT32 totalfilesrequestednum = 0;
|
||||
UINT32 totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
|
@ -333,6 +335,7 @@ boolean CL_SendRequestFile(void)
|
|||
strcatbf(fileneeded[i].filename, downloaddir, "/");
|
||||
fileneeded[i].status = FS_REQUESTED;
|
||||
totalfilesrequestednum++;
|
||||
totalfilesrequestedsize += fileneeded[i].totalsize;
|
||||
}
|
||||
WRITEUINT8(p, 0xFF);
|
||||
I_GetDiskFreeSpace(&availablefreespace);
|
||||
|
@ -874,6 +877,7 @@ void Got_Filetxpak(void)
|
|||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += file->totalsize;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1186,6 +1190,7 @@ void CURLGetFile(void)
|
|||
nameonly(curl_realname);
|
||||
CONS_Printf(M_GetText("Finished downloading %s\n"), curl_realname);
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += curl_curfile->totalsize;
|
||||
curl_curfile->status = FS_FOUND;
|
||||
fclose(curl_curfile->file);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,9 @@ extern char downloaddir[512];
|
|||
#ifdef CLIENT_LOADINGSCREEN
|
||||
extern INT32 lastfilenum;
|
||||
extern INT32 downloadcompletednum;
|
||||
extern UINT32 downloadcompletedsize;
|
||||
extern INT32 totalfilesrequestednum;
|
||||
extern UINT32 totalfilesrequestedsize;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
|
|
Loading…
Reference in a new issue