REDIVIVUS

Proposals / #1262

Mac DAMAGE_CalculateAndApplyDamage: void __cdecl (pGame, pUnit, pVictim, D2DamageStrc* pDamage, byte byScale)

checked · by KierTaylor · submitted 2026-11-06

The Mac body reads [EBP+8] pGame, [EBP+0xc] pUnit and [EBP+0x10] pVictim (both NULL-checked), and [EBP+0x14] pDamage (its wResultFlags word at +4 is masked with 0x8381, flags byte at +0). Callers store five slots, and the fifth is a scale byte: MONSTER_AttackTarget 0x001da57e passes [ESP+0x10]=0x80 with [ESP+0xc]=&local damage struct; PowerStrike 0x00245f43 stores [ESP]..[ESP+0x10] and sets EAX=1 itself afterwards, so the callee's EAX is unused. Same roles and order as the Windows twin 0x0057dbf0.

Changes 1, applied together

  1. Set prototype mac 0x002801d1

    signatureundefined DAMAGE_CalculateAndApplyDamage(void)→void DAMAGE_CalculateAndApplyDamage(D2GameStrc* pGame, D2UnitStrc* pUnit, D2UnitStrc* pVictim, D2DamageStrc* pDamage, byte byScale)
    conventionunknown→__cdecl