shithub: pokered

Download patch

ref: d218d1972a9be5b9d0025a17842239e1fbf5b622
parent: ebecf8f7b540e670afa974104a3aa9317f696316
author: Marcus Huderle <huderlem@gmail.com>
date: Tue May 13 06:43:09 EDT 2014

Documented/Labeled Route 22 scripts.

--- a/main.asm
+++ b/main.asm
@@ -77684,7 +77684,7 @@
 	db $5, $8, $0, ROUTE_22_GATE
 
 	db $1 ; signs
-	db $b, $7, $3 ; Route22Text3
+	db $b, $7, $3 ; Route22FrontGateText
 
 	db $2 ; people
 	db SPRITE_BLUE, $5 + 4, $19 + 4, $ff, $ff, $1 ; person
@@ -78450,8 +78450,8 @@
 	ld [W_TRAINERNO], a ; $d05d
 	ret
 
-Func_50ee6: ; 50ee6 (14:4ee6)
-	ld de, MovementData_50efb ; $4efb
+Route22MoveRivalSprite: ; 50ee6 (14:4ee6)
+	ld de, Route22RivalMovementData ; $4efb
 	ld a, [$cf0d]
 	cp $1
 	jr z, .asm_50ef1
@@ -78462,14 +78462,14 @@
 	ld [$ff8d], a
 	jp Func_34a6
 
-MovementData_50efb: ; 50efb (14:4efb)
-	db $C0,$C0,$C0,$C0,$FF
+Route22RivalMovementData: ; 50efb (14:4efb)
+	db $C0,$C0,$C0,$C0,$FF ; move right 4 times
 
 Route22Script0: ; 50f00 (14:4f00)
 	ld a, [$d7eb]
 	bit 7, a
 	ret z
-	ld hl, .CoordsData_50f2d ; $4f2d
+	ld hl, .Route22RivalBattleCoords ; $4f2d
 	call ArePlayerCoordsInArray
 	ret nc
 	ld a, [$cd3d]
@@ -78481,18 +78481,18 @@
 	ld a, $2
 	ld [$d528], a
 	ld a, [$d7eb]
-	bit 0, a
-	jr nz, .asm_50f32 ; 0x50f25 $b
-	bit 1, a
+	bit 0, a ; is this the rival battle at the beginning of the game?
+	jr nz, .firstRivalBattle ; 0x50f25 $b
+	bit 1, a ; is this the rival at the end of the game?
 	jp nz, Func_5104e
 	ret
 
-.CoordsData_50f2d
+.Route22RivalBattleCoords
 	db $04, $1D
 	db $05, $1D
 	db $FF
 
-.asm_50f32
+.firstRivalBattle
 	ld a, $1
 	ld [$cd4f], a
 	xor a
@@ -78511,7 +78511,7 @@
 	call PlayMusic
 	ld a, $1
 	ld [$ff8c], a
-	call Func_50ee6
+	call Route22MoveRivalSprite
 	ld a, $1
 	ld [W_ROUTE22CURSCRIPT], a
 	ret
@@ -78542,10 +78542,10 @@
 	ld hl, $d72d
 	set 6, [hl]
 	set 7, [hl]
-	ld hl, UnnamedText_511b7
+	ld hl, Route22RivalDefeatedText1
 	ld de, UnnamedText_511bc
 	call PreBattleSaveRegisters
-	ld a, $e1
+	ld a, SONY1 + $C8
 	ld [$d059], a
 	ld hl, StarterMons_50faf ; $4faf
 	call Func_50ed6
@@ -78554,6 +78554,7 @@
 	ret
 
 StarterMons_50faf: ; 50faf (14:4faf)
+; starter the rival picked, rival trainer number
 	db SQUIRTLE,$04
 	db BULBASAUR,$05
 	db CHARMANDER,$06
@@ -78598,21 +78599,21 @@
 	ret
 
 Func_51008: ; 51008 (14:5008)
-	ld de, MovementData_51017 ; $5017
+	ld de, Route22RivalExitMovementData1 ; $5017
 	jr asm_51010
 
 Func_5100d: ; 5100d (14:500d)
-	ld de, MovementData_5101f ; $501f
+	ld de, Route22RivalExitMovementData2 ; $501f
 asm_51010
 	ld a, $1
 	ld [H_SPRITEHEIGHT], a
 	jp MoveSprite
 
-MovementData_51017: ; 51017 (14:5017)
-	db $C0,$C0,$00,$00,$00,$00,$00,$FF
+Route22RivalExitMovementData1: ; 51017 (14:5017)
+	db $C0,$C0,$00,$00,$00,$00,$00,$FF ; right x2, down x5
 
-MovementData_5101f: ; 5101f (14:501f)
-	db $40,$C0,$C0,$C0,$00,$00,$00,$00,$00,$00,$FF
+Route22RivalExitMovementData2: ; 5101f (14:501f)
+	db $40,$C0,$C0,$C0,$00,$00,$00,$00,$00,$00,$FF ; up x1, right x3, down x6
 
 Route22Script3: ; 5102a (14:502a)
 	ld a, [$d730]
@@ -78652,7 +78653,7 @@
 	callba Music_RivalAlternateTempo
 	ld a, $2
 	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
-	call Func_50ee6
+	call Route22MoveRivalSprite
 	ld a, $4
 	ld [W_ROUTE22CURSCRIPT], a
 	ret
@@ -78685,7 +78686,7 @@
 	ld hl, $d72d
 	set 6, [hl]
 	set 7, [hl]
-	ld hl, UnnamedText_511cb ; $51cb
+	ld hl, Route22RivalDefeatedText2 ; $51cb
 	ld de, UnnamedText_511d0 ; $51d0
 	call PreBattleSaveRegisters
 	ld a, $f2
@@ -78756,10 +78757,10 @@
 	jp MoveSprite
 
 MovementData_5114c: ; 5114c (14:514c)
-	db $80
+	db $80 ; left
 
 MovementData_5114d: ; 5114d (14:514d)
-	db $80,$80,$80,$FF
+	db $80,$80,$80,$FF ; left x3
 
 Route22Script6: ; 51151 (14:5151)
 	ld a, [$d730]
@@ -78782,7 +78783,7 @@
 Route22TextPointers: ; 51175 (14:5175)
 	dw Route22Text1
 	dw Route22Text2
-	dw Route22Text3
+	dw Route22FrontGateText
 
 Route22Text1: ; 5117b (14:517b)
 	db $08 ; asm
@@ -78789,11 +78790,11 @@
 	ld a, [$d7eb]
 	bit 5, a
 	jr z, .asm_a88cf ; 0x51181
-	ld hl, UnnamedText_511b2
+	ld hl, Route22RivalAfterBattleText1
 	call PrintText
 	jr .asm_48088 ; 0x51189
 .asm_a88cf ; 0x5118b
-	ld hl, UnnamedText_511ad
+	ld hl, Route22RivalBeforeBattleText1
 	call PrintText
 .asm_48088 ; 0x51191
 	jp TextScriptEnd
@@ -78803,25 +78804,25 @@
 	ld a, [$d7eb]
 	bit 6, a
 	jr z, .asm_58c0a ; 0x5119a
-	ld hl, UnnamedText_511c6
+	ld hl, Route22RivalAfterBattleText2
 	call PrintText
 	jr .asm_673ee ; 0x511a2
 .asm_58c0a ; 0x511a4
-	ld hl, UnnamedText_511c1
+	ld hl, Route22RivalBeforeBattleText2
 	call PrintText
 .asm_673ee ; 0x511aa
 	jp TextScriptEnd
 
-UnnamedText_511ad: ; 511ad (14:51ad)
-	TX_FAR _UnnamedText_511ad
+Route22RivalBeforeBattleText1: ; 511ad (14:51ad)
+	TX_FAR _Route22RivalBeforeBattleText1
 	db "@"
 
-UnnamedText_511b2: ; 511b2 (14:51b2)
-	TX_FAR _UnnamedText_511b2
+Route22RivalAfterBattleText1: ; 511b2 (14:51b2)
+	TX_FAR _Route22RivalAfterBattleText1
 	db "@"
 
