shithub: choc

Download patch

ref: e6028047cd51a6d14d4e30b0aae733f51a810f86
parent: bfe085adcf3d8b978441ed977e52510bf3c8463f
author: Simon Howard <[email protected]>
date: Tue Sep 26 19:50:06 EDT 2006

Add "join game" dialog.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 675

--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -71,6 +71,7 @@
 extern void ConfigSound();
 extern void CompatibilitySettings();
 extern void StartMultiGame();
+extern void JoinMultiGame();
 extern void MultiplayerConfig();
 
 void MainMenu(void)
@@ -108,7 +109,9 @@
     TXT_SignalConnect(button, "pressed", StartMultiGame, NULL);
     TXT_AddWidget(window, button);
 
-    TXT_AddWidget(window, TXT_NewButton("Join a Network game"));
+    button = TXT_NewButton("Join a Network game");
+    TXT_SignalConnect(button, "pressed", JoinMultiGame, NULL);
+    TXT_AddWidget(window, button);
 
     button = TXT_NewButton("Multiplayer configuration");
     TXT_SignalConnect(button, "pressed", MultiplayerConfig, NULL);
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -68,6 +68,10 @@
 int warpepisode = 1;
 int warpmap = 1;
 
+// Address to connect to when joining a game
+
+char *connect_address = NULL;
+
 static void StartGame(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data))
 {
     printf("Now we start the game.\n");
@@ -291,6 +295,28 @@
     TXT_SignalConnect(button, "pressed", OpenExtraParamsWindow, NULL);
     TXT_AddWidget(window, button);
     
+}
+
+void JoinMultiGame(void)
+{
+    txt_window_t *window;
+    txt_button_t *button;
+
+    window = TXT_NewWindow("Join multiplayer game");
+
+    TXT_AddWidget(window, TXT_NewLabel("Connect to address: "));
+    TXT_AddWidget(window, TXT_NewInputBox(&connect_address, 40));
+    TXT_AddWidget(window, TXT_NewStrut(0, 1));
+
+    button = TXT_NewButton("Add extra parameters...");
+    TXT_SignalConnect(button, "pressed", OpenExtraParamsWindow, NULL);
+    TXT_AddWidget(window, button);
+
+    button = TXT_NewButton("Add WADs...");
+    TXT_SignalConnect(button, "pressed", OpenWadsWindow, NULL);
+    TXT_AddWidget(window, button);
+
+    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
 }
 
 static void SetChatMacroDefaults(void)