oak_speech.asm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. SetDefaultNames:
  2. ld a, [wLetterPrintingDelayFlags]
  3. push af
  4. ld a, [wOptions]
  5. push af
  6. ld a, [wd732]
  7. push af
  8. ld hl, wPlayerName
  9. ld bc, wBoxDataEnd - wPlayerName
  10. xor a
  11. call FillMemory
  12. ld hl, wSpriteStateData1
  13. ld bc, $200
  14. xor a
  15. call FillMemory
  16. pop af
  17. ld [wd732], a
  18. pop af
  19. ld [wOptions], a
  20. pop af
  21. ld [wLetterPrintingDelayFlags], a
  22. ld a, [wOptionsInitialized]
  23. and a
  24. call z, InitOptions
  25. ld hl, NintenText
  26. ld de, wPlayerName
  27. ld bc, NAME_LENGTH
  28. call CopyData
  29. ld hl, SonyText
  30. ld de, wRivalName
  31. ld bc, NAME_LENGTH
  32. jp CopyData
  33. OakSpeech:
  34. ld a, $FF
  35. call PlaySound ; stop music
  36. ld a, BANK(Music_Routes2)
  37. ld c, a
  38. ld a, MUSIC_ROUTES2
  39. call PlayMusic
  40. call ClearScreen
  41. call LoadTextBoxTilePatterns
  42. call SetDefaultNames
  43. predef InitPlayerData2
  44. ld hl, wNumBoxItems
  45. ld a, POTION
  46. ld [wcf91], a
  47. ld a, 1
  48. ld [wItemQuantity], a
  49. call AddItemToInventory ; give one potion
  50. ld a, [wDefaultMap]
  51. ld [wDestinationMap], a
  52. call SpecialWarpIn
  53. xor a
  54. ld [hTilesetType], a
  55. ld a, [wd732]
  56. bit 1, a ; possibly a debug mode bit
  57. jp nz, .skipChoosingNames
  58. ld de, ProfOakPic
  59. lb bc, Bank(ProfOakPic), $00
  60. call IntroDisplayPicCenteredOrUpperRight
  61. call FadeInIntroPic
  62. ld hl, OakSpeechText1
  63. call PrintText
  64. call GBFadeOutToWhite
  65. call ClearScreen
  66. ld a, NIDORINO
  67. ld [wd0b5], a
  68. ld [wcf91], a
  69. call GetMonHeader
  70. coord hl, 6, 4
  71. call LoadFlippedFrontSpriteByMonIndex
  72. call MovePicLeft
  73. ld hl, OakSpeechText2
  74. call PrintText
  75. call GBFadeOutToWhite
  76. call ClearScreen
  77. ld de, RedPicFront
  78. lb bc, Bank(RedPicFront), $00
  79. call IntroDisplayPicCenteredOrUpperRight
  80. call MovePicLeft
  81. ld hl, IntroducePlayerText
  82. call PrintText
  83. call ChoosePlayerName
  84. call GBFadeOutToWhite
  85. call ClearScreen
  86. ld de, Rival1Pic
  87. lb bc, Bank(Rival1Pic), $00
  88. call IntroDisplayPicCenteredOrUpperRight
  89. call FadeInIntroPic
  90. ld hl, IntroduceRivalText
  91. call PrintText
  92. call ChooseRivalName
  93. .skipChoosingNames
  94. call GBFadeOutToWhite
  95. call ClearScreen
  96. ld de, RedPicFront
  97. lb bc, Bank(RedPicFront), $00
  98. call IntroDisplayPicCenteredOrUpperRight
  99. call GBFadeInFromWhite
  100. ld a, [wd72d]
  101. and a
  102. jr nz, .next
  103. ld hl, OakSpeechText3
  104. call PrintText
  105. .next
  106. ld a, [H_LOADEDROMBANK]
  107. push af
  108. ld a, SFX_SHRINK
  109. call PlaySound
  110. pop af
  111. ld [H_LOADEDROMBANK], a
  112. ld [MBC1RomBank], a
  113. ld c, 4
  114. call DelayFrames
  115. ld de, RedSprite
  116. ld hl, vSprites
  117. lb bc, BANK(RedSprite), $0C
  118. call CopyVideoData
  119. ld de, ShrinkPic1
  120. lb bc, BANK(ShrinkPic1), $00
  121. call IntroDisplayPicCenteredOrUpperRight
  122. ld c, 4
  123. call DelayFrames
  124. ld de, ShrinkPic2
  125. lb bc, BANK(ShrinkPic2), $00
  126. call IntroDisplayPicCenteredOrUpperRight
  127. call ResetPlayerSpriteData
  128. ld a, [H_LOADEDROMBANK]
  129. push af
  130. ld a, BANK(Music_PalletTown)
  131. ld [wAudioROMBank], a
  132. ld [wAudioSavedROMBank], a
  133. ld a, 10
  134. ld [wAudioFadeOutControl], a
  135. ld a, $FF
  136. ld [wNewSoundID], a
  137. call PlaySound ; stop music
  138. pop af
  139. ld [H_LOADEDROMBANK], a
  140. ld [MBC1RomBank], a
  141. ld c, 20
  142. call DelayFrames
  143. coord hl, 6, 5
  144. ld b, 7
  145. ld c, 7
  146. call ClearScreenArea
  147. call LoadTextBoxTilePatterns
  148. ld a, 1
  149. ld [wUpdateSpritesEnabled], a
  150. ld c, 50
  151. call DelayFrames
  152. call GBFadeOutToWhite
  153. jp ClearScreen
  154. OakSpeechText1:
  155. TX_FAR _OakSpeechText1
  156. db "@"
  157. OakSpeechText2:
  158. TX_FAR _OakSpeechText2A
  159. TX_CRY_NIDORINA
  160. TX_FAR _OakSpeechText2B
  161. db "@"
  162. IntroducePlayerText:
  163. TX_FAR _IntroducePlayerText
  164. db "@"
  165. IntroduceRivalText:
  166. TX_FAR _IntroduceRivalText
  167. db "@"
  168. OakSpeechText3:
  169. TX_FAR _OakSpeechText3
  170. db "@"
  171. FadeInIntroPic:
  172. ld hl, IntroFadePalettes
  173. ld b, 6
  174. .next
  175. ld a, [hli]
  176. ld [rBGP], a
  177. ld c, 10
  178. call DelayFrames
  179. dec b
  180. jr nz, .next
  181. ret
  182. IntroFadePalettes:
  183. db %01010100
  184. db %10101000
  185. db %11111100
  186. db %11111000
  187. db %11110100
  188. db %11100100
  189. MovePicLeft:
  190. ld a, 119
  191. ld [rWX], a
  192. call DelayFrame
  193. ld a, %11100100
  194. ld [rBGP], a
  195. .next
  196. call DelayFrame
  197. ld a, [rWX]
  198. sub 8
  199. cp $FF
  200. ret z
  201. ld [rWX], a
  202. jr .next
  203. DisplayPicCenteredOrUpperRight:
  204. call GetPredefRegisters
  205. IntroDisplayPicCenteredOrUpperRight:
  206. ; b = bank
  207. ; de = address of compressed pic
  208. ; c: 0 = centred, non-zero = upper-right
  209. push bc
  210. ld a, b
  211. call UncompressSpriteFromDE
  212. ld hl, sSpriteBuffer1
  213. ld de, sSpriteBuffer0
  214. ld bc, $310
  215. call CopyData
  216. ld de, vFrontPic
  217. call InterlaceMergeSpriteBuffers
  218. pop bc
  219. ld a, c
  220. and a
  221. coord hl, 15, 1
  222. jr nz, .next
  223. coord hl, 6, 4
  224. .next
  225. xor a
  226. ld [hStartTileID], a
  227. predef_jump CopyUncompressedPicToTilemap