aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/LoreleisRoom.asm
diff options
context:
space:
mode:
authorvulcandth <vulcandth@gmail.com>2023-07-13 20:27:56 -0500
committerGitHub <noreply@github.com>2023-07-13 21:27:56 -0400
commitd001ced41b53271373753de835a9c3b3413dc318 (patch)
treeff2db7f403bddfcdeb12e50def8411cafedcdd5e /scripts/LoreleisRoom.asm
parentMake wCurrentBoxNum a byte instead of word (#414) (diff)
downloadpokeyellow-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/LoreleisRoom.asm')
-rw-r--r--scripts/LoreleisRoom.asm54
1 files changed, 28 insertions, 26 deletions
diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm
index 1f42fa2e..c1cc2adb 100644
--- a/scripts/LoreleisRoom.asm
+++ b/scripts/LoreleisRoom.asm
@@ -28,18 +28,19 @@ LoreleiShowOrHideExitBlock:
predef_jump ReplaceTileBlock
ResetLoreleiScript:
- xor a
+ xor a ; SCRIPT_LORELEISROOM_DEFAULT
ld [wLoreleisRoomCurScript], a
ret
LoreleisRoom_ScriptPointers:
- dw LoreleiScript0
- dw DisplayEnemyTrainerTextAndStartBattle
- dw LoreleiScript2
- dw LoreleiScript3
- dw LoreleiScript4
+ def_script_pointers
+ dw_const LoreleisRoomDefaultScript, SCRIPT_LORELEISROOM_DEFAULT
+ dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_LORELEISROOM_LORELEI_START_BATTLE
+ dw_const LoreleisRoomLoreleiEndBattleScript, SCRIPT_LORELEISROOM_LORELEI_END_BATTLE
+ dw_const LoreleisRoomPlayerIsMovingScript, SCRIPT_LORELEISROOM_PLAYER_IS_MOVING
+ dw_const LoreleisRoomNoopScript, SCRIPT_LORELEISROOM_NOOP
-LoreleiScript4:
+LoreleisRoomNoopScript:
ret
LoreleiScriptWalkIntoRoom:
@@ -55,12 +56,12 @@ LoreleiScriptWalkIntoRoom:
ld a, $6
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
- ld a, $3
+ ld a, SCRIPT_LORELEISROOM_PLAYER_IS_MOVING
ld [wLoreleisRoomCurScript], a
ld [wCurMapScript], a
ret
-LoreleiScript0:
+LoreleisRoomDefaultScript:
ld hl, LoreleiEntranceCoords
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
@@ -75,7 +76,7 @@ LoreleiScript0:
CheckAndSetEvent EVENT_AUTOWALKED_INTO_LORELEIS_ROOM
jr z, LoreleiScriptWalkIntoRoom
.stopPlayerFromLeaving
- ld a, $2
+ ld a, TEXT_LORELEISROOM_DONT_RUN_AWAY
ldh [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
ld a, D_UP
@@ -83,7 +84,7 @@ LoreleiScript0:
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
- ld a, $3
+ ld a, SCRIPT_LORELEISROOM_PLAYER_IS_MOVING
ld [wLoreleisRoomCurScript], a
ld [wCurMapScript], a
ret
@@ -95,7 +96,7 @@ LoreleiEntranceCoords:
dbmapcoord 5, 11
db -1 ; end
-LoreleiScript3:
+LoreleisRoomPlayerIsMovingScript:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
@@ -106,43 +107,44 @@ LoreleiScript3:
ld [wCurMapScript], a
ret
-LoreleiScript2:
+LoreleisRoomLoreleiEndBattleScript:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetLoreleiScript
- ld a, $1
+ ld a, TEXT_LORELEISROOM_LORELEI
ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
LoreleisRoom_TextPointers:
- dw LoreleiText1
- dw LoreleiDontRunAwayText
+ def_text_pointers
+ dw_const LoreleisRoomLoreleiText, TEXT_LORELEISROOM_LORELEI
+ dw_const LoreleisRoomLoreleiDontRunAwayText, TEXT_LORELEISROOM_DONT_RUN_AWAY
LoreleisRoomTrainerHeaders:
def_trainers
LoreleisRoomTrainerHeader0:
- trainer EVENT_BEAT_LORELEIS_ROOM_TRAINER_0, 0, LoreleiBeforeBattleText, LoreleiEndBattleText, LoreleiAfterBattleText
+ trainer EVENT_BEAT_LORELEIS_ROOM_TRAINER_0, 0, LoreleisRoomLoreleiBeforeBattleText, LoreleisRoomLoreleiEndBattleText, LoreleisRoomLoreleiAfterBattleText
db -1 ; end
-LoreleiText1:
+LoreleisRoomLoreleiText:
text_asm
ld hl, LoreleisRoomTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
-LoreleiBeforeBattleText:
- text_far _LoreleiBeforeBattleText
+LoreleisRoomLoreleiBeforeBattleText:
+ text_far _LoreleisRoomLoreleiBeforeBattleText
text_end
-LoreleiEndBattleText:
- text_far _LoreleiEndBattleText
+LoreleisRoomLoreleiEndBattleText:
+ text_far _LoreleisRoomLoreleiEndBattleText
text_end
-LoreleiAfterBattleText:
- text_far _LoreleiAfterBattleText
+LoreleisRoomLoreleiAfterBattleText:
+ text_far _LoreleisRoomLoreleiAfterBattleText
text_end
-LoreleiDontRunAwayText:
- text_far _LoreleiDontRunAwayText
+LoreleisRoomLoreleiDontRunAwayText:
+ text_far _LoreleisRoomLoreleiDontRunAwayText
text_end