diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a6e88a1abcdbfd2988263955b427a828eaa03f61..bd138957be7a7699ea0725dac136db79fdeab15c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1128,91 +1128,91 @@ static inline void CL_DrawConnectionStatus(void) } else { - // if (cl_mode == CL_LOADFILES) - // { - // INT32 totalfileslength; - // INT32 loadcompletednum = 0; - // INT32 i; - - // V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_YELLOWMAP, "Press ESC to abort"); - - // //ima just count files here - // if (fileneeded) - // { - // for (i = 0; i < fileneedednum; i++) - // if (fileneeded[i].status == FS_OPEN) - // loadcompletednum++; - // } - - // // Loading progress - // V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_YELLOWMAP, "Loading server addons..."); - // totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum)) * 256); - // M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-16-8, 32, 1); - // V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, 256, 8, 111); - // V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, totalfileslength, 8, 96); - // V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, - // va(" %2u/%2u Files",loadcompletednum,fileneedednum)); - // } - // else if (lastfilenum != -1) - // { - // INT32 dldlength; - // static char tempname[28]; - // fileneeded_t *file; - // char *filename; - - // if (snake) - // Snake_Draw(); - - // // Draw the bottom box. - // CL_DrawConnectionStatusBox(); - - // if (fileneeded) - // { - // file = &fileneeded[lastfilenum]; - // filename = file->filename; - // } - // else - // return; - - // Net_GetNetStat(); - // dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256); - // if (dldlength > 256) - // dldlength = 256; - // V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, 256, 8, 111); - // V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, dldlength, 8, 96); - - // memset(tempname, 0, sizeof(tempname)); - // // offset filename to just the name only part - // filename += strlen(filename) - nameonlylength(filename); - - // if (strlen(filename) > sizeof(tempname)-1) // too long to display fully - // { - // size_t endhalfpos = strlen(filename)-10; - // // display as first 14 chars + ... + last 10 chars - // // which should add up to 27 if our math(s) is correct - // snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos); - // } - // else // we can copy the whole thing in safely - // { - // strncpy(tempname, filename, sizeof(tempname)-1); - // } - - // V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_YELLOWMAP, - // va(M_GetText("Downloading \"%s\""), tempname)); - // V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, - // va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10)); - // V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, - // va("%3.1fK/s ", ((double)getbps)/1024)); - // } - // else - // { + if (cl_mode == CL_LOADFILES) + { + INT32 totalfileslength; + INT32 loadcompletednum = 0; + INT32 i; + + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_YELLOWMAP, "Press ESC to abort"); + + //ima just count files here + if (fileneeded) + { + for (i = 0; i < fileneedednum; i++) + if (fileneeded[i].status == FS_OPEN) + loadcompletednum++; + } + + // Loading progress + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_YELLOWMAP, "Loading server addons..."); + totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum)) * 256); + M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-16-8, 32, 1); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, totalfileslength, 8, 96); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, + va(" %2u/%2u Files",loadcompletednum,fileneedednum)); + } + else if (lastfilenum != -1) + { + INT32 dldlength; + static char tempname[28]; + fileneeded_t *file; + char *filename; + + if (snake) + Snake_Draw(); + + // Draw the bottom box. + CL_DrawConnectionStatusBox(); + + if (fileneeded) + { + file = &fileneeded[lastfilenum]; + filename = file->filename; + } + else + return; + + Net_GetNetStat(); + dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256); + if (dldlength > 256) + dldlength = 256; + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, dldlength, 8, 96); + + memset(tempname, 0, sizeof(tempname)); + // offset filename to just the name only part + filename += strlen(filename) - nameonlylength(filename); + + if (strlen(filename) > sizeof(tempname)-1) // too long to display fully + { + size_t endhalfpos = strlen(filename)-10; + // display as first 14 chars + ... + last 10 chars + // which should add up to 27 if our math(s) is correct + snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos); + } + else // we can copy the whole thing in safely + { + strncpy(tempname, filename, sizeof(tempname)-1); + } + + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_YELLOWMAP, + va(M_GetText("Downloading \"%s\""), tempname)); + V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, + va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10)); + V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-16, V_20TRANS|V_MONOSPACE, + va("%3.1fK/s ", ((double)getbps)/1024)); + } + else + { if (snake) Snake_Draw(); CL_DrawConnectionStatusBox(); V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_YELLOWMAP, M_GetText("Waiting to download files...")); - // } + } } } #endif