diff options
| author | vulcandth <vulcandth@gmail.com> | 2023-07-13 20:27:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-13 21:27:56 -0400 |
| commit | d001ced41b53271373753de835a9c3b3413dc318 (patch) | |
| tree | ff2db7f403bddfcdeb12e50def8411cafedcdd5e /scripts/LancesRoom.asm | |
| parent | Make wCurrentBoxNum a byte instead of word (#414) (diff) | |
| download | pokeyellow-d001ced41b53271373753de835a9c3b3413dc318.tar.gz pokeyellow-d001ced41b53271373753de835a9c3b3413dc318.tar.xz pokeyellow-d001ced41b53271373753de835a9c3b3413dc318.zip | |
Add macros, constants, and labels for map scripts and text (#367)
This introduces `def_script_pointers`, `def_text_pointers`, and `object_const_def` macros, and applies them to all maps. Most other map labels have also been identified.
Diffstat (limited to 'scripts/LancesRoom.asm')
| -rw-r--r-- | scripts/LancesRoom.asm | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/scripts/LancesRoom.asm b/scripts/LancesRoom.asm index 9c316416..fd1401c2 100644 --- a/scripts/LancesRoom.asm +++ b/scripts/LancesRoom.asm @@ -36,21 +36,22 @@ LanceShowOrHideEntranceBlocks: predef_jump ReplaceTileBlock ResetLanceScript: - xor a + xor a ; SCRIPT_LANCESROOM_DEFAULT ld [wLancesRoomCurScript], a ret LancesRoom_ScriptPointers: - dw LanceScript0 - dw DisplayEnemyTrainerTextAndStartBattle - dw LanceScript2 - dw LanceScript3 - dw LanceScript4 + def_script_pointers + dw_const LancesRoomDefaultScript, SCRIPT_LANCESROOM_DEFAULT + dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_LANCESROOM_LANCE_START_BATTLE + dw_const LancesRoomLanceEndBattleScript, SCRIPT_LANCESROOM_LANCE_END_BATTLE + dw_const LancesRoomPlayerIsMovingScript, SCRIPT_LANCESROOM_PLAYER_IS_MOVING + dw_const LancesRoomNoopScript, SCRIPT_LANCESROOM_NOOP -LanceScript4: +LancesRoomNoopScript: ret -LanceScript0: +LancesRoomDefaultScript: CheckEvent EVENT_BEAT_LANCE ret nz ld hl, LanceTriggerMovementCoords @@ -61,7 +62,7 @@ LanceScript0: ld a, [wCoordIndex] cp $3 ; Is player standing next to Lance's sprite? jr nc, .notStandingNextToLance - ld a, $1 + ld a, TEXT_LANCESROOM_LANCE ldh [hSpriteIndexOrTextID], a jp DisplayTextID .notStandingNextToLance @@ -83,18 +84,18 @@ LanceTriggerMovementCoords: dbmapcoord 24, 16 db -1 ; end -LanceScript2: +LancesRoomLanceEndBattleScript: call EndTrainerBattle ld a, [wIsInBattle] cp $ff jp z, ResetLanceScript - ld a, $1 + ld a, TEXT_LANCESROOM_LANCE ldh [hSpriteIndexOrTextID], a jp DisplayTextID WalkToLance: ; Moves the player down the hallway to Lance's room. - ld a, $ff + ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld hl, wSimulatedJoypadStatesEnd ld de, WalkToLance_RLEList @@ -102,7 +103,7 @@ WalkToLance: dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates - ld a, $3 + ld a, SCRIPT_LANCESROOM_PLAYER_IS_MOVING ld [wLancesRoomCurScript], a ld [wCurMapScript], a ret @@ -114,42 +115,43 @@ WalkToLance_RLEList: db D_LEFT, 6 db -1 ; end -LanceScript3: +LancesRoomPlayerIsMovingScript: ld a, [wSimulatedJoypadStatesIndex] and a ret nz call Delay3 - xor a + xor a ; SCRIPT_LANCESROOM_DEFAULT ld [wJoyIgnore], a ld [wLancesRoomCurScript], a ld [wCurMapScript], a ret LancesRoom_TextPointers: - dw LanceText1 + def_text_pointers + dw_const LancesRoomLanceText, TEXT_LANCESROOM_LANCE LancesRoomTrainerHeaders: def_trainers LancesRoomTrainerHeader0: - trainer EVENT_BEAT_LANCES_ROOM_TRAINER_0, 0, LanceBeforeBattleText, LanceEndBattleText, LanceAfterBattleText + trainer EVENT_BEAT_LANCES_ROOM_TRAINER_0, 0, LancesRoomLanceBeforeBattleText, LancesRoomLanceEndBattleText, LancesRoomLanceAfterBattleText db -1 ; end -LanceText1: +LancesRoomLanceText: text_asm ld hl, LancesRoomTrainerHeader0 call TalkToTrainer jp TextScriptEnd -LanceBeforeBattleText: - text_far _LanceBeforeBattleText +LancesRoomLanceBeforeBattleText: + text_far _LancesRoomLanceBeforeBattleText text_end -LanceEndBattleText: - text_far _LanceEndBattleText +LancesRoomLanceEndBattleText: + text_far _LancesRoomLanceEndBattleText text_end -LanceAfterBattleText: - text_far _LanceAfterBattleText +LancesRoomLanceAfterBattleText: + text_far _LancesRoomLanceAfterBattleText text_asm SetEvent EVENT_BEAT_LANCE jp TextScriptEnd |
