shithub: choc

Download patch

ref: b05a3f9448a690bf1d6805ed20081227921f64d9
parent: 9ba60f243d1ae1ab14ba28eac92fca7b5891801a
author: Simon Howard <fraggle@gmail.com>
date: Thu Sep 25 16:00:31 EDT 2008

Remove ExtendedWAD variable; use gamemode == retail.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1286

--- a/src/heretic/am_map.c
+++ b/src/heretic/am_map.c
@@ -1453,6 +1453,8 @@
 
 void AM_Drawer(void)
 {
+    int numepisodes;
+
     if (!automapactive)
         return;
 
@@ -1471,7 +1473,17 @@
     {
         AM_drawkeys();
     }
-    if ((gameepisode < (ExtendedWAD ? 6 : 4)) && gamemap < 10)
+
+    if (gamemode == retail)
+    {
+        numepisodes = 5;
+    }
+    else
+    {
+        numepisodes = 3;
+    }
+
+    if (gameepisode <= numepisodes && gamemap < 10)
     {
         MN_DrTextA(LevelNames[(gameepisode - 1) * 9 + gamemap - 1], 20, 145);
     }
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -39,7 +39,6 @@
 
 GameMission_t gamemission = heretic;
 GameMode_t gamemode = indetermined;
-boolean ExtendedWAD = false;    // true if episodes 4 and 5 present
 
 boolean nomonsters;             // checkparm of -nomonsters
 boolean respawnparm;            // checkparm of -respawn
@@ -926,18 +925,18 @@
     }
 
     if (W_CheckNumForName("E2M1") == -1)
-    {                           // Can't find episode 2 maps, must be the shareware WAD
+    {
         gamemode = shareware;
     }
+    else if (W_CheckNumForName("EXTENDED") != -1)
+    {
+        // Presence of the EXTENDED lump indicates the retail version
+
+        gamemode = retail;
+    }
     else
     {
         gamemode = registered;
-
-        // Is this the extended WAD?
-        if (W_CheckNumForName("EXTENDED") != -1)
-        {
-            ExtendedWAD = true;
-        }
     }
 
 #ifdef __WATCOMC__
--- a/src/heretic/in_lude.c
+++ b/src/heretic/in_lude.c
@@ -734,7 +734,7 @@
         sounds++;
     }
 
-    if (!ExtendedWAD || gameepisode < 4)
+    if (gamemode != retail || gameepisode <= 3)
     {
         IN_DrTextB("TIME", 85, 160);
         IN_DrawTime(155, 160, hours, minutes, seconds);
--- a/src/heretic/m_misc.c
+++ b/src/heretic/m_misc.c
@@ -48,42 +48,21 @@
     {
         return false;
     }
-    if (gamemode == shareware)
-    {                           // Shareware version checks
-        if (episode != 1)
-        {
+
+    switch (gamemode)
+    {
+        case shareware:
+            return episode == 1;
+
+        case retail:
+            return episode <= 5 || (episode == 6 && map <= 3);
+
+        case registered:
+            return episode <= 3 || (episode == 4 && map == 1);
+
+        default:
             return false;
-        }
     }
-    else if (ExtendedWAD)
-    {                           // Extended version checks
-        if (episode == 6)
-        {
-            if (map > 3)
-            {
-                return false;
-            }
-        }
-        else if (episode > 5)
-        {
-            return false;
-        }
-    }
-    else
-    {                           // Registered version checks
-        if (episode == 4)
-        {
-            if (map != 1)
-            {
-                return false;
-            }
-        }
-        else if (episode > 3)
-        {
-            return false;
-        }
-    }
-    return true;
 }
 
 //---------------------------------------------------------------------------
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -303,7 +303,8 @@
     MenuActive = false;
     messageson = true;
     SkullBaseLump = W_GetNumForName("M_SKL00");
-    if (ExtendedWAD)
+
+    if (gamemode == retail)
     {                           // Add episodes 4 and 5 to the menu
         EpisodeMenu.itemCount = 5;
         EpisodeMenu.y -= ITEM_HEIGHT;