REDIVIVUS

Proposals / #1087

Type unit parameters held as int32_t as D2UnitStrc *

checked · by dtchitt · submitted 2026-11-03

Seven parameters typed int32_t are units: callers pass a D2UnitStrc *, and each body reads only D2UnitStrc fields, at their width. SetSfxAsyncTicks writes dwSfxAsyncTicks (0x80, uSideData at 0x64 plus 0x1c) and GetSfxTicks reads dwSfxTicks (0x7c, 0x64 plus 0x18). ITEMMODE_ValidateInventorySlot reads nUnitGUID (0xc) of the scroll it inserts, and passes the same register on as the D2UnitStrc * of INVENTORY_FindMatchingScrollBook. SKILLAMZ_GetPlagueJavelinCloudCount reads pInventory (0x60). MISSILE_InitializeVisual reads sSeed (0x20) and pPath (0x2c), PATH_CalculateMissilePath passes &sSeed (0x20) on as a D2SeedStrc *, and PLAYER_InteractAtTarget stores the parameter as sInteractInfo.pTarget, a D2UnitStrc *, then reads nUnitGUID (0xc).

Changes 7, applied together

  1. Retype variable win 0x004cabc0 EAX

    typeint32_t→D2UnitStrc *
  2. Retype variable win 0x004cab30 EAX

    typeint32_t→D2UnitStrc *
  3. Retype variable win 0x0055ffa0 EAX

    typeint32_t→D2UnitStrc *
  4. Retype variable win 0x005d92d0 EAX

    typeint32_t→D2UnitStrc *
  5. Retype variable win 0x004cc870 EDX

    typeint32_t→D2UnitStrc *
  6. Retype variable win 0x00649760 ECX

    typeint32_t→D2UnitStrc *
  7. Retype variable win 0x00461a70 ECX

    typeint32_t→D2UnitStrc *