From 6c6306889a49368fc915701eb30bcbd99396dfba Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 8 Jun 2023 18:02:06 +0100 Subject: [PATCH] M_StartMessage revamp Immense 25-file diff, so spun off into its own branch. - Improved appearance - Not just a big block of text on a blue background - Well, OK, the main part is, but some stuff has been spun out into its own fields - Title text - Text and button prompt for Yes/No or OK - Slides with pow on and off the screen - Disabled MM_EVENTHANDLER, which has always been dog but got considerably worse after newmenus to the point nothing's using it anymore - Required in order to reduce the reliance on FUNCPTRCAST, which prevents Eidolon from compiling some stuff because it's not valid C++ --- src/d_clisrv.c | 105 ++++++++++----------- src/d_netcmd.c | 12 +-- src/g_demo.c | 32 +++---- src/g_game.c | 8 +- src/k_menu.h | 14 ++- src/k_menudraw.c | 46 +++++++-- src/k_menufunc.c | 6 +- src/m_cheat.c | 28 +++--- src/menus/extras-addons.c | 22 ++--- src/menus/extras-egg-tv.cpp | 11 +-- src/menus/main-1.c | 2 +- src/menus/options-data-erase-1.c | 4 +- src/menus/options-data-erase-profile.c | 6 +- src/menus/options-profiles-1.c | 6 +- src/menus/options-profiles-edit-1.c | 6 +- src/menus/options-profiles-edit-controls.c | 2 +- src/menus/play-local-race-time-attack.c | 6 +- src/menus/play-online-1.c | 2 +- src/menus/play-online-host.c | 2 +- src/menus/play-online-join-ip.c | 2 +- src/menus/play-online-server-browser.c | 2 +- src/menus/transient/level-select.c | 2 +- src/menus/transient/message-box.c | 55 ++++++++--- src/menus/transient/pause-game.c | 4 +- src/mserv.c | 2 +- 25 files changed, 222 insertions(+), 165 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b1f8dd0a6..1fd3e890a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1722,12 +1722,12 @@ static boolean CL_FinishedFileList(void) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "You have too many WAD files loaded\n" "to add ones the server is using.\n" - "Please restart Ring Racers before connecting.\n\n" - "Press (B)\n" - ), NULL, MM_NOTHING); + "Please restart Ring Racers before connecting.\n" + ), NULL, MM_NOTHING, NULL, "Back to Menu"); return false; } else if (i == 2) // cannot join for some reason @@ -1736,27 +1736,26 @@ static boolean CL_FinishedFileList(void) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "You have the wrong addons loaded.\n\n" "To play on this server, restart\n" "the game and don't load any addons.\n" "Ring Racers will automatically add\n" - "everything you need when you join.\n\n" - "Press (B)\n" - ), NULL, MM_NOTHING); + "everything you need when you join.\n" + ), NULL, MM_NOTHING, NULL, "Back to Menu"); return false; } else if (i == 1) { if (serverisfull) { - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "This server is full!\n" "\n" "You may load server addons (if any), and wait for a slot.\n" - "\n" - "Press (A) to continue or (B) to cancel\n" - ), NULL, MM_NOTHING); + ), NULL, MM_NOTHING, "Continue", "Back to Menu"); cl_mode = CL_CONFIRMCONNECT; } else @@ -1776,15 +1775,15 @@ static boolean CL_FinishedFileList(void) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "An error occured when trying to\n" "download missing addons.\n" "(This is almost always a problem\n" "with the server, not your game.)\n\n" "See the console or log file\n" - "for additional details.\n\n" - "Press (B)\n" - ), NULL, MM_NOTHING); + "for additional details.\n" + ), NULL, MM_NOTHING, NULL, "Back to Menu"); return false; } } @@ -1811,23 +1810,21 @@ static boolean CL_FinishedFileList(void) downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10)); if (serverisfull) - M_StartMessage(va(M_GetText( + M_StartMessage("Server Connection", + va(M_GetText( "This server is full!\n" "Download of %s additional content\n" "is required to join.\n" "\n" "You may download, load server addons,\n" "and wait for a slot.\n" - "\n" - "Press (A) to continue or (B) to cancel\n" - ), downloadsize), NULL, MM_NOTHING); + ), downloadsize), NULL, MM_NOTHING, "Continue", "Back to Menu"); else - M_StartMessage(va(M_GetText( + M_StartMessage("Server Connection", + va(M_GetText( "Download of %s additional content\n" "is required to join.\n" - "\n" - "Press (A) to continue or (B) to cancel\n" - ), downloadsize), NULL, MM_NOTHING); + ), downloadsize), NULL, MM_NOTHING, "Continue", "Back to Menu"); Z_Free(downloadsize); cl_mode = CL_CONFIRMCONNECT; @@ -1906,12 +1903,12 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) D_ClearState(); M_StartControlPanel(); - M_StartMessage(va( + M_StartMessage("Server Connection Failure", + va( "Your EXE differs from the server.\n" " Yours: %.*s\n" - "Theirs: %s\n\n" - "Press ESC\n", - GIT_SHA_ABBREV * 2, comprevision, theirs), NULL, MM_NOTHING); + "Theirs: %s\n\n", + GIT_SHA_ABBREV * 2, comprevision, theirs), NULL, MM_NOTHING, NULL, "Back to Menu"); return false; } #endif @@ -2057,12 +2054,11 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "The direct download encountered an error.\n" "See the logfile for more info.\n" - "\n" - "Press (B)\n" - ), NULL, MM_NOTHING); + ), NULL, MM_NOTHING, NULL, "Back to Menu"); return false; } case CL_LOADFILES: @@ -2087,12 +2083,11 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText( + M_StartMessage("Server Connection Failure", + M_GetText( "5 minute wait time exceeded.\n" "You may retry connection.\n" - "\n" - "Press (B)\n" - ), NULL, MM_NOTHING); + ), NULL, MM_NOTHING, NULL, "Return to Menu"); return false; } // prepare structures to save the file @@ -2185,7 +2180,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic if (cl_mode == CL_ABORTED) { CONS_Printf(M_GetText("Network game synchronization aborted.\n")); -// M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress (B)\n"), NULL, MM_NOTHING); +// M_StartMessage("Server Connection", M_GetText("Network game synchronization aborted.\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); D_QuitNetGame(); CL_Reset(); @@ -3423,25 +3418,25 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) M_StartControlPanel(); if (msg == KICK_MSG_CON_FAIL) - M_StartMessage(M_GetText("Server closed connection\n(Synch failure)\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Server closed connection\n(Synch failure)\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_PING_HIGH) - M_StartMessage(M_GetText("Server closed connection\n(Broke delay limit)\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Server closed connection\n(Broke delay limit)\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_TIMEOUT) // this one will probably never be seen? - M_StartMessage(M_GetText("Connection timed out\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Connection timed out\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_BANNED) - M_StartMessage(M_GetText("You have been banned by the server\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("You have been banned by the server\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_CUSTOM_KICK) - M_StartMessage(M_GetText("You have been kicked\n(Automatic grief detection)\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("You have been kicked\n(Automatic grief detection)\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_CUSTOM_KICK) - M_StartMessage(va(M_GetText("You have been kicked\n(%s)\nPress (B)\n"), reason), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", va(M_GetText("You have been kicked\n(%s)\n"), reason), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_CUSTOM_BAN) - M_StartMessage(va(M_GetText("You have been banned\n(%s)\nPress (B)\n"), reason), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", va(M_GetText("You have been banned\n(%s)\n"), reason), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_SIGFAIL) - M_StartMessage(M_GetText("Server closed connection\n(Invalid signature)\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Server closed connection\n(Invalid signature)\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else if (msg == KICK_MSG_VOTE_KICK) - M_StartMessage(M_GetText("You have been kicked by popular demand\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("You have been kicked by popular demand\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); else - M_StartMessage(M_GetText("You have been kicked by the server\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("You have been kicked by the server\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); } else if (server) { @@ -4583,7 +4578,7 @@ static void HandleShutdown(SINT8 node) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText("Server has shutdown\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Server has shutdown\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); } /** Called when a PT_NODETIMEOUT packet is received @@ -4599,7 +4594,7 @@ static void HandleTimeout(SINT8 node) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(M_GetText("Server Timeout\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", M_GetText("Server Timeout\n"), NULL, MM_NOTHING, NULL, "Back to Menu"); } // Called when a signature check fails and we suspect the server is playing games. @@ -4616,7 +4611,7 @@ void HandleSigfail(const char *string) CL_Reset(); D_ClearState(); M_StartControlPanel(); - M_StartMessage(va(M_GetText("Signature check failed.\n(%s)\nPress (B)\n"), string), NULL, MM_NOTHING); + M_StartMessage("Server Disconnected", va(M_GetText("Signature check failed.\n(%s)\n"), string), NULL, MM_NOTHING, NULL, "Back to Menu"); } /** Called when a PT_SERVERINFO packet is received @@ -4814,14 +4809,16 @@ static void HandlePacketFromAwayNode(SINT8 node) if (reason[1] == '|') { - M_StartMessage(va("You have been %sfrom the server\n\nReason:\n%s", + M_StartMessage("Server Connection Failure", + va("You have been %sfrom the server\n\nReason:\n%s", (reason[0] == 'B') ? "banned\n" : "temporarily\nkicked ", - reason+2), NULL, MM_NOTHING); + reason+2), NULL, MM_NOTHING, NULL, "Back to Menu"); } else { - M_StartMessage(va(M_GetText("Server refuses connection\n\nReason:\n%s"), - reason), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", + va(M_GetText("Server refuses connection\n\nReason:\n%s"), + reason), NULL, MM_NOTHING, NULL, "Back to Menu"); } free(reason); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b27da2029..712c01a3f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4696,12 +4696,12 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) if (ncs == FS_NOTFOUND) { CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server.\n"), filename); - M_StartMessage(va("The server added a file\n(%s)\nthat you do not have.\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("The server added a file\n(%s)\nthat you do not have.\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } else { CONS_Printf(M_GetText("Unknown error finding soc file (%s) the server added.\n"), filename); - M_StartMessage(va("Unknown error trying to load a file\nthat the server added\n(%s).\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("Unknown error trying to load a file\nthat the server added\n(%s).\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } return; } @@ -4940,22 +4940,22 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) if (ncs == FS_FOUND) { CONS_Printf(M_GetText("The server tried to add %s,\nbut you have too many files added.\nRestart the game to clear loaded files\nand play on this server."), filename); - M_StartMessage(va("The server added a file \n(%s)\nbut you have too many files added.\nRestart the game to clear loaded files.\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("The server added a file \n(%s)\nbut you have too many files added.\nRestart the game to clear loaded files.\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } else if (ncs == FS_NOTFOUND) { CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server."), filename); - M_StartMessage(va("The server added a file \n(%s)\nthat you do not have.\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("The server added a file \n(%s)\nthat you do not have.\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } else if (ncs == FS_MD5SUMBAD) { CONS_Printf(M_GetText("Checksum mismatch while loading %s.\nMake sure you have the copy of\nthis file that the server has.\n"), filename); - M_StartMessage(va("Checksum mismatch while loading \n%s.\nThe server seems to have a\ndifferent version of this file.\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("Checksum mismatch while loading \n%s.\nThe server seems to have a\ndifferent version of this file.\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } else { CONS_Printf(M_GetText("Unknown error finding wad file (%s) the server added.\n"), filename); - M_StartMessage(va("Unknown error trying to load a file\nthat the server added \n(%s).\n\nPress ESC\n",filename), NULL, MM_NOTHING); + M_StartMessage("Server Connection Failure", va("Unknown error trying to load a file\nthat the server added \n(%s).\n",filename), NULL, MM_NOTHING, NULL, "Return to Menu"); } return; } diff --git a/src/g_demo.c b/src/g_demo.c index ec2372c8c..5b8a5854e 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -2115,7 +2115,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp) { CONS_Alert(CONS_WARNING, M_GetText("Too many files loaded to add anymore for demo playback\n")); if (!CON_Ready()) - M_StartMessage(M_GetText("There are too many files loaded to add this demo's addons.\n\nDemo playback may desync.\n\nPress ESC\n"), NULL, MM_NOTHING); + M_StartMessage("Demo Playback", M_GetText("There are too many files loaded to add this demo's addons.\n\nDemo playback may desync.\n"), NULL, MM_NOTHING, NULL, NULL); } else if (ncs != FS_FOUND) { @@ -2127,7 +2127,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp) CONS_Alert(CONS_NOTICE, M_GetText("Unknown error finding file %s\n"), filename); if (!CON_Ready()) - M_StartMessage(M_GetText("There were errors trying to add this demo's addons. Check the console for more information.\n\nDemo playback may desync.\n\nPress ESC\n"), NULL, MM_NOTHING); + M_StartMessage("Demo Playback", M_GetText("There were errors trying to add this demo's addons. Check the console for more information.\n\nDemo playback may desync.\n"), NULL, MM_NOTHING, NULL, NULL); } else { @@ -3080,7 +3080,7 @@ void G_DoPlayDemo(const char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); Z_Free(pdemoname); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); return; } } @@ -3096,7 +3096,7 @@ void G_DoPlayDemo(const char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); Z_Free(pdemoname); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); return; } @@ -3125,7 +3125,7 @@ void G_DoPlayDemo(const char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); Z_Free(pdemoname); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); return; } @@ -3138,7 +3138,7 @@ void G_DoPlayDemo(const char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); Z_Free(pdemoname); gameaction = ga_nothing; - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); return; } @@ -3163,7 +3163,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is not a Ring Racers replay file.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3182,7 +3182,7 @@ void G_DoPlayDemo(const char *defdemoname) default: snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3199,7 +3199,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3262,7 +3262,7 @@ void G_DoPlayDemo(const char *defdemoname) CONS_Alert(CONS_ERROR, "%s", msg); if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out. - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3277,7 +3277,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is in a gametype that is not currently loaded and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3291,7 +3291,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s has an invalid skin list and cannot be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(pdemoname); Z_Free(demobuf.buffer); demo.playback = false; @@ -3324,7 +3324,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(demo.skinlist); demo.skinlist = NULL; Z_Free(pdemoname); @@ -3341,7 +3341,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(demo.skinlist); demo.skinlist = NULL; Z_Free(pdemoname); @@ -3395,7 +3395,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with %s, and is thus invalid.\n"), pdemoname, (bot ? "bots" : "spectators")); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(demo.skinlist); demo.skinlist = NULL; Z_Free(pdemoname); @@ -3412,7 +3412,7 @@ void G_DoPlayDemo(const char *defdemoname) { snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname); CONS_Alert(CONS_ERROR, "%s", msg); - M_StartMessage(msg, NULL, MM_NOTHING); + M_StartMessage("Demo Playback", msg, NULL, MM_NOTHING, NULL, "Return to Menu"); Z_Free(demo.skinlist); demo.skinlist = NULL; Z_Free(pdemoname); diff --git a/src/g_game.c b/src/g_game.c index 553a905cb..2466f8db9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5709,12 +5709,12 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) if (strcmp((const char *)save.p, (const char *)vcheck)) { #ifdef SAVEGAME_OTHERVERSIONS - M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"), - M_ForceLoadGameResponse, MM_YESNO); + M_StartMessage("Savegame Load", M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n"), + M_ForceLoadGameResponse, MM_YESNO, NULL, NULL); //Freeing done by the callback function of the above message #else M_ClearMenus(true); // so ESC backs out to title - M_StartMessage(M_GetText("Save game from different version\n\nPress ESC\n"), NULL, MM_NOTHING); + M_StartMessage("Savegame Load", M_GetText("Save game from different version\n\n"), NULL, MM_NOTHING, NULL, "Return to Menu"); Command_ExitGame_f(); P_SaveBufferFree(&save); @@ -5735,7 +5735,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) if (!P_LoadGame(&save, mapoverride)) { M_ClearMenus(true); // so ESC backs out to title - M_StartMessage(M_GetText("Savegame file corrupted\n\nPress ESC\n"), NULL, MM_NOTHING); + M_StartMessage("Savegame Load", M_GetText("Savegame file corrupted\n"), NULL, MM_NOTHING, NULL, "Return to Menu"); Command_ExitGame_f(); Z_Free(save.buffer); save.p = save.buffer = NULL; diff --git a/src/k_menu.h b/src/k_menu.h index b7d07db0e..c352ddad5 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -178,7 +178,7 @@ typedef enum { MM_NOTHING = 0, // is just displayed until the user do someting MM_YESNO, // routine is called with only 'y' or 'n' in param - MM_EVENTHANDLER // the same of above but without 'y' or 'n' restriction + //MM_EVENTHANDLER // the same of above but without 'y' or 'n' restriction // and routine is void routine(event_t *) (ex: set control) } menumessagetype_t; @@ -520,16 +520,22 @@ typedef enum extern struct menumessage_s { boolean active; + boolean closing; + INT32 flags; // MM_ + const char *header; char message[MAXMENUMESSAGE]; // message to display SINT8 fadetimer; // opening INT32 x; INT32 y; - INT32 m; + INT16 timer; void (*routine)(INT32 choice); // Normal routine - void (*eroutine)(event_t *ev); // Event routine (MM_EVENTHANDLER) + //void (*eroutine)(event_t *ev); // Event routine (MM_EVENTHANDLER) + + const char *defaultstr; + const char *confirmstr; } menumessage; void M_HandleMenuMessage(void); @@ -619,7 +625,7 @@ void M_PlayMenuJam(void); void M_MenuTypingInput(INT32 key); -void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype); +void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr); void M_StopMessage(INT32 choice); void M_DrawMenuMessage(void); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index b9d966016..617f98014 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -606,22 +606,52 @@ static void M_DrawMenuTyping(void) // Draw the message popup submenu void M_DrawMenuMessage(void) { - - INT32 y = menumessage.y + (9-menumessage.fadetimer)*20; + INT32 x = (BASEVIDWIDTH - menumessage.x)/2; + INT32 y = (BASEVIDHEIGHT - menumessage.y)/2 + floor(pow(2, (double)(9 - menumessage.fadetimer))); size_t i, start = 0; - INT16 max; char string[MAXMENUMESSAGE]; - INT32 mlines; const char *msg = menumessage.message; if (!menumessage.active) return; - mlines = menumessage.m>>8; - max = (INT16)((UINT8)(menumessage.m & 0xFF)*8); - V_DrawFadeScreen(31, menumessage.fadetimer); - M_DrawTextBox(menumessage.x, y - 8, (max+7)>>3, mlines); + + V_DrawFill(0, y, BASEVIDWIDTH, menumessage.y, 159); + + if (menumessage.header != NULL) + { + V_DrawThinString(x, y - 10, highlightflags|V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.header); + } + + if (menumessage.defaultstr) + { + INT32 workx = x + menumessage.x; + INT32 worky = y + menumessage.y; + + workx -= V_ThinStringWidth(menumessage.defaultstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE); + V_DrawThinString(workx, worky + 1, V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.defaultstr); + + workx -= SHORT(kp_button_x[1][0]->width); + K_drawButtonAnim(workx, worky, 0, kp_button_x[1], menumessage.timer); + + workx -= SHORT(kp_button_b[1][0]->width); + K_drawButtonAnim(workx, worky, 0, kp_button_b[1], menumessage.timer); + + if (menumessage.confirmstr) + { + workx -= 12; + + workx -= V_ThinStringWidth(menumessage.confirmstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE); + V_DrawThinString(workx, worky + 1, V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.confirmstr); + } + + workx -= SHORT(kp_button_a[1][0]->width); + K_drawButtonAnim(workx, worky, 0, kp_button_a[1], menumessage.timer); + } + + x -= 4; + y += 4; while (*(msg+start)) { diff --git a/src/k_menufunc.c b/src/k_menufunc.c index c7f2f86df..2e7800be0 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -273,12 +273,12 @@ boolean M_Responder(event_t *ev) } // event handler for MM_EVENTHANDLER - if (menumessage.active && menumessage.flags == MM_EVENTHANDLER && menumessage.routine) + /*if (menumessage.active && menumessage.flags == MM_EVENTHANDLER && menumessage.routine) { CONS_Printf("MM_EVENTHANDLER...\n"); menumessage.eroutine(ev); // What a terrible hack... return true; - } + }*/ // Handle menu handling in-game. if (menuactive == false) @@ -994,7 +994,7 @@ static void M_HandleMenuInput(void) { if (((currentMenu->menuitems[itemOn].status & IT_CALLTYPE) & IT_CALL_NOTMODIFIED) && majormods) { - M_StartMessage(M_GetText("This cannot be done with complex addons\nor in a cheated game.\n\nPress (B)"), NULL, MM_NOTHING); + M_StartMessage("Modified Game", M_GetText("This cannot be done with complex addons\nor in a cheated game."), NULL, MM_NOTHING, NULL, NULL); return; } } diff --git a/src/m_cheat.c b/src/m_cheat.c index c94699a93..a8ac759c0 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -86,27 +86,23 @@ static UINT8 cheatf_warp(void) M_ClearMenus(true); S_StartSound(0, sfx_kc42); - M_StartMessage(M_GetText( - "TOURNAMENT MODE\n\ - \nAll challenges temporarily unlocked.\n\ - Saving is disabled - the game will\n\ - return to normal on next launch.\n\ - \n\ - Press (B)\n" - ), NULL, MM_NOTHING); + M_StartMessage("Tournament Mode", + M_GetText( + "All challenges temporarily unlocked.\n" + "Saving is disabled - the game will\n" + "return to normal on next launch.\n" + ), NULL, MM_NOTHING, NULL, NULL); } else { S_StartSound(0, sfx_s3k7b); - M_StartMessage(M_GetText( - "TOURNAMENT MODE\n\ - \nThis is the correct password, but.\n\ - you already have every challenge\n\ - unlocked, so saving is still allowed!\n\ - \n\ - Press (B)\n" - ), NULL, MM_NOTHING); + M_StartMessage("Tournament Mode", + M_GetText( + "This is the correct password, but\n" + "you already have every challenge\n" + "unlocked, so saving is still allowed!\n" + ), NULL, MM_NOTHING, NULL, NULL); } return 1; diff --git a/src/menus/extras-addons.c b/src/menus/extras-addons.c index 6ecf56398..d9c8f9c2b 100644 --- a/src/menus/extras-addons.c +++ b/src/menus/extras-addons.c @@ -59,7 +59,7 @@ void M_Addons(INT32 choice) if (!preparefilemenu(false, false)) { - M_StartMessage(va("No files/folders found.\n\n%s\n\nPress (B)\n", LOCATIONSTRING1),NULL,MM_NOTHING); + M_StartMessage("Add-ons Menu", va("No files/folders found.\n\n%s\n", LOCATIONSTRING1),NULL,MM_NOTHING, NULL, NULL); return; } else @@ -92,7 +92,7 @@ char *M_AddonsHeaderPath(void) #define UNEXIST S_StartSound(NULL, sfx_s26d);\ M_SetupNextMenu(MISC_AddonsDef.prevMenu, false);\ - M_StartMessage(va("\x82%s\x80\nThis folder no longer exists!\nAborting to main menu.\n\nPress (B)\n", M_AddonsHeaderPath()),NULL,MM_NOTHING) + M_StartMessage("Add-ons Menu", va("\x82%s\x80\nThis folder no longer exists!\nAborting to main menu.\n", M_AddonsHeaderPath()),NULL,MM_NOTHING, NULL, NULL) #define CLEARNAME Z_Free(refreshdirname);\ refreshdirname = NULL @@ -136,25 +136,25 @@ void M_AddonsRefresh(void) { S_StartSound(NULL, sfx_s26d); if (refreshdirmenu & REFRESHDIR_MAX) - message = va("%c%s\x80\nMaximum number of addons reached.\nA file could not be loaded.\nIf you wish to play with this addon, restart the game to clear existing ones.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nMaximum number of addons reached.\nA file could not be loaded.\nIf you wish to play with this addon, restart the game to clear existing ones.\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); else - message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more info.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more info.\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); } else if (refreshdirmenu & (REFRESHDIR_WARNING|REFRESHDIR_ERROR)) { S_StartSound(NULL, sfx_s224); - message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more info.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings")); + message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more info.\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings")); } else if (majormods && !prevmajormods) { S_StartSound(NULL, sfx_s221); - message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); prevmajormods = majormods; } if (message) { - M_StartMessage(message,FUNCPTRCAST(M_AddonsClearName),MM_YESNO); + M_StartMessage("Add-ons Menu", message, &M_AddonsClearName,MM_YESNO, NULL, NULL); return;// true; } @@ -267,7 +267,7 @@ void M_HandleAddons(INT32 choice) if (!preparefilemenu(false, false)) { S_StartSound(NULL, sfx_s224); - M_StartMessage(va("%c%s\x80\nThis folder is empty.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); + M_StartMessage("Add-ons Menu", va("%c%s\x80\nThis folder is empty.\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING, NULL, NULL); menupath[menupathindex[++menudepthleft]] = 0; if (!preparefilemenu(true, false)) @@ -286,7 +286,7 @@ void M_HandleAddons(INT32 choice) else { S_StartSound(NULL, sfx_s26d); - M_StartMessage(va("%c%s\x80\nThis folder is too deep to navigate to!\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); + M_StartMessage("Add-ons Menu", va("%c%s\x80\nThis folder is too deep to navigate to!\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING, NULL, NULL); menupath[menupathindex[menudepthleft]] = 0; } break; @@ -302,11 +302,11 @@ void M_HandleAddons(INT32 choice) break; case EXT_TXT: - M_StartMessage(va("%c%s\x80\nThis file may not be a console script.\nAttempt to run anyways? \n\nPress (A) to confirm or (B) to cancel\n\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),FUNCPTRCAST(M_AddonExec),MM_YESNO); + M_StartMessage("Add-ons Menu", va("%c%s\x80\nThis file may not be a console script.\nAttempt to run anyways?\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),&M_AddonExec,MM_YESNO, NULL, NULL); break; case EXT_CFG: - M_StartMessage(va("%c%s\x80\nThis file may modify your settings.\nAttempt to run anyways? \n\nPress (A) to confirm or (B) to cancel\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),FUNCPTRCAST(M_AddonExec),MM_YESNO); + M_StartMessage("Add-ons Menu", va("%c%s\x80\nThis file may modify your settings.\nAttempt to run anyways?\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),&M_AddonExec,MM_YESNO, NULL, NULL); break; case EXT_LUA: diff --git a/src/menus/extras-egg-tv.cpp b/src/menus/extras-egg-tv.cpp index ebf5d3b5f..513ba72b6 100644 --- a/src/menus/extras-egg-tv.cpp +++ b/src/menus/extras-egg-tv.cpp @@ -59,15 +59,14 @@ void M_DeleteReplayChoice(INT32 choice) void M_DeleteReplay(INT32 c) { (void)c; - M_StartMessage( + M_StartMessage("Egg TV", "Are you sure you want to\n" "delete this replay?\n" "\n" - "\x85" "This cannot be undone.\n" "\x80" - "\n" - "Press (A) to confirm or (B) to cancel", - FUNCPTRCAST(M_DeleteReplayChoice), - MM_YESNO + "\x85" "This cannot be undone.\n", + &M_DeleteReplayChoice, + MM_YESNO, + nullptr, nullptr ); S_StartSound(nullptr, sfx_s3k36); // lel skid } diff --git a/src/menus/main-1.c b/src/menus/main-1.c index aa441b572..e00b10b85 100644 --- a/src/menus/main-1.c +++ b/src/menus/main-1.c @@ -80,7 +80,7 @@ void M_QuitSRB2(INT32 choice) // We pick index 0 which is language sensitive, or one at random, // between 1 and maximum number. (void)choice; - M_StartMessage("Are you sure you want to quit playing?\n\nPress (A) to confirm or (B) to cancel", FUNCPTRCAST(M_QuitResponse), MM_YESNO); + M_StartMessage("Quit Game", "Are you sure you want to quit playing?\n", &M_QuitResponse, MM_YESNO, "Leave the game", "No, I want to go back!"); } void M_QuitResponse(INT32 ch) diff --git a/src/menus/options-data-erase-1.c b/src/menus/options-data-erase-1.c index 88d5b474b..a4a75202c 100644 --- a/src/menus/options-data-erase-1.c +++ b/src/menus/options-data-erase-1.c @@ -79,7 +79,7 @@ static void M_EraseDataResponse(INT32 ch) void M_EraseData(INT32 choice) { - const char *eschoice, *esstr = M_GetText("Are you sure you want to erase\n%s?\n\nPress (A) to confirm or (B) to cancel\n"); + const char *eschoice, *esstr = M_GetText("Are you sure you want\nto erase %s?\n"); (void)choice; optionsmenu.erasecontext = (UINT8)currentMenu->menuitems[itemOn].mvar1; @@ -96,5 +96,5 @@ void M_EraseData(INT32 choice) eschoice = "[misconfigured erasecontext]"; - M_StartMessage(va(esstr, eschoice), FUNCPTRCAST(M_EraseDataResponse), MM_YESNO); + M_StartMessage("Data Erase", va(esstr, eschoice), &M_EraseDataResponse, MM_YESNO, NULL, NULL); } diff --git a/src/menus/options-data-erase-profile.c b/src/menus/options-data-erase-profile.c index 090f2d60e..3754a7e91 100644 --- a/src/menus/options-data-erase-profile.c +++ b/src/menus/options-data-erase-profile.c @@ -36,7 +36,7 @@ void M_CheckProfileData(INT32 choice) if (np < 2) { S_StartSound(NULL, sfx_s3k7b); - M_StartMessage("There are no custom profiles.\n\nPress (B)", NULL, MM_NOTHING); + M_StartMessage("Profile Erase", "There are no custom profiles.\n", NULL, MM_NOTHING, NULL, NULL); return; } @@ -100,9 +100,9 @@ void M_HandleProfileErase(INT32 choice) else if (M_MenuConfirmPressed(pid)) { if (optionsmenu.eraseprofilen == cv_currprofile.value) - M_StartMessage("Your ""\x85""current profile""\x80"" will be erased.\nAre you sure you want to proceed?\nDeleting this profile will also\nreturn you to the title screen.\n\nPress (A) to confirm or (B) to cancel", FUNCPTRCAST(M_EraseProfileResponse), MM_YESNO); + M_StartMessage("Profile Erase", "Your ""\x85""current profile""\x80"" will be erased.\nAre you sure you want to proceed?\nDeleting this profile will also\nreturn you to the title screen.\n", &M_EraseProfileResponse, MM_YESNO, NULL, NULL); else - M_StartMessage("This profile will be erased.\nAre you sure you want to proceed?\n\nPress (A) to confirm or (B) to cancel", FUNCPTRCAST(M_EraseProfileResponse), MM_YESNO); + M_StartMessage("Profile Erase", "This profile will be erased.\nAre you sure you want to proceed?\n", &M_EraseProfileResponse, MM_YESNO, NULL, NULL); M_SetMenuDelay(pid); } diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index c43aba4fc..020be1858 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -178,14 +178,14 @@ void M_HandleProfileSelect(INT32 ch) if (optionsmenu.profilen == 0) // Guest profile, you can't edit that one! { S_StartSound(NULL, sfx_s3k7b); - M_StartMessage(M_GetText("The Guest profile cannot be edited.\nCreate a new profile instead."), NULL, MM_NOTHING); + M_StartMessage("Profiles", M_GetText("The Guest profile cannot be edited.\nCreate a new profile instead."), NULL, MM_NOTHING, NULL, NULL); M_SetMenuDelay(pid); return; } else if (creatable && optionsmenu.profilen == maxp && gamestate != GS_MENU) { S_StartSound(NULL, sfx_s3k7b); - M_StartMessage(M_GetText("Cannot create a new profile\nmid-game. Return to the\ntitle screen first."), NULL, MM_NOTHING); + M_StartMessage("Profiles", M_GetText("Cannot create a new profile\nmid-game. Return to the\ntitle screen first."), NULL, MM_NOTHING, NULL, NULL); M_SetMenuDelay(pid); return; } @@ -207,7 +207,7 @@ void M_HandleProfileSelect(INT32 ch) #if 0 if (optionsmenu.profilen == 0) { - M_StartMessage(M_GetText("Are you sure you wish\nto use the Guest Profile?\nThis profile cannot be customised.\nIt is recommended to create\na new Profile instead.\n\nPress (A) to confirm or (B) to cancel"), FUNCPTRCAST(M_FirstPickProfile), MM_YESNO); + M_StartMessage("Profiles", M_GetText("Are you sure you wish\nto use the Guest Profile?\nThis profile cannot be customised.\nIt is recommended to create\na new Profile instead.\n"), &M_FirstPickProfile, MM_YESNO, NULL, NULL); return; } #endif diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index 22375da93..ba57a2419 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -48,7 +48,7 @@ static boolean M_ProfileEditEnd(const UINT8 pid) if (optionsmenu.profilen == 0) { S_StartSound(NULL, sfx_s3k7b); - M_StartMessage(M_GetText("Guest profile cannot be edited.\nCreate a new profile instead."), NULL, MM_NOTHING); + M_StartMessage("Profiles", M_GetText("Guest profile cannot be edited.\nCreate a new profile instead."), NULL, MM_NOTHING, NULL, NULL); M_SetMenuDelay(pid); return false; } @@ -64,7 +64,7 @@ static boolean M_ProfileEditEnd(const UINT8 pid) if (!(strcmp(optionsmenu.profile->profilename, check->profilename))) { S_StartSound(NULL, sfx_s3k7b); - M_StartMessage(M_GetText("Another profile uses the same name.\nThis must be changed to be able to save."), NULL, MM_NOTHING); + M_StartMessage("Profiles", M_GetText("Another profile uses the same name.\nThis must be changed to be able to save."), NULL, MM_NOTHING, NULL, NULL); M_SetMenuDelay(pid); return false; } @@ -155,7 +155,7 @@ void M_ConfirmProfile(INT32 choice) } else { - M_StartMessage(M_GetText("Are you sure you wish to\nselect this profile?\n\nPress (A) to confirm or (B) to cancel"), FUNCPTRCAST(M_FirstPickProfile), MM_YESNO); + M_StartMessage("Profiles", M_GetText("Are you sure you wish to\nselect this profile?\n"), &M_FirstPickProfile, MM_YESNO, NULL, NULL); M_SetMenuDelay(pid); } } diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 0140a89d4..9ef5b590f 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -207,7 +207,7 @@ void M_ProfileControlsConfirm(INT32 choice) { (void)choice; - //M_StartMessage(M_GetText("Exiting will save the control changes\nfor this Profile.\nIs this okay?\n\nPress (A) to confirm or (B) to cancel"), FUNCPTRCAST(M_ProfileControlSaveResponse), MM_YESNO); + //M_StartMessage("Profiles", M_GetText("Exiting will save the control changes\nfor this Profile.\nIs this okay?\n"), &M_ProfileControlSaveResponse, MM_YESNO, NULL, NULL); // TODO: Add a graphic for controls saving, instead of obnoxious prompt. M_ProfileControlSaveResponse(MA_YES); diff --git a/src/menus/play-local-race-time-attack.c b/src/menus/play-local-race-time-attack.c index b44d6aba6..454080573 100644 --- a/src/menus/play-local-race-time-attack.c +++ b/src/menus/play-local-race-time-attack.c @@ -404,7 +404,7 @@ static void M_WriteGuestReplay(INT32 ch) len = FIL_ReadFile(va("%s-%s-%s.lmp", gpath, cv_skin[0].string, TA_GuestReplay_Str), &buf); if (!len) { - M_StartMessage("Replay to copy no longer exists!", NULL, MM_NOTHING); + M_StartMessage("Guest Replay", "Replay to copy no longer exists!", NULL, MM_NOTHING, NULL, NULL); Z_Free(gpath); return; } @@ -430,7 +430,7 @@ static void M_WriteGuestReplay(INT32 ch) M_SetupNextMenu(&PLAY_TimeAttackDef, false); // TODO the following isn't showing up and I'm not sure why - //M_StartMessage(va("Guest replay data %s.", (len ? "saved" : "erased")), NULL, MM_NOTHING); + //M_StartMessage("Guest Replay", va("Guest replay data %s.", (len ? "saved" : "erased")), NULL, MM_NOTHING, NULL, NULL); } @@ -456,7 +456,7 @@ void M_SetGuestReplay(INT32 choice) if (FIL_FileExists(va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(levellist.choosemap+1)))) { - M_StartMessage(va("Are you sure you want to\n%s the guest replay data?\n\nPress (A) to confirm or (B) to cancel", (TA_GuestReplay_Str != NULL ? "overwrite" : "delete")), FUNCPTRCAST(M_WriteGuestReplay), MM_YESNO); + M_StartMessage("Guest Replay", va("Are you sure you want to\n%s the guest replay data?\n", (TA_GuestReplay_Str != NULL ? "overwrite" : "delete")), &M_WriteGuestReplay, MM_YESNO, NULL, NULL); } else if (TA_GuestReplay_Str != NULL) { diff --git a/src/menus/play-online-1.c b/src/menus/play-online-1.c index ed4ef704f..8a9b74234 100644 --- a/src/menus/play-online-1.c +++ b/src/menus/play-online-1.c @@ -68,7 +68,7 @@ void M_MPOptSelectInit(INT32 choice) #ifndef TESTERS if (choice != -1 && !M_SecretUnlocked(SECRET_ONLINE, true)) { - M_StartMessage("Online play is ""\x8B""not yet unlocked""\x80"".\n\nYou'll want experience in ""\x8B""Grand Prix""\x80""\nbefore even thinking about facing\nopponents from across the world.\n\nPress (B)", NULL, MM_NOTHING); + M_StartMessage("No Way? No Way!", "Online play is ""\x8B""not yet unlocked""\x80"".\n\nYou'll want experience in ""\x8B""Grand Prix""\x80""\nbefore even thinking about facing\nopponents from across the world.\n", NULL, MM_NOTHING, NULL, NULL); S_StartSound(NULL, sfx_s3k36); return; } diff --git a/src/menus/play-online-host.c b/src/menus/play-online-host.c index 9610154ef..7ab684c5c 100644 --- a/src/menus/play-online-host.c +++ b/src/menus/play-online-host.c @@ -110,6 +110,6 @@ void M_MPSetupNetgameMapSelect(INT32 choice) if (!M_LevelListFromGametype(menugametype)) { S_StartSound(NULL, sfx_s3kb2); - M_StartMessage(va("No levels available for\n%s Mode!\n\nPress (B)\n", gametypes[menugametype]->name), NULL, MM_NOTHING); + M_StartMessage("Online Play", va("No levels available for\n%s Mode!\n", gametypes[menugametype]->name), NULL, MM_NOTHING, NULL, NULL); } } diff --git a/src/menus/play-online-join-ip.c b/src/menus/play-online-join-ip.c index 6d26b85cb..ba67c7039 100644 --- a/src/menus/play-online-join-ip.c +++ b/src/menus/play-online-join-ip.c @@ -63,7 +63,7 @@ void M_JoinIP(const char *ipa) { if (*(ipa) == '\0') // Jack shit { - M_StartMessage("Please specify an address.\n", NULL, MM_NOTHING); + M_StartMessage("Online Play", "Please specify an address.\n", NULL, MM_NOTHING, NULL, NULL); return; } diff --git a/src/menus/play-online-server-browser.c b/src/menus/play-online-server-browser.c index 795febc0b..673af7cc3 100644 --- a/src/menus/play-online-server-browser.c +++ b/src/menus/play-online-server-browser.c @@ -229,7 +229,7 @@ static void M_CheckMODVersion(int id) #ifdef HAVE_THREADS I_lock_mutex(&k_menu_mutex); #endif - M_StartMessage(updatestring, NULL, MM_NOTHING); + M_StartMessage("Game Update", updatestring, NULL, MM_NOTHING, NULL, NULL); #ifdef HAVE_THREADS I_unlock_mutex(k_menu_mutex); #endif diff --git a/src/menus/transient/level-select.c b/src/menus/transient/level-select.c index d58c40151..a54096b1b 100644 --- a/src/menus/transient/level-select.c +++ b/src/menus/transient/level-select.c @@ -464,7 +464,7 @@ void M_LevelSelectInit(INT32 choice) if (!M_LevelListFromGametype(gt)) { S_StartSound(NULL, sfx_s3kb2); - M_StartMessage(va("No levels available for\n%s Mode!\n\nPress (B)\n", gametypes[gt]->name), NULL, MM_NOTHING); + M_StartMessage("Offline Play", va("No levels available for\n%s Mode!\n", gametypes[gt]->name), NULL, MM_NOTHING, NULL, NULL); } } diff --git a/src/menus/transient/message-box.c b/src/menus/transient/message-box.c index 605949b68..dd659daee 100644 --- a/src/menus/transient/message-box.c +++ b/src/menus/transient/message-box.c @@ -24,7 +24,7 @@ static inline size_t M_StringHeight(const char *string) } // default message handler -void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype) +void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr) { const UINT8 pid = 0; size_t max = 0, maxatstart = 0, start = 0, strlines, i; @@ -65,9 +65,12 @@ void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtyp } strncpy(menumessage.message, string, MAXMENUMESSAGE); + menumessage.header = header; menumessage.flags = itemtype; - *(void**)&menumessage.routine = routine; + menumessage.routine = routine; menumessage.fadetimer = (gamestate == GS_WAITINGPLAYERS) ? 9 : 1; + menumessage.timer = 0; + menumessage.closing = false; menumessage.active = true; start = 0; @@ -79,18 +82,29 @@ void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtyp menumessage.routine = M_StopMessage; } + if (menumessage.flags == MM_YESNO && !defaultstr) + { + menumessage.defaultstr = "No"; + menumessage.confirmstr = "Yes"; + } + else + { + menumessage.defaultstr = defaultstr ? defaultstr : "OK"; + menumessage.confirmstr = confirmstr; + } + // event routine - if (menumessage.flags == MM_EVENTHANDLER) + /*if (menumessage.flags == MM_EVENTHANDLER) { *(void**)&menumessage.eroutine = routine; menumessage.routine = NULL; - } + }*/ //added : 06-02-98: now draw a textbox around the message // compute lenght max and the numbers of lines for (strlines = 0; *(message+start); strlines++) { - for (i = 0;i < strlen(message+start);i++) + for (i = 0; i < strlen(message+start);i++) { if (*(message+start+i) == '\n') { @@ -111,10 +125,8 @@ void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtyp } } - menumessage.x = (INT16)((BASEVIDWIDTH - 8*max-16)/2); - menumessage.y = (INT16)((BASEVIDHEIGHT - M_StringHeight(message))/2); - - menumessage.m = (INT16)((strlines<<8)+max); + menumessage.x = (8 * MAXSTRINGLENGTH) - 1; + menumessage.y = M_StringHeight(message); M_SetMenuDelay(pid); // Set menu delay to avoid setting off any of the handlers. } @@ -124,7 +136,8 @@ void M_StopMessage(INT32 choice) const char pid = 0; (void) choice; - menumessage.active = false; + menumessage.closing = true; + menumessage.timer = 0; M_SetMenuDelay(pid); } @@ -135,15 +148,31 @@ void M_HandleMenuMessage(void) boolean btok = M_MenuConfirmPressed(pid); boolean btnok = M_MenuBackPressed(pid); - if (menumessage.fadetimer < 9) + if (menumessage.closing) + { + if (menumessage.fadetimer > 0) + { + menumessage.fadetimer--; + } + + if (menumessage.fadetimer == 0) + { + menumessage.active = false; + } + + return; + } + else if (menumessage.fadetimer < 9) { menumessage.fadetimer++; return; } + menumessage.timer++; + switch (menumessage.flags) { - // Send 1 to the routine if we're pressing A/B/X/Y + // Send 1 to the routine if we're pressing A/B/X case MM_NOTHING: { // send 1 if any button is pressed, 0 otherwise. @@ -152,7 +181,7 @@ void M_HandleMenuMessage(void) break; } - // Send 1 to the routine if we're pressing A/X, 2 if B/Y, 0 otherwise. + // Send 1 to the routine if we're pressing A, 2 if B/X, 0 otherwise. case MM_YESNO: { INT32 answer = MA_NONE; diff --git a/src/menus/transient/pause-game.c b/src/menus/transient/pause-game.c index 556aa2fd7..3f638aebd 100644 --- a/src/menus/transient/pause-game.c +++ b/src/menus/transient/pause-game.c @@ -349,7 +349,7 @@ void M_ConfirmEnterGame(INT32 choice) (void)choice; if (!cv_allowteamchange.value) { - M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\n\nPress (B)\n"), NULL, MM_NOTHING); + M_StartMessage("Team Change", M_GetText("The server is not allowing\nteam changes at this time.\n"), NULL, MM_NOTHING, NULL, NULL); return; } M_QuitPauseMenu(-1); @@ -381,5 +381,5 @@ void M_EndGame(INT32 choice) if (!Playing()) return; - M_StartMessage(M_GetText("Are you sure you want to\nreturn to the menu?\nPress (A) to confirm or (B) to cancel\n"), FUNCPTRCAST(M_ExitGameResponse), MM_YESNO); + M_StartMessage("Return to Menu", M_GetText("Are you sure you want to\nreturn to the menu?\n"), &M_ExitGameResponse, MM_YESNO, NULL, NULL); } diff --git a/src/mserv.c b/src/mserv.c index 2876ac2f7..dd02d6c48 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -117,7 +117,7 @@ static void WarnGUI (void) #ifdef HAVE_THREADS I_lock_mutex(&k_menu_mutex); #endif - M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING); + M_StartMessage("Online Play", M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING, NULL, NULL); #ifdef HAVE_THREADS I_unlock_mutex(k_menu_mutex); #endif