shithub: pokered

Download patch

ref: 2e45c2946a3cf7ba18de6b9d6fc4549165666864
parent: 8d2afb7c1324adf6f6b70637a8300073c0a2cb81
author: deak311andris <deak311andris@gmail.com>
date: Mon Oct 7 03:23:57 EDT 2019

Deobfuscate gyms consistently

--- a/scripts/CeladonGym.asm
+++ b/scripts/CeladonGym.asm
@@ -54,12 +54,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM21
-	jr .asm_4898c
+	jr .gymVictory
 .BagFull
 	ld a, $b
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_4898c
+.gymVictory
 	ld hl, wObtainedBadges
 	set 3, [hl]
 	ld hl, wBeatGymFlags
@@ -151,17 +151,17 @@
 CeladonGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_ERIKA
-	jr z, .asm_48a2d
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM21
-	jr nz, .asm_48a25
+	jr nz, .afterVictory
 	call z, CeladonGymText_48963
 	call DisableWaitingAfterTextDisplay
-	jr .asm_48a5b
-.asm_48a25
+	jr .done
+.afterVictory
 	ld hl, CeladonGymText_48a68
 	call PrintText
-	jr .asm_48a5b
-.asm_48a2d
+	jr .done
+.beginBattle
 	ld hl, CeladonGymText_48a5e
 	call PrintText
 	ld hl, wd72d
@@ -179,7 +179,7 @@
 	ld a, $3
 	ld [wCeladonGymCurScript], a
 	ld [wCurMapScript], a
-.asm_48a5b
+.done
 	jp TextScriptEnd
 
 CeladonGymText_48a5e:
--- a/scripts/CeruleanGym.asm
+++ b/scripts/CeruleanGym.asm
@@ -54,12 +54,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM11
-	jr .asm_5c736
+	jr .gymVictory
 .BagFull
 	ld a, $7
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_5c736
+.gymVictory
 	ld hl, wObtainedBadges
 	set 1, [hl]
 	ld hl, wBeatGymFlags
@@ -102,17 +102,17 @@
 CeruleanGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_MISTY
-	jr z, .asm_5c78d
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM11
-	jr nz, .asm_5c785
+	jr nz, .afterVictory
 	call z, CeruleanGymScript_5c70d
 	call DisableWaitingAfterTextDisplay
-	jr .asm_5c7bb
-.asm_5c785
+	jr .done
+.afterVictory
 	ld hl, CeruleanGymText_5c7c3
 	call PrintText
-	jr .asm_5c7bb
-.asm_5c78d
+	jr .done
+.beginBattle
 	ld hl, CeruleanGymText_5c7be
 	call PrintText
 	ld hl, wd72d
@@ -131,7 +131,7 @@
 	ld [hJoyHeld], a
 	ld a, $3
 	ld [wCeruleanGymCurScript], a
-.asm_5c7bb
+.done
 	jp TextScriptEnd
 
 CeruleanGymText_5c7be:
--- a/scripts/CinnabarGym.asm
+++ b/scripts/CinnabarGym.asm
@@ -151,12 +151,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM38
-	jr .asm_75880
+	jr .gymVictory
 .BagFull
 	ld a, $c
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_75880
+.gymVictory
 	ld hl, wObtainedBadges
 	set 6, [hl]
 	ld hl, wBeatGymFlags
@@ -207,17 +207,17 @@
 CinnabarGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_BLAINE
-	jr z, .asm_d9332
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM38
-	jr nz, .asm_3012f
+	jr nz, .afterVictory
 	call z, CinnabarGymScript3_75857
 	call DisableWaitingAfterTextDisplay
 	jp TextScriptEnd
-.asm_3012f
+.afterVictory
 	ld hl, BlaineFireBlastText
 	call PrintText
 	jp TextScriptEnd
-.asm_d9332
+.beginBattle
 	ld hl, BlaineBattleText
 	call PrintText
 	ld hl, BlaineEndBattleText
