added 'wBT_OTTempCopy'-label and the data structure that comes after

This commit is contained in:
JimB16
2015-08-31 14:31:13 +02:00
parent 051d9e416d
commit bcc11712a5
6 changed files with 59 additions and 34 deletions

View File

@@ -108,3 +108,7 @@ const_value = 1
const MOM_ITEM const MOM_ITEM
const MOM_DOLL const MOM_DOLL
BATTLETOWER_NROFPKMNS EQU 3
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLETOWER_NROFTRAINERS EQU 7

View File

@@ -35,9 +35,11 @@ ELSE
ENDC ENDC
jr nc, .asm_1f8022 jr nc, .asm_1f8022
ld b, a ld b, a
ld a, BANK(sbe46) ld a, BANK(sbe46)
call GetSRAMBank call GetSRAMBank
ld c, $7
ld c, BATTLETOWER_NROFTRAINERS
ld hl, sBTTrainers ld hl, sBTTrainers
.asm_1f803a .asm_1f803a
ld a, [hli] ld a, [hli]
@@ -45,6 +47,7 @@ ENDC
jr z, .asm_1f8022 jr z, .asm_1f8022
dec c dec c
jr nz, .asm_1f803a ; c <= 7 initialise all 7 trainers? jr nz, .asm_1f803a ; c <= 7 initialise all 7 trainers?
ld hl, sBTTrainers ld hl, sBTTrainers
ld a, [sbe46] ld a, [sbe46]
ld c, a ld c, a
@@ -53,18 +56,22 @@ ENDC
add hl, bc add hl, bc
ld [hl], a ld [hl], a
call CloseSRAM call CloseSRAM
push af push af
; Copy name (10 bytes) and class (1 byte) of trainer
ld hl, BattleTowerTrainers ld hl, BattleTowerTrainers
ld bc, 11 ld bc, 11
call AddNTimes call AddNTimes
ld bc, 11 ld bc, 11
call CopyBytes call CopyBytes
call Function_LoadRandomBattleTowerPkmn call Function_LoadRandomBattleTowerPkmn
pop af pop af
ld hl, BattleTowerTrainerData ld hl, BattleTowerTrainerData
ld bc, $0024 ld bc, BATTLETOWER_TRAINERDATALENGTH
call AddNTimes call AddNTimes
ld bc, $0024 ld bc, BATTLETOWER_TRAINERDATALENGTH
.asm_1f8070 .asm_1f8070
ld a, BANK(BattleTowerTrainerData) ld a, BANK(BattleTowerTrainerData)
call GetFarByte call GetFarByte
@@ -78,10 +85,9 @@ ENDC
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret
; 1f8081
Function_LoadRandomBattleTowerPkmn: ; 1f8081 Function_LoadRandomBattleTowerPkmn: ; 1f8081
ld c, $3 ld c, BATTLETOWER_NROFPKMNS
.loop .loop
push bc push bc
ld a, BANK(sBTPkmnPrevTrainer1) ld a, BANK(sBTPkmnPrevTrainer1)
@@ -156,6 +162,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
ld bc, $3b ld bc, $3b
call CopyBytes call CopyBytes
ld a, [wd265] ld a, [wd265]
push af push af
push de push de
@@ -172,6 +179,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
pop de pop de
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
pop de pop de
pop af pop af
ld [wd265], a ld [wd265], a

View File

@@ -142,7 +142,7 @@ SpecialsPointers:: ; c029
add_special Function170215 add_special Function170215
add_special Function1704e1 add_special Function1704e1
add_special Function17021d add_special Function17021d
add_special Function_LoadOpponentTrainerAndPokemons170b44 add_special Function_LoadOpponentTrainerAndPokemonsWithOTSprite
add_special Function11ba38 add_special Function11ba38
add_special SpecialCheckForBattleTowerRules add_special SpecialCheckForBattleTowerRules
add_special Function117656 add_special Function117656

View File

@@ -21,7 +21,7 @@ Script_BattleRoom: ; 0x9f421
; beat all 7 opponents in a row ; beat all 7 opponents in a row
Script_BattleRoomLoop: ; 0x9f425 Script_BattleRoomLoop: ; 0x9f425
writebyte $2 writebyte $2
special Function_LoadOpponentTrainerAndPokemons170b44 special Function_LoadOpponentTrainerAndPokemonsWithOTSprite
appear $2 appear $2
warpsound warpsound
waitbutton waitbutton

View File

