shithub: pokecrystal

Download patch

ref: 671341a0fbcbdcbe41331a19f7863fef923c19c1
parent: 1bf12455e4ad9cb9a0fde0d1ac5fa29a48c63590
author: mid-kid <esteve.varela@gmail.com>
date: Sun Nov 19 06:52:42 EST 2017

Labelled some battle tower-related functions

The UbersCheck and LevelCheck are used only for the battle tower,
despite them living in the mobile files.
Also labelled some of the known BattleTowerActions.

--- a/constants/battle_tower_constants.asm
+++ b/constants/battle_tower_constants.asm
@@ -1,7 +1,7 @@
 	const_def
-	const BATTLETOWERACTION_00
-	const BATTLETOWERACTION_01
-	const BATTLETOWERACTION_02
+	const BATTLETOWERACTION_CHECK_EXPLANATION_READ
+	const BATTLETOWERACTION_SET_EXPLANATION_READ
+	const BATTLETOWERACTION_GET_CHALLENGE_STATE
 	const BATTLETOWERACTION_SAVE_AND_QUIT
 	const BATTLETOWERACTION_CHALLENGECANCELED
 	const BATTLETOWERACTION_05
@@ -13,7 +13,7 @@
 	const BATTLETOWERACTION_CHECKMOBILEEVENT
 	const BATTLETOWERACTION_0C ; more time stuff in SRAM bank 5
 	const BATTLETOWERACTION_0D ; more time stuff in SRAM bank 5
-	const BATTLETOWERACTION_EGGTICKET ; egg ticket
+	const BATTLETOWERACTION_EGGTICKET
 	const BATTLETOWERACTION_0F ; check w3_d090
 	const BATTLETOWERACTION_10 ; dw based on 5:a800
 	const BATTLETOWERACTION_11 ; store 0 in 5:aa8d
@@ -23,8 +23,8 @@
 	const BATTLETOWERACTION_15 ; set 0, [s1_be4f]
 	const BATTLETOWERACTION_16 ; update time in SRAM bank 5
 	const BATTLETOWERACTION_17 ; check time in SRAM bank 5
-	const BATTLETOWERACTION_18 ; level check
-	const BATTLETOWERACTION_19 ; ubers check
+	const BATTLETOWERACTION_LEVEL_CHECK
+	const BATTLETOWERACTION_UBERS_CHECK
 	const BATTLETOWERACTION_RESETDATA ; clear data
 	const BATTLETOWERACTION_GIVEREWARD ; give reward
 	const BATTLETOWERACTION_1C ; set won challenge
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -20,7 +20,7 @@
 	writebyte BATTLETOWERACTION_CHECKSAVEFILEISYOURS
 	special BattleTowerAction
 	iffalse .SkipEverything
-	writebyte BATTLETOWERACTION_02 ; copybytetovar sBattleTowerChallengeState
+	writebyte BATTLETOWERACTION_GET_CHALLENGE_STATE ; copybytetovar sBattleTowerChallengeState
 	special BattleTowerAction
 	if_equal $0, .SkipEverything
 	if_equal $2, .priorityjump1
@@ -56,13 +56,13 @@
 	end
 
 ReceptionistScript_0x9e3e2:
-	writebyte BATTLETOWERACTION_02 ; copybytetovar sBattleTowerChallengeState
+	writebyte BATTLETOWERACTION_GET_CHALLENGE_STATE ; copybytetovar sBattleTowerChallengeState
 	special BattleTowerAction
 	if_equal $3, Script_BeatenAllTrainers2 ; maps/BattleTowerBattleRoom.asm
 	opentext
 	writetext Text_BattleTowerWelcomesYou
 	buttonsound
-	writebyte BATTLETOWERACTION_00 ; if new save file: bit 1, [s1_be4f]
+	writebyte BATTLETOWERACTION_CHECK_EXPLANATION_READ ; if new save file: bit 1, [s1_be4f]
 	special BattleTowerAction
 	if_not_equal $0, Script_Menu_ChallengeExplanationCancel
 	jump Script_BattleTowerIntroductionYesNo
@@ -87,7 +87,7 @@
 	special Special_TryQuickSave
 	iffalse Script_Menu_ChallengeExplanationCancel
 	dotrigger $1
-	writebyte BATTLETOWERACTION_01 ; set 1, [s1_be4f]
+	writebyte BATTLETOWERACTION_SET_EXPLANATION_READ ; set 1, [s1_be4f]
 	special BattleTowerAction
 	special Function1700b0
 	if_equal $a, Script_Menu_ChallengeExplanationCancel
@@ -148,7 +148,7 @@
 Script_BattleTowerExplanation: ; 0x9e4a5
 	writetext Text_BattleTowerIntroduction_2
 Script_BattleTowerSkipExplanation:
-	writebyte BATTLETOWERACTION_01
+	writebyte BATTLETOWERACTION_SET_EXPLANATION_READ
 	special BattleTowerAction
 	jump Script_Menu_ChallengeExplanationCancel
 
@@ -174,7 +174,7 @@
 	iffalse Script_Menu_ChallengeExplanationCancel
 	special Special_TryQuickSave
 	iffalse Script_Menu_ChallengeExplanationCancel
-	writebyte BATTLETOWERACTION_01
+	writebyte BATTLETOWERACTION_SET_EXPLANATION_READ
 	special BattleTowerAction
 	special Function1700ba
 	if_equal $a, Script_Menu_ChallengeExplanationCancel