--- a/scripts/FuchsiaGym.asm
+++ b/scripts/FuchsiaGym.asm
@@ -54,12 +54,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM06
-	jr .asm_754c0
+	jr .gymVictory
 .BagFull
 	ld a, $b
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_754c0
+.gymVictory
 	ld hl, wObtainedBadges
 	set 4, [hl]
 	ld hl, wBeatGymFlags
@@ -142,17 +142,17 @@
 FuchsiaGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_KOGA
-	jr z, .asm_181b6
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM06
-	jr nz, .asm_adc3b
+	jr nz, .afterVictory
 	call z, FuchsiaGymScript3_75497
 	call DisableWaitingAfterTextDisplay
-	jr .asm_e84c6
-.asm_adc3b
+	jr .done
+.afterVictory
 	ld hl, KogaExplainToxicText
 	call PrintText
-	jr .asm_e84c6
-.asm_181b6
+	jr .done
+.beginBattle
 	ld hl, KogaBeforeBattleText
 	call PrintText
 	ld hl, wd72d
@@ -171,7 +171,7 @@
 	ld [hJoyHeld], a
 	ld a, $3
 	ld [wFuchsiaGymCurScript], a
-.asm_e84c6
+.done
 	jp TextScriptEnd
 
 KogaBeforeBattleText:
--- a/scripts/OaksLab.asm
+++ b/scripts/OaksLab.asm
@@ -764,17 +764,17 @@
 OaksLabText1:
 	TX_ASM
 	CheckEvent EVENT_FOLLOWED_OAK_INTO_LAB_2
-	jr nz, .asm_1d0de
+	jr nz, .beforeChooseMon
 	ld hl, OaksLabGaryText1
 	call PrintText
 	jr .done
-.asm_1d0de
+.beforeChooseMon
 	bit 2, a
-	jr nz, .asm_1d0ea
+	jr nz, .afterChooseMon
 	ld hl, OaksLabText40
 	call PrintText
 	jr .done
-.asm_1d0ea
+.afterChooseMon
 	ld hl, OaksLabText41
 	call PrintText
 .done
--- a/scripts/PewterGym.asm
+++ b/scripts/PewterGym.asm
@@ -54,12 +54,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM34
-	jr .asm_5c408
+	jr .gymVictory
 .BagFull
 	ld a, $6
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_5c408
+.gymVictory
 	ld hl, wObtainedBadges
 	set 0, [hl]
 	ld hl, wBeatGymFlags
@@ -101,17 +101,17 @@
 PewterGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_BROCK
-	jr z, .asm_5c46a
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM34
-	jr nz, .asm_5c462
+	jr nz, .gymVictory
 	call z, PewterGymScript_5c3df
 	call DisableWaitingAfterTextDisplay
-	jr .asm_5c49b
-.asm_5c462
+	jr .done
+.gymVictory
 	ld hl, PewterGymText_5c4a3
 	call PrintText
-	jr .asm_5c49b
-.asm_5c46a
+	jr .done
+.beginBattle
 	ld hl, PewterGymText_5c49e
 	call PrintText
 	ld hl, wd72d
@@ -131,7 +131,7 @@
 	ld a, $3
 	ld [wPewterGymCurScript], a
 	ld [wCurMapScript], a
-.asm_5c49b
+.done
 	jp TextScriptEnd
 
 PewterGymText_5c49e:
--- a/scripts/SaffronGym.asm
+++ b/scripts/SaffronGym.asm
@@ -54,12 +54,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM46
-	jr .asm_5d091
+	jr .gymVictory
 .BagFull
 	ld a, $c
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_5d091
+.gymVictory
 	ld hl, wObtainedBadges
 	set 5, [hl]
 	ld hl, wBeatGymFlags
@@ -152,17 +152,17 @@
 SaffronGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_SABRINA
-	jr z, .asm_5d134
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM46
-	jr nz, .asm_5d12c
+	jr nz, .afterVictory
 	call z, SaffronGymText_5d068
 	call DisableWaitingAfterTextDisplay
-	jr .asm_5d15f
-.asm_5d12c
+	jr .done
+.afterVictory
 	ld hl, SaffronGymText_5d16e
 	call PrintText
