Ouch face

From DoomWiki.org

Revision as of 00:20, 3 October 2012 by Jartapran (talk | contribs) (Removed a redundant sentence.)


Ouch face being demonstrated on E1M4 (see demo below)

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 during that period, which is a rare occurrence.

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. The most common way, however, 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.

Technical

The ouch face being triggered on E1M4 by the player picking up a soul sphere while simultaneously taking rocket damage.

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

File:DOOM GUY.jpg
Ouch face in the Xbox 360 version of Doom.

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.[1]

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

See also