REDIVIVUS

Proposals / #1250

Mac SKILLNEC_AddHitpoints: int32_t __fastcall (D2UnitStrc* pUnit ECX, int32_t nHpAmount EDX)

checked · by KierTaylor · submitted 2026-11-06

The Mac prologue saves ECX (pUnit, passed as the unit to the stat get/set calls with stat 6 = hitpoints) and EDX (nHpAmount, tested with JLE and added to the current HP). There are no stack-arg reads and it ends in a plain RET. EAX = the HP actually added (EBX), and every caller uses it (SUB EDI,EAX at 0x00266d57, SUB ESI,EAX at 0x00267ae8). The callers load ECX/EDX just before the CALL. The Windows twin 0x005c5f10 has the same role (pUnit, nHpAmount -> int32_t), there in EBX/EAX.

Changes 1, applied together

  1. Set prototype mac 0x00266dbe

    signatureundefined SKILLNEC_AddHitpoints(void)→int32_t SKILLNEC_AddHitpoints(D2UnitStrc* pUnit, int32_t nHpAmount)
    conventionunknown→__fastcall