mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-10 18:12:46 +00:00
If Playing(), does nothing.
- If NULL, cycle between Cascade Cave as is traditional.
- If ".", stop music. (will one day be used for sound test)
- Any other case, call S_ChangeMusicInternal on the string directly
Notable menu sets:
- All Extra menus, excepting the Replay Hut, use "EXTRAS"
- Replay Hut uses "REPLAY"
- All online menus use "NETMD2".
- I know we wanted to do something with switching between "NETMDE" and "NETMD2". I would prefer a more consistent API for transferring song position across between tracks be implemented before implementing this.
- Known bug: Music restarts when exiting from failed connection screen
- Known bug: Music goes back to Cascade Cave when selecting "GO" for server creation
- Wontfix as we want that button to go directly to the voting screen, which we can do in a voting revamp branch
- Data Erase, Profile Erase: "SHWDN2"
- Not in the spec but I think it's both funny and a valuable tell for the most "dangerous" menu to play with.
- Also shifts the background to SKINCOLOR_BLACK
111 lines
2.7 KiB
C
111 lines
2.7 KiB
C
/// \file menus/play-online-join-ip.c
|
|
/// \brief MULTIPLAYER JOIN BY IP
|
|
|
|
#include "../k_menu.h"
|
|
#include "../v_video.h"
|
|
#include "../i_system.h" // I_OsPolling
|
|
#include "../i_video.h" // I_UpdateNoBlit
|
|
#include "../m_misc.h" // NUMLOGIP
|
|
|
|
menuitem_t PLAY_MP_JoinIP[] =
|
|
{
|
|
//{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, M_MPOptSelect, 0, 0},
|
|
|
|
{IT_STRING | IT_CVAR | IT_CV_STRING, "IP: ", "Type the IPv4 address of the server.",
|
|
NULL, {.cvar = &cv_dummyip}, 0, 0},
|
|
|
|
{IT_STRING, "CONNECT ", "Attempt to connect to the server you entered the IP for.",
|
|
NULL, {NULL}, 0, 0},
|
|
|
|
{IT_STRING | IT_SPACE, "LAST IPs JOINED:", "Kanade best waifu :)",
|
|
NULL, {NULL}, 0, 0},
|
|
|
|
{IT_STRING, "servip1", "The last 3 IPs you've succesfully joined are displayed here.",
|
|
NULL, {NULL}, 0, 0},
|
|
|
|
{IT_STRING, "servip2", "The last 3 IPs you've succesfully joined are displayed here.",
|
|
NULL, {NULL}, 0, 0},
|
|
|
|
{IT_STRING, "servip3", "The last 3 IPs you've succesfully joined are displayed here.",
|
|
NULL, {NULL}, 0, 0},
|
|
|
|
};
|
|
|
|
menu_t PLAY_MP_JoinIPDef = {
|
|
sizeof (PLAY_MP_JoinIP) / sizeof (menuitem_t),
|
|
&PLAY_MP_OptSelectDef,
|
|
0,
|
|
PLAY_MP_JoinIP,
|
|
0, 0,
|
|
0, 0,
|
|
"NETMD2",
|
|
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
|
|
M_DrawMPJoinIP,
|
|
M_MPOptSelectTick, // This handles the unfolding options
|
|
NULL,
|
|
M_MPResetOpts,
|
|
M_JoinIPInputs
|
|
};
|
|
|
|
consvar_t cv_dummyip = CVAR_INIT ("dummyip", "", CV_HIDDEN, NULL, NULL);
|
|
|
|
void M_MPJoinIPInit(INT32 choice)
|
|
{
|
|
|
|
(void)choice;
|
|
mpmenu.modewinextend[2][0] = 1;
|
|
M_SetupNextMenu(&PLAY_MP_JoinIPDef, true);
|
|
}
|
|
|
|
// Attempts to join a given IP from the menu.
|
|
void M_JoinIP(const char *ipa)
|
|
{
|
|
if (*(ipa) == '\0') // Jack shit
|
|
{
|
|
M_StartMessage("Please specify an address.\n", NULL, MM_NOTHING);
|
|
return;
|
|
}
|
|
|
|
COM_BufAddText(va("connect \"%s\"\n", ipa));
|
|
|
|
// A little "please wait" message.
|
|
M_DrawTextBox(56, BASEVIDHEIGHT/2-12, 24, 2);
|
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, 0, "Connecting to server...");
|
|
I_OsPolling();
|
|
I_UpdateNoBlit();
|
|
if (rendermode == render_soft)
|
|
I_FinishUpdate(); // page flip or blit buffer
|
|
}
|
|
|
|
boolean M_JoinIPInputs(INT32 ch)
|
|
{
|
|
|
|
const UINT8 pid = 0;
|
|
(void) ch;
|
|
|
|
if (itemOn == 1) // connect field
|
|
{
|
|
// enter: connect
|
|
if (M_MenuConfirmPressed(pid))
|
|
{
|
|
M_JoinIP(cv_dummyip.string);
|
|
M_SetMenuDelay(pid);
|
|
return true;
|
|
}
|
|
}
|
|
else if (currentMenu->numitems - itemOn <= NUMLOGIP && M_MenuConfirmPressed(pid)) // On one of the last 3 options for IP rejoining
|
|
{
|
|
UINT8 index = NUMLOGIP - (currentMenu->numitems - itemOn);
|
|
M_SetMenuDelay(pid);
|
|
|
|
// Is there an address at this part of the table?
|
|
if (*joinedIPlist[index][0])
|
|
M_JoinIP(joinedIPlist[index][0]);
|
|
else
|
|
S_StartSound(NULL, sfx_lose);
|
|
|
|
return true; // eat input.
|
|
}
|
|
|
|
return false;
|
|
}
|