elevator.asm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ShakeElevator:
  2. ld de, -$20
  3. call ShakeElevatorRedrawRow
  4. ld de, SCREEN_HEIGHT * $20
  5. call ShakeElevatorRedrawRow
  6. call Delay3
  7. ld a, $ff
  8. call PlaySound
  9. ld a, [hSCY]
  10. ld d, a
  11. ld e, $1
  12. ld b, 100
  13. .shakeLoop ; scroll the BG up and down and play a sound effect
  14. ld a, e
  15. xor $fe
  16. ld e, a
  17. add d
  18. ld [hSCY], a
  19. push bc
  20. ld c, BANK(SFX_Collision_1)
  21. ld a, SFX_COLLISION
  22. call PlayMusic
  23. pop bc
  24. ld c, 2
  25. call DelayFrames
  26. dec b
  27. jr nz, .shakeLoop
  28. ld a, d
  29. ld [hSCY], a
  30. ld a, $ff
  31. call PlaySound
  32. ld c, BANK(SFX_Safari_Zone_PA)
  33. ld a, SFX_SAFARI_ZONE_PA
  34. call PlayMusic
  35. .musicLoop
  36. ld a, [wChannelSoundIDs + Ch4]
  37. cp SFX_SAFARI_ZONE_PA
  38. jr z, .musicLoop
  39. call UpdateSprites
  40. jp PlayDefaultMusic
  41. ShakeElevatorRedrawRow:
  42. ; This function is used to redraw certain portions of the screen, but it does
  43. ; not appear to ever result in any visible effect, so this function seems to
  44. ; be pointless.
  45. ld hl, wMapViewVRAMPointer + 1
  46. ld a, [hld]
  47. push af
  48. ld a, [hl]
  49. push af
  50. push hl
  51. push hl
  52. ld a, [hli]
  53. ld h, [hl]
  54. ld l, a
  55. add hl, de
  56. ld a, h
  57. and $3
  58. or vBGMap0 / $100
  59. ld d, a
  60. ld a, l
  61. pop hl
  62. ld [hli], a
  63. ld [hl], d
  64. call ScheduleNorthRowRedraw
  65. pop hl
  66. pop af
  67. ld [hli], a
  68. pop af
  69. ld [hl], a
  70. jp Delay3