-	jr .asm_5d15f
-.asm_5d134
+	jr .done
+.beginBattle
 	ld hl, SaffronGymText_5d162
 	call PrintText
 	ld hl, wd72d
@@ -179,7 +179,7 @@
 	ld [wGymLeaderNo], a
 	ld a, $3
 	ld [wSaffronGymCurScript], a
-.asm_5d15f
+.done
 	jp TextScriptEnd
 
 SaffronGymText_5d162:
--- a/scripts/VermilionGym.asm
+++ b/scripts/VermilionGym.asm
@@ -29,14 +29,14 @@
 
 VermilionGymScript_5ca6d:
 	CheckEvent EVENT_2ND_LOCK_OPENED
-	jr nz, .asm_5ca78
+	jr nz, .doorsOpen
 	ld a, $24
-	jr .asm_5ca7f
-.asm_5ca78
+	jr .replaceTile
+.doorsOpen
 	ld a, SFX_GO_INSIDE
 	call PlaySound
 	ld a, $5
-.asm_5ca7f
+.replaceTile
 	ld [wNewTileBlockID], a
 	lb bc, 2, 2
 	predef_jump ReplaceTileBlock
@@ -73,12 +73,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM24
-	jr .asm_5cad3
+	jr .gymVictory
 .BagFull
 	ld a, $8
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_5cad3
+.gymVictory
 	ld hl, wObtainedBadges
 	set 2, [hl]
 	ld hl, wBeatGymFlags
@@ -131,17 +131,17 @@
 VermilionGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_LT_SURGE
-	jr z, .asm_5cb39
+	jr z, .beforeBeat
 	CheckEventReuseA EVENT_GOT_TM24
-	jr nz, .asm_5cb31
+	jr nz, .afterBeat
 	call z, VermilionGymScript_5caaa
 	call DisableWaitingAfterTextDisplay
-	jr .asm_5cb6a
-.asm_5cb31
+	jr .done
+.afterBeat
 	ld hl, VermilionGymText_5cb72
 	call PrintText
-	jr .asm_5cb6a
-.asm_5cb39
+	jr .done
+.beforeBeat
 	ld hl, VermilionGymText_5cb6d
 	call PrintText
 	ld hl, wd72d
@@ -161,7 +161,7 @@
 	ld a, $3
 	ld [wVermilionGymCurScript], a
 	ld [wCurMapScript], a
-.asm_5cb6a
+.done
 	jp TextScriptEnd
 
 VermilionGymText_5cb6d:
--- a/scripts/ViridianGym.asm
+++ b/scripts/ViridianGym.asm
@@ -148,12 +148,12 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	SetEvent EVENT_GOT_TM27
-	jr .asm_749be
+	jr .gymVictory
 .BagFull
 	ld a, $e
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-.asm_749be
+.gymVictory
 	ld hl, wObtainedBadges
 	set 7, [hl]
 	ld hl, wBeatGymFlags
@@ -261,13 +261,13 @@
 ViridianGymText1:
 	TX_ASM
 	CheckEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
-	jr z, .asm_6de66
+	jr z, .beginBattle
 	CheckEventReuseA EVENT_GOT_TM27
-	jr nz, .asm_9fc95
+	jr nz, .afterVictory
 	call z, ViridianGymScript3_74995
 	call DisableWaitingAfterTextDisplay
-	jr .asm_6dff7
-.asm_9fc95
+	jr .done
+.afterVictory
 	ld a, $1
 	ld [wDoNotWaitForButtonPressAfterDisplayingText], a
 	ld hl, ViridianGymText_74ad9
@@ -279,8 +279,8 @@
 	call UpdateSprites
 	call Delay3
 	call GBFadeInFromBlack
-	jr .asm_6dff7
-.asm_6de66
+	jr .done
+.beginBattle
 	ld hl, ViridianGymText_74ace
 	call PrintText
 	ld hl, wd72d
@@ -297,7 +297,7 @@
 	ld [wGymLeaderNo], a
 	ld a, $3
 	ld [wViridianGymCurScript], a
-.asm_6dff7
+.done
 	jp TextScriptEnd
 
 ViridianGymText_74ace: