pewtergym.asm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. PewterGymScript:
  2. ld hl, wCurrentMapScriptFlags
  3. bit 6, [hl]
  4. res 6, [hl]
  5. call nz, PewterGymScript_5c3a4
  6. call EnableAutoTextBoxDrawing
  7. ld hl, PewterGymTrainerHeader0
  8. ld de, PewterGymScriptPointers
  9. ld a, [wPewterGymCurScript]
  10. call ExecuteCurMapScriptInTable
  11. ld [wPewterGymCurScript], a
  12. ret
  13. PewterGymScript_5c3a4:
  14. ld hl, Gym1CityName
  15. ld de, Gym1LeaderName
  16. jp LoadGymLeaderAndCityName
  17. Gym1CityName:
  18. db "PEWTER CITY@"
  19. Gym1LeaderName:
  20. db "BROCK@"
  21. PewterGymScript_5c3bf:
  22. xor a
  23. ld [wJoyIgnore], a
  24. ld [wPewterGymCurScript], a
  25. ld [wCurMapScript], a
  26. ret
  27. PewterGymScriptPointers:
  28. dw CheckFightingMapTrainers
  29. dw DisplayEnemyTrainerTextAndStartBattle
  30. dw EndTrainerBattle
  31. dw PewterGymScript3
  32. PewterGymScript3:
  33. ld a, [wIsInBattle]
  34. cp $ff
  35. jp z, PewterGymScript_5c3bf
  36. ld a, $f0
  37. ld [wJoyIgnore], a
  38. PewterGymScript_5c3df:
  39. ld a, $4
  40. ld [hSpriteIndexOrTextID], a
  41. call DisplayTextID
  42. SetEvent EVENT_BEAT_BROCK
  43. lb bc, TM_34, 1
  44. call GiveItem
  45. jr nc, .BagFull
  46. ld a, $5
  47. ld [hSpriteIndexOrTextID], a
  48. call DisplayTextID
  49. SetEvent EVENT_GOT_TM34
  50. jr .asm_5c408
  51. .BagFull
  52. ld a, $6
  53. ld [hSpriteIndexOrTextID], a
  54. call DisplayTextID
  55. .asm_5c408
  56. ld hl, wObtainedBadges
  57. set 0, [hl]
  58. ld hl, wBeatGymFlags
  59. set 0, [hl]
  60. ld a, HS_GYM_GUY
  61. ld [wMissableObjectIndex], a
  62. predef HideObject
  63. ld a, HS_ROUTE_22_RIVAL_1
  64. ld [wMissableObjectIndex], a
  65. predef HideObject
  66. ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE
  67. ; deactivate gym trainers
  68. SetEvent EVENT_BEAT_PEWTER_GYM_TRAINER_0
  69. jp PewterGymScript_5c3bf
  70. PewterGymTextPointers:
  71. dw PewterGymText1
  72. dw PewterGymText2
  73. dw PewterGymText3
  74. dw PewterGymText4
  75. dw PewterGymText5
  76. dw PewterGymText6
  77. PewterGymTrainerHeader0:
  78. dbEventFlagBit EVENT_BEAT_PEWTER_GYM_TRAINER_0
  79. db ($5 << 4) ; trainer's view range
  80. dwEventFlagAddress EVENT_BEAT_PEWTER_GYM_TRAINER_0
  81. dw PewterGymBattleText1 ; TextBeforeBattle
  82. dw PewterGymAfterBattleText1 ; TextAfterBattle
  83. dw PewterGymEndBattleText1 ; TextEndBattle
  84. dw PewterGymEndBattleText1 ; TextEndBattle
  85. db $ff
  86. PewterGymText1:
  87. TX_ASM
  88. CheckEvent EVENT_BEAT_BROCK
  89. jr z, .asm_5c46a
  90. CheckEventReuseA EVENT_GOT_TM34
  91. jr nz, .asm_5c462
  92. call z, PewterGymScript_5c3df
  93. call DisableWaitingAfterTextDisplay
  94. jr .asm_5c49b
  95. .asm_5c462
  96. ld hl, PewterGymText_5c4a3
  97. call PrintText
  98. jr .asm_5c49b
  99. .asm_5c46a
  100. ld hl, PewterGymText_5c49e
  101. call PrintText
  102. ld hl, wd72d
  103. set 6, [hl]
  104. set 7, [hl]
  105. ld hl, PewterGymText_5c4bc
  106. ld de, PewterGymText_5c4bc
  107. call SaveEndBattleTextPointers
  108. ld a, [H_SPRITEINDEX]
  109. ld [wSpriteIndex], a
  110. call EngageMapTrainer
  111. call InitBattleEnemyParameters
  112. ld a, $1
  113. ld [wGymLeaderNo], a
  114. xor a
  115. ld [hJoyHeld], a
  116. ld a, $3
  117. ld [wPewterGymCurScript], a
  118. ld [wCurMapScript], a
  119. .asm_5c49b
  120. jp TextScriptEnd
  121. PewterGymText_5c49e:
  122. TX_FAR _PewterGymText_5c49e
  123. db "@"
  124. PewterGymText_5c4a3:
  125. TX_FAR _PewterGymText_5c4a3
  126. db "@"
  127. PewterGymText4:
  128. TX_FAR _TM34PreReceiveText
  129. db "@"
  130. PewterGymText5:
  131. TX_FAR _ReceivedTM34Text
  132. TX_SFX_ITEM_1
  133. TX_FAR _TM34ExplanationText
  134. db "@"
  135. PewterGymText6:
  136. TX_FAR _TM34NoRoomText
  137. db "@"
  138. PewterGymText_5c4bc:
  139. TX_FAR _PewterGymText_5c4bc
  140. TX_SFX_LEVEL_UP ; probably supposed to play SFX_GET_ITEM_1 but the wrong music bank is loaded
  141. TX_FAR _PewterGymText_5c4c1
  142. db "@"
  143. PewterGymText2:
  144. TX_ASM
  145. ld hl, PewterGymTrainerHeader0
  146. call TalkToTrainer
  147. jp TextScriptEnd
  148. PewterGymBattleText1:
  149. TX_FAR _PewterGymBattleText1
  150. db "@"
  151. PewterGymEndBattleText1:
  152. TX_FAR _PewterGymEndBattleText1
  153. db "@"
  154. PewterGymAfterBattleText1:
  155. TX_FAR _PewterGymAfterBattleText1
  156. db "@"
  157. PewterGymText3:
  158. TX_ASM
  159. ld a, [wBeatGymFlags]
  160. bit 0, a
  161. jr nz, .asm_5c50c
  162. ld hl, PewterGymText_5c515
  163. call PrintText
  164. call YesNoChoice
  165. ld a, [wCurrentMenuItem]
  166. and a
  167. jr nz, .asm_5c4fe
  168. ld hl, PewterGymText_5c51a
  169. call PrintText
  170. jr .asm_5c504
  171. .asm_5c4fe
  172. ld hl, PewterGymText_5c524
  173. call PrintText
  174. .asm_5c504
  175. ld hl, PewterGymText_5c51f
  176. call PrintText
  177. jr .asm_5c512
  178. .asm_5c50c
  179. ld hl, PewterGymText_5c529
  180. call PrintText
  181. .asm_5c512
  182. jp TextScriptEnd
  183. PewterGymText_5c515:
  184. TX_FAR _PewterGymText_5c515
  185. db "@"
  186. PewterGymText_5c51a:
  187. TX_FAR _PewterGymText_5c51a
  188. db "@"
  189. PewterGymText_5c51f:
  190. TX_FAR _PewterGymText_5c51f
  191. db "@"
  192. PewterGymText_5c524:
  193. TX_FAR _PewterGymText_5c524
  194. db "@"
  195. PewterGymText_5c529:
  196. TX_FAR _PewterGymText_5c529
  197. db "@"