Ouch face

right|thumb|200px|The ouch face being triggered on E1M4 by the player picking up a soul sphere while simultaneously taking rocket damage. The ouch face is one of the status bar face graphics (STFOUCH*), for when the player is shocked by great pain. During normal play it is seen only rarely, and for a long time the face was considered an almost random occurrence.

When Doom's source code was released, it became apparent that the code that displayed the face was in error. The programmers had used the expression (plyr->health - st_oldhealth > ST_MUCHPAIN) instead of the correct expression (st_oldhealth - plyr->health > ST_MUCHPAIN). The code should have displayed the face whenever a player was subject to 20 hit points of damage or more during a single tic. As it is, the code only displays the face when the player gains more than 20 hit points whilst sustaining damage - a rare occurrence, most commonly trigged by picking up a large healing item or setting up the IDDQD cheat while being hurt.

There are several ways to see the ouch face. One is to start a level with the player standing on a damaging floor sector, such as in Memento Mori MAP13: The Inmost Dens II. Another way is to receive damage while simultaneously picking up a large health increasing item (such as by being hit by a projectile while picking up a supercharge, or using the iddqd cheat code while on a damaging floor; see the E1M3 demo in shareware Doom v1.666), resulting in a health which is far greater than it was before the series of events took place. Also, in Doom RPG the ouchface is seen when taking damage from behind.

Technical
The code relating to the bug is found in the file st_stuff.c and is as follows (comments added for clarity):

if (plyr->health - st_oldhealth > ST_MUCHPAIN) // ST_MUCHPAIN is 20 {     st_facecount = ST_TURNCOUNT;  // ST_TURNCOUNT is 35 st_faceindex = ST_calcPainOffset + ST_OUCHOFFSET; // ST_OUCHOFFSET is 5 }

The relevant portion is in the first line, which essentially states that the ouch face will only appear if the player's current health is more than 20 points greater than their health in the previous tic. Since this portion of code is only called when the player receives damage, it is very unusual through normal play for a player receiving damage to end up with a great deal more health than he started with.

Presence in ports


The Doom press release beta contained an apparently non-buggy version of the ouch face. Crossing pools of nukage or lava would result in a sustained ouch face until the player escaped the hazard.

Some modern source ports, such as ZDoom and Eternity, have reversed the code, resulting in behavior which is not present in the games out of the box, but correcting what could nevertheless be considered a "bug". A binary patch for the DOS executables similarly changing the face behavior has been written by the programmer of PrBoom+, Andrey Budko.

The Playstation and Sega Saturn console ports include the ouch face. It usually occurs when the player is hit from behind.

The official Xbox 360 port of Doom also has the ouch face, but it is harder to trigger and looks slightly different.

Demo

 * [[Media:stfouch-e1m4.lmp | Ouch face]] (file info) demonstrated on E1M4: Command Control (or watch it on YouTube)