REDIVIVUS

Proposals / #1158

Mac MONSTERAI_FindEnergyMonster: uint32_t __cdecl ForEach callback (pGame, pUnit, pOther, pParams)

approved · by KierTaylor · submitted 2026-11-05, approved 2026-11-05

Mac 0x002b0993 is "undefined (void)", convention unknown. Its only code use is as the pBackupFunc (fpMonsterAiForEach) argument of ForEach (0x001a5625): AITHINK_Fn1_PutridDefiler stores its address at [ESP+0xc] (0x002b0a31/0x002b0a37) before CALL 0x001a5625 at 0x002b0a55. Body reads [EBP+0xc] (unit) and [EBP+0x10] (candidate), passes them to 0x00257526 and 0x001a5190, returns 0 or the candidate (CMOVBE EAX,ESI when distance <= 0x19); [EBP+8]/[EBP+0x14] unused; no ECX/EDX on entry; plain RET 0x002b09d1. 4 cdecl params as in fpMonsterAiForEach (4th left void* since the existing D2MonsterAiParameterStruct name fails the Strc rule); return as Windows twin 0x005efa50 (uint32_t).

Changes 1, applied together

  1. Set prototype mac 0x002b0993

    signatureundefined MONSTERAI_FindEnergyMonster(void)→uint32_t MONSTERAI_FindEnergyMonster(D2GameStrc * pGame, D2UnitStrc * pUnit, D2UnitStrc * pOther, void * pParams)
    conventionunknown→__cdecl