REDIVIVUS

Proposals / #1412

Recover the Mac tile lookup's room/coordinate arguments and tile-pointer result

checked · by eejitgames · submitted 2026-11-07

Mac 001290cb is stored as undefined(void)/unknown, although it reads the room from ECX, X from EDX and Y from the first stack DWORD, then returns the matching 48-byte D2DrlgTileDataStrc or NULL in EAX. Both native calls in 00128fce set all three inputs and consume the full pointer. Complete body, sole caller, room-coordinate/floor-array callees and Windows counterpart 004cace0 agree: subtract room origins, signed divide by five, scan floor records by +0x30 for +8/+0xc coordinates. Declare D2DrlgTileDataStrc* __fastcc(D2RoomStrc*,int32_t,int32_t), retaining the chosen name. Mac register order differs from Windows custom ECX=X/EDX=room/EAX=Y and must not be copied blindly. Existing issue98 addresses Windows generator loop recovery, not this Mac calling contract.

Changes 1, applied together

  1. Set prototype mac 0x001290cb

    signatureundefined UNITSND_GetTileDataAtPosition(void)→D2DrlgTileDataStrc * UNITSND_GetTileDataAtPosition(D2RoomStrc * pRoom, int32_t nPosX, int32_t nPosY)
    conventionunknown→__fastcc