REDIVIVUS

Proposals / #715

Name generic parameters of the monster spawn wrappers and helpers

applied · by dtchitt · submitted 2026-11-01, applied 2026-11-02

Ghidra v1805 · 8293ab3

The five spawn wrappers copy these parameters into D2UnknownCreateMonsterStrc.nSpawnRadius (offset 0x20) and nFlags (offset 0x24) before calling CreateMonster, so they take the field names. FindMonsterAiCmd compares its parameter to nCmdArg[0]. MONSTER_GetMonsterClassByDifficulty walks NextInClass that many times, and callers load 0, 1 or 2. SPAWN_FindRandomPositionForMonster calls CheckWarpSpawnCoords only when its parameter is nonzero. SKILLS_GetSummonMonsterClassId forwards its parameter to a callee that reads MonStats spawn data when it is nonzero. Not proven: that every caller passes only 0 or 1 for the two b names, or what nCmdArg[0] means beyond being the lookup key. Chosen names that look wrong: on SKILLS_GetSummonMonsterClassId, nSummonMode reaches the callee's Skills.txt index and nSummonParam reaches an argument the callee never reads.

Changes 13, applied together

  1. Rename variable win 0x005b2490 Stack[0xc]

    namenParam→nSpawnRadius
  2. Rename variable win 0x005b2490 Stack[0x10]

    namenParam2→nFlags
  3. Rename variable win 0x005b23c0 Stack[0xc]

    namenParam→nSpawnRadius
  4. Rename variable win 0x005b23c0 Stack[0x10]

    namenParam2→nFlags
  5. Rename variable win 0x005b2f20 Stack[0x14]

    namenParam→nSpawnRadius
  6. Rename variable win 0x005b3040 Stack[0x18]

    namenParam→nSpawnRadius
  7. Rename variable win 0x005b3040 Stack[0x1c]

    namenParam2→nFlags
  8. Rename variable win 0x005b2f70 Stack[0x10]

    namenParam→nSpawnRadius
  9. Rename variable win 0x005b2f70 Stack[0x14]

    namenParam2→nFlags
  10. Rename variable win 0x0058eef0 EDX

    namenParam→nCmdArg0
  11. Rename variable win 0x0056e620 EDX

    namenParam→bUseMonsterSpawnData
  12. Rename variable win 0x0054da60 EDX

    namenParam→nDifficulty
  13. Rename variable win 0x0054dc40 Stack[0x14]

    namenParam→bCheckWarpDistance