titlescreen2.asm 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. TitleScroll_WaitBall:
  2. ; Wait around for the TitleBall animation to play out.
  3. ; hi: speed
  4. ; lo: duration
  5. db $05, $05, 0
  6. TitleScroll_In:
  7. ; Scroll a TitleMon in from the right.
  8. ; hi: speed
  9. ; lo: duration
  10. db $a2, $94, $84, $63, $52, $31, $11, 0
  11. TitleScroll_Out:
  12. ; Scroll a TitleMon out to the left.
  13. ; hi: speed
  14. ; lo: duration
  15. db $12, $22, $32, $42, $52, $62, $83, $93, 0
  16. TitleScroll:
  17. ld a, d
  18. ld bc, TitleScroll_In
  19. ld d, $88
  20. ld e, 0 ; don't animate titleball
  21. and a
  22. jr nz, .ok
  23. ld bc, TitleScroll_Out
  24. ld d, $00
  25. ld e, 0 ; don't animate titleball
  26. .ok
  27. _TitleScroll:
  28. ld a, [bc]
  29. and a
  30. ret z
  31. inc bc
  32. push bc
  33. ld b, a
  34. and $f
  35. ld c, a
  36. ld a, b
  37. and $f0
  38. swap a
  39. ld b, a
  40. .loop
  41. ld h, d
  42. ld l, $48
  43. call .ScrollBetween
  44. ld h, $00
  45. ld l, $88
  46. call .ScrollBetween
  47. ld a, d
  48. add b
  49. ld d, a
  50. call GetTitleBallY
  51. dec c
  52. jr nz, .loop
  53. pop bc
  54. jr _TitleScroll
  55. .ScrollBetween:
  56. .wait
  57. ld a, [rLY] ; rLY
  58. cp l
  59. jr nz, .wait
  60. ld a, h
  61. ld [rSCX], a
  62. .wait2
  63. ld a, [rLY] ; rLY
  64. cp h
  65. jr z, .wait2
  66. ret
  67. TitleBallYTable:
  68. ; OBJ y-positions for the Poke Ball held by Red in the title screen.
  69. ; This is really two 0-terminated lists. Initiated with an index of 1.
  70. db 0, $71, $6f, $6e, $6d, $6c, $6d, $6e, $6f, $71, $74, 0
  71. TitleScreenAnimateBallIfStarterOut:
  72. ; Animate the TitleBall if a starter just got scrolled out.
  73. ld a, [wTitleMonSpecies]
  74. cp STARTER1
  75. jr z, .ok
  76. cp STARTER2
  77. jr z, .ok
  78. cp STARTER3
  79. ret nz
  80. .ok
  81. ld e, 1 ; animate titleball
  82. ld bc, TitleScroll_WaitBall
  83. ld d, 0
  84. jp _TitleScroll
  85. GetTitleBallY:
  86. ; Get position e from TitleBallYTable
  87. push de
  88. push hl
  89. xor a
  90. ld d, a
  91. ld hl, TitleBallYTable
  92. add hl, de
  93. ld a, [hl]
  94. pop hl
  95. pop de
  96. and a
  97. ret z
  98. ld [wOAMBuffer + $28], a
  99. inc e
  100. ret