@@ -22877,54 +22877,55 @@ Function17024d: ; 17024d
; Initialise the BattleTower-Trainer and his Pkmn ; Initialise the BattleTower-Trainer and his Pkmn
Function1702b7: ; 1702b7 Function1702b7: ; 1702b7
call Function1704a2 call Function1704a2
ld de, $c643 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
ld c, $b ld c, $b
callba Function17d073 callba Function17d073
jr nc, .asm_1702db jr nc, .asm_1702db
ld a, [BT_OTTempCopy + 11]
ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1]
ld [wd265], a ld [wd265], a
call GetPokemonName call GetPokemonName
ld l, e ld l, e
ld h, d ld h, d
ld de, $c643 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
.asm_1702db .asm_1702db
ld de, $c67e ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
ld c, $b ld c, $b
callba Function17d073 callba Function17d073
jr nc, .asm_1702fc jr nc, .asm_1702fc
ld a, [$c64e] ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e]
ld [wd265], a ld [wd265], a
call GetPokemonName call GetPokemonName
ld l, e ld l, e
ld h, d ld h, d
ld de, $c67e ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
.asm_1702fc .asm_1702fc
ld de, $c686 + 51 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
ld c, $b ld c, $b
callba Function17d073 callba Function17d073
jr nc, .asm_17031d jr nc, .asm_17031d
ld a, [$c689] ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689]
ld [wd265], a ld [wd265], a
call GetPokemonName call GetPokemonName
ld l, e ld l, e
ld h, d ld h, d
ld de, $c686 + 51 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
.asm_17031d .asm_17031d
ld a, $50 ld a, $50
ld [$c64d], a ld [wBT_OTTempCopy + wBT_OTTempCopy_45], a ; $c64d
ld [$c688], a ld [wBT_OTTempCopy + wBT_OTTempCopy_80], a ; $c688
ld [$c68a + 57], a ld [wBT_OTTempCopy + wBT_OTTempCopy_BB], a ; $c68a + 57 = $c6c3
call Function170c98 call Function170c98
ld de, BT_OTTempCopy ld de, wBT_OTTempCopy
ld c, $a ld c, $a
callba Function17d073 callba Function17d073
jr nc, .asm_17033d jr nc, .asm_17033d
@@ -22932,7 +22933,7 @@ Function1702b7: ; 1702b7
jr .asm_170340 jr .asm_170340
.asm_17033d .asm_17033d
ld hl, BT_OTTempCopy ; 0xc608 ld hl, wBT_OTTempCopy ; 0xc608
.asm_170340 .asm_170340
ld de, wd26b ld de, wd26b
@@ -22940,20 +22941,20 @@ Function1702b7: ; 1702b7
call CopyBytes call CopyBytes
ld a, $50 ld a, $50
ld [de], a ld [de], a
ld hl, BT_OTTempCopy + $a ld hl, wBT_OTTempCopy + wBT_OTTempCopy_TrainerClass
ld a, [hli] ld a, [hli]
ld [OtherTrainerClass], a ld [OtherTrainerClass], a
ld a, $ea ld a, $ea
ld [BGMapBuffer], a ld [BGMapBuffer], a
ld a, $d3 ld a, $d3
ld [wcd21], a ld [wcd21], a
ld de, OTPartyMon1Species
ld bc, OTPartyCount
ld a, $3 ; Number of Pkmn the BattleTower-Trainer has
ld [bc], a
inc bc
; Copy Pkmn into Memory from the address in hl ; 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 .asm_170367
push af push af
ld a, [hl] ld a, [hl]
@@ -24182,7 +24183,7 @@ Function170b16: ; 170b16 (5c:4b16)
ld [ScriptVar], a ld [ScriptVar], a
ret ret
Function_LoadOpponentTrainerAndPokemons170b44: ; 0x170b44 Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44
callba Function_LoadOpponentTrainerAndPokemons callba Function_LoadOpponentTrainerAndPokemons
ld a, [rSVBK] ld a, [rSVBK]
push af push af
@@ -24199,6 +24200,9 @@ Function_LoadOpponentTrainerAndPokemons170b44: ; 0x170b44
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [wcd49], a ld [wcd49], a
; Load sprite of the opponent trainer
; because s/he is chosen randomly and appears out of nowhere
ld a, [ScriptVar] ld a, [ScriptVar]
dec a dec a
sla a sla a

View File

@@ -443,6 +443,7 @@ SECTION "Battle", WRAM0
wMisc:: wMisc::
wBattle:: wBattle::
wBT_OTTempCopy:: ; also used to copy the data of the BattleTower-Trainer and the 3 Pkmn
wc608:: wc608::
wEnemyMoveStruct:: ds MOVE_LENGTH ; c608 wEnemyMoveStruct:: ds MOVE_LENGTH ; c608
@@ -884,13 +885,21 @@ wMiscEnd::
wc7e8:: ds 24 wc7e8:: ds 24
RSSET $c608 ;$c000+(wc608-wc000) ; compute the address through doesn't seem to work RSSET 0 ; Offsets for wBT_OTTempCopy:: @ $c608
BT_OTTempCopy RW 1 wBT_OTTempCopy_0 RB $a ; $c608
str_tData RB 256 wBT_OTTempCopy_TrainerClass RB $1 ; $c608 + $a = $c612
str_bCount RB 1 wBT_OTTempCopy_Pkmn1 RB $30 ; $c608 + $b = $c613
str_SIZEOF RB 0 wBT_OTTempCopy_Pkmn1Name RB $A ; $c608 + $3b = $c643
wBT_OTTempCopy_45 RB $1 ; $c608 + $45 = $c64d
wBT_OTTempCopy_Pkmn2 RB $30 ; $c608 + $46 = $c64e
wBT_OTTempCopy_Pkmn2Name RB $A ; $c608 + $76 = $c67e
wBT_OTTempCopy_80 RB $1 ; $c608 + $80 = $c688
wBT_OTTempCopy_Pkmn3 RB $30 ; $c608 + $81 = $c689
wBT_OTTempCopy_Pkmn3Name RB $A ; $c608 + $b1 = $c6b9
wBT_OTTempCopy_BB RB $1 ; $c608 + $bb = $c6c3
;str_SIZEOF RB 0
GLOBAL BT_OTTempCopy GLOBAL wBT_OTTempCopy_TrainerClass, wBT_OTTempCopy_Pkmn1, wBT_OTTempCopy_Pkmn1Name, wBT_OTTempCopy_45, wBT_OTTempCopy_Pkmn2, wBT_OTTempCopy_Pkmn2Name, wBT_OTTempCopy_80, wBT_OTTempCopy_Pkmn3, wBT_OTTempCopy_Pkmn3Name, wBT_OTTempCopy_BB