Key pickup resets palette


A demonstration of a key pickup resetting the item pickup palette tint to its lowest level.

In Doom, picking up multiple items in quick succession results in the game's palette tint growing increasingly more yellow before fading back to normal. If the player picks up a key, however, the palette tint is immediately reset back to its second lowest level of yellow instead of fading normally.


The level of yellow palette tint for item pickups is controlled in Doom by a variable called player->bonuscount. Normally this variable is 0, but when it is greater than 0, it causes the game to display a yellow palette tint that grows increasingly yellow based on how large player->bonuscount is. player->bonuscount also decrements by 1 every tic until it returns to 0, causing the yellow palette tint to fade back to normal.

Doom has three separate functions for handling item pickups: P_TouchSpecialThing, P_GiveWeapon, and P_GiveCard. The first handles all pickups, but it calls the second to specially handle weapon pickups and the third to specially handle key pickups.

When a player picks up an item, P_TouchSpecialThing will call the following code at the end of the function:

  player->bonuscount += BONUSADD;

Where BONUSADD is defined as 6. If the item is a key, however, the game will first call P_GiveCard, which contains the following:

  player->bonuscount = BONUSADD;

Instead of adding 6 to player->bonuscount, this function sets it to 6 directly. This means that even if player->bonuscount is larger than 6 when a key is picked up, it will immediately drop to 6, and the yellow palette tint will decrease accordingly. (P_TouchSpecialThing will then immediately add another 6 to player->bonuscount, resulting in a final value of 12. This behavior also means that any key pickup will result in a yellow palette tint lasting twice as long as a normal single item pickup.)