@@ -188,10 +188,10 @@
 	end
 
 UnreferencedScript_0x9e4ea:
-	writebyte BATTLETOWERACTION_18
+	writebyte BATTLETOWERACTION_LEVEL_CHECK
 	special BattleTowerAction
 	if_not_equal $0, Script_APkmnLevelExceeds
-	writebyte BATTLETOWERACTION_19
+	writebyte BATTLETOWERACTION_UBERS_CHECK
 	special BattleTowerAction
 	if_not_equal $0, Script_MayNotEnterABattleRoomUnderL70
 	special SpecialCheckForBattleTowerRules
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -952,9 +952,9 @@
 
 
 .dw ; 170696 (5c:4696)
-	dw Function17075f ; 0x00
-	dw Function170788 ; 0x01
-	dw Function170778 ; 0x02
+	dw BattleTowerAction_CheckExplanationRead ; 0x00
+	dw BattleTowerAction_SetExplanationRead ; 0x01
+	dw BattleTowerAction_GetChallengeState ; 0x02
 	dw BattleTowerAction_SetByteToQuickSaveChallenge ; 0x03
 	dw BattleTowerAction_SetByteToCancelChallenge ; 0x04
 	dw Function1707ac ; 0x05
@@ -966,7 +966,7 @@
 	dw CheckMobileEventIndex ; 0x0b
 	dw Function1708c8 ; 0x0c
 	dw Function1708f0 ; 0x0d
-	dw Function17093c ; 0x0e
+	dw BattleTowerAction_EggTicket ; 0x0e
 	dw Function1709aa ; 0x0f
 	dw Function1709bb ; 0x10
 	dw Function170a9c ; 0x11
@@ -976,8 +976,8 @@
 	dw Function170ad7 ; 0x15
 	dw Function170807 ; 0x16
 	dw Function17081d ; 0x17
-	dw Function170ae8 ; 0x18
-	dw Function170b16 ; 0x19
+	dw BattleTowerAction_LevelCheck ; 0x18
+	dw BattleTowerAction_UbersCheck ; 0x19
 	dw ResetBattleTowerTrainersSRAM ; 0x1a
 	dw BattleTower_GiveReward ; 0x1b
 	dw Function17071b ; 0x1c
@@ -1073,7 +1073,7 @@
 	call CloseSRAM
 	ret
 
-Function17075f: ; 17075f (5c:475f) BattleTowerAction $00
+BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00
 	call BattleTower_CheckSaveFileExistsAndIsYours
 	ld a, [ScriptVar]
 	and a
@@ -1087,7 +1087,7 @@
 	call CloseSRAM
 	ret
 
-Function170778: ; 170778 (5c:4778) BattleTowerAction $02
+BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02
 	ld hl, sBattleTowerChallengeState
 	ld a, BANK(sBattleTowerChallengeState)
 	call GetSRAMBank
@@ -1096,7 +1096,7 @@
 	call CloseSRAM
 	ret
 
-Function170788: ; 170788 (5c:4788) BattleTowerAction $01
+BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01
 	ld a, BANK(s1_be4f)
 	call GetSRAMBank
 	ld a, [s1_be4f]
@@ -1344,7 +1344,7 @@
 ; 17093c
 
 
-Function17093c: ; 17093c (5c:493c) BattleTowerAction $0e
+BattleTowerAction_EggTicket: ; 17093c (5c:493c) BattleTowerAction $0e
 	xor a
 	ld [ScriptVar], a
 	ld a, EGG_TICKET
@@ -1600,7 +1600,7 @@
 	call CloseSRAM
 	ret
 
-Function170ae8: ; 170ae8 (5c:4ae8) BattleTowerAction $18
+BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18
 	ld a, $5
 	call GetSRAMBank
 	ld a, [$b2fb]
@@ -1611,7 +1611,7 @@
 	ld [wcd4f], a
 	xor a
 	ld [ScriptVar], a
-	callba Function119d93 ; level check
+	callba BattleTower_LevelCheck ; level check
 	ret nc
 	ld a, $5
 	call GetSRAMBank
@@ -1620,7 +1620,7 @@
 	ld [ScriptVar], a
 	ret
 
-Function170b16: ; 170b16 (5c:4b16) BattleTowerAction $19
+BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19
 	ld a, $5
 	call GetSRAMBank
 	ld a, [$b2fb]
@@ -1631,7 +1631,7 @@
 	ld [wcd4f], a
 	xor a
 	ld [ScriptVar], a
-	callba Function119dd1 ; ubers check
+	callba BattleTower_UbersCheck
 	ret nc
 	ld a, $5
 	call GetSRAMBank
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -1320,9 +1320,9 @@
 	ld a, [wcd38]
 	and a
 	jr nz, .asm_118a30
-	call Function119d93
+	call BattleTower_LevelCheck
 	ret c
-	call Function119dd1
+	call BattleTower_UbersCheck
 	ret c
 
 .asm_118a30
@@ -3991,7 +3991,7 @@
 	db "CANCEL@"
 ; 119d93
 
-Function119d93: ; 119d93 (46:5d93)
+BattleTower_LevelCheck: ; 119d93 (46:5d93)
 	ld a, [rSVBK]
 	push af
 	ld a, $1
@@ -4035,7 +4035,7 @@
 	scf
 	ret
 
-Function119dd1: ; 119dd1 (46:5dd1)
+BattleTower_UbersCheck: ; 119dd1 (46:5dd1)
 	ld a, [rSVBK]
 	push af
 	ld a, [wcd4f]