ghost_marowak_anim.asm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. MarowakAnim:
  2. ; animate the ghost being unveiled as a Marowak
  3. ld a, $e4
  4. ld [rOBP1], a
  5. call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
  6. ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
  7. coord hl, 12, 0
  8. lb bc, 7, 7
  9. call ClearScreenArea
  10. call Delay3
  11. xor a
  12. ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon
  13. ; replace ghost pic with Marowak in BG
  14. ld a, MAROWAK
  15. ld [wChangeMonPicEnemyTurnSpecies], a
  16. ld a, $1
  17. ld [H_WHOSETURN], a
  18. callab ChangeMonPic
  19. ; alternate between black and light grey 8 times.
  20. ; this makes the ghost's body appear to flash
  21. ld d, $80
  22. call FlashSprite8Times
  23. .fadeOutGhostLoop
  24. ld c, 10
  25. call DelayFrames
  26. ld a, [rOBP1]
  27. sla a
  28. sla a
  29. ld [rOBP1], a
  30. jr nz, .fadeOutGhostLoop
  31. call ClearSprites
  32. call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
  33. ld b, $e4
  34. .fadeInMarowakLoop
  35. ld c, 10
  36. call DelayFrames
  37. ld a, [rOBP1]
  38. srl b
  39. rra
  40. srl b
  41. rra
  42. ld [rOBP1], a
  43. ld a, b
  44. and a
  45. jr nz, .fadeInMarowakLoop
  46. ld a, $1
  47. ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
  48. call Delay3
  49. jp ClearSprites
  50. ; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM
  51. CopyMonPicFromBGToSpriteVRAM:
  52. ld de, vFrontPic
  53. ld hl, vSprites
  54. ld bc, 7 * 7
  55. call CopyVideoData
  56. ld a, $10
  57. ld [wBaseCoordY], a
  58. ld a, $70
  59. ld [wBaseCoordX], a
  60. ld hl, wOAMBuffer
  61. lb bc, 6, 6
  62. ld d, $8
  63. .oamLoop
  64. push bc
  65. ld a, [wBaseCoordY]
  66. ld e, a
  67. .oamInnerLoop
  68. ld a, e
  69. add $8
  70. ld e, a
  71. ld [hli], a
  72. ld a, [wBaseCoordX]
  73. ld [hli], a
  74. ld a, d
  75. ld [hli], a
  76. ld a, $10 ; use OBP1
  77. ld [hli], a
  78. inc d
  79. dec c
  80. jr nz, .oamInnerLoop
  81. inc d
  82. ld a, [wBaseCoordX]
  83. add $8
  84. ld [wBaseCoordX], a
  85. pop bc
  86. dec b
  87. jr nz, .oamLoop
  88. ret