ref: eb3102200f66e3aa1688e4e52429fcac4b0272fa
parent: 2ab60fa8a49dfe9e20ebb620471ba4c2ca64a4aa
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Sun Jan 14 14:26:55 EST 2018
More Battle Tower map script constants, fewer raw hex values
--- a/constants/battle_tower_constants.asm
+++ b/constants/battle_tower_constants.asm
@@ -1,4 +1,13 @@
-; BattleTowerAction arguments (see mobile/battle_tower_5c.asm)
+BATTLETOWER_NROFPKMNS EQU 3
+BATTLETOWER_NROFTRAINERS EQU 7
+
+BATTLETOWER_NUM_UNIQUE_PKMN EQU 21
+BATTLETOWER_NUM_UNIQUE_TRAINERS EQU 70
+
+BATTLETOWER_TRAINERDATALENGTH EQU $24
+BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + BATTLETOWER_NROFPKMNS * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
+
+; BattleTowerAction writebyte arguments (see engine/events/battle_tower/battle_tower.asm)
const_def
const BATTLETOWERACTION_CHECK_EXPLANATION_READ
const BATTLETOWERACTION_SET_EXPLANATION_READ
@@ -33,7 +42,17 @@
const BATTLETOWERACTION_CHOOSEREWARD ; save options
const BATTLETOWERACTION_SAVEOPTIONS
-; sBattleTowerChallengeState
+; BattleTowerAction return values
+; - from BATTLETOWERACTION_CHECKMOBILEEVENT
+MOBILE_EVENT_OBJECT_GS_BALL EQU $b
+
+; BattleTowerText arguments (see engine/events/battle_tower/trainer_text.asm)
+const_value set 1
+ const BATTLETOWERTEXT_INTRO
+ const BATTLETOWERTEXT_WIN_TEXT
+ const BATTLETOWERTEXT_LOSS_TEXT
+
+; sBattleTowerChallengeState values
const_def
const BATTLETOWER_NO_CHALLENGE
const BATTLETOWER_SAVED_AND_LEFT
@@ -40,15 +59,3 @@
const BATTLETOWER_CHALLENGE_IN_PROGESS
const BATTLETOWER_WON_CHALLENGE
const BATTLETOWER_RECEIVED_REWARD
-
-BATTLETOWER_NROFPKMNS EQU 3
-BATTLETOWER_NROFTRAINERS EQU 7
-
-BATTLETOWER_NUM_UNIQUE_TRAINERS EQU 70
-BATTLETOWER_NUM_UNIQUE_PKMN EQU 21
-
-BATTLETOWER_TRAINERDATALENGTH EQU $24
-BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + BATTLETOWER_NROFPKMNS * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
-
-; return value from BattleTowerAction(BATTLETOWERACTION_CHECKMOBILEEVENT)
-MOBILE_EVENT_OBJECT_GS_BALL EQU $b
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -240,7 +240,7 @@
const BUGCONTEST_BOXED_MON ; 1
const BUGCONTEST_NO_CATCH ; 2
-; used by HealMachineAnim
+; HealMachineAnim writebyte arguments
; HealMachineAnim.Pointers indexes (see engine/events/heal_machine_anim.asm)
const_def
const HEALMACHINE_POKECENTER ; 0
@@ -247,7 +247,7 @@
const HEALMACHINE_ELMS_LAB ; 1
const HEALMACHINE_HALL_OF_FAME ; 2
-; used by Special_UnownPuzzle
+; Special_UnownPuzzle writebyte arguments
; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/unown_puzzle.asm)
const_def
const UNOWNPUZZLE_KABUTO ; 0
@@ -256,7 +256,7 @@
const UNOWNPUZZLE_HO_OH ; 3
NUM_UNOWN_PUZZLES EQU const_value
-; used by Special_DisplayUnownWords
+; Special_DisplayUnownWords writebyte arguments
; UnownWalls and MenuDataHeaders_UnownWalls indexes (see data/unown_walls.asm)
const_def
const UNOWNWORDS_ESCAPE ; 0
@@ -264,7 +264,7 @@
const UNOWNWORDS_WATER ; 2
const UNOWNWORDS_HO_OH ; 3
-; used by Special_MoveTutor
+; Special_MoveTutor writebyte arguments
const_value set 1
const MOVETUTOR_FLAMETHROWER ; 1
const MOVETUTOR_THUNDERBOLT ; 2
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2452,7 +2452,7 @@
ld c, 40
call DelayFrames
call EmptyBattleTextBox
- ld c, $3
+ ld c, BATTLETOWERTEXT_LOSS_TEXT
farcall BattleTowerText
call WaitPressAorB_BlinkCursor
ld hl, wPayDayMoney
@@ -3022,7 +3022,7 @@
call DelayFrames
call EmptyBattleTextBox
- ld c, 2
+ ld c, BATTLETOWERTEXT_WIN_TEXT
farcall BattleTowerText
call WaitPressAorB_BlinkCursor
call ClearTileMap
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -1659,11 +1659,11 @@
SpecialCheckForBattleTowerRules: ; 170bd3
farcall CheckForBattleTowerRules
jr c, .asm_170bde
- xor a
+ xor a ; FALSE
jr .asm_170be0
.asm_170bde
- ld a, $1
+ ld a, TRUE
.asm_170be0
ld [ScriptVar], a
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -67,10 +67,10 @@
Script_Menu_ChallengeExplanationCancel: ; 0x9e3fc
writetext Text_WantToGoIntoABattleRoom
- writebyte $1
+ writebyte TRUE
special Special_Menu_ChallengeExplanationCancel
- if_equal $1, Script_ChooseChallenge
- if_equal $2, Script_BattleTowerExplanation
+ if_equal 1, Script_ChooseChallenge
+ if_equal 2, Script_BattleTowerExplanation
jump Script_BattleTowerHopeToServeYouAgain
Script_ChooseChallenge: ; 0x9e40f
@@ -77,7 +77,7 @@
writebyte BATTLETOWERACTION_RESETDATA ; ResetBattleTowerTrainerSRAM
special BattleTowerAction
special SpecialCheckForBattleTowerRules
- if_not_equal $0, Script_WaitButton
+ if_not_equal FALSE, Script_WaitButton
writetext Text_SaveBeforeEnteringBattleRoom
yesorno
iffalse Script_Menu_ChallengeExplanationCancel
@@ -193,7 +193,7 @@
special BattleTowerAction
if_not_equal $0, Script_MayNotEnterABattleRoomUnderL70
special SpecialCheckForBattleTowerRules
- if_not_equal $0, Script_WaitButton
+ if_not_equal FALSE, Script_WaitButton
writebyte BATTLETOWERACTION_05
special BattleTowerAction
if_equal $0, .zero
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -29,7 +29,7 @@
waitsfx
applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksIn
opentext
- battletowertext $1
+ battletowertext BATTLETOWERTEXT_INTRO
buttonsound
closetext
special BattleTowerBattle ; calls predef startbattle
--- a/maps/BurnedTower1F.asm
+++ b/maps/BurnedTower1F.asm
@@ -33,7 +33,7 @@
.Next:
checkevent EVENT_RELEASED_THE_BEASTS
iftrue .Done
- changeblock 6, 14, $9 ; ladder
+ changeblock 6, 14, $09 ; ladder
.Done:
return
--- a/maps/BurnedTowerB1F.asm
+++ b/maps/BurnedTowerB1F.asm
@@ -28,7 +28,7 @@
.LadderCallback:
checkevent EVENT_RELEASED_THE_BEASTS
iftrue .NoChange
- changeblock 6, 14, $2
+ changeblock 6, 14, $02
.NoChange:
return
--- a/maps/GoldenrodDeptStoreB1F.asm
+++ b/maps/GoldenrodDeptStoreB1F.asm
@@ -23,7 +23,7 @@
jump UnknownScript_0x7d791
UnknownScript_0x7d78a:
- changeblock 16, 4, $d
+ changeblock 16, 4, $0d
jump UnknownScript_0x7d791
UnknownScript_0x7d791:
@@ -31,15 +31,15 @@
iftrue .Layout2
checkevent EVENT_GOLDENROD_DEPT_STORE_B1F_LAYOUT_3
iftrue .Layout3
- changeblock 10, 8, $d
+ changeblock 10, 8, $0d
return
.Layout2:
- changeblock 4, 10, $d
+ changeblock 4, 10, $0d
return
.Layout3:
- changeblock 10, 12, $d
+ changeblock 10, 12, $0d
return
UnknownScript_0x7d7ac:
--- a/maps/GoldenrodDeptStoreRoof.asm
+++ b/maps/GoldenrodDeptStoreRoof.asm
@@ -24,7 +24,7 @@
.ChangeBlock:
changeblock 0, 2, $3f
- changeblock 0, 4, $f
+ changeblock 0, 4, $0f
return
.CheckSaleChangeClerk:
--- a/maps/LancesRoom.asm
+++ b/maps/LancesRoom.asm
@@ -27,7 +27,7 @@
.KeepDoorsClosed:
checkevent EVENT_LANCES_ROOM_EXIT_OPEN
iffalse .OpenDoors
- changeblock 4, 0, $b
+ changeblock 4, 0, $0b
.OpenDoors:
return
@@ -69,7 +69,7 @@
waitbutton
closetext
playsound SFX_ENTER_DOOR
- changeblock 4, 0, $b
+ changeblock 4, 0, $0b
reloadmappart
closetext
setevent EVENT_LANCES_ROOM_ENTRANCE_CLOSED
--- a/maps/RadioTower3F.asm
+++ b/maps/RadioTower3F.asm
@@ -22,7 +22,7 @@
.Change:
changeblock 14, 2, $2a
- changeblock 14, 4, $1
+ changeblock 14, 4, $01
return
RadioTower3FSuperNerdScript:
@@ -144,7 +144,7 @@
setevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER
playsound SFX_ENTER_DOOR
changeblock 14, 2, $2a
- changeblock 14, 4, $1
+ changeblock 14, 4, $01
reloadmappart
closetext
waitsfx
--- a/maps/Route26.asm
+++ b/maps/Route26.asm
@@ -153,8 +153,8 @@
scall UnknownScript_0x1a4e7f
UnknownScript_0x1a4e21:
askforphonenumber PHONE_COOLTRAINERF_BETH
- if_equal $1, UnknownScript_0x1a4e8f
- if_equal $2, UnknownScript_0x1a4e8b
+ if_equal PHONE_CONTACTS_FULL, UnknownScript_0x1a4e8f
+ if_equal PHONE_CONTACT_REFUSED, UnknownScript_0x1a4e8b
trainertotext COOLTRAINERF, BETH1, MEM_BUFFER_0
scall UnknownScript_0x1a4e83
jump UnknownScript_0x1a4e87
--- a/maps/RuinsOfAlphAerodactylChamber.asm
+++ b/maps/RuinsOfAlphAerodactylChamber.asm
@@ -30,8 +30,8 @@
return
.FloorClosed:
- changeblock 2, 2, $1
- changeblock 4, 2, $2
+ changeblock 2, 2, $01
+ changeblock 4, 2, $02
return
.WallOpenScript:
--- a/maps/RuinsOfAlphHoOhChamber.asm
+++ b/maps/RuinsOfAlphHoOhChamber.asm
@@ -31,8 +31,8 @@
return
.FloorClosed:
- changeblock 2, 2, $1
- changeblock 4, 2, $2
+ changeblock 2, 2, $01
+ changeblock 4, 2, $02
return
.WallOpenScript:
--- a/maps/RuinsOfAlphKabutoChamber.asm
+++ b/maps/RuinsOfAlphKabutoChamber.asm
@@ -34,8 +34,8 @@
return
.FloorClosed:
- changeblock 2, 2, $1
- changeblock 4, 2, $2
+ changeblock 2, 2, $01
+ changeblock 4, 2, $02
return
.WallOpenScript:
--- a/maps/RuinsOfAlphOmanyteChamber.asm
+++ b/maps/RuinsOfAlphOmanyteChamber.asm
@@ -31,8 +31,8 @@
return
.FloorClosed:
- changeblock 2, 2, $1
- changeblock 4, 2, $2
+ changeblock 2, 2, $01
+ changeblock 4, 2, $02
return
.WallOpenScript:
--- a/maps/TinTower1F.asm
+++ b/maps/TinTower1F.asm
@@ -79,7 +79,7 @@
.StairsCallback:
checkevent EVENT_GOT_RAINBOW_WING
iftrue .DontHideStairs
- changeblock 10, 2, $9
+ changeblock 10, 2, $09
.DontHideStairs:
return
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -429,10 +429,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Parameter: [ScriptVar] = 0..1
;
-; if [ScriptVar] == 0
+; if [ScriptVar] == FALSE
; Show japanese menu options
; - News - News - ??? - Cancel
-; if [ScriptVar] == 1
+; if [ScriptVar] == TRUE
; Show BattleTower-Menu with 3 options in english language
; - Challenge - Explanation - Cancel
Special_Menu_ChallengeExplanationCancel: ; 17d224