pokered/scripts/bruno.asm

153 lines
2.9 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
BrunoScript:
call BrunoShowOrHideExitBlock
2014-05-18 18:19:10 +00:00
call EnableAutoTextBoxDrawing
ld hl, BrunoTrainerHeaders
ld de, BrunoScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wBrunoCurScript]
2014-05-18 18:19:10 +00:00
call ExecuteCurMapScriptInTable
2015-08-31 02:38:41 +00:00
ld [wBrunoCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoShowOrHideExitBlock:
; Blocks or clears the exit to the next room.
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
bit 5, [hl]
res 5, [hl]
ret z
2015-07-21 01:32:02 +00:00
CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
jr z, .blockExitToNextRoom
2014-05-18 18:19:10 +00:00
ld a, $5
jp .setExitBlock
.blockExitToNextRoom
2014-05-18 18:19:10 +00:00
ld a, $24
.setExitBlock
2015-07-24 21:39:45 +00:00
ld [wNewTileBlockID], a
2015-08-05 21:20:29 +00:00
lb bc, 0, 2
2014-09-14 18:29:18 +00:00
predef_jump ReplaceTileBlock
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
ResetBrunoScript:
2014-05-18 18:19:10 +00:00
xor a
2015-08-31 02:38:41 +00:00
ld [wBrunoCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoScriptPointers:
2014-05-18 18:19:10 +00:00
dw BrunoScript0
2014-09-14 18:29:18 +00:00
dw DisplayEnemyTrainerTextAndStartBattle
2014-05-18 18:19:10 +00:00
dw BrunoScript2
dw BrunoScript3
dw BrunoScript4
2016-06-12 00:24:04 +00:00
BrunoScript4:
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoScriptWalkIntoRoom:
; Walk six steps upward.
ld hl, wSimulatedJoypadStatesEnd
ld a, D_UP
2014-05-18 18:19:10 +00:00
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, $6
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
2014-05-18 18:19:10 +00:00
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wBrunoCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoScript0:
ld hl, BrunoEntranceCoords
2014-05-18 18:19:10 +00:00
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
2014-05-25 17:51:53 +00:00
ld [hJoyPressed], a
ld [hJoyHeld], a
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesIndex], a
2015-07-19 03:49:52 +00:00
ld a, [wCoordIndex]
cp $3 ; Is player standing one tile above the exit?
jr c, .stopPlayerFromLeaving
2015-07-21 17:36:03 +00:00
CheckAndSetEvent EVENT_AUTOWALKED_INTO_BRUNOS_ROOM
jr z, BrunoScriptWalkIntoRoom
.stopPlayerFromLeaving
2014-05-18 18:19:10 +00:00
ld a, $2
2015-07-18 15:17:29 +00:00
ld [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
2014-05-18 18:19:10 +00:00
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
2014-05-18 18:19:10 +00:00
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wBrunoCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoEntranceCoords:
2014-05-18 18:19:10 +00:00
db $0A,$04
db $0A,$05
db $0B,$04
db $0B,$05
db $FF
2016-06-12 00:24:04 +00:00
BrunoScript3:
ld a, [wSimulatedJoypadStatesIndex]
2014-05-18 18:19:10 +00:00
and a
ret nz
call Delay3
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld [wBrunoCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
BrunoScript2:
2014-05-18 18:19:10 +00:00
call EndTrainerBattle
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, ResetBrunoScript
2014-05-18 18:19:10 +00:00
ld a, $1
2015-07-18 15:17:29 +00:00
ld [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
jp DisplayTextID
2016-06-12 00:24:04 +00:00
BrunoTextPointers:
2014-05-18 18:19:10 +00:00
dw BrunoText1
2015-06-12 15:26:00 +00:00
dw BrunoDontRunAwayText
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
BrunoTrainerHeaders:
BrunoTrainerHeader0:
2015-07-21 01:32:02 +00:00
dbEventFlagBit EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
2014-05-18 18:19:10 +00:00
db ($0 << 4) ; trainer's view range
2015-07-21 01:32:02 +00:00
dwEventFlagAddress EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
dw BrunoBeforeBattleText ; TextBeforeBattle
dw BrunoAfterBattleText ; TextAfterBattle
dw BrunoEndBattleText ; TextEndBattle
dw BrunoEndBattleText ; TextEndBattle
2014-05-18 18:19:10 +00:00
db $ff
2016-06-12 00:24:04 +00:00
BrunoText1:
2015-07-03 19:58:50 +00:00
TX_ASM
2014-05-18 18:19:10 +00:00
ld hl, BrunoTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
BrunoBeforeBattleText:
2014-05-18 18:19:10 +00:00
TX_FAR _BrunoBeforeBattleText
db "@"
2016-06-12 00:24:04 +00:00
BrunoEndBattleText:
2014-05-18 18:19:10 +00:00
TX_FAR _BrunoEndBattleText
db "@"
2016-06-12 00:24:04 +00:00
BrunoAfterBattleText:
2014-05-18 18:19:10 +00:00
TX_FAR _BrunoAfterBattleText
db "@"
2016-06-12 00:24:04 +00:00
BrunoDontRunAwayText:
2015-06-12 15:26:00 +00:00
TX_FAR _BrunoDontRunAwayText
2014-05-18 18:19:10 +00:00
db "@"