shithub: choc

Download patch

ref: a151944333d2e7318fe75868ec2455ec70fb0b6e
parent: 7dcb9c7e6041c12db593323751a36311ba3a54c7
author: Simon Howard <fraggle@gmail.com>
date: Thu Jul 31 17:29:20 EDT 2008

Update Chocolate Setup to support chex.wad.

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

--- a/setup/execute.h
+++ b/setup/execute.h
@@ -31,6 +31,7 @@
 #define IWAD_TNT      (1 << 2)       /* tnt.wad */
 #define IWAD_DOOM     (1 << 3)       /* doom.wad */
 #define IWAD_DOOM1    (1 << 4)       /* doom1.wad */
+#define IWAD_CHEX     (1 << 5)       /* chex.wad */
 
 execute_context_t *NewExecuteContext(void);
 void AddCmdLineParameter(execute_context_t *context, char *s, ...);
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -55,11 +55,12 @@
     { "tnt.wad",      "Final Doom: TNT: Evilution",          IWAD_TNT },
     { "plutonia.wad", "Final Doom: The Plutonia Experiment", IWAD_PLUTONIA },
     { "doom1.wad",    "Doom shareware",                      IWAD_DOOM1 },
+    { "chex.wad",     "Chex Quest",                          IWAD_CHEX },
 };
 
 // Array of IWADs found to be installed
 
-static char *found_iwads[5];
+static char *found_iwads[6];
 
 // Index of the currently selected IWAD
 
@@ -78,6 +79,15 @@
     "NIGHTMARE!",
 };
 
+static char *chex_skills[] = 
+{
+    "Easy does it",
+    "Not so sticky",
+    "Gobs of goo",
+    "Extreme ooze",
+    "SUPER SLIMEY!"
+};
+
 static char *gamemodes[] = 
 {
     "Co-operative",
@@ -98,6 +108,7 @@
 static int udpport = 2342;
 static int timer = 0;
 
+static txt_dropdown_list_t *skillbutton;
 static txt_button_t *warpbutton;
 static warptype_t warptype = WARP_DOOM2;
 static int warpepisode = 1;
@@ -117,7 +128,7 @@
     {
         if (!strcmp(iwads[i].description, description))
         {
-            return &iwads[i];;
+            return &iwads[i];
         }
     }
 
@@ -124,6 +135,12 @@
     return NULL;
 }
 
+static iwad_t *GetCurrentIWAD(void)
+{
+    return GetIWADForDescription(found_iwads[found_iwad_selected]);
+}
+
+
 static void AddWADs(execute_context_t *exec)
 {
     int have_wads = 0;
@@ -248,6 +265,20 @@
     TXT_SetButtonLabel(warpbutton, buf);
 }
 
+static void UpdateSkillButton(void)
+{
+    iwad_t *iwad = GetCurrentIWAD();
+
+    if (iwad->mask == IWAD_CHEX)
+    {
+        skillbutton->values = chex_skills;
+    }
+    else
+    {
+        skillbutton->values = skills;
+    }
+}
+
 static void SetDoom1Warp(TXT_UNCAST_ARG(widget), void *val)
 {
     int l;
@@ -283,6 +314,7 @@
     txt_window_t *window;
     txt_table_t *table;
     txt_button_t *button;
+    iwad_t *iwad;
     char buf[10];
     int x, y;
     int l;
@@ -298,11 +330,27 @@
     {
         // ExMy levels
         
+        iwad = GetCurrentIWAD();
+
         for (i=0; i<4 * 9; ++i)
         {
             x = (i % 4) + 1;
             y = (i / 4) + 1;
 
+            // chex.wad only has E1M1-E1M5.
+
+            if (iwad->mask == IWAD_CHEX && (x > 1 || y > 5))
+            {
+                continue;
+            }
+
+            // doom1.wad only has E1
+
+            if (iwad->mask == IWAD_DOOM1 && x > 1)
+            {
+                continue;
+            }
+
             sprintf(buf, " E%iM%i ", x, y);
             button = TXT_NewButton(buf);
             TXT_SignalConnect(button, "pressed",
@@ -348,7 +396,7 @@
 
     // Find the iwad_t selected
 
-    iwad = GetIWADForDescription(found_iwads[found_iwad_selected]);
+    iwad = GetCurrentIWAD();
 
     // Update iwadfile
 
@@ -368,7 +416,7 @@
 
     // Find the new warp type
 
-    if (iwad->mask & (IWAD_DOOM | IWAD_DOOM1))
+    if (iwad->mask & (IWAD_DOOM | IWAD_DOOM1 | IWAD_CHEX))
     {
         new_warptype = WARP_DOOM1;
     }
@@ -388,6 +436,7 @@
     warptype = new_warptype;
 
     UpdateWarpButton();
+    UpdateSkillButton();
 }
 
 static txt_widget_t *IWADSelector(void)
@@ -529,7 +578,7 @@
            TXT_NewLabel("Game"),
            iwad_selector = IWADSelector(),
            TXT_NewLabel("Skill"),
-           TXT_NewDropdownList(&skill, skills, 5),
+           skillbutton = TXT_NewDropdownList(&skill, skills, 5),
            TXT_NewLabel("Game type"),
            TXT_NewDropdownList(&deathmatch, gamemodes, 3),
            TXT_NewLabel("Level warp"),