diff --git a/src/netcode/client_connection.c b/src/netcode/client_connection.c index 917e32b598e03d86f8540b997329069f279817fb..2d26c2c2cb9837b9eaa5f9c2030a690a46cec4d7 100644 --- a/src/netcode/client_connection.c +++ b/src/netcode/client_connection.c @@ -51,9 +51,16 @@ static boolean IsDownloadingFile(void) return false; } +static boolean IsRequestedFile(fileneeded_t *file) +{ + return file->status == FS_REQUESTED || file->status == FS_DOWNLOADING || file->justdownloaded; +} + static void DrawConnectionStatusBox(void) { M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-16-8, 32, 1); + if (filedownload.current != -1) + M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-46-8, 32, 1); if (cl_mode == CL_CONFIRMCONNECT || IsDownloadingFile()) return; @@ -84,6 +91,44 @@ static void DrawFileProgress(fileneeded_t *file, int y) V_DrawRightAlignedString(BASEVIDWIDTH/2+128, y, V_20TRANS|V_MONOSPACE, va("%3.1fK/s ", ((double)getbps)/1024)); } +static void DrawOverallProgress(int y) +{ + UINT32 totalsize = 0; + INT32 downloadedfiles = 0; + INT32 totalfiles = 0; + for (int i = 0; i < fileneedednum; i++) { + if (IsRequestedFile(&fileneeded[i])) { + totalsize += fileneeded[i].totalsize; + totalfiles++; + } + + if (fileneeded[i].justdownloaded) + downloadedfiles++; + } + + INT32 downloaded = filedownload.completedsize; + if (fileneeded[filedownload.current].currentsize != fileneeded[filedownload.current].totalsize) + downloaded = filedownload.completedsize + fileneeded[filedownload.current].currentsize; + + INT32 dldlength = (INT32)((downloaded/(double)totalsize) * 256); + if (dldlength > 256) + dldlength = 256; + V_DrawFill(BASEVIDWIDTH/2-128, y, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, y, dldlength, 8, 96); + + const char *progress_str; + if (totalsize >= 1024*1024) + progress_str = va(" %.2fMiB/%.2fMiB", (double)downloaded / (1024*1024), (double)totalsize / (1024*1024)); + else if (totalsize < 1024) + progress_str = va(" %4uB/%4uB", downloaded, totalsize); + else + progress_str = va(" %.2fKiB/%.2fKiB", (double)downloaded / 1024, (double)totalsize / 1024); + + V_DrawString(BASEVIDWIDTH/2-128, y, V_20TRANS|V_ALLOWLOWERCASE, progress_str); + + V_DrawRightAlignedString(BASEVIDWIDTH/2+128, y, V_20TRANS|V_ALLOWLOWERCASE, va("%2u/%2u Files ", downloadedfiles+1, totalfiles)); +} + // // CL_DrawConnectionStatus // @@ -224,7 +269,7 @@ static void CL_DrawConnectionStatus(void) const char *download_str = M_GetText("Downloading \"%s\""); #endif - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-24, V_ALLOWLOWERCASE|V_YELLOWMAP, + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-46-24, V_ALLOWLOWERCASE|V_YELLOWMAP, va(download_str, tempname)); // Rusty: actually lets do this instead @@ -244,16 +289,18 @@ static void CL_DrawConnectionStatus(void) strlcpy(tempname, http_source, sizeof(tempname)); } - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_ALLOWLOWERCASE|V_YELLOWMAP, + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-46-16, V_ALLOWLOWERCASE|V_YELLOWMAP, va(M_GetText("from %s"), tempname)); } else { - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_ALLOWLOWERCASE|V_YELLOWMAP, + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-46-16, V_ALLOWLOWERCASE|V_YELLOWMAP, M_GetText("from the server")); } + DrawFileProgress(file, BASEVIDHEIGHT-46); - DrawFileProgress(file, BASEVIDHEIGHT-16); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_ALLOWLOWERCASE|V_YELLOWMAP, "Overall Download Progress"); + DrawOverallProgress(BASEVIDHEIGHT-16); } else { diff --git a/src/snake.c b/src/snake.c index 4219d5b8fa54ee69ce1b99167e697e935cd3483b..1276daafd0ae83f738a9cea0becefbc252097f20 100644 --- a/src/snake.c +++ b/src/snake.c @@ -23,7 +23,7 @@ #define SPEED 5 #define NUM_BLOCKS_X 20 -#define NUM_BLOCKS_Y 10 +#define NUM_BLOCKS_Y 8 #define BLOCK_SIZE 12 #define BORDER_SIZE 12 @@ -32,7 +32,7 @@ #define LEFT_X ((BASEVIDWIDTH - MAP_WIDTH) / 2 - BORDER_SIZE) #define RIGHT_X (LEFT_X + MAP_WIDTH + BORDER_SIZE * 2 - 1) -#define BOTTOM_Y (BASEVIDHEIGHT - 48) +#define BOTTOM_Y (BASEVIDHEIGHT - 76) #define TOP_Y (BOTTOM_Y - MAP_HEIGHT - BORDER_SIZE * 2 + 1) enum bonustype_s {