mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-08 06:36:10 +00:00
Server Browser change alert (KartKrew/Kart-Public!277)
- Let players know if their cv_masterserver was changed, and give them the opportunity to change it back
- A limited number of nag attempts, so if people are using a legitimate custom Server Browser they won't be annoyed for the rest of the game's lifespan
- Show the Server Browser at the bottom of all online menus
- KNOWN BUG: currently overlaps with the Join IP
- we're redoing this menu before launch because it's buggy so this is just another bug on that pile
This commit is contained in:
parent
339d368d7d
commit
c14ff69d9a
4 changed files with 85 additions and 16 deletions
|
|
@ -502,6 +502,7 @@ consvar_t cv_kicktime = Server("kicktime", "20").values(CV_Unsigned);
|
|||
|
||||
void MasterServer_OnChange(void);
|
||||
consvar_t cv_masterserver = Server("masterserver", "https://ms.kartkrew.org/ms/api").onchange(MasterServer_OnChange);
|
||||
consvar_t cv_masterserver_nagattempts = Server("masterserver_nagattempts", "5").values(CV_Unsigned);
|
||||
|
||||
void MasterServer_Debug_OnChange (void);
|
||||
consvar_t cv_masterserver_debug = Server("masterserver_debug", "Off").on_off().onchange(MasterServer_Debug_OnChange);
|
||||
|
|
|
|||
|
|
@ -3086,6 +3086,23 @@ void M_DrawTimeAttack(void)
|
|||
|
||||
// NOTE: This is pretty rigid and only intended for use with the multiplayer options menu which has *3* choices.
|
||||
|
||||
static void M_DrawMasterServerReminder(void)
|
||||
{
|
||||
// Did you change the Server Browser address? Have a little reminder.
|
||||
|
||||
INT32 mservflags = 0;
|
||||
if (CV_IsSetToDefault(&cv_masterserver))
|
||||
mservflags = highlightflags;
|
||||
else
|
||||
mservflags = warningflags;
|
||||
|
||||
INT32 y = BASEVIDHEIGHT - 24;
|
||||
|
||||
V_DrawFadeFill(0, y-1, BASEVIDWIDTH, 10+1, 0, 31, 5);
|
||||
V_DrawCenteredThinString(BASEVIDWIDTH/2, y,
|
||||
mservflags, va("List via \"%s\"", cv_masterserver.string));
|
||||
}
|
||||
|
||||
static void M_MPOptDrawer(menu_t *m, INT16 extend[3][3])
|
||||
{
|
||||
// This is a copypaste of the generic gamemode menu code with a few changes.
|
||||
|
|
@ -3149,6 +3166,7 @@ void M_DrawMPOptSelect(void)
|
|||
M_DrawEggaChannel();
|
||||
M_DrawMenuTooltips();
|
||||
M_MPOptDrawer(&PLAY_MP_OptSelectDef, mpmenu.modewinextend);
|
||||
M_DrawMasterServerReminder();
|
||||
}
|
||||
|
||||
// Multiplayer mode option select: HOST GAME!
|
||||
|
|
@ -3468,20 +3486,6 @@ static void M_DrawServerCountAndHorizontalBar(void)
|
|||
va("%c", throbber[throbindex])
|
||||
);
|
||||
}
|
||||
|
||||
// Did you change the Server Browser address? Have a little reminder.
|
||||
|
||||
INT32 mservflags = 0;
|
||||
if (CV_IsSetToDefault(&cv_masterserver))
|
||||
mservflags = highlightflags;
|
||||
else
|
||||
mservflags = warningflags;
|
||||
|
||||
y = BASEVIDHEIGHT - 24;
|
||||
|
||||
V_DrawFadeFill(0, y-1, BASEVIDWIDTH, 10+1, 0, 31, 5);
|
||||
V_DrawCenteredThinString(BASEVIDWIDTH/2, y,
|
||||
mservflags, va("List from \"%s\"", cv_masterserver.string));
|
||||
}
|
||||
|
||||
void M_DrawMPServerBrowser(void)
|
||||
|
|
@ -3586,6 +3590,7 @@ void M_DrawMPServerBrowser(void)
|
|||
|
||||
// And finally, the overlay bar!
|
||||
M_DrawServerCountAndHorizontalBar();
|
||||
M_DrawMasterServerReminder();
|
||||
}
|
||||
|
||||
// OPTIONS MENU
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../k_menu.h"
|
||||
#include "../m_cond.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../mserv.h" // cv_masterserver
|
||||
|
||||
#if defined (TESTERS)
|
||||
#define IT_STRING_CALL_NOTESTERS IT_DISABLED
|
||||
|
|
@ -11,13 +12,74 @@
|
|||
#define IT_STRING_CALL_NOTESTERS (IT_STRING | IT_CALL)
|
||||
#endif // TESTERS
|
||||
|
||||
static boolean firstDismissedNagThisBoot = true;
|
||||
|
||||
static void M_HandleMasterServerResetChoice(INT32 ch)
|
||||
{
|
||||
if (ch == MA_YES)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M_PreMPHostInitChoice(INT32 ch)
|
||||
{
|
||||
M_HandleMasterServerResetChoice(ch);
|
||||
M_MPHostInit(0);
|
||||
}
|
||||
|
||||
static void M_PreMPHostInit(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0)
|
||||
{
|
||||
M_StartMessage("Server Browser Alert", M_GetText("Hey! You've changed the game's\naddress for the Server Browser.\n\nYou won't be able to host games on\nthe official Server Browser.\n\nUnless you're from the future, this\nprobably isn't what you want.\n"), &M_PreMPHostInitChoice, MM_YESNO, "Fix and continue", "I changed the URL intentionally");
|
||||
return;
|
||||
}
|
||||
|
||||
M_MPHostInit(0);
|
||||
}
|
||||
|
||||
static void M_PreMPRoomSelectInitChoice(INT32 ch)
|
||||
{
|
||||
M_HandleMasterServerResetChoice(ch);
|
||||
M_MPRoomSelectInit(0);
|
||||
}
|
||||
|
||||
static void M_PreMPRoomSelectInit(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0)
|
||||
{
|
||||
M_StartMessage("Server Browser Alert", M_GetText("Hey! You've changed the game's\naddress for the Server Browser.\n\nYou won't be able to see games from\nthe official Server Browser.\n\nUnless you're from the future, this\nprobably isn't what you want.\n"), &M_PreMPRoomSelectInitChoice, MM_YESNO, "Fix and continue", "I changed the URL intentionally");
|
||||
return;
|
||||
}
|
||||
|
||||
M_MPRoomSelectInit(0);
|
||||
}
|
||||
|
||||
menuitem_t PLAY_MP_OptSelect[] =
|
||||
{
|
||||
{IT_STRING_CALL_NOTESTERS, "Host Game", "Start your own online game!",
|
||||
NULL, {.routine = M_MPHostInit}, 0, 0},
|
||||
NULL, {.routine = M_PreMPHostInit}, 0, 0},
|
||||
|
||||
{IT_STRING_CALL_NOTESTERS, "Server Browser", "Search for game servers to play in.",
|
||||
NULL, {.routine = M_MPRoomSelectInit}, 0, 0},
|
||||
NULL, {.routine = M_PreMPRoomSelectInit}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "Join by IP", "Join an online game by its IP address.",
|
||||
NULL, {.routine = M_MPJoinIPInit}, 0, 0},
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ struct msg_ban_t
|
|||
// ================================ GLOBALS ===============================
|
||||
|
||||
extern consvar_t cv_masterserver, cv_servername;
|
||||
extern consvar_t cv_masterserver_nagattempts;
|
||||
extern consvar_t cv_server_contact;
|
||||
extern consvar_t cv_masterserver_update_rate;
|
||||
extern consvar_t cv_masterserver_timeout;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue