shithub: choc

Download patch

ref: 6fb9d62d1424b81fa18476b56090034812defa0e
parent: c9debbb1ceabdea48df609a9db2025265fa65c51
parent: 74e95c6130784c5c9bc5fc218e4cac9ba1e25f5e
author: Simon Howard <fraggle@soulsphere.org>
date: Mon Nov 9 18:31:16 EST 2015

Merge branch 'master' of github.com:chocolate-doom/chocolate-doom

--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -1726,9 +1726,6 @@
     // the -warp command line parameter to behave differently.
     // This is left here for posterity.
 
-    if (skill > sk_nightmare)
-	skill = sk_nightmare;
-
     // This was quite messy with SPECIAL and commented parts.
     // Supposedly hacks to make the latest edition work.
     // It might not work properly.
@@ -1751,6 +1748,33 @@
 	episode = 3;
     }
     */
+
+    if (skill > sk_nightmare)
+	skill = sk_nightmare;
+
+    if (gameversion >= exe_ultimate)
+    {
+        if (episode == 0)
+        {
+            episode = 4;
+        }
+    }
+    else
+    {
+        if (episode < 1)
+        {
+            episode = 1;
+        }
+        if (episode > 3)
+        {
+            episode = 3;
+        }
+    }
+
+    if (episode > 1 && gamemode == shareware)
+    {
+        episode = 1;
+    }
 
     if (map < 1)
 	map = 1;
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -611,7 +611,7 @@
       
       if (gamemode == commercial)
       {
-	epsd = 1;
+	epsd = 0;
 	map = (buf[0] - '0')*10 + buf[1] - '0';
       }
       else
@@ -635,30 +635,40 @@
       }
 
       // Catch invalid maps.
-      if (epsd < 1)
-	return false;
-
-      if (map < 1)
-	return false;
-
-      // Ohmygod - this is not going to work.
-      if ((gamemode == retail)
-	  && ((epsd > 4) || (map > 9)))
-	return false;
-
-      if ((gamemode == registered)
-	  && ((epsd > 3) || (map > 9)))
-	return false;
-
-      if ((gamemode == shareware)
-	  && ((epsd > 1) || (map > 9)))
-	return false;
-
-      // The source release has this check as map > 34. However, Vanilla
-      // Doom allows IDCLEV up to MAP40 even though it normally crashes.
-      if ((gamemode == commercial)
-	&& (( epsd > 1) || (map > 40)))
-	return false;
+      if (gamemode != commercial)
+      {
+          if (epsd < 1)
+          {
+              return false;
+          }
+          if (epsd > 4)
+          {
+              return false;
+          }
+          if (epsd == 4 && gameversion < exe_ultimate)
+          {
+              return false;
+          }
+          if (map < 1)
+          {
+              return false;
+          }
+          if (map > 9)
+          {
+              return false;
+          }
+      }
+      else
+      {
+          if (map < 1)
+          {
+              return false;
+          }
+          if (map > 40)
+          {
+              return false;
+          }
+      }
 
       // So be it.
       plyr->message = DEH_String(STSTR_CLEV);
--- a/src/doom/wi_stuff.c
+++ b/src/doom/wi_stuff.c
@@ -1810,7 +1810,7 @@
     if (!wbs->maxsecret)
 	wbs->maxsecret = 1;
 
-    if ( gamemode != retail )
+    if ( gameversion < exe_ultimate )
       if (wbs->epsd > 2)
 	wbs->epsd -= 3;
 }