foxygit / doom Log in
commit 93fd43794aabc8a3bafb70c561e5f2c76e9e4ccc
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Fri Feb 16 08:02:21 2024 -0500
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Fri Feb 16 08:02:21 2024 -0500

    Revert "Fix lockups in Hexen and Strife when playing with more than four"

    This reverts commit d6693cc9e17fdbee7033e47b7b8da249da118d8f.
---
 src/hexen/p_enemy.c  | 12 ++----------
 src/strife/p_enemy.c | 12 ++----------
 2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index c92604d6..4da539c1 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -534,16 +534,8 @@ boolean P_LookForPlayers(mobj_t * actor, boolean allaround)
         return (P_LookForMonsters(actor));
     }
     c = 0;
-
-    // NOTE: This behavior has been changed from the Vanilla behavior, where
-    // an infinite loop can occur if players 0-3 all quit the game. Although
-    // technically this is not what Vanilla does, fixing this is highly
-    // desirable, and having the game simply lock up is not acceptable.
-    // stop = (actor->lastlook - 1) & 3;
-    // for (;; actor->lastlook = (actor->lastlook + 1) & 3)
-
-    stop = (actor->lastlook + maxplayers - 1) % maxplayers;
-    for (;; actor->lastlook = (actor->lastlook + 1) % maxplayers)
+    stop = (actor->lastlook - 1) & 3;
+    for (;; actor->lastlook = (actor->lastlook + 1) & 3)
     {
         if (!playeringame[actor->lastlook])
             continue;
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 5f572972..213f7195 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -787,17 +787,9 @@ P_LookForPlayers
     }

     c = 0;
+    stop = (actor->lastlook-1)&3;

-    // NOTE: This behavior has been changed from the Vanilla behavior, where
-    // an infinite loop can occur if players 0-3 all quit the game. Although
-    // technically this is not what Vanilla does, fixing this is highly
-    // desirable, and having the game simply lock up is not acceptable.
-    // stop = (actor->lastlook - 1) & 3;
-    // for (;; actor->lastlook = (actor->lastlook + 1) & 3)
-
-    stop = (actor->lastlook + MAXPLAYERS - 1) % MAXPLAYERS;
-
-    for ( ; ; actor->lastlook = (actor->lastlook + 1) % MAXPLAYERS)
+    for ( ; ; actor->lastlook = (actor->lastlook+1)&3 )
     {
         if (!playeringame[actor->lastlook])
             continue;