REDIVIVUS

Proposals / #1271

Mac SUNITNPC_SetItemForNpc: void __cdecl (pUnit npc, pUnit2 item, D2GameStrc* pGame, int32_t bVendorItem)

checked · by KierTaylor · submitted 2026-11-06

Matched to the Windows twin 0x005762c0 by role. [EBP+8] = pUnit, the NPC (Windows EDI: flag call, then its +0x60 inventory gets the item). [EBP+0xc] = pUnit2, the item (Windows ESI: item flag 0x10, OR [+0xc8],4, the 0xe9 check). [EBP+0x14] = bVendorItem (Windows [EBP+0xc], CMP 0 early-out). The third slot, [EBP+0x10], is the unused pGame slot, as on Windows ([EBP+8] there is never read). Callers store [ESP], [ESP+4], [ESP+0xc] (SellItem 0x0028721b passes 1; GenerateNpcItems 0x00285b9e passes its own flag). Windows' 5th unused dwParam has no Mac slot. Plain RET, void.

Changes 1, applied together

  1. Set prototype mac 0x0028566c

    signatureundefined SUNITNPC_SetItemForNpc(void)→void SUNITNPC_SetItemForNpc(D2UnitStrc* pUnit, D2UnitStrc* pUnit2, D2GameStrc* pGame, int32_t bVendorItem)
    conventionunknown→__cdecl