Changes

From DoomWiki.org

Melee attack

4 bytes added, 20:58, 26 October 2005
m
link angle
A number of the Doom [[monsters]] can perform melee attacks in the form of clawing, biting or (in one case) punching. In fact, [[Demon]]s, [[Spectre]]s and [[Lost Soul]]s have only melee attacks. Others have both melee and ranged attacks—these are the [[Imp]], [[Cacodemon]], [[Revenant]], [[Hell Knight]] and [[Baron of Hell]]. [[Player]]s can perform melee attacks using the [[fists]] or the [[chainsaw]].
In the [[Doom source code]], there is a constant <tt>MELEERANGE</tt> defined as <tt>64*FRACUNIT</tt>. For a player, this means that a melee attack will be successful only if the target is no farther than 64 map units away. Using the [[angle ]] the player is facing, the map point <tt>MELEERANGE</tt> units away is determined trigonometrically. Then the [[hitscan]] function is invoked, which will damage the first vulnerable thing (if any) along the line to that point.
For monsters that have melee attacks, the function <tt>P_CheckMeleeRange</tt> is called, and it returns <tt>true</tt> if a melee attack will be successful. If so, damage is inflicted immediately; if not, a ranged attack (if any) is launched.
1,464
edits