REDIVIVUS

Proposals / #1256

Mac SpawnUnitByType: D2UnitStrc* __cdecl 7-arg (pGame, pRoom, eUnitType, nClassId, nX, nY, bInitItem)

checked · by KierTaylor · submitted 2026-11-06

The Mac body reads seven stack args, [EBP+8]..[EBP+0x20], and forwards them in the same roles as the Windows twin 0x005557d0: pGame, pRoom, eUnitType (compared with UNIT_OBJECT/UNIT_MONSTER/UNIT_ITEM), nClassId (0x23d/0x23e checks), nX, nY, and bInitItem (the last arg to SpawnMonster/SERVER_InitUnitObject and the 8th to CreateUnit). It returns the created unit in EAX, then a plain RET. The caller SUNIT_SpawnPresetUnit 0x00279aa9 stores [ESP]..[ESP+0x18] (7 args) and tests EAX. Windows' extra dwParam8 is never read there and has no Mac slot.

Changes 1, applied together

  1. Set prototype mac 0x002798db

    signatureundefined SpawnUnitByType(void)→D2UnitStrc* SpawnUnitByType(D2GameStrc* pGame, D2RoomStrc* pRoom, eD2UnitType eUnitType, int nClassId, int32_t nX, int32_t nY, int32_t bInitItem)
    conventionunknown→__cdecl