shithub: pokered

Download patch

ref: 1a5a108bdf6904423bfa80cc7bcb5582331740cb
parent: 351146024bdd386c328af0f2abdb04e728e4c133
author: Marcus Huderle <huderlem@gmail.com>
date: Fri Dec 18 14:14:42 EST 2015

Label elite four scripts more completely.

--- a/scripts/agatha.asm
+++ b/scripts/agatha.asm
@@ -1,5 +1,5 @@
 AgathaScript: ; 7642d (1d:642d)
-	call AgathaScript_76443
+	call AgathaShowOrHideExitBlock
 	call EnableAutoTextBoxDrawing
 	ld hl, AgathaTrainerHeaders
 	ld de, AgathaScriptPointers
@@ -8,24 +8,24 @@
 	ld [wAgathaCurScript], a
 	ret
 
-AgathaScript_76443: ; 76443 (1d:6443)
+AgathaShowOrHideExitBlock: ; 76443 (1d:6443)
+; Blocks or clears the exit to the next room.
 	ld hl, wd126
 	bit 5, [hl]
 	res 5, [hl]
 	ret z
 	CheckEvent EVENT_BEAT_AGATHAS_ROOM_TRAINER_0
-	jr z, .asm_76457
+	jr z, .blockExitToNextRoom
 	ld a, $e
-	jp AgathaScript_76459
-.asm_76457
+	jp .setExitBlock
+.blockExitToNextRoom
 	ld a, $3b
-
-AgathaScript_76459: ; 76459 (1d:6459)
+.setExitBlock:
 	ld [wNewTileBlockID], a
 	lb bc, 0, 2
 	predef_jump ReplaceTileBlock
 
-AgathaScript_76464: ; 76464 (1d:6464)
+ResetAgathaScript: ; 76464 (1d:6464)
 	xor a
 	ld [wAgathaCurScript], a
 	ret
@@ -40,7 +40,8 @@
 AgathaScript4: ; 76473 (1d:6473)
 	ret
 
-AgathaScript_76474: ; 76474 (1d:6474)
+AgathaScriptWalkIntoRoom: ; 76474 (1d:6474)
+; Walk six steps upward.
 	ld hl, wSimulatedJoypadStatesEnd
 	ld a, D_UP
 	ld [hli], a
@@ -58,7 +59,7 @@
 	ret
 
 AgathaScript0: ; 76490 (1d:6490)
-	ld hl, CoordsData_764d1
+	ld hl, AgathaEntranceCoords
 	call ArePlayerCoordsInArray
 	jp nc, CheckFightingMapTrainers
 	xor a
@@ -67,14 +68,14 @@
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
 	ld a, [wCoordIndex]
-	cp $3
-	jr c, .asm_764b4
+	cp $3  ; Is player standing one tile above the exit?
+	jr c, .stopPlayerFromLeaving
 	CheckAndSetEvent EVENT_AUTOWALKED_INTO_AGATHAS_ROOM
-	jr z, AgathaScript_76474
-.asm_764b4
+	jr z, AgathaScriptWalkIntoRoom
+.stopPlayerFromLeaving
 	ld a, $2
 	ld [hSpriteIndexOrTextID], a
-	call DisplayTextID
+	call DisplayTextID  ; "Don't run away!"
 	ld a, D_UP
 	ld [wSimulatedJoypadStatesEnd], a
 	ld a, $1
@@ -85,7 +86,7 @@
 	ld [wCurMapScript], a
 	ret
 
-CoordsData_764d1: ; 764d1 (1d:64d1)
+AgathaEntranceCoords: ; 764d1 (1d:64d1)
 	db $0A,$04
 	db $0A,$05
 	db $0B,$04
@@ -107,7 +108,7 @@
 	call EndTrainerBattle
 	ld a, [wIsInBattle]
 	cp $ff
-	jp z, AgathaScript_76464
+	jp z, ResetAgathaScript
 	ld a, $1
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
--- a/scripts/bruno.asm
+++ b/scripts/bruno.asm
@@ -1,5 +1,5 @@
 BrunoScript: ; 762d6 (1d:62d6)
-	call BrunoScript_762ec
+	call BrunoShowOrHideExitBlock
 	call EnableAutoTextBoxDrawing
 	ld hl, BrunoTrainerHeaders
 	ld de, BrunoScriptPointers
