summaryrefslogtreecommitdiff
path: root/scripts/lance.asm
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lance.asm')
-rwxr-xr-xscripts/lance.asm63
1 files changed, 33 insertions, 30 deletions
diff --git a/scripts/lance.asm b/scripts/lance.asm
index b2cf9207..7d67f6cd 100755
--- a/scripts/lance.asm
+++ b/scripts/lance.asm
@@ -1,42 +1,44 @@
LanceScript:
- call LanceScript_5a2c4
+ call LanceShowOrHideEntranceBlocks
call EnableAutoTextBoxDrawing
ld hl, LanceTrainerHeaders
ld de, LanceScriptPointers
- ld a, [W_LANCECURSCRIPT]
+ ld a, [wLanceCurScript]
call ExecuteCurMapScriptInTable
- ld [W_LANCECURSCRIPT], a
+ ld [wLanceCurScript], a
ret
-LanceScript_5a2c4:
- ld hl, wd126
+LanceShowOrHideEntranceBlocks:
+ ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR
- jr nz, .asm_5a2da
+ jr nz, .closeEntrance
+ ; open entrance
ld a, $31
ld b, $32
- jp .asm_5a2de
+ jp .LanceSetEntranceBlocks
-.asm_5a2da
+.closeEntrance
ld a, $72
ld b, $73
-.asm_5a2de
+.LanceSetEntranceBlocks
+; Replaces the tile blocks so the player can't leave.
push bc
ld [wNewTileBlockID], a
lb bc, 6, 2
- call .asm_5a2f0
+ call .LanceSetEntranceBlock
pop bc
ld a, b
ld [wNewTileBlockID], a
lb bc, 6, 3
-.asm_5a2f0
+.LanceSetEntranceBlock
predef_jump ReplaceTileBlock
-LanceScript_5a2f5:
+ResetLanceScript:
xor a
- ld [W_LANCECURSCRIPT], a
+ ld [wLanceCurScript], a
ret
LanceScriptPointers:
@@ -52,29 +54,29 @@ LanceScript4:
LanceScript0:
CheckEvent EVENT_BEAT_LANCE
ret nz
- ld hl, CoordsData_5a33e
+ ld hl, LanceTriggerMovementCoords
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
ld [hJoyHeld], a
ld a, [wCoordIndex]
- cp $3
- jr nc, .asm_5a325
+ cp $3 ; Is player standing next to Lance's sprite?
+ jr nc, .notStandingNextToLance
ld a, $1
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
-.asm_5a325
- cp $5
- jr z, LanceScript_5a35b
+.notStandingNextToLance
+ cp $5 ; Is player standing on the entrance staircase?
+ jr z, WalkToLance
CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR
ret nz
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, SFX_GO_INSIDE
call PlaySound
- jp LanceScript_5a2c4
+ jp LanceShowOrHideEntranceBlocks
-CoordsData_5a33e:
+LanceTriggerMovementCoords:
db $01,$05
db $02,$06
db $0B,$05
@@ -86,26 +88,27 @@ LanceScript2:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
- jp z, LanceScript_5a2f5
+ jp z, ResetLanceScript
ld a, $1
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
-LanceScript_5a35b:
+WalkToLance:
+; Moves the player down the hallway to Lance's room.
ld a, $ff
ld [wJoyIgnore], a
ld hl, wSimulatedJoypadStatesEnd
- ld de, RLEList_5a379
+ ld de, WalkToLance_RLEList
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $3
- ld [W_LANCECURSCRIPT], a
- ld [W_CURMAPSCRIPT], a
+ ld [wLanceCurScript], a
+ ld [wCurMapScript], a
ret
-RLEList_5a379:
+WalkToLance_RLEList:
db D_UP, $0D
db D_LEFT, $0C
db D_DOWN, $07
@@ -119,8 +122,8 @@ LanceScript3:
call Delay3
xor a
ld [wJoyIgnore], a
- ld [W_LANCECURSCRIPT], a
- ld [W_CURMAPSCRIPT], a
+ ld [wLanceCurScript], a
+ ld [wCurMapScript], a
ret
LanceTextPointers: