load_mon_data.asm 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. LoadMonData_:
  2. ; Load monster [wWhichPokemon] from list [wMonDataLocation]:
  3. ; 0: partymon
  4. ; 1: enemymon
  5. ; 2: boxmon
  6. ; 3: daycaremon
  7. ; Return monster id at wcf91 and its data at wLoadedMon.
  8. ; Also load base stats at wMonHeader for convenience.
  9. ld a, [wDayCareMonSpecies]
  10. ld [wcf91], a
  11. ld a, [wMonDataLocation]
  12. cp DAYCARE_DATA
  13. jr z, .GetMonHeader
  14. ld a, [wWhichPokemon]
  15. ld e, a
  16. callab GetMonSpecies
  17. .GetMonHeader
  18. ld a, [wcf91]
  19. ld [wd0b5], a ; input for GetMonHeader
  20. call GetMonHeader
  21. ld hl, wPartyMons
  22. ld bc, wPartyMon2 - wPartyMon1
  23. ld a, [wMonDataLocation]
  24. cp ENEMY_PARTY_DATA
  25. jr c, .getMonEntry
  26. ld hl, wEnemyMons
  27. jr z, .getMonEntry
  28. cp 2
  29. ld hl, wBoxMons
  30. ld bc, wBoxMon2 - wBoxMon1
  31. jr z, .getMonEntry
  32. ld hl, wDayCareMon
  33. jr .copyMonData
  34. .getMonEntry
  35. ld a, [wWhichPokemon]
  36. call AddNTimes
  37. .copyMonData
  38. ld de, wLoadedMon
  39. ld bc, wPartyMon2 - wPartyMon1
  40. jp CopyData