foxygit / doom Log in
commit 751f3782bb3bf634b9d254c3dab8a00c859ad173
Author:     jens <jens.se@icloud.com>
AuthorDate: Tue Aug 25 16:53:39 2026 +0200
Commit:     jens <jens.se@icloud.com>
CommitDate: Tue Aug 25 16:53:39 2026 +0200

    Leave weapons and keycards on the map for splitscreen players too

    Vanilla's P_GiveWeapon/P_TouchSpecialThing already leave placed
    weapons and keycards in the world instead of removing them, so a
    different player can still pick up their own copy later - but that
    was gated purely on netgame, which local splitscreen players aren't.
    Extend both checks to netgame || splitscreen, so each splitscreen
    player gets their own weapon/key pickup from a shared spawn instead of
    only the first player to reach it.

    Verified with a temporary self-triggering test (not committed): player
    0 touching a shotgun pickup leaves the mobj in the world, and player 1
    independently receives their own copy from the same pickup afterward.

    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---
 src/doom/p_inter.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

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

-    if (netgame
+    // 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)
 	&& (deathmatch!=2)
 	 && !dropped )
     {
@@ -416,51 +421,57 @@ P_TouchSpecialThing

 	// cards
 	// leave cards for everyone
+	// (also splitscreen - see doomstat.h - same reasoning as
+	// P_GiveWeapon's netgame check: multiple simultaneous players
+	// sharing one level need this whether or not they're on separate
+	// networked machines, or a splitscreen player who reaches a key
+	// after another player already grabbed it can end up permanently
+	// unable to get their own copy)
       case SPR_BKEY:
 	if (!player->cards[it_bluecard])
 	    player->message = DEH_String(GOTBLUECARD);
 	P_GiveCard (player, it_bluecard);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;
-
+
       case SPR_YKEY:
 	if (!player->cards[it_yellowcard])
 	    player->message = DEH_String(GOTYELWCARD);
 	P_GiveCard (player, it_yellowcard);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;
-
+
       case SPR_RKEY:
 	if (!player->cards[it_redcard])
 	    player->message = DEH_String(GOTREDCARD);
 	P_GiveCard (player, it_redcard);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;
-
+
       case SPR_BSKU:
 	if (!player->cards[it_blueskull])
 	    player->message = DEH_String(GOTBLUESKUL);
 	P_GiveCard (player, it_blueskull);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;
-
+
       case SPR_YSKU:
 	if (!player->cards[it_yellowskull])
 	    player->message = DEH_String(GOTYELWSKUL);
 	P_GiveCard (player, it_yellowskull);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;
-
+
       case SPR_RSKU:
 	if (!player->cards[it_redskull])
 	    player->message = DEH_String(GOTREDSKULL);
 	P_GiveCard (player, it_redskull);
-	if (!netgame)
+	if (!netgame && !splitscreen)
 	    break;
 	return;