Weapon pickup message not displayed in multiplayer

In multiplayer games, weapons do not disappear when picked up, as they do in a single-player game. There are some exceptions to this rule: in altdeath mode they do disappear, and weapons that are dropped by monsters always disappear. However, if the weapon does not disappear, the usual weapon pickup message also does not appear in the HUD.

Technical details
The code that handles weapon pickups is located in the file inside the function. This function contains a switch/case block that tries to identify the kind of thing that was touched by the player. The following is an example:

case SPR_SHOT: if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) ) return; player->message = GOTSHOTGUN; sound = sfx_wpnup; break;

The function is called; this function evaluates whether the player can take the weapon. The function usually returns if the player can take the weapon (in single player or altdeath). In cooperative or normal deathmatch, the code takes a different path: always returns. Because of this, returns, short-circuiting the code that usually displays the weapon pickup message.

Exiting this function early also skips the code that removes the weapon from the game (intended behavior for cooperative or normal deathmatch). When playing single-player or altdeath, the code continues inside the same function. This sets the correct weapon pickup message, but removes the weapon from the game.

Links

 * Explanation of the bug on Github