-UnnamedText_511b7: ; 511b7 (14:51b7)
-	TX_FAR _UnnamedText_511b7
+Route22RivalDefeatedText1: ; 511b7 (14:51b7)
+	TX_FAR _Route22RivalDefeatedText1
 	db "@"
 
 UnnamedText_511bc: ; 511bc (14:51bc)
@@ -78828,16 +78829,16 @@
 	TX_FAR _UnnamedText_511bc
 	db "@"
 
-UnnamedText_511c1: ; 511c1 (14:51c1)
-	TX_FAR _UnnamedText_511c1
+Route22RivalBeforeBattleText2: ; 511c1 (14:51c1)
+	TX_FAR _Route22RivalBeforeBattleText2
 	db "@"
 
-UnnamedText_511c6: ; 511c6 (14:51c6)
-	TX_FAR _UnnamedText_511c6
+Route22RivalAfterBattleText2: ; 511c6 (14:51c6)
+	TX_FAR _Route22RivalAfterBattleText2
 	db "@"
 
-UnnamedText_511cb: ; 511cb (14:51cb)
-	TX_FAR _UnnamedText_511cb
+Route22RivalDefeatedText2: ; 511cb (14:51cb)
+	TX_FAR _Route22RivalDefeatedText2
 	db "@"
 
 UnnamedText_511d0: ; 511d0 (14:51d0)
@@ -78844,8 +78845,8 @@
 	TX_FAR _UnnamedText_511d0
 	db "@"
 
-Route22Text3: ; 511d5 (14:51d5)
-	TX_FAR _Route22Text3
+Route22FrontGateText: ; 511d5 (14:51d5)
+	TX_FAR _Route22FrontGateText
 	db "@"
 
 Route23Script: ; 511da (14:51da)
--- a/text/maps/route_22.asm
+++ b/text/maps/route_22.asm
@@ -1,4 +1,4 @@
-_UnnamedText_511ad:: ; 922cd (24:62cd)
+_Route22RivalBeforeBattleText1:: ; 922cd (24:62cd)
 	text $53, ": Hey!"
 	line $52, "!"
 
@@ -17,7 +17,7 @@
 	cont "get any stronger?"
 	done
 
-_UnnamedText_511b2:: ; 9236f (24:636f)
+_Route22RivalAfterBattleText1:: ; 9236f (24:636f)
 	text "I heard #MON"
 	line "LEAGUE has many"
 	cont "tough trainers!"
@@ -31,7 +31,7 @@
 	cont "a move on!"
 	done
 
-_UnnamedText_511b7:: ; 923f4 (24:63f4)
+_Route22RivalDefeatedText1:: ; 923f4 (24:63f4)
 	text "Awww!"
 	line "You just lucked"
 	cont "out!"
@@ -46,7 +46,7 @@
 	cont "some more too!"
 	prompt
 
-_UnnamedText_511c1:: ; 92450 (24:6450)
+_Route22RivalBeforeBattleText2:: ; 92450 (24:6450)
 	text $53, ": What?"
 	line $52, "! What a"
 	cont "surprise to see"
@@ -67,7 +67,7 @@
 	para "Come on!"
 	done
 
-_UnnamedText_511c6:: ; 92506 (24:6506)
+_Route22RivalAfterBattleText2:: ; 92506 (24:6506)
 	text "That loosened me"
 	line "up! I'm ready for"
 	cont "#MON LEAGUE!"
@@ -80,7 +80,7 @@
 	cont "here. Smell ya!"
 	done
 
-_UnnamedText_511cb:: ; 92583 (24:6583)
+_Route22RivalDefeatedText2:: ; 92583 (24:6583)
 	text "What!?"
 
 	para "I was just"
@@ -98,7 +98,7 @@
 	line "more! You loser!"
 	prompt
 
-_Route22Text3:: ; 92606 (24:6606)
+_Route22FrontGateText:: ; 92606 (24:6606)
 	text "#MON LEAGUE"
 	line "Front Gate"
 	done