hidden_object_functions7.asm 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. PrintNewBikeText:
  2. call EnableAutoTextBoxDrawing
  3. tx_pre_jump NewBicycleText
  4. NewBicycleText:
  5. TX_FAR _NewBicycleText
  6. db "@"
  7. DisplayOakLabLeftPoster:
  8. call EnableAutoTextBoxDrawing
  9. tx_pre_jump PushStartText
  10. PushStartText:
  11. TX_FAR _PushStartText
  12. db "@"
  13. DisplayOakLabRightPoster:
  14. call EnableAutoTextBoxDrawing
  15. ld hl, wPokedexOwned
  16. ld b, wPokedexOwnedEnd - wPokedexOwned
  17. call CountSetBits
  18. ld a, [wNumSetBits]
  19. cp 2
  20. tx_pre_id SaveOptionText
  21. jr c, .ownLessThanTwo
  22. ; own two or more mon
  23. tx_pre_id StrengthsAndWeaknessesText
  24. .ownLessThanTwo
  25. jp PrintPredefTextID
  26. SaveOptionText:
  27. TX_FAR _SaveOptionText
  28. db "@"
  29. StrengthsAndWeaknessesText:
  30. TX_FAR _StrengthsAndWeaknessesText
  31. db "@"
  32. SafariZoneCheck:
  33. CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone,
  34. jr z, SafariZoneGameStillGoing ; don't bother printing game over text
  35. ld a, [wNumSafariBalls]
  36. and a
  37. jr z, SafariZoneGameOver
  38. jr SafariZoneGameStillGoing
  39. SafariZoneCheckSteps:
  40. ld a, [wSafariSteps]
  41. ld b, a
  42. ld a, [wSafariSteps + 1]
  43. ld c, a
  44. or b
  45. jr z, SafariZoneGameOver
  46. dec bc
  47. ld a, b
  48. ld [wSafariSteps], a
  49. ld a, c
  50. ld [wSafariSteps + 1], a
  51. SafariZoneGameStillGoing:
  52. xor a
  53. ld [wSafariZoneGameOver], a
  54. ret
  55. SafariZoneGameOver:
  56. call EnableAutoTextBoxDrawing
  57. xor a
  58. ld [wAudioFadeOutControl], a
  59. dec a
  60. call PlaySound
  61. ld c, BANK(SFX_Safari_Zone_PA)
  62. ld a, SFX_SAFARI_ZONE_PA
  63. call PlayMusic
  64. .waitForMusicToPlay
  65. ld a, [wChannelSoundIDs + Ch4]
  66. cp SFX_SAFARI_ZONE_PA
  67. jr nz, .waitForMusicToPlay
  68. ld a, TEXT_SAFARI_GAME_OVER
  69. ld [hSpriteIndexOrTextID], a
  70. call DisplayTextID
  71. xor a
  72. ld [wPlayerMovingDirection], a
  73. ld a, SAFARI_ZONE_ENTRANCE
  74. ld [hWarpDestinationMap], a
  75. ld a, $3
  76. ld [wDestinationWarpID], a
  77. ld a, $5
  78. ld [wSafariZoneEntranceCurScript], a
  79. SetEvent EVENT_SAFARI_GAME_OVER
  80. ld a, 1
  81. ld [wSafariZoneGameOver], a
  82. ret
  83. PrintSafariGameOverText:
  84. xor a
  85. ld [wJoyIgnore], a
  86. ld hl, SafariGameOverText
  87. jp PrintText
  88. SafariGameOverText:
  89. TX_ASM
  90. ld a, [wNumSafariBalls]
  91. and a
  92. jr z, .noMoreSafariBalls
  93. ld hl, TimesUpText
  94. call PrintText
  95. .noMoreSafariBalls
  96. ld hl, GameOverText
  97. call PrintText
  98. jp TextScriptEnd
  99. TimesUpText:
  100. TX_FAR _TimesUpText
  101. db "@"
  102. GameOverText:
  103. TX_FAR _GameOverText
  104. db "@"
  105. PrintCinnabarQuiz:
  106. ld a, [wSpriteStateData1 + 9]
  107. cp SPRITE_FACING_UP
  108. ret nz
  109. call EnableAutoTextBoxDrawing
  110. tx_pre_jump CinnabarGymQuiz
  111. CinnabarGymQuiz:
  112. TX_ASM
  113. xor a
  114. ld [wOpponentAfterWrongAnswer], a
  115. ld a, [wHiddenObjectFunctionArgument]
  116. push af
  117. and $f
  118. ld [hGymGateIndex], a
  119. pop af
  120. and $f0
  121. swap a
  122. ld [$ffdc], a
  123. ld hl, CinnabarGymQuizIntroText
  124. call PrintText
  125. ld a, [hGymGateIndex]
  126. dec a
  127. add a
  128. ld d, 0
  129. ld e, a
  130. ld hl, CinnabarQuizQuestions
  131. add hl, de
  132. ld a, [hli]
  133. ld h, [hl]
  134. ld l, a
  135. call PrintText
  136. ld a, 1
  137. ld [wDoNotWaitForButtonPressAfterDisplayingText], a
  138. call CinnabarGymQuiz_1ea92
  139. jp TextScriptEnd
  140. CinnabarGymQuizIntroText:
  141. TX_FAR _CinnabarGymQuizIntroText
  142. db "@"
  143. CinnabarQuizQuestions:
  144. dw CinnabarQuizQuestionsText1
  145. dw CinnabarQuizQuestionsText2
  146. dw CinnabarQuizQuestionsText3
  147. dw CinnabarQuizQuestionsText4
  148. dw CinnabarQuizQuestionsText5
  149. dw CinnabarQuizQuestionsText6
  150. CinnabarQuizQuestionsText1:
  151. TX_FAR _CinnabarQuizQuestionsText1
  152. db "@"
  153. CinnabarQuizQuestionsText2:
  154. TX_FAR _CinnabarQuizQuestionsText2
  155. db "@"
  156. CinnabarQuizQuestionsText3:
  157. TX_FAR _CinnabarQuizQuestionsText3
  158. db "@"
  159. CinnabarQuizQuestionsText4:
  160. TX_FAR _CinnabarQuizQuestionsText4
  161. db "@"
  162. CinnabarQuizQuestionsText5:
  163. TX_FAR _CinnabarQuizQuestionsText5
  164. db "@"
  165. CinnabarQuizQuestionsText6:
  166. TX_FAR _CinnabarQuizQuestionsText6
  167. db "@"
  168. CinnabarGymGateFlagAction:
  169. EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
  170. predef_jump FlagActionPredef
  171. CinnabarGymQuiz_1ea92:
  172. call YesNoChoice
  173. ld a, [$ffdc]
  174. ld c, a
  175. ld a, [wCurrentMenuItem]
  176. cp c
  177. jr nz, .wrongAnswer
  178. ld hl, wCurrentMapScriptFlags
  179. set 5, [hl]
  180. ld a, [hGymGateIndex]
  181. ld [$ffe0], a
  182. ld hl, CinnabarGymQuizCorrectText
  183. call PrintText
  184. ld a, [$ffe0]
  185. AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
  186. ld c, a
  187. ld b, FLAG_SET
  188. call CinnabarGymGateFlagAction
  189. jp UpdateCinnabarGymGateTileBlocks_
  190. .wrongAnswer
  191. call WaitForSoundToFinish
  192. ld a, SFX_DENIED
  193. call PlaySound
  194. call WaitForSoundToFinish
  195. ld hl, CinnabarGymQuizIncorrectText
  196. call PrintText
  197. ld a, [hGymGateIndex]
  198. add $2
  199. AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
  200. ld c, a
  201. ld b, FLAG_TEST
  202. EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
  203. predef FlagActionPredef
  204. ld a, c
  205. and a
  206. ret nz
  207. ld a, [hGymGateIndex]
  208. add $2
  209. ld [wOpponentAfterWrongAnswer], a
  210. ret
  211. CinnabarGymQuizCorrectText:
  212. TX_SFX_ITEM_1
  213. TX_FAR _CinnabarGymQuizCorrectText
  214. TX_BLINK
  215. TX_ASM
  216. ld a, [$ffe0]
  217. AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
  218. ld c, a
  219. ld b, FLAG_TEST
  220. call CinnabarGymGateFlagAction
  221. ld a, c
  222. and a
  223. jp nz, TextScriptEnd
  224. call WaitForSoundToFinish
  225. ld a, SFX_GO_INSIDE
  226. call PlaySound
  227. call WaitForSoundToFinish
  228. jp TextScriptEnd
  229. CinnabarGymQuizIncorrectText:
  230. TX_FAR _CinnabarGymQuizIncorrectText
  231. db "@"
  232. UpdateCinnabarGymGateTileBlocks_:
  233. ; Update the overworld map with open floor blocks or locked gate blocks
  234. ; depending on event flags.
  235. ld a, 6
  236. ld [hGymGateIndex], a
  237. .loop
  238. ld a, [hGymGateIndex]
  239. dec a
  240. add a
  241. add a
  242. ld d, 0
  243. ld e, a
  244. ld hl, CinnabarGymGateCoords
  245. add hl, de
  246. ld a, [hli]
  247. ld b, [hl]
  248. ld c, a
  249. inc hl
  250. ld a, [hl]
  251. ld [wGymGateTileBlock], a
  252. push bc
  253. ld a, [hGymGateIndex]
  254. ld [$ffe0], a
  255. AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
  256. ld c, a
  257. ld b, FLAG_TEST
  258. call CinnabarGymGateFlagAction
  259. ld a, c
  260. and a
  261. jr nz, .unlocked
  262. ld a, [wGymGateTileBlock]
  263. jr .next
  264. .unlocked
  265. ld a, $e
  266. .next
  267. pop bc
  268. ld [wNewTileBlockID], a
  269. predef ReplaceTileBlock
  270. ld hl, hGymGateIndex
  271. dec [hl]
  272. jr nz, .loop
  273. ret
  274. CinnabarGymGateCoords:
  275. ; format: x-coord, y-coord, direction, padding
  276. ; direction: $54 = horizontal gate, $5f = vertical gate
  277. db $09,$03,$54,$00
  278. db $06,$03,$54,$00
  279. db $06,$06,$54,$00
  280. db $03,$08,$5f,$00
  281. db $02,$06,$54,$00
  282. db $02,$03,$54,$00
  283. PrintMagazinesText:
  284. call EnableAutoTextBoxDrawing
  285. tx_pre MagazinesText
  286. ret
  287. MagazinesText:
  288. TX_FAR _MagazinesText
  289. db "@"
  290. BillsHousePC:
  291. call EnableAutoTextBoxDrawing
  292. ld a, [wSpriteStateData1 + 9]
  293. cp SPRITE_FACING_UP
  294. ret nz
  295. CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING
  296. jr nz, .displayBillsHousePokemonList
  297. CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL
  298. jr nz, .displayBillsHouseMonitorText
  299. CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR
  300. jr nz, .doCellSeparator
  301. .displayBillsHouseMonitorText
  302. tx_pre_jump BillsHouseMonitorText
  303. .doCellSeparator
  304. ld a, $1
  305. ld [wDoNotWaitForButtonPressAfterDisplayingText], a
  306. tx_pre BillsHouseInitiatedText
  307. ld c, 32
  308. call DelayFrames
  309. ld a, SFX_TINK
  310. call PlaySound
  311. call WaitForSoundToFinish
  312. ld c, 80
  313. call DelayFrames
  314. ld a, SFX_SHRINK
  315. call PlaySound
  316. call WaitForSoundToFinish
  317. ld c, 48
  318. call DelayFrames
  319. ld a, SFX_TINK
  320. call PlaySound
  321. call WaitForSoundToFinish
  322. ld c, 32
  323. call DelayFrames
  324. ld a, SFX_GET_ITEM_1
  325. call PlaySound
  326. call WaitForSoundToFinish
  327. call PlayDefaultMusic
  328. SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
  329. ret
  330. .displayBillsHousePokemonList
  331. ld a, $1
  332. ld [wDoNotWaitForButtonPressAfterDisplayingText], a
  333. tx_pre BillsHousePokemonList
  334. ret
  335. BillsHouseMonitorText:
  336. TX_FAR _BillsHouseMonitorText
  337. db "@"
  338. BillsHouseInitiatedText:
  339. TX_FAR _BillsHouseInitiatedText
  340. TX_BLINK
  341. TX_ASM
  342. ld a, $ff
  343. ld [wNewSoundID], a
  344. call PlaySound
  345. ld c, 16
  346. call DelayFrames
  347. ld a, SFX_SWITCH
  348. call PlaySound
  349. call WaitForSoundToFinish
  350. ld c, 60
  351. call DelayFrames
  352. jp TextScriptEnd
  353. BillsHousePokemonList:
  354. TX_ASM
  355. call SaveScreenTilesToBuffer1
  356. ld hl, BillsHousePokemonListText1
  357. call PrintText
  358. xor a
  359. ld [wMenuItemOffset], a ; not used
  360. ld [wCurrentMenuItem], a
  361. ld [wLastMenuItem], a
  362. ld a, A_BUTTON | B_BUTTON
  363. ld [wMenuWatchedKeys], a
  364. ld a, 4
  365. ld [wMaxMenuItem], a
  366. ld a, 2
  367. ld [wTopMenuItemY], a
  368. ld a, 1
  369. ld [wTopMenuItemX], a
  370. .billsPokemonLoop
  371. ld hl, wd730
  372. set 6, [hl]
  373. coord hl, 0, 0
  374. ld b, 10
  375. ld c, 9
  376. call TextBoxBorder
  377. coord hl, 2, 2
  378. ld de, BillsMonListText
  379. call PlaceString
  380. ld hl, BillsHousePokemonListText2
  381. call PrintText
  382. call SaveScreenTilesToBuffer2
  383. call HandleMenuInput
  384. bit 1, a ; pressed b
  385. jr nz, .cancel
  386. ld a, [wCurrentMenuItem]
  387. add EEVEE
  388. cp EEVEE
  389. jr z, .displayPokedex
  390. cp FLAREON
  391. jr z, .displayPokedex
  392. cp JOLTEON
  393. jr z, .displayPokedex
  394. cp VAPOREON
  395. jr z, .displayPokedex
  396. jr .cancel
  397. .displayPokedex
  398. call DisplayPokedex
  399. call LoadScreenTilesFromBuffer2
  400. jr .billsPokemonLoop
  401. .cancel
  402. ld hl, wd730
  403. res 6, [hl]
  404. call LoadScreenTilesFromBuffer2
  405. jp TextScriptEnd
  406. BillsHousePokemonListText1:
  407. TX_FAR _BillsHousePokemonListText1
  408. db "@"
  409. BillsMonListText:
  410. db "EEVEE"
  411. next "FLAREON"
  412. next "JOLTEON"
  413. next "VAPOREON"
  414. next "CANCEL@"
  415. BillsHousePokemonListText2:
  416. TX_FAR _BillsHousePokemonListText2
  417. db "@"
  418. DisplayOakLabEmailText:
  419. ld a, [wSpriteStateData1 + 9]
  420. cp SPRITE_FACING_UP
  421. ret nz
  422. call EnableAutoTextBoxDrawing
  423. tx_pre_jump OakLabEmailText
  424. OakLabEmailText:
  425. TX_FAR _OakLabEmailText
  426. db "@"