Pain state

A monster's pain state is an action frame used for that monster when being momentarily stunned by a damaging attack. Each monster type has a different probability of suffering this effect when hurt. The stronger and larger (and even rarer) the monster is, the lower this probability becomes. This probability is called the monster's pain chance (from DeHackEd). The monster, when in pain from being hit by a projectile or shot, clawed or bitten, or punched or chainsawed, halts its movement or attack and displays its pain state sprite frame while usually giving a cry of pain, and then continues moving or possibly retaliates against its attacker.

The chaingun is particularly useful against monsters with a high pain chance, as due to its rapid rate of fire each bullet causes the monster to cringe convulsively in pain (called "doing the chaingun cha-cha" in the original Doom manual). These include imps, demons, lost souls, cacodemons, pain elementals, mancubi, arachnotrons and revenants.

For those monsters with a low pain chance, the shotguns or plasma guns are more effective. Only the player and the lost soul have a 100% pain chance. The player's pain state includes a reddening effect of the screen, as well as the third-person view sprite frame.

Technical
The pain chance is handled in P_DamageMobj in p_inter.c. This is the generic "hurt something" code which is called for all damage events. There are no situations in the game where multiple separate damage events are combined into one pain chance check. For example, for rocket splashes, P_RadiusAttack from p_map.c calls P_DamageMobj individually for each splash it makes, and the direct hit is also a separate call. BFG tracers and shotgun pellets also call P_DamageMobj individually for each one, even if many hit one target. A straightforward consequence of this handling is that attacks with many individual components, like super shotgun hits or BFG tracers, are very likely to give a monster pain, because the pain chance check only needs to succeed for one component.

Although different monsters generally have different sounds, several share the same "pain cry". For example, former humans of whatever type, imps, and revenants share one particularly human-sounding cry, whereas a second common one, a monotonous moan, is shared by demons/spectres, lost souls, cacodemons, arachnotrons, hell knights/barons of hell, and cyberdemons. A few, such as pain elementals, mancubi, and arch-viles, have their own unique pain cries.