foxygit / doom Log in
commit 936a2a5b7cf649abe5c709e9109efd7d3328f8a8
Author:     jens <jens.se@icloud.com>
AuthorDate: Tue Aug 25 17:08:19 2026 +0200
Commit:     jens <jens.se@icloud.com>
CommitDate: Tue Aug 25 17:08:19 2026 +0200

    Respawn splitscreen pickups after 30s instead of leaving them forever

    Superseding the previous "leave weapons forever" splitscreen fix:
    turns out vanilla already has a full item-respawn-queue system
    (P_RespawnSpecials/itemrespawnque) that's only gated on deathmatch==2
    ("altdeath"). Widen that gate to also fire for local splitscreen, and
    revert P_GiveWeapon's splitscreen addition so weapons go through the
    normal single-pickup-then-remove path and actually enter the queue,
    instead of being permanently skipped over by the "never remove it"
    branch.

    Net effect: any player picking up a weapon/ammo/health/armor pickup in
    splitscreen removes it as normal, and it reappears (with the usual
    teleport-fog effect) ~30 seconds later for whoever's still looking for
    it - the same experience vanilla already gives real deathmatch, now
    also available to non-networked local splitscreen players in any game
    mode. Keycards are unaffected by this change - they already used their
    own separate "never remove, one per player" logic (see the previous
    commit), which doesn't rely on the respawn queue at all.

    Verified with a temporary self-triggering test (not committed):
    touching a shotgun pickup now genuinely removes the mobj, and a fresh
    one reappears near the same spot ~31 real seconds later.

    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---
 src/doom/p_inter.c | 13 +++++++------
 src/doom/p_mobj.c  | 10 +++++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/doom/p_inter.c b/src/doom/p_inter.c
index 7409fbd3..cf79a86e 100644
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -165,12 +165,13 @@ P_GiveWeapon
     boolean	gaveammo;
     boolean	gaveweapon;

-    // Local splitscreen (see doomstat.h) is also multiple simultaneous
-    // players sharing one level, same as a netgame - it should get the
-    // same "leave it for everyone else" treatment below, not just
-    // -actual- networked coop, or every splitscreen player after the
-    // first to reach a given weapon spot finds nothing there.
-    if ((netgame || splitscreen)
+    // Deliberately netgame-only, not (netgame || splitscreen): local
+    // splitscreen (see doomstat.h) wants the deathmatch-style "remove
+    // and let P_RespawnSpecials bring it back later" treatment instead
+    // (see p_mobj.c) - not this branch's "leave it forever, never
+    // remove it" one, which would stop it from ever entering the
+    // respawn queue in the first place.
+    if (netgame
 	&& (deathmatch!=2)
 	 && !dropped )
     {
diff --git a/src/doom/p_mobj.c b/src/doom/p_mobj.c
index 69b4152e..47f94d7e 100644
--- a/src/doom/p_mobj.c
+++ b/src/doom/p_mobj.c
@@ -625,9 +625,13 @@ void P_RespawnSpecials (void)

     int			i;

-    // only respawn items in deathmatch
-    if (deathmatch != 2)
-	return;	//
+    // Only respawn items in deathmatch - or local splitscreen (see
+    // doomstat.h), which wants the same "reappears for whoever's still
+    // looking for it" behavior as altdeath even in coop, since a shared
+    // pickup that's simply gone once one of several players grabs it
+    // leaves everyone else permanently without their own copy.
+    if (deathmatch != 2 && !splitscreen)
+	return;	//

     // nothing left to respawn?
     if (iquehead == iquetail)