ref: 10beeb3c0611b9114a8e5ff6ab0b8c5d7716defe
parent: b1dc88b7281e0486cb952c8f8c62dab705eb4b9d
author: PikalaxALT <[email protected]>
date: Tue Nov 3 10:05:19 EST 2015
Battle Tower
--- a/constants.asm
+++ b/constants.asm
@@ -28,3 +28,4 @@
INCLUDE "constants/radio_constants.asm"
INCLUDE "constants/sprite_constants.asm"
INCLUDE "constants/tilemap_constants.asm"
+INCLUDE "constants/battle_tower_constants.asm"
--- /dev/null
+++ b/constants/battle_tower_constants.asm
@@ -1,0 +1,33 @@
+ const_def
+ const BATTLE_TOWER_ACTION_00
+ const BATTLE_TOWER_ACTION_01
+ const BATTLE_TOWER_ACTION_02
+ const BATTLE_TOWER_ACTION_03
+ const BATTLE_TOWER_ACTION_04
+ const BATTLE_TOWER_ACTION_05
+ const BATTLE_TOWER_ACTION_06
+ const BATTLE_TOWER_ACTION_07
+ const BATTLE_TOWER_ACTION_08
+ const BATTLE_TOWER_ACTION_09
+ const BATTLE_TOWER_ACTION_0A
+ const BATTLE_TOWER_ACTION_0B
+ const BATTLE_TOWER_ACTION_0C
+ const BATTLE_TOWER_ACTION_0D
+ const BATTLE_TOWER_ACTION_0E
+ const BATTLE_TOWER_ACTION_0F
+ const BATTLE_TOWER_ACTION_10
+ const BATTLE_TOWER_ACTION_11
+ const BATTLE_TOWER_ACTION_12
+ const BATTLE_TOWER_ACTION_13
+ const BATTLE_TOWER_ACTION_14
+ const BATTLE_TOWER_ACTION_15
+ const BATTLE_TOWER_ACTION_16
+ const BATTLE_TOWER_ACTION_17
+ const BATTLE_TOWER_ACTION_18
+ const BATTLE_TOWER_ACTION_19
+ const BATTLE_TOWER_ACTION_1A
+ const BATTLE_TOWER_ACTION_1B
+ const BATTLE_TOWER_ACTION_1C
+ const BATTLE_TOWER_ACTION_1D
+ const BATTLE_TOWER_ACTION_1E
+ const BATTLE_TOWER_ACTION_1F
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -259,6 +259,7 @@
add_mt THUNDERBOLT
add_mt ICE_BEAM
+ITEM_FROM_MEM EQU $ff
; leftovers from red
@@ -265,7 +266,6 @@
SAFARI_BALL EQU 8 ; MOON_STONE
MOON_STONE_RED EQU 10 ; BURN_HEAL
FULL_HEAL_RED EQU 52 ; X_SPEED
-
MAIL_MAX_LENGTH EQU $20
; pockets
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -109,10 +109,10 @@
const MOM_ITEM
const MOM_DOLL
-BATTLETOWER_PKMNSTRUCTLENGTH EQU $30
BATTLETOWER_NROFPKMNS EQU 3
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLETOWER_NROFTRAINERS EQU 7
+BATTLETOWER_NRMONSPERLEVELBRACKET EQU BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS
NUM_WILDMONS_PER_AREA_TIME_OF_DAY EQU 7
WILDMON_GRASS_STRUCTURE_LENGTH EQU 2 + 3 * (1 + 2 * NUM_WILDMONS_PER_AREA_TIME_OF_DAY)
--- a/data/battle_tower.asm
+++ b/data/battle_tower.asm
@@ -1,7 +1,7 @@
Function_LoadOpponentTrainerAndPokemons: ; 1f8000
ld a, [rSVBK]
push af
- ld a, $3
+ ld a, BANK(BT_OTrainer)
ld [rSVBK], a
; Fill BT_OTrainer with zeros
@@ -21,32 +21,32 @@
ld a, [hRandomAdd]
ld b, a
-.asm_1f8022 ; loop to find a random trainer
+.resample ; loop to find a random trainer
call Random
ld a, [hRandomAdd]
add b
ld b, a ; b contains the nr of the trainer
IF DEF(CRYSTAL11)
- and $7f
- cp $46
+ and (1 << 7) - 1
+ cp 70
ELSE
- and $1f
- cp $15
+ and (1 << 5) - 1
+ cp 21
ENDC
- jr nc, .asm_1f8022
+ jr nc, .resample
ld b, a
- ld a, BANK(sNrOfBeatenBattleTowerTrainers)
+ ld a, BANK(sBTTrainers)
call GetSRAMBank
ld c, BATTLETOWER_NROFTRAINERS
ld hl, sBTTrainers
-.asm_1f803a
+.next_trainer
ld a, [hli]
cp b
- jr z, .asm_1f8022
+ jr z, .resample
dec c
- jr nz, .asm_1f803a ; c <= 7 initialise all 7 trainers?
+ jr nz, .next_trainer ; c <= 7 initialise all 7 trainers?
ld hl, sBTTrainers
ld a, [sNrOfBeatenBattleTowerTrainers]
@@ -61,9 +61,9 @@
push af
; Copy name (10 bytes) and class (1 byte) of trainer
ld hl, BattleTowerTrainers
- ld bc, 11
+ ld bc, NAME_LENGTH
call AddNTimes
- ld bc, 11
+ ld bc, NAME_LENGTH
call CopyBytes
call Function_LoadRandomBattleTowerPkmn
@@ -73,7 +73,7 @@
ld bc, BATTLETOWER_TRAINERDATALENGTH
call AddNTimes
ld bc, BATTLETOWER_TRAINERDATALENGTH
-.asm_1f8070
+.copy_bt_trainer_data_loop
ld a, BANK(BattleTowerTrainerData)
call GetFarByte
ld [de], a
@@ -82,7 +82,7 @@
dec bc
ld a, b
or c
- jr nz, .asm_1f8070
+ jr nz, .copy_bt_trainer_data_loop
pop af
ld [rSVBK], a
@@ -108,20 +108,20 @@
ld a, [hRandomAdd]
ld b, a
-.asm_1f8099
+.resample
call Random
ld a, [hRandomAdd]
add b
ld b, a
and $1f
- cp (BattleTowerMons2 - BattleTowerMons1) / ($3b)
- jr nc, .asm_1f8099
+ cp BATTLETOWER_NRMONSPERLEVELBRACKET
+ jr nc, .resample
; in register 'a' is the chosen Pkmn of the LevelGroup
; Check if Pkmn was already loaded before
; Check current and the 2 previous teams
; includes check if item is double at the current team
- ld bc, BATTLETOWER_PKMNSTRUCTLENGTH + $b
+ ld bc, party_struct_length + PKMN_NAME_LENGTH
call AddNTimes
ld a, [hli]
ld b, a
@@ -164,17 +164,17 @@
cp b
jr z, .FindARandomBattleTowerPkmn
- ld bc, BATTLETOWER_PKMNSTRUCTLENGTH + $b
+ ld bc, party_struct_length + PKMN_NAME_LENGTH
call CopyBytes
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
push af
push de
- ld hl, - (BATTLETOWER_PKMNSTRUCTLENGTH + $b)
+ ld hl, - (party_struct_length + PKMN_NAME_LENGTH)
add hl, de
ld a, [hl]
- ld [wd265], a
- ld bc, BATTLETOWER_PKMNSTRUCTLENGTH
+ ld [wNamedObjectIndexBuffer], a
+ ld bc, party_struct_length
add hl, bc
push hl
call GetPokemonName
@@ -186,7 +186,7 @@
pop de
pop af
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
pop bc
dec c
jp nz, .loop
@@ -229,6 +229,7 @@
db "KAUFMAN@@@", SWIMMERM
db "LANCASTER@", SKIER
db "McMAHILL@@", CAMPER
+; The following can only be sampled in Crystal 1.1.
db "OBRIEN@@@@", GENTLEMAN
db "FROST@@@@@", BEAUTY
db "MORSE@@@@@", SUPER_NERD
@@ -282,7 +283,7 @@
BattleTowerMons: ; 1f8450
-
+; 10 groups of 21 mons.
BattleTowerMons1:
db JOLTEON
--- /dev/null
+++ b/data/battle_tower_2.asm
@@ -1,0 +1,72 @@
+BattleTowerTrainerData:: ; What exactly it is, I don't know
+; Size is 70 (Nr of Trainers in BattleTower) * 0x24 (Nr of Bytes that are copied)
+ db $37, $03, $0e, $09, $25, $0b, $1c, $0d, $12, $0d, $00, $05, $0e, $09, $1a, $0b, $30, $04, $3f, $06, $20, $04, $21, $0d, $0e, $09, $30, $04, $20, $04, $0b, $06, $34, $03, $06, $05
+ db $36, $03, $ca, $00, $22, $08, $20, $04, $33, $0d, $11, $0d, $37, $05, $06, $05, $3f, $06, $ca, $00, $20, $04, $06, $0d, $ca, $00, $21, $03, $09, $06, $12, $04, $28, $0b, $0c, $0d
+ db $32, $06, $31, $04, $02, $02, $03, $04, $22, $02, $00, $05, $40, $04, $2d, $06, $13, $0d, $18, $03, $3f, $04, $13, $0d, $1a, $0c, $33, $04, $32, $0d, $09, $06, $22, $02, $13, $0d
+ db $22, $0c, $22, $0c, $0a, $09, $0b, $08, $2f, $06, $22, $07, $22, $06, $2c, $04, $1a, $06, $0d, $07, $3f, $0d, $00, $05, $0b, $08, $09, $06, $2c, $04, $1f, $0e, $1c, $0b, $41, $0b
+ db $a3, $00, $41, $03, $1f, $04, $29, $00, $1c, $04, $03, $02, $3d, $05, $38, $06, $71, $00, $18, $03, $30, $06, $53, $00, $1e, $05, $b9, $00, $21, $0d, $30, $06, $d1, $00, $0a, $06
+ db $13, $02, $31, $06, $04, $02, $1c, $04, $0d, $0d, $31, $0d, $39, $07, $31, $06, $24, $07, $3d, $04, $40, $04, $30, $0d, $03, $06, $08, $05, $02, $05, $14, $07, $08, $05, $1a, $0d
+ db $0d, $02, $07, $02, $00, $05, $22, $02, $10, $0b, $0a, $0d, $16, $02, $01, $02, $08, $0d, $2c, $04, $23, $07, $23, $0d, $16, $02, $01, $02, $08, $0d, $02, $03, $20, $04, $23, $0d
+ db $1e, $02, $22, $02, $00, $05, $20, $08, $2c, $04, $03, $02, $1d, $05, $41, $08, $41, $08, $35, $05, $40, $0b, $00, $05, $0b, $05, $0b, $02, $00, $05, $04, $04, $14, $08, $00, $05
+ db $06, $0c, $09, $06, $00, $00, $0b, $09, $1e, $0c, $37, $0d, $41, $03, $06, $04, $34, $06, $22, $0c, $15, $09, $23, $0d, $02, $03, $22, $08, $41, $0d, $26, $04, $31, $0d, $01, $05
+ db $22, $0c, $30, $04, $01, $05, $2c, $04, $23, $07, $01, $05, $37, $03, $3d, $04, $3c, $0d, $1c, $03, $29, $08, $3c, $0d, $18, $04, $30, $0d, $06, $05, $14, $07, $30, $0d, $06, $05
+ db $0e, $06, $04, $05, $2c, $04, $1e, $0c, $38, $0d, $00, $05, $3f, $03, $3f, $06, $20, $04, $33, $0d, $04, $0d, $00, $00, $20, $04, $26, $0d, $04, $05, $0c, $04, $26, $0d, $04, $05
+ db $18, $02, $33, $03, $28, $04, $2c, $04, $09, $07, $03, $05, $30, $04, $08, $09, $00, $05, $1a, $02, $32, $03, $00, $05, $3f, $05, $26, $07, $01, $05, $26, $05, $0f, $02, $00, $05
+ db $3a, $0b, $3a, $0b, $00, $05, $42, $03, $19, $08, $30, $04, $39, $03, $13, $06, $13, $06, $19, $08, $21, $0d, $00, $00, $39, $03, $09, $02, $00, $05, $40, $03, $3a, $08, $2a, $0d
+ db $31, $05, $11, $0e, $30, $04, $1b, $08, $07, $08, $0c, $0d, $1b, $02, $1b, $02, $01, $05, $15, $02, $0a, $04, $0e, $0d, $22, $05, $31, $06, $02, $05, $1d, $06, $3b, $07, $0e, $0d
+ db $1b, $02, $2c, $04, $0d, $0d, $34, $03, $00, $03, $11, $0d, $1b, $08, $31, $04, $0b, $0d, $2f, $08, $01, $05, $00, $00, $06, $05, $10, $05, $0f, $06, $11, $0d, $06, $05, $00, $00
+ db $42, $03, $30, $04, $1f, $0b, $16, $0e, $10, $07, $34, $0d, $17, $0e, $04, $0d, $00, $00, $42, $03, $19, $08, $30, $04, $0c, $05, $35, $05, $01, $05, $1e, $06, $36, $08, $41, $0d
+ db $18, $03, $42, $03, $43, $04, $3a, $0b, $3b, $0b, $03, $05, $2c, $05, $06, $05, $1b, $03, $43, $04, $39, $0b, $3c, $04, $14, $0b, $0f, $05, $06, $05, $40, $03, $3f, $04, $20, $0e
+ db $0c, $05, $36, $07, $30, $04, $27, $0b, $10, $08, $31, $0d, $11, $0e, $30, $04, $41, $03, $07, $0d, $2f, $08, $03, $05, $06, $05, $3f, $06, $11, $0e, $30, $04, $30, $07, $06, $05
+ db $36, $03, $06, $06, $44, $04, $0b, $0e, $16, $0d, $00, $05, $32, $0d, $08, $06, $09, $0e, $44, $04, $09, $08, $22, $0d, $04, $0e, $09, $0e, $44, $04, $29, $08, $05, $0d, $00, $00
+ db $3f, $06, $2c, $04, $34, $0d, $14, $05, $13, $02, $04, $02, $0c, $05, $3f, $04, $38, $0d, $02, $03, $29, $08, $32, $0d, $35, $05, $15, $06, $40, $05, $02, $03, $34, $07, $04, $0d
+ db $12, $03, $02, $04, $07, $07, $28, $04, $2c, $0d, $00, $05, $2c, $03, $12, $03, $2b, $06, $0a, $04, $06, $0d, $31, $0d, $2c, $03, $12, $03, $06, $04, $0d, $06, $28, $0b, $02, $05
+ db $41, $04, $3c, $0b, $34, $0d, $40, $03, $00, $03, $0d, $0d, $13, $0c, $33, $08, $31, $0d, $1e, $09, $27, $07, $3b, $0d, $22, $08, $15, $04, $11, $0d, $2c, $03, $0c, $04, $3b, $0d
+ db $03, $0a, $3a, $0d, $2c, $04, $1c, $0b, $35, $07, $26, $0d, $24, $09, $43, $04, $26, $0d, $0f, $03, $1f, $07, $04, $05, $02, $03, $24, $08, $26, $0d, $3f, $03, $13, $04, $04, $05
+ db $06, $05, $06, $05, $06, $05, $06, $05, $2c, $04, $03, $05, $06, $05, $06, $05, $06, $05, $06, $05, $07, $04, $03, $05, $06, $05, $06, $05, $06, $05, $06, $05, $33, $04, $03, $05
+ db $27, $05, $01, $05, $00, $00, $18, $04, $19, $0d, $01, $05, $41, $05, $00, $00, $00, $00, $16, $06, $3d, $04, $19, $0d, $20, $04, $05, $05, $00, $00, $21, $03, $0c, $04, $19, $0d
+ db $03, $02, $43, $03, $27, $04, $28, $04, $2d, $0d, $00, $05, $30, $05, $04, $05, $02, $03, $38, $06, $3e, $04, $41, $0d, $16, $0e, $04, $05, $02, $03, $38, $06, $20, $04, $41, $0d
+ db $34, $03, $00, $03, $11, $0d, $03, $04, $1c, $0b, $07, $0d, $29, $05, $00, $05, $00, $00, $40, $04, $11, $0d, $3e, $0d, $03, $06, $11, $0d, $00, $05, $16, $0e, $0d, $06, $20, $06
+ db $19, $03, $17, $0b, $20, $06, $1b, $0b, $06, $0c, $1a, $0b, $34, $03, $06, $04, $20, $06, $1b, $0b, $06, $0c, $1a, $0b, $34, $03, $36, $04, $20, $06, $1b, $0b, $06, $0c, $1a, $0b
+ db $0a, $03, $0c, $0c, $25, $0a, $21, $0e, $2c, $04, $03, $02, $10, $09, $03, $08, $09, $06, $0a, $03, $31, $04, $16, $0d, $27, $05, $17, $07, $04, $05, $02, $0c, $0a, $09, $2f, $0d
+ db $15, $02, $2c, $04, $03, $02, $24, $04, $39, $04, $0f, $0d, $1e, $02, $11, $02, $01, $05, $0d, $04, $39, $08, $05, $0d, $29, $05, $08, $02, $00, $05, $43, $03, $0c, $04, $3b, $0d
+ db $10, $0b, $04, $04, $00, $05, $05, $08, $21, $0d, $00, $00, $1f, $05, $01, $02, $00, $05, $18, $03, $3c, $08, $31, $0d, $02, $06, $23, $0b, $31, $03, $43, $03, $13, $07, $16, $0d
+ db $0f, $0e, $19, $0d, $00, $05, $0b, $0e, $2c, $04, $19, $0d, $0e, $0e, $2c, $04, $06, $05, $1f, $07, $19, $0d, $01, $05, $06, $05, $37, $03, $29, $04, $32, $0d, $19, $0d, $01, $05
+ db $35, $03, $06, $04, $0d, $06, $29, $0b, $05, $0d, $00, $00, $16, $0e, $30, $04, $0b, $0d, $29, $08, $16, $0d, $00, $05, $11, $0e, $30, $04, $30, $07, $06, $05, $29, $08, $03, $05
+ db $18, $04, $03, $05, $0b, $0d, $2c, $04, $1e, $0c, $01, $05, $1f, $05, $1d, $07, $1d, $07, $2c, $04, $21, $07, $01, $05, $0a, $05, $12, $02, $32, $0d, $11, $0c, $0c, $06, $1a, $0d
+ db $0c, $0c, $37, $03, $1a, $03, $40, $04, $23, $0b, $26, $0a, $3f, $06, $09, $04, $1b, $07, $37, $03, $22, $08, $27, $06, $04, $0e, $03, $05, $00, $00, $26, $0a, $3b, $08, $1b, $07
+ db $18, $03, $1b, $08, $29, $0b, $40, $08, $32, $0d, $00, $05, $2f, $06, $29, $0b, $0b, $0d, $2f, $08, $23, $0d, $02, $0d, $35, $05, $13, $0e, $2e, $06, $22, $06, $2f, $08, $27, $06
+ db $1c, $03, $02, $0e, $31, $03, $2a, $0d, $24, $0d, $00, $00, $18, $03, $0b, $0d, $30, $08, $40, $08, $04, $05, $00, $00, $1c, $05, $01, $05, $03, $03, $02, $0e, $27, $04, $34, $0d
+ db $33, $03, $30, $04, $2c, $04, $1c, $0b, $35, $07, $00, $05, $30, $04, $2c, $04, $20, $06, $1e, $09, $40, $06, $40, $04, $30, $04, $2c, $04, $20, $06, $1e, $09, $40, $06, $22, $07
+ db $22, $0c, $22, $0c, $16, $0a, $35, $0d, $1c, $0b, $3f, $0d, $13, $05, $16, $0a, $40, $06, $23, $07, $06, $0d, $06, $05, $3f, $06, $16, $0a, $16, $0d, $37, $03, $2c, $04, $26, $07
+ db $0e, $06, $05, $08, $04, $0d, $00, $00, $00, $00, $00, $00, $14, $05, $06, $05, $12, $02, $00, $00, $00, $00, $00, $00, $23, $05, $01, $06, $18, $0d, $00, $00, $00, $00, $00, $00
+ db $18, $03, $27, $03, $03, $05, $20, $0b, $27, $06, $06, $05, $20, $0e, $12, $07, $2b, $0d, $2c, $03, $0e, $08, $35, $07, $37, $03, $27, $03, $03, $05, $42, $07, $2f, $08, $06, $05
+ db $36, $03, $30, $04, $17, $04, $2c, $03, $0c, $04, $3b, $0d, $18, $03, $32, $07, $15, $0d, $35, $05, $0d, $07, $07, $0d, $09, $05, $06, $05, $0f, $0c, $09, $04, $07, $0d, $3b, $0d
+ db $0b, $05, $14, $06, $24, $04, $0a, $0d, $3c, $0d, $00, $05, $14, $05, $09, $02, $32, $0d, $1e, $06, $04, $07, $06, $0d, $1a, $05, $33, $04, $03, $05, $16, $02, $00, $02, $07, $05
+ db $0a, $03, $32, $07, $0b, $0e, $22, $06, $2c, $04, $29, $0b, $0a, $03, $12, $0d, $24, $04, $1a, $0b, $33, $0d, $03, $0d, $0a, $03, $35, $04, $1b, $07, $06, $05, $1e, $06, $14, $07
+ db $0e, $06, $2c, $04, $00, $0d, $06, $03, $31, $04, $04, $0d, $0c, $05, $12, $02, $00, $05, $40, $03, $09, $04, $01, $0d, $35, $05, $36, $08, $00, $05, $02, $03, $31, $04, $21, $0d
+ db $22, $05, $07, $0e, $30, $04, $c5, $00, $10, $02, $01, $05, $0c, $0c, $00, $01, $30, $04, $82, $00, $21, $04, $01, $05, $10, $01, $11, $05, $30, $04, $c3, $00, $3f, $04, $06, $05
+ db $3a, $07, $3b, $07, $36, $03, $30, $04, $21, $04, $06, $0d, $17, $0e, $03, $05, $00, $00, $3f, $06, $21, $04, $21, $0d, $36, $05, $36, $03, $30, $04, $33, $06, $3f, $04, $0c, $0d
+ db $43, $03, $20, $04, $41, $0d, $17, $06, $06, $03, $0a, $04, $3a, $06, $13, $04, $04, $0d, $08, $06, $3f, $04, $31, $0d, $43, $03, $39, $04, $04, $05, $17, $06, $39, $04, $41, $0d
+ db $36, $03, $16, $04, $08, $06, $09, $08, $06, $0d, $00, $00, $1f, $0b, $03, $05, $12, $0e, $0f, $0e, $2c, $0d, $00, $05, $3a, $06, $16, $04, $38, $06, $38, $06, $2c, $0d, $00, $05
+ db $11, $05, $25, $03, $33, $04, $2f, $08, $19, $0d, $00, $05, $11, $05, $25, $03, $3f, $06, $26, $04, $19, $0d, $00, $05, $11, $05, $21, $03, $35, $04, $14, $07, $19, $0d, $06, $05
+ db $2c, $04, $0a, $0d, $04, $05, $33, $03, $29, $0b, $05, $0d, $00, $06, $04, $05, $09, $02, $33, $03, $07, $04, $35, $07, $33, $03, $3a, $08, $05, $0d, $3f, $06, $29, $08, $05, $0d
+ db $05, $03, $1b, $04, $41, $03, $39, $0b, $3a, $0b, $01, $05, $2c, $04, $03, $05, $00, $00, $40, $07, $3e, $0d, $00, $05, $00, $0e, $09, $05, $04, $05, $19, $09, $1d, $0b, $03, $05
+ db $1c, $0c, $20, $06, $05, $08, $3e, $0d, $00, $05, $00, $00, $18, $03, $1f, $0e, $11, $0a, $1c, $0b, $15, $0b, $1c, $06, $03, $0e, $06, $0c, $21, $0c, $14, $0d, $06, $05, $1f, $08
+ db $37, $03, $0e, $01, $08, $01, $19, $06, $27, $0b, $03, $02, $0e, $01, $08, $01, $1b, $08, $05, $08, $21, $0d, $00, $00, $36, $03, $33, $04, $04, $05, $00, $04, $41, $08, $3b, $0d
+ db $06, $02, $00, $05, $34, $03, $00, $03, $0d, $0d, $00, $05, $3c, $06, $05, $08, $16, $04, $2f, $08, $33, $0d, $02, $0d, $1c, $05, $00, $05, $18, $03, $05, $08, $1b, $04, $0c, $0d
+ db $2c, $04, $13, $09, $20, $06, $39, $03, $20, $04, $3c, $0d, $05, $03, $43, $04, $0b, $0d, $22, $04, $06, $0d, $31, $0d, $24, $08, $00, $05, $02, $03, $09, $08, $06, $0d, $3b, $0d
+ db $06, $03, $20, $04, $24, $0d, $24, $04, $10, $0b, $00, $05, $39, $07, $00, $05, $2a, $06, $04, $04, $3c, $04, $00, $00, $24, $04, $1c, $0b, $07, $0d, $2f, $08, $09, $06, $06, $05
+ db $44, $07, $23, $0b, $33, $0d, $2c, $04, $20, $06, $24, $08, $24, $08, $00, $05, $0e, $0e, $12, $08, $09, $0b, $28, $06, $24, $08, $00, $05, $02, $03, $13, $06, $11, $08, $41, $0d
+ db $36, $03, $06, $06, $30, $04, $0f, $0b, $02, $0b, $3b, $0d, $31, $0d, $00, $05, $39, $03, $20, $04, $21, $0d, $00, $00, $04, $0e, $02, $05, $06, $06, $20, $0e, $0b, $06, $27, $06
+ db $14, $05, $04, $02, $09, $0e, $08, $08, $2e, $08, $41, $0d, $34, $05, $2e, $08, $21, $0d, $3f, $03, $18, $08, $00, $05, $36, $05, $05, $02, $00, $05, $17, $06, $39, $04, $00, $05
+ db $34, $03, $00, $03, $11, $0d, $41, $08, $0b, $06, $06, $04, $39, $07, $00, $05, $00, $00, $36, $03, $30, $04, $07, $08, $10, $05, $15, $08, $00, $05, $3a, $06, $1e, $06, $14, $0d
+ db $37, $05, $37, $05, $00, $05, $38, $05, $38, $05, $41, $05, $25, $05, $04, $05, $32, $05, $31, $05, $41, $05, $41, $05, $0f, $05, $04, $05, $0f, $05, $0f, $05, $16, $05, $01, $05
+ db $1f, $0e, $36, $04, $40, $0d, $2f, $08, $1a, $0d, $00, $05, $21, $06, $35, $05, $24, $06, $1a, $06, $12, $0e, $00, $00, $1b, $05, $31, $06, $02, $05, $28, $0d, $27, $0d, $00, $00
+ db $41, $08, $0b, $06, $37, $03, $08, $06, $20, $04, $3b, $0d, $15, $02, $16, $06, $26, $07, $13, $0c, $33, $08, $32, $0d, $2d, $07, $00, $05, $35, $03, $0b, $04, $28, $06, $06, $05
+ db $0c, $08, $2c, $04, $1c, $0b, $06, $07, $0a, $0d, $03, $05, $30, $06, $06, $07, $00, $05, $2c, $04, $20, $06, $24, $07, $30, $06, $0b, $07, $00, $05, $2c, $04, $20, $06, $22, $07
+ db $22, $0c, $22, $0c, $0a, $09, $04, $0b, $02, $07, $27, $06, $0f, $0c, $0a, $0a, $22, $06, $02, $07, $27, $06, $04, $05, $3a, $06, $0e, $0a, $22, $06, $05, $08, $02, $07, $04, $05
+ db $2d, $0b, $02, $08, $37, $0d, $10, $05, $29, $07, $03, $05, $20, $0e, $0e, $0e, $0d, $06, $42, $07, $30, $08, $28, $06, $10, $05, $04, $05, $04, $05, $10, $05, $10, $05, $04, $05
+ db $3f, $03, $16, $0e, $3f, $08, $0b, $0d, $2f, $08, $41, $0d, $34, $05, $00, $05, $02, $03, $3a, $06, $31, $07, $31, $0d, $21, $0e, $03, $05, $3f, $03, $16, $0e, $26, $07, $03, $05
+ db $3a, $06, $2c, $03, $12, $03, $17, $0c, $28, $0b, $06, $0d, $3a, $06, $17, $0c, $23, $0b, $0d, $06, $2f, $08, $22, $0d, $14, $07, $04, $05, $17, $0c, $1c, $0b, $1b, $07, $00, $05
+ db $1b, $02, $00, $05, $0c, $08, $2c, $04, $23, $0b, $32, $0d, $2b, $07, $1f, $04, $3b, $0d, $09, $07, $09, $07, $00, $05, $26, $05, $00, $05, $3f, $03, $22, $07, $d1, $00, $32, $0d
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -2339,7 +2339,7 @@
; quantity (SingleByteParam)
call GetScriptByte
- cp -1
+ cp ITEM_FROM_MEM
jr nz, .ok ; 0x977cf $3
ld a, [ScriptVar]
.ok
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -139,7 +139,7 @@
add_special Function1700b0
add_special Function1700ba
add_special Function170114
- add_special Function170215
+ add_special BattleTowerBattle
add_special Function1704e1
add_special Function17021d
add_special Function_LoadOpponentTrainerAndPokemonsWithOTSprite
@@ -154,7 +154,7 @@
add_special Function4925b
add_special SpecialOmanyteChamber
add_special Function11c1ab
- add_special Function170687
+ add_special BattleTowerAction
add_special Special_DisplayUnownWords
add_special Special_Menu_ChallengeExplanationCancel
add_special Function17d2b6
--- a/macros.asm
+++ b/macros.asm
@@ -177,3 +177,35 @@
tiles EQUS "* $10"
tile EQUS "+ $10 *"
+
+partymon: MACRO
+ db \1
+ db \2
+ db \3, \4, \5, \6
+ dw \7
+ dt \8
+rept 8
+ shift
+endr
+rept 5
+ bigdw \1
+ shift
+endr
+ db \1, \2
+ db \3, \4, \5, \6
+rept 6
+ shift
+endr
+ db \1
+ db \2, \3, \4
+ db \5
+ db \6, \7
+rept 7
+ shift
+endr
+rept 7
+ bigdw \1
+ shift
+endr
+ db \1
+ENDM
--- a/main.asm
+++ b/main.asm
@@ -563,7 +563,7 @@
call Function6e3
and $80
jr z, .asm_5e93
- ld de, $0408
+ ld de, $408
call Function5eaf
ret
@@ -650,17 +650,17 @@
Function5f1c: ; 5f1c
call GetMemTileCoord
push hl
- ld de, $005d
+ ld de, $5d
add hl, de
call DisplayBadgeCount
pop hl
push hl
- ld de, $0084
+ ld de, $84
add hl, de
call DisplayPokedexNumCaught
pop hl
push hl
- ld de, $0030
+ ld de, $30
add hl, de
ld de, .Player
call PlaceString
@@ -672,7 +672,7 @@
; 5f40
Function5f40: ; 5f40
- ld de, $00a9
+ ld de, $a9
add hl, de
call DisplayGameTime
ret
@@ -679,7 +679,7 @@
; 5f48
Function5f48: ; 5f48
- ld de, $00a9
+ ld de, $a9
add hl, de
ld de, .text_5f53
call PlaceString
@@ -1390,7 +1390,7 @@
and $3
ret nz
ld bc, wc3a4
- ld hl, $000a
+ ld hl, $a
add hl, bc ; over-the-top compicated way to load wc3ae into hl
ld l, [hl]
ld h, 0
@@ -1568,7 +1568,7 @@
ld [rSVBK], a
ld a, $60
ld hl, w6_d000
- ld bc, $400
+ lb bc, 4, 0
call ByteFill
ld a, w6_d000 / $100
ld [rHDMA1], a
@@ -7600,7 +7600,7 @@
ld [wd1f5], a
ld a, [wd1ee]
ld [wd1f6], a
- ld bc, $0001
+ ld bc, 1
jr .asm_d6d9
.asm_d6c1
@@ -7753,11 +7753,11 @@
ret z
cp $1
jr z, .asm_d792
- ld de, $0016
+ ld de, $16
jr .asm_d795
.asm_d792
- ld de, $0015
+ ld de, $15
.asm_d795
push hl
@@ -7893,7 +7893,7 @@
.asm_d85e
push bc
- ld bc, $0080
+ ld bc, $80
add hl, bc
pop bc
ld a, l
@@ -8533,14 +8533,14 @@
pop hl
ld b, h
ld c, l
- ld hl, $001f
+ ld hl, $1f
add hl, bc
ld [hl], a
- ld hl, $0024
+ ld hl, $24
add hl, bc
ld d, h
ld e, l
- ld hl, $000a
+ ld hl, $a
add hl, bc
push bc
ld b, $1
@@ -8549,11 +8549,11 @@
ld a, [wd10b]
and a
jr nz, .asm_dcac
- ld hl, $0020
+ ld hl, $20
add hl, bc
xor a
ld [hl], a
- ld hl, $0022
+ ld hl, $22
add hl, bc
ld d, h
ld e, l
@@ -8742,21 +8742,21 @@
push hl
call Functionde1a
pop hl
- ld bc, $0020
+ ld bc, $20
call CopyBytes
call GetBaseData
call Functionde1a
ld b, d
ld c, e
- ld hl, $001f
+ ld hl, $1f
add hl, bc
ld a, [CurPartyLevel]
ld [hl], a
- ld hl, $0024
+ ld hl, $24
add hl, bc
ld d, h
ld e, l
- ld hl, $000a
+ ld hl, $a
add hl, bc
push bc
ld b, $1
@@ -8779,7 +8779,7 @@
ld d, a
callab CalcExpAtLevel
pop bc
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld a, [hMultiplicand]
ld [hli], a
@@ -9232,7 +9232,7 @@
cp [hl]
jr z, .asm_e131
ld hl, s0_a600
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call AddNTimes
push hl
add hl, bc
@@ -9242,11 +9242,11 @@
.asm_e11a
push bc
push hl
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call CopyBytes
pop hl
push hl
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
add hl, bc
pop de
pop bc
@@ -9352,7 +9352,7 @@
srl c
pop hl
push bc
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
pop bc
ld a, c
@@ -9986,10 +9986,10 @@
ld a, " "
call ByteFill
hlcoord 0,0
- ld bc, $0a12
+ lb bc, 10, 18
call TextBox
hlcoord 0,12
- ld bc, $0412
+ lb bc, 4, 18
call TextBox
call Function3200
call SetPalettes ; load regular palettes?
@@ -9999,10 +9999,10 @@
Functione5bb: ; e5bb
ld a, [CurPartyMon]
ld hl, sBoxMon1Species
- ld bc, $0020
+ ld bc, $20
call AddNTimes
ld de, TempMonSpecies
- ld bc, $0020
+ ld bc, $20
ld a, BANK(sBoxMon1Species)
call GetSRAMBank
call CopyBytes
@@ -10016,7 +10016,7 @@
jr z, .asm_e5f1
ld a, b
ld hl, Unknown_e66e
- ld bc, $0003
+ ld bc, 3
call AddNTimes
ld a, [hli]
push af
@@ -10033,7 +10033,7 @@
.asm_e5f6
call GetSRAMBank
ld a, [hl]
- ld bc, $0016
+ ld bc, $16
add hl, bc
ld b, a
ld c, $0
@@ -10047,7 +10047,7 @@
ld a, c
ld bc, 0
add hl, bc
- ld bc, $0020
+ ld bc, $20
call AddNTimes
ld a, [hl]
ld [de], a
@@ -10059,7 +10059,7 @@
push hl
push bc
ld a, c
- ld bc, $035c
+ ld bc, $35c
add hl, bc
call SkipNames
call CopyBytes
@@ -10068,9 +10068,9 @@
push hl
push bc
ld a, c
- ld bc, $001f
+ ld bc, $1f
add hl, bc
- ld bc, $0020
+ ld bc, $20
call AddNTimes
ld a, [hl]
ld [de], a
@@ -10080,9 +10080,9 @@
push hl
push bc
ld a, c
- ld bc, $0015
+ ld bc, $15
add hl, bc
- ld bc, $0020
+ ld bc, $20
call AddNTimes
ld a, [hli]
and $f0
@@ -10132,7 +10132,7 @@
Functione698: ; e698
ld hl, wBreedMon1Stats
ld de, TempMon
- ld bc, $0020
+ ld bc, $20
call CopyBytes
callab CalcLevel
ld a, [wBreedMon1Level]
@@ -10147,7 +10147,7 @@
Functione6b3: ; e6b3
ld hl, wBreedMon2Stats
ld de, TempMon
- ld bc, $0020
+ ld bc, $20
call CopyBytes
callab CalcLevel
ld a, [wBreedMon2Level]
@@ -10773,7 +10773,7 @@
dec c
jr nz, .asm_11905
push de
- ld de, $0017
+ ld de, $17
add hl, de
pop de
dec b
@@ -13530,12 +13530,12 @@
ld [de], a
ld a, [CurPartyMon]
ld hl, s0_a600
- ld bc, $2f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call AddNTimes
ld d, h
ld e, l
ld hl, DefaultFlypoint
- ld bc, $2f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
ld a, BANK(s0_a600)
call GetSRAMBank
call CopyBytes
@@ -14125,19 +14125,19 @@
push hl
call Function1313a
pop hl
- ld bc, $0015
+ ld bc, $15
add hl, bc
call Function1313a
ld a, [wBattleMode]
jr z, .asm_13113
ld hl, BattleMonMoves
- ld bc, $0020
+ ld bc, $20
ld a, [CurPartyMon]
call AddNTimes
push hl
call Function1313a
pop hl
- ld bc, $0006
+ ld bc, 6
add hl, bc
call Function1313a
@@ -14640,7 +14640,7 @@
Function1345a: ; 1345a
ld de, OBPals + 8 * 6
- ld bc, $0004
+ ld bc, 4
ld hl, wd03f
ld a, [hli]
ld h, [hl]
@@ -14720,12 +14720,12 @@
ld l, a
inc hl
pop af
- ld bc, $0004
+ ld bc, 4
call AddNTimes
inc hl
ld de, wdcac
ld a, [EngineBuffer1]
- ld bc, $0003
+ ld bc, 3
call FarCopyBytes
ret
; 134dd
@@ -15317,7 +15317,7 @@
jr c, .next
ld hl, EndFlypoint
ld de, wd00a
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld hl, DefaultFlypoint
ld de, EndFlypoint
@@ -15845,7 +15845,7 @@
ld d, h
ld e, l
ld hl, PlayerName
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
.asm_13b34
pop bc
@@ -17754,13 +17754,13 @@
Function14a07:: ; 14a07
ld a, [PlayerStandingTile]
- ld de, $001f
+ ld de, $1f
cp $71 ; door
ret z
- ld de, $0013
+ ld de, $13
cp $7c ; warp pad
ret z
- ld de, $0023
+ ld de, $23
ret
; 14a1a
@@ -19908,13 +19908,13 @@
ld a, d
ld [StringBuffer2 + 1], a
ld de, StringBuffer1
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld hl, 0
- ld bc, $0064
+ ld bc, $64
ld a, [StringBuffer2 + 1]
call AddNTimes
- ld de, $0064
+ ld de, $64
add hl, de
xor a
ld [StringBuffer2 + 2], a
@@ -20189,7 +20189,7 @@
ld hl, wEggNick
call CopyBytes
ld hl, PartyMonOT
- ld bc, $000b
+ ld bc, NAME_LENGTH
call Function16a31
ld hl, wEggOT
call CopyBytes
@@ -20418,7 +20418,7 @@
.asm_16bab
ld hl, StringBuffer1
ld de, wd050
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld hl, wEggMonMoves
ld de, wEggMonPP
@@ -20425,7 +20425,7 @@
predef FillPP
ld hl, wd050
ld de, StringBuffer1
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld a, [BaseEggSteps]
ld hl, wEggMonHappiness
@@ -20471,7 +20471,7 @@
call Request1bpp
hlcoord 0, 0
- ld bc, $0312
+ lb bc, 3, 18
call TextBox
hlcoord 0, 5
@@ -20479,7 +20479,7 @@
call TextBox
hlcoord 0, 14
- ld bc, $0212
+ lb bc, 2, 18
call TextBox
hlcoord 1, 2
@@ -20629,7 +20629,7 @@
xor a
call GetSRAMBank
ld hl, sScratch
- ld bc, $0310 ; 784
+ ld bc, $310 ; 784
xor a
call ByteFill
ld hl, VTiles2 tile $31
@@ -21411,7 +21411,7 @@
ld [hBGMapAddress + 1], a
ld a, c
ld [$ffad], a
- ld bc, $707
+ lb bc, 7, 7
predef FillBox
pop af
call Function17363
@@ -21656,7 +21656,7 @@
Function1746c: ; 1746c
push bc
ld de, StringBuffer1
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
call Function16e1d
pop bc
@@ -22147,7 +22147,7 @@
dec c
jr nz, .asm_240f1
pop hl
- ld bc, $0028
+ ld bc, $28
add hl, bc
pop bc
dec b
@@ -23362,7 +23362,7 @@
.asm_2480d
call GetMemTileCoord
- ld bc, $0015
+ ld bc, $15
add hl, bc
ld a, [wcf92]
ld b, a
@@ -23380,7 +23380,7 @@
push hl
call Function2486e
pop hl
- ld bc, $0028
+ ld bc, $28
add hl, bc
pop bc
inc c
@@ -23741,7 +23741,7 @@
dec a
cpl
.asm_24a76
- ld hl, $0
+ ld hl, $
call AddNTimes
ld b, h
ld c, l
@@ -23813,7 +23813,7 @@
pop hl
and a
jr nz, .done
- ld de, $0015
+ ld de, $15
add hl, de
ld [hl], "×"
inc hl
@@ -23837,13 +23837,13 @@
Function24af8: ; 24af8
ld hl, MenuDataHeader_0x24b15
- ld de, $000b
+ ld de, $b
call Function1e2e
Function24b01: ; 24b01
call Function1cbb
call GetMemTileCoord
- ld de, $0015
+ ld de, $15
add hl, de
ld de, Money
lb bc, PRINTNUM_MONEY | 3, 6
@@ -24192,7 +24192,7 @@
PopulateMonMenu: ; 24d91
call GetMemTileCoord
- ld bc, $002a ; 42
+ ld bc, $2a ; 42
add hl, bc
ld de, Buffer2
.loop
@@ -24205,7 +24205,7 @@
call GetMonMenuString
pop hl
call PlaceString
- ld bc, $0028 ; 40
+ ld bc, $28 ; 40
add hl, bc
pop de
jr .loop
@@ -24680,7 +24680,7 @@
Function25072: ; 25072
call Function1cbb
call GetMemTileCoord
- ld de, $0015
+ ld de, $15
add hl, de
ld [hl], $f1
inc hl
@@ -25818,7 +25818,7 @@
ld hl, DefaultFlypoint
ld [hli], a
ld a, -1
- ld bc, $0010
+ ld bc, $10
call ByteFill
ret
; 2687a
@@ -27297,19 +27297,19 @@
ld [rIE], a
ld hl, wd1f3
ld de, EnemyMonSpecies
- ld bc, $0011
+ ld bc, $11
call Function75f
ld a, $fe
ld [de], a
ld hl, OverworldMap
ld de, wd26b
- ld bc, $01a8
+ ld bc, $1a8
call Function75f
ld a, $fe
ld [de], a
ld hl, wc608
ld de, wc6d0
- ld bc, $00c8
+ ld bc, $c8
call Function75f
xor a
ld [rIF], a
@@ -27319,7 +27319,7 @@
ld hl, wd26b
call Function287ca
push hl
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
ld a, [hl]
pop hl
@@ -27328,7 +27328,7 @@
cp $7
jp nc, Function28b22
ld de, OverworldMap
- ld bc, $01a2
+ ld bc, $1a2
call Function2879e
ld de, wc6d0
ld hl, wc813
@@ -27362,7 +27362,7 @@
jr nz, .asm_280fe
ld hl, OverworldMap
ld de, wd26b
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld de, OTPartyCount
ld a, [hli]
@@ -27440,19 +27440,19 @@
ld [rIE], a
ld hl, wd1f3
ld de, EnemyMonSpecies
- ld bc, $0011
+ ld bc, $11
call Function75f
ld a, $fe
ld [de], a
ld hl, OverworldMap
ld de, wd26b
- ld bc, $01c2
+ ld bc, $1c2
call Function75f
ld a, $fe
ld [de], a
ld hl, wc608
ld de, wc6d0
- ld bc, $00c8
+ ld bc, $c8
call Function75f
ld a, [wLinkMode]
cp LINK_TRADECENTER
@@ -27459,7 +27459,7 @@
jr nz, .asm_281fd
ld hl, wc9f4
ld de, wcb84
- ld bc, $0186
+ ld bc, $186
call Function283f2
.asm_281fd
@@ -27473,7 +27473,7 @@
ld hl, wd26b
call Function287ca
ld de, OverworldMap
- ld bc, $01b9
+ ld bc, $1b9
call Function2879e
ld de, wc6d0
ld hl, wc813
@@ -27521,10 +27521,10 @@
jr z, .asm_28259
dec hl
ld de, wcb84
- ld bc, $0190
+ ld bc, $190
call CopyBytes
ld hl, wcb84
- ld bc, $00c6
+ ld bc, $c6
.asm_28272
ld a, [hl]
cp $21
@@ -27557,7 +27557,7 @@
ld b, $6
.asm_2829c
push bc
- ld bc, $0021
+ ld bc, $21
call CopyBytes
ld a, $e
add e
@@ -27578,7 +27578,7 @@
ld a, $0
adc d
ld d, a
- ld bc, $000e
+ ld bc, $e
call CopyBytes
pop bc
dec b
@@ -27604,7 +27604,7 @@
.asm_282ee
pop de
- ld hl, $002f
+ ld hl, $2f
add hl, de
ld d, h
ld e, l
@@ -27618,16 +27618,16 @@
.asm_282fe
ld hl, OverworldMap
ld de, wd26b
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld de, OTPartyCount
- ld bc, $0008
+ ld bc, 8
call CopyBytes
ld de, wd276
- ld bc, $0002
+ ld bc, 2
call CopyBytes
ld de, OTPartyMon1Species
- ld bc, $01a4
+ ld bc, $1a4
call CopyBytes
ld a, OTPartyMonOT % $100
ld [wd102], a
@@ -27772,7 +27772,7 @@
Function28426: ; 28426
ld hl, OverworldMap
- ld bc, $0514
+ lb bc, 5, SCREEN_WIDTH
.asm_2842c
xor a
ld [hli], a
@@ -27849,7 +27849,7 @@
ld a, $ff
ld [de], a
inc de
- ld bc, $100
+ lb bc, 1, 0
jr .asm_28464
.asm_28495
@@ -27868,7 +27868,7 @@
dec b
jr nz, .asm_284a0
ld hl, PlayerName
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
push de
ld hl, PartyCount
@@ -27893,7 +27893,7 @@
.asm_284ce
ld [de], a
pop de
- ld hl, $0008
+ ld hl, $8
add hl, de
ld d, h
ld e, l
@@ -27911,7 +27911,7 @@
call .asm_284f0
ld hl, PartyMonNicknames
.asm_284f0
- ld bc, $0042
+ ld bc, $42
jp CopyBytes
; 284f6
@@ -27928,7 +27928,7 @@
ld a, [wd265]
ld [de], a
inc de
- ld hl, $0022
+ ld hl, $22
add hl, bc
ld a, [hli]
ld [de], a
@@ -27939,7 +27939,7 @@
xor a
ld [de], a
inc de
- ld hl, $0020
+ ld hl, $20
add hl, bc
ld a, [hl]
ld [de], a
@@ -27971,13 +27971,13 @@
.asm_28544
push bc
- ld hl, $0001
+ ld hl, $1
add hl, bc
ld bc, $1a
call CopyBytes
pop bc
- ld hl, $001f
+ ld hl, $1f
add hl, bc
ld a, [hl]
ld [de], a
@@ -27985,9 +27985,9 @@
inc de
push bc
- ld hl, $0024
+ ld hl, $24
add hl, bc
- ld bc, $0008
+ ld bc, 8
call CopyBytes
pop bc
@@ -28006,7 +28006,7 @@
ld [BaseSpecialAttack], a
pop bc
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld c, $5
ld b, $1
@@ -28036,22 +28036,22 @@
dec b
jr nz, .loop1
ld hl, PlayerName
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld hl, PartyCount
- ld bc, $0008
+ ld bc, 8
call CopyBytes
ld hl, PlayerID
- ld bc, $0002
+ ld bc, 2
call CopyBytes
ld hl, PartyMon1Species
- ld bc, $0120
+ ld bc, $120
call CopyBytes
ld hl, PartyMonOT
- ld bc, $0042
+ ld bc, $42
call CopyBytes
ld hl, PartyMonNicknames
- ld bc, $0042
+ ld bc, $42
call CopyBytes
ld a, [wLinkMode]
cp LINK_TRADECENTER
@@ -28062,28 +28062,28 @@
ld a, BANK(s0_a600)
call GetSRAMBank
ld hl, s0_a600
- ld b, $6
+ ld b, PARTY_LENGTH
.loop2
push bc
- ld bc, $0021
+ ld bc, $21
call CopyBytes
- ld bc, $000e
+ ld bc, $e
add hl, bc
pop bc
dec b
jr nz, .loop2
ld hl, s0_a600
- ld b, $6
+ ld b, PARTY_LENGTH
.loop3
push bc
- ld bc, $0021
+ ld bc, $21
add hl, bc
- ld bc, $000e
+ ld bc, $e
call CopyBytes
pop bc
dec b
jr nz, .loop3
- ld b, $6
+ ld b, PARTY_LENGTH
ld de, s0_a600
ld hl, wc9f9
.loop4
@@ -28108,12 +28108,12 @@
.next
pop de
- ld hl, $002f
+ ld hl, PartyMon1StatsEnd - PartyMon1Item
add hl, de
ld d, h
ld e, l
pop hl
- ld bc, $0021
+ ld bc, $21
add hl, bc
pop bc
dec b
@@ -28120,7 +28120,7 @@
jr nz, .loop4
call CloseSRAM
ld hl, wc9f9
- ld bc, $00c6
+ ld bc, $c6
.loop5
ld a, [hl]
cp $fe
@@ -28184,13 +28184,13 @@
dec c
jr nz, .loop
pop hl
- ld bc, $0108
+ lb bc, 1, 8
add hl, bc
ld de, OTPartyMonOT
- ld bc, $0042
+ ld bc, $42
call CopyBytes
ld de, OTPartyMonNicknames
- ld bc, $0042
+ ld bc, $42
jp CopyBytes
; 286ba
@@ -28208,7 +28208,7 @@
ld a, [wd265]
ld [bc], a
ld [CurSpecies], a
- ld hl, $0022
+ ld hl, $22
add hl, bc
ld a, [de]
inc de
@@ -28217,7 +28217,7 @@
inc de
ld [hl], a
inc de
- ld hl, $0020
+ ld hl, $20
add hl, bc
ld a, [de]
inc de
@@ -28237,7 +28237,7 @@
ld a, h
ld [wcbe9], a
push bc
- ld hl, $0001
+ ld hl, $1
add hl, bc
push hl
ld h, d
@@ -28251,12 +28251,12 @@
ld [de], a
inc de
pop bc
- ld bc, $0019
+ ld bc, $19
call CopyBytes
pop bc
ld d, h
ld e, l
- ld hl, $001f
+ ld hl, $1f
add hl, bc
ld a, [de]
inc de
@@ -28263,13 +28263,13 @@
ld [hl], a
ld [CurPartyLevel], a
push bc
- ld hl, $0024
+ ld hl, $24
add hl, bc
push hl
ld h, d
ld l, e
pop de
- ld bc, $0008
+ ld bc, 8
call CopyBytes
pop bc
call GetBaseData
@@ -28277,7 +28277,7 @@
push bc
ld d, h
ld e, l
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld c, $5
ld b, $1
@@ -28290,7 +28290,7 @@
ld [hli], a
push hl
push bc
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld c, $6
ld b, $1
@@ -28302,7 +28302,7 @@
ld a, [$ffb6]
ld [hli], a
push hl
- ld hl, $001b
+ ld hl, $1b
add hl, bc
ld a, $46
ld [hli], a
@@ -28484,7 +28484,7 @@
call Function1bf7
push hl
push bc
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
ld [hl], $7f
pop bc
@@ -28546,7 +28546,7 @@
call Function1bf7
push hl
push bc
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
ld [hl], $7f
pop bc
@@ -28566,7 +28566,7 @@
call Function1bf7
push hl
push bc
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
ld [hl], $7f
pop bc
@@ -28663,12 +28663,12 @@
callba Function4d319
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1
- ld bc, $0601
- ld a, $7f
+ lb bc, 6, 1
+ ld a, " "
call Function28b77
hlcoord 17, 1
- ld bc, $0601
- ld a, $7f
+ lb bc, 6, 1
+ ld a, " "
call Function28b77
jp Function2888b
@@ -28765,7 +28765,7 @@
call Function1bf7
push hl
push bc
- ld bc, $000b
+ ld bc, NAME_LENGTH
add hl, bc
ld [hl], $7f
pop bc
@@ -28888,7 +28888,7 @@
call GetPokemonName
ld hl, StringBuffer1
ld de, wd004
- ld bc, $000b
+ ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld a, [wd003]
ld hl, OTPartySpecies
@@ -28943,8 +28943,8 @@
ld a, $1
ld [wcf56], a
hlcoord 0, 12
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, 18
call Function28eef
hlcoord 1, 14
ld de, String28ece
@@ -28960,8 +28960,8 @@
dec a
jr nz, .asm_28c7b
hlcoord 0, 12
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, 18
call Function28eef
hlcoord 1, 14
ld de, String28ece
@@ -28971,13 +28971,13 @@
.asm_28c7b
ld hl, s0_a600
ld a, [DefaultFlypoint]
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call AddNTimes
ld a, BANK(s0_a600)
call GetSRAMBank
ld d, h
ld e, l
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
add hl, bc
ld a, [DefaultFlypoint]
ld c, a
@@ -28987,7 +28987,7 @@
cp $6
jr z, .asm_28ca6
push bc
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call CopyBytes
pop bc
jr .asm_28c96
@@ -28996,20 +28996,20 @@
ld hl, s0_a600
ld a, [PartyCount]
dec a
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call AddNTimes
push hl
ld hl, wc9f4
ld a, [wd003]
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call AddNTimes
pop de
- ld bc, $002f
+ ld bc, PartyMon1StatsEnd - PartyMon1Item
call CopyBytes
call CloseSRAM
ld hl, PlayerName
ld de, wc6e7
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld a, [DefaultFlypoint]
ld hl, PartySpecies
@@ -29023,7 +29023,7 @@
ld hl, PartyMonOT
call SkipNames
ld de, wc6f2
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld hl, PartyMon1ID
ld a, [DefaultFlypoint]
@@ -29049,7 +29049,7 @@
ld [wc701], a
ld hl, wd26b
ld de, wc719
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld a, [wd003]
ld hl, OTPartySpecies
@@ -29062,7 +29062,7 @@
ld hl, OTPartyMonOT
call SkipNames
ld de, wc724
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ld hl, OTPartyMon1ID
ld a, [wd003]
@@ -29110,7 +29110,7 @@
add hl, bc
ld a, [hl]
ld [wd003], a
- ld c, $64
+ ld c, 100
call DelayFrames
call ClearTileMap
call LoadFontsBattleExtra
@@ -29187,17 +29187,17 @@
callba Function14a58
callba MobileFn_1060af
callba Function106187
- ld c, $28
+ ld c, 40
call DelayFrames
hlcoord 0, 12
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, 18
call Function28eef
hlcoord 1, 14
ld de, String28ebd
call PlaceString
callba Function4d354
- ld c, $32
+ ld c, 50
call DelayFrames
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
@@ -29425,12 +29425,12 @@
call Decompress
ld hl, TradeArrowGFX
ld de, VTiles1 tile $6d
- ld bc, $0010
+ ld bc, $10
ld a, BANK(TradeArrowGFX)
call FarCopyBytes
ld hl, TradeArrowGFX + $10
ld de, VTiles1 tile $6e
- ld bc, $0010
+ ld bc, $10
ld a, BANK(TradeArrowGFX)
call FarCopyBytes
xor a
@@ -29598,7 +29598,7 @@
call DisableLCD
callab Function8cf53
ld hl, $9874
- ld bc, $000c
+ ld bc, $c
ld a, $60
call ByteFill
pop af
@@ -29614,7 +29614,7 @@
pop de
ld a, $11
call Function3b2a
- ld hl, $000b
+ ld hl, $b
add hl, bc
pop bc
ld [hl], b
@@ -29621,7 +29621,7 @@
pop de
ld a, $12
call Function3b2a
- ld hl, $000b
+ ld hl, $b
add hl, bc
pop bc
ld [hl], b
@@ -29795,7 +29795,7 @@
hlcoord 9, 3
ld [hl], $5b
inc hl
- ld bc, $000a
+ ld bc, $a
ld a, $60
call ByteFill
hlcoord 3, 2
@@ -29815,7 +29815,7 @@
Function292be: ; 292be
call Function297cf
hlcoord 0, 3
- ld bc, $0011
+ ld bc, $11
ld a, $60
call ByteFill
hlcoord 17, 3
@@ -29875,7 +29875,7 @@
ld de, wc741
call PlaceString
hlcoord 7, 2
- ld bc, $0006
+ ld bc, 6
pop af
call ByteFill
call WaitBGMap
@@ -30097,7 +30097,7 @@
call GetPokemonName
ld hl, StringBuffer1
pop de
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ret
; 294bb
@@ -30112,7 +30112,7 @@
Function294c3: ; 294c3
call DelayFrame
ld hl, VTiles2
- ld bc, $0a31
+ ld bc, $a31
call Request2bpp
call WaitTop
call Function297cf
@@ -30318,10 +30318,10 @@
lb de, $54, $58
ld a, $e
call Function3b2a
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld [hl], $1
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], $dc
call Function29114
@@ -30421,7 +30421,7 @@
inc [hl]
ret
.asm_296c8
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ret
@@ -30459,7 +30459,7 @@
dec [hl]
and a
ret nz
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ret
@@ -30644,11 +30644,11 @@
Function297ff: ; 297ff
push de
ld de, wc736
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
pop hl
ld de, wc741
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ret
; 29814
@@ -31428,7 +31428,7 @@
.asm_2a067
pop hl
- ld bc, $002f
+ ld bc, $2f
add hl, bc
jr .asm_2a052
; 2a06e
@@ -31452,7 +31452,7 @@
.asm_2a081
pop hl
- ld bc, $0009
+ ld bc, 9
add hl, bc
jr .asm_2a06e
; 2a088
@@ -32479,7 +32479,7 @@
Function2b995: ; 2b995
ld c, $0
ld b, $3
- ld de, $002f
+ ld de, $2f
.asm_2b99c
ld a, [hli]
or [hl]
@@ -32529,7 +32529,7 @@
.asm_2b9d7
push de
- ld de, $002f
+ ld de, $2f
add hl, de
pop de
dec c
@@ -32575,7 +32575,7 @@
.asm_2ba10
push de
- ld de, $002e
+ ld de, $2e
add hl, de
pop de
dec d
@@ -32699,7 +32699,7 @@
.asm_2c08e
ld a, b
ld [de], a
- ld bc, $0032
+ ld bc, $32
add hl, bc
ret
; 2c095
@@ -34918,7 +34918,7 @@
hlcoord 0, 17
ld [hl], $3b
inc hl
- ld bc, $0013
+ ld bc, $13
ld a, " "
call ByteFill
callba Function4424d
@@ -36047,7 +36047,7 @@
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
- ld bc, $0013
+ ld bc, $13
ld a, $61
call ByteFill
hlcoord 1, 9
@@ -36074,7 +36074,7 @@
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
- ld bc, $0013
+ ld bc, $13
ld a, $61
call ByteFill
hlcoord 1, 9
@@ -36377,12 +36377,12 @@
push bc
push af
ld hl, s0_a600
- ld bc, $002f
+ ld bc, $2f
call AddNTimes
ld d, h
ld e, l
ld hl, wd002
- ld bc, $0021
+ ld bc, $21
ld a, BANK(s0_a600)
call GetSRAMBank
call CopyBytes
@@ -36389,9 +36389,9 @@
pop af
push af
ld hl, PartyMonOT
- ld bc, $000b
+ ld bc, NAME_LENGTH
call AddNTimes
- ld bc, $000a
+ ld bc, $a
call CopyBytes
pop af
ld hl, PartyMon1ID
@@ -36418,11 +36418,11 @@
call GetSRAMBank
ld hl, s0_a600
ld de, s0_a71a
- ld bc, $11a
+ ld bc, 6 * (party_struct_length + PartyMon1 - PartyMon1Item)
call CopyBytes
ld hl, s0_a834
ld de, s0_aa0b
- ld bc, $1d7
+ ld bc, 1 + 10 * (party_struct_length + PartyMon1 - PartyMon1Item)
call CopyBytes
jp CloseSRAM
; 44745
@@ -36432,11 +36432,11 @@
call GetSRAMBank
ld hl, s0_a71a
ld de, s0_a600
- ld bc, $11a
+ ld bc, 6 * (party_struct_length + PartyMon1 - PartyMon1Item)
call CopyBytes
ld hl, s0_aa0b
ld de, s0_a834
- ld bc, $1d7
+ ld bc, 1 + 10 * (party_struct_length + PartyMon1 - PartyMon1Item)
call CopyBytes
jp CloseSRAM
@@ -36445,11 +36445,11 @@
call GetSRAMBank
xor a
ld hl, s0_a600
- ld bc, $11a
+ ld bc, 6 * (party_struct_length + PartyMon1 - PartyMon1Item)
call ByteFill
xor a
ld hl, s0_a834
- ld bc, $1d7
+ ld bc, 1 + 10 * (party_struct_length + PartyMon1 - PartyMon1Item)
call ByteFill
jp CloseSRAM
; 44781 (11:4781)
@@ -36527,7 +36527,7 @@
Function447da: ; 0x447da
dec a
ld hl, s0_a835 + $21
- ld bc, $002f
+ ld bc, $2f
call AddNTimes
ld a, BANK(s0_a834)
call GetSRAMBank
@@ -36657,7 +36657,7 @@
call GetSRAMBank
pop af
ld hl, s0_a835 + $2e
- ld bc, $002f
+ ld bc, $2f
call AddNTimes
ld a, [hl]
ld [CurItem], a
@@ -38917,33 +38917,33 @@
Function49384: ; 49384 (12:5384)
hlcoord 0, 0, AttrMap
- ld bc, $401
+ lb bc, 4, 1
ld a, $1
call Function49336
- ld bc, $201
+ lb bc, 2, 1
ld a, $2
call Function49336
- ld bc, $601
+ lb bc, 6, 1
ld a, $3
call Function49336
hlcoord 1, 0, AttrMap
ld a, $1
- ld bc, $312
+ lb bc, 3, 18
call Function49336
- ld bc, $212
+ lb bc, 2, 18
ld a, $2
call Function49336
- ld bc, $c12
+ lb bc, 12, 18
ld a, $3
call Function49336
hlcoord 19, 0, AttrMap
- ld bc, $401
+ lb bc, 4, 1
ld a, $1
call Function49336
- ld bc, $201
+ lb bc, 2, 1
ld a, $2
call Function49336
- ld bc, $601
+ lb bc, 6, 1
ld a, $3
call Function49336
hlcoord 0, 12, AttrMap
@@ -38984,7 +38984,7 @@
Function49409:: ; 49409
ld hl, Palette_49418
ld de, Unkn1Pals + 8 * 7
- ld bc, $0008
+ ld bc, 8
ld a, $5
call FarCopyWRAM
ret
@@ -39048,7 +39048,7 @@
Function49480: ; 49480
hlcoord 0, 0, AttrMap
- ld bc, $0414
+ lb bc, 4, SCREEN_WIDTH
ld a, $7
call Function49336
hlcoord 0, 2, AttrMap
@@ -39061,7 +39061,7 @@
Function49496: ; 49496
hlcoord 0, 0, AttrMap
- ld bc, $0214
+ lb bc, 2, SCREEN_WIDTH
ld a, $7
call Function49336
hlcoord 0, 1, AttrMap
@@ -39131,7 +39131,7 @@
ld a, $5
ld de, Unkn1Pals
ld hl, PokeComPalette
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ret
; 49501
@@ -39144,7 +39144,7 @@
ld a, $5
ld de, Unkn1Pals
ld hl, BattleTowerPalette
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ret
; 49550
@@ -39157,7 +39157,7 @@
ld a, $5
ld de, Unkn1Pals
ld hl, IcePathPalette
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ret
; 4959f
@@ -39170,7 +39170,7 @@
ld a, $5
ld de, Unkn1Pals
ld hl, HousePalette
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ret
; 495ee
@@ -39183,7 +39183,7 @@
ld a, $5
ld de, Unkn1Pals
ld hl, RadioTowerPalette
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ret
; 4963d
@@ -39246,22 +39246,22 @@
ld a, $5
ld de, Unkn1Pals
ld hl, MansionPalette1
- ld bc, $0040
+ ld bc, $40
call FarCopyWRAM
ld a, $5
ld de, Unkn1Pals + $20
ld hl, MansionPalette2
- ld bc, $0008
+ ld bc, 8
call FarCopyWRAM
ld a, $5
ld de, Unkn1Pals + $18
ld hl, MansionPalette3
- ld bc, $0008
+ ld bc, 8
call FarCopyWRAM
ld a, $5
ld de, Unkn1Pals + $30
ld hl, MansionPalette4
- ld bc, $0008
+ ld bc, 8
call FarCopyWRAM
ret
; 496fe
@@ -39276,7 +39276,7 @@
Function49706: ; 49706
ld hl, Palette_49732
ld de, Unkn1Pals
- ld bc, $0008
+ ld bc, 8
ld a, $5
call FarCopyWRAM
callba Function96a4
@@ -39284,7 +39284,7 @@
callba Function96b3
ld hl, Palette_4973a
ld de, Unkn2Pals
- ld bc, $0008
+ ld bc, 8
ld a, $5
call FarCopyWRAM
ret
@@ -39307,7 +39307,7 @@
Function49742: ; 49742
ld hl, Palette_49757
ld de, Unkn1Pals
- ld bc, $0040
+ ld bc, $40
ld a, $5
call FarCopyWRAM
callba Function96a4
@@ -39358,7 +39358,7 @@
Function49797: ; 49797
hlcoord 0, 0, AttrMap
- ld bc, $1002
+ lb bc, 16, 2
ld a, $4
call Function49336
ld a, $3
@@ -39365,31 +39365,31 @@
ldcoord_a 0, 1, AttrMap
ldcoord_a 0, 14, AttrMap
hlcoord 2, 0, AttrMap
- ld bc, $0812
+ lb bc, 8, 18
ld a, $5
call Function49336
hlcoord 2, 8, AttrMap
- ld bc, $0812
+ lb bc, 8, 18
ld a, $6
call Function49336
hlcoord 0, 16, AttrMap
- ld bc, $0214
+ lb bc, 2, SCREEN_WIDTH
ld a, $4
call Function49336
ld a, $3
- ld bc, $0601
+ lb bc, 6, 1
hlcoord 6, 1, AttrMap
call Function49336
ld a, $3
- ld bc, $0601
+ lb bc, 6, 1
hlcoord 17, 1, AttrMap
call Function49336
ld a, $3
- ld bc, $0601
+ lb bc, 6, 1
hlcoord 6, 9, AttrMap
call Function49336
ld a, $3
- ld bc, $0601
+ lb bc, 6, 1
hlcoord 17, 9, AttrMap
call Function49336
ld a, $2
@@ -39411,7 +39411,7 @@
Function49811: ; 49811
ld hl, Palette_49826
ld de, wd010
- ld bc, $0030
+ ld bc, $30
ld a, $5
call FarCopyWRAM
callba Function96a4
@@ -39472,16 +39472,16 @@
xor a
ld [VramState], a
call LoadCelebiGFX
- ld de, $0750
+ ld de, $750
ld a, $2c
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $84
- ld hl, $0002
+ ld hl, $2
add hl, bc
ld [hl], $1f
- ld hl, $000f
+ ld hl, $f
add hl, bc
ld a, $80
ld [hl], a
@@ -39527,7 +39527,7 @@
dec c
jr nz, .loop
ld hl, Sprites + $10
- ld bc, $0090
+ ld bc, $90
xor a
call ByteFill
ret
@@ -39576,7 +39576,7 @@
ld e, $0
ld a, $18
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $80
ret
@@ -39717,7 +39717,7 @@
ld e, [hl]
inc hl
ld d, [hl]
- ld hl, $0
+ ld hl, $
.asm_49b61
srl a
jr nc, .asm_49b66
@@ -39772,7 +39772,7 @@
ld a, $90
.asm_49bde
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], a
jr .asm_49be9
@@ -40570,8 +40570,8 @@
Function4a28a: ; 4a28a (12:628a)
hlcoord 2, 3
- ld bc, $601
- ld a, $7f
+ lb bc, 6, 1
+ ld a, " "
call Function4a6d8
call Function1bee
call WaitBGMap
@@ -40724,64 +40724,64 @@
call Function4a485
Function4a3aa: ; 4a3aa
hlcoord 0, 0
- ld bc, $301
+ lb bc, 3, 1
xor a
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $1
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
xor a
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $1
call Function4a6d8
- ld bc, $401
+ lb bc, 4, 1
ld a, $2
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $3
call Function4a6d8
- ld bc, $101
- ld a, $7f
+ lb bc, 1, 1
+ ld a, " "
call Function4a6d8
hlcoord 1, 0
ld a, $1
- ld bc, $312
+ lb bc, 3, 18
call Function4a6d8
- ld bc, $112
+ lb bc, 1, 18
ld a, $0
call Function4a6d8
- ld bc, $112
+ lb bc, 1, 18
ld a, $1
call Function4a6d8
- ld bc, $112
+ lb bc, 1, 18
ld a, $2
call Function4a6d8
- ld bc, $b12
- ld a, $7f
+ lb bc, 11, 18
+ ld a, " "
call Function4a6d8
hlcoord 19, 0
- ld bc, $301
+ lb bc, 3, 1
ld a, $0
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $1
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
xor a
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $1
call Function4a6d8
- ld bc, $401
+ lb bc, 4, 1
ld a, $2
call Function4a6d8
- ld bc, $101
+ lb bc, 1, 1
ld a, $3
call Function4a6d8
- ld bc, $101
- ld a, $7f
+ lb bc, 1, 1
+ ld a, " "
call Function4a6d8
ret
; 4a449 (12:6449)
@@ -41624,7 +41624,7 @@
ld h, d
ld l, e
ld de, EndFlypoint
- ld bc, $0006
+ ld bc, 6
call CopyBytes
ld a, [wd003]
ld hl, PartyMonNicknames
@@ -41632,7 +41632,7 @@
ld h, d
ld l, e
ld de, wd00c
- ld bc, $0006
+ ld bc, 6
call CopyBytes
ld a, [wd004]
ld hl, PartyMonNicknames
@@ -41640,7 +41640,7 @@
ld h, d
ld l, e
ld de, wd012
- ld bc, $0006
+ ld bc, 6
call CopyBytes
ld hl, UnknownText_0x4aa1d
call PrintText
@@ -41731,13 +41731,13 @@
push hl
ld c, l
ld b, h
- ld hl, $0002
+ ld hl, $2
add hl, bc
ld [hl], a
pop hl
.next
- ld bc, $0010
+ ld bc, $10
add hl, bc
dec e
jr nz, .inner_loop
@@ -41765,7 +41765,7 @@
push de
push hl
hlcoord 0, 1
- ld bc, $0028
+ ld bc, $28
call AddNTimes
ld [hl], $ec
pop hl
@@ -42004,7 +42004,7 @@
ld a, [PartyCount]
hlcoord 6, 1
.asm_4ac3b
- ld bc, $0028
+ ld bc, $28
add hl, bc
dec a
jr nz, .asm_4ac3b
@@ -42295,7 +42295,7 @@
; 4ae1f
Function4ae1f: ; 4ae1f
- ld bc, $0e07
+ lb bc, 14, 7
push bc
ld hl, YesNoMenuDataHeader
call CopyMenuDataHeader
@@ -42616,7 +42616,7 @@
ld a, [wd196]
and a
jr z, .asm_4d168
- ld bc, $0030
+ ld bc, $30
add hl, bc
.asm_4d168
@@ -43579,7 +43579,7 @@
call GetPokemonName
ld hl, StringBuffer1
ld de, wd050
- ld bc, $000b
+ ld bc, PKMN_NAME_LENGTH
call CopyBytes
call GiveANickname_YesNo
jr c, .asm_4da66
@@ -45235,7 +45235,7 @@
ld de, VTiles2
ld hl, VTiles2 tile $31
- ld bc, $0031
+ ld bc, $31
call Request2bpp
ld a, $31
@@ -45352,7 +45352,7 @@
Function4e726: ; 4e726
call ClearJoypad
- ld bc, $010e
+ lb bc, 1, 14
.asm_4e72c
push bc
call Function4e779
@@ -45393,7 +45393,7 @@
ld [hBGMapMode], a
hlcoord 7, 2
lb bc, 7, 7
- ld de, $000d
+ ld de, $d
.asm_4e762
push bc
.asm_4e763
@@ -45497,7 +45497,7 @@
ld de, $4858
ld a, $13
call Function3b2a
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld a, [wJumptableIndex]
and $e
@@ -45505,10 +45505,10 @@
pop de
add e
ld [hl], a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $0
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $10
ret
@@ -45788,7 +45788,7 @@
Function4e9d6: ; 4e9d6
ld hl, Sprites + 1
ld c, $12
- ld de, $0004
+ ld de, $4
.asm_4e9de
rept 2
dec [hl]
@@ -45839,11 +45839,11 @@
call MobileTextBorder
pop af
dec a
- ld bc, $000c
+ ld bc, $c
ld hl, wdc1a
call AddNTimes
ld de, wcd53
- ld bc, $000c
+ ld bc, $c
ld a, $5
call FarCopyWRAM
ld a, [rSVBK]
@@ -46023,7 +46023,7 @@
pop hl
call PlaceString
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46077,7 +46077,7 @@
ld hl, wcda9
inc [hl]
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46149,7 +46149,7 @@
.asm_5016b
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46183,7 +46183,7 @@
jr nc, .asm_501a1
ld a, "<LV>"
ld [hli], a
- ld bc, $4102
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 2 ; Missing a jr in here
.asm_501a1
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
call PrintNum
@@ -46319,7 +46319,7 @@
.asm_5025d
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46407,7 +46407,7 @@
.asm_502e3
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46442,7 +46442,7 @@
ld de, String_50372
call PlaceString
pop hl
- ld de, $0028
+ ld de, $28
add hl, de
pop bc
inc b
@@ -46468,7 +46468,7 @@
.asm_50340
and a
jr z, .asm_5034a
- ld de, $0028
+ ld de, $28
add hl, de
dec a
jr .asm_50340
@@ -46695,7 +46695,7 @@
PrintPartyMenuText: ; 5049a
hlcoord 0, 14
- ld bc, $0212
+ lb bc, 2, 18
call TextBox
ld a, [PartyCount]
and a
@@ -47595,7 +47595,7 @@
pop hl
; Print HP
- ld bc, $0015 ; move (1,1)
+ ld bc, $15 ; move (1,1)
add hl, bc
ld de, TempMonHP
ld a, [MonType]
@@ -47886,7 +47886,7 @@
ret
; 50cdb
-Function50cdb: ; 50cdb
+Function50cdb: ; unreferenced predef
push hl
push hl
ld hl, PartyMonNicknames
@@ -47900,12 +47900,12 @@
cp EGG
jr z, .asm_50d09
push hl
- ld bc, $fff4
+ ld bc, -12
add hl, bc
ld b, $0
call DrawEnemyHP
pop hl
- ld bc, $0005
+ ld bc, 5
add hl, bc
push de
call PrintLevel
@@ -49783,24 +49783,24 @@
bit 0, [hl]
jr z, .asm_8039c
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld a, [hl]
cp $ff
jr nz, .asm_8039c
- ld hl, $0006
+ ld hl, $6
add hl, bc
bit 6, [hl]
jr z, .asm_8039c
- ld hl, $0005
+ ld hl, $5
add hl, bc
set 2, [hl]
ld a, [WalkingDirection]
ld d, a
- ld hl, $0020
+ ld hl, $20
add hl, bc
ld a, [hl]
and $fc
@@ -50271,7 +50271,7 @@
push hl
call Function81928
pop hl
- ld bc, $0008
+ ld bc, 8
add hl, bc
pop bc
dec c
@@ -50287,7 +50287,7 @@
push hl
call Function81928
pop hl
- ld bc, $0004
+ ld bc, 4
add hl, bc
pop bc
dec c
@@ -50346,15 +50346,15 @@
Function8197c: ; 8197c
ld hl, DebugColorTestGFX + $10
ld de, VTiles2 tile $6a
- ld bc, $0160
+ ld bc, $160
call CopyBytes
ld hl, DebugColorTestGFX
ld de, VTiles0
- ld bc, $0010
+ ld bc, $10
call CopyBytes
call Functione51
ld hl, VTiles1
- ld bc, $0800
+ lb bc, 8, 0
.asm_8199d
ld a, [hl]
xor $ff
@@ -50376,7 +50376,7 @@
ld [rSVBK], a
ld hl, Palette_819f4
ld de, BGPals
- ld bc, $0080
+ ld bc, $80
call CopyBytes
ld a, $80
ld [rBGPI], a
@@ -50620,7 +50620,7 @@
ld a, $31
ld [$ffad], a
hlcoord 2, 4
- ld bc, $0606
+ lb bc, 6, 6
predef FillBox
ld a, [wd003]
and a
@@ -50683,13 +50683,13 @@
push af
ld a, $6a
ld [hli], a
- ld bc, $000f
+ ld bc, $f
ld a, $6b
call ByteFill
ld l, e
ld h, d
pop af
- ld bc, $0028
+ ld bc, $28
call ByteFill
ret
; 81bf4
@@ -50705,7 +50705,7 @@
ld de, OverworldMap
add hl, de
ld de, wc608
- ld bc, $0004
+ ld bc, 4
call CopyBytes
xor a
ld [wcf64], a
@@ -50960,7 +50960,7 @@
Function81d8e: ; 81d8e
hlcoord 0, 10
- ld bc, $00a0
+ ld bc, $a0
ld a, $6f
call ByteFill
hlcoord 2, 12
@@ -51082,7 +51082,7 @@
; 81e5e
Function81e5e: ; 81e5e
- ld bc, $000a
+ ld bc, $a
ld a, $6f
call ByteFill
ret
@@ -51163,7 +51163,7 @@
ld e, l
ld d, h
ld hl, wc608
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ret
; 81ee3
@@ -51387,16 +51387,16 @@
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7
call ByteFill
- ld de, $0015
+ ld de, $15
ld a, $6c
call Function821d2
- ld de, $001a
+ ld de, $1a
ld a, $6d
call Function821d2
- ld de, $001f
+ ld de, $1f
ld a, $6e
call Function821d2
- ld de, $0024
+ ld de, $24
ld a, $6f
call Function821d2
call Function821f4
@@ -51421,12 +51421,12 @@
rept 4
ld [hli], a
endr
- ld bc, $0010
+ ld bc, $10
add hl, bc
rept 4
ld [hli], a
endr
- ld bc, $0010
+ ld bc, $10
add hl, bc
rept 4
ld [hli], a
@@ -51464,7 +51464,7 @@
ld de, Unkn1Pals
add hl, de
ld de, wc608
- ld bc, $0008
+ ld bc, 8
call CopyBytes
ld de, wc608
call Function81ea5
@@ -51496,13 +51496,13 @@
.asm_82253
ld [hl], a
- ld de, $0015
+ ld de, $15
call Function821d8
- ld de, $001a
+ ld de, $1a
call Function821d8
- ld de, $001f
+ ld de, $1f
call Function821d8
- ld de, $0024
+ ld de, $24
call Function821d8
ld a, [rSVBK]
push af
@@ -51510,10 +51510,10 @@
ld [rSVBK], a
ld hl, BGPals
ld a, [wcf64]
- ld bc, $0008
+ ld bc, 8
call AddNTimes
ld de, wc608
- ld bc, $0008
+ ld bc, 8
call CopyBytes
pop af
ld [rSVBK], a
@@ -51540,12 +51540,12 @@
ld [rSVBK], a
ld hl, BGPals
ld a, [wcf64]
- ld bc, $0008
+ ld bc, 8
call AddNTimes
ld e, l
ld d, h
ld hl, wc608
- ld bc, $0008
+ ld bc, 8
call CopyBytes
hlcoord 1, 0
ld de, wc608
@@ -51738,7 +51738,7 @@
Function84000: ; 84000
ld hl, OverworldMap
- ld bc, $040c
+ lb bc, 4, 12
xor a
call Function842ab
xor a
@@ -52045,7 +52045,7 @@
ret
Function84219: ; 84219 (21:4219)
- ld hl, $0
+ ld hl, $
ld bc, $4
ld de, wca82
call Function8423c
@@ -52860,7 +52860,7 @@
xor a
ld [hBGMapMode], a
hlcoord 0, 5
- ld bc, $0a12
+ lb bc, 10, 18
call TextBox
pop af
ld e, a
@@ -53329,7 +53329,7 @@
cp 6
jr nc, .done
ld hl, wc608 + 1
- ld bc, $0010
+ ld bc, $10
call AddNTimes
ld a, [hl]
cp -1
@@ -53486,7 +53486,7 @@
ld a, $31
ld [$ffad], a
hlcoord 6, 6
- ld bc, $0606
+ lb bc, 6, 6
predef FillBox
ld a, $d0
ld [hSCY], a
@@ -53595,7 +53595,7 @@
cp $6
jr nc, .asm_866a7
ld hl, wc608 + 1
- ld bc, $0010
+ ld bc, $10
call AddNTimes
ld a, [hl]
cp $ff
@@ -53820,10 +53820,10 @@
xor a
ld [hBGMapMode], a
hlcoord 0, 2
- ld bc, $0809
+ lb bc, 8, 9
call TextBox
hlcoord 0, 12
- ld bc, $0412
+ lb bc, 4, 18
call TextBox
hlcoord 2, 4
ld de, PlayerName
@@ -54219,7 +54219,7 @@
call Function8cad3
ld a, $1b
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $84
ld a, $90
@@ -54250,7 +54250,7 @@
ld [hBGMapMode], a
callba Function8cf53
ld hl, Sprites + $90
- ld bc, $0010
+ ld bc, $10
xor a
call ByteFill
ld de, Font
@@ -54434,7 +54434,7 @@
ret
Function8ca8e: ; 8ca8e (23:4a8e)
- ld de, $0
+ ld de, $
ld a, [wd197]
bit 0, a
jr z, .asm_8ca9a
@@ -54784,7 +54784,7 @@
ld hl, VTiles0
ld c, $4
call Request2bpp
- ld hl, $00c0
+ ld hl, $c0
add hl, de
ld d, h
ld e, l
@@ -54892,11 +54892,11 @@
Function8cda6: ; 8cda6
ld hl, LYOverrides
- ld bc, $0090
+ ld bc, $90
ld a, [wd192]
call ByteFill
ld hl, LYOverridesBackup
- ld bc, $0090
+ ld bc, $90
ld a, [wd192]
call ByteFill
ld a, $43
@@ -54910,25 +54910,25 @@
; bushes
ld hl, VBGMap0
- ld bc, $0080
+ ld bc, 8 tiles
ld a, $2
call ByteFill
; train
ld hl, VBGMap0 tile $08
- ld bc, $0140
+ ld bc, 20 tiles
xor a
call ByteFill
; more bushes
ld hl, VBGMap0 tile $1c
- ld bc, $0080
+ ld bc, 8 tiles
ld a, $2
call ByteFill
; train window
- ld hl, $9907
- ld bc, $0006
+ ld hl, VBGMap0 tile $10 + 7
+ ld bc, 6
ld a, $4
call ByteFill
@@ -54986,7 +54986,7 @@
ld [rSVBK], a
ld a, b
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $0
call Function8ce14
@@ -55139,7 +55139,7 @@
Function8cf53: ; 8cf53
ld hl, wc300
- ld bc, $00c1
+ ld bc, $c1
.asm_8cf59
ld [hl], $0
inc hl
@@ -55192,7 +55192,7 @@
jr c, .done
.next
- ld bc, $0010
+ ld bc, $10
add hl, bc
dec e
jr nz, .loop
@@ -55231,7 +55231,7 @@
jr c, .done
.next
- ld bc, $0010
+ ld bc, $10
add hl, bc
dec e
jr nz, .loop
@@ -55259,7 +55259,7 @@
ld a, [hl]
and a
jr z, .found
- ld bc, $0010
+ ld bc, $10
add hl, bc
dec e
jr nz, .loop
@@ -55304,7 +55304,7 @@
ld [hli], a
pop de
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld a, e
ld [hli], a
@@ -55479,7 +55479,7 @@
Function8d0ec: ; 8d0ec
xor a
ld [wc3b8], a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld a, [hli]
ld [wc3ba], a
@@ -55520,13 +55520,13 @@
; 8d120
Function8d120:: ; 8d120
- ld hl, $0001
+ ld hl, $1
add hl, bc
ld [hl], a
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld [hl], $0
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], $ff
ret
@@ -55535,7 +55535,7 @@
Function8d132: ; 8d132
.loop
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld a, [hl]
and a
@@ -55547,7 +55547,7 @@
jr .skip
.ok
- ld hl, $000a
+ ld hl, $a
add hl, bc
inc [hl]
call Function8d189
@@ -55560,10 +55560,10 @@
ld a, [hl]
push hl
and $3f
- ld hl, $0009
+ ld hl, $9
add hl, bc
add [hl]
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld [hl], a
pop hl
@@ -55578,10 +55578,10 @@
.minus_1
xor a
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld [hl], a
- ld hl, $000a
+ ld hl, $a
add hl, bc
rept 2
dec [hl]
@@ -55590,11 +55590,11 @@
.minus_2
xor a
- ld hl, $0008
+ ld hl, $8
add hl, bc
ld [hl], a
dec a
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], a
jr .loop
@@ -55603,7 +55603,7 @@
Function8d189: ; 8d189
; Get the [bc+10]th entry in the data table
; indexed at [bc+1] in Unknown_8d6e6
- ld hl, $0001
+ ld hl, $1
add hl, bc
ld e, [hl]
ld d, 0
@@ -55614,7 +55614,7 @@
ld e, [hl]
inc hl
ld d, [hl]
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld l, [hl]
ld h, 0
@@ -55706,7 +55706,7 @@
Function8d24b: ; 8d24b
- ld hl, $0002
+ ld hl, $2
add hl, bc
ld e, [hl]
ld d, 0
@@ -55764,7 +55764,7 @@
.one: ; 8d2a2 (23:52a2)
ld a, [wcfa9]
- ld hl, $0
+ ld hl, $
add hl, bc
cp [hl]
jr z, .two
@@ -55815,7 +55815,7 @@
.three: ; 8d2ea (23:52ea)
ld a, [wcfa9]
- ld hl, $0
+ ld hl, $
add hl, bc
cp [hl]
jr z, .asm_8d2fb
@@ -55844,44 +55844,44 @@
ld hl, 0
add hl, bc
ld a, [hl]
- ld hl, $000d
+ ld hl, $d
add hl, bc
and $3
ld [hl], a
inc [hl]
swap a
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], a
.four_one: ; 8d321
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld a, [hl]
cp $a4
jr nc, .asm_8d356
- ld hl, $000d
+ ld hl, $d
add hl, bc
add $4
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld [hl], a
- ld hl, $0005
+ ld hl, $5
add hl, bc
inc [hl]
- ld hl, $000d
+ ld hl, $d
add hl, bc
ld a, [hl]
sla a
sla a
ld d, $2
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld a, [hl]
add $3
ld [hl], a
call Function8d6de
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], a
ret
@@ -56101,10 +56101,10 @@
.sixteen_zero: ; 8d493
ld a, $14
call Function8d120
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld [hl], $2
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $20
ret
@@ -56111,7 +56111,7 @@
; 8d4a5
.sixteen_two: ; 8d4a5
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld a, [hl]
and a
@@ -56121,12 +56121,12 @@
.asm_8d4af
call Function8d6d8
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $40
.sixteen_three: ; 8d4b8
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld a, [hl]
cp $30
@@ -56134,7 +56134,7 @@
dec [hl]
ld d, $28
call Function8d6de
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], a
ret
@@ -56146,13 +56146,13 @@
; 8d4d5
.sixteen_one: ; 8d4d5
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld [hl], $4
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $30
- ld hl, $000d
+ ld hl, $d
add hl, bc
ld [hl], $24
ret
@@ -56159,29 +56159,29 @@
; 8d4e8
.sixteen_four: ; 8d4e8
- ld hl, $000d
+ ld hl, $d
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d51c
ld d, a
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld a, [hl]
call Function8e72c
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], a
- ld hl, $000c
+ ld hl, $c
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $20
- ld hl, $000d
+ ld hl, $d
add hl, bc
ld a, [hl]
sub $c
@@ -56192,7 +56192,7 @@
.asm_8d51c
xor a
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], a
call Function8d6d8
@@ -56505,7 +56505,7 @@
; 8d6d8 (23:56d8)
Function8d6d8: ; 8d6d8
- ld hl, $000b
+ ld hl, $b
add hl, bc
inc [hl]
ret
@@ -58473,13 +58473,13 @@
push hl
ld c, l
ld b, h
- ld hl, $0002
+ ld hl, $2
add hl, bc
ld [hl], a
pop hl
.next
- ld bc, $0010
+ ld bc, $10
add hl, bc
dec e
jr nz, .loop
@@ -58755,7 +58755,7 @@
ld [de], a
inc de
push de
- ld hl, $0003
+ ld hl, $3
add hl, de
ld a, [de]
inc de
@@ -59665,7 +59665,7 @@
ld de, RadioTilemapRLE
call Function914bb
hlcoord 0, 12
- ld bc, $412
+ lb bc, 4, 18
call TextBox
ret
; 90e82
@@ -59674,7 +59674,7 @@
ld de, PhoneTilemapRLE
call Function914bb
hlcoord 0, 12
- ld bc, $412
+ lb bc, 4, 18
call TextBox
call Function90e98
call Function912d8
@@ -59997,7 +59997,7 @@
.asm_91079
ld a, b
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $10
pop af
@@ -60005,10 +60005,10 @@
push bc
callba GetLandmarkCoords
pop bc
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld [hl], e
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], d
ret
@@ -60019,10 +60019,10 @@
ld de, 0
ld a, $d
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $4
- ld hl, $0002
+ ld hl, $2
add hl, bc
ld [hl], $0
pop af
@@ -60053,10 +60053,10 @@
ld e, a
callba GetLandmarkCoords
pop bc
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld [hl], e
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], d
ret
@@ -60887,7 +60887,7 @@
.asm_91a11
callba Function91ae1
ld a, $7
- ld bc, $0006
+ ld bc, 6
hlcoord 1, 0
call ByteFill
hlcoord 0, 0
@@ -60899,7 +60899,7 @@
hlcoord 7, 2
ld [hl], $26
ld a, $7
- ld bc, $000b
+ ld bc, NAME_LENGTH
hlcoord 8, 2
call ByteFill
hlcoord 19, 2
@@ -60961,7 +60961,7 @@
.jump_return
push de
hlcoord 0, 12
- ld bc, $0412
+ lb bc, 4, 18
call TextBox
hlcoord 1, 14
ld [hl], $72
@@ -61219,10 +61219,10 @@
ld c, a
ld a, [wd004]
ld b, a
- ld hl, $0004
+ ld hl, $4
add hl, bc
ld [hl], e
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], d
ret
@@ -61541,7 +61541,7 @@
.asm_91ddc
hlcoord 0, 0
ld de, Sprites
- ld bc, $00a0
+ ld bc, $a0
call CopyBytes
ret
; 91de9
@@ -61604,7 +61604,7 @@
.asm_91e4d
ld hl, Sprites
decoord 0, 0
- ld bc, $00a0
+ ld bc, $a0
call CopyBytes
ret
; 91e5a
@@ -61869,7 +61869,7 @@
call Request2bpp
; Walking icon
- ld hl, $00c0
+ ld hl, $c0
add hl, de
ld d, h
ld e, l
@@ -61889,7 +61889,7 @@
ld a, b
call Function3b2a
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld [hl], $10
@@ -62101,7 +62101,7 @@
call DelayFrame
call DisableLCD
ld hl, VBGMap0 tile $00
- ld bc, $400
+ lb bc, 4, 0
ld a, $7f
call ByteFill
ld b, $5
@@ -62694,7 +62694,7 @@
ret
Function92af9: ; 92af9 (24:6af9)
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ld hl, $3
@@ -62890,7 +62890,7 @@
; 92c17
Function92c17: ; 92c17
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $10
ret
@@ -62897,7 +62897,7 @@
; 92c1e
Function92c1e: ; 92c1e
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $8
ret
@@ -62904,7 +62904,7 @@
; 92c25
Function92c25: ; 92c25
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $4
ret
@@ -62911,7 +62911,7 @@
; 92c2c
Function92c2c: ; 92c2c
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $2
ret
@@ -62918,7 +62918,7 @@
; 92c33
Function92c33: ; 92c33
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $1
ret
@@ -62925,18 +62925,18 @@
; 92c3a
Function92c3a: ; 92c3a
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
ld hl, 0
add hl, bc
ld [hl], $1
- ld hl, $000f
+ ld hl, $f
add hl, bc
ld [hl], $3
Function92c4c: ; 92c4c
- ld hl, $000f
+ ld hl, $f
add hl, bc
ld a, [hl]
and a
@@ -62956,7 +62956,7 @@
ld a, [wc709]
cp $ff
jr z, .asm_92c72
- ld hl, $0009
+ ld hl, $9
add hl, bc
ld a, [hl]
and a
@@ -62997,7 +62997,7 @@
ld a, [wc709]
cp $ff
jr z, .asm_92ca5
- ld hl, $0009
+ ld hl, $9
add hl, bc
ld a, [hl]
and a
@@ -63016,7 +63016,7 @@
ld hl, wc709
cp [hl]
jr z, .asm_92cce
- ld hl, $0009
+ ld hl, $9
add hl, bc
ld a, [hl]
and a
@@ -63028,7 +63028,7 @@
ld a, [wc709]
cp $ff
jr z, .asm_92cce
- ld hl, $0009
+ ld hl, $9
add hl, bc
ld a, [hl]
and a
@@ -63056,10 +63056,10 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], $20
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
ret
@@ -63066,7 +63066,7 @@
; 92cf8
Function92cf8: ; 92cf8
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld a, [hl]
and a
@@ -63080,7 +63080,7 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $8
ret
@@ -63105,7 +63105,7 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
call Function92fc0
@@ -63114,7 +63114,7 @@
ld de, $6068
ld a, $6
call Function3b2a
- ld hl, $000e
+ ld hl, $e
add hl, bc
pop af
ld [hl], a
@@ -63139,7 +63139,7 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $8
ret
@@ -63151,7 +63151,7 @@
ld hl, 0
add hl, bc
dec [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
ret
@@ -63166,7 +63166,7 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
push bc
@@ -63196,15 +63196,15 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $10
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], $11
Function92dca: ; 92dca
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld a, [hl]
and a
@@ -63223,7 +63223,7 @@
ret
.asm_92de5
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
ld hl, 0
@@ -63246,12 +63246,12 @@
add hl, bc
inc [hl]
call Function92fc0
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], a
Function92e10: ; 92e10
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld a, [hl]
and a
@@ -63265,15 +63265,15 @@
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld [hl], $20
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $0
Function92e31: ; 92e31
- ld hl, $000b
+ ld hl, $b
add hl, bc
ld a, [hl]
and a
@@ -63285,7 +63285,7 @@
ld hl, 0
add hl, bc
dec [hl]
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $8
ret
@@ -63297,18 +63297,18 @@
ld a, SFX_STOP_SLOT
call Function9331e
call Function93316
- ld hl, $0005
+ ld hl, $5
add hl, bc
ld [hl], $1
ld hl, 0
add hl, bc
inc [hl]
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld [hl], $10
Function92e64: ; 92e64
- ld hl, $000a
+ ld hl, $a
add hl, bc
ld a, [hl]
and a
@@ -63571,7 +63571,7 @@
; 92fc0
Function92fc0: ; 92fc0
- ld hl, $0003
+ ld hl, $3
add hl, bc
ld a, [hl]
push af
@@ -63590,7 +63590,7 @@
jr nz, .asm_92fe8
ld e, $0
.asm_92fd7
- ld hl, $0003
+ ld hl, $3
add hl, bc
inc [hl]
inc e
@@ -63611,7 +63611,7 @@
.asm_92ff2
ld a, e
inc e
- ld hl, $0003
+ ld hl, $3
add hl, bc
add [hl]
ld [hl], a
@@ -63996,7 +63996,7 @@
jr nz, .asm_93247
ld a, $2
ld [wcf64], a
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ret
@@ -64112,7 +64112,7 @@
jr z, .asm_932f1
cp $5
ret nz
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ret
@@ -65149,7 +65149,7 @@
push hl
ld a, $0
call GetSRAMBank
- ld de, $002b
+ ld de, $2b
add hl, de
ld a, [hli]
ld [Buffer1], a
@@ -65403,7 +65403,7 @@
Functionb94d6: ; b94d6
push bc
ld hl, VTiles2 tile $31
- ld bc, $0028
+ ld bc, $28
call Functionb97f8
ld de, Unknown_b9c96
ld c, 8
@@ -65483,7 +65483,7 @@
ld c, $8
call Functionb9915
ld a, $ff
- ld bc, $0010
+ ld bc, $10
call ByteFill
ld de, Unknown_b992e
ld c, $8
@@ -65660,7 +65660,7 @@
ld c, $30
call Functionb991e
xor a
- ld bc, $0010
+ ld bc, $10
call ByteFill
ld de, Unknown_b9cfe
ld c, $18
@@ -65692,7 +65692,7 @@
Functionb9776: ; b9776
push bc
ld hl, VTiles2 tile $31
- ld bc, $0028
+ ld bc, $28
call Functionb97f8
ld de, Unknown_b992e
ld c, $8
@@ -65763,7 +65763,7 @@
; b9803
Functionb9803: ; b9803
- ld bc, $002f
+ ld bc, $2f
ld de, wd002
ld a, $0
call GetSRAMBank
@@ -65771,7 +65771,7 @@
call CloseSRAM
ld hl, wd023
ld de, wd050
- ld bc, $000a
+ ld bc, $a
call CopyBytes
ld a, $50
ld [wd023], a
@@ -65943,7 +65943,7 @@
ld [hli], a
inc a
ld [hl], a
- ld bc, $0013
+ ld bc, $13
add hl, bc
inc a
ld [hli], a
@@ -66453,7 +66453,7 @@
ld hl, wd012
call Functione004e
pop hl
- ld bc, $0010
+ ld bc, $10
add hl, bc
pop bc
inc c
@@ -66462,7 +66462,7 @@
jr c, .asm_e000b
ld hl, OverworldMap
ld de, sScratch
- ld bc, $0310
+ ld bc, $310
call CopyBytes
pop hl
ld de, sScratch
@@ -66707,7 +66707,7 @@
xor a
ld [hBGMapMode], a
hlcoord 0, 0
- ld bc, $0c09
+ lb bc, 12, 9
call Functione04e5
hlcoord 9, 0
ld bc, SCREEN_WIDTH
@@ -66768,7 +66768,7 @@
xor $1
ld [hl], a
call Functione03ac
- ld bc, $0605
+ lb bc, 6, 5
call Functione04e5
pop af
ld [wcf66], a
@@ -66896,7 +66896,7 @@
Functione0366: ; e0366
ld hl, wc6d0
- ld bc, $0018
+ ld bc, $18
xor a
call ByteFill
ld de, wc6d0
@@ -66918,7 +66918,7 @@
xor a
ld [wc6e8], a
ld hl, wc6ea
- ld bc, $0018
+ ld bc, $18
call ByteFill
ret
; e0398
@@ -66925,7 +66925,7 @@
Functione0398: ; e0398
ld hl, 0
- ld bc, $0006
+ ld bc, 6
ld a, [wcf64]
call AddNTimes
ld b, $0
@@ -66988,7 +66988,7 @@
ld e, a
ld d, [hl]
pop hl
- ld bc, $0017
+ ld bc, $17
add hl, bc
ld [hl], e
ld bc, SCREEN_HEIGHT
@@ -67083,7 +67083,7 @@
lb bc, 12, 11
call Functione04f7
hlcoord 0, 12
- ld bc, $412
+ lb bc, 4, 18
call TextBox
ret
; e04e5 (38:44e5)
@@ -68146,23 +68146,23 @@
xor a
call ByteFill
hlcoord 12, 1, AttrMap
- ld bc, $202
+ lb bc, 2, 2
ld a, $1
call Functione04e7
hlcoord 14, 1, AttrMap
- ld bc, $202
+ lb bc, 2, 2
ld a, $2
call Functione04e7
hlcoord 16, 1, AttrMap
- ld bc, $202
+ lb bc, 2, 2
ld a, $3
call Functione04e7
hlcoord 18, 1, AttrMap
- ld bc, $202
+ lb bc, 2, 2
ld a, $4
call Functione04e7
hlcoord 9, 0, AttrMap
- ld bc, $c01
+ lb bc, 12, 1
ld a, $1
call Functione04e7
ld a, [rSVBK] ; $ff00+$70
@@ -68267,12 +68267,12 @@
ld [hBGMapMode], a
call DisableLCD
ld hl, wc608
- ld bc, $01e0
+ ld bc, $1e0
xor a
call ByteFill
ld hl, GFX_e17c5
ld de, VTiles1 tile $60
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld hl, LZ_e1805
ld de, VTiles1 tile $6d
@@ -68283,7 +68283,7 @@
ld a, $ee
call ByteFill
hlcoord 4, 3
- ld bc, $0c0c
+ lb bc, 12, 12
ld a, $ef
call Functione13ee
call Functione124e
@@ -68391,7 +68391,7 @@
hlcoord 4, 15
ld a, $f0
ld [hli], a
- ld bc, $000a
+ ld bc, $a
ld a, $f1
call ByteFill
hlcoord 15, 15
@@ -68400,7 +68400,7 @@
hlcoord 4, 16
ld a, $f3
ld [hli], a
- ld bc, $000a
+ ld bc, $a
ld a, $ef
call ByteFill
hlcoord 15, 16
@@ -68409,7 +68409,7 @@
hlcoord 4, 17
ld a, $f4
ld [hli], a
- ld bc, $000a
+ ld bc, $a
ld a, $f1
call ByteFill
hlcoord 15, 17
@@ -68895,11 +68895,11 @@
push hl
call Functione1654
pop hl
- ld bc, $0008
+ ld bc, 8
add hl, bc
call Functione1654
pop hl
- ld bc, $0060
+ ld bc, $60
add hl, bc
pop bc
dec b
@@ -68970,7 +68970,7 @@
dec c
jr nz, .asm_e1681
pop hl
- ld bc, $0010
+ ld bc, $10
add hl, bc
pop bc
dec c
@@ -69038,12 +69038,12 @@
dec b
jr nz, .asm_e16ea
pop hl
- ld de, $0030
+ ld de, $30
add hl, de
pop de
dec c
jr nz, .asm_e16e6
- ld bc, $0180
+ ld bc, $180
add hl, bc
pop bc
dec b
@@ -69462,7 +69462,7 @@
Functione209d: ; e209d
ld hl, wc6d0
- ld bc, $002d
+ ld bc, $2d
xor a
call ByteFill
call Functione2101
@@ -69612,7 +69612,7 @@
add $9
ld e, a
hlcoord 1, 2
- ld bc, $0028
+ ld bc, $28
.asm_e2195
ld a, d
and a
@@ -69650,7 +69650,7 @@
jr nz, .asm_e220d
ret
.asm_e21c8
- ld hl, $0
+ ld hl, $
add hl, bc
ld [hl], $0
ret
@@ -70717,7 +70717,7 @@
Functione2a6e: ; e2a6e (38:6a6e)
push de
hlcoord 0, 15
- ld bc, $112
+ lb bc, 1, 18
call TextBox
pop de
hlcoord 1, 16
@@ -71594,7 +71594,7 @@
lb bc, 1, 3
call ClearBox
hlcoord 0, 15
- ld bc, $112
+ lb bc, 1, 18
call TextBox
call WaitBGMap
hlcoord 1, 16
@@ -71649,7 +71649,7 @@
lb bc, 1, 3
call ClearBox
hlcoord 0, 15
- ld bc, $112
+ lb bc, 1, 18
call TextBox
call WaitBGMap
hlcoord 1, 16
@@ -71686,7 +71686,7 @@
lb bc, 1, 3
call ClearBox
hlcoord 0, 15
- ld bc, $112
+ lb bc, 1, 18
call TextBox
call WaitBGMap
@@ -71707,7 +71707,7 @@
ld c, 80
call DelayFrames
hlcoord 0, 15
- ld bc, $112
+ lb bc, 1, 18
call TextBox
hlcoord 1, 16
ld de, PCString_Bye
@@ -71731,7 +71731,7 @@
push bc
push af
hlcoord 0, 15
- ld bc, $0112
+ lb bc, 1, 18
call TextBox
hlcoord 1, 16
ld de, String_e3233
@@ -72367,7 +72367,7 @@
Functione37e3: ; e37e3 (38:77e3)
push de
hlcoord 0, 14
- ld bc, $212
+ lb bc, 2, 18
call TextBox
pop de
hlcoord 1, 16
@@ -72798,7 +72798,7 @@
.IsLight
ld c, $1
- ld de, $0040 ;the 2 values next to this setting
+ ld de, $40 ;the 2 values next to this setting
ret
.IsDark
@@ -72959,7 +72959,7 @@
dec c
jr nz, .asm_e4564
hlcoord 1, 2
- ld bc, $0028
+ ld bc, $28
ld a, [wJumptableIndex]
call AddNTimes
ld [hl], $ed
@@ -73033,11 +73033,11 @@
call FarDecompress
ld hl, VTiles0
ld de, w6_d000
- ld bc, $0180
+ ld bc, $180
call Request2bpp
ld hl, VTiles1
ld de, w6_d000 + $800
- ld bc, $0180
+ ld bc, $180
call Request2bpp
pop af
ld [rSVBK], a
@@ -73045,13 +73045,13 @@
ld de, $5458
ld a, $3
call Function3b2a
- ld hl, $0007
+ ld hl, $7
add hl, bc
ld [hl], $a0
- ld hl, $000c
+ ld hl, $c
add hl, bc
ld [hl], $60
- ld hl, $000d
+ ld hl, $d
add hl, bc
ld [hl], $30
xor a
@@ -74901,9 +74901,9 @@
ld [Requested2bppSource], a
ld a, [hli]
ld [Requested2bppSource + 1], a
- ld a, $9090 % $100
+ ld a, (VTiles2 tile $09) % $100
ld [Requested2bppDest], a
- ld a, $9090 / $100
+ ld a, (VTiles2 tile $09) / $100
ld [Requested2bppDest + 1], a
ld a, $4
ld [Requested2bpp], a
@@ -75641,7 +75641,7 @@
Functionfb4cc: ; fb4cc
ld a, [TextBoxFrame]
and 7
- ld bc, $0030
+ ld bc, $30
ld hl, Frames
call AddNTimes
ld d, h
@@ -76687,7 +76687,7 @@
call Functionfcdf4
ld hl, PartyMonOT
- ld bc, $000b
+ ld bc, NAME_LENGTH
call Functionfcdd7
ld de, wc6f2
call Functionfcdf4
@@ -76771,7 +76771,7 @@
call Functionfcdf4
ld hl, PartyMonOT
- ld bc, $000b
+ ld bc, NAME_LENGTH
call Functionfcdde
ld hl, wc724
call Functionfcdf4
@@ -76870,13 +76870,13 @@
; fcdf4
Functionfcdf4: ; fcdf4
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ret
; fcdfb
Functionfcdfb: ; fcdfb
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld a, $50
ld [de], a
@@ -76884,7 +76884,7 @@
; fce05
Functionfce05: ; fce05
- ld bc, $0003
+ ld bc, 3
call CopyBytes
ld a, $50
ld [de], a
@@ -77930,12 +77930,12 @@
ld c, $10
call .asm_1042d6
pop de
- ld hl, $0080
+ ld hl, $80
add hl, de
ld d, h
ld e, l
pop hl
- ld bc, $100
+ lb bc, 1, 0
add hl, bc
pop bc
ld a, c
@@ -78296,13 +78296,13 @@
ld a, $1
ld [rVBK], a ; $ff00+$4f
xor a
- ld bc, $400
+ lb bc, 4, 0
ld hl, VBGMap0 tile $00
call ByteFill
pop af
ld [rVBK], a ; $ff00+$4f
ld a, $60
- ld bc, $400
+ lb bc, 4, 0
ld hl, VBGMap0 tile $00
call ByteFill
ret
@@ -80021,7 +80021,7 @@
ld hl, MysteryGiftJP_GFX
ld de, VTiles2 tile $00
ld a, BANK(MysteryGiftJP_GFX)
- ld bc, $400
+ lb bc, 4, 0
call FarCopyBytes
ld hl, MysteryGiftJP_GFX + $400
ld de, VTiles0 tile $00
@@ -80537,19 +80537,19 @@
call GetSRAMBank
ld hl, GameTimeHours
ld de, $a001
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld hl, $a010
ld de, $a005
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld hl, $a039
ld de, $a009
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld hl, $a01b
ld de, $a00d
- ld bc, $0003
+ ld bc, 3
call CopyBytes
call Function106162
call CloseSRAM
@@ -80979,7 +80979,7 @@
Function10616e: ; 10616e
push bc
ld hl, $a001
- ld bc, $0080
+ ld bc, $80
xor a
ld de, 0
.asm_106179
@@ -81050,7 +81050,7 @@
Function1061cd: ; 1061cd
ld hl, $a001
- ld bc, $0082
+ ld bc, $82
xor a
call ByteFill
ld hl, $a07d
@@ -81060,7 +81060,7 @@
call Function106162
ld hl, $a001
ld de, $a084
- ld bc, $0082
+ ld bc, $82
call CopyBytes
ret
; 1061ef
@@ -81344,8 +81344,8 @@
Function10637c: ; 10637c
ld de, wcd30
- ld hl, $0041
- ld bc, $0041
+ ld hl, $41
+ ld bc, $41
ld a, $40
call Function3e32
ld a, [wcd25]
@@ -81522,7 +81522,7 @@
Function10649b: ; 10649b
ld a, [TextBoxFrame]
and $7
- ld bc, $0030
+ ld bc, $30
ld hl, Frames
call AddNTimes
ld d, h
@@ -81725,7 +81725,7 @@
Function1dc1b0: ; 1dc1b0
hlcoord 0, 0
ld de, wca90
- ld bc, $0154
+ ld bc, $154
call CopyBytes
ld hl, wcab5
ld a, $62
@@ -81776,7 +81776,7 @@
Function1dc213: ; 1dc213
ld hl, wca90
- ld bc, $00a0
+ ld bc, $a0
ld a, $7f
call ByteFill
ld hl, wca90
@@ -82015,7 +82015,7 @@
; 1dc50e
Function1dc50e: ; 1dc50e
- ld bc, $000b
+ ld bc, NAME_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld e, l
@@ -82197,7 +82197,7 @@
Function1de171: ; 1de171 (77:6171)
ld a, $32
hlcoord 0, 17
- lb bc, 0, 12
+ ld bc, 12
call ByteFill
hlcoord 0, 1
lb bc, 15, 11
@@ -82417,7 +82417,7 @@
Function1de5c8: ; 1de5c8
ld c, $0
- ld hl, $0029
+ ld hl, $29
add hl, de
ld a, [hli]
cp $84
@@ -82548,9 +82548,7 @@
SECTION "bank7C", ROMX, BANK[$7C]
-BattleTowerTrainerData:: ; What exactly it is, I don't know
-; Size is 70 (Nr of Trainers in BattleTower) * 0x24 (Nr of Bytes that are copied)
-INCBIN "unknown/1f0000.bin"
+INCLUDE "data/battle_tower_2.asm"
SECTION "bank7D", ROMX, BANK[$7D]
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -10,11 +10,11 @@
db 0
UnknownScript_0x9e39d:
- writebyte $9
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_09
+ special BattleTowerAction
iffalse UnknownScript_0x9e3d1
- writebyte $2
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_02
+ special BattleTowerAction
if_equal $0, UnknownScript_0x9e3d1
if_equal $2, UnknownScript_0x9e3c4
if_equal $3, UnknownScript_0x9e3d1
@@ -30,10 +30,10 @@
priorityjump UnknownScript_0x9e555
UnknownScript_0x9e3c7:
- writebyte $4
- special Function170687
- writebyte $6
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_04
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_06
+ special BattleTowerAction
UnknownScript_0x9e3d1:
dotrigger $1
UnknownScript_0x9e3d3:
@@ -51,14 +51,14 @@
end
ReceptionistScript_0x9e3e2:
- writebyte $2
- special Function170687
- if_equal $3, BattleTowerBattleRoomScript_0x9f4e4
+ writebyte BATTLE_TOWER_ACTION_02
+ special BattleTowerAction
+ if_equal $3, BattleTowerBattleRoomScript_0x9f4e4 ; maps/BattleTowerBattleRoom.asm
loadfont
writetext Text_BattleTowerWelcomesYou
keeptextopen
- writebyte $0
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_00
+ special BattleTowerAction
if_not_equal $0, Script_Menu_ChallengeExplanationCancel
jump Script_BattleTowerIntroductionYesNo
@@ -71,8 +71,8 @@
jump UnknownScript_0x9e4b0
Script_ChoseChallenge: ; 0x9e40f
- writebyte $1a
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_1A ; ResetBattleTowerTrainerSRAM
+ special BattleTowerAction
special SpecialCheckForBattleTowerRules
if_not_equal $0, Script_CloseText
writetext Text_SaveBeforeEnteringBattleRoom
@@ -82,24 +82,24 @@
special Special_TryQuickSave
iffalse Script_Menu_ChallengeExplanationCancel
dotrigger $1
- writebyte $1
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_01
+ special BattleTowerAction
special Function1700b0
if_equal $a, Script_Menu_ChallengeExplanationCancel
if_not_equal $0, UnknownScript_0x9e550
- writebyte $11
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_11
+ special BattleTowerAction
writetext Text_RightThisWayToYourBattleRoom
closetext
loadmovesprites
- writebyte $1e
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_1E
+ special BattleTowerAction
jump UnknownScript_0x9e454
UnknownScript_0x9e44e:
loadmovesprites
- writebyte $8
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_08
+ special BattleTowerAction
UnknownScript_0x9e454:
musicfadeout MUSIC_NONE, $8
domaptrigger BATTLE_TOWER_BATTLE_ROOM, $0
@@ -107,8 +107,8 @@
domaptrigger BATTLE_TOWER_HALLWAY, $0
follow $2, PLAYER
applymovement $2, MovementData_0x9e571
- writebyte $a
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_0A
+ special BattleTowerAction
warpsound
disappear $2
stopfollow
@@ -117,16 +117,16 @@
end
Script_GivePlayerHisPrize: ; 0x9e47a
- writebyte $1c
- special Function170687
- writebyte $1b
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_1C
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_1B
+ special BattleTowerAction
if_equal $12, Script_YourPackIsStuffedFull
itemtotext $0, $1
- giveitem $ff, $5
+ giveitem ITEM_FROM_MEM, 5
writetext Text_PlayerGotFive
- writebyte $1d
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_1D
+ special BattleTowerAction
loadmovesprites
end
@@ -143,8 +143,8 @@
Script_BattleTowerExplanation: ; 0x9e4a5
writetext Text_BattleTowerIntroduction_2
UnknownScript_0x9e4a8:
- writebyte $1
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_01
+ special BattleTowerAction
jump Script_Menu_ChallengeExplanationCancel
UnknownScript_0x9e4b0:
@@ -170,8 +170,8 @@
iffalse Script_Menu_ChallengeExplanationCancel
special Special_TryQuickSave
iffalse Script_Menu_ChallengeExplanationCancel
- writebyte $1
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_01
+ special BattleTowerAction
special Function1700ba
if_equal $a, Script_Menu_ChallengeExplanationCancel
if_not_equal $0, UnknownScript_0x9e550
@@ -184,16 +184,16 @@
end
UnknownScript_0x9e4ea:
- writebyte $18
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_18
+ special BattleTowerAction
if_not_equal $0, Script_APkmnLevelExceeds
- writebyte $19
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_19
+ special BattleTowerAction
if_not_equal $0, Script_MayNotEnterABattleRoomUnderL70
special SpecialCheckForBattleTowerRules
if_not_equal $0, Script_CloseText
- writebyte $5
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_05
+ special BattleTowerAction
if_equal $0, UnknownScript_0x9e512
writetext UnknownText_0x9ecb0
jump UnknownScript_0x9e515
@@ -210,10 +210,10 @@
special Special_TryQuickSave
iffalse Script_Menu_ChallengeExplanationCancel
dotrigger $1
- writebyte $6
- special Function170687
- writebyte $12
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_06
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_12
+ special BattleTowerAction
writetext Text_RightThisWayToYourBattleRoom
closetext
jump UnknownScript_0x9e44e
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -30,10 +30,10 @@
storetext 1
keeptextopen
loadmovesprites
- special Function170215 ; calls predef startbattle
+ special BattleTowerBattle ; calls predef startbattle
special FadeBlackBGMap
reloadmap
- if_not_equal $0, UnknownScript_0x9f4c2
+ if_not_equal $0, Script_FailedBattleTowerChallenge
copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64
if_equal BATTLETOWER_NROFTRAINERS, Script_BeatenAllTrainers
applymovement $2, MovementData_0x9e597
@@ -65,12 +65,12 @@
writetext Text_SaveAndEndTheSession
yesorno
iffalse Script_DontSaveAndEndTheSession
- writebyte $7
- special Function170687
- writebyte $1f
- special Function170687
- writebyte $3
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_07
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_1F
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_03
+ special BattleTowerAction
playsound SFX_SAVE
waitbutton
special FadeBlackBGMap
@@ -79,22 +79,22 @@
writetext Text_CancelYourBattleRoomChallenge
yesorno
iffalse Script_ContinueAndBattleNextOpponent
- writebyte $4
- special Function170687
- writebyte $6
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_04
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_06
+ special BattleTowerAction
loadmovesprites
special FadeBlackBGMap
- warpfacing $1, BATTLE_TOWER_1F, $7, $7
+ warpfacing UP, BATTLE_TOWER_1F, $7, $7
loadfont
jump UnknownScript_0x9e4b0
-UnknownScript_0x9f4c2:
+Script_FailedBattleTowerChallenge:
pause 60
special Special_BattleTowerFade
- warpfacing $1, BATTLE_TOWER_1F, $7, $7
- writebyte $4
- special Function170687
+ warpfacing UP, BATTLE_TOWER_1F, $7, $7
+ writebyte BATTLE_TOWER_ACTION_04
+ special BattleTowerAction
loadfont
writetext Text_ThanksForVisiting
closetext
@@ -104,7 +104,7 @@
Script_BeatenAllTrainers: ; 0x9f4d9
pause 60
special Special_BattleTowerFade
- warpfacing $1, BATTLE_TOWER_1F, $7, $7
+ warpfacing UP, BATTLE_TOWER_1F, $7, $7
BattleTowerBattleRoomScript_0x9f4e4:
loadfont
writetext Text_CongratulationsYouveBeatenAllTheTrainers
@@ -111,8 +111,8 @@
jump Script_GivePlayerHisPrize
UnknownScript_0x9f4eb:
- writebyte $4
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_04
+ special BattleTowerAction
loadfont
writetext Text_TooMuchTimeElapsedNoRegister
closetext
@@ -120,10 +120,10 @@
end
UnknownScript_0x9f4f7:
- writebyte $4
- special Function170687
- writebyte $6
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_04
+ special BattleTowerAction
+ writebyte BATTLE_TOWER_ACTION_06
+ special BattleTowerAction
loadfont
writetext Text_ThanksForVisiting
writetext Text_WeHopeToServeYouAgain
--- a/maps/BattleTowerElevator.asm
+++ b/maps/BattleTowerElevator.asm
@@ -20,8 +20,8 @@
follow $2, PLAYER
applymovement $2, MovementData_0x9f58f
applymovement PLAYER, MovementData_0x9f592
- writebyte $a
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_0A
+ special BattleTowerAction
playsound SFX_ELEVATOR
earthquake 60
waitbutton
--- a/maps/GoldenrodPokeCenter1F.asm
+++ b/maps/GoldenrodPokeCenter1F.asm
@@ -9,8 +9,8 @@
jumpstd pokecenternurse
UnknownScript_0x60f94:
- writebyte $b
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_0B
+ special BattleTowerAction
if_equal $b, UnknownScript_0x60f9e
end
@@ -41,8 +41,8 @@
end
UnknownScript_0x60fd9:
- writebyte $b
- special Function170687
+ writebyte BATTLE_TOWER_ACTION_0B
+ special BattleTowerAction
if_equal $b, UnknownScript_0x60fe3
end
--- a/maps/LancesRoom.asm
+++ b/maps/LancesRoom.asm
@@ -127,7 +127,7 @@
applymovement $3, MovementData_0x180f5b
special FadeBlackBGMap
pause 15
- warpfacing $1, HALL_OF_FAME, $4, $d
+ warpfacing UP, HALL_OF_FAME, $4, $d
end
MovementData_0x180f33:
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -77,7 +77,7 @@
playsound SFX_ENTER_DOOR
special FadeBlackBGMap
waitbutton
- warpfacing $1, NATIONAL_PARK_BUG_CONTEST, $a, $2f
+ warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f
end
OfficerScript_0x6a204:
@@ -115,7 +115,7 @@
special FadeBlackBGMap
waitbutton
special Special_SelectRandomBugContestContestants
- warpfacing $1, NATIONAL_PARK_BUG_CONTEST, $a, $2f
+ warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f
end
Route35NationalParkgate_EnterContest:
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -85,7 +85,7 @@
playsound SFX_EXIT_BUILDING
special FadeBlackBGMap
waitbutton
- warpfacing $2, NATIONAL_PARK_BUG_CONTEST, $21, $12
+ warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12
end
.CopyContestants:
@@ -169,7 +169,7 @@
special FadeBlackBGMap
waitbutton
special Special_SelectRandomBugContestContestants
- warpfacing $2, NATIONAL_PARK_BUG_CONTEST, $21, $12
+ warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12
end
.LeaveMonsWithOfficer:
--- /dev/null
+++ b/misc/battle_tower_45.asm
@@ -1,0 +1,1490 @@
+BattleTowerBattle: ; 170215
+ xor a
+ ld [wJumptableIndex], a
+ call Function17022c
+ ret
+; 17021d
+
+Function17021d: ; 17021d
+ ret
+; 17021e
+
+Function17021e: ; 17021e
+ xor a
+ ld [wJumptableIndex], a
+ ld [wcf64], a
+ ld [wcf65], a
+ ld [wcf66], a
+ ret
+; 17022c
+
+Function17022c: ; 17022c
+.loop
+ call Jumpto_BattleTowerBattleFunction
+ call DelayFrame
+ ld a, [wJumptableIndex]
+ cp $1
+ jr nz, .loop
+ ret
+; 17023a
+
+Jumpto_BattleTowerBattleFunction: ; 17023a
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_BattleTowerBattleFunctions
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 170249
+
+Jumptable_BattleTowerBattleFunctions: ; 170249
+ dw RunBattleTowerBattle
+ dw SkipBattleTowerBattle
+; 17024d
+
+RunBattleTowerBattle: ; 17024d
+ ld a, [Options]
+ push af
+ ld hl, Options
+ set 6, [hl]
+ ld a, [InBattleTowerBattle]
+ push af
+ or $1
+ ld [InBattleTowerBattle], a
+ xor a
+ ld [wLinkMode], a
+ callba Mobile_HealParty
+ callba HealParty
+ call Function1702b7
+ call Function170bf7
+ predef StartBattle
+ callba LoadPokemonData
+ callba HealParty
+ ld a, [wBattleResult]
+ ld [ScriptVar], a
+ and a
+ jr nz, .lost
+ ld a, BANK(sNrOfBeatenBattleTowerTrainers)
+ call GetSRAMBank
+ ld a, [sNrOfBeatenBattleTowerTrainers]
+ ld [wNrOfBeatenBattleTowerTrainers], a ; wcf64
+ call CloseSRAM
+ ld hl, StringBuffer3
+ ld a, [wNrOfBeatenBattleTowerTrainers] ; wcf64
+ add $f7
+ ld [hli], a
+ ld a, $50
+ ld [hl], a
+
+.lost
+ pop af
+ ld [InBattleTowerBattle], a
+ pop af
+ ld [Options], a
+ ld a, $1
+ ld [wJumptableIndex], a
+ ret
+
+
+Function1702b7: ; 1702b7
+; Initialise the BattleTower-Trainer and his Pkmn
+ call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
+ ld c, PKMN_NAME_LENGTH
+ callba Function17d073
+ jr nc, .asm_1702db
+
+ ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1]
+ ld [wd265], a
+ call GetPokemonName
+ ld l, e
+ ld h, d
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+.asm_1702db
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
+ ld c, PKMN_NAME_LENGTH
+ callba Function17d073
+ jr nc, .asm_1702fc
+ ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e]
+ ld [wd265], a
+ call GetPokemonName
+ ld l, e
+ ld h, d
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+.asm_1702fc
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
+ ld c, PKMN_NAME_LENGTH
+ callba Function17d073
+ jr nc, .asm_17031d
+ ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689]
+ ld [wd265], a
+ call GetPokemonName
+ ld l, e
+ ld h, d
+ ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+.asm_17031d
+ ld a, $50
+ ld [wBT_OTTempCopy + wBT_OTTempCopy_45], a ; $c64d
+ ld [wBT_OTTempCopy + wBT_OTTempCopy_80], a ; $c688
+ ld [wBT_OTTempCopy + wBT_OTTempCopy_BB], a ; $c68a + 57 = $c6c3
+ call Function170c98
+ ld de, wBT_OTTempCopy
+ ld c, $a
+ callba Function17d073
+ jr nc, .asm_17033d
+ ld hl, String_170426
+ jr .asm_170340
+
+.asm_17033d
+ ld hl, wBT_OTTempCopy ; 0xc608
+
+.asm_170340
+ ld de, wd26b
+ ld bc, $000a
+ call CopyBytes
+ ld a, $50
+ ld [de], a
+ ld hl, wBT_OTTempCopy + wBT_OTTempCopy_TrainerClass
+ ld a, [hli]
+ ld [OtherTrainerClass], a
+ ld a, $ea
+ ld [BGMapBuffer], a
+ ld a, $d3
+ ld [wcd21], a
+
+ ; Copy Pkmn into Memory from the address in hl
+ ld de, OTPartyMon1Species
+ ld bc, OTPartyCount
+ ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has
+ ld [bc], a
+ inc bc
+.asm_170367
+ push af
+ ld a, [hl]
+ ld [bc], a
+ inc bc
+ push bc
+ ld bc, party_struct_length
+ call CopyBytes
+ push de
+ ld a, [BGMapBuffer]
+ ld e, a
+ ld a, [wcd21]
+ ld d, a
+ ld bc, $000b
+ call CopyBytes
+ ld a, e
+ ld [BGMapBuffer], a
+ ld a, d
+ ld [wcd21], a
+ pop de
+ pop bc
+ pop af
+ dec a
+ and a
+ jr nz, .asm_170367
+ ld a, $ff
+ ld [bc], a
+ ret
+; 170394
+
+Function170394: ; 170394
+ ld hl, $c608 + 11
+ ld d, $3
+.asm_170399
+ push de
+ push hl
+ ld b, h
+ ld c, l
+ ld a, [hl]
+ and a
+ jr z, .asm_1703b1
+ cp $ff
+ jr z, .asm_1703b1
+ cp $fe
+ jr z, .asm_1703b1
+ cp $fd
+ jr z, .asm_1703b1
+ cp $fc
+ jr nz, .asm_1703b4
+
+.asm_1703b1
+ ld a, $eb
+ ld [hl], a
+
+.asm_1703b4
+ ld [CurSpecies], a
+ call GetBaseData
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2fb]
+ call CloseSRAM
+ ld e, a
+ ld hl, $001f
+ add hl, bc
+ ld a, [hl]
+ cp $2
+ ld a, $2
+ jr c, .asm_1703d6
+ ld a, [hl]
+ cp e
+ jr c, .asm_1703d7
+ ld a, e
+
+.asm_1703d6
+ ld [hl], a
+
+.asm_1703d7
+ ld [CurPartyLevel], a
+ ld hl, $0002
+ add hl, bc
+ ld d, $3
+ ld a, [hli]
+ and a
+ jr z, .asm_1703ea
+ cp $fc
+ jr nc, .asm_1703ea
+ jr .asm_1703f4
+
+.asm_1703ea
+ dec hl
+ ld a, $1
+ ld [hli], a
+ xor a
+rept 2
+ ld [hli], a
+endr
+ ld [hl], a
+ jr .asm_1703ff
+
+.asm_1703f4
+ ld a, [hl]
+ cp $fc
+ jr c, .asm_1703fb
+ ld [hl], $0
+
+.asm_1703fb
+ inc hl
+ dec d
+ jr nz, .asm_1703f4
+
+.asm_1703ff
+ ld hl, $0024
+ add hl, bc
+ ld d, h
+ ld e, l
+ push hl
+ push de
+ ld hl, $000a
+ add hl, bc
+ ld b, $1
+ predef CalcPkmnStats
+ pop de
+ pop hl
+rept 2
+ dec de
+endr
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+ pop hl
+ ld bc, $003b
+ add hl, bc
+ pop de
+ dec d
+ jp nz, .asm_170399
+ ret
+; 170426
+
+String_170426: ; 170426
+ db "CHRIS@"
+; 17042c
+
+Function17042c: ; 17042c
+ ld hl, OTPartyMon2ID
+ ld a, $7
+.asm_170431
+ push af
+ push hl
+ ld c, $12
+.asm_170435
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ and a
+ jr z, .asm_170451
+ cp $f
+ jr nc, .asm_17045b
+ push hl
+ ld hl, Unknown_170470
+ dec a
+ ld e, a
+ ld d, 0
+ add hl, de
+ ld a, [hl]
+ pop hl
+ cp b
+ jr c, .asm_17045b
+ jr z, .asm_17045b
+ jr .asm_170456
+
+.asm_170451
+ ld a, b
+ cp $fc
+ jr nc, .asm_17045b
+
+.asm_170456
+ dec c
+ jr nz, .asm_170435
+ jr .asm_170466
+
+.asm_17045b
+ pop de
+ push de
+ ld hl, Unknown_17047e
+ ld bc, $0024
+ call CopyBytes
+
+.asm_170466
+ pop hl
+ ld de, $00e0
+ add hl, de
+ pop af
+ dec a
+ jr nz, .asm_170431
+ ret
+; 170470
+
+Unknown_170470:
+ db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24
+
+Unknown_17047e:
+ db $03, $04, $05, $08
+ db $03, $05, $0e, $06
+ db $03, $02, $00, $00
+ db $39, $07, $07, $04
+ db $00, $05, $04, $07
+ db $01, $05, $00, $00
+ db $0f, $05, $14, $07
+ db $05, $05, $11, $0c
+ db $0c, $06, $06, $04
+
+
+CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2
+; copy the BattleTower-Trainer data that lies at 'BT_OTrainer' to 'wBT_OTTempCopy'
+ ld a, [rSVBK]
+ push af
+ ld a, $3
+ ld [rSVBK], a
+ ld hl, BT_OTrainer ; $d100
+ ld de, wBT_OTTempCopy ; $c608
+ ld bc, BT_OTrainerEnd - BT_OTrainer ; $e0 = $a + $1 + 3*$3b + $24
+ ; = $a + $1 + BATTLETOWER_NROFPKMNS * (party_struct_length + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
+ call CopyBytes
+ pop af
+ ld [rSVBK], a
+ ld a, BANK(s1_be45)
+ call GetSRAMBank
+ ld a, $2
+ ld [s1_be45], a
+ ld hl, sNrOfBeatenBattleTowerTrainers
+ inc [hl]
+ call CloseSRAM
+SkipBattleTowerBattle: ; 1704c9
+ ret
+; 1704ca
+
+
+Function1704ca: ; 1704ca
+ ld a, [$be46]
+ cp $7
+ jr c, .asm_1704d3
+ ld a, $6
+
+.asm_1704d3
+ ld hl, $afce
+ ld de, -$e0
+.asm_1704d9
+ and a
+ jr z, .asm_1704e0
+ add hl, de
+ dec a
+ jr .asm_1704d9
+
+.asm_1704e0
+ ret
+; 1704e1
+
+Function1704e1: ; 1704e1
+ call SpeechTextBox
+ call FadeToMenu
+ call Function17021e
+ call Function1704f1
+ call Function2b3c
+ ret
+; 1704f1
+
+Function1704f1: ; 1704f1
+ call WhiteBGMap
+ call ClearSprites
+ call ClearScreen
+.asm_1704fa
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_17050f
+ call Function170510
+ callba Function104061
+ jr .asm_1704fa
+
+.asm_17050f
+ ret
+; 170510
+
+Function170510: ; 170510
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_17051f
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 17051f
+
+Jumptable_17051f: ; 17051f
+ dw Function170525
+ dw Function170571
+ dw Function170577
+; 170525
+
+Function170525: ; 170525
+ ld a, $5
+ call GetSRAMBank
+
+ ld hl, $a89c
+ ld de, StringBuffer3
+ ld bc, $0016
+ call CopyBytes
+
+ ld hl, $a8b2
+ ld de, $c608
+ ld bc, $0096
+ call CopyBytes
+
+ call CloseSRAM
+ hlcoord 1, 1
+ ld de, StringBuffer3
+ call PlaceString
+ hlcoord 1, 3
+ ld de, String_170676
+ call PlaceString
+ hlcoord 4, 3
+ ld de, StringBuffer4
+ call PlaceString
+ hlcoord 8, 3
+ ld de, String_17067a
+ call PlaceString
+ call Function1705b7
+ call Function1705f0
+ jr Function1705b2
+
+
+Function170571:
+ call SetPalettes
+ call Function1705b2
+
+
+Function170577:
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and $1
+ jr nz, .asm_1705ac
+ ld a, [hl]
+ and $2
+ jr nz, .asm_1705ac
+ ld a, [hl]
+ and $40
+ jr nz, .asm_17058f
+ ld a, [hl]
+ and $80
+ jr nz, .asm_17059d
+ ret
+
+.asm_17058f
+ ld a, [wcf64]
+ and a
+ ret z
+ sub $f
+ ld [wcf64], a
+ call Function1705f0
+ ret
+
+.asm_17059d
+ ld a, [wcf64]
+ cp $3c
+ ret z
+ add $f
+ ld [wcf64], a
+ call Function1705f0
+ ret
+
+.asm_1705ac
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Function1705b2:
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; 1705b7
+
+Function1705b7: ; 1705b7
+ hlcoord 0, 4
+ ld a, $79
+ ld [hli], a
+ ld c, $12
+.asm_1705bf
+ ld a, $7a
+ ld [hli], a
+ dec c
+ jr nz, .asm_1705bf
+ ld a, $7b
+ ld [hli], a
+ ld de, $0014
+ ld c, $c
+.asm_1705cd
+ ld a, $7c
+ ld [hl], a
+ add hl, de
+ dec c
+ jr nz, .asm_1705cd
+ ld a, $7d
+ ld [hli], a
+ ld c, $12
+.asm_1705d9
+ ld a, $7a
+ ld [hli], a
+ dec c
+ jr nz, .asm_1705d9
+ ld a, $7e
+ ld [hl], a
+ ld de, $ffec
+ add hl, de
+ ld c, $c
+.asm_1705e8
+ ld a, $7c
+ ld [hl], a
+ add hl, de
+ dec c
+ jr nz, .asm_1705e8
+ ret
+; 1705f0
+
+Function1705f0: ; 1705f0
+ call Function17064b
+ call Function17065d
+ ld a, $50
+ ld [wcd4e], a
+ ld hl, $c608
+ ld a, [wcf64]
+ ld c, a
+ xor a
+ ld b, a
+ add hl, bc
+ push hl
+ pop bc
+ hlcoord 1, 6
+ ld a, $6
+.asm_17060c
+ push af
+ push hl
+ ld a, $3
+.asm_170610
+ push af
+ ld de, wcd49
+ ld a, [bc]
+ and a
+ jr z, .asm_170625
+ ld a, $5
+.asm_17061a
+ push af
+ ld a, [bc]
+ ld [de], a
+ inc bc
+ inc de
+ pop af
+ dec a
+ jr nz, .asm_17061a
+ jr .asm_170631
+
+.asm_170625
+ ld a, $5
+.asm_170627
+ push af
+ ld a, $e3
+ ld [de], a
+ inc de
+ inc bc
+ pop af
+ dec a
+ jr nz, .asm_170627
+
+.asm_170631
+ ld de, wcd49
+ push bc
+ call PlaceString
+ ld de, $0006
+ add hl, de
+ pop bc
+ pop af
+ dec a
+ jr nz, .asm_170610
+ pop hl
+ ld de, $0028
+ add hl, de
+ pop af
+ dec a
+ jr nz, .asm_17060c
+ ret
+; 17064b
+
+Function17064b: ; 17064b
+ hlcoord 1, 5
+ xor a
+ ld b, $c
+.asm_170651
+ ld c, $12
+.asm_170653
+ ld [hli], a
+ dec c
+ jr nz, .asm_170653
+rept 2
+ inc hl
+endr
+ dec b
+ jr nz, .asm_170651
+ ret
+; 17065d
+
+Function17065d: ; 17065d
+ ld a, [wcf64]
+ and a
+ jr z, .asm_170669
+ hlcoord 18, 5
+ ld a, $61
+ ld [hl], a
+
+.asm_170669
+ ld a, [wcf64]
+ cp $3c
+ ret z
+ hlcoord 18, 16
+ ld a, $ee
+ ld [hl], a
+ ret
+; 170676
+
+String_170676: ; 170676
+ db "ルーム@"
+; 17067a
+
+String_17067a: ; 17067a
+ db "れきだいりーダーいちらん@"
+; 170687
+
+BattleTowerAction: ; 170687
+ ld a, [ScriptVar]
+ ld e, a
+ ld d, 0
+ ld hl, .jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 170696
+
+
+.jumptable: ; 170696 (5c:4696)
+ dw Function17075f ; 0x00
+ dw Function170788 ; 0x01
+ dw Function170778 ; 0x02
+ dw Function170799 ; 0x03
+ dw Function17079d ; 0x04
+ dw Function1707ac ; 0x05
+ dw Function1707f4 ; 0x06
+ dw Function170868 ; 0x07
+ dw Function170881 ; 0x08
+ dw Function17089a ; 0x09
+ dw Function1708b1 ; 0x0a
+ dw Function1708b9 ; 0x0b
+ dw Function1708c8 ; 0x0c
+ dw Function1708f0 ; 0x0d
+ dw Function17093c ; 0x0e
+ dw Function1709aa ; 0x0f
+ dw Function1709bb ; 0x10
+ dw Function170a9c ; 0x11
+ dw Function170aa0 ; 0x12
+ dw Function170aaf ; 0x13
+ dw Function170abe ; 0x14
+ dw Function170ad7 ; 0x15
+ dw Function170807 ; 0x16
+ dw Function17081d ; 0x17
+ dw Function170ae8 ; 0x18
+ dw Function170b16 ; 0x19
+ dw ResetBattleTowerTrainersSRAM ; 0x1a
+ dw Function1706ee ; 0x1b
+ dw Function17071b ; 0x1c
+ dw Function170729 ; 0x1d
+ dw Function17073e ; 0x1e
+ dw Function170737 ; 0x1f
+
+
+; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
+ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a
+ ld a, BANK(sBTTrainers)
+ call GetSRAMBank
+
+ ld a, $ff
+ ld hl, sBTTrainers
+ ld bc, BATTLETOWER_NROFTRAINERS
+ call ByteFill
+
+ xor a
+ ld [sNrOfBeatenBattleTowerTrainers], a
+
+ call CloseSRAM
+
+ ret
+
+Function1706ee: ; 1706ee (5c:46ee)
+ ld a, BANK(sbe50)
+ call GetSRAMBank
+
+ ld a, [sbe50]
+ call CloseSRAM
+ ld [ScriptVar], a
+ ld hl, NumItems
+ ld a, [hli]
+ cp $14
+ ret c
+ ld b, $14
+ ld a, [ScriptVar]
+ ld c, a
+.asm_170709
+ ld a, [hli]
+ cp c
+ jr nz, .asm_170711
+ ld a, [hl]
+ cp $5f
+ ret c
+.asm_170711
+ inc hl
+ dec b
+ jr nz, .asm_170709
+ ld a, $12
+ ld [ScriptVar], a
+ ret
+
+Function17071b: ; 17071b (5c:471b)
+ ld a, BANK(s1_be45)
+ call GetSRAMBank
+ ld a, $3
+ ld [s1_be45], a
+ call CloseSRAM
+ ret
+
+Function170729: ; 170729 (5c:4729)
+ ld a, BANK(s1_be45)
+ call GetSRAMBank
+ ld a, $4
+ ld [s1_be45], a
+ call CloseSRAM
+ ret
+
+Function170737: ; 170737 (5c:4737)
+ callba SaveOptions
+ ret
+
+Function17073e: ; 17073e (5c:473e)
+ call Random
+ ld a, [hRandomAdd] ; $ff00+$e1
+ and $7
+ cp $6
+ jr c, .asm_17074b
+ sub $6
+.asm_17074b
+ add $1a
+ cp $1e
+ jr z, Function17073e
+ push af
+ ld a, BANK(sbe50)
+ call GetSRAMBank
+ pop af
+ ld [sbe50], a
+ call CloseSRAM
+ ret
+
+Function17075f: ; 17075f (5c:475f)
+ call Function17089a
+ ld a, [ScriptVar]
+ and a
+ ret z
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ and $2
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170778: ; 170778 (5c:4778)
+ ld hl, s1_be45
+ ld a, BANK(s1_be45)
+ call GetSRAMBank
+ ld a, [hl]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170788: ; 170788 (5c:4788)
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ or $2
+ ld [sbe4f], a
+ call CloseSRAM
+ ret
+
+Function170799: ; 170799 (5c:4799)
+ ld c, $1
+ jr asm_17079f
+
+Function17079d: ; 17079d (5c:479d)
+ ld c, $0
+asm_17079f: ; 17079f (5c:479f)
+ ld a, BANK(s1_be45)
+ call GetSRAMBank
+ ld a, c
+ ld [s1_be45], a
+ call CloseSRAM
+ ret
+
+Function1707ac: ; 1707ac (5c:47ac)
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa8c]
+ ld b, a
+ ld a, [$be46]
+ ld [ScriptVar], a
+ call CloseSRAM
+ and a
+ ret z
+ ld a, b
+ cp $2
+ jr nc, .asm_1707ef
+ push bc
+ call UpdateTime
+ pop bc
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa8b]
+ call CloseSRAM
+ ld c, a
+ ld a, [CurDay]
+ sub c
+ jr c, .asm_1707e5
+ cp $8
+ jr nc, .asm_1707ef
+ ld a, b
+ and a
+ jr nz, .asm_1707ef
+ ret
+.asm_1707e5
+ ld hl, CurDay
+ ld a, $8c
+ sub c
+ add [hl]
+ cp $8
+ ret c
+.asm_1707ef
+ ld a, $8
+ ld [ScriptVar], a
+
+Function1707f4: ; 1707f4 (5c:47f4)
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$be46], a
+ ld [$aa8b], a
+ ld [$aa8c], a
+ call CloseSRAM
+ ret
+
+Function170807: ; 170807 (5c:4807)
+ call UpdateTime
+ ld a, $5
+ call GetSRAMBank
+ ld a, [CurDay]
+ ld [$b2f9], a
+ xor a
+ ld [$b2fa], a
+ call CloseSRAM
+ ret
+
+Function17081d: ; 17081d (5c:481d)
+ xor a
+ ld [ScriptVar], a
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2f9]
+ ld c, a
+ ld a, [$b2fa]
+ ld b, a
+ call CloseSRAM
+ cp $2
+ jr nc, .asm_170853
+ push bc
+ call UpdateTime
+ pop bc
+ ld a, [CurDay]
+ sub c
+ jr c, .asm_170849
+ cp $b
+ jr nc, .asm_170853
+ ld a, b
+ and a
+ jr nz, .asm_170853
+ ret
+.asm_170849
+ ld hl, CurDay
+ ld a, $8c
+ sub c
+ add [hl]
+ cp $b
+ ret c
+.asm_170853
+ ld a, $1
+ ld [ScriptVar], a
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$b2f9], a
+ ld [$b2fa], a
+ call CloseSRAM
+ ret
+
+Function170868: ; 170868 (5c:4868)
+ ld a, BANK(sbe47)
+ call GetSRAMBank
+ ld a, [rSVBK] ; $ff00+$70
+ push af
+ ld a, $3
+ ld [rSVBK], a ; $ff00+$70
+ ld a, [wd000 + $800]
+ ld [sbe47], a
+ pop af
+ ld [rSVBK], a ; $ff00+$70
+ call CloseSRAM
+ ret
+
+Function170881: ; 170881 (5c:4881)
+ ld a, BANK(sbe47)
+ call GetSRAMBank
+ ld a, [rSVBK] ; $ff00+$70
+ push af
+ ld a, $3
+ ld [rSVBK], a ; $ff00+$70
+ ld a, [sbe47]
+ ld [wd000 + $800], a
+ pop af
+ ld [rSVBK], a ; $ff00+$70
+ call CloseSRAM
+ ret
+
+Function17089a: ; 17089a
+ ld a, [wcfcd]
+ and a
+ jr z, .asm_1708ad
+ callba Function14bcb
+ jr z, .asm_1708ab
+ xor a
+ jr .asm_1708ad
+
+.asm_1708ab
+ ld a, $1
+
+.asm_1708ad
+ ld [ScriptVar], a
+ ret
+; 1708b1
+
+
+Function1708b1: ; 1708b1 (5c:48b1)
+ xor a
+ ld [MusicFade], a
+ call MaxVolume
+ ret
+
+Function1708b9: ; 1708b9 (5c:48b9)
+ ld a, BANK(s1_be3c)
+ call GetSRAMBank
+ ld a, [s1_be3c]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function1708c8: ; 1708c8 (5c:48c8)
+ call UpdateTime
+ ld a, $5
+ call GetSRAMBank
+ ld a, [CurDay]
+ ld [$aa8b], a
+ xor a
+ ld [$aa8c], a
+ ld a, [$aa5d]
+ cp $2
+ jr nc, .asm_1708ec
+ ld a, [CurDay]
+ ld [$aa48], a
+ ld a, $1
+ ld [$aa47], a
+.asm_1708ec
+ call CloseSRAM
+ ret
+
+Function1708f0: ; 1708f0 (5c:48f0)
+ xor a
+ ld [ScriptVar], a
+ call UpdateTime
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa48]
+ ld c, a
+ ld a, [$aa47]
+ call CloseSRAM
+ and a
+ ret z
+ ld hl, CurDay
+ ld a, c
+ cp [hl]
+ jr nz, Function170923
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa5d]
+ call CloseSRAM
+ cp $5
+ ret c
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+
+Function170923: ; 170923
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$aa48], a
+ ld [$aa47], a
+ ld hl, $aa5d
+ ld bc, $0011
+ call ByteFill
+ call CloseSRAM
+ ret
+; 17093c
+
+
+Function17093c: ; 17093c (5c:493c)
+ xor a
+ ld [ScriptVar], a
+ ld a, EGG_TICKET
+ ld [CurItem], a
+ ld hl, NumItems
+ call CheckItem
+ ret nc
+ ld a, [PartyCount]
+ ld b, 0
+ ld c, a
+ ld hl, PartySpecies
+.asm_170955
+ ld a, [hli]
+ cp EGG
+ jr nz, .asm_17099f
+ push hl
+ ld hl, PartyMonOT ; wddff (aliases: PartyMonOT)
+ ld de, $6
+ ld a, b
+ and a
+ jr z, .asm_170969
+.asm_170965
+ add hl, de
+ dec a
+ jr nz, .asm_170965
+.asm_170969
+ ld de, String_1709a4
+ ld a, $6
+.asm_17096e
+ push af
+ ld a, [de]
+ inc de
+ cp [hl]
+ inc hl
+ jr nz, .asm_17099d
+ pop af
+ dec a
+ jr nz, .asm_17096e
+rept 4
+ dec hl
+endr
+ ld a, $50
+rept 2
+ ld [hli], a
+endr
+ pop hl
+ ld a, EGG_TICKET
+ ld [CurItem], a
+ ld a, $1
+ ld [wItemQuantityChangeBuffer], a
+ ld a, $ff
+ ld [wd107], a
+ ld hl, NumItems
+ call TossItem
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.asm_17099d
+ pop af
+ pop hl
+.asm_17099f
+ inc b
+ dec c
+ jr nz, .asm_170955
+ ret
+; 1709a4 (5c:49a4)
+
+String_1709a4: ; 1709a4
+ db "なぞナゾ@@"
+
+Function1709aa: ; 1709aa (5c:49aa)
+ ld a, [rSVBK] ; $ff00+$70
+ push af
+ ld a, $3
+ ld [rSVBK], a ; $ff00+$70
+ ld a, [StringBuffer2 + 10]
+ ld [ScriptVar], a
+ pop af
+ ld [rSVBK], a ; $ff00+$70
+ ret
+
+Function1709bb: ; 1709bb (5c:49bb)
+ xor a
+ ld [ScriptVar], a
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$a800]
+ call CloseSRAM
+ cp 6
+ jr nc, .asm_1709da
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_1709e7
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+.asm_1709da
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$a800], a
+ call CloseSRAM
+ ret
+; 1709e7 (5c:49e7)
+
+Jumptable_1709e7: ; 1709e7
+ dw Function170a00
+ dw Function170a00
+ dw Function1709f3
+ dw Function1709f3
+ dw Function170a01
+ dw Function170a33
+; 1709f3
+
+Function1709f3: ; 1709f3
+ ld a, $5
+ call GetSRAMBank
+ ld a, $1
+ ld [$a800], a
+ call CloseSRAM
+
+Function170a00: ; 170a00
+ ret
+; 170a01
+
+Function170a01: ; 170a01
+ ld a, $5
+ call GetSRAMBank
+ ld hl, $b023
+ ld de, $c608
+ ld bc, $0069
+ call CopyBytes
+ ld a, [$a825]
+ ld [wcd30], a
+ ld a, [$a826]
+ ld [wcd31], a
+ call CloseSRAM
+ callba Function11b6b4
+ callba Function17d0f3
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+; 170a33
+
+Function170a33: ; 170a33
+ ld a, $0
+ call GetSRAMBank
+ ld hl, wRTC
+ ld de, $c608
+ ld bc, $0004
+ call CopyBytes
+ call CloseSRAM
+ ld a, $5
+ call GetSRAMBank
+ ld hl, $b08c
+ ld de, $c608
+ ld c, $4
+.asm_170a54
+ ld a, [de]
+ inc de
+ cp [hl]
+ jr nz, .asm_170a78
+ inc hl
+ dec c
+ jr nz, .asm_170a54
+ call CloseSRAM
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ call GetMapTrigger
+ ld a, d
+ or e
+ jr z, .asm_170a72
+ ld a, [de]
+ and a
+ ret nz
+
+.asm_170a72
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.asm_170a78
+ call CloseSRAM
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$a800], a
+ call CloseSRAM
+ ld [ScriptVar], a
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ call GetMapTrigger
+ ld a, d
+ or e
+ jr z, .asm_170a9b
+ xor a
+ ld [de], a
+
+.asm_170a9b
+ ret
+; 170a9c
+
+Function170a9c: ; 170a9c (5c:4a9c)
+ ld c, $0
+ jr asm_170aa2
+
+Function170aa0: ; 170aa0 (5c:4aa0)
+ ld c, $1
+asm_170aa2: ; 170aa2 (5c:4aa2)
+ ld a, $5
+ call GetSRAMBank
+ ld a, c
+ ld [$aa8d], a
+ call CloseSRAM
+ ret
+
+Function170aaf: ; 170aaf (5c:4aaf)
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa8d]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170abe: ; 170abe (5c:4abe)
+ call Function17089a
+ ld a, [ScriptVar]
+ and a
+ ret z
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ and $1
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170ad7: ; 170ad7 (5c:4ad7)
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ or $1
+ ld [sbe4f], a
+ call CloseSRAM
+ ret
+
+Function170ae8: ; 170ae8 (5c:4ae8)
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2fb]
+ call CloseSRAM
+ ld c, $a
+ call SimpleDivide
+ ld a, b
+ ld [wcd4f], a
+ xor a
+ ld [ScriptVar], a
+ callba Function119d93
+ ret nc
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2fb]
+ call CloseSRAM
+ ld [ScriptVar], a
+ ret
+
+Function170b16: ; 170b16 (5c:4b16)
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2fb]
+ call CloseSRAM
+ ld c, 10
+ call SimpleDivide
+ ld a, b
+ ld [wcd4f], a
+ xor a
+ ld [ScriptVar], a
+ callba Function119dd1
+ ret nc
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$b2fb]
+ call CloseSRAM
+ ld [ScriptVar], a
+ ret
+
+Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44
+ callba Function_LoadOpponentTrainerAndPokemons
+ ld a, [rSVBK]
+ push af
+ ld a, $3
+ ld [rSVBK], a
+ ld hl, wd10a
+ ld a, [hl]
+ dec a
+ ld c, a
+ ld b, $0
+ pop af
+ ld [rSVBK], a
+ ld hl, Unknown_170b90
+ add hl, bc
+ ld a, [hl]
+ ld [wcd49], a
+
+; Load sprite of the opponent trainer
+; because s/he is chosen randomly and appears out of nowhere
+ ld a, [ScriptVar]
+ dec a
+ sla a
+ ld e, a
+ sla a
+ sla a
+ sla a
+ ld c, a
+ ld b, $0
+ ld d, $0
+ ld hl, MapObjects
+ add hl, bc
+ inc hl
+ ld a, [wcd49]
+ ld [hl], a
+ ld hl, UsedSprites
+ add hl, de
+ ld [hli], a
+ ld [hUsedSpriteIndex], a
+ ld a, [hl]
+ ld [hUsedSpriteTile], a
+ callba Function143c8
+ ret
+; 170b90
+
+Unknown_170b90:
+ db $12, $13, $14, $15, $18, $17
+ db $16, $19, $04, $05, $11, $01
+ db $1c, $1b, $21, $1e, $1a, $1d
+ db $1f, $3c, $20, $27, $27, $27
+ db $28, $0a, $23, $24, $2a, $2b
+ db $35, $40, $2a, $29, $22, $25
+ db $3a, $2b, $24, $49, $2b, $07
+ db $2c, $2d, $4a, $0d, $4b, $3a
+ db $2b, $41, $35, $27, $28, $27
+ db $36, $3e, $30, $2c, $2d, $3d
+ db $26, $2e, $06, $07, $43, $36
+
+Function170bd2: ; 170bd2
+ ret
+; 170bd3
+
+SpecialCheckForBattleTowerRules: ; 170bd3
+ callba CheckForBattleTowerRules
+ jr c, .asm_170bde
+ xor a
+ jr .asm_170be0
+
+.asm_170bde
+ ld a, $1
+
+.asm_170be0
+ ld [ScriptVar], a
+ ret
+; 170be4
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -22782,1495 +22782,7 @@
ret
; 170215
-Function170215: ; 170215
- xor a
- ld [wJumptableIndex], a
- call Function17022c
- ret
-; 17021d
-
-Function17021d: ; 17021d
- ret
-; 17021e
-
-Function17021e: ; 17021e
- xor a
- ld [wJumptableIndex], a
- ld [wcf64], a
- ld [wcf65], a
- ld [wcf66], a
- ret
-; 17022c
-
-Function17022c: ; 17022c
-.asm_17022c
- call Jumpto_BattleTowerBattleFunction
- call DelayFrame
- ld a, [wJumptableIndex]
- cp $1
- jr nz, .asm_17022c
- ret
-; 17023a
-
-Jumpto_BattleTowerBattleFunction: ; 17023a
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_BattleTowerBattleFunctions
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 170249
-
-Jumptable_BattleTowerBattleFunctions: ; 170249
- dw RunBattleTowerBattle
- dw SkipBattleTowerBattle
-; 17024d
-
-RunBattleTowerBattle: ; 17024d
- ld a, [Options]
- push af
- ld hl, Options
- set 6, [hl]
- ld a, [InBattleTowerBattle]
- push af
- or $1
- ld [InBattleTowerBattle], a
- xor a
- ld [wLinkMode], a
- callba Mobile_HealParty
- callba HealParty
- call Function1702b7
- call Function170bf7
- predef StartBattle
- callba LoadPokemonData
- callba HealParty
- ld a, [wBattleResult]
- ld [ScriptVar], a
- and a
- jr nz, .asm_1702a9
- ld a, BANK(sNrOfBeatenBattleTowerTrainers)
- call GetSRAMBank
- ld a, [sNrOfBeatenBattleTowerTrainers]
- ld [wNrOfBeatenBattleTowerTrainers], a ; wcf64
- call CloseSRAM
- ld hl, StringBuffer3
- ld a, [wNrOfBeatenBattleTowerTrainers] ; wcf64
- add $f7
- ld [hli], a
- ld a, $50
- ld [hl], a
-
-.asm_1702a9
- pop af
- ld [InBattleTowerBattle], a
- pop af
- ld [Options], a
- ld a, $1
- ld [wJumptableIndex], a
- ret
-
-
-Function1702b7: ; 1702b7
-; Initialise the BattleTower-Trainer and his Pkmn
- call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
- ld c, PKMN_NAME_LENGTH
- callba Function17d073
- jr nc, .asm_1702db
-
- ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1]
- ld [wd265], a
- call GetPokemonName
- ld l, e
- ld h, d
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
- ld bc, PKMN_NAME_LENGTH
- call CopyBytes
-
-.asm_1702db
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
- ld c, PKMN_NAME_LENGTH
- callba Function17d073
- jr nc, .asm_1702fc
- ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e]
- ld [wd265], a
- call GetPokemonName
- ld l, e
- ld h, d
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
- ld bc, PKMN_NAME_LENGTH
- call CopyBytes
-
-.asm_1702fc
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
- ld c, PKMN_NAME_LENGTH
- callba Function17d073
- jr nc, .asm_17031d
- ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689]
- ld [wd265], a
- call GetPokemonName
- ld l, e
- ld h, d
- ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
- ld bc, PKMN_NAME_LENGTH
- call CopyBytes
-
-.asm_17031d
- ld a, $50
- ld [wBT_OTTempCopy + wBT_OTTempCopy_45], a ; $c64d
- ld [wBT_OTTempCopy + wBT_OTTempCopy_80], a ; $c688
- ld [wBT_OTTempCopy + wBT_OTTempCopy_BB], a ; $c68a + 57 = $c6c3
- call Function170c98
- ld de, wBT_OTTempCopy
- ld c, $a
- callba Function17d073
- jr nc, .asm_17033d
- ld hl, String_170426
- jr .asm_170340
-
-.asm_17033d
- ld hl, wBT_OTTempCopy ; 0xc608
-
-.asm_170340
- ld de, wd26b
- ld bc, $000a
- call CopyBytes
- ld a, $50
- ld [de], a
- ld hl, wBT_OTTempCopy + wBT_OTTempCopy_TrainerClass
- ld a, [hli]
- ld [OtherTrainerClass], a
- ld a, $ea
- ld [BGMapBuffer], a
- ld a, $d3
- ld [wcd21], a
-
- ; Copy Pkmn into Memory from the address in hl
- ld de, OTPartyMon1Species
- ld bc, OTPartyCount
- ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has
- ld [bc], a
- inc bc
-.asm_170367
- push af
- ld a, [hl]
- ld [bc], a
- inc bc
- push bc
- ld bc, BATTLETOWER_PKMNSTRUCTLENGTH
- call CopyBytes
- push de
- ld a, [BGMapBuffer]
- ld e, a
- ld a, [wcd21]
- ld d, a
- ld bc, $000b
- call CopyBytes
- ld a, e
- ld [BGMapBuffer], a
- ld a, d
- ld [wcd21], a
- pop de
- pop bc
- pop af
- dec a
- and a
- jr nz, .asm_170367
- ld a, $ff
- ld [bc], a
- ret
-; 170394
-
-Function170394: ; 170394
- ld hl, $c608 + 11
- ld d, $3
-.asm_170399
- push de
- push hl
- ld b, h
- ld c, l
- ld a, [hl]
- and a
- jr z, .asm_1703b1
- cp $ff
- jr z, .asm_1703b1
- cp $fe
- jr z, .asm_1703b1
- cp $fd
- jr z, .asm_1703b1
- cp $fc
- jr nz, .asm_1703b4
-
-.asm_1703b1
- ld a, $eb
- ld [hl], a
-
-.asm_1703b4
- ld [CurSpecies], a
- call GetBaseData
- ld a, $5
- call GetSRAMBank
- ld a, [$b2fb]
- call CloseSRAM
- ld e, a
- ld hl, $001f
- add hl, bc
- ld a, [hl]
- cp $2
- ld a, $2
- jr c, .asm_1703d6
- ld a, [hl]
- cp e
- jr c, .asm_1703d7
- ld a, e
-
-.asm_1703d6
- ld [hl], a
-
-.asm_1703d7
- ld [CurPartyLevel], a
- ld hl, $0002
- add hl, bc
- ld d, $3
- ld a, [hli]
- and a
- jr z, .asm_1703ea
- cp $fc
- jr nc, .asm_1703ea
- jr .asm_1703f4
-
-.asm_1703ea
- dec hl
- ld a, $1
- ld [hli], a
- xor a
-rept 2
- ld [hli], a
-endr
- ld [hl], a
- jr .asm_1703ff
-
-.asm_1703f4
- ld a, [hl]
- cp $fc
- jr c, .asm_1703fb
- ld [hl], $0
-
-.asm_1703fb
- inc hl
- dec d
- jr nz, .asm_1703f4
-
-.asm_1703ff
- ld hl, $0024
- add hl, bc
- ld d, h
- ld e, l
- push hl
- push de
- ld hl, $000a
- add hl, bc
- ld b, $1
- predef CalcPkmnStats
- pop de
- pop hl
-rept 2
- dec de
-endr
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hl]
- ld [de], a
- pop hl
- ld bc, $003b
- add hl, bc
- pop de
- dec d
- jp nz, .asm_170399
- ret
-; 170426
-
-String_170426: ; 170426
- db "CHRIS@"
-; 17042c
-
-Function17042c: ; 17042c
- ld hl, OTPartyMon2ID
- ld a, $7
-.asm_170431
- push af
- push hl
- ld c, $12
-.asm_170435
- ld a, [hli]
- ld b, a
- ld a, [hli]
- and a
- jr z, .asm_170451
- cp $f
- jr nc, .asm_17045b
- push hl
- ld hl, Unknown_170470
- dec a
- ld e, a
- ld d, 0
- add hl, de
- ld a, [hl]
- pop hl
- cp b
- jr c, .asm_17045b
- jr z, .asm_17045b
- jr .asm_170456
-
-.asm_170451
- ld a, b
- cp $fc
- jr nc, .asm_17045b
-
-.asm_170456
- dec c
- jr nz, .asm_170435
- jr .asm_170466
-
-.asm_17045b
- pop de
- push de
- ld hl, Unknown_17047e
- ld bc, $0024
- call CopyBytes
-
-.asm_170466
- pop hl
- ld de, $00e0
- add hl, de
- pop af
- dec a
- jr nz, .asm_170431
- ret
-; 170470
-
-Unknown_170470:
- db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24
-
-Unknown_17047e:
- db $03, $04, $05, $08
- db $03, $05, $0e, $06
- db $03, $02, $00, $00
- db $39, $07, $07, $04
- db $00, $05, $04, $07
- db $01, $05, $00, $00
- db $0f, $05, $14, $07
- db $05, $05, $11, $0c
- db $0c, $06, $06, $04
-
-
-CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2
-; copy the BattleTower-Trainer data that lies at 'BT_OTrainer' to 'wBT_OTTempCopy'
- ld a, [rSVBK]
- push af
- ld a, $3
- ld [rSVBK], a
- ld hl, BT_OTrainer ; $d100
- ld de, wBT_OTTempCopy ; $c608
- ld bc, BT_OTrainerEnd - BT_OTrainer ; $e0 = $a + $1 + 3*$3b + $24
- ; = $a + $1 + BATTLETOWER_NROFPKMNS * (BATTLETOWER_PKMNSTRUCTLENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
- call CopyBytes
- pop af
- ld [rSVBK], a
- ld a, BANK(s1_be45)
- call GetSRAMBank
- ld a, $2
- ld [s1_be45], a
- ld hl, sNrOfBeatenBattleTowerTrainers
- inc [hl]
- call CloseSRAM
-SkipBattleTowerBattle: ; 1704c9
- ret
-; 1704ca
-
-Function1704ca: ; 1704ca
- ld a, [$be46]
- cp $7
- jr c, .asm_1704d3
- ld a, $6
-
-.asm_1704d3
- ld hl, $afce
- ld de, -$e0
-.asm_1704d9
- and a
- jr z, .asm_1704e0
- add hl, de
- dec a
- jr .asm_1704d9
-
-.asm_1704e0
- ret
-; 1704e1
-
-Function1704e1: ; 1704e1
- call SpeechTextBox
- call FadeToMenu
- call Function17021e
- call Function1704f1
- call Function2b3c
- ret
-; 1704f1
-
-Function1704f1: ; 1704f1
- call WhiteBGMap
- call ClearSprites
- call ClearScreen
-.asm_1704fa
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_17050f
- call Function170510
- callba Function104061
- jr .asm_1704fa
-
-.asm_17050f
- ret
-; 170510
-
-Function170510: ; 170510
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_17051f
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 17051f
-
-Jumptable_17051f: ; 17051f
- dw Function170525
- dw Function170571
- dw Function170577
-; 170525
-
-Function170525: ; 170525
- ld a, $5
- call GetSRAMBank
-
- ld hl, $a89c
- ld de, StringBuffer3
- ld bc, $0016
- call CopyBytes
-
- ld hl, $a8b2
- ld de, $c608
- ld bc, $0096
- call CopyBytes
-
- call CloseSRAM
- hlcoord 1, 1
- ld de, StringBuffer3
- call PlaceString
- hlcoord 1, 3
- ld de, String_170676
- call PlaceString
- hlcoord 4, 3
- ld de, StringBuffer4
- call PlaceString
- hlcoord 8, 3
- ld de, String_17067a
- call PlaceString
- call Function1705b7
- call Function1705f0
- jr Function1705b2
-
-
-Function170571:
- call SetPalettes
- call Function1705b2
-
-
-Function170577:
- ld hl, hJoyPressed
- ld a, [hl]
- and $1
- jr nz, .asm_1705ac
- ld a, [hl]
- and $2
- jr nz, .asm_1705ac
- ld a, [hl]
- and $40
- jr nz, .asm_17058f
- ld a, [hl]
- and $80
- jr nz, .asm_17059d
- ret
-
-.asm_17058f
- ld a, [wcf64]
- and a
- ret z
- sub $f
- ld [wcf64], a
- call Function1705f0
- ret
-
-.asm_17059d
- ld a, [wcf64]
- cp $3c
- ret z
- add $f
- ld [wcf64], a
- call Function1705f0
- ret
-
-.asm_1705ac
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Function1705b2:
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; 1705b7
-
-Function1705b7: ; 1705b7
- hlcoord 0, 4
- ld a, $79
- ld [hli], a
- ld c, $12
-.asm_1705bf
- ld a, $7a
- ld [hli], a
- dec c
- jr nz, .asm_1705bf
- ld a, $7b
- ld [hli], a
- ld de, $0014
- ld c, $c
-.asm_1705cd
- ld a, $7c
- ld [hl], a
- add hl, de
- dec c
- jr nz, .asm_1705cd
- ld a, $7d
- ld [hli], a
- ld c, $12
-.asm_1705d9
- ld a, $7a
- ld [hli], a
- dec c
- jr nz, .asm_1705d9
- ld a, $7e
- ld [hl], a
- ld de, $ffec
- add hl, de
- ld c, $c
-.asm_1705e8
- ld a, $7c
- ld [hl], a
- add hl, de
- dec c
- jr nz, .asm_1705e8
- ret
-; 1705f0
-
-Function1705f0: ; 1705f0
- call Function17064b
- call Function17065d
- ld a, $50
- ld [wcd4e], a
- ld hl, $c608
- ld a, [wcf64]
- ld c, a
- xor a
- ld b, a
- add hl, bc
- push hl
- pop bc
- hlcoord 1, 6
- ld a, $6
-.asm_17060c
- push af
- push hl
- ld a, $3
-.asm_170610
- push af
- ld de, wcd49
- ld a, [bc]
- and a
- jr z, .asm_170625
- ld a, $5
-.asm_17061a
- push af
- ld a, [bc]
- ld [de], a
- inc bc
- inc de
- pop af
- dec a
- jr nz, .asm_17061a
- jr .asm_170631
-
-.asm_170625
- ld a, $5
-.asm_170627
- push af
- ld a, $e3
- ld [de], a
- inc de
- inc bc
- pop af
- dec a
- jr nz, .asm_170627
-
-.asm_170631
- ld de, wcd49
- push bc
- call PlaceString
- ld de, $0006
- add hl, de
- pop bc
- pop af
- dec a
- jr nz, .asm_170610
- pop hl
- ld de, $0028
- add hl, de
- pop af
- dec a
- jr nz, .asm_17060c
- ret
-; 17064b
-
-Function17064b: ; 17064b
- hlcoord 1, 5
- xor a
- ld b, $c
-.asm_170651
- ld c, $12
-.asm_170653
- ld [hli], a
- dec c
- jr nz, .asm_170653
-rept 2
- inc hl
-endr
- dec b
- jr nz, .asm_170651
- ret
-; 17065d
-
-Function17065d: ; 17065d
- ld a, [wcf64]
- and a
- jr z, .asm_170669
- hlcoord 18, 5
- ld a, $61
- ld [hl], a
-
-.asm_170669
- ld a, [wcf64]
- cp $3c
- ret z
- hlcoord 18, 16
- ld a, $ee
- ld [hl], a
- ret
-; 170676
-
-String_170676: ; 170676
- db "ルーム@"
-; 17067a
-
-String_17067a: ; 17067a
- db "れきだいりーダーいちらん@"
-; 170687
-
-Function170687: ; 170687
- ld a, [ScriptVar]
- ld e, a
- ld d, 0
- ld hl, Jumptable_170696
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 170696
-
-
-Jumptable_170696: ; 170696 (5c:4696)
- dw Function17075f ; 0x00
- dw Function170788 ; 0x01
- dw Function170778 ; 0x02
- dw Function170799 ; 0x03
- dw Function17079d ; 0x04
- dw Function1707ac ; 0x05
- dw Function1707f4 ; 0x06
- dw Function170868 ; 0x07
- dw Function170881 ; 0x08
- dw Function17089a ; 0x09
- dw Function1708b1 ; 0x0a
- dw Function1708b9 ; 0x0b
- dw Function1708c8 ; 0x0c
- dw Function1708f0 ; 0x0d
- dw Function17093c ; 0x0e
- dw Function1709aa ; 0x0f
- dw Function1709bb ; 0x10
- dw Function170a9c ; 0x11
- dw Function170aa0 ; 0x12
- dw Function170aaf ; 0x13
- dw Function170abe ; 0x14
- dw Function170ad7 ; 0x15
- dw Function170807 ; 0x16
- dw Function17081d ; 0x17
- dw Function170ae8 ; 0x18
- dw Function170b16 ; 0x19
- dw ResetBattleTowerTrainersSRAM ; 0x1a
- dw Function1706ee ; 0x1b
- dw Function17071b ; 0x1c
- dw Function170729 ; 0x1d
- dw Function17073e ; 0x1e
- dw Function170737 ; 0x1f
-
-
-; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
-ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6)
- ld a, BANK(sBTTrainers)
- call GetSRAMBank
-
- ld a, $ff
- ld hl, sBTTrainers
- ld bc, BATTLETOWER_NROFTRAINERS
- call ByteFill
-
- xor a
- ld [sNrOfBeatenBattleTowerTrainers], a
-
- call CloseSRAM
-
- ret
-
-Function1706ee: ; 1706ee (5c:46ee)
- ld a, BANK(sbe50)
- call GetSRAMBank
-
- ld a, [sbe50]
- call CloseSRAM
- ld [ScriptVar], a
- ld hl, NumItems
- ld a, [hli]
- cp $14
- ret c
- ld b, $14
- ld a, [ScriptVar]
- ld c, a
-.asm_170709
- ld a, [hli]
- cp c
- jr nz, .asm_170711
- ld a, [hl]
- cp $5f
- ret c
-.asm_170711
- inc hl
- dec b
- jr nz, .asm_170709
- ld a, $12
- ld [ScriptVar], a
- ret
-
-Function17071b: ; 17071b (5c:471b)
- ld a, BANK(s1_be45)
- call GetSRAMBank
- ld a, $3
- ld [s1_be45], a
- call CloseSRAM
- ret
-
-Function170729: ; 170729 (5c:4729)
- ld a, BANK(s1_be45)
- call GetSRAMBank
- ld a, $4
- ld [s1_be45], a
- call CloseSRAM
- ret
-
-Function170737: ; 170737 (5c:4737)
- callba SaveOptions
- ret
-
-Function17073e: ; 17073e (5c:473e)
- call Random
- ld a, [hRandomAdd] ; $ff00+$e1
- and $7
- cp $6
- jr c, .asm_17074b
- sub $6
-.asm_17074b
- add $1a
- cp $1e
- jr z, Function17073e
- push af
- ld a, BANK(sbe50)
- call GetSRAMBank
- pop af
- ld [sbe50], a
- call CloseSRAM
- ret
-
-Function17075f: ; 17075f (5c:475f)
- call Function17089a
- ld a, [ScriptVar]
- and a
- ret z
- ld a, BANK(sbe4f)
- call GetSRAMBank
- ld a, [sbe4f]
- and $2
- ld [ScriptVar], a
- call CloseSRAM
- ret
-
-Function170778: ; 170778 (5c:4778)
- ld hl, s1_be45
- ld a, BANK(s1_be45)
- call GetSRAMBank
- ld a, [hl]
- ld [ScriptVar], a
- call CloseSRAM
- ret
-
-Function170788: ; 170788 (5c:4788)
- ld a, BANK(sbe4f)
- call GetSRAMBank
- ld a, [sbe4f]
- or $2
- ld [sbe4f], a
- call CloseSRAM
- ret
-
-Function170799: ; 170799 (5c:4799)
- ld c, $1
- jr asm_17079f
-
-Function17079d: ; 17079d (5c:479d)
- ld c, $0
-asm_17079f: ; 17079f (5c:479f)
- ld a, BANK(s1_be45)
- call GetSRAMBank
- ld a, c
- ld [s1_be45], a
- call CloseSRAM
- ret
-
-Function1707ac: ; 1707ac (5c:47ac)
- ld a, $5
- call GetSRAMBank
- ld a, [$aa8c]
- ld b, a
- ld a, [$be46]
- ld [ScriptVar], a
- call CloseSRAM
- and a
- ret z
- ld a, b
- cp $2
- jr nc, .asm_1707ef
- push bc
- call UpdateTime
- pop bc
- ld a, $5
- call GetSRAMBank
- ld a, [$aa8b]
- call CloseSRAM
- ld c, a
- ld a, [CurDay]
- sub c
- jr c, .asm_1707e5
- cp $8
- jr nc, .asm_1707ef
- ld a, b
- and a
- jr nz, .asm_1707ef
- ret
-.asm_1707e5
- ld hl, CurDay
- ld a, $8c
- sub c
- add [hl]
- cp $8
- ret c
-.asm_1707ef
- ld a, $8
- ld [ScriptVar], a
-
-Function1707f4: ; 1707f4 (5c:47f4)
- ld a, $5
- call GetSRAMBank
- xor a
- ld [$be46], a
- ld [$aa8b], a
- ld [$aa8c], a
- call CloseSRAM
- ret
-
-Function170807: ; 170807 (5c:4807)
- call UpdateTime
- ld a, $5
- call GetSRAMBank
- ld a, [CurDay]
- ld [$b2f9], a
- xor a
- ld [$b2fa], a
- call CloseSRAM
- ret
-
-Function17081d: ; 17081d (5c:481d)
- xor a
- ld [ScriptVar], a
- ld a, $5
- call GetSRAMBank
- ld a, [$b2f9]
- ld c, a
- ld a, [$b2fa]
- ld b, a
- call CloseSRAM
- cp $2
- jr nc, .asm_170853
- push bc
- call UpdateTime
- pop bc
- ld a, [CurDay]
- sub c
- jr c, .asm_170849
- cp $b
- jr nc, .asm_170853
- ld a, b
- and a
- jr nz, .asm_170853
- ret
-.asm_170849
- ld hl, CurDay
- ld a, $8c
- sub c
- add [hl]
- cp $b
- ret c
-.asm_170853
- ld a, $1
- ld [ScriptVar], a
- ld a, $5
- call GetSRAMBank
- xor a
- ld [$b2f9], a
- ld [$b2fa], a
- call CloseSRAM
- ret
-
-Function170868: ; 170868 (5c:4868)
- ld a, BANK(sbe47)
- call GetSRAMBank
- ld a, [rSVBK] ; $ff00+$70
- push af
- ld a, $3
- ld [rSVBK], a ; $ff00+$70
- ld a, [wd000 + $800]
- ld [sbe47], a
- pop af
- ld [rSVBK], a ; $ff00+$70
- call CloseSRAM
- ret
-
-Function170881: ; 170881 (5c:4881)
- ld a, BANK(sbe47)
- call GetSRAMBank
- ld a, [rSVBK] ; $ff00+$70
- push af
- ld a, $3
- ld [rSVBK], a ; $ff00+$70
- ld a, [sbe47]
- ld [wd000 + $800], a
- pop af
- ld [rSVBK], a ; $ff00+$70
- call CloseSRAM
- ret
-
-Function17089a: ; 17089a
- ld a, [wcfcd]
- and a
- jr z, .asm_1708ad
- callba Function14bcb
- jr z, .asm_1708ab
- xor a
- jr .asm_1708ad
-
-.asm_1708ab
- ld a, $1
-
-.asm_1708ad
- ld [ScriptVar], a
- ret
-; 1708b1
-
-
-Function1708b1: ; 1708b1 (5c:48b1)
- xor a
- ld [MusicFade], a
- call MaxVolume
- ret
-
-Function1708b9: ; 1708b9 (5c:48b9)
- ld a, BANK(s1_be3c)
- call GetSRAMBank
- ld a, [s1_be3c]
- ld [ScriptVar], a
- call CloseSRAM
- ret
-
-Function1708c8: ; 1708c8 (5c:48c8)
- call UpdateTime
- ld a, $5
- call GetSRAMBank
- ld a, [CurDay]
- ld [$aa8b], a
- xor a
- ld [$aa8c], a
- ld a, [$aa5d]
- cp $2
- jr nc, .asm_1708ec
- ld a, [CurDay]
- ld [$aa48], a
- ld a, $1
- ld [$aa47], a
-.asm_1708ec
- call CloseSRAM
- ret
-
-Function1708f0: ; 1708f0 (5c:48f0)
- xor a
- ld [ScriptVar], a
- call UpdateTime
- ld a, $5
- call GetSRAMBank
- ld a, [$aa48]
- ld c, a
- ld a, [$aa47]
- call CloseSRAM
- and a
- ret z
- ld hl, CurDay
- ld a, c
- cp [hl]
- jr nz, Function170923
- ld a, $5
- call GetSRAMBank
- ld a, [$aa5d]
- call CloseSRAM
- cp $5
- ret c
- ld a, $1
- ld [ScriptVar], a
- ret
-
-
-Function170923: ; 170923
- ld a, $5
- call GetSRAMBank
- xor a
- ld [$aa48], a
- ld [$aa47], a
- ld hl, $aa5d
- ld bc, $0011
- call ByteFill
- call CloseSRAM
- ret
-; 17093c
-
-
-Function17093c: ; 17093c (5c:493c)
- xor a
- ld [ScriptVar], a
- ld a, EGG_TICKET
- ld [CurItem], a
- ld hl, NumItems
- call CheckItem
- ret nc
- ld a, [PartyCount]
- ld b, 0
- ld c, a
- ld hl, PartySpecies
-.asm_170955
- ld a, [hli]
- cp EGG
- jr nz, .asm_17099f
- push hl
- ld hl, PartyMonOT ; wddff (aliases: PartyMonOT)
- ld de, $6
- ld a, b
- and a
- jr z, .asm_170969
-.asm_170965
- add hl, de
- dec a
- jr nz, .asm_170965
-.asm_170969
- ld de, String_1709a4
- ld a, $6
-.asm_17096e
- push af
- ld a, [de]
- inc de
- cp [hl]
- inc hl
- jr nz, .asm_17099d
- pop af
- dec a
- jr nz, .asm_17096e
-rept 4
- dec hl
-endr
- ld a, $50
-rept 2
- ld [hli], a
-endr
- pop hl
- ld a, EGG_TICKET
- ld [CurItem], a
- ld a, $1
- ld [wItemQuantityChangeBuffer], a
- ld a, $ff
- ld [wd107], a
- ld hl, NumItems
- call TossItem
- ld a, $1
- ld [ScriptVar], a
- ret
-
-.asm_17099d
- pop af
- pop hl
-.asm_17099f
- inc b
- dec c
- jr nz, .asm_170955
- ret
-; 1709a4 (5c:49a4)
-
-String_1709a4: ; 1709a4
- db "なぞナゾ@@"
-
-Function1709aa: ; 1709aa (5c:49aa)
- ld a, [rSVBK] ; $ff00+$70
- push af
- ld a, $3
- ld [rSVBK], a ; $ff00+$70
- ld a, [StringBuffer2 + 10]
- ld [ScriptVar], a
- pop af
- ld [rSVBK], a ; $ff00+$70
- ret
-
-Function1709bb: ; 1709bb (5c:49bb)
- xor a
- ld [ScriptVar], a
- ld a, $5
- call GetSRAMBank
- ld a, [$a800]
- call CloseSRAM
- cp 6
- jr nc, .asm_1709da
- ld e, a
- ld d, 0
- ld hl, Jumptable_1709e7
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-.asm_1709da
- ld a, $5
- call GetSRAMBank
- xor a
- ld [$a800], a
- call CloseSRAM
- ret
-; 1709e7 (5c:49e7)
-
-Jumptable_1709e7: ; 1709e7
- dw Function170a00
- dw Function170a00
- dw Function1709f3
- dw Function1709f3
- dw Function170a01
- dw Function170a33
-; 1709f3
-
-Function1709f3: ; 1709f3
- ld a, $5
- call GetSRAMBank
- ld a, $1
- ld [$a800], a
- call CloseSRAM
-
-Function170a00: ; 170a00
- ret
-; 170a01
-
-Function170a01: ; 170a01
- ld a, $5
- call GetSRAMBank
- ld hl, $b023
- ld de, $c608
- ld bc, $0069
- call CopyBytes
- ld a, [$a825]
- ld [wcd30], a
- ld a, [$a826]
- ld [wcd31], a
- call CloseSRAM
- callba Function11b6b4
- callba Function17d0f3
- ld a, $1
- ld [ScriptVar], a
- ret
-; 170a33
-
-Function170a33: ; 170a33
- ld a, $0
- call GetSRAMBank
- ld hl, wRTC
- ld de, $c608
- ld bc, $0004
- call CopyBytes
- call CloseSRAM
- ld a, $5
- call GetSRAMBank
- ld hl, $b08c
- ld de, $c608
- ld c, $4
-.asm_170a54
- ld a, [de]
- inc de
- cp [hl]
- jr nz, .asm_170a78
- inc hl
- dec c
- jr nz, .asm_170a54
- call CloseSRAM
- ld a, [MapGroup]
- ld b, a
- ld a, [MapNumber]
- ld c, a
- call GetMapTrigger
- ld a, d
- or e
- jr z, .asm_170a72
- ld a, [de]
- and a
- ret nz
-
-.asm_170a72
- ld a, $1
- ld [ScriptVar], a
- ret
-
-.asm_170a78
- call CloseSRAM
- ld a, $5
- call GetSRAMBank
- xor a
- ld [$a800], a
- call CloseSRAM
- ld [ScriptVar], a
- ld a, [MapGroup]
- ld b, a
- ld a, [MapNumber]
- ld c, a
- call GetMapTrigger
- ld a, d
- or e
- jr z, .asm_170a9b
- xor a
- ld [de], a
-
-.asm_170a9b
- ret
-; 170a9c
-
-Function170a9c: ; 170a9c (5c:4a9c)
- ld c, $0
- jr asm_170aa2
-
-Function170aa0: ; 170aa0 (5c:4aa0)
- ld c, $1
-asm_170aa2: ; 170aa2 (5c:4aa2)
- ld a, $5
- call GetSRAMBank
- ld a, c
- ld [$aa8d], a
- call CloseSRAM
- ret
-
-Function170aaf: ; 170aaf (5c:4aaf)
- ld a, $5
- call GetSRAMBank
- ld a, [$aa8d]
- ld [ScriptVar], a
- call CloseSRAM
- ret
-
-Function170abe: ; 170abe (5c:4abe)
- call Function17089a
- ld a, [ScriptVar]
- and a
- ret z
- ld a, BANK(sbe4f)
- call GetSRAMBank
- ld a, [sbe4f]
- and $1
- ld [ScriptVar], a
- call CloseSRAM
- ret
-
-Function170ad7: ; 170ad7 (5c:4ad7)
- ld a, BANK(sbe4f)
- call GetSRAMBank
- ld a, [sbe4f]
- or $1
- ld [sbe4f], a
- call CloseSRAM
- ret
-
-Function170ae8: ; 170ae8 (5c:4ae8)
- ld a, $5
- call GetSRAMBank
- ld a, [$b2fb]
- call CloseSRAM
- ld c, $a
- call SimpleDivide
- ld a, b
- ld [wcd4f], a
- xor a
- ld [ScriptVar], a
- callba Function119d93
- ret nc
- ld a, $5
- call GetSRAMBank
- ld a, [$b2fb]
- call CloseSRAM
- ld [ScriptVar], a
- ret
-
-Function170b16: ; 170b16 (5c:4b16)
- ld a, $5
- call GetSRAMBank
- ld a, [$b2fb]
- call CloseSRAM
- ld c, 10
- call SimpleDivide
- ld a, b
- ld [wcd4f], a
- xor a
- ld [ScriptVar], a
- callba Function119dd1
- ret nc
- ld a, $5
- call GetSRAMBank
- ld a, [$b2fb]
- call CloseSRAM
- ld [ScriptVar], a
- ret
-
-Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44
- callba Function_LoadOpponentTrainerAndPokemons
- ld a, [rSVBK]
- push af
- ld a, $3
- ld [rSVBK], a
- ld hl, wd10a
- ld a, [hl]
- dec a
- ld c, a
- ld b, $0
- pop af
- ld [rSVBK], a
- ld hl, Unknown_170b90
- add hl, bc
- ld a, [hl]
- ld [wcd49], a
-
-; Load sprite of the opponent trainer
-; because s/he is chosen randomly and appears out of nowhere
- ld a, [ScriptVar]
- dec a
- sla a
- ld e, a
- sla a
- sla a
- sla a
- ld c, a
- ld b, $0
- ld d, $0
- ld hl, MapObjects
- add hl, bc
- inc hl
- ld a, [wcd49]
- ld [hl], a
- ld hl, UsedSprites
- add hl, de
- ld [hli], a
- ld [hUsedSpriteIndex], a
- ld a, [hl]
- ld [hUsedSpriteTile], a
- callba Function143c8
- ret
-; 170b90
-
-Unknown_170b90:
- db $12, $13, $14, $15, $18, $17
- db $16, $19, $04, $05, $11, $01
- db $1c, $1b, $21, $1e, $1a, $1d
- db $1f, $3c, $20, $27, $27, $27
- db $28, $0a, $23, $24, $2a, $2b
- db $35, $40, $2a, $29, $22, $25
- db $3a, $2b, $24, $49, $2b, $07
- db $2c, $2d, $4a, $0d, $4b, $3a
- db $2b, $41, $35, $27, $28, $27
- db $36, $3e, $30, $2c, $2d, $3d
- db $26, $2e, $06, $07, $43, $36
-
-Function170bd2: ; 170bd2
- ret
-; 170bd3
-
-SpecialCheckForBattleTowerRules: ; 170bd3
- callba CheckForBattleTowerRules
- jr c, .asm_170bde
- xor a
- jr .asm_170be0
-
-.asm_170bde
- ld a, $1
-
-.asm_170be0
- ld [ScriptVar], a
- ret
-; 170be4
+INCLUDE "misc/battle_tower_45.asm"
Function170be4: ; 170be4
ld a, $5
--- a/wram.asm
+++ b/wram.asm
@@ -2645,23 +2645,17 @@
BT_OTrainer::
w3_d100:: ; BattleTower OpponentTrainer-Data (length = 0xe0 = $a + $1 + 3*$3b + $24)
BT_OTrainer_Name::
- ds $A
+ ds NAME_LENGTH + -1
BT_OTrainer_TrainerClass::
- ds $1
-BT_OTPkmn1:: ; w3_d10b
- ds $1
-BT_OTPkmn1Item::
- ds $3b-1
-BT_OTPkmn2:: ; w3_d146
- ds $1
-BT_OTPkmn2Item::
- ds $3b-1
-BT_OTPkmn3:: ; w3_d181
- ds $1
-BT_OTPkmn3Item::
- ds $3b-1
+ ds 1
+BT_OTPkmn1:: party_struct BT_OTPkmn1
+BT_OTPkmn1Name:: ds PKMN_NAME_LENGTH
+BT_OTPkmn2:: party_struct BT_OTPkmn2
+BT_OTPkmn2Name:: ds PKMN_NAME_LENGTH
+BT_OTPkmn3:: party_struct BT_OTPkmn3
+BT_OTPkmn3Name:: ds PKMN_NAME_LENGTH
- ds $24
+BT_OTrainerData:: ds $24
BT_OTrainerEnd:: ; we_d1e0
ds $20