pewter_guys.asm 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. PewterGuys:
  2. ld hl, wSimulatedJoypadStatesEnd
  3. ld a, [wSimulatedJoypadStatesIndex]
  4. dec a ; this decrement causes it to overwrite the last byte before $FF in the list
  5. ld [wSimulatedJoypadStatesIndex], a
  6. ld d, 0
  7. ld e, a
  8. add hl, de
  9. ld d, h
  10. ld e, l
  11. ld hl, PointerTable_37ce6
  12. ld a, [wWhichPewterGuy]
  13. add a
  14. ld b, 0
  15. ld c, a
  16. add hl, bc
  17. ld a, [hli]
  18. ld h, [hl]
  19. ld l, a
  20. ld a, [wYCoord]
  21. ld b, a
  22. ld a, [wXCoord]
  23. ld c, a
  24. .findMatchingCoordsLoop
  25. ld a, [hli]
  26. cp b
  27. jr nz, .nextEntry1
  28. ld a, [hli]
  29. cp c
  30. jr nz, .nextEntry2
  31. ld a, [hli]
  32. ld h, [hl]
  33. ld l, a
  34. .copyMovementDataLoop
  35. ld a, [hli]
  36. cp $ff
  37. ret z
  38. ld [de], a
  39. inc de
  40. ld a, [wSimulatedJoypadStatesIndex]
  41. inc a
  42. ld [wSimulatedJoypadStatesIndex], a
  43. jr .copyMovementDataLoop
  44. .nextEntry1
  45. inc hl
  46. .nextEntry2
  47. inc hl
  48. inc hl
  49. jr .findMatchingCoordsLoop
  50. PointerTable_37ce6:
  51. dw PewterMuseumGuyCoords
  52. dw PewterGymGuyCoords
  53. ; these are the four coordinates of the spaces below, above, to the left and
  54. ; to the right of the museum guy, and pointers to different movements for
  55. ; the player to make to get positioned before the main movement.
  56. PewterMuseumGuyCoords:
  57. db 18, 27
  58. dw .down
  59. db 16, 27
  60. dw .up
  61. db 17, 26
  62. dw .left
  63. db 17, 28
  64. dw .right
  65. .down
  66. db D_UP, D_UP, $ff
  67. .up
  68. db D_RIGHT, D_LEFT, $ff
  69. .left
  70. db D_UP, D_RIGHT, $ff
  71. .right
  72. db D_UP, D_LEFT, $ff
  73. ; these are the five coordinates which trigger the gym guy and pointers to
  74. ; different movements for the player to make to get positioned before the
  75. ; main movement
  76. ; $00 is a pause
  77. PewterGymGuyCoords:
  78. db 16, 34
  79. dw .one
  80. db 17, 35
  81. dw .two
  82. db 18, 37
  83. dw .three
  84. db 19, 37
  85. dw .four
  86. db 17, 36
  87. dw .five
  88. .one
  89. db D_LEFT, D_DOWN, D_DOWN, D_RIGHT, $ff
  90. .two
  91. db D_LEFT, D_DOWN, D_RIGHT, D_LEFT, $ff
  92. .three
  93. db D_LEFT, D_LEFT, D_LEFT, $00, $00, $00, $00, $00, $00, $00, $00, $ff
  94. .four
  95. db D_LEFT, D_LEFT, D_UP, D_LEFT, $ff
  96. .five
  97. db D_LEFT, D_DOWN, D_LEFT, $00, $00, $00, $00, $00, $00, $00, $00, $ff