Added some useful options to the Server setup menu, including a jump-link to the relevant Options screen. Think it should be a little smarter designed, though, but I'd rather commit what I have then let it languish.

This commit is contained in:
toasterbabe 2017-02-01 17:21:04 +00:00
parent 873e768a44
commit 4efeb02978

View file

@ -281,6 +281,7 @@ static void M_ConnectIPMenu(INT32 choice);
#endif #endif
static void M_StartSplitServerMenu(INT32 choice); static void M_StartSplitServerMenu(INT32 choice);
static void M_StartServer(INT32 choice); static void M_StartServer(INT32 choice);
static void M_ServerOptions(INT32 choice);
#ifndef NONET #ifndef NONET
static void M_Refresh(INT32 choice); static void M_Refresh(INT32 choice);
static void M_Connect(INT32 choice); static void M_Connect(INT32 choice);
@ -926,29 +927,36 @@ static menuitem_t MP_ServerMenu[] =
{ {
{IT_DISABLED|IT_NOTHING, NULL, "", NULL, 0}, {IT_DISABLED|IT_NOTHING, NULL, "", NULL, 0},
#ifndef NONET #ifndef NONET
{IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10}, {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10},
{IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20}, {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20},
{IT_STRING|IT_CVAR, NULL, "Max Players", &cv_maxplayers, 46},
{IT_STRING|IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 56},
#endif #endif
{IT_STRING|IT_CALL, NULL, "Select Gametype/Level", M_GameTypeChange, 90}, {IT_STRING|IT_CALL, NULL, "Select Gametype/Level", M_GameTypeChange, 100},
{IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
{IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
}; };
enum enum
{ {
mp_server_dummy = 0, // exists solely so numbering is consistent between NONET and not NONET mp_server_dummy = 0, // exists solely so zero-indexed in both NONET and not NONET
#ifndef NONET #ifndef NONET
mp_server_room, mp_server_room,
mp_server_name, mp_server_name,
mp_server_maxpl,
mp_server_waddl,
#endif #endif
mp_server_levelgt, mp_server_levelgt,
mp_server_options,
mp_server_start mp_server_start
}; };
// Separated splitscreen and normal servers. // Separated splitscreen and normal servers.
static menuitem_t MP_SplitServerMenu[] = static menuitem_t MP_SplitServerMenu[] =
{ {
{IT_STRING|IT_CALL, NULL, "Select Gametype/Level", M_GameTypeChange, 90}, {IT_STRING|IT_CALL, NULL, "Select Gametype/Level", M_GameTypeChange, 100},
{IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130},
{IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140},
}; };
#ifndef NONET #ifndef NONET
@ -1022,14 +1030,14 @@ static menuitem_t MP_PlayerSetupMenu[] =
// Prefix: OP_ // Prefix: OP_
static menuitem_t OP_MainMenu[] = static menuitem_t OP_MainMenu[] =
{ {
{IT_SUBMENU | IT_STRING, NULL, "Setup Controls...", &OP_ControlsDef, 10}, {IT_SUBMENU | IT_STRING, NULL, "Setup Controls...", &OP_ControlsDef, 10},
{IT_SUBMENU | IT_STRING, NULL, "Video Options...", &OP_VideoOptionsDef, 30}, {IT_SUBMENU | IT_STRING, NULL, "Video Options...", &OP_VideoOptionsDef, 30},
{IT_SUBMENU | IT_STRING, NULL, "Sound Options...", &OP_SoundOptionsDef, 40}, {IT_SUBMENU | IT_STRING, NULL, "Sound Options...", &OP_SoundOptionsDef, 40},
{IT_SUBMENU | IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 50}, {IT_SUBMENU | IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 50},
{IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70}, {IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70},
{IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, {IT_CALL | IT_STRING, NULL, "Server Options...", M_ServerOptions, 80},
}; };
static menuitem_t OP_ControlsMenu[] = static menuitem_t OP_ControlsMenu[] =
@ -1713,7 +1721,7 @@ menu_t MP_ServerDef =
&MP_MainDef, &MP_MainDef,
MP_ServerMenu, MP_ServerMenu,
M_DrawServerMenu, M_DrawServerMenu,
27, 40, 27, 30,
0, 0,
NULL NULL
}; };
@ -1725,7 +1733,7 @@ menu_t MP_SplitServerDef =
&MP_MainDef, &MP_MainDef,
MP_SplitServerMenu, MP_SplitServerMenu,
M_DrawServerMenu, M_DrawServerMenu,
27, 40, 27, 30,
0, 0,
NULL NULL
}; };
@ -4507,7 +4515,7 @@ static void M_Options(INT32 choice)
(void)choice; (void)choice;
// if the player is not admin or server, disable server options // if the player is not admin or server, disable server options
OP_MainMenu[5].status = (Playing() && !(server || adminplayer == consoleplayer)) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); OP_MainMenu[5].status = (Playing() && !(server || adminplayer == consoleplayer)) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL);
// if the player is playing _at all_, disable the erase data options // if the player is playing _at all_, disable the erase data options
OP_DataOptionsMenu[1].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); OP_DataOptionsMenu[1].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU);
@ -6909,7 +6917,7 @@ static void M_DrawServerMenu(void)
sprintf(headerstr, "%s - %s", cv_newgametype.string, cv_nextmap.string); sprintf(headerstr, "%s - %s", cv_newgametype.string, cv_nextmap.string);
M_DrawLevelPlatterHeader(currentMenu->y + 80 - lsheadingheight/2, (const char *)headerstr, true); M_DrawLevelPlatterHeader(currentMenu->y + MP_ServerMenu[mp_server_levelgt].alphaKey - 10 - lsheadingheight/2, (const char *)headerstr, true);
// A 160x100 image of the level as entry MAPxxP // A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value)));
@ -6919,7 +6927,7 @@ static void M_DrawServerMenu(void)
else else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
V_DrawSmallScaledPatch(319 - (currentMenu->x + (SHORT(PictureOfLevel->width)/2)), currentMenu->y + 90, 0, PictureOfLevel); V_DrawSmallScaledPatch(319 - (currentMenu->x + (SHORT(PictureOfLevel->width)/2)), currentMenu->y + MP_ServerMenu[mp_server_levelgt].alphaKey, 0, PictureOfLevel);
} }
} }
@ -6963,6 +6971,14 @@ static void M_StartSplitServerMenu(INT32 choice)
M_SetupNextMenu(&MP_SplitServerDef); M_SetupNextMenu(&MP_SplitServerDef);
} }
static void M_ServerOptions(INT32 choice)
{
(void)choice;
OP_ServerOptionsDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_ServerOptionsDef);
}
#ifndef NONET #ifndef NONET
static void M_StartServerMenu(INT32 choice) static void M_StartServerMenu(INT32 choice)
{ {