mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
Add warning and reset flow for non-default masterserver address
This commit is contained in:
parent
750b8bfe20
commit
93647873de
1 changed files with 60 additions and 2 deletions
62
src/m_menu.c
62
src/m_menu.c
|
@ -260,6 +260,10 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef;
|
||||||
|
|
||||||
// Multiplayer
|
// Multiplayer
|
||||||
#ifndef NONET
|
#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_StartServerMenu(INT32 choice);
|
||||||
static void M_ConnectMenu(INT32 choice);
|
static void M_ConnectMenu(INT32 choice);
|
||||||
static void M_ConnectMenuModChecks(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},
|
{IT_HEADER, NULL, "Host a game", NULL, 100-24},
|
||||||
#ifndef NONET
|
#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
|
#else
|
||||||
{IT_GRAYEDOUT, NULL, "Internet/LAN...", NULL, 110-24},
|
{IT_GRAYEDOUT, NULL, "Internet/LAN...", NULL, 110-24},
|
||||||
#endif
|
#endif
|
||||||
|
@ -1002,7 +1006,7 @@ static menuitem_t MP_MainMenu[] =
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Join a game", NULL, 132-24},
|
{IT_HEADER, NULL, "Join a game", NULL, 132-24},
|
||||||
#ifndef NONET
|
#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},
|
{IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 150-24},
|
||||||
#else
|
#else
|
||||||
{IT_GRAYEDOUT, NULL, "Internet server browser...",NULL, 142-24},
|
{IT_GRAYEDOUT, NULL, "Internet server browser...",NULL, 142-24},
|
||||||
|
@ -8797,6 +8801,60 @@ static void M_ConnectMenuModChecks(INT32 choice)
|
||||||
|
|
||||||
M_ConnectMenu(-1);
|
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
|
#endif //NONET
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue