ref: f599e477fc3306dbca9cad4aeadfe7a66b84c7bc
parent: 6c248953b79237de98a177b7820ed7b9c4e96880
author: PikalaxALT <PikalaxALT@gmail.com>
date: Tue Nov 24 10:18:44 EST 2015
Partial interpretation of battle tower trainer data
--- a/data/battle_tower_2.asm
+++ b/data/battle_tower_2.asm
@@ -1,72 +1,1405 @@
+
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
+; Second argument points to an entry in Unknown_170470, to which the first argument is compared.
+
+BattleTowerTrainer1DataTable:
+ db $37, 3
+ db $0e, 9
+ db $25, 11
+ db $1c, 13
+ db $12, 13
+ db $00, 5
+ db $0e, 9
+ db $1a, 11
+ db $30, 4
+ db $3f, 6
+ db $20, 4
+ db $21, 13
+ db $0e, 9
+ db $30, 4
+ db $20, 4
+ db $0b, 6
+ db $34, 3
+ db $06, 5
+
+BattleTowerTrainer2DataTable:
+ db $36, 3
+ db $ca, 0
+ db $22, 8
+ db $20, 4
+ db $33, 13
+ db $11, 13
+ db $37, 5
+ db $06, 5
+ db $3f, 6
+ db $ca, 0
+ db $20, 4
+ db $06, 13
+ db $ca, 0
+ db $21, 3
+ db $09, 6
+ db $12, 4
+ db $28, 11
+ db $0c, 13
+
+BattleTowerTrainer3DataTable:
+ db $32, 6
+ db $31, 4
+ db $02, 2
+ db $03, 4
+ db $22, 2
+ db $00, 5
+ db $40, 4
+ db $2d, 6
+ db $13, 13
+ db $18, 3
+ db $3f, 4
+ db $13, 13
+ db $1a, 12
+ db $33, 4
+ db $32, 13
+ db $09, 6
+ db $22, 2
+ db $13, 13
+
+BattleTowerTrainer4DataTable:
+ db $22, 12
+ db $22, 12
+ db $0a, 9
+ db $0b, 8
+ db $2f, 6
+ db $22, 7
+ db $22, 6
+ db $2c, 4
+ db $1a, 6
+ db $0d, 7
+ db $3f, 13
+ db $00, 5
+ db $0b, 8
+ db $09, 6
+ db $2c, 4
+ db $1f, 14
+ db $1c, 11
+ db $41, 11
+
+BattleTowerTrainer5DataTable:
+ db $a3, 0
+ db $41, 3
+ db $1f, 4
+ db $29, 0
+ db $1c, 4
+ db $03, 2
+ db $3d, 5
+ db $38, 6
+ db $71, 0
+ db $18, 3
+ db $30, 6
+ db $53, 0
+ db $1e, 5
+ db $b9, 0
+ db $21, 13
+ db $30, 6
+ db $d1, 0
+ db $0a, 6
+
+BattleTowerTrainer6DataTable:
+ db $13, 2
+ db $31, 6
+ db $04, 2
+ db $1c, 4
+ db $0d, 13
+ db $31, 13
+ db $39, 7
+ db $31, 6
+ db $24, 7
+ db $3d, 4
+ db $40, 4
+ db $30, 13
+ db $03, 6
+ db $08, 5
+ db $02, 5
+ db $14, 7
+ db $08, 5
+ db $1a, 13
+
+BattleTowerTrainer7DataTable:
+ db $0d, 2
+ db $07, 2
+ db $00, 5
+ db $22, 2
+ db $10, 11
+ db $0a, 13
+ db $16, 2
+ db $01, 2
+ db $08, 13
+ db $2c, 4
+ db $23, 7
+ db $23, 13
+ db $16, 2
+ db $01, 2
+ db $08, 13
+ db $02, 3
+ db $20, 4
+ db $23, 13
+
+BattleTowerTrainer8DataTable:
+ db $1e, 2
+ db $22, 2
+ db $00, 5
+ db $20, 8
+ db $2c, 4
+ db $03, 2
+ db $1d, 5
+ db $41, 8
+ db $41, 8
+ db $35, 5
+ db $40, 11
+ db $00, 5
+ db $0b, 5
+ db $0b, 2
+ db $00, 5
+ db $04, 4
+ db $14, 8
+ db $00, 5
+
+BattleTowerTrainer9DataTable:
+ db $06, 12
+ db $09, 6
+ db $00, 0
+ db $0b, 9
+ db $1e, 12
+ db $37, 13
+ db $41, 3
+ db $06, 4
+ db $34, 6
+ db $22, 12
+ db $15, 9
+ db $23, 13
+ db $02, 3
+ db $22, 8
+ db $41, 13
+ db $26, 4
+ db $31, 13
+ db $01, 5
+
+BattleTowerTrainer10DataTable:
+ db $22, 12
+ db $30, 4
+ db $01, 5
+ db $2c, 4
+ db $23, 7
+ db $01, 5
+ db $37, 3
+ db $3d, 4
+ db $3c, 13
+ db $1c, 3
+ db $29, 8
+ db $3c, 13
+ db $18, 4
+ db $30, 13
+ db $06, 5
+ db $14, 7
+ db $30, 13
+ db $06, 5
+
+BattleTowerTrainer11DataTable:
+ db $0e, 6
+ db $04, 5
+ db $2c, 4
+ db $1e, 12
+ db $38, 13
+ db $00, 5
+ db $3f, 3
+ db $3f, 6
+ db $20, 4
+ db $33, 13
+ db $04, 13
+ db $00, 0
+ db $20, 4
+ db $26, 13
+ db $04, 5
+ db $0c, 4
+ db $26, 13
+ db $04, 5
+
+BattleTowerTrainer12DataTable:
+ db $18, 2
+ db $33, 3
+ db $28, 4
+ db $2c, 4
+ db $09, 7
+ db $03, 5
+ db $30, 4
+ db $08, 9
+ db $00, 5
+ db $1a, 2
+ db $32, 3
+ db $00, 5
+ db $3f, 5
+ db $26, 7
+ db $01, 5
+ db $26, 5
+ db $0f, 2
+ db $00, 5
+
+BattleTowerTrainer13DataTable:
+ db $3a, 11
+ db $3a, 11
+ db $00, 5
+ db $42, 3
+ db $19, 8
+ db $30, 4
+ db $39, 3
+ db $13, 6
+ db $13, 6
+ db $19, 8
+ db $21, 13
+ db $00, 0
+ db $39, 3
+ db $09, 2
+ db $00, 5
+ db $40, 3
+ db $3a, 8
+ db $2a, 13
+
+BattleTowerTrainer14DataTable:
+ db $31, 5
+ db $11, 14
+ db $30, 4
+ db $1b, 8
+ db $07, 8
+ db $0c, 13
+ db $1b, 2
+ db $1b, 2
+ db $01, 5
+ db $15, 2
+ db $0a, 4
+ db $0e, 13
+ db $22, 5
+ db $31, 6
+ db $02, 5
+ db $1d, 6
+ db $3b, 7
+ db $0e, 13
+
+BattleTowerTrainer15DataTable:
+ db $1b, 2
+ db $2c, 4
+ db $0d, 13
+ db $34, 3
+ db $00, 3
+ db $11, 13
+ db $1b, 8
+ db $31, 4
+ db $0b, 13
+ db $2f, 8
+ db $01, 5
+ db $00, 0
+ db $06, 5
+ db $10, 5
+ db $0f, 6
+ db $11, 13
+ db $06, 5
+ db $00, 0
+
+BattleTowerTrainer16DataTable:
+ db $42, 3
+ db $30, 4
+ db $1f, 11
+ db $16, 14
+ db $10, 7
+ db $34, 13
+ db $17, 14
+ db $04, 13
+ db $00, 0
+ db $42, 3
+ db $19, 8
+ db $30, 4
+ db $0c, 5
+ db $35, 5
+ db $01, 5
+ db $1e, 6
+ db $36, 8
+ db $41, 13
+
+BattleTowerTrainer17DataTable:
+ db $18, 3
+ db $42, 3
+ db $43, 4
+ db $3a, 11
+ db $3b, 11
+ db $03, 5
+ db $2c, 5
+ db $06, 5
+ db $1b, 3
+ db $43, 4
+ db $39, 11
+ db $3c, 4
+ db $14, 11
+ db $0f, 5
+ db $06, 5
+ db $40, 3
+ db $3f, 4
+ db $20, 14
+
+BattleTowerTrainer18DataTable:
+ db $0c, 5
+ db $36, 7
+ db $30, 4
+ db $27, 11
+ db $10, 8
+ db $31, 13
+ db $11, 14
+ db $30, 4
+ db $41, 3
+ db $07, 13
+ db $2f, 8
+ db $03, 5
+ db $06, 5
+ db $3f, 6
+ db $11, 14
+ db $30, 4
+ db $30, 7
+ db $06, 5
+
+BattleTowerTrainer19DataTable:
+ db $36, 3
+ db $06, 6
+ db $44, 4
+ db $0b, 14
+ db $16, 13
+ db $00, 5
+ db $32, 13
+ db $08, 6
+ db $09, 14
+ db $44, 4
+ db $09, 8
+ db $22, 13
+ db $04, 14
+ db $09, 14
+ db $44, 4
+ db $29, 8
+ db $05, 13
+ db $00, 0
+
+BattleTowerTrainer20DataTable:
+ db $3f, 6
+ db $2c, 4
+ db $34, 13
+ db $14, 5
+ db $13, 2
+ db $04, 2
+ db $0c, 5
+ db $3f, 4
+ db $38, 13
+ db $02, 3
+ db $29, 8
+ db $32, 13
+ db $35, 5
+ db $15, 6
+ db $40, 5
+ db $02, 3
+ db $34, 7
+ db $04, 13
+
+BattleTowerTrainer21DataTable:
+ db $12, 3
+ db $02, 4
+ db $07, 7
+ db $28, 4
+ db $2c, 13
+ db $00, 5
+ db $2c, 3
+ db $12, 3
+ db $2b, 6
+ db $0a, 4
+ db $06, 13
+ db $31, 13
+ db $2c, 3
+ db $12, 3
+ db $06, 4
+ db $0d, 6
+ db $28, 11
+ db $02, 5
+
+BattleTowerTrainer22DataTable:
+ db $41, 4
+ db $3c, 11
+ db $34, 13
+ db $40, 3
+ db $00, 3
+ db $0d, 13
+ db $13, 12
+ db $33, 8
+ db $31, 13
+ db $1e, 9
+ db $27, 7
+ db $3b, 13
+ db $22, 8
+ db $15, 4
+ db $11, 13
+ db $2c, 3
+ db $0c, 4
+ db $3b, 13
+
+BattleTowerTrainer23DataTable:
+ db $03, 10
+ db $3a, 13
+ db $2c, 4
+ db $1c, 11
+ db $35, 7
+ db $26, 13
+ db $24, 9
+ db $43, 4
+ db $26, 13
+ db $0f, 3
+ db $1f, 7
+ db $04, 5
+ db $02, 3
+ db $24, 8
+ db $26, 13
+ db $3f, 3
+ db $13, 4
+ db $04, 5
+
+BattleTowerTrainer24DataTable:
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $2c, 4
+ db $03, 5
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $07, 4
+ db $03, 5
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $06, 5
+ db $33, 4
+ db $03, 5
+
+BattleTowerTrainer25DataTable:
+ db $27, 5
+ db $01, 5
+ db $00, 0
+ db $18, 4
+ db $19, 13
+ db $01, 5
+ db $41, 5
+ db $00, 0
+ db $00, 0
+ db $16, 6
+ db $3d, 4
+ db $19, 13
+ db $20, 4
+ db $05, 5
+ db $00, 0
+ db $21, 3
+ db $0c, 4
+ db $19, 13
+
+BattleTowerTrainer26DataTable:
+ db $03, 2
+ db $43, 3
+ db $27, 4
+ db $28, 4
+ db $2d, 13
+ db $00, 5
+ db $30, 5
+ db $04, 5
+ db $02, 3
+ db $38, 6
+ db $3e, 4
+ db $41, 13
+ db $16, 14
+ db $04, 5
+ db $02, 3
+ db $38, 6
+ db $20, 4
+ db $41, 13
+
+BattleTowerTrainer27DataTable:
+ db $34, 3
+ db $00, 3
+ db $11, 13
+ db $03, 4
+ db $1c, 11
+ db $07, 13
+ db $29, 5
+ db $00, 5
+ db $00, 0
+ db $40, 4
+ db $11, 13
+ db $3e, 13
+ db $03, 6
+ db $11, 13
+ db $00, 5
+ db $16, 14
+ db $0d, 6
+ db $20, 6
+
+BattleTowerTrainer28DataTable:
+ db $19, 3
+ db $17, 11
+ db $20, 6
+ db $1b, 11
+ db $06, 12
+ db $1a, 11
+ db $34, 3
+ db $06, 4
+ db $20, 6
+ db $1b, 11
+ db $06, 12
+ db $1a, 11
+ db $34, 3
+ db $36, 4
+ db $20, 6
+ db $1b, 11
+ db $06, 12
+ db $1a, 11
+
+BattleTowerTrainer29DataTable:
+ db $0a, 3
+ db $0c, 12
+ db $25, 10
+ db $21, 14
+ db $2c, 4
+ db $03, 2
+ db $10, 9
+ db $03, 8
+ db $09, 6
+ db $0a, 3
+ db $31, 4
+ db $16, 13
+ db $27, 5
+ db $17, 7
+ db $04, 5
+ db $02, 12
+ db $0a, 9
+ db $2f, 13
+
+BattleTowerTrainer30DataTable:
+ db $15, 2
+ db $2c, 4
+ db $03, 2
+ db $24, 4
+ db $39, 4
+ db $0f, 13
+ db $1e, 2
+ db $11, 2
+ db $01, 5
+ db $0d, 4
+ db $39, 8
+ db $05, 13
+ db $29, 5
+ db $08, 2
+ db $00, 5
+ db $43, 3
+ db $0c, 4
+ db $3b, 13
+
+BattleTowerTrainer31DataTable:
+ db $10, 11
+ db $04, 4
+ db $00, 5
+ db $05, 8
+ db $21, 13
+ db $00, 0
+ db $1f, 5
+ db $01, 2
+ db $00, 5
+ db $18, 3
+ db $3c, 8
+ db $31, 13
+ db $02, 6
+ db $23, 11
+ db $31, 3
+ db $43, 3
+ db $13, 7
+ db $16, 13
+
+BattleTowerTrainer32DataTable:
+ db $0f, 14
+ db $19, 13
+ db $00, 5
+ db $0b, 14
+ db $2c, 4
+ db $19, 13
+ db $0e, 14
+ db $2c, 4
+ db $06, 5
+ db $1f, 7
+ db $19, 13
+ db $01, 5
+ db $06, 5
+ db $37, 3
+ db $29, 4
+ db $32, 13
+ db $19, 13
+ db $01, 5
+
+BattleTowerTrainer33DataTable:
+ db $35, 3
+ db $06, 4
+ db $0d, 6
+ db $29, 11
+ db $05, 13
+ db $00, 0
+ db $16, 14
+ db $30, 4
+ db $0b, 13
+ db $29, 8
+ db $16, 13
+ db $00, 5
+ db $11, 14
+ db $30, 4
+ db $30, 7
+ db $06, 5
+ db $29, 8
+ db $03, 5
+
+BattleTowerTrainer34DataTable:
+ db $18, 4
+ db $03, 5
+ db $0b, 13
+ db $2c, 4
+ db $1e, 12
+ db $01, 5
+ db $1f, 5
+ db $1d, 7
+ db $1d, 7
+ db $2c, 4
+ db $21, 7
+ db $01, 5
+ db $0a, 5
+ db $12, 2
+ db $32, 13
+ db $11, 12
+ db $0c, 6
+ db $1a, 13
+
+BattleTowerTrainer35DataTable:
+ db $0c, 12
+ db $37, 3
+ db $1a, 3
+ db $40, 4
+ db $23, 11
+ db $26, 10
+ db $3f, 6
+ db $09, 4
+ db $1b, 7
+ db $37, 3
+ db $22, 8
+ db $27, 6
+ db $04, 14
+ db $03, 5
+ db $00, 0
+ db $26, 10
+ db $3b, 8
+ db $1b, 7
+
+BattleTowerTrainer36DataTable:
+ db $18, 3
+ db $1b, 8
+ db $29, 11
+ db $40, 8
+ db $32, 13
+ db $00, 5
+ db $2f, 6
+ db $29, 11
+ db $0b, 13
+ db $2f, 8
+ db $23, 13
+ db $02, 13
+ db $35, 5
+ db $13, 14
+ db $2e, 6
+ db $22, 6
+ db $2f, 8
+ db $27, 6
+
+BattleTowerTrainer37DataTable:
+ db $1c, 3
+ db $02, 14
+ db $31, 3
+ db $2a, 13
+ db $24, 13
+ db $00, 0
+ db $18, 3
+ db $0b, 13
+ db $30, 8
+ db $40, 8
+ db $04, 5
+ db $00, 0
+ db $1c, 5
+ db $01, 5
+ db $03, 3
+ db $02, 14
+ db $27, 4
+ db $34, 13
+
+BattleTowerTrainer38DataTable:
+ db $33, 3
+ db $30, 4
+ db $2c, 4
+ db $1c, 11
+ db $35, 7
+ db $00, 5
+ db $30, 4
+ db $2c, 4
+ db $20, 6
+ db $1e, 9
+ db $40, 6
+ db $40, 4
+ db $30, 4
+ db $2c, 4
+ db $20, 6
+ db $1e, 9
+ db $40, 6
+ db $22, 7
+
+BattleTowerTrainer39DataTable:
+ db $22, 12
+ db $22, 12
+ db $16, 10
+ db $35, 13
+ db $1c, 11
+ db $3f, 13
+ db $13, 5
+ db $16, 10
+ db $40, 6
+ db $23, 7
+ db $06, 13
+ db $06, 5
+ db $3f, 6
+ db $16, 10
+ db $16, 13
+ db $37, 3
+ db $2c, 4
+ db $26, 7
+
+BattleTowerTrainer40DataTable:
+ db $0e, 6
+ db $05, 8
+ db $04, 13
+ db $00, 0
+ db $00, 0
+ db $00, 0
+ db $14, 5
+ db $06, 5
+ db $12, 2
+ db $00, 0
+ db $00, 0
+ db $00, 0
+ db $23, 5
+ db $01, 6
+ db $18, 13
+ db $00, 0
+ db $00, 0
+ db $00, 0
+
+BattleTowerTrainer41DataTable:
+ db $18, 3
+ db $27, 3
+ db $03, 5
+ db $20, 11
+ db $27, 6
+ db $06, 5
+ db $20, 14
+ db $12, 7
+ db $2b, 13
+ db $2c, 3
+ db $0e, 8
+ db $35, 7
+ db $37, 3
+ db $27, 3
+ db $03, 5
+ db $42, 7
+ db $2f, 8
+ db $06, 5
+
+BattleTowerTrainer42DataTable:
+ db $36, 3
+ db $30, 4
+ db $17, 4
+ db $2c, 3
+ db $0c, 4
+ db $3b, 13
+ db $18, 3
+ db $32, 7
+ db $15, 13
+ db $35, 5
+ db $0d, 7
+ db $07, 13
+ db $09, 5
+ db $06, 5
+ db $0f, 12
+ db $09, 4
+ db $07, 13
+ db $3b, 13
+
+BattleTowerTrainer43DataTable:
+ db $0b, 5
+ db $14, 6
+ db $24, 4
+ db $0a, 13
+ db $3c, 13
+ db $00, 5
+ db $14, 5
+ db $09, 2
+ db $32, 13
+ db $1e, 6
+ db $04, 7
+ db $06, 13
+ db $1a, 5
+ db $33, 4
+ db $03, 5
+ db $16, 2
+ db $00, 2
+ db $07, 5
+
+BattleTowerTrainer44DataTable:
+ db $0a, 3
+ db $32, 7
+ db $0b, 14
+ db $22, 6
+ db $2c, 4
+ db $29, 11
+ db $0a, 3
+ db $12, 13
+ db $24, 4
+ db $1a, 11
+ db $33, 13
+ db $03, 13
+ db $0a, 3
+ db $35, 4
+ db $1b, 7
+ db $06, 5
+ db $1e, 6
+ db $14, 7
+
+BattleTowerTrainer45DataTable:
+ db $0e, 6
+ db $2c, 4
+ db $00, 13
+ db $06, 3
+ db $31, 4
+ db $04, 13
+ db $0c, 5
+ db $12, 2
+ db $00, 5
+ db $40, 3
+ db $09, 4
+ db $01, 13
+ db $35, 5
+ db $36, 8
+ db $00, 5
+ db $02, 3
+ db $31, 4
+ db $21, 13
+
+BattleTowerTrainer46DataTable:
+ db $22, 5
+ db $07, 14
+ db $30, 4
+ db $c5, 0
+ db $10, 2
+ db $01, 5
+ db $0c, 12
+ db $00, 1
+ db $30, 4
+ db $82, 0
+ db $21, 4
+ db $01, 5
+ db $10, 1
+ db $11, 5
+ db $30, 4
+ db $c3, 0
+ db $3f, 4
+ db $06, 5
+
+BattleTowerTrainer47DataTable:
+ db $3a, 7
+ db $3b, 7
+ db $36, 3
+ db $30, 4
+ db $21, 4
+ db $06, 13
+ db $17, 14
+ db $03, 5
+ db $00, 0
+ db $3f, 6
+ db $21, 4
+ db $21, 13
+ db $36, 5
+ db $36, 3
+ db $30, 4
+ db $33, 6
+ db $3f, 4
+ db $0c, 13
+
+BattleTowerTrainer48DataTable:
+ db $43, 3
+ db $20, 4
+ db $41, 13
+ db $17, 6
+ db $06, 3
+ db $0a, 4
+ db $3a, 6
+ db $13, 4
+ db $04, 13
+ db $08, 6
+ db $3f, 4
+ db $31, 13
+ db $43, 3
+ db $39, 4
+ db $04, 5
+ db $17, 6
+ db $39, 4
+ db $41, 13
+
+BattleTowerTrainer49DataTable:
+ db $36, 3
+ db $16, 4
+ db $08, 6
+ db $09, 8
+ db $06, 13
+ db $00, 0
+ db $1f, 11
+ db $03, 5
+ db $12, 14
+ db $0f, 14
+ db $2c, 13
+ db $00, 5
+ db $3a, 6
+ db $16, 4
+ db $38, 6
+ db $38, 6
+ db $2c, 13
+ db $00, 5
+
+BattleTowerTrainer50DataTable:
+ db $11, 5
+ db $25, 3
+ db $33, 4
+ db $2f, 8
+ db $19, 13
+ db $00, 5
+ db $11, 5
+ db $25, 3
+ db $3f, 6
+ db $26, 4
+ db $19, 13
+ db $00, 5
+ db $11, 5
+ db $21, 3
+ db $35, 4
+ db $14, 7
+ db $19, 13
+ db $06, 5
+
+BattleTowerTrainer51DataTable:
+ db $2c, 4
+ db $0a, 13
+ db $04, 5
+ db $33, 3
+ db $29, 11
+ db $05, 13
+ db $00, 6
+ db $04, 5
+ db $09, 2
+ db $33, 3
+ db $07, 4
+ db $35, 7
+ db $33, 3
+ db $3a, 8
+ db $05, 13
+ db $3f, 6
+ db $29, 8
+ db $05, 13
+
+BattleTowerTrainer52DataTable:
+ db $05, 3
+ db $1b, 4
+ db $41, 3
+ db $39, 11
+ db $3a, 11
+ db $01, 5
+ db $2c, 4
+ db $03, 5
+ db $00, 0
+ db $40, 7
+ db $3e, 13
+ db $00, 5
+ db $00, 14
+ db $09, 5
+ db $04, 5
+ db $19, 9
+ db $1d, 11
+ db $03, 5
+
+BattleTowerTrainer53DataTable:
+ db $1c, 12
+ db $20, 6
+ db $05, 8
+ db $3e, 13
+ db $00, 5
+ db $00, 0
+ db $18, 3
+ db $1f, 14
+ db $11, 10
+ db $1c, 11
+ db $15, 11
+ db $1c, 6
+ db $03, 14
+ db $06, 12
+ db $21, 12
+ db $14, 13
+ db $06, 5
+ db $1f, 8
+
+BattleTowerTrainer54DataTable:
+ db $37, 3
+ db $0e, 1
+ db $08, 1
+ db $19, 6
+ db $27, 11
+ db $03, 2
+ db $0e, 1
+ db $08, 1
+ db $1b, 8
+ db $05, 8
+ db $21, 13
+ db $00, 0
+ db $36, 3
+ db $33, 4
+ db $04, 5
+ db $00, 4
+ db $41, 8
+ db $3b, 13
+
+BattleTowerTrainer55DataTable:
+ db $06, 2
+ db $00, 5
+ db $34, 3
+ db $00, 3
+ db $0d, 13
+ db $00, 5
+ db $3c, 6
+ db $05, 8
+ db $16, 4
+ db $2f, 8
+ db $33, 13
+ db $02, 13
+ db $1c, 5
+ db $00, 5
+ db $18, 3
+ db $05, 8
+ db $1b, 4
+ db $0c, 13
+
+BattleTowerTrainer56DataTable:
+ db $2c, 4
+ db $13, 9
+ db $20, 6
+ db $39, 3
+ db $20, 4
+ db $3c, 13
+ db $05, 3
+ db $43, 4
+ db $0b, 13
+ db $22, 4
+ db $06, 13
+ db $31, 13
+ db $24, 8
+ db $00, 5
+ db $02, 3
+ db $09, 8
+ db $06, 13
+ db $3b, 13
+
+BattleTowerTrainer57DataTable:
+ db $06, 3
+ db $20, 4
+ db $24, 13
+ db $24, 4
+ db $10, 11
+ db $00, 5
+ db $39, 7
+ db $00, 5
+ db $2a, 6
+ db $04, 4
+ db $3c, 4
+ db $00, 0
+ db $24, 4
+ db $1c, 11
+ db $07, 13
+ db $2f, 8
+ db $09, 6
+ db $06, 5
+
+BattleTowerTrainer58DataTable:
+ db $44, 7
+ db $23, 11
+ db $33, 13
+ db $2c, 4
+ db $20, 6
+ db $24, 8
+ db $24, 8
+ db $00, 5
+ db $0e, 14
+ db $12, 8
+ db $09, 11
+ db $28, 6
+ db $24, 8
+ db $00, 5
+ db $02, 3
+ db $13, 6
+ db $11, 8
+ db $41, 13
+
+BattleTowerTrainer59DataTable:
+ db $36, 3
+ db $06, 6
+ db $30, 4
+ db $0f, 11
+ db $02, 11
+ db $3b, 13
+ db $31, 13
+ db $00, 5
+ db $39, 3
+ db $20, 4
+ db $21, 13
+ db $00, 0
+ db $04, 14
+ db $02, 5
+ db $06, 6
+ db $20, 14
+ db $0b, 6
+ db $27, 6
+
+BattleTowerTrainer60DataTable:
+ db $14, 5
+ db $04, 2
+ db $09, 14
+ db $08, 8
+ db $2e, 8
+ db $41, 13
+ db $34, 5
+ db $2e, 8
+ db $21, 13
+ db $3f, 3
+ db $18, 8
+ db $00, 5
+ db $36, 5
+ db $05, 2
+ db $00, 5
+ db $17, 6
+ db $39, 4
+ db $00, 5
+
+BattleTowerTrainer61DataTable:
+ db $34, 3
+ db $00, 3
+ db $11, 13
+ db $41, 8
+ db $0b, 6
+ db $06, 4
+ db $39, 7
+ db $00, 5
+ db $00, 0
+ db $36, 3
+ db $30, 4
+ db $07, 8
+ db $10, 5
+ db $15, 8
+ db $00, 5
+ db $3a, 6
+ db $1e, 6
+ db $14, 13
+
+BattleTowerTrainer62DataTable:
+ db $37, 5
+ db $37, 5
+ db $00, 5
+ db $38, 5
+ db $38, 5
+ db $41, 5
+ db $25, 5
+ db $04, 5
+ db $32, 5
+ db $31, 5
+ db $41, 5
+ db $41, 5
+ db $0f, 5
+ db $04, 5
+ db $0f, 5
+ db $0f, 5
+ db $16, 5
+ db $01, 5
+
+BattleTowerTrainer63DataTable:
+ db $1f, 14
+ db $36, 4
+ db $40, 13
+ db $2f, 8
+ db $1a, 13
+ db $00, 5
+ db $21, 6
+ db $35, 5
+ db $24, 6
+ db $1a, 6
+ db $12, 14
+ db $00, 0
+ db $1b, 5
+ db $31, 6
+ db $02, 5
+ db $28, 13
+ db $27, 13
+ db $00, 0
+
+BattleTowerTrainer64DataTable:
+ db $41, 8
+ db $0b, 6
+ db $37, 3
+ db $08, 6
+ db $20, 4
+ db $3b, 13
+ db $15, 2
+ db $16, 6
+ db $26, 7
+ db $13, 12
+ db $33, 8
+ db $32, 13
+ db $2d, 7
+ db $00, 5
+ db $35, 3
+ db $0b, 4
+ db $28, 6
+ db $06, 5
+
+BattleTowerTrainer65DataTable:
+ db $0c, 8
+ db $2c, 4
+ db $1c, 11
+ db $06, 7
+ db $0a, 13
+ db $03, 5
+ db $30, 6
+ db $06, 7
+ db $00, 5
+ db $2c, 4
+ db $20, 6
+ db $24, 7
+ db $30, 6
+ db $0b, 7
+ db $00, 5
+ db $2c, 4
+ db $20, 6
+ db $22, 7
+
+BattleTowerTrainer66DataTable:
+ db $22, 12
+ db $22, 12
+ db $0a, 9
+ db $04, 11
+ db $02, 7
+ db $27, 6
+ db $0f, 12
+ db $0a, 10
+ db $22, 6
+ db $02, 7
+ db $27, 6
+ db $04, 5
+ db $3a, 6
+ db $0e, 10
+ db $22, 6
+ db $05, 8
+ db $02, 7
+ db $04, 5
+
+BattleTowerTrainer67DataTable:
+ db $2d, 11
+ db $02, 8
+ db $37, 13
+ db $10, 5
+ db $29, 7
+ db $03, 5
+ db $20, 14
+ db $0e, 14
+ db $0d, 6
+ db $42, 7
+ db $30, 8
+ db $28, 6
+ db $10, 5
+ db $04, 5
+ db $04, 5
+ db $10, 5
+ db $10, 5
+ db $04, 5
+
+BattleTowerTrainer68DataTable:
+ db $3f, 3
+ db $16, 14
+ db $3f, 8
+ db $0b, 13
+ db $2f, 8
+ db $41, 13
+ db $34, 5
+ db $00, 5
+ db $02, 3
+ db $3a, 6
+ db $31, 7
+ db $31, 13
+ db $21, 14
+ db $03, 5
+ db $3f, 3
+ db $16, 14
+ db $26, 7
+ db $03, 5
+
+BattleTowerTrainer69DataTable:
+ db $3a, 6
+ db $2c, 3
+ db $12, 3
+ db $17, 12
+ db $28, 11
+ db $06, 13
+ db $3a, 6
+ db $17, 12
+ db $23, 11
+ db $0d, 6
+ db $2f, 8
+ db $22, 13
+ db $14, 7
+ db $04, 5
+ db $17, 12
+ db $1c, 11
+ db $1b, 7
+ db $00, 5
+
+BattleTowerTrainer70DataTable:
+ db $1b, 2
+ db $00, 5
+ db $0c, 8
+ db $2c, 4
+ db $23, 11
+ db $32, 13
+ db $2b, 7
+ db $1f, 4
+ db $3b, 13
+ db $09, 7
+ db $09, 7
+ db $00, 5
+ db $26, 5
+ db $00, 5
+ db $3f, 3
+ db $22, 7
+ db $d1, 0
+ db $32, 13
+BattleTowerTrainerDataEnd:
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -288,13 +288,13 @@
callba BackupPartyMonMail
callba BackupMobileEventIndex
callba SaveRTC
- ld a, BANK(sSaveType)
+ ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank
- ld a, [sSaveType]
+ ld a, [sBattleTowerChallengeState]
cp $4
jr nz, .ok
xor a
- ld [sSaveType], a
+ ld [sBattleTowerChallengeState], a
.ok
call CloseSRAM
ret
@@ -438,10 +438,10 @@
; 14d5c
Function14d5c: ; 14d5c
- ld a, BANK(sSaveType)
+ ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank
xor a
- ld [sSaveType], a
+ ld [sBattleTowerChallengeState], a
jp CloseSRAM
; 14d68
@@ -788,13 +788,13 @@
ld bc, wMapDataEnd - wMapData
call CopyBytes
call CloseSRAM
- ld a, BANK(sSaveType)
+ ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank
- ld a, [sSaveType]
+ ld a, [sBattleTowerChallengeState]
cp $4
jr nz, .not_4
ld a, $3
- ld [sSaveType], a
+ ld [sBattleTowerChallengeState], a
.not_4
call CloseSRAM
ret
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -27,7 +27,7 @@
end
.priorityjump1:
- priorityjump UnknownScript_0x9e555
+ priorityjump BattleTower_LeftWithoutSaving
writebyte BATTLE_TOWER_ACTION_04
special BattleTowerAction
writebyte BATTLE_TOWER_ACTION_06
@@ -119,7 +119,7 @@
special BattleTowerAction
writebyte BATTLE_TOWER_ACTION_1B
special BattleTowerAction
- if_equal $12, Script_YourPackIsStuffedFull
+ if_equal POTION, Script_YourPackIsStuffedFull
itemtotext $0, $1
giveitem ITEM_FROM_MEM, 5
writetext Text_PlayerGotFive
@@ -236,9 +236,9 @@
loadmovesprites
end
-UnknownScript_0x9e555:
+BattleTower_LeftWithoutSaving:
loadfont
- writetext UnknownText_0x9ee18
+ writetext Text_BattleTower_LeftWithoutSaving
closetext
jump UnknownScript_0x9e4b0
@@ -610,7 +610,7 @@
line "placed on them."
done
-UnknownText_0x9ee18:
+Text_BattleTower_LeftWithoutSaving:
text "Excuse me!"
line "You didn't SAVE"
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -1,3 +1,183 @@
+Function1700b0: ; 1700b0
+ call Function17021e
+ callba Function118121
+ ret
+; 1700ba
+
+Function1700ba: ; 1700ba
+ call Function17021e
+ callba Function11811a
+ ret
+; 1700c4
+
+Function1700c4: ; 1700c4
+ ld a, [rSVBK]
+ push af
+ ld a, $3
+ ld [rSVBK], a
+
+ call Function17042c
+ ld a, $5
+ call GetSRAMBank
+ ld a, $1
+ ld [$be45], a
+ xor a
+ ld [$be46], a
+ ld hl, $dffc
+ ld de, $aa41
+ ld bc, $0004
+ call CopyBytes
+ ld hl, $d202
+ ld de, $aa8e
+ ld bc, $0594
+ call CopyBytes
+ ld hl, $aa5d
+ ld a, [hl]
+ inc [hl]
+ inc hl
+ sla a
+ sla a
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld e, l
+ ld d, h
+ ld hl, $dffc
+ ld bc, $0004
+ call CopyBytes
+ call CloseSRAM
+ pop af
+ ld [rSVBK], a
+ ret
+; 170114
+
+Function170114: ; 170114
+ call Function17021e
+ call Function170121
+ callba Function11805f
+ ret
+; 170121
+
+Function170121: ; 170121
+ ld a, $5
+ call GetSRAMBank
+ ld hl, $a948
+ ld de, $c608
+ ld bc, $00f6
+ call CopyBytes
+ call CloseSRAM
+ call Function170c8b
+ ret
+; 170139
+
+Function170139: ; 170139
+ ld a, $5
+ call GetSRAMBank
+ ld de, $aa41
+ ld h, $0
+ ld l, h
+ ld bc, $03e8
+ call Function17020c
+ ld bc, $0064
+ call Function17020c
+ ld bc, $000a
+ call Function17020c
+ ld a, [de]
+ ld c, a
+ ld b, $0
+ add hl, bc
+ call CloseSRAM
+ ld a, h
+ ld [$c608], a
+ ld a, l
+ ld [$c608 + 1], a
+ ld hl, $c628
+ ld a, [PlayerID]
+ ld [hli], a
+ ld a, [PlayerID + 1]
+ ld [hli], a
+ ld a, [wSecretID]
+ ld [hli], a
+ ld a, [wSecretID + 1]
+ ld [hli], a
+ ld e, l
+ ld d, h
+ ld hl, PlayerName
+ ld bc, $0005 ; Japanese name length
+ call CopyBytes
+ ld bc, PlayerID
+ ld de, PlayerGender
+ callba Function4e929
+ ld de, $c62c + 5
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, $df
+ ld [wcd49], a
+ ld a, $dc
+ ld [wcd4a], a
+ ld a, $41
+ ld [wcd4b], a
+ ld a, $de
+ ld [wcd4c], a
+ ld a, $3
+.asm_1701ac
+ push af
+ ld a, [wcd49]
+ ld l, a
+ ld a, [wcd4a]
+ ld h, a
+ ld bc, $0030
+ call CopyBytes
+ ld a, l
+ ld [wcd49], a
+ ld a, h
+ ld [wcd4a], a
+ ld a, [wcd4b]
+ ld l, a
+ ld a, [wcd4c]
+ ld h, a
+ ld bc, $0006
+ call CopyBytes
+ ld a, l
+ ld [wcd4b], a
+ ld a, h
+ ld [wcd4c], a
+ pop af
+ dec a
+ jr nz, .asm_1701ac
+ ld a, $4
+ call GetSRAMBank
+ ld hl, $a013
+ ld bc, $0024
+ call CopyBytes
+ call CloseSRAM
+ ld a, $5
+ call GetSRAMBank
+ ld hl, $a894
+ ld bc, $0006
+ call CopyBytes
+ ld hl, $c608
+ ld de, $a948
+ ld bc, $00f6
+ call CopyBytes
+ call CloseSRAM
+ ret
+; 17020c
+
+Function17020c: ; 17020c
+ ld a, [de]
+ inc de
+ and a
+ ret z
+
+.loop
+ add hl, bc
+ dec a
+ jr nz, .loop
+ ret
+; 170215
+
BattleTowerBattle: ; 170215
xor a
ld [wcf63], a
@@ -64,7 +244,9 @@
callba HealParty
call ReadBTTrainerParty
call Clears5_a89a
+
predef StartBattle
+
callba LoadPokemonData
callba HealParty
ld a, [wBattleResult]
@@ -323,3 +505,1135 @@
BT_ChrisName: ; 170426
db "CHRIS@"
; 17042c
+
+Function17042c: ; 17042c
+ ld hl, w3_d202TrainerData
+ ld a, 7
+.loop
+ push af
+ push hl
+ ld c, BATTLETOWER_TRAINERDATALENGTH / 2
+.loop2
+ ; First byte is a comparison value.
+ ld a, [hli]
+ ld b, a
+ ; Second byte is a lookup index.
+ ld a, [hli]
+ and a
+ jr z, .empty
+ cp $f
+ jr nc, .copy_data
+
+ push hl
+ ld hl, Unknown_170470
+ dec a
+ ld e, a
+ ld d, 0
+ add hl, de
+ ld a, [hl]
+ pop hl
+
+ ; If Unknown_170470[a-1] <= b, overwrite the current trainer's data
+ ; with Unknown17047e, and exit the inner loop.
+ cp b
+ jr c, .copy_data
+ jr z, .copy_data
+ jr .next_iteration
+
+.empty
+ ; If a == 0 and b >= $fc, overwrite the current trainer's data with
+ ; Unknown17047e, and exit the inner loop.
+ ld a, b
+ cp $fc
+ jr nc, .copy_data
+
+.next_iteration
+ dec c
+ jr nz, .loop2
+ jr .next_trainer
+
+.copy_data
+ pop de
+ push de
+ ld hl, Unknown_17047e
+ ld bc, BATTLETOWER_TRAINERDATALENGTH
+ call CopyBytes
+
+.next_trainer
+ pop hl
+ ld de, BATTLE_TOWER_STRUCT_LENGTH
+ add hl, de
+ pop af
+ dec a
+ jr nz, .loop
+ ret
+; 170470
+
+Unknown_170470:
+ db $12
+ db $24
+ db $45
+ db $45
+ db $42
+ db $42
+ db $45
+ db $42
+ db $27
+ db $27
+ db $45
+ db $27
+ db $42
+ db $24
+
+Unknown_17047e:
+; see data/battle_tower_2.asm
+ db $03, 4
+ db $05, 8
+ db $03, 5
+ db $0e, 6
+ db $03, 2
+ db $00, 0
+ db $39, 7
+ db $07, 4
+ db $00, 5
+ db $04, 7
+ db $01, 5
+ db $00, 0
+ db $0f, 5
+ db $14, 7
+ db $05, 5
+ db $11, 12
+ db $0c, 6
+ db $06, 4
+
+
+CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2
+; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp'
+ ld a, [rSVBK]
+ push af
+ ld a, $3 ; BANK(BT_OTTrainer)
+ ld [rSVBK], a
+
+ ld hl, BT_OTTrainer ; $d100
+ ld de, wBT_OTTemp ; $c608
+ ld bc, BATTLE_TOWER_STRUCT_LENGTH
+ call CopyBytes
+
+ pop af
+ ld [rSVBK], a
+
+ ld a, BANK(sBattleTowerChallengeState)
+ call GetSRAMBank
+ ld a, $2
+ ld [sBattleTowerChallengeState], a
+ ld hl, sNrOfBeatenBattleTowerTrainers
+ inc [hl]
+ call CloseSRAM
+SkipBattleTowerTrainer: ; 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 ReturnToCallingMenu
+ ret
+; 1704f1
+
+Function1704f1: ; 1704f1
+ call ClearBGPalettes
+ call ClearSprites
+ call ClearScreen
+.asm_1704fa
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_17050f
+ call Function170510
+ callba ReloadMapPart
+ 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 CheckMobileEventIndex ; 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) BattleTowerAction $1b
+ ld a, BANK(sBattleTowerReward)
+ call GetSRAMBank
+
+ ld a, [sBattleTowerReward]
+ call CloseSRAM
+ ld [ScriptVar], a
+ ld hl, NumItems
+ ld a, [hli]
+ cp MAX_ITEMS
+ ret c
+ ld b, MAX_ITEMS
+ ld a, [ScriptVar]
+ ld c, a
+.loop
+ ld a, [hli]
+ cp c
+ jr nz, .next
+ ld a, [hl]
+ cp 95
+ ret c
+.next
+ inc hl
+ dec b
+ jr nz, .loop
+ ld a, POTION
+ ld [ScriptVar], a
+ ret
+
+Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c
+ ld a, BANK(sBattleTowerChallengeState)
+ call GetSRAMBank
+ ld a, $3
+ ld [sBattleTowerChallengeState], a
+ call CloseSRAM
+ ret
+
+Function170729: ; 170729 (5c:4729) BattleTowerAction $1d
+ ld a, BANK(sBattleTowerChallengeState)
+ call GetSRAMBank
+ ld a, $4
+ ld [sBattleTowerChallengeState], a
+ call CloseSRAM
+ ret
+
+Function170737: ; 170737 (5c:4737) BattleTowerAction $1e
+ callba SaveOptions
+ ret
+
+Function17073e: ; 17073e (5c:473e) BattleTowerAction $1f
+; Generate a random stat boosting item.
+.loop
+ call Random
+ ld a, [hRandomAdd]
+ and $7
+ cp 6
+ jr c, .okay
+ sub 6
+.okay
+ add HP_UP
+ cp LUCKY_PUNCH
+ jr z, .loop
+ push af
+ ld a, BANK(sBattleTowerReward)
+ call GetSRAMBank
+ pop af
+ ld [sBattleTowerReward], a
+ call CloseSRAM
+ ret
+
+Function17075f: ; 17075f (5c:475f) BattleTowerAction $00
+ 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) BattleTowerAction $02
+ ld hl, sBattleTowerChallengeState
+ ld a, BANK(sBattleTowerChallengeState)
+ call GetSRAMBank
+ ld a, [hl]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170788: ; 170788 (5c:4788) BattleTowerAction $01
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ or $2
+ ld [sbe4f], a
+ call CloseSRAM
+ ret
+
+Function170799: ; 170799 (5c:4799) BattleTowerAction $03
+ ld c, $1
+ jr asm_17079f
+
+Function17079d: ; 17079d (5c:479d) BattleTowerAction $04
+ ld c, $0
+asm_17079f: ; 17079f (5c:479f)
+ ld a, BANK(sBattleTowerChallengeState)
+ call GetSRAMBank
+ ld a, c
+ ld [sBattleTowerChallengeState], a
+ call CloseSRAM
+ ret
+
+Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05
+ 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) BattleTowerAction $06
+ ld a, $5
+ call GetSRAMBank
+ xor a
+ ld [$be46], a
+ ld [$aa8b], a
+ ld [$aa8c], a
+ call CloseSRAM
+ ret
+
+Function170807: ; 170807 (5c:4807) BattleTowerAction $16
+ 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) BattleTowerAction $17
+ 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) BattleTowerAction $07
+ ld a, BANK(sbe47)
+ call GetSRAMBank
+ ld a, [rSVBK]
+ push af
+ ld a, $3
+ ld [rSVBK], a
+ ld a, [wd000 + $800]
+ ld [sbe47], a
+ pop af
+ ld [rSVBK], a
+ call CloseSRAM
+ ret
+
+Function170881: ; 170881 (5c:4881) BattleTowerAction $08
+ ld a, BANK(sbe47)
+ call GetSRAMBank
+ ld a, [rSVBK]
+ push af
+ ld a, $3
+ ld [rSVBK], a
+ ld a, [sbe47]
+ ld [wd000 + $800], a
+ pop af
+ ld [rSVBK], a
+ call CloseSRAM
+ ret
+
+Function17089a: ; 17089a BattleTowerAction $09
+ ld a, [wSaveFileExists]
+ and a
+ jr z, .nope
+ callba Function14bcb
+ jr z, .yes
+ xor a
+ jr .nope
+
+.yes
+ ld a, $1
+
+.nope
+ ld [ScriptVar], a
+ ret
+; 1708b1
+
+
+Function1708b1: ; 1708b1 (5c:48b1) BattleTowerAction $0a
+ xor a
+ ld [MusicFade], a
+ call MaxVolume
+ ret
+
+CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do with GS Ball
+ ld a, BANK(sMobileEventIndex)
+ call GetSRAMBank
+ ld a, [sMobileEventIndex]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c
+ 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) BattleTowerAction $0d
+ 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) BattleTowerAction $0e
+ 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
+.loop
+ ld a, [hli]
+ cp EGG
+ jr nz, .not_egg
+ push hl
+ ld hl, PartyMonOT ; wddff (aliases: PartyMonOT)
+ ld de, $6
+ ld a, b
+ and a
+ jr z, .skip
+.loop2
+ add hl, de
+ dec a
+ jr nz, .loop2
+.skip
+ 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
+.not_egg
+ inc b
+ dec c
+ jr nz, .loop
+ ret
+; 1709a4 (5c:49a4)
+
+String_1709a4: ; 1709a4
+ db "なぞナゾ@@"
+
+Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f
+ ld a, [rSVBK]
+ push af
+ ld a, BANK(w3_d090)
+ ld [rSVBK], a
+ ld a, [w3_d090]
+ ld [ScriptVar], a
+ pop af
+ ld [rSVBK], a
+ ret
+
+Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10
+ xor a
+ ld [ScriptVar], a
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$a800]
+ call CloseSRAM
+ cp 6
+ jr nc, .invalid
+ 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]
+
+.invalid
+ 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) BattleTowerAction $11
+ ld c, $0
+ jr asm_170aa2
+
+Function170aa0: ; 170aa0 (5c:4aa0) BattleTowerAction $12
+ 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) BattleTowerAction $13
+ ld a, $5
+ call GetSRAMBank
+ ld a, [$aa8d]
+ ld [ScriptVar], a
+ call CloseSRAM
+ ret
+
+Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14
+ 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) BattleTowerAction $15
+ ld a, BANK(sbe4f)
+ call GetSRAMBank
+ ld a, [sbe4f]
+ or $1
+ ld [sbe4f], a
+ call CloseSRAM
+ ret
+
+Function170ae8: ; 170ae8 (5c:4ae8) BattleTowerAction $18
+ 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) BattleTowerAction $19
+ 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
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -175,7 +175,7 @@
cp [hl]
jr nz, .asm_11813e
xor a
- ld [UnknBGPals], a
+ ld [w3_d000], a
pop af
ld [rSVBK], a
call Function118452
@@ -197,33 +197,37 @@
ld de, $a89c
ld bc, $0016
call CopyBytes
+
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
- ld de, $d202
+
+ ld de, w3_d202
ld c, $96
- callba Function17d0b3
- jr c, .asm_1181d0
- ld de, $d202
- ld bc, $0196
- callba Function17d1e1
- jr c, .asm_1181d0
- ld hl, $d202
+ callba CheckStringForErrors_IgnoreTerminator
+ jr c, .return_d3
+
+ ld de, w3_d202
+ lb bc, 1, $96
+ callba CheckStringContainsLessThanBNextCharacters
+ jr c, .return_d3
+
+ ld hl, w3_d202
ld de, $a8b2
ld bc, $0096
call CopyBytes
-.asm_1181c9
+.reset_banks
pop af
ld [rSVBK], a
call CloseSRAM
ret
-.asm_1181d0
+.return_d3
ld a, $d3
ld [wc300], a
ld [ScriptVar], a
- jr .asm_1181c9
+ jr .reset_banks
; 1181da
Function1181da: ; 1181da
@@ -7549,8 +7553,8 @@
.asm_11b70f
ld de, $c63d
- ld bc, $0105
- callba Function17d1e1
+ lb bc, 1, 5
+ callba CheckStringContainsLessThanBNextCharacters
jr nc, .asm_11b723
callba Function17d187
@@ -7563,8 +7567,8 @@
.asm_11b736
ld de, $c642
- ld bc, $0105
- callba Function17d1e1
+ lb bc, 1, 5
+ callba CheckStringContainsLessThanBNextCharacters
jr nc, .asm_11b74a
callba Function17d199
@@ -7577,8 +7581,8 @@
.asm_11b75d
ld de, $c647
- ld bc, $0221
- callba Function17d1e1
+ lb bc, 2, $21
+ callba CheckStringContainsLessThanBNextCharacters
jr c, .asm_11b770
ld a, b
cp $2
@@ -7596,8 +7600,8 @@
.asm_11b789
ld de, $c668
- ld bc, $0105
- callba Function17d1e1
+ lb bc, 1, 5
+ callba CheckStringContainsLessThanBNextCharacters
jr nc, .asm_11b79d
callba Function17d1c9
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -73,1287 +73,7 @@
ret
; 1700b0
-Function1700b0: ; 1700b0
- call Function17021e
- callba Function118121
- ret
-; 1700ba
-
-Function1700ba: ; 1700ba
- call Function17021e
- callba Function11811a
- ret
-; 1700c4
-
-Function1700c4: ; 1700c4
- ld a, [rSVBK]
- push af
- ld a, $3
- ld [rSVBK], a
-
- call Function17042c
- ld a, $5
- call GetSRAMBank
- ld a, $1
- ld [$be45], a
- xor a
- ld [$be46], a
- ld hl, $dffc
- ld de, $aa41
- ld bc, $0004
- call CopyBytes
- ld hl, $d202
- ld de, $aa8e
- ld bc, $0594
- call CopyBytes
- ld hl, $aa5d
- ld a, [hl]
- inc [hl]
- inc hl
- sla a
- sla a
- ld e, a
- ld d, $0
- add hl, de
- ld e, l
- ld d, h
- ld hl, $dffc
- ld bc, $0004
- call CopyBytes
- call CloseSRAM
- pop af
- ld [rSVBK], a
- ret
-; 170114
-
-Function170114: ; 170114
- call Function17021e
- call Function170121
- callba Function11805f
- ret
-; 170121
-
-Function170121: ; 170121
- ld a, $5
- call GetSRAMBank
- ld hl, $a948
- ld de, $c608
- ld bc, $00f6
- call CopyBytes
- call CloseSRAM
- call Function170c8b
- ret
-; 170139
-
-Function170139: ; 170139
- ld a, $5
- call GetSRAMBank
- ld de, $aa41
- ld h, $0
- ld l, h
- ld bc, $03e8
- call Function17020c
- ld bc, $0064
- call Function17020c
- ld bc, $000a
- call Function17020c
- ld a, [de]
- ld c, a
- ld b, $0
- add hl, bc
- call CloseSRAM
- ld a, h
- ld [$c608], a
- ld a, l
- ld [$c608 + 1], a
- ld hl, $c628
- ld a, [PlayerID]
- ld [hli], a
- ld a, [PlayerID + 1]
- ld [hli], a
- ld a, [wSecretID]
- ld [hli], a
- ld a, [wSecretID + 1]
- ld [hli], a
- ld e, l
- ld d, h
- ld hl, PlayerName
- ld bc, $0005 ; Japanese name length
- call CopyBytes
- ld bc, PlayerID
- ld de, PlayerGender
- callba Function4e929
- ld de, $c62c + 5
- ld a, c
- ld [de], a
- inc de
- ld a, $df
- ld [wcd49], a
- ld a, $dc
- ld [wcd4a], a
- ld a, $41
- ld [wcd4b], a
- ld a, $de
- ld [wcd4c], a
- ld a, $3
-.asm_1701ac
- push af
- ld a, [wcd49]
- ld l, a
- ld a, [wcd4a]
- ld h, a
- ld bc, $0030
- call CopyBytes
- ld a, l
- ld [wcd49], a
- ld a, h
- ld [wcd4a], a
- ld a, [wcd4b]
- ld l, a
- ld a, [wcd4c]
- ld h, a
- ld bc, $0006
- call CopyBytes
- ld a, l
- ld [wcd4b], a
- ld a, h
- ld [wcd4c], a
- pop af
- dec a
- jr nz, .asm_1701ac
- ld a, $4
- call GetSRAMBank
- ld hl, $a013
- ld bc, $0024
- call CopyBytes
- call CloseSRAM
- ld a, $5
- call GetSRAMBank
- ld hl, $a894
- ld bc, $0006
- call CopyBytes
- ld hl, $c608
- ld de, $a948
- ld bc, $00f6
- call CopyBytes
- call CloseSRAM
- ret
-; 17020c
-
-Function17020c: ; 17020c
- ld a, [de]
- inc de
- and a
- ret z
-
-.loop
- add hl, bc
- dec a
- jr nz, .loop
- ret
-; 170215
-
INCLUDE "misc/battle_tower_5c.asm"
-
-
-Function17042c: ; 17042c
- ld hl, w3_d2be
- ld a, 7
-.loop
- push af
- push hl
- ld c, 18
-.loop2
- ld a, [hli]
- ld b, a
- ld a, [hli]
- and a
- jr z, .empty
- cp $f
- jr nc, .exit_inner_loop
- 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, .exit_inner_loop
- jr z, .exit_inner_loop
- jr .next_iteration
-
-.empty
- ld a, b
- cp $fc
- jr nc, .exit_inner_loop
-
-.next_iteration
- dec c
- jr nz, .loop2
- jr .dont_copy
-
-.exit_inner_loop
- pop de
- push de
- ld hl, Unknown_17047e
- ld bc, BATTLETOWER_TRAINERDATALENGTH
- call CopyBytes
-
-.dont_copy
- pop hl
- ld de, $00e0
- add hl, de
- pop af
- dec a
- jr nz, .loop
- 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_OT_TowBT_OTTemp: ; 1704a2
-; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp'
- ld a, [rSVBK]
- push af
- ld a, $3 ; BANK(BT_OTTrainer)
- ld [rSVBK], a
-
- ld hl, BT_OTTrainer ; $d100
- ld de, wBT_OTTemp ; $c608
- ld bc, BATTLE_TOWER_STRUCT_LENGTH
- call CopyBytes
-
- pop af
- ld [rSVBK], a
-
- ld a, BANK(sSaveType)
- call GetSRAMBank
- ld a, $2
- ld [sSaveType], a
- ld hl, sNrOfBeatenBattleTowerTrainers
- inc [hl]
- call CloseSRAM
-SkipBattleTowerTrainer: ; 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 ReturnToCallingMenu
- ret
-; 1704f1
-
-Function1704f1: ; 1704f1
- call ClearBGPalettes
- call ClearSprites
- call ClearScreen
-.asm_1704fa
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_17050f
- call Function170510
- callba ReloadMapPart
- 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 CheckMobileEventIndex ; 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(sSaveType)
- call GetSRAMBank
- ld a, $3
- ld [sSaveType], a
- call CloseSRAM
- ret
-
-Function170729: ; 170729 (5c:4729)
- ld a, BANK(sSaveType)
- call GetSRAMBank
- ld a, $4
- ld [sSaveType], a
- call CloseSRAM
- ret
-
-Function170737: ; 170737 (5c:4737)
- callba SaveOptions
- ret
-
-Function17073e: ; 17073e (5c:473e)
- call Random
- ld a, [hRandomAdd]
- 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, sSaveType
- ld a, BANK(sSaveType)
- 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(sSaveType)
- call GetSRAMBank
- ld a, c
- ld [sSaveType], 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]
- push af
- ld a, $3
- ld [rSVBK], a
- ld a, [wd000 + $800]
- ld [sbe47], a
- pop af
- ld [rSVBK], a
- call CloseSRAM
- ret
-
-Function170881: ; 170881 (5c:4881)
- ld a, BANK(sbe47)
- call GetSRAMBank
- ld a, [rSVBK]
- push af
- ld a, $3
- ld [rSVBK], a
- ld a, [sbe47]
- ld [wd000 + $800], a
- pop af
- ld [rSVBK], a
- call CloseSRAM
- ret
-
-Function17089a: ; 17089a
- ld a, [wSaveFileExists]
- 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
-
-CheckMobileEventIndex: ; 1708b9 (5c:48b9) something to do with GS Ball
- ld a, BANK(sMobileEventIndex)
- call GetSRAMBank
- ld a, [sMobileEventIndex]
- 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
-.loop
- ld a, [hli]
- cp EGG
- jr nz, .not_egg
- push hl
- ld hl, PartyMonOT ; wddff (aliases: PartyMonOT)
- ld de, $6
- ld a, b
- and a
- jr z, .skip
-.loop2
- add hl, de
- dec a
- jr nz, .loop2
-.skip
- 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
-.not_egg
- inc b
- dec c
- jr nz, .loop
- ret
-; 1709a4 (5c:49a4)
-
-String_1709a4: ; 1709a4
- db "なぞナゾ@@"
-
-Function1709aa: ; 1709aa (5c:49aa)
- ld a, [rSVBK]
- push af
- ld a, BANK(w3_d090)
- ld [rSVBK], a
- ld a, [w3_d090]
- ld [ScriptVar], a
- pop af
- ld [rSVBK], a
- ret
-
-Function1709bb: ; 1709bb (5c:49bb)
- xor a
- ld [ScriptVar], a
- ld a, $5
- call GetSRAMBank
- ld a, [$a800]
- call CloseSRAM
- cp 6
- jr nc, .invalid
- 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]
-
-.invalid
- 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
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -6,7 +6,7 @@
call DisableLCD
ld hl, VTiles2
- ld bc, $310
+ ld bc, $31 tiles
xor a
call ByteFill
@@ -61,7 +61,7 @@
ld hl, MobileSelectGFX
ld de, VTiles0 tile $30
- ld bc, $200
+ ld bc, $20 tiles
call CopyBytes
ld a, 1
@@ -69,12 +69,12 @@
ld hl, HaveWantGFX
ld de, VTiles2
- ld bc, $800
+ ld bc, $80 tiles
call CopyBytes
ld hl, HaveWantGFX + $800
ld de, VTiles1
- ld bc, $100
+ ld bc, $10 tiles
call CopyBytes
xor a
@@ -226,46 +226,48 @@
ret
; 17d0b3
-Function17d0b3: ; 17d0b3
-.asm_17d0b3
+CheckStringForErrors_IgnoreTerminator: ; 17d0b3
+; Find control chars
+.loop
ld a, [de]
inc de
and a
- jr z, .asm_17d0ee
- cp $60
- jr nc, .asm_17d0ee
- cp $4e
- jr z, .asm_17d0ee
- cp $50
- jr z, .asm_17d0ee
+ jr z, .next
+ cp "<DEXEND>" + 1
+ jr nc, .next
+ cp "<NEXT>"
+ jr z, .next
+ cp "@"
+ jr z, .next
+
cp $5
- jr c, .asm_17d0ec
- cp $14
- jr c, .asm_17d0ee
+ jr c, .end
+ cp "<PLAY_G>"
+ jr c, .next
cp $19
- jr c, .asm_17d0ec
+ jr c, .end
cp $1d
- jr c, .asm_17d0ee
- cp $26
- jr c, .asm_17d0ec
+ jr c, .next
+ cp "%" + 1
+ jr c, .end
cp $35
- jr c, .asm_17d0ee
- cp $3a
- jr c, .asm_17d0ec
- cp $3f
- jr c, .asm_17d0ee
- cp $40
- jr c, .asm_17d0ec
- cp $49
- jr c, .asm_17d0ee
+ jr c, .next
+ cp "<GREEN>" + 1
+ jr c, .end
+ cp "<ENEMY>"
+ jr c, .next
+ cp "<ENEMY>" + 1
+ jr c, .end
+ cp "<MOM>"
+ jr c, .next
-.asm_17d0ec
+.end
scf
ret
-.asm_17d0ee
+.next
dec c
- jr nz, .asm_17d0b3
+ jr nz, .loop
and a
ret
; 17d0f3
@@ -380,22 +382,22 @@
ret
; 17d1e1
-Function17d1e1: ; 17d1e1
-.asm_17d1e1
+CheckStringContainsLessThanBNextCharacters: ; 17d1e1
+.loop
ld a, [de]
inc de
- cp $4e
- jr nz, .asm_17d1ea
+ cp "<NEXT>"
+ jr nz, .next_char
dec b
- jr z, .asm_17d1ef
+ jr z, .done
-.asm_17d1ea
+.next_char
dec c
- jr nz, .asm_17d1e1
+ jr nz, .loop
and a
ret
-.asm_17d1ef
+.done
scf
ret
; 17d1f1
@@ -440,18 +442,18 @@
Special_Menu_ChallengeExplanationCancel: ; 17d224
ld a, [ScriptVar]
and a
- jr nz, .asm_17d234
+ jr nz, .English
ld a, $4
ld [ScriptVar], a
ld hl, MenuDataHeader_17d26a ; Japanese Menu, where you can choose 'News' as an option
- jr .asm_17d23c
+ jr .Load_Interpret
-.asm_17d234
+.English
ld a, $4
ld [ScriptVar], a
ld hl, MenuDataHeader_ChallengeExplanationCancel ; English Menu
-.asm_17d23c
+.Load_Interpret
call LoadMenuDataHeader
call Function17d246
call WriteBackup
@@ -460,25 +462,25 @@
Function17d246: ; 17d246
call InterpretMenu2
- jr c, .asm_17d264
+ jr c, .Exit
ld a, [ScriptVar]
cp $5
- jr nz, .asm_17d25d
+ jr nz, .UseMenuSelection2
ld a, [MenuSelection2]
cp $3
ret z
- jr c, .asm_17d25d
+ jr c, .UseMenuSelection2
dec a
- jr .asm_17d260
+ jr .LoadToScriptVar
-.asm_17d25d
+.UseMenuSelection2
ld a, [MenuSelection2]
-.asm_17d260
+.LoadToScriptVar
ld [ScriptVar], a
ret
-.asm_17d264
+.Exit
ld a, $4
ld [ScriptVar], a
ret
@@ -494,8 +496,8 @@
MenuData2_17d272: ; 17d272
db $a0 ; flags
db 4
- db "ニュース", $1f, "よみこむ@"
- db "ニュース", $1f, "みる@"
+ db "ニュース¯よみこむ@"
+ db "ニュース¯みる@"
db "せつめい@"
db "やめる@"
; 17d28f
@@ -633,27 +635,27 @@
call DisableLCD
ld hl, VTiles1 tile $6e
ld de, $c608
- ld bc, $0010
+ ld bc, 1 tiles
call CopyBytes
ld a, $1
ld [rVBK], a
ld hl, PokemonNewsGFX
ld de, VTiles1
- ld bc, $0480
+ ld bc, $48 tiles
call CopyBytes
xor a
ld hl, VTiles2 tile $7f
- ld bc, $0010
+ ld bc, 1 tiles
call ByteFill
ld hl, $c608
ld de, VTiles1 tile $6e
- ld bc, $0010
+ ld bc, 1 tiles
call CopyBytes
xor a
ld [rVBK], a
ld hl, GFX_17eb7e
ld de, VTiles2 tile $60
- ld bc, $0010
+ ld bc, 1 tiles
call CopyBytes
call EnableLCD
call Function17d60b
@@ -681,21 +683,21 @@
call DisableLCD
ld hl, VTiles1 tile $6e
ld de, $c608
- ld bc, $0010
+ ld bc, 1 tiles
call CopyBytes
ld a, $1
ld [rVBK], a
ld hl, PokemonNewsGFX
ld de, VTiles1
- ld bc, $0480
+ ld bc, $48 tiles
call CopyBytes
xor a
ld hl, VTiles2 tile $7f
- ld bc, $0010
+ ld bc, 1 tiles
call ByteFill
ld hl, $c608
ld de, VTiles1 tile $6e
- ld bc, $0010
+ ld bc, 1 tiles
call CopyBytes
xor a
ld [rVBK], a
--- a/sram.asm
+++ b/sram.asm
@@ -143,20 +143,21 @@
sCrystalData::
ds wCrystalDataEnd - wCrystalData
sMobileEventIndexBackup:: ds 1
-sSaveType:: ds 1
+
+SECTION "SRAM Battle Tower", SRAM, BANK [1]
+; data of the BattleTower must be in SRAM because you can save and leave between battles
+sBattleTowerChallengeState:: ds 1
; 0: normal
; 2: battle tower
-; data of the BattleTower must be in SRAM because you can save and leave between battles
sBattleTower:: ; be46
-sNrOfBeatenBattleTowerTrainers::
-sbe46:: ds 1
+sNrOfBeatenBattleTowerTrainers:: ds 1
sbe47:: ds 1
; The 7 trainers of the BattleTower are saved here, so nobody appears more than once
sBTTrainers:: ; sbe48
ds 7
sbe4f:: ds 1
-sbe50:: ds 1
+sBattleTowerReward:: ds 1
; Pkmn of previous trainer
sBTPkmnOfTrainers:: ; 0xbe51
sBTPkmnPrevTrainer1::
--- a/wram.asm
+++ b/wram.asm
@@ -2976,11 +2976,17 @@
; d1e0
ds $20
; d200
-BT_TrainerTextIndex::
- ds $be
-w3_d2be:: ds 1
+BT_TrainerTextIndex:: ds 2
+w3_d202:: battle_tower_struct w3_d202
+w3_d2e2:: battle_tower_struct w3_d2e2
+w3_d3c2:: battle_tower_struct w3_d3c2
+w3_d4a2:: battle_tower_struct w3_d4a2
+w3_d582:: battle_tower_struct w3_d582
+w3_d662:: battle_tower_struct w3_d662
+w3_d742:: battle_tower_struct w3_d742
+; d822
+ ds -$22
-SECTION "WRAM 3 part 2", WRAMX [$d800], BANK [3]
wBTChoiceOfLvlGroup::
w3_d800:: ds $400
w3_dc00:: ds $168