foxygit / doom Log in
commit 77f49e5ea5aae45fe904306a9364018c0fc23b71
Author:     James Canete <SmileTheory@gmail.com>
AuthorDate: Thu Oct 17 16:14:40 2019 -0700
Commit:     James Canete <SmileTheory@gmail.com>
CommitDate: Thu Oct 17 16:14:40 2019 -0700

    Requested changes.

    https://github.com/chocolate-doom/chocolate-doom/pull/1205
---
 src/d_mode.h        |  3 +--
 src/doom/d_main.c   | 19 +++++++++----------
 src/doom/g_game.c   | 14 +++++---------
 src/doom/hu_stuff.c |  2 +-
 src/doom/p_inter.c  | 24 ++++++++++++++++--------
 src/doom/p_sight.c  | 49 ++++++++++++++++++++++++-------------------------
 src/doom/p_spec.c   |  1 -
 src/doom/s_sound.c  | 36 +-----------------------------------
 src/doom/st_lib.c   |  2 +-
 src/doom/st_stuff.c |  2 +-
 10 files changed, 59 insertions(+), 93 deletions(-)

diff --git a/src/d_mode.h b/src/d_mode.h
index 04d2fab0..7822a44a 100644
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -56,8 +56,7 @@ typedef enum

 typedef enum
 {
-    exe_doom_1_1,    // Doom 1.0/1.1: shareware and registered
-    exe_doom_1_2,    // Doom 1.2: "
+    exe_doom_1_2,    // Doom 1.2: shareware and registered
     exe_doom_1_666,  // Doom 1.666: for shareware, registered and commercial
     exe_doom_1_7,    // Doom 1.7/1.7a: "
     exe_doom_1_8,    // Doom 1.8: "
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 036037d5..2789f9a6 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -959,7 +959,6 @@ static struct
     const char *cmdline;
     GameVersion_t version;
 } gameversions[] = {
-    {"Doom 1.0/1.1",         "1.1",        exe_doom_1_1},
     {"Doom 1.2",             "1.2",        exe_doom_1_2},
     {"Doom 1.666",           "1.666",      exe_doom_1_666},
     {"Doom 1.7/1.7a",        "1.7",        exe_doom_1_7},
@@ -988,9 +987,9 @@ static void InitGameVersion(void)
     // @arg <version>
     // @category compat
     //
-    // Emulate a specific version of Doom.  Valid values are "1.1", "1.2",
-    // "1.666", "1.7", "1.8", "1.9", "ultimate", "final", "final2", "hacx"
-    // and "chex".
+    // Emulate a specific version of Doom.  Valid values are "1.2",
+    // "1.666", "1.7", "1.8", "1.9", "ultimate", "final", "final2",
+    // "hacx" and "chex".
     //

     p = M_CheckParmWithArgs("-gameversion", 1);
@@ -1082,12 +1081,6 @@ static void InitGameVersion(void)
                     }
                 }
             }
-
-            // detect v1.0/v1.1 from missing D_INTROA
-            if (gameversion == exe_doom_1_2 && W_CheckNumForName("D_INTROA") < 0)
-            {
-                gameversion = exe_doom_1_1;
-            }
         }
         else if (gamemode == retail)
         {
@@ -1104,6 +1097,12 @@ static void InitGameVersion(void)
             gameversion = exe_final;
         }
     }
