bruno.asm 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. BrunoScript:
  2. call BrunoShowOrHideExitBlock
  3. call EnableAutoTextBoxDrawing
  4. ld hl, BrunoTrainerHeader0
  5. ld de, BrunoScriptPointers
  6. ld a, [wBrunoCurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wBrunoCurScript], a
  9. ret
  10. BrunoShowOrHideExitBlock:
  11. ; Blocks or clears the exit to the next room.
  12. ld hl, wCurrentMapScriptFlags
  13. bit 5, [hl]
  14. res 5, [hl]
  15. ret z
  16. CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
  17. jr z, .blockExitToNextRoom
  18. ld a, $5
  19. jp .setExitBlock
  20. .blockExitToNextRoom
  21. ld a, $24
  22. .setExitBlock
  23. ld [wNewTileBlockID], a
  24. lb bc, 0, 2
  25. predef_jump ReplaceTileBlock
  26. ResetBrunoScript:
  27. xor a
  28. ld [wBrunoCurScript], a
  29. ret
  30. BrunoScriptPointers:
  31. dw BrunoScript0
  32. dw DisplayEnemyTrainerTextAndStartBattle
  33. dw BrunoScript2
  34. dw BrunoScript3
  35. dw BrunoScript4
  36. BrunoScript4:
  37. ret
  38. BrunoScriptWalkIntoRoom:
  39. ; Walk six steps upward.
  40. ld hl, wSimulatedJoypadStatesEnd
  41. ld a, D_UP
  42. ld [hli], a
  43. ld [hli], a
  44. ld [hli], a
  45. ld [hli], a
  46. ld [hli], a
  47. ld [hl], a
  48. ld a, $6
  49. ld [wSimulatedJoypadStatesIndex], a
  50. call StartSimulatingJoypadStates
  51. ld a, $3
  52. ld [wBrunoCurScript], a
  53. ld [wCurMapScript], a
  54. ret
  55. BrunoScript0:
  56. ld hl, BrunoEntranceCoords
  57. call ArePlayerCoordsInArray
  58. jp nc, CheckFightingMapTrainers
  59. xor a
  60. ld [hJoyPressed], a
  61. ld [hJoyHeld], a
  62. ld [wSimulatedJoypadStatesEnd], a
  63. ld [wSimulatedJoypadStatesIndex], a
  64. ld a, [wCoordIndex]
  65. cp $3 ; Is player standing one tile above the exit?
  66. jr c, .stopPlayerFromLeaving
  67. CheckAndSetEvent EVENT_AUTOWALKED_INTO_BRUNOS_ROOM
  68. jr z, BrunoScriptWalkIntoRoom
  69. .stopPlayerFromLeaving
  70. ld a, $2
  71. ld [hSpriteIndexOrTextID], a
  72. call DisplayTextID ; "Don't run away!"
  73. ld a, D_UP
  74. ld [wSimulatedJoypadStatesEnd], a
  75. ld a, $1
  76. ld [wSimulatedJoypadStatesIndex], a
  77. call StartSimulatingJoypadStates
  78. ld a, $3
  79. ld [wBrunoCurScript], a
  80. ld [wCurMapScript], a
  81. ret
  82. BrunoEntranceCoords:
  83. db $0A,$04
  84. db $0A,$05
  85. db $0B,$04
  86. db $0B,$05
  87. db $FF
  88. BrunoScript3:
  89. ld a, [wSimulatedJoypadStatesIndex]
  90. and a
  91. ret nz
  92. call Delay3
  93. xor a
  94. ld [wJoyIgnore], a
  95. ld [wBrunoCurScript], a
  96. ld [wCurMapScript], a
  97. ret
  98. BrunoScript2:
  99. call EndTrainerBattle
  100. ld a, [wIsInBattle]
  101. cp $ff
  102. jp z, ResetBrunoScript
  103. ld a, $1
  104. ld [hSpriteIndexOrTextID], a
  105. jp DisplayTextID
  106. BrunoTextPointers:
  107. dw BrunoText1
  108. dw BrunoDontRunAwayText
  109. BrunoTrainerHeader0:
  110. dbEventFlagBit EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
  111. db ($0 << 4) ; trainer's view range
  112. dwEventFlagAddress EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
  113. dw BrunoBeforeBattleText ; TextBeforeBattle
  114. dw BrunoAfterBattleText ; TextAfterBattle
  115. dw BrunoEndBattleText ; TextEndBattle
  116. dw BrunoEndBattleText ; TextEndBattle
  117. db $ff
  118. BrunoText1:
  119. TX_ASM
  120. ld hl, BrunoTrainerHeader0
  121. call TalkToTrainer
  122. jp TextScriptEnd
  123. BrunoBeforeBattleText:
  124. TX_FAR _BrunoBeforeBattleText
  125. db "@"
  126. BrunoEndBattleText:
  127. TX_FAR _BrunoEndBattleText
  128. db "@"
  129. BrunoAfterBattleText:
  130. TX_FAR _BrunoAfterBattleText
  131. db "@"
  132. BrunoDontRunAwayText:
  133. TX_FAR _BrunoDontRunAwayText
  134. db "@"