Picked up a medikit that you REALLY need!

The original Doom source code included provision for a special message to be displayed when the user picked up a medikit while their health was low. Instead of the usual "Picked up a medikit" message, "Picked up a medikit that you REALLY need!" was supposed to be displayed.

Because of a logic error in the implementation, this message is never displayed. The following is an excerpt from p_inter.c:

case SPR_MEDI: if (!P_GiveBody (player, 25)) return; if (player->health < 25) player->message = GOTMEDINEED; else player->message = GOTMEDIKIT; break;

This section of source code implements the medikit powerup logic. If the player's health is less than 25%, the "Picked up a medikit that you REALLY need!" message should be displayed. However, the code which gives the player the extra health is placed before the check is made. Because a medikit gives 25% extra health, the player's health is always at least 25% before the check. As a result, the normal "Picked up a medikit" message is always displayed and the special message is never shown.

A fixed version of the code is as follows:

case SPR_MEDI: if (player->health < 25) player->message = GOTMEDINEED; else player->message = GOTMEDIKIT; if (!P_GiveBody (player, 25)) return; break;