shithub: choc

Download patch

ref: 0ef3db9af6b98e70658c3d6f997493dcc680c63f
parent: 12ae015f192be46361060efb8fa727c033aec048
author: Simon Howard <[email protected]>
date: Wed Sep 20 07:47:24 EDT 2006

Add multiplayer configuration dialog.

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

--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -69,6 +69,7 @@
 extern void ConfigKeyboard();
 extern void ConfigMouse();
 extern void StartMultiGame();
+extern void MultiplayerConfig();
 
 void MainMenu(void)
 {
@@ -98,6 +99,10 @@
     TXT_AddWidget(window, button);
 
     TXT_AddWidget(window, TXT_NewButton("Join a Network game"));
+
+    button = TXT_NewButton("Multiplayer configuration");
+    TXT_SignalConnect(button, "pressed", MultiplayerConfig, NULL);
+    TXT_AddWidget(window, button);
 
     quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit");
     TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL);
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -47,6 +47,9 @@
     "Deathmatch 2.0",
 };
 
+char *player_name;
+char *chatmacros[10];
+
 char *wads[NUM_WADS] = {};
 int skill = 0;
 int nomonsters = 0;
@@ -253,5 +256,41 @@
     TXT_AddWidget(window, TXT_NewCheckBox("Fast monsters", &fast));
     TXT_AddWidget(window, TXT_NewCheckBox("Respawning monsters", &respawn));
 
+}
+
+void MultiplayerConfig(void)
+{
+    txt_window_t *window;
+    txt_label_t *label;
+    txt_table_t *table;
+    char buf[10];
+    int i;
+
+    window = TXT_NewWindow("Multiplayer Configuration");
+
+    TXT_AddWidget(window, TXT_NewStrut(0, 1));
+
+    table = TXT_NewTable(2);
+
+    TXT_AddWidget(table, TXT_NewLabel("Player name:  "));
+    TXT_AddWidget(table, TXT_NewInputBox(&player_name, 25));
+
+    TXT_AddWidget(window, table);
+    TXT_AddWidget(window, TXT_NewStrut(0, 1));
+    TXT_AddWidget(window, TXT_NewSeparator("Chat macros"));
+
+    table = TXT_NewTable(2);
+
+    for (i=0; i<10; ++i)
+    {
+        sprintf(buf, "#%i ", i + 1);
+
+        label = TXT_NewLabel(buf);
+        TXT_SetFGColor(label, TXT_COLOR_BRIGHT_CYAN);
+        TXT_AddWidget(table, label);
+        TXT_AddWidget(table, TXT_NewInputBox(&chatmacros[i], 40));
+    }
+    
+    TXT_AddWidget(window, table);
 }