summaryrefslogtreecommitdiff
path: root/setup/multiplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup/multiplayer.c')
-rw-r--r--setup/multiplayer.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/setup/multiplayer.c b/setup/multiplayer.c
index cbc76dde..ee46c3f1 100644
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -48,6 +48,12 @@ typedef enum
WARP_DOOM2,
} warptype_t;
+typedef enum
+{
+ JOIN_AUTO_LAN,
+ JOIN_ADDRESS,
+} jointype_t;
+
static iwad_t iwads[] =
{
{ "doom.wad", "Doom", IWAD_DOOM },
@@ -98,6 +104,8 @@ static char *gamemodes[] =
char *net_player_name;
char *chat_macros[10];
+static int jointype = JOIN_ADDRESS;
+
static char *wads[NUM_WADS];
static char *extra_params[NUM_EXTRA_PARAMS];
static int skill = 2;
@@ -608,7 +616,14 @@ static void DoJoinGame(void *unused1, void *unused2)
exec = NewExecuteContext();
- AddCmdLineParameter(exec, "-connect %s", connect_address);
+ if (jointype == JOIN_ADDRESS)
+ {
+ AddCmdLineParameter(exec, "-connect %s", connect_address);
+ }
+ else if (jointype == JOIN_AUTO_LAN)
+ {
+ AddCmdLineParameter(exec, "-autojoin");
+ }
// Extra parameters come first, so that they can be used to override
// the other parameters.
@@ -638,18 +653,28 @@ static txt_window_action_t *JoinGameAction(void)
return action;
}
+// When an address is entered, select "address" mode.
+
+static void SelectAddressJoin(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
+{
+ jointype = JOIN_ADDRESS;
+}
+
void JoinMultiGame(void)
{
txt_window_t *window;
txt_table_t *gameopt_table;
+ txt_table_t *serveropt_table;
+ txt_inputbox_t *address_box;
window = TXT_NewWindow("Join multiplayer game");
TXT_AddWidgets(window,
gameopt_table = TXT_NewTable(2),
+ TXT_NewSeparator("Server"),
+ serveropt_table = TXT_NewTable(2),
TXT_NewStrut(0, 1),
TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL),
- // TXT_NewButton2("Add WADs...", OpenWadsWindow, NULL),
NULL);
TXT_SetColumnWidths(gameopt_table, 12, 12);
@@ -657,10 +682,19 @@ void JoinMultiGame(void)
TXT_AddWidgets(gameopt_table,
TXT_NewLabel("Game"),
IWADSelector(),
- TXT_NewLabel("Server address "),
- TXT_NewInputBox(&connect_address, 40),
NULL);
+ TXT_AddWidgets(serveropt_table,
+ TXT_NewRadioButton("Connect to address:",
+ &jointype, JOIN_ADDRESS),
+ address_box = TXT_NewInputBox(&connect_address, 30),
+ TXT_NewRadioButton("Auto-join LAN game",
+ &jointype, JOIN_AUTO_LAN),
+ NULL);
+
+ TXT_SignalConnect(address_box, "changed", SelectAddressJoin, NULL);
+ TXT_SelectWidget(window, address_box);
+
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction());
}