+
+    // Deathmatch 2.0 did not exist until Doom v1.4
+    if (gameversion <= exe_doom_1_2 && deathmatch == 2)
+    {
+        deathmatch = 1;
+    }

     // The original exe does not support retail - 4th episode not supported

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 50e7e85b..b4de8dd8 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -2052,10 +2052,6 @@ int G_VanillaVersionCode(void)
 {
     switch (gameversion)
     {
-        case exe_doom_1_1:
-            return 101;
-        case exe_doom_1_2:
-            return 102;
         case exe_doom_1_666:
             return 106;
         case exe_doom_1_7:
@@ -2174,6 +2170,7 @@ void G_DoPlayDemo (void)
     skill_t skill;
     int i, lumpnum, episode, map;
     int demoversion;
+    boolean olddemo = false;

     lumpnum = W_GetNumForName(defdemoname);
     gameaction = ga_nothing;
@@ -2184,9 +2181,7 @@ void G_DoPlayDemo (void)

     if (demoversion >= 0 && demoversion <= 4)
     {
-        if (gameversion <= exe_doom_1_2)
-            demoversion = G_VanillaVersionCode();
-
+        olddemo = true;
         demo_p--;
     }

@@ -2199,7 +2194,8 @@ void G_DoPlayDemo (void)
     {
         longtics = true;
     }
-    else if (demoversion != G_VanillaVersionCode())
+    else if (demoversion != G_VanillaVersionCode() &&
+             !(gameversion <= exe_doom_1_2 && olddemo))
     {
         const char *message = "Demo is from a different game version!\n"
                               "(read %i, should be %i)\n"
@@ -2217,7 +2213,7 @@ void G_DoPlayDemo (void)
     skill = *demo_p++;
     episode = *demo_p++;
     map = *demo_p++;
-    if (demoversion > 102)
+    if (!olddemo)
     {
         deathmatch = *demo_p++;
         respawnparm = *demo_p++;
diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c
index fd14c837..dd8eed0d 100644
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -522,7 +522,7 @@ void HU_Ticker(void)
 			    message_counter = HU_MSGTIMEOUT;
 			    if ( gamemode == commercial )
 			      S_StartSound(0, sfx_radio);
-			    else
+			    else if (gameversion > exe_doom_1_2)
 			      S_StartSound(0, sfx_tink);
 			}
 			HUlib_resetIText(&w_inputbuffer[i]);
diff --git a/src/doom/p_inter.c b/src/doom/p_inter.c
index f827b02e..b7c04b90 100644
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -397,7 +397,8 @@ P_TouchSpecialThing
 	    player->health = deh_max_soulsphere;
 	player->mo->health = player->health;
 	player->message = DEH_String(GOTSUPER);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_MEGA:
@@ -409,7 +410,8 @@ P_TouchSpecialThing
         // affects the MegaArmor.
 	P_GiveArmor (player, 2);
 	player->message = DEH_String(GOTMSPHERE);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

 	// cards
@@ -485,7 +487,8 @@ P_TouchSpecialThing
 	if (!P_GivePower (player, pw_invulnerability))
 	    return;
 	player->message = DEH_String(GOTINVUL);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_PSTR:
@@ -494,35 +497,40 @@ P_TouchSpecialThing
 	player->message = DEH_String(GOTBERSERK);
 	if (player->readyweapon != wp_fist)
 	    player->pendingweapon = wp_fist;
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_PINS:
 	if (!P_GivePower (player, pw_invisibility))
 	    return;
 	player->message = DEH_String(GOTINVIS);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_SUIT:
 	if (!P_GivePower (player, pw_ironfeet))
 	    return;
 	player->message = DEH_String(GOTSUIT);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_PMAP:
 	if (!P_GivePower (player, pw_allmap))
 	    return;
 	player->message = DEH_String(GOTMAP);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

       case SPR_PVIS:
 	if (!P_GivePower (player, pw_infrared))
 	    return;
 	player->message = DEH_String(GOTVISOR);
-	sound = sfx_getpow;
+	if (gameversion > exe_doom_1_2)
+	    sound = sfx_getpow;
 	break;

 	// ammo
diff --git a/src/doom/p_sight.c b/src/doom/p_sight.c
index 0598309a..6457417e 100644
--- a/src/doom/p_sight.c
+++ b/src/doom/p_sight.c
@@ -16,7 +16,6 @@
 //	LineOfSight/Visibility checks, uses REJECT Lookup Table.
 //

-#include <stdlib.h> // abs()

 #include "doomdef.h"
 #include "doomstat.h"
@@ -45,37 +44,37 @@ int		sightcounts[2];
 // taken from prboom-plus/src/p_sight.c:69-102
 boolean PTR_SightTraverse(intercept_t *in)
 {
-  line_t *li;
-  fixed_t slope;
+    line_t *li;
+    fixed_t slope;

-  li = in->d.line;
+    li = in->d.line;

-  //
-  // crosses a two sided line
-  //
-  P_LineOpening(li);
+    //
+    // crosses a two sided line
+    //
+    P_LineOpening(li);

-  if (openbottom >= opentop)  // quick test for totally closed doors
-    return false;  // stop
+    if (openbottom >= opentop) // quick test for totally closed doors
+        return false;          // stop

-  if (li->frontsector->floorheight != li->backsector->floorheight)
-  {
-    slope = FixedDiv(openbottom - sightzstart , in->frac);
-    if (slope > bottomslope)
-      bottomslope = slope;
-  }
+    if (li->frontsector->floorheight != li->backsector->floorheight)
+    {
+        slope = FixedDiv(openbottom - sightzstart, in->frac);
+        if (slope > bottomslope)
+            bottomslope = slope;
+    }

-  if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
-  {
-    slope = FixedDiv(opentop - sightzstart, in->frac);
-    if (slope < topslope)
-      topslope = slope;
-  }
+    if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
+    {
+        slope = FixedDiv(opentop - sightzstart, in->frac);
+        if (slope < topslope)
+            topslope = slope;
+    }

-  if (topslope <= bottomslope)
-    return false;  // stop
+    if (topslope <= bottomslope)
+        return false; // stop

-  return true;  // keep going
+    return true; // keep going
 }


diff --git a/src/doom/p_spec.c b/src/doom/p_spec.c
index d6201e54..8702b8f4 100644
--- a/src/doom/p_spec.c
+++ b/src/doom/p_spec.c
@@ -531,7 +531,6 @@ P_CrossSpecialLine
                 case MT_HEADSHOT:
                 case MT_BRUISERSHOT:
                     return;
-                    break;

                 default: break;
             }
diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c
index 75ef929c..76748892 100644
--- a/src/doom/s_sound.c
+++ b/src/doom/s_sound.c
@@ -445,40 +445,6 @@ void S_StartSound(void *origin_p, int sfx_id)
         I_Error("Bad sfx #: %d", sfx_id);
     }

-    // substitute missing sounds in Doom 1.2
-    if (gameversion <= exe_doom_1_2)
-    {
-        switch(sfx_id)
-        {
-            case sfx_bdcls:
-                sfx_id = sfx_dorcls;
-                break;
-
-            case sfx_bdopn:
-                sfx_id = sfx_doropn;
-                break;
-
-            case sfx_getpow:
-                sfx_id = sfx_itemup;
-                break;
-
-            case sfx_itmbk:
-                sfx_id = sfx_stnmov;
-                break;
-
-            case sfx_pdiehi:
-                sfx_id = sfx_pldeth;
-                break;
-
-            case sfx_tink:
-                sfx_id = sfx_swtchx;
-                break;
-
-            default:
-                break;
-        }
-    }
-
     sfx = &S_sfx[sfx_id];

     // Initialize sound parameters
@@ -696,7 +662,7 @@ void S_ChangeMusic(int musicnum, int looping)

     if (musicnum == mus_intro && (snd_musicdevice == SNDDEVICE_ADLIB
                                || snd_musicdevice == SNDDEVICE_SB)
-        && gameversion >= exe_doom_1_2)
+        && W_CheckNumForName("D_INTROA") >= 0)
     {
         musicnum = mus_introa;
     }
diff --git a/src/doom/st_lib.c b/src/doom/st_lib.c
index 28ab1b30..3fa64dc2 100644
--- a/src/doom/st_lib.c
+++ b/src/doom/st_lib.c
@@ -50,7 +50,7 @@ patch_t*		sttminus;

 void STlib_init(void)
 {
-    if (W_CheckNumForName(DEH_String("STTMINUS")) > 0)
+    if (W_CheckNumForName(DEH_String("STTMINUS")) >= 0)
         sttminus = (patch_t *) W_CacheLumpName(DEH_String("STTMINUS"), PU_STATIC);
     else
         sttminus = NULL;
diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index 51603907..d5112608 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -1149,7 +1149,7 @@ static void ST_loadUnloadGraphics(load_callback_t callback)
     callback(namebuf, &faceback);

     // status bar background bits
-    if (gameversion >= exe_doom_1_2)
+    if (W_CheckNumForName("STBAR") >= 0)
     {
         callback(DEH_String("STBAR"), &sbar);
         sbarr = NULL;