From a35d4ea5f499054c3c60e23f3b606ce604618966 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 19 Aug 2021 21:49:40 -0400 Subject: [PATCH 1/9] 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 --- src/d_clisrv.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f4029ee0..cfaa7e95 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1177,7 +1177,7 @@ static inline void CL_DrawConnectionStatus(void) // Draw background fade 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 && cl_mode != CL_DOWNLOADHTTPFILES #endif @@ -1213,15 +1213,9 @@ static inline void CL_DrawConnectionStatus(void) break; #endif case CL_ASKFULLFILELIST: - case CL_CHECKFILES: - cltext = M_GetText("Checking server addon list ..."); - break; case CL_CONFIRMCONNECT: cltext = ""; break; - case CL_LOADFILES: - cltext = M_GetText("Loading server addons..."); - break; case CL_ASKJOIN: case CL_WAITJOINRESPONSE: if (serverisfull) @@ -1243,7 +1237,29 @@ static inline void CL_DrawConnectionStatus(void) } 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 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, 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, va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20)); else @@ -2167,7 +2183,7 @@ static boolean CL_FinishedFileList(void) } #ifndef NONET - if (totalfilesrequestedsize>>20 >= 100) + if (totalfilesrequestedsize>>20 >= 10) downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20)); else downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10)); From b0724506bb8108a00f5bf494a8a2b710061e0c6c Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 19 Aug 2021 22:22:23 -0400 Subject: [PATCH 2/9] Set drift and item default axis binds to None --- src/g_game.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d9d7b7f1..42cdb13c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -488,8 +488,8 @@ consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, consvar_t cv_brakeaxis = {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis = {"joyaxis_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis = {"joyaxis_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis = {"joyaxis_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis = {"joyaxis_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_deadzone = {"joy_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -497,8 +497,8 @@ consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis2 = {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis2 = {"joyaxis2_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis2 = {"joyaxis2_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis2 = {"joyaxis2_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_deadzone2 = {"joy2_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis3 = {"joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -506,8 +506,8 @@ consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis3 = {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis3 = {"joyaxis3_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis3 = {"joyaxis3_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis3 = {"joyaxis3_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_deadzone3 = {"joy3_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis4 = {"joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -515,8 +515,8 @@ consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_brakeaxis4 = {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis4 = {"joyaxis4_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_driftaxis4 = {"joyaxis4_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_deadzone4 = {"joy4_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; From dc447c07e948527e6d5fe170ef227e9aa3913eff Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 19 Aug 2021 22:41:50 -0400 Subject: [PATCH 3/9] A few netgame default improvements Increase timeouts by a few seconds, helps folks joining with slow disks Beef up the vanilla downloader settings --- src/d_clisrv.c | 6 +++--- src/d_netcmd.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 9a3652cc..cfff5c16 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3561,17 +3561,17 @@ static CV_PossibleValue_t discordinvites_cons_t[] = {{0, "Admins Only"}, {1, "Ev consvar_t cv_discordinvites = {"discordinvites", "Everyone", CV_SAVE|CV_CALL, discordinvites_cons_t, Joinable_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}}; -consvar_t cv_resynchattempts = {"resynchattempts", "5", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL }; +consvar_t cv_resynchattempts = {"resynchattempts", "2", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL }; consvar_t cv_blamecfail = {"blamecfail", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; // max file size to send to a player (in kilobytes) static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}}; -consvar_t cv_maxsend = {"maxsend", "4096", CV_SAVE, maxsend_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_maxsend = {"maxsend", "MAX", CV_SAVE, maxsend_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_noticedownload = {"noticedownload", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // Speed of file downloading (in packets per tic) static CV_PossibleValue_t downloadspeed_cons_t[] = {{0, "MIN"}, {32, "MAX"}, {0, NULL}}; -consvar_t cv_downloadspeed = {"downloadspeed", "16", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_downloadspeed = {"downloadspeed", "MAX", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 84c1045a..cf55768f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -438,9 +438,9 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; -consvar_t cv_nettimeout = {"nettimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; //static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; -consvar_t cv_jointimeout = {"jointimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_jointimeout = {"jointimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t maxping_cons_t[] = {{0, "MIN"}, {1000, "MAX"}, {0, NULL}}; consvar_t cv_maxping = {"maxping", "800", CV_SAVE, maxping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; From a2900c8811c851eee197ec961f7c85b21be937a0 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Fri, 10 Sep 2021 20:25:13 -0400 Subject: [PATCH 4/9] Discord joins now force menu close and title demo stop This prevents wierdness from ahving the menu open on teh connection screen It also prevents the connect command from erroring due to being in a demo --- src/discord.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/discord.c b/src/discord.c index ba68da72..3ca9e40b 100644 --- a/src/discord.c +++ b/src/discord.c @@ -156,6 +156,9 @@ static void DRPC_HandleJoin(const char *secret) { char *ip = DRPC_XORIPString(secret); CONS_Printf("Connecting to %s via Discord\n", ip); + M_ClearMenus(true); //Don't have menus open during connection screen + if (demo.playback && demo.title) + G_CheckDemoStatus(); //Stop the title demo, so that the connect command doesn't error if a demo is playing COM_BufAddText(va("connect \"%s\"\n", ip)); free(ip); } From 55055b75361a2eed46f5c9ddc57cf7f14ad3f898 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sat, 25 Sep 2021 18:04:46 -0400 Subject: [PATCH 5/9] Small logging improvements for addon loading Adds back the "Loading file" message when a file is loaded Adds individual file errors for things loaded with W_InitMultipleFiles (-file param) Errors for a given file will now appear between "Loading file" and the "Added file" or "not adding file" messages, making troubleshooting easier --- src/w_wad.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index d4da027b..a9379be5 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -671,7 +671,7 @@ UINT16 W_InitFile(const char *filename) else refreshdirname = NULL; - //CONS_Debug(DBG_SETUP, "Loading %s\n", filename); + CONS_Printf("Loading %s\n", filename); // // check if limit of active wadfiles // @@ -848,6 +848,7 @@ void W_UnloadWadFile(UINT16 num) INT32 W_InitMultipleFiles(char **filenames, boolean addons) { INT32 rc = 1; + INT32 overallrc = 1; // will be realloced as lumps are added for (; *filenames; filenames++) @@ -856,13 +857,16 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons) G_SetGameModified(true, false); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); - rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0; + rc = W_InitFile(*filenames); + if (rc == INT16_MAX) + CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); + overallrc &= (rc != INT16_MAX) ? 1 : 0; } if (!numwadfiles) I_Error("W_InitMultipleFiles: no files found"); - return rc; + return overallrc; } /** Make sure a lump number is valid. From 93647873de327ec2edec97215d00a6892068e5a1 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Mon, 23 May 2022 23:12:24 -0500 Subject: [PATCH 6/9] Add warning and reset flow for non-default masterserver address --- src/m_menu.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 15a61987..59bb064e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -260,6 +260,10 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; // Multiplayer #ifndef NONET +static void M_PreStartServerMenu(INT32 choice); +static void M_PreStartServerMenuChoice(event_t *ev); +static void M_PreConnectMenu(INT32 choice); +static void M_PreConnectMenuChoice(event_t *ev); static void M_StartServerMenu(INT32 choice); static void M_ConnectMenu(INT32 choice); static void M_ConnectMenuModChecks(INT32 choice); @@ -994,7 +998,7 @@ static menuitem_t MP_MainMenu[] = {IT_HEADER, NULL, "Host a game", NULL, 100-24}, #ifndef NONET - {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 110-24}, + {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_PreStartServerMenu, 110-24}, #else {IT_GRAYEDOUT, NULL, "Internet/LAN...", NULL, 110-24}, #endif @@ -1002,7 +1006,7 @@ static menuitem_t MP_MainMenu[] = {IT_HEADER, NULL, "Join a game", NULL, 132-24}, #ifndef NONET - {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_ConnectMenuModChecks, 142-24}, + {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_PreConnectMenu, 142-24}, {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 150-24}, #else {IT_GRAYEDOUT, NULL, "Internet server browser...",NULL, 142-24}, @@ -8797,6 +8801,60 @@ static void M_ConnectMenuModChecks(INT32 choice) M_ConnectMenu(-1); } + +static void M_HandleMasterServerResetChoice(event_t *ev) +{ + INT32 choice = -1; + + choice = ev->data1; + + if (ev->type == ev_keydown) + { + if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[gc_accelerate][0] || choice == gamecontrol[gc_accelerate][1]) + { + CV_Set(&cv_masterserver, cv_masterserver.defaultvalue); + S_StartSound(NULL, sfx_s221); + } + } +} + +static void M_PreStartServerMenu(INT32 choice) +{ + (void)choice; + + if (!CV_IsSetToDefault(&cv_masterserver)) + { + M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to host games on the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreStartServerMenuChoice,MM_EVENTHANDLER); + return; + } + + M_StartServerMenu(-1); +} + +static void M_PreConnectMenu(INT32 choice) +{ + (void)choice; + + if (!CV_IsSetToDefault(&cv_masterserver)) + { + M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to see games from the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreConnectMenuChoice,MM_EVENTHANDLER); + return; + } + + M_ConnectMenuModChecks(-1); +} + +static void M_PreStartServerMenuChoice(event_t *ev) +{ + M_HandleMasterServerResetChoice(ev); + M_StartServerMenu(-1); +} + +static void M_PreConnectMenuChoice(event_t *ev) +{ + M_HandleMasterServerResetChoice(ev); + M_ConnectMenuModChecks(-1); +} #endif //NONET //=========================================================================== From 8548d441099f8c4a030cf1f9d1fb35effd45f135 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 24 May 2022 18:25:18 -0500 Subject: [PATCH 7/9] Futureproofing mserv address conveyance --- src/m_menu.c | 33 +++++++++++++++++++++++++++++++-- src/mserv.c | 3 +++ src/mserv.h | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 59bb064e..9b95d79b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8565,6 +8565,15 @@ static void M_DrawConnectMenu(void) // Page num V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_page].alphaKey, highlightflags, va("%u of %d", serverlistpage+1, numPages)); + + // Did you change the Server Browser address? Have a little reminder. + int mservflags = V_ALLOWLOWERCASE; + if (CV_IsSetToDefault(&cv_masterserver)) + mservflags = mservflags|highlightflags|V_30TRANS; + else + mservflags = mservflags|warningflags; + V_DrawRightAlignedThinString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+10 + MP_ConnectMenu[mp_connect_page].alphaKey, + mservflags, cv_masterserver.string); // Horizontal line! V_DrawFill(1, currentMenu->y+32, 318, 1, 0); @@ -8802,6 +8811,8 @@ static void M_ConnectMenuModChecks(INT32 choice) M_ConnectMenu(-1); } +boolean firstDismissedNagThisBoot = true; + static void M_HandleMasterServerResetChoice(event_t *ev) { INT32 choice = -1; @@ -8813,7 +8824,16 @@ static void M_HandleMasterServerResetChoice(event_t *ev) if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[gc_accelerate][0] || choice == gamecontrol[gc_accelerate][1]) { CV_Set(&cv_masterserver, cv_masterserver.defaultvalue); + CV_Set(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.defaultvalue); S_StartSound(NULL, sfx_s221); + } else + { + if (firstDismissedNagThisBoot) { + if (cv_masterserver_nagattempts.value > 0) { + CV_SetValue(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.value - 1); + } + firstDismissedNagThisBoot = false; + } } } } @@ -8822,7 +8842,7 @@ static void M_PreStartServerMenu(INT32 choice) { (void)choice; - if (!CV_IsSetToDefault(&cv_masterserver)) + if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to host games on the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreStartServerMenuChoice,MM_EVENTHANDLER); return; @@ -8835,7 +8855,7 @@ static void M_PreConnectMenu(INT32 choice) { (void)choice; - if (!CV_IsSetToDefault(&cv_masterserver)) + if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to see games from the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreConnectMenuChoice,MM_EVENTHANDLER); return; @@ -9069,6 +9089,15 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) static void M_DrawServerMenu(void) { M_DrawLevelSelectOnly(false, false); + if (currentMenu == &MP_ServerDef && cv_advertise.value) // Remind players where they're hosting. + { + int mservflags = V_ALLOWLOWERCASE; + if (CV_IsSetToDefault(&cv_masterserver)) + mservflags = mservflags|highlightflags|V_30TRANS; + else + mservflags = mservflags|warningflags; + V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, mservflags, cv_masterserver.string); + } M_DrawGenericMenu(); } diff --git a/src/mserv.c b/src/mserv.c index ab615711..33128c76 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -75,6 +75,8 @@ consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SA consvar_t cv_advertise = {"advertise", "No", CV_NETVAR|CV_CALL|CV_NOINIT, CV_YesNo, Advertise_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; + #if defined (MASTERSERVER) && defined (HAVE_THREADS) int ms_QueryId; I_mutex ms_QueryId_mutex; @@ -98,6 +100,7 @@ void AddMServCommands(void) CV_RegisterVar(&cv_masterserver_timeout); CV_RegisterVar(&cv_masterserver_debug); CV_RegisterVar(&cv_masterserver_token); + CV_RegisterVar(&cv_masterserver_nagattempts); CV_RegisterVar(&cv_advertise); CV_RegisterVar(&cv_servername); CV_RegisterVar(&cv_server_contact); diff --git a/src/mserv.h b/src/mserv.h index 02aaf367..ef401aba 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -61,6 +61,8 @@ extern consvar_t cv_masterserver_token; extern consvar_t cv_advertise; +extern consvar_t cv_masterserver_nagattempts; + #ifdef HAVE_THREADS extern int ms_QueryId; extern I_mutex ms_QueryId_mutex; From 1441fda8384633b678ab0482f159ae76f5241abe Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 24 May 2022 18:44:49 -0500 Subject: [PATCH 8/9] Clearly mark MS reminder + formatting touchup --- src/m_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 9b95d79b..28f71aa9 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8572,8 +8572,8 @@ static void M_DrawConnectMenu(void) mservflags = mservflags|highlightflags|V_30TRANS; else mservflags = mservflags|warningflags; - V_DrawRightAlignedThinString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+10 + MP_ConnectMenu[mp_connect_page].alphaKey, - mservflags, cv_masterserver.string); + V_DrawRightAlignedSmallString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+14 + MP_ConnectMenu[mp_connect_page].alphaKey, + mservflags, va("MS: %s", cv_masterserver.string)); // Horizontal line! V_DrawFill(1, currentMenu->y+32, 318, 1, 0); @@ -9096,7 +9096,7 @@ static void M_DrawServerMenu(void) mservflags = mservflags|highlightflags|V_30TRANS; else mservflags = mservflags|warningflags; - V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, mservflags, cv_masterserver.string); + V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, mservflags, va("Master Server: %s", cv_masterserver.string)); } M_DrawGenericMenu(); } From 129fc2bbb1814617500a5302b626d3f99dc65a3f Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Wed, 25 May 2022 18:22:43 -0500 Subject: [PATCH 9/9] Style cleanup --- src/m_menu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 28f71aa9..6c04c933 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8826,10 +8826,13 @@ static void M_HandleMasterServerResetChoice(event_t *ev) CV_Set(&cv_masterserver, cv_masterserver.defaultvalue); CV_Set(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.defaultvalue); S_StartSound(NULL, sfx_s221); - } else + } + else { - if (firstDismissedNagThisBoot) { - if (cv_masterserver_nagattempts.value > 0) { + if (firstDismissedNagThisBoot) + { + if (cv_masterserver_nagattempts.value > 0) + { CV_SetValue(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.value - 1); } firstDismissedNagThisBoot = false;