@@ -8,24 +8,24 @@
 	ld [wBrunoCurScript], a
 	ret
 
-BrunoScript_762ec: ; 762ec (1d:62ec)
+BrunoShowOrHideExitBlock: ; 762ec (1d:62ec)
+; Blocks or clears the exit to the next room.
 	ld hl, wd126
 	bit 5, [hl]
 	res 5, [hl]
 	ret z
 	CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0
-	jr z, .asm_76300
+	jr z, .blockExitToNextRoom
 	ld a, $5
-	jp BrunoScript_76302
-.asm_76300
+	jp .setExitBlock
+.blockExitToNextRoom
 	ld a, $24
-
-BrunoScript_76302: ; 76302 (1d:6302)
+.setExitBlock
 	ld [wNewTileBlockID], a
 	lb bc, 0, 2
 	predef_jump ReplaceTileBlock
 
-BrunoScript_7630d: ; 7630d (1d:630d)
+ResetBrunoScript: ; 7630d (1d:630d)
 	xor a
 	ld [wBrunoCurScript], a
 	ret
@@ -40,7 +40,8 @@
 BrunoScript4: ; 7631c (1d:631c)
 	ret
 
-BrunoScript_7631d: ; 7631d (1d:631d)
+BrunoScriptWalkIntoRoom: ; 7631d (1d:631d)
+; Walk six steps upward.
 	ld hl, wSimulatedJoypadStatesEnd
 	ld a, D_UP
 	ld [hli], a
@@ -58,7 +59,7 @@
 	ret
 
 BrunoScript0: ; 76339 (1d:6339)
-	ld hl, CoordsData_7637a
+	ld hl, BrunoEntranceCoords
 	call ArePlayerCoordsInArray
 	jp nc, CheckFightingMapTrainers
 	xor a
@@ -67,14 +68,14 @@
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
 	ld a, [wCoordIndex]
-	cp $3
-	jr c, .asm_7635d
+	cp $3  ; Is player standing one tile above the exit?
+	jr c, .stopPlayerFromLeaving
 	CheckAndSetEvent EVENT_AUTOWALKED_INTO_BRUNOS_ROOM
-	jr z, BrunoScript_7631d
-.asm_7635d
+	jr z, BrunoScriptWalkIntoRoom
+.stopPlayerFromLeaving
 	ld a, $2
 	ld [hSpriteIndexOrTextID], a
-	call DisplayTextID
+	call DisplayTextID  ; "Don't run away!"
 	ld a, D_UP
 	ld [wSimulatedJoypadStatesEnd], a
 	ld a, $1
@@ -85,7 +86,7 @@
 	ld [wCurMapScript], a
 	ret
 
-CoordsData_7637a: ; 7637a (1d:637a)
+BrunoEntranceCoords: ; 7637a (1d:637a)
 	db $0A,$04
 	db $0A,$05
 	db $0B,$04
@@ -107,7 +108,7 @@
 	call EndTrainerBattle
 	ld a, [wIsInBattle]
 	cp $ff
-	jp z, BrunoScript_7630d
+	jp z, ResetBrunoScript
 	ld a, $1
 	ld [hSpriteIndexOrTextID], a
 	jp DisplayTextID
--- a/scripts/gary.asm
+++ b/scripts/gary.asm
@@ -4,7 +4,7 @@
 	ld a, [wGaryCurScript]
 	jp CallFunctionInTable
 
-GaryScript_75f29: ; 75f29 (1d:5f29)
+ResetGaryScript: ; 75f29 (1d:5f29)
 	xor a
 	ld [wJoyIgnore], a
 	ld [wGaryCurScript], a
@@ -30,7 +30,7 @@
 	ld a, $ff
 	ld [wJoyIgnore], a
 	ld hl, wSimulatedJoypadStatesEnd
-	ld de, RLEMovement75f63
+	ld de, GaryEntrance_RLEMovement
 	call DecodeRLEList
 	dec a
 	ld [wSimulatedJoypadStatesIndex], a
@@ -39,7 +39,7 @@
 	ld [wGaryCurScript], a
 	ret
 
-RLEMovement75f63: ; 75f63 (1d:5f63)
+GaryEntrance_RLEMovement: ; 75f63 (1d:5f63)
 	db D_UP,1
 	db D_RIGHT,1
 	db D_UP,3
