foxygit / doom Log in
commit 03b6f175461eaebda716ad8b06da8c608bb6be18
Author:     Michael Francis <4574480+mfrancis95@users.noreply.github.com>
AuthorDate: Mon Oct 9 20:15:50 2023 -0400
Commit:     GitHub <noreply@github.com>
CommitDate: Mon Oct 9 20:15:50 2023 -0400

    Introduce v1.5 compatibility
---
 src/d_mode.c       | 1 +
 src/d_mode.h       | 1 +
 src/doom/d_main.c  | 7 ++++---
 src/doom/p_enemy.c | 4 ++--
 src/doom/p_inter.c | 2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/d_mode.c b/src/d_mode.c
index 26625ec4..7f9e7fd3 100644
--- a/src/d_mode.c
+++ b/src/d_mode.c
@@ -121,6 +121,7 @@ static struct {
     GameVersion_t version;
 } valid_versions[] = {
     { doom,     exe_doom_1_2 },
+    { doom,     exe_doom_1_5 },
     { doom,     exe_doom_1_666 },
     { doom,     exe_doom_1_7 },
     { doom,     exe_doom_1_8 },
diff --git a/src/d_mode.h b/src/d_mode.h
index a3b627ce..f94aff00 100644
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -58,6 +58,7 @@ typedef enum
 typedef enum
 {
     exe_doom_1_2,    // Doom 1.2: shareware and registered
+    exe_doom_1_5,    // Doom 1.5: "
     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 0bab43c1..ba5e4b58 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -982,6 +982,7 @@ static struct
     GameVersion_t version;
 } gameversions[] = {
     {"Doom 1.2",             "1.2",        exe_doom_1_2},
+    {"Doom 1.5",             "1.5",        exe_doom_1_5},
     {"Doom 1.666",           "1.666",      exe_doom_1_666},
     {"Doom 1.7/1.7a",        "1.7",        exe_doom_1_7},
     {"Doom 1.8",             "1.8",        exe_doom_1_8},
@@ -1009,9 +1010,9 @@ static void InitGameVersion(void)
     // @arg <version>
     // @category compat
     //
-    // 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".
+    // Emulate a specific version of Doom. Valid values are "1.2",
+    // "1.5", "1.666", "1.7", "1.8", "1.9", "ultimate", "final",
+    // "final2", "hacx" and "chex".
     //

     p = M_CheckParmWithArgs("-gameversion", 1);
diff --git a/src/doom/p_enemy.c b/src/doom/p_enemy.c
index b68666dc..c6acf390 100644
--- a/src/doom/p_enemy.c
+++ b/src/doom/p_enemy.c
@@ -176,7 +176,7 @@ boolean P_CheckMeleeRange (mobj_t*	actor)
     pl = actor->target;
     dist = P_AproxDistance (pl->x-actor->x, pl->y-actor->y);

-    if (gameversion <= exe_doom_1_2)
+    if (gameversion < exe_doom_1_5)
         range = MELEERANGE;
     else
         range = MELEERANGE-20*FRACUNIT+pl->info->radius;
@@ -933,7 +933,7 @@ void A_SargAttack (mobj_t* actor)

     A_FaceTarget (actor);

-    if (gameversion > exe_doom_1_2)
+    if (gameversion >= exe_doom_1_5)
     {
         if (!P_CheckMeleeRange (actor))
             return;
diff --git a/src/doom/p_inter.c b/src/doom/p_inter.c
index c0f1f090..b6e40329 100644
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -915,7 +915,7 @@ P_DamageMobj
     target->reactiontime = 0;		// we're awake now...

     if ( (!target->threshold || target->type == MT_VILE)
-	 && source && (source != target || gameversion <= exe_doom_1_2)
+	 && source && (source != target || gameversion < exe_doom_1_5)
 	 && source->type != MT_VILE)
     {
 	// if not intent on another player,