REDIVIVUS

Proposals / #1235

Mac MONSTERAI_ValidateSwitchTarget: BOOL __fastcc (pUnit, ppUnit, pDistance, pCandidate, nDistance)

checked · by KierTaylor · submitted 2026-11-05

Resubmit of #1159 per review. Mac 0x001a66c0: fastcc, ECX=pUnit (EBX; [EBX]==0 player check, its path probed), EDX=ppUnit (in/out unit slot), stack [EBP+8]=pDistance (out), [EBP+0xc]=candidate unit, [EBP+0x10]=nDistance (<6 triggers the path probe); returns 0/1; plain RET. The 4th arg is a unit: at the call 0x001a5fb9 the caller stores [EBP-0x2c] to [ESP+4] (0x001a5fad) and after the call copies that same value into its out-unit slot (0x001a5fc2-0x001a5fc5). Windows twin 0x005dd510.

Changes 1, applied together

  1. Set prototype mac 0x001a66c0

    signatureundefined MONSTERAI_ValidateSwitchTarget(void)→BOOL MONSTERAI_ValidateSwitchTarget(D2UnitStrc * pUnit, D2UnitStrc * * ppUnit, int * pDistance, D2UnitStrc * pCandidate, int32_t nDistance)
    conventionunknown→__fastcc