@@ -53,7 +53,7 @@
 	xor a
 	ld [wJoyIgnore], a
 	ld hl, wOptions
-	res 7, [hl]
+	res 7, [hl]  ; Turn on battle animations to make the battle feel more epic.
 	ld a, $1
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
@@ -61,8 +61,8 @@
 	ld hl, wd72d
 	set 6, [hl]
 	set 7, [hl]
-	ld hl, GaryText_760f9
-	ld de, GaryText_760fe
+	ld hl, GaryDefeatedText
+	ld de, GaryVictoryText
 	call SaveEndBattleTextPointers
 	ld a, OPP_SONY3
 	ld [wCurOpponent], a
@@ -70,17 +70,17 @@
 	; select which team to use during the encounter
 	ld a, [wRivalStarter]
 	cp STARTER2
-	jr nz, .NotSquirtle
+	jr nz, .NotStarter2
 	ld a, $1
-	jr .done
-.NotSquirtle
+	jr .saveTrainerId
+.NotStarter2
 	cp STARTER3
-	jr nz, .Charmander
+	jr nz, .NotStarter3
 	ld a, $2
-	jr .done
-.Charmander
+	jr .saveTrainerId
+.NotStarter3
 	ld a, $3
-.done
+.saveTrainerId
 	ld [wTrainerNo], a
 
 	xor a
@@ -92,7 +92,7 @@
 GaryScript3: ; 75fbb (1d:5fbb)
 	ld a, [wIsInBattle]
 	cp $ff
-	jp z, GaryScript_75f29
+	jp z, ResetGaryScript
 	call UpdateSprites
 	SetEvent EVENT_BEAT_CHAMPION_RIVAL
 	ld a, $f0
@@ -115,7 +115,7 @@
 	ld a, $2
 	ld [H_SPRITEINDEX], a
 	call SetSpriteMovementBytesToFF
-	ld de, MovementData_76014
+	ld de, OakEntranceAfterVictoryMovement
 	ld a, $2
 	ld [H_SPRITEINDEX], a
 	call MoveSprite
@@ -126,7 +126,7 @@
 	ld [wGaryCurScript], a
 	ret
 
-MovementData_76014: ; 76014 (1d:6014)
+OakEntranceAfterVictoryMovement: ; 76014 (1d:6014)
 	db NPC_MOVEMENT_UP
 	db NPC_MOVEMENT_UP
 	db NPC_MOVEMENT_UP
@@ -179,7 +179,7 @@
 	ld a, $5
 	ld [hSpriteIndexOrTextID], a
 	call GaryScript_760c8
-	ld de, MovementData_76080
+	ld de, OakExitGaryRoomMovement
 	ld a, $2
 	ld [H_SPRITEINDEX], a
 	call MoveSprite
@@ -187,7 +187,7 @@
 	ld [wGaryCurScript], a
 	ret
 
-MovementData_76080: ; 76080 (1d:6080)
+OakExitGaryRoomMovement: ; 76080 (1d:6080)
 	db NPC_MOVEMENT_UP
 	db NPC_MOVEMENT_UP
 	db $FF
@@ -207,7 +207,7 @@
 	ld a, $ff
 	ld [wJoyIgnore], a
 	ld hl, wSimulatedJoypadStatesEnd
-	ld de, RLEMovement760b4
+	ld de, WalkToHallOfFame_RLEMovment
 	call DecodeRLEList
 	dec a
 	ld [wSimulatedJoypadStatesIndex], a
@@ -216,7 +216,7 @@
 	ld [wGaryCurScript], a
 	ret
 
-RLEMovement760b4: ; 760b4 (1d:60b4)
+WalkToHallOfFame_RLEMovment: ; 760b4 (1d:60b4)
 	db D_UP,4
 	db D_LEFT,1
 	db $ff
@@ -249,23 +249,23 @@
 GaryText1: ; 760e0 (1d:60e0)
 	TX_ASM
 	CheckEvent EVENT_BEAT_CHAMPION_RIVAL
-	ld hl, GaryText_760f4
-	jr z, .asm_17e9f
+	ld hl, GaryChampionIntroText
+	jr z, .printText
 	ld hl, GaryText_76103
