Baron attacks a monster behind him


Revision as of 19:39, 5 January 2024 by Gregor (talk | contribs) (c temp, wl, code pointer - no compound → intra-wiki consistency)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When a baron of Hell or Hell knight is struck by another monster during his attack sequence, and changes his target without entering a pain state, he will attack the new target while still facing the original one. Thus the fireball or claw damage appears to emerge from his back.

This is a purely cosmetic anomaly and does not affect the underlying engine actions.

The reason for this is that the baron attack code pointer (A_BruisAttack) does not call A_FaceTarget. Looking in p_enemy.c, we can see that each monster attack code pointer (A_PosAttack, A_SPosAttack, A_CPosAttack, A_CPosRefire, A_SpidRefire, A_BspiAttack, A_TroopAttack, A_SargAttack, A_HeadAttack, A_CyberAttack, A_SkelMissile, A_SkelWhoosh, A_SkelFist, A_VileTarget, A_VileAttack, A_FatAttack1/2/3, A_SkullAttack, A_PainAttack) call the A_FaceTarget code pointer. A_BruisAttack is the only exception to this rule.

The baron and Hell knight attack sequence consists of three states (Hell knight states are identical except for BOS2 instead of BOSS):

    {SPR_BOSS,4,8,{A_FaceTarget},S_BOSS_ATK2,0,0},	// S_BOSS_ATK1
    {SPR_BOSS,5,8,{A_FaceTarget},S_BOSS_ATK3,0,0},	// S_BOSS_ATK2
    {SPR_BOSS,6,8,{A_BruisAttack},S_BOSS_RUN1,0,0},	// S_BOSS_ATK3

The first two states call A_FaceTarget, but there is an eight-tic delay between them and the next state. If the target changes (or changes position) during the eight tics of the second state, the attack takes place without adjusting the baron's angle to face the new target position.

External link[edit]