From d001ced41b53271373753de835a9c3b3413dc318 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Thu, 13 Jul 2023 20:27:56 -0500 Subject: 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. --- scripts/Route22Gate.asm | 60 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'scripts/Route22Gate.asm') diff --git a/scripts/Route22Gate.asm b/scripts/Route22Gate.asm index 8a726515..9bca889d 100644 --- a/scripts/Route22Gate.asm +++ b/scripts/Route22Gate.asm @@ -6,24 +6,25 @@ Route22Gate_Script: ld a, [wYCoord] cp 4 ld a, ROUTE_23 - jr c, .asm_1e69a + jr c, .set_last_map ld a, ROUTE_22 -.asm_1e69a +.set_last_map ld [wLastMap], a ret Route22Gate_ScriptPointers: - dw Route22GateScript0 - dw Route22GateScript1 - dw Route22GateScript2 + def_script_pointers + dw_const Route22GateDefaultScript, SCRIPT_ROUTE22GATE_DEFAULT + dw_const Route22GatePlayerMovingScript, SCRIPT_ROUTE22GATE_PLAYER_MOVING + dw_const Route22GateNoopScript, SCRIPT_ROUTE22GATE_NOOP -Route22GateScript0: +Route22GateDefaultScript: ld hl, Route22GateScriptCoords call ArePlayerCoordsInArray ret nc xor a ldh [hJoyHeld], a - ld a, $1 + ld a, TEXT_ROUTE22GATE_GUARD ldh [hSpriteIndexOrTextID], a jp DisplayTextID @@ -32,7 +33,7 @@ Route22GateScriptCoords: dbmapcoord 5, 2 db -1 ; end -Route22GateScript_1e6ba: +Route22GateMovePlayerDownScript: ld a, $1 ld [wSimulatedJoypadStatesIndex], a ld a, D_DOWN @@ -41,53 +42,54 @@ Route22GateScript_1e6ba: ld [wJoyIgnore], a jp StartSimulatingJoypadStates -Route22GateScript1: +Route22GatePlayerMovingScript: ld a, [wSimulatedJoypadStatesIndex] and a ret nz xor a ld [wJoyIgnore], a call Delay3 - ld a, $0 + ld a, SCRIPT_ROUTE22GATE_DEFAULT ld [wRoute22GateCurScript], a -Route22GateScript2: +Route22GateNoopScript: ret Route22Gate_TextPointers: - dw Route22GateText1 + def_text_pointers + dw_const Route22GateGuardText, TEXT_ROUTE22GATE_GUARD -Route22GateText1: +Route22GateGuardText: text_asm ld a, [wObtainedBadges] bit BIT_BOULDERBADGE, a - jr nz, .asm_1e6f6 - ld hl, Route22GateText_1e704 + jr nz, .has_boulderbadge + ld hl, Route22GateGuardNoBoulderbadgeText call PrintText - call Route22GateScript_1e6ba - ld a, $1 - jr .asm_1e6fe -.asm_1e6f6 - ld hl, Route22GateText_1e71a + call Route22GateMovePlayerDownScript + ld a, SCRIPT_ROUTE22GATE_PLAYER_MOVING + jr .set_current_script +.has_boulderbadge + ld hl, Route22GateGuardGoRightAheadText call PrintText - ld a, $2 -.asm_1e6fe + ld a, SCRIPT_ROUTE22GATE_NOOP +.set_current_script ld [wRoute22GateCurScript], a jp TextScriptEnd -Route22GateText_1e704: - text_far _Route22GateText_1e704 +Route22GateGuardNoBoulderbadgeText: + text_far _Route22GateGuardNoBoulderbadgeText text_asm ld a, SFX_DENIED call PlaySoundWaitForCurrent call WaitForSoundToFinish - ld hl, Route22GateText_1e715 + ld hl, Route22GateGuardICantLetYouPassText ret -Route22GateText_1e715: - text_far _Route22GateText_1e715 +Route22GateGuardICantLetYouPassText: + text_far _Route22GateGuardICantLetYouPassText text_end -Route22GateText_1e71a: - text_far _Route22GateText_1e71a +Route22GateGuardGoRightAheadText: + text_far _Route22GateGuardGoRightAheadText sound_get_item_1 text_end -- cgit v1.3.1-sl0p