Merge branch 'mprelated-tweaks' into 'master'
Various improvements and changes to multiplayer menu See merge request STJr/SRB2Internal!300
This commit is contained in:
commit
c696063260
|
@ -152,7 +152,7 @@ ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
||||||
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
|
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
|
||||||
|
|
||||||
|
|
||||||
static consvar_t cv_showjoinaddress = {"showjoinaddress", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -2948,13 +2948,13 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
CL_RemovePlayer(pnum, kickreason);
|
CL_RemovePlayer(pnum, kickreason);
|
||||||
}
|
}
|
||||||
|
|
||||||
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||||
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
||||||
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_resynchattempts = {"resynchattempts", "10", 0, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
consvar_t cv_resynchattempts = {"resynchattempts", "10", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||||
consvar_t cv_blamecfail = {"blamecfail", "Off", 0, CV_OnOff, 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)
|
// max file size to send to a player (in kilobytes)
|
||||||
static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}};
|
||||||
|
@ -2995,11 +2995,6 @@ void D_ClientServerInit(void)
|
||||||
RegisterNetXCmd(XD_KICK, Got_KickCmd);
|
RegisterNetXCmd(XD_KICK, Got_KickCmd);
|
||||||
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
|
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
CV_RegisterVar(&cv_allownewplayer);
|
|
||||||
CV_RegisterVar(&cv_joinnextround);
|
|
||||||
CV_RegisterVar(&cv_showjoinaddress);
|
|
||||||
CV_RegisterVar(&cv_resynchattempts);
|
|
||||||
CV_RegisterVar(&cv_blamecfail);
|
|
||||||
#ifdef DUMPCONSISTENCY
|
#ifdef DUMPCONSISTENCY
|
||||||
CV_RegisterVar(&cv_dumpconsistency);
|
CV_RegisterVar(&cv_dumpconsistency);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -445,6 +445,7 @@ extern INT32 mapchangepending;
|
||||||
// Points inside doomcom
|
// Points inside doomcom
|
||||||
extern doomdata_t *netbuffer;
|
extern doomdata_t *netbuffer;
|
||||||
|
|
||||||
|
extern consvar_t cv_showjoinaddress;
|
||||||
extern consvar_t cv_playbackspeed;
|
extern consvar_t cv_playbackspeed;
|
||||||
|
|
||||||
#define BASEPACKETSIZE offsetof(doomdata_t, u)
|
#define BASEPACKETSIZE offsetof(doomdata_t, u)
|
||||||
|
|
|
@ -556,9 +556,16 @@ void D_RegisterServerCommands(void)
|
||||||
|
|
||||||
// d_clisrv
|
// d_clisrv
|
||||||
CV_RegisterVar(&cv_maxplayers);
|
CV_RegisterVar(&cv_maxplayers);
|
||||||
|
CV_RegisterVar(&cv_resynchattempts);
|
||||||
CV_RegisterVar(&cv_maxsend);
|
CV_RegisterVar(&cv_maxsend);
|
||||||
CV_RegisterVar(&cv_noticedownload);
|
CV_RegisterVar(&cv_noticedownload);
|
||||||
CV_RegisterVar(&cv_downloadspeed);
|
CV_RegisterVar(&cv_downloadspeed);
|
||||||
|
#ifndef NONET
|
||||||
|
CV_RegisterVar(&cv_allownewplayer);
|
||||||
|
CV_RegisterVar(&cv_joinnextround);
|
||||||
|
CV_RegisterVar(&cv_showjoinaddress);
|
||||||
|
CV_RegisterVar(&cv_blamecfail);
|
||||||
|
#endif
|
||||||
|
|
||||||
COM_AddCommand("ping", Command_Ping_f);
|
COM_AddCommand("ping", Command_Ping_f);
|
||||||
CV_RegisterVar(&cv_nettimeout);
|
CV_RegisterVar(&cv_nettimeout);
|
||||||
|
|
82
src/m_menu.c
82
src/m_menu.c
|
@ -265,6 +265,7 @@ static void M_ServerOptions(INT32 choice);
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
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_Refresh(INT32 choice);
|
static void M_Refresh(INT32 choice);
|
||||||
static void M_Connect(INT32 choice);
|
static void M_Connect(INT32 choice);
|
||||||
static void M_ChooseRoom(INT32 choice);
|
static void M_ChooseRoom(INT32 choice);
|
||||||
|
@ -884,12 +885,12 @@ static menuitem_t MP_SplitServerMenu[] =
|
||||||
|
|
||||||
static menuitem_t MP_MainMenu[] =
|
static menuitem_t MP_MainMenu[] =
|
||||||
{
|
{
|
||||||
{IT_HEADER, NULL, "Host a game", NULL, 0},
|
{IT_HEADER, NULL, "Join a game", NULL, 0},
|
||||||
{IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 12},
|
{IT_STRING|IT_CALL, NULL, "Server browser...", M_ConnectMenuModChecks, 12},
|
||||||
{IT_STRING|IT_CALL, NULL, "Splitscreen...", M_StartSplitServerMenu, 22},
|
{IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 22},
|
||||||
{IT_HEADER, NULL, "Join a game", NULL, 40},
|
{IT_HEADER, NULL, "Host a game", NULL, 54},
|
||||||
{IT_STRING|IT_CALL, NULL, "Server browser...", M_ConnectMenu, 52},
|
{IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 66},
|
||||||
{IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 62},
|
{IT_STRING|IT_CALL, NULL, "Splitscreen...", M_StartSplitServerMenu, 76},
|
||||||
{IT_HEADER, NULL, "Player setup", NULL, 94},
|
{IT_HEADER, NULL, "Player setup", NULL, 94},
|
||||||
{IT_STRING|IT_CALL, NULL, "Player 1...", M_SetupMultiPlayer, 106},
|
{IT_STRING|IT_CALL, NULL, "Player 1...", M_SetupMultiPlayer, 106},
|
||||||
{IT_STRING|IT_CALL, NULL, "Player 2... ", M_SetupMultiPlayer2, 116},
|
{IT_STRING|IT_CALL, NULL, "Player 2... ", M_SetupMultiPlayer2, 116},
|
||||||
|
@ -948,7 +949,7 @@ enum
|
||||||
|
|
||||||
static menuitem_t MP_RoomMenu[] =
|
static menuitem_t MP_RoomMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING | IT_CALL, NULL, "<Offline Mode>", M_ChooseRoom, 9},
|
{IT_STRING | IT_CALL, NULL, "<Unlisted Mode>", M_ChooseRoom, 9},
|
||||||
{IT_DISABLED, NULL, "", M_ChooseRoom, 18},
|
{IT_DISABLED, NULL, "", M_ChooseRoom, 18},
|
||||||
{IT_DISABLED, NULL, "", M_ChooseRoom, 27},
|
{IT_DISABLED, NULL, "", M_ChooseRoom, 27},
|
||||||
{IT_DISABLED, NULL, "", M_ChooseRoom, 36},
|
{IT_DISABLED, NULL, "", M_ChooseRoom, 36},
|
||||||
|
@ -5603,7 +5604,7 @@ static boolean M_AddonsRefresh(void)
|
||||||
{
|
{
|
||||||
S_StartSound(NULL, sfx_lose);
|
S_StartSound(NULL, sfx_lose);
|
||||||
if (refreshdirmenu & REFRESHDIR_MAX)
|
if (refreshdirmenu & REFRESHDIR_MAX)
|
||||||
message = va("%c%s\x80\nMaximum number of add-ons reached.\nA file could not be loaded.\nIf you want to play with this add-on, restart the game to clear existing ones.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
message = va("%c%s\x80\nMaximum number of add-ons reached.\nA file could not be loaded.\nIf you wish to play with this add-on, restart the game to clear existing ones.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||||
else
|
else
|
||||||
message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
|
||||||
}
|
}
|
||||||
|
@ -8872,7 +8873,7 @@ static void M_DrawConnectMenu(void)
|
||||||
// Room name
|
// Room name
|
||||||
if (ms_RoomId < 0)
|
if (ms_RoomId < 0)
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_room].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_room].alphaKey,
|
||||||
V_YELLOWMAP, (itemOn == mp_connect_room) ? "<Select to change>" : "<Offline Mode>");
|
V_YELLOWMAP, (itemOn == mp_connect_room) ? "<Select to change>" : "<Unlisted Mode>");
|
||||||
else
|
else
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_room].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_room].alphaKey,
|
||||||
V_YELLOWMAP, room_list[menuRoomIndex].name);
|
V_YELLOWMAP, room_list[menuRoomIndex].name);
|
||||||
|
@ -9022,11 +9023,32 @@ static void M_ConnectMenu(INT32 choice)
|
||||||
|
|
||||||
// first page of servers
|
// first page of servers
|
||||||
serverlistpage = 0;
|
serverlistpage = 0;
|
||||||
M_SetupNextMenu(&MP_ConnectDef);
|
if (ms_RoomId < 0)
|
||||||
|
{
|
||||||
|
M_RoomMenu(0); // Select a room instead of staring at an empty list
|
||||||
|
// This prevents us from returning to the modified game alert.
|
||||||
|
currentMenu->prevMenu = &MP_MainDef;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
M_SetupNextMenu(&MP_ConnectDef);
|
||||||
itemOn = 0;
|
itemOn = 0;
|
||||||
M_Refresh(0);
|
M_Refresh(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void M_ConnectMenuModChecks(INT32 choice)
|
||||||
|
{
|
||||||
|
(void)choice;
|
||||||
|
// okay never mind we want to COMMUNICATE to the player pre-emptively instead of letting them try and then get confused when it doesn't work
|
||||||
|
|
||||||
|
if (modifiedgame)
|
||||||
|
{
|
||||||
|
M_StartMessage(M_GetText("Add-ons are currently loaded.\n\nYou will only be able to join a server if\nit has the same ones loaded in the same order, which may be unlikely.\n\nIf you wish to play on other servers,\nrestart the game to clear existing add-ons.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
M_ConnectMenu(-1);
|
||||||
|
}
|
||||||
|
|
||||||
static UINT32 roomIds[NUM_LIST_ROOMS];
|
static UINT32 roomIds[NUM_LIST_ROOMS];
|
||||||
|
|
||||||
static void M_RoomMenu(INT32 choice)
|
static void M_RoomMenu(INT32 choice)
|
||||||
|
@ -9081,7 +9103,16 @@ static void M_ChooseRoom(INT32 choice)
|
||||||
}
|
}
|
||||||
|
|
||||||
serverlistpage = 0;
|
serverlistpage = 0;
|
||||||
M_SetupNextMenu(currentMenu->prevMenu);
|
/*
|
||||||
|
We were on the Multiplayer menu? That means that we must have been trying to
|
||||||
|
view the server browser, but we hadn't selected a room yet. So we need to go
|
||||||
|
to the browser next, not back there.
|
||||||
|
*/
|
||||||
|
if (currentMenu->prevMenu == &MP_MainDef)
|
||||||
|
M_SetupNextMenu(&MP_ConnectDef);
|
||||||
|
else
|
||||||
|
M_SetupNextMenu(currentMenu->prevMenu);
|
||||||
|
|
||||||
if (currentMenu == &MP_ConnectDef)
|
if (currentMenu == &MP_ConnectDef)
|
||||||
M_Refresh(0);
|
M_Refresh(0);
|
||||||
}
|
}
|
||||||
|
@ -9140,7 +9171,7 @@ static void M_DrawServerMenu(void)
|
||||||
M_DrawLevelPlatterHeader(currentMenu->y - lsheadingheight/2, "Server settings", true, false);
|
M_DrawLevelPlatterHeader(currentMenu->y - lsheadingheight/2, "Server settings", true, false);
|
||||||
if (ms_RoomId < 0)
|
if (ms_RoomId < 0)
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey,
|
||||||
V_YELLOWMAP, (itemOn == mp_server_room) ? "<Select to change>" : "<Offline Mode>");
|
V_YELLOWMAP, (itemOn == mp_server_room) ? "<Select to change>" : "<Unlisted Mode>");
|
||||||
else
|
else
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey,
|
||||||
V_YELLOWMAP, room_list[menuRoomIndex].name);
|
V_YELLOWMAP, room_list[menuRoomIndex].name);
|
||||||
|
@ -9247,7 +9278,7 @@ static void M_StartServerMenu(INT32 choice)
|
||||||
// CONNECT VIA IP
|
// CONNECT VIA IP
|
||||||
// ==============
|
// ==============
|
||||||
|
|
||||||
static char setupm_ip[16];
|
static char setupm_ip[28];
|
||||||
|
|
||||||
// Draw the funky Connect IP menu. Tails 11-19-2002
|
// Draw the funky Connect IP menu. Tails 11-19-2002
|
||||||
// So much work for such a little thing!
|
// So much work for such a little thing!
|
||||||
|
@ -9259,30 +9290,26 @@ static void M_DrawMPMainMenu(void)
|
||||||
// use generic drawer for cursor, items and title
|
// use generic drawer for cursor, items and title
|
||||||
M_DrawGenericMenu();
|
M_DrawGenericMenu();
|
||||||
|
|
||||||
#if MAXPLAYERS == 32
|
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+66,
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+12,
|
((itemOn == 4) ? V_YELLOWMAP : 0), va("(2-%d players)", MAXPLAYERS));
|
||||||
((itemOn == 1) ? V_YELLOWMAP : 0), "(2-32 players)");
|
|
||||||
#else
|
|
||||||
Update the maxplayers label...
|
|
||||||
#endif
|
|
||||||
|
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+22,
|
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+76,
|
||||||
((itemOn == 2) ? V_YELLOWMAP : 0), "(2 players)");
|
((itemOn == 5) ? V_YELLOWMAP : 0), "(2 players)");
|
||||||
|
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+116,
|
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+116,
|
||||||
((itemOn == 8) ? V_YELLOWMAP : 0), "(splitscreen)");
|
((itemOn == 8) ? V_YELLOWMAP : 0), "(splitscreen)");
|
||||||
|
|
||||||
y += 62;
|
y += 22;
|
||||||
|
|
||||||
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 159);
|
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 159);
|
||||||
|
|
||||||
// draw name string
|
// draw name string
|
||||||
V_DrawString(x+8,y+12, V_MONOSPACE, setupm_ip);
|
V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, setupm_ip);
|
||||||
|
|
||||||
// draw text cursor for name
|
// draw text cursor for name
|
||||||
if (itemOn == 5 //0
|
if (itemOn == 2 //0
|
||||||
&& skullAnimCounter < 4) //blink cursor
|
&& skullAnimCounter < 4) //blink cursor
|
||||||
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_MONOSPACE),y+12,'_',false);
|
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tails 11-19-2002
|
// Tails 11-19-2002
|
||||||
|
@ -9353,10 +9380,11 @@ static void M_HandleConnectIP(INT32 choice)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
l = strlen(setupm_ip);
|
l = strlen(setupm_ip);
|
||||||
if (l >= 16-1)
|
if (l >= 28-1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (choice == 46 || (choice >= 48 && choice <= 57)) // Rudimentary number and period enforcing
|
// Rudimentary number and period enforcing - also allows letters so hostnames can be used instead
|
||||||
|
if ((choice >= '-' && choice <= ':') || (choice >= 'A' && choice <= 'Z') || (choice >= 'a' && choice <= 'z'))
|
||||||
{
|
{
|
||||||
S_StartSound(NULL,sfx_menu1); // Tails
|
S_StartSound(NULL,sfx_menu1); // Tails
|
||||||
setupm_ip[l] = (char)choice;
|
setupm_ip[l] = (char)choice;
|
||||||
|
|
Loading…
Reference in New Issue