oak_speech2.asm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. ChoosePlayerName:
  2. call OakSpeechSlidePicRight
  3. ld de, DefaultNamesPlayer
  4. call DisplayIntroNameTextBox
  5. ld a, [wCurrentMenuItem]
  6. and a
  7. jr z, .customName
  8. ld hl, DefaultNamesPlayerList
  9. call GetDefaultName
  10. ld de, wPlayerName
  11. call OakSpeechSlidePicLeft
  12. jr .done
  13. .customName
  14. ld hl, wPlayerName
  15. xor a ; NAME_PLAYER_SCREEN
  16. ld [wNamingScreenType], a
  17. call DisplayNamingScreen
  18. ld a, [wcf4b]
  19. cp "@"
  20. jr z, .customName
  21. call ClearScreen
  22. call Delay3
  23. ld de, RedPicFront
  24. ld b, BANK(RedPicFront)
  25. call IntroDisplayPicCenteredOrUpperRight
  26. .done
  27. ld hl, YourNameIsText
  28. jp PrintText
  29. YourNameIsText:
  30. TX_FAR _YourNameIsText
  31. db "@"
  32. ChooseRivalName:
  33. call OakSpeechSlidePicRight
  34. ld de, DefaultNamesRival
  35. call DisplayIntroNameTextBox
  36. ld a, [wCurrentMenuItem]
  37. and a
  38. jr z, .customName
  39. ld hl, DefaultNamesRivalList
  40. call GetDefaultName
  41. ld de, wRivalName
  42. call OakSpeechSlidePicLeft
  43. jr .done
  44. .customName
  45. ld hl, wRivalName
  46. ld a, NAME_RIVAL_SCREEN
  47. ld [wNamingScreenType], a
  48. call DisplayNamingScreen
  49. ld a, [wcf4b]
  50. cp "@"
  51. jr z, .customName
  52. call ClearScreen
  53. call Delay3
  54. ld de, Rival1Pic
  55. ld b, $13
  56. call IntroDisplayPicCenteredOrUpperRight
  57. .done
  58. ld hl, HisNameIsText
  59. jp PrintText
  60. HisNameIsText:
  61. TX_FAR _HisNameIsText
  62. db "@"
  63. OakSpeechSlidePicLeft:
  64. push de
  65. coord hl, 0, 0
  66. lb bc, 12, 11
  67. call ClearScreenArea ; clear the name list text box
  68. ld c, 10
  69. call DelayFrames
  70. pop de
  71. ld hl, wcd6d
  72. ld bc, NAME_LENGTH
  73. call CopyData
  74. call Delay3
  75. coord hl, 12, 4
  76. lb de, 6, 6 * SCREEN_WIDTH + 5
  77. ld a, $ff
  78. jr OakSpeechSlidePicCommon
  79. OakSpeechSlidePicRight:
  80. coord hl, 5, 4
  81. lb de, 6, 6 * SCREEN_WIDTH + 5
  82. xor a
  83. OakSpeechSlidePicCommon:
  84. push hl
  85. push de
  86. push bc
  87. ld [hSlideDirection], a
  88. ld a, d
  89. ld [hSlideAmount], a
  90. ld a, e
  91. ld [hSlidingRegionSize], a
  92. ld c, a
  93. ld a, [hSlideDirection]
  94. and a
  95. jr nz, .next
  96. ; If sliding right, point hl to the end of the pic's tiles.
  97. ld d, 0
  98. add hl, de
  99. .next
  100. ld d, h
  101. ld e, l
  102. .loop
  103. xor a
  104. ld [H_AUTOBGTRANSFERENABLED], a
  105. ld a, [hSlideDirection]
  106. and a
  107. jr nz, .slideLeft
  108. ; sliding right
  109. ld a, [hli]
  110. ld [hld], a
  111. dec hl
  112. jr .next2
  113. .slideLeft
  114. ld a, [hld]
  115. ld [hli], a
  116. inc hl
  117. .next2
  118. dec c
  119. jr nz, .loop
  120. ld a, [hSlideDirection]
  121. and a
  122. jr z, .next3
  123. ; If sliding left, we need to zero the last tile in the pic (there is no need
  124. ; to take a corresponding action when sliding right because hl initially points
  125. ; to a 0 tile in that case).
  126. xor a
  127. dec hl
  128. ld [hl], a
  129. .next3
  130. ld a, 1
  131. ld [H_AUTOBGTRANSFERENABLED], a
  132. call Delay3
  133. ld a, [hSlidingRegionSize]
  134. ld c, a
  135. ld h, d
  136. ld l, e
  137. ld a, [hSlideDirection]
  138. and a
  139. jr nz, .slideLeft2
  140. inc hl
  141. jr .next4
  142. .slideLeft2
  143. dec hl
  144. .next4
  145. ld d, h
  146. ld e, l
  147. ld a, [hSlideAmount]
  148. dec a
  149. ld [hSlideAmount], a
  150. jr nz, .loop
  151. pop bc
  152. pop de
  153. pop hl
  154. ret
  155. DisplayIntroNameTextBox:
  156. push de
  157. coord hl, 0, 0
  158. ld b, $a
  159. ld c, $9
  160. call TextBoxBorder
  161. coord hl, 3, 0
  162. ld de, .namestring
  163. call PlaceString
  164. pop de
  165. coord hl, 2, 2
  166. call PlaceString
  167. call UpdateSprites
  168. xor a
  169. ld [wCurrentMenuItem], a
  170. ld [wLastMenuItem], a
  171. inc a
  172. ld [wTopMenuItemX], a
  173. ld [wMenuWatchedKeys], a ; A_BUTTON
  174. inc a
  175. ld [wTopMenuItemY], a
  176. inc a
  177. ld [wMaxMenuItem], a
  178. jp HandleMenuInput
  179. .namestring
  180. db "NAME@"
  181. IF DEF(_RED)
  182. DefaultNamesPlayer:
  183. db "NEW NAME"
  184. next "RED"
  185. next "ASH"
  186. next "JACK"
  187. db "@"
  188. DefaultNamesRival:
  189. db "NEW NAME"
  190. next "BLUE"
  191. next "GARY"
  192. next "JOHN"
  193. db "@"
  194. ENDC
  195. IF DEF(_BLUE)
  196. DefaultNamesPlayer:
  197. db "NEW NAME"
  198. next "BLUE"
  199. next "GARY"
  200. next "JOHN"
  201. db "@"
  202. DefaultNamesRival:
  203. db "NEW NAME"
  204. next "RED"
  205. next "ASH"
  206. next "JACK"
  207. db "@"
  208. ENDC
  209. GetDefaultName:
  210. ; a = name index
  211. ; hl = name list
  212. ld b, a
  213. ld c, 0
  214. .loop
  215. ld d, h
  216. ld e, l
  217. .innerLoop
  218. ld a, [hli]
  219. cp "@"
  220. jr nz, .innerLoop
  221. ld a, b
  222. cp c
  223. jr z, .foundName
  224. inc c
  225. jr .loop
  226. .foundName
  227. ld h, d
  228. ld l, e
  229. ld de, wcd6d
  230. ld bc, $14
  231. jp CopyData
  232. IF DEF(_RED)
  233. DefaultNamesPlayerList:
  234. db "NEW NAME@"
  235. db "RED@"
  236. db "ASH@"
  237. db "JACK@"
  238. DefaultNamesRivalList:
  239. db "NEW NAME@"
  240. db "BLUE@"
  241. db "GARY@"
  242. db "JOHN@"
  243. ENDC
  244. IF DEF(_BLUE)
  245. DefaultNamesPlayerList:
  246. db "NEW NAME@"
  247. db "BLUE@"
  248. db "GARY@"
  249. db "JOHN@"
  250. DefaultNamesRivalList:
  251. db "NEW NAME@"
  252. db "RED@"
  253. db "ASH@"
  254. db "JACK@"
  255. ENDC
  256. TextTerminator_6b20:
  257. db "@"