foxygit / doom Log in
commit 9eb11191b5ac68764da60c2f583d9c34ac05794e
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu May 14 19:54:49 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu May 14 19:54:49 2009 +0000

    Add character class selectors for Hexen.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1523
---
 src/setup/multiplayer.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c
index 6756e53c..101361c4 100644
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -103,6 +103,13 @@ static char *hexen_skills[] =
     "Titan/Pope/Archimage"
 };

+static char *character_classes[] =
+{
+    "Fighter",
+    "Cleric",
+    "Mage"
+};
+
 static struct
 {
     GameMission_t mission;
@@ -114,7 +121,7 @@ static struct
     { hexen,   hexen_skills }
 };

-static char *gamemodes[] =
+static char *gamemodes[] =
 {
     "Co-operative",
     "Deathmatch",
@@ -128,6 +135,7 @@ static int jointype = JOIN_ADDRESS;

 static char *wads[NUM_WADS];
 static char *extra_params[NUM_EXTRA_PARAMS];
+static int character_class = 0;
 static int skill = 2;
 static int nomonsters = 0;
 static int deathmatch = 0;
@@ -215,6 +223,11 @@ static void StartGame(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data))
     AddCmdLineParameter(exec, "-server");
     AddCmdLineParameter(exec, "-skill %i", skill + 1);

+    if (gamemission == hexen)
+    {
+        AddCmdLineParameter(exec, "-class %i", character_class);
+    }
+
     if (nomonsters)
     {
         AddCmdLineParameter(exec, "-nomonsters");
@@ -618,6 +631,15 @@ void StartMultiGame(void)
                            NULL),
            NULL);

+    if (gamemission == hexen)
+    {
+        TXT_AddWidgets(gameopt_table,
+                       TXT_NewLabel("Character class "),
+                       TXT_NewDropdownList(&character_class,
+                                           character_classes, 3),
+                       NULL);
+    }
+
     TXT_SetColumnWidths(advanced_table, 12, 12);

     TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL);
@@ -646,6 +668,11 @@ static void DoJoinGame(void *unused1, void *unused2)
         AddCmdLineParameter(exec, "-autojoin");
     }

+    if (gamemission == hexen)
+    {
+        AddCmdLineParameter(exec, "-class %i", character_class);
+    }
+
     // Extra parameters come first, so that they can be used to override
     // the other parameters.

@@ -705,6 +732,15 @@ void JoinMultiGame(void)
                    IWADSelector(),
                    NULL);

+    if (gamemission == hexen)
+    {
+        TXT_AddWidgets(gameopt_table,
+                       TXT_NewLabel("Character class "),
+                       TXT_NewDropdownList(&character_class,
+                                           character_classes, 3),
+                       NULL);
+    }
+
     TXT_AddWidgets(serveropt_table,
                    TXT_NewRadioButton("Connect to address:",
                                       &jointype, JOIN_ADDRESS),