pokemontower2.asm 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. PokemonTower2Script:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, PokemonTower2ScriptPointers
  4. ld a, [wPokemonTower2CurScript]
  5. jp CallFunctionInTable
  6. PokemonTower2Script_604fe:
  7. xor a
  8. ld [wJoyIgnore], a
  9. ld [wPokemonTower2CurScript], a
  10. ld [wCurMapScript], a
  11. ret
  12. PokemonTower2ScriptPointers:
  13. dw PokemonTower2Script0
  14. dw PokemonTower2Script1
  15. dw PokemonTower2Script2
  16. PokemonTower2Script0:
  17. CheckEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
  18. ret nz
  19. ld hl, CoordsData_6055e
  20. call ArePlayerCoordsInArray
  21. ret nc
  22. ld a, $ff
  23. ld [wNewSoundID], a
  24. call PlaySound
  25. ld c, BANK(Music_MeetRival)
  26. ld a, MUSIC_MEET_RIVAL
  27. call PlayMusic
  28. ResetEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
  29. ld a, [wCoordIndex]
  30. cp $1
  31. ld a, PLAYER_DIR_UP
  32. ld b, SPRITE_FACING_DOWN
  33. jr nz, .asm_60544
  34. ; the rival is on the left side and the player is on the right side
  35. SetEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
  36. ld a, PLAYER_DIR_LEFT
  37. ld b, SPRITE_FACING_RIGHT
  38. .asm_60544
  39. ld [wPlayerMovingDirection], a
  40. ld a, $1
  41. ld [H_SPRITEINDEX], a
  42. ld a, b
  43. ld [hSpriteFacingDirection], a
  44. call SetSpriteFacingDirectionAndDelay
  45. ld a, $1
  46. ld [hSpriteIndexOrTextID], a
  47. call DisplayTextID
  48. xor a
  49. ld [hJoyHeld], a
  50. ld [hJoyPressed], a
  51. ret
  52. CoordsData_6055e:
  53. db $05,$0F
  54. db $06,$0E
  55. db $0F ; isn't this supposed to end in $ff?
  56. PokemonTower2Script1:
  57. ld a, [wIsInBattle]
  58. cp $ff
  59. jp z, PokemonTower2Script_604fe
  60. ld a, $f0
  61. ld [wJoyIgnore], a
  62. SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
  63. ld a, $1
  64. ld [hSpriteIndexOrTextID], a
  65. call DisplayTextID
  66. ld de, MovementData_605b2
  67. CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
  68. jr nz, .asm_60589
  69. ld de, MovementData_605a9
  70. .asm_60589
  71. ld a, $1
  72. ld [H_SPRITEINDEX], a
  73. call MoveSprite
  74. ld a, $ff
  75. ld [wNewSoundID], a
  76. call PlaySound
  77. callba Music_RivalAlternateStart
  78. ld a, $2
  79. ld [wPokemonTower2CurScript], a
  80. ld [wCurMapScript], a
  81. ret
  82. MovementData_605a9:
  83. db NPC_MOVEMENT_RIGHT
  84. db NPC_MOVEMENT_DOWN
  85. db NPC_MOVEMENT_DOWN
  86. db NPC_MOVEMENT_RIGHT
  87. db NPC_MOVEMENT_DOWN
  88. db NPC_MOVEMENT_DOWN
  89. db NPC_MOVEMENT_RIGHT
  90. db NPC_MOVEMENT_RIGHT
  91. db $FF
  92. MovementData_605b2:
  93. db NPC_MOVEMENT_DOWN
  94. db NPC_MOVEMENT_DOWN
  95. db NPC_MOVEMENT_RIGHT
  96. db NPC_MOVEMENT_RIGHT
  97. db NPC_MOVEMENT_RIGHT
  98. db NPC_MOVEMENT_RIGHT
  99. db NPC_MOVEMENT_DOWN
  100. db NPC_MOVEMENT_DOWN
  101. db $FF
  102. PokemonTower2Script2:
  103. ld a, [wd730]
  104. bit 0, a
  105. ret nz
  106. ld a, HS_POKEMONTOWER_2_RIVAL
  107. ld [wMissableObjectIndex], a
  108. predef HideObject
  109. xor a
  110. ld [wJoyIgnore], a
  111. call PlayDefaultMusic
  112. ld a, $0
  113. ld [wPokemonTower2CurScript], a
  114. ld [wCurMapScript], a
  115. ret
  116. PokemonTower2TextPointers:
  117. dw PokemonTower2Text1
  118. dw PokemonTower2Text2
  119. PokemonTower2Text1:
  120. TX_ASM
  121. CheckEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
  122. jr z, .asm_16f24
  123. ld hl, PokemonTower2Text_6063c
  124. call PrintText
  125. jr .asm_41852
  126. .asm_16f24
  127. ld hl, PokemonTower2Text_6062d
  128. call PrintText
  129. ld hl, wd72d
  130. set 6, [hl]
  131. set 7, [hl]
  132. ld hl, PokemonTower2Text_60632
  133. ld de, PokemonTower2Text_60637
  134. call SaveEndBattleTextPointers
  135. ld a, OPP_SONY2
  136. ld [wCurOpponent], a
  137. ; select which team to use during the encounter
  138. ld a, [wRivalStarter]
  139. cp STARTER2
  140. jr nz, .NotSquirtle
  141. ld a, $4
  142. jr .done
  143. .NotSquirtle
  144. cp STARTER3
  145. jr nz, .Charmander
  146. ld a, $5
  147. jr .done
  148. .Charmander
  149. ld a, $6
  150. .done
  151. ld [wTrainerNo], a
  152. ld a, $1
  153. ld [wPokemonTower2CurScript], a
  154. ld [wCurMapScript], a
  155. .asm_41852
  156. jp TextScriptEnd
  157. PokemonTower2Text_6062d:
  158. TX_FAR _PokemonTower2Text_6062d
  159. db "@"
  160. PokemonTower2Text_60632:
  161. TX_FAR _PokemonTower2Text_60632
  162. db "@"
  163. PokemonTower2Text_60637:
  164. TX_FAR _PokemonTower2Text_60637
  165. db "@"
  166. PokemonTower2Text_6063c:
  167. TX_FAR _PokemonTower2Text_6063c
  168. db "@"
  169. PokemonTower2Text2:
  170. TX_FAR _PokemonTower2Text2
  171. db "@"