mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
New "Overall Download Progress" bar
Shows progress of all file downloads pre-join
This commit is contained in:
parent
12d40a07cc
commit
fc9f40a177
3 changed files with 44 additions and 12 deletions
|
@ -1167,10 +1167,6 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
// Draw background fade
|
// Draw background fade
|
||||||
V_DrawFadeScreen(0xFF00, 16);
|
V_DrawFadeScreen(0xFF00, 16);
|
||||||
|
|
||||||
// Draw the bottom box.
|
|
||||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
|
||||||
|
|
||||||
if (cl_mode != CL_DOWNLOADFILES
|
if (cl_mode != CL_DOWNLOADFILES
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
&& cl_mode != CL_DOWNLOADHTTPFILES
|
&& cl_mode != CL_DOWNLOADHTTPFILES
|
||||||
|
@ -1182,6 +1178,10 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
// 15 pal entries total.
|
// 15 pal entries total.
|
||||||
const char *cltext;
|
const char *cltext;
|
||||||
|
|
||||||
|
//Draw bottom box
|
||||||
|
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
||||||
|
|
||||||
for (i = 0; i < 16; ++i)
|
for (i = 0; i < 16; ++i)
|
||||||
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
|
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
|
||||||
|
|
||||||
|
@ -1221,13 +1221,18 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
cltext = M_GetText("Connecting to server...");
|
cltext = M_GetText("Connecting to server...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, cltext);
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-32, V_YELLOWMAP, cltext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lastfilenum != -1)
|
if (lastfilenum != -1)
|
||||||
{
|
{
|
||||||
|
// Draw the bottom box.
|
||||||
|
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-58-8, 32, 1);
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP, "Press ESC to abort");
|
||||||
|
|
||||||
INT32 dldlength;
|
INT32 dldlength;
|
||||||
|
INT32 totalfileslength;
|
||||||
static char tempname[28];
|
static char tempname[28];
|
||||||
fileneeded_t *file = &fileneeded[lastfilenum];
|
fileneeded_t *file = &fileneeded[lastfilenum];
|
||||||
char *filename = file->filename;
|
char *filename = file->filename;
|
||||||
|
@ -1236,8 +1241,10 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
|
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
|
||||||
if (dldlength > 256)
|
if (dldlength > 256)
|
||||||
dldlength = 256;
|
dldlength = 256;
|
||||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, 256, 8, 175);
|
||||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160);
|
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
memset(tempname, 0, sizeof(tempname));
|
memset(tempname, 0, sizeof(tempname));
|
||||||
// offset filename to just the name only part
|
// offset filename to just the name only part
|
||||||
|
@ -1255,15 +1262,24 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
strncpy(tempname, filename, sizeof(tempname)-1);
|
strncpy(tempname, filename, sizeof(tempname)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP,
|
||||||
va(M_GetText("Downloading \"%s\""), tempname));
|
va(M_GetText("Downloading \"%s\""), tempname));
|
||||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||||
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||||
va("%3.1fK/s ", ((double)getbps)/1024));
|
va("%3.1fK/s ", ((double)getbps)/1024));
|
||||||
|
|
||||||
|
// Download progress
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP, "Total File Download Progress");
|
||||||
|
totalfileslength = (INT32)((downloadcompletednum/(double)totalfilesrequestednum) * 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",downloadcompletednum,totalfilesrequestednum));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-32, V_YELLOWMAP,
|
||||||
M_GetText("Waiting to download files..."));
|
M_GetText("Waiting to download files..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1963,7 +1979,11 @@ static boolean CL_FinishedFileList(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CL_SendRequestFile())
|
if (CL_SendRequestFile())
|
||||||
|
{
|
||||||
cl_mode = CL_DOWNLOADFILES;
|
cl_mode = CL_DOWNLOADFILES;
|
||||||
|
downloadcompletednum = 0;
|
||||||
|
totalfilesrequestednum = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
else
|
else
|
||||||
|
@ -2108,10 +2128,15 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
case CL_PREPAREHTTPFILES:
|
case CL_PREPAREHTTPFILES:
|
||||||
if (http_source[0])
|
if (http_source[0])
|
||||||
{
|
{
|
||||||
|
downloadcompletednum = 0;
|
||||||
|
totalfilesrequestednum = 0;
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
||||||
|
{
|
||||||
curl_transfers++;
|
curl_transfers++;
|
||||||
|
totalfilesrequestednum++;
|
||||||
|
}
|
||||||
|
|
||||||
cl_mode = CL_DOWNLOADHTTPFILES;
|
cl_mode = CL_DOWNLOADHTTPFILES;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -108,6 +108,8 @@ char downloaddir[512] = "DOWNLOAD";
|
||||||
#ifdef CLIENT_LOADINGSCREEN
|
#ifdef CLIENT_LOADINGSCREEN
|
||||||
// for cl loading screen
|
// for cl loading screen
|
||||||
INT32 lastfilenum = -1;
|
INT32 lastfilenum = -1;
|
||||||
|
INT32 downloadcompletednum = 0;
|
||||||
|
INT32 totalfilesrequestednum = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
@ -330,6 +332,7 @@ boolean CL_SendRequestFile(void)
|
||||||
// put it in download dir
|
// put it in download dir
|
||||||
strcatbf(fileneeded[i].filename, downloaddir, "/");
|
strcatbf(fileneeded[i].filename, downloaddir, "/");
|
||||||
fileneeded[i].status = FS_REQUESTED;
|
fileneeded[i].status = FS_REQUESTED;
|
||||||
|
totalfilesrequestednum++;
|
||||||
}
|
}
|
||||||
WRITEUINT8(p, 0xFF);
|
WRITEUINT8(p, 0xFF);
|
||||||
I_GetDiskFreeSpace(&availablefreespace);
|
I_GetDiskFreeSpace(&availablefreespace);
|
||||||
|
@ -860,6 +863,7 @@ void Got_Filetxpak(void)
|
||||||
file->status = FS_FOUND;
|
file->status = FS_FOUND;
|
||||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||||
filename);
|
filename);
|
||||||
|
downloadcompletednum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1171,6 +1175,7 @@ void CURLGetFile(void)
|
||||||
{
|
{
|
||||||
nameonly(curl_realname);
|
nameonly(curl_realname);
|
||||||
CONS_Printf(M_GetText("Finished downloading %s\n"), curl_realname);
|
CONS_Printf(M_GetText("Finished downloading %s\n"), curl_realname);
|
||||||
|
downloadcompletednum++;
|
||||||
curl_curfile->status = FS_FOUND;
|
curl_curfile->status = FS_FOUND;
|
||||||
fclose(curl_curfile->file);
|
fclose(curl_curfile->file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ extern char downloaddir[512];
|
||||||
|
|
||||||
#ifdef CLIENT_LOADINGSCREEN
|
#ifdef CLIENT_LOADINGSCREEN
|
||||||
extern INT32 lastfilenum;
|
extern INT32 lastfilenum;
|
||||||
|
extern INT32 downloadcompletednum;
|
||||||
|
extern INT32 totalfilesrequestednum;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
|
Loading…
Reference in a new issue