hall_of_fame.asm 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. AnimateHallOfFame:
  2. call HoFFadeOutScreenAndMusic
  3. call ClearScreen
  4. ld c, 100
  5. call DelayFrames
  6. call LoadFontTilePatterns
  7. call LoadTextBoxTilePatterns
  8. call DisableLCD
  9. ld hl, vBGMap0
  10. ld bc, $800
  11. ld a, " "
  12. call FillMemory
  13. call EnableLCD
  14. ld hl, rLCDC
  15. set 3, [hl]
  16. xor a
  17. ld hl, wHallOfFame
  18. ld bc, HOF_TEAM
  19. call FillMemory
  20. xor a
  21. ld [wUpdateSpritesEnabled], a
  22. ld [hTilesetType], a
  23. ld [wSpriteFlipped], a
  24. ld [wLetterPrintingDelayFlags], a ; no delay
  25. ld [wHoFMonOrPlayer], a ; mon
  26. inc a
  27. ld [H_AUTOBGTRANSFERENABLED], a
  28. ld hl, wNumHoFTeams
  29. ld a, [hl]
  30. inc a
  31. jr z, .skipInc ; don't wrap around to 0
  32. inc [hl]
  33. .skipInc
  34. ld a, $90
  35. ld [hWY], a
  36. ld c, BANK(Music_HallOfFame)
  37. ld a, MUSIC_HALL_OF_FAME
  38. call PlayMusic
  39. ld hl, wPartySpecies
  40. ld c, $ff
  41. .partyMonLoop
  42. ld a, [hli]
  43. cp $ff
  44. jr z, .doneShowingParty
  45. inc c
  46. push hl
  47. push bc
  48. ld [wHoFMonSpecies], a
  49. ld a, c
  50. ld [wHoFPartyMonIndex], a
  51. ld hl, wPartyMon1Level
  52. ld bc, wPartyMon2 - wPartyMon1
  53. call AddNTimes
  54. ld a, [hl]
  55. ld [wHoFMonLevel], a
  56. call HoFShowMonOrPlayer
  57. call HoFDisplayAndRecordMonInfo
  58. ld c, 80
  59. call DelayFrames
  60. coord hl, 2, 13
  61. ld b, 3
  62. ld c, 14
  63. call TextBoxBorder
  64. coord hl, 4, 15
  65. ld de, HallOfFameText
  66. call PlaceString
  67. ld c, 180
  68. call DelayFrames
  69. call GBFadeOutToWhite
  70. pop bc
  71. pop hl
  72. jr .partyMonLoop
  73. .doneShowingParty
  74. ld a, c
  75. inc a
  76. ld hl, wHallOfFame
  77. ld bc, HOF_MON
  78. call AddNTimes
  79. ld [hl], $ff
  80. call SaveHallOfFameTeams
  81. xor a
  82. ld [wHoFMonSpecies], a
  83. inc a
  84. ld [wHoFMonOrPlayer], a ; player
  85. call HoFShowMonOrPlayer
  86. call HoFDisplayPlayerStats
  87. call HoFFadeOutScreenAndMusic
  88. xor a
  89. ld [hWY], a
  90. ld hl, rLCDC
  91. res 3, [hl]
  92. ret
  93. HallOfFameText:
  94. db "HALL OF FAME@"
  95. HoFShowMonOrPlayer:
  96. call ClearScreen
  97. ld a, $d0
  98. ld [hSCY], a
  99. ld a, $c0
  100. ld [hSCX], a
  101. ld a, [wHoFMonSpecies]
  102. ld [wcf91], a
  103. ld [wd0b5], a
  104. ld [wBattleMonSpecies2], a
  105. ld [wWholeScreenPaletteMonSpecies], a
  106. ld a, [wHoFMonOrPlayer]
  107. and a
  108. jr z, .showMon
  109. ; show player
  110. call HoFLoadPlayerPics
  111. jr .next1
  112. .showMon
  113. coord hl, 12, 5
  114. call GetMonHeader
  115. call LoadFrontSpriteByMonIndex
  116. predef LoadMonBackPic
  117. .next1
  118. ld b, SET_PAL_POKEMON_WHOLE_SCREEN
  119. ld c, 0
  120. call RunPaletteCommand
  121. ld a, %11100100
  122. ld [rBGP], a
  123. ld c, $31 ; back pic
  124. call HoFLoadMonPlayerPicTileIDs
  125. ld d, $a0
  126. ld e, 4
  127. ld a, [wOnSGB]
  128. and a
  129. jr z, .next2
  130. sla e ; scroll more slowly on SGB
  131. .next2
  132. call .ScrollPic ; scroll back pic left
  133. xor a
  134. ld [hSCY], a
  135. ld c, a ; front pic
  136. call HoFLoadMonPlayerPicTileIDs
  137. ld d, 0
  138. ld e, -4
  139. ; scroll front pic right
  140. .ScrollPic
  141. call DelayFrame
  142. ld a, [hSCX]
  143. add e
  144. ld [hSCX], a
  145. cp d
  146. jr nz, .ScrollPic
  147. ret
  148. HoFDisplayAndRecordMonInfo:
  149. ld a, [wHoFPartyMonIndex]
  150. ld hl, wPartyMonNicks
  151. call GetPartyMonName
  152. call HoFDisplayMonInfo
  153. jp HoFRecordMonInfo
  154. HoFDisplayMonInfo:
  155. coord hl, 0, 2
  156. ld b, 9
  157. ld c, 10
  158. call TextBoxBorder
  159. coord hl, 2, 6
  160. ld de, HoFMonInfoText
  161. call PlaceString
  162. coord hl, 1, 4
  163. ld de, wcd6d
  164. call PlaceString
  165. ld a, [wHoFMonLevel]
  166. coord hl, 8, 7
  167. call PrintLevelCommon
  168. ld a, [wHoFMonSpecies]
  169. ld [wd0b5], a
  170. coord hl, 3, 9
  171. predef PrintMonType
  172. ld a, [wHoFMonSpecies]
  173. jp PlayCry
  174. HoFMonInfoText:
  175. db "LEVEL/"
  176. next "TYPE1/"
  177. next "TYPE2/@"
  178. HoFLoadPlayerPics:
  179. ld de, RedPicFront
  180. ld a, BANK(RedPicFront)
  181. call UncompressSpriteFromDE
  182. ld hl, sSpriteBuffer1
  183. ld de, sSpriteBuffer0
  184. ld bc, $310
  185. call CopyData
  186. ld de, vFrontPic
  187. call InterlaceMergeSpriteBuffers
  188. ld de, RedPicBack
  189. ld a, BANK(RedPicBack)
  190. call UncompressSpriteFromDE
  191. predef ScaleSpriteByTwo
  192. ld de, vBackPic
  193. call InterlaceMergeSpriteBuffers
  194. ld c, $1
  195. HoFLoadMonPlayerPicTileIDs:
  196. ; c = base tile ID
  197. ld b, 0
  198. coord hl, 12, 5
  199. predef_jump CopyTileIDsFromList
  200. HoFDisplayPlayerStats:
  201. SetEvent EVENT_HALL_OF_FAME_DEX_RATING
  202. predef DisplayDexRating
  203. coord hl, 0, 4
  204. ld b, 6
  205. ld c, 10
  206. call TextBoxBorder
  207. coord hl, 5, 0
  208. ld b, 2
  209. ld c, 9
  210. call TextBoxBorder
  211. coord hl, 7, 2
  212. ld de, wPlayerName
  213. call PlaceString
  214. coord hl, 1, 6
  215. ld de, HoFPlayTimeText
  216. call PlaceString
  217. coord hl, 5, 7
  218. ld de, wPlayTimeHours
  219. lb bc, 1, 3
  220. call PrintNumber
  221. ld [hl], $6d
  222. inc hl
  223. ld de, wPlayTimeMinutes
  224. lb bc, LEADING_ZEROES | 1, 2
  225. call PrintNumber
  226. coord hl, 1, 9
  227. ld de, HoFMoneyText
  228. call PlaceString
  229. coord hl, 4, 10
  230. ld de, wPlayerMoney
  231. ld c, $a3
  232. call PrintBCDNumber
  233. ld hl, DexSeenOwnedText
  234. call HoFPrintTextAndDelay
  235. ld hl, DexRatingText
  236. call HoFPrintTextAndDelay
  237. ld hl, wDexRatingText
  238. HoFPrintTextAndDelay:
  239. call PrintText
  240. ld c, 120
  241. jp DelayFrames
  242. HoFPlayTimeText:
  243. db "PLAY TIME@"
  244. HoFMoneyText:
  245. db "MONEY@"
  246. DexSeenOwnedText:
  247. TX_FAR _DexSeenOwnedText
  248. db "@"
  249. DexRatingText:
  250. TX_FAR _DexRatingText
  251. db "@"
  252. HoFRecordMonInfo:
  253. ld hl, wHallOfFame
  254. ld bc, HOF_MON
  255. ld a, [wHoFPartyMonIndex]
  256. call AddNTimes
  257. ld a, [wHoFMonSpecies]
  258. ld [hli], a
  259. ld a, [wHoFMonLevel]
  260. ld [hli], a
  261. ld e, l
  262. ld d, h
  263. ld hl, wcd6d
  264. ld bc, NAME_LENGTH
  265. jp CopyData
  266. HoFFadeOutScreenAndMusic:
  267. ld a, 10
  268. ld [wAudioFadeOutCounterReloadValue], a
  269. ld [wAudioFadeOutCounter], a
  270. ld a, $ff
  271. ld [wAudioFadeOutControl], a
  272. jp GBFadeOutToWhite