-.asm_17e9f
+.printText
 	call PrintText
 	jp TextScriptEnd
 
-GaryText_760f4: ; 760f4 (1d:60f4)
-	TX_FAR _GaryText_760f4
+GaryChampionIntroText: ; 760f4 (1d:60f4)
+	TX_FAR _GaryChampionIntroText
 	db "@"
 
-GaryText_760f9: ; 760f9 (1d:60f9)
-	TX_FAR _GaryText_760f9
+GaryDefeatedText: ; 760f9 (1d:60f9)
+	TX_FAR _GaryDefeatedText
 	db "@"
 
-GaryText_760fe: ; 760fe (1d:60fe)
-	TX_FAR _GaryText_760fe
+GaryVictoryText: ; 760fe (1d:60fe)
+	TX_FAR _GaryVictoryText
 	db "@"
 
 GaryText_76103: ; 76103 (1d:6103)
--- a/scripts/lance.asm
+++ b/scripts/lance.asm
@@ -1,5 +1,5 @@
 LanceScript: ; 5a2ae (16:62ae)
-	call LanceScript_5a2c4
+	call LanceShowOrHideEntranceBlocks
 	call EnableAutoTextBoxDrawing
 	ld hl, LanceTrainerHeaders
 	ld de, LanceScriptPointers
@@ -8,34 +8,36 @@
 	ld [wLanceCurScript], a
 	ret
 
-LanceScript_5a2c4: ; 5a2c4 (16:62c4)
+LanceShowOrHideEntranceBlocks: ; 5a2c4 (16:62c4)
 	ld hl, wd126
 	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 LanceScript_5a2de
-.asm_5a2da
+	jp LanceSetEntranceBlocks
+.closeEntrance
 	ld a, $72
 	ld b, $73
 
-LanceScript_5a2de: ; 5a2de (16:62de)
+LanceSetEntranceBlocks: ; 5a2de (16:62de)
+; Replaces the tile blocks so the player can't leave.
 	push bc
 	ld [wNewTileBlockID], a
 	lb bc, 6, 2
-	call LanceScript_5a2f0
+	call LanceSetEntranceBlock
 	pop bc
 	ld a, b
 	ld [wNewTileBlockID], a
 	lb bc, 6, 3
 
-LanceScript_5a2f0: ; 5a2f0 (16:62f0)
+LanceSetEntranceBlock: ; 5a2f0 (16:62f0)
 	predef_jump ReplaceTileBlock
 
-LanceScript_5a2f5: ; 5a2f5 (16:62f5)
+ResetLanceScript: ; 5a2f5 (16:62f5)
 	xor a
 	ld [wLanceCurScript], a
 	ret
@@ -53,20 +55,20 @@
 LanceScript0: ; 5a305 (16:6305)
 	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
@@ -73,9 +75,9 @@
 	set 5, [hl]
 	ld a, SFX_GO_INSIDE
 	call PlaySound
-	jp LanceScript_5a2c4
+	jp LanceShowOrHideEntranceBlocks
 
-CoordsData_5a33e: ; 5a33e (16:633e)
+LanceTriggerMovementCoords: ; 5a33e (16:633e)
 	db $01,$05
 	db $02,$06
 	db $0B,$05
@@ -87,16 +89,17 @@
 	call EndTrainerBattle
 	ld a, [wIsInBattle]
 	cp $ff
-	jp z, LanceScript_5a2f5
+	jp z, ResetLanceScript
 	ld a, $1
 	ld [hSpriteIndexOrTextID], a
 	jp DisplayTextID
 
-LanceScript_5a35b: ; 5a35b (16:635b)
+WalkToLance: ; 5a35b (16:635b)
+; 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
@@ -106,7 +109,7 @@
 	ld [wCurMapScript], a
 	ret
 
-RLEList_5a379: ; 5a379 (16:6379)
+WalkToLance_RLEList: ; 5a379 (16:6379)
 	db D_UP, $0C
 	db D_LEFT, $0C
 	db D_DOWN, $07
--- a/scripts/lorelei.asm
+++ b/scripts/lorelei.asm
@@ -1,5 +1,5 @@
 LoreleiScript: ; 7617b (1d:617b)
-	call LoreleiScript_76191
+	call LoreleiShowOrHideExitBlock
 	call EnableAutoTextBoxDrawing
 	ld hl, LoreleiTrainerHeaders
 	ld de, LoreleiScriptPointers
@@ -8,7 +8,8 @@
 	ld [wLoreleiCurScript], a
 	ret
 
-LoreleiScript_76191: ; 76191 (1d:6191)
+LoreleiShowOrHideExitBlock: ; 76191 (1d:6191)
+; Blocks or clears the exit to the next room.
 	ld hl, wd126
 	bit 5, [hl]
 	res 5, [hl]
@@ -16,17 +17,17 @@
 	ld hl, wBeatLorelei
 	set 1, [hl]
 	CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0
-	jr z, .asm_761a9
+	jr z, .blockExitToNextRoom
 	ld a, $5
-	jr .asm_761ab
-.asm_761a9
+	jr .setExitBlock
+.blockExitToNextRoom
 	ld a, $24
-.asm_761ab
+.setExitBlock
 	ld [wNewTileBlockID], a
 	lb bc, 0, 2
 	predef_jump ReplaceTileBlock
 
-LoreleiScript_761b6: ; 761b6 (1d:61b6)
+ResetLoreleiScript: ; 761b6 (1d:61b6)
 	xor a
 	ld [wLoreleiCurScript], a
 	ret
@@ -41,7 +42,8 @@
 LoreleiScript4: ; 761c5 (1d:61c5)
 	ret
 
-LoreleiScript_761c6: ; 761c6 (1d:61c6)
+LoreleiScriptWalkIntoRoom: ; 761c6 (1d:61c6)
+; Walk six steps upward.
 	ld hl, wSimulatedJoypadStatesEnd
 	ld a, D_UP
 	ld [hli], a
@@ -59,7 +61,7 @@
 	ret
 
 LoreleiScript0: ; 761e2 (1d:61e2)
-	ld hl, CoordsData_76223
+	ld hl, LoreleiEntranceCoords
 	call ArePlayerCoordsInArray
 	jp nc, CheckFightingMapTrainers
 	xor a
@@ -68,14 +70,14 @@
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
 	ld a, [wCoordIndex]
-	cp $3
-	jr c, .asm_76206
+	cp $3  ; Is player standing one tile above the exit?
+	jr c, .stopPlayerFromLeaving
 	CheckAndSetEvent EVENT_AUTOWALKED_INTO_LORELEIS_ROOM
-	jr z, LoreleiScript_761c6
-.asm_76206
+	jr z, LoreleiScriptWalkIntoRoom
+.stopPlayerFromLeaving
 	ld a, $2
 	ld [hSpriteIndexOrTextID], a
-	call DisplayTextID
+	call DisplayTextID  ; "Don't run away!"
 	ld a, D_UP
 	ld [wSimulatedJoypadStatesEnd], a
 	ld a, $1
@@ -86,7 +88,7 @@
 	ld [wCurMapScript], a
 	ret
 
-CoordsData_76223: ; 76223 (1d:6223)
+LoreleiEntranceCoords: ; 76223 (1d:6223)
 	db $0A,$04
 	db $0A,$05
 	db $0B,$04
@@ -103,11 +105,12 @@
 	ld [wLoreleiCurScript], a
 	ld [wCurMapScript], a
 	ret
+
 LoreleiScript2: ; 7623f (1d:623f)
 	call EndTrainerBattle
 	ld a, [wIsInBattle]
 	cp $ff
-	jp z, LoreleiScript_761b6
+	jp z, ResetLoreleiScript
 	ld a, $1
 	ld [hSpriteIndexOrTextID], a
 	jp DisplayTextID
--- a/text/maps/champion.asm
+++ b/text/maps/champion.asm
@@ -1,4 +1,4 @@
-_GaryText_760f4::
+_GaryChampionIntroText::
 	text $53, ": Hey!"
 
 	para "I was looking"
@@ -35,7 +35,7 @@
 	cont "in the world!"
 	done
 
-_GaryText_760f9::
+_GaryDefeatedText::
 	text "NO!"
 	line "That can't be!"
 	cont "You beat my best!"
@@ -49,7 +49,7 @@
 	cont "It's not fair!"
 	prompt
 
-_GaryText_760fe::
+_GaryVictoryText::
 	text "Hahaha!"
 	line "I won, I won!"