bank_e_misc.asm 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. ; formats a string at wMovesString that lists the moves at wMoves
  2. FormatMovesString:
  3. ld hl, wMoves
  4. ld de, wMovesString
  5. ld b, $0
  6. .printMoveNameLoop
  7. ld a, [hli]
  8. and a ; end of move list?
  9. jr z, .printDashLoop ; print dashes when no moves are left
  10. push hl
  11. ld [wd0b5], a
  12. ld a, BANK(MoveNames)
  13. ld [wPredefBank], a
  14. ld a, MOVE_NAME
  15. ld [wNameListType], a
  16. call GetName
  17. ld hl, wcd6d
  18. .copyNameLoop
  19. ld a, [hli]
  20. cp $50
  21. jr z, .doneCopyingName
  22. ld [de], a
  23. inc de
  24. jr .copyNameLoop
  25. .doneCopyingName
  26. ld a, b
  27. ld [wNumMovesMinusOne], a
  28. inc b
  29. ld a, $4e ; line break
  30. ld [de], a
  31. inc de
  32. pop hl
  33. ld a, b
  34. cp NUM_MOVES
  35. jr z, .done
  36. jr .printMoveNameLoop
  37. .printDashLoop
  38. ld a, "-"
  39. ld [de], a
  40. inc de
  41. inc b
  42. ld a, b
  43. cp NUM_MOVES
  44. jr z, .done
  45. ld a, $4e ; line break
  46. ld [de], a
  47. inc de
  48. jr .printDashLoop
  49. .done
  50. ld a, "@"
  51. ld [de], a
  52. ret
  53. ; XXX this is called in a few places, but it doesn't appear to do anything useful
  54. InitList:
  55. ld a, [wInitListType]
  56. cp INIT_ENEMYOT_LIST
  57. jr nz, .notEnemy
  58. ld hl, wEnemyPartyCount
  59. ld de, wEnemyMonOT
  60. ld a, ENEMYOT_NAME
  61. jr .done
  62. .notEnemy
  63. cp INIT_PLAYEROT_LIST
  64. jr nz, .notPlayer
  65. ld hl, wPartyCount
  66. ld de, wPartyMonOT
  67. ld a, PLAYEROT_NAME
  68. jr .done
  69. .notPlayer
  70. cp INIT_MON_LIST
  71. jr nz, .notMonster
  72. ld hl, wItemList
  73. ld de, MonsterNames
  74. ld a, MONSTER_NAME
  75. jr .done
  76. .notMonster
  77. cp INIT_BAG_ITEM_LIST
  78. jr nz, .notBag
  79. ld hl, wNumBagItems
  80. ld de, ItemNames
  81. ld a, ITEM_NAME
  82. jr .done
  83. .notBag
  84. ld hl, wItemList
  85. ld de, ItemNames
  86. ld a, ITEM_NAME
  87. .done
  88. ld [wNameListType], a
  89. ld a, l
  90. ld [wListPointer], a
  91. ld a, h
  92. ld [wListPointer + 1], a
  93. ld a, e
  94. ld [wUnusedCF8D], a
  95. ld a, d
  96. ld [wUnusedCF8D + 1], a
  97. ld bc, ItemPrices
  98. ld a, c
  99. ld [wItemPrices], a
  100. ld a, b
  101. ld [wItemPrices + 1], a
  102. ret
  103. ; get species of mon e in list [wMonDataLocation] for LoadMonData
  104. GetMonSpecies:
  105. ld hl, wPartySpecies
  106. ld a, [wMonDataLocation]
  107. and a
  108. jr z, .getSpecies
  109. dec a
  110. jr z, .enemyParty
  111. ld hl, wBoxSpecies
  112. jr .getSpecies
  113. .enemyParty
  114. ld hl, wEnemyPartyMons
  115. .getSpecies
  116. ld d, 0
  117. add hl, de
  118. ld a, [hl]
  119. ld [wcf91], a
  120. ret