added/renamed constants and labels

This commit is contained in:
JimB16 2015-09-01 06:26:31 +02:00
parent bcc11712a5
commit d6a4dada40
6 changed files with 65 additions and 43 deletions

View File

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

View File

@ -36,7 +36,7 @@ ENDC
jr nc, .asm_1f8022 jr nc, .asm_1f8022
ld b, a ld b, a
ld a, BANK(sbe46) ld a, BANK(sNrOfBeatenBattleTowerTrainers)
call GetSRAMBank call GetSRAMBank
ld c, BATTLETOWER_NROFTRAINERS ld c, BATTLETOWER_NROFTRAINERS
@ -49,12 +49,13 @@ ENDC
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, [sNrOfBeatenBattleTowerTrainers]
ld c, a ld c, a
ld a, b ld a, b
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld [hl], a ld [hl], a
call CloseSRAM call CloseSRAM
push af push af
@ -82,10 +83,13 @@ ENDC
ld a, b ld a, b
or c or c
jr nz, .asm_1f8070 jr nz, .asm_1f8070
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret
Function_LoadRandomBattleTowerPkmn: ; 1f8081 Function_LoadRandomBattleTowerPkmn: ; 1f8081
ld c, BATTLETOWER_NROFPKMNS ld c, BATTLETOWER_NROFPKMNS
.loop .loop
@ -96,7 +100,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
.FindARandomBattleTowerPkmn .FindARandomBattleTowerPkmn
; From Which LevelGroup are the Pkmn loaded ; From Which LevelGroup are the Pkmn loaded
; a = 1..10 ; a = 1..10
ld a, [$d800] ld a, [wBTChoiceOfLvlGroup] ; [$d800]
dec a dec a
ld hl, BattleTowerMons ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1 ld bc, BattleTowerMons2 - BattleTowerMons1
@ -117,7 +121,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
; Check if Pkmn was already loaded before ; Check if Pkmn was already loaded before
; Check current and the 2 previous teams ; Check current and the 2 previous teams
; includes check if item is double at the current team ; includes check if item is double at the current team
ld bc, $3b ld bc, BATTLETOWER_PKMNSTRUCTLENGTH + $b
call AddNTimes call AddNTimes
ld a, [hli] ld a, [hli]
ld b, a ld b, a
@ -160,17 +164,17 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
cp b cp b
jr z, .FindARandomBattleTowerPkmn jr z, .FindARandomBattleTowerPkmn
ld bc, $3b ld bc, BATTLETOWER_PKMNSTRUCTLENGTH + $b
call CopyBytes call CopyBytes
ld a, [wd265] ld a, [wd265]
push af push af
push de push de
ld hl, -$3b ld hl, - (BATTLETOWER_PKMNSTRUCTLENGTH + $b)
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld [wd265], a ld [wd265], a
ld bc, $0030 ld bc, BATTLETOWER_PKMNSTRUCTLENGTH
add hl, bc add hl, bc
push hl push hl
call GetPokemonName call GetPokemonName

View File

@ -34,8 +34,8 @@ Script_BattleRoomLoop: ; 0x9f425
special FadeBlackBGMap special FadeBlackBGMap
reloadmap reloadmap
if_not_equal $0, UnknownScript_0x9f4c2 if_not_equal $0, UnknownScript_0x9f4c2
copybytetovar wcf64 copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64
if_equal $7, Script_BeatenAllTrainers if_equal BATTLETOWER_NROFTRAINERS, Script_BeatenAllTrainers
applymovement $2, MovementData_0x9e597 applymovement $2, MovementData_0x9e597
warpsound warpsound
disappear $2 disappear $2

View File

@ -27,7 +27,7 @@ Function_0x9f5cb:
ld a, 3 ld a, 3
ld [rSVBK], a ld [rSVBK], a
ld a, [w3_d800] ld a, [wBTChoiceOfLvlGroup]
ld [ScriptVar], a ld [ScriptVar], a
pop af pop af

View File

@ -9728,12 +9728,12 @@ Function118903: ; 118903 (46:4903)
ld [wcd3c], a ld [wcd3c], a
call Function119ed8 call Function119ed8
jp Function119e2e jp Function119e2e
; 11891c (46:491c)
Function11891c: ; 11891c Function11891c: ; 11891c
call Function118b42 call Function118b42
jp Function119e2e jp Function119e2e
; 118922
Function118922: ; 118922 Function118922: ; 118922
ld a, [wcd38] ld a, [wcd38]
@ -9770,13 +9770,13 @@ Function118936:
ld a, [StatusFlags] ld a, [StatusFlags]
bit 6, a bit 6, a
jr nz, .asm_11896b jr nz, .asm_11896b
ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels
ld a, 5 ; 4 levels to choose from, including 'Cancel'-option ld a, 5 ; 4 levels to choose from, including 'Cancel'-option
jr .asm_118970 jr .asm_118970
.asm_11896b .asm_11896b
ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels
ld a, 11 ; 10 levels to choose from, including 'Cancel'-option ld a, 11 ; 10 levels to choose from, including 'Cancel'-option
.asm_118970 .asm_118970
ld [wcd4a], a ld [wcd4a], a
@ -9915,7 +9915,8 @@ Function118982:
ld a, $0 ld a, $0
ld [wcd46], a ld [wcd46], a
ret ret
; 118a54
Function118a54: ; 118a54 Function118a54: ; 118a54
ld a, [wcd55] ld a, [wcd55]
@ -22852,13 +22853,13 @@ Function17024d: ; 17024d
ld [ScriptVar], a ld [ScriptVar], a
and a and a
jr nz, .asm_1702a9 jr nz, .asm_1702a9
ld a, BANK(sbe46) ld a, BANK(sNrOfBeatenBattleTowerTrainers)
call GetSRAMBank call GetSRAMBank
ld a, [sbe46] ld a, [sNrOfBeatenBattleTowerTrainers]
ld [wcf64], a ld [wNrOfBeatenBattleTowerTrainers], a ; wcf64
call CloseSRAM call CloseSRAM
ld hl, StringBuffer3 ld hl, StringBuffer3
ld a, [wcf64] ld a, [wNrOfBeatenBattleTowerTrainers] ; wcf64
add $f7 add $f7
ld [hli], a ld [hli], a
ld a, $50 ld a, $50
@ -22872,13 +22873,13 @@ Function17024d: ; 17024d
ld a, $1 ld a, $1
ld [wcf63], a ld [wcf63], a
ret ret
; 1702b7
; Initialise the BattleTower-Trainer and his Pkmn ; Initialise the BattleTower-Trainer and his Pkmn
Function1702b7: ; 1702b7 Function1702b7: ; 1702b7
call Function1704a2 call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy
ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643
ld c, $b ld c, PKMN_NAME_LENGTH
callba Function17d073 callba Function17d073
jr nc, .asm_1702db jr nc, .asm_1702db
@ -22893,7 +22894,7 @@ Function1702b7: ; 1702b7
.asm_1702db .asm_1702db
ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e
ld c, $b ld c, PKMN_NAME_LENGTH
callba Function17d073 callba Function17d073
jr nc, .asm_1702fc jr nc, .asm_1702fc
ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e] ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e]
@ -22907,7 +22908,7 @@ Function1702b7: ; 1702b7
.asm_1702fc .asm_1702fc
ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9 ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9
ld c, $b ld c, PKMN_NAME_LENGTH
callba Function17d073 callba Function17d073
jr nc, .asm_17031d jr nc, .asm_17031d
ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689] ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689]
@ -22961,7 +22962,7 @@ Function1702b7: ; 1702b7
ld [bc], a ld [bc], a
inc bc inc bc
push bc push bc
ld bc, $0030 ld bc, BATTLETOWER_PKMNSTRUCTLENGTH
call CopyBytes call CopyBytes
push de push de
ld a, [BGMapBuffer] ld a, [BGMapBuffer]
@ -23167,16 +23168,18 @@ Unknown_17047e:
db $0f, $05, $14, $07 db $0f, $05, $14, $07
db $05, $05, $11, $0c db $05, $05, $11, $0c
db $0c, $06, $06, $04 db $0c, $06, $06, $04
; 1704a2
Function1704a2: ; 1704a2
CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2
; copy the BattleTower-Trainer data that lies at 'BT_OTrainer' to 'wBT_OTTempCopy'
ld a, [rSVBK] ld a, [rSVBK]
push af push af
ld a, $3 ld a, $3
ld [rSVBK], a ld [rSVBK], a
ld hl, $d100 ; this is NOT LYOverrides ld hl, BT_OTrainer ; $d100
ld de, $c608 ld de, wBT_OTTempCopy ; $c608
ld bc, BT_OTrainerEnd - BT_OTrainer 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 call CopyBytes
pop af pop af
ld [rSVBK], a ld [rSVBK], a
@ -23184,7 +23187,7 @@ Function1704a2: ; 1704a2
call GetSRAMBank call GetSRAMBank
ld a, $2 ld a, $2
ld [s1_be45], a ld [s1_be45], a
ld hl, sbe46 ld hl, sNrOfBeatenBattleTowerTrainers
inc [hl] inc [hl]
call CloseSRAM call CloseSRAM
Function1704c9: Function1704c9:
@ -23260,14 +23263,17 @@ Jumptable_17051f: ; 17051f
Function170525: ; 170525 Function170525: ; 170525
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, $a89c ld hl, $a89c
ld de, StringBuffer3 ld de, StringBuffer3
ld bc, $0016 ld bc, $0016
call CopyBytes call CopyBytes
ld hl, $a8b2 ld hl, $a8b2
ld de, $c608 ld de, $c608
ld bc, $0096 ld bc, $0096
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
hlcoord 1, 1 hlcoord 1, 1
ld de, StringBuffer3 ld de, StringBuffer3
@ -23285,10 +23291,12 @@ Function170525: ; 170525
call Function1705f0 call Function1705f0
jr Function1705b2 jr Function1705b2
Function170571: Function170571:
call Function32f9 call Function32f9
call Function1705b2 call Function1705b2
Function170577: Function170577:
ld hl, hJoyPressed ld hl, hJoyPressed
ld a, [hl] ld a, [hl]
@ -23530,7 +23538,7 @@ Jumptable_170696: ; 170696 (5c:4696)
dw Function17081d ; 0x17 dw Function17081d ; 0x17
dw Function170ae8 ; 0x18 dw Function170ae8 ; 0x18
dw Function170b16 ; 0x19 dw Function170b16 ; 0x19
dw Function1706d6 ; 0x1a dw ResetBattleTowerTrainersSRAM ; 0x1a
dw Function1706ee ; 0x1b dw Function1706ee ; 0x1b
dw Function17071b ; 0x1c dw Function17071b ; 0x1c
dw Function170729 ; 0x1d dw Function170729 ; 0x1d
@ -23539,21 +23547,26 @@ Jumptable_170696: ; 170696 (5c:4696)
; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) ; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
Function1706d6: ; 1706d6 (5c:46d6) ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6)
ld a, BANK(sBTTrainers) ld a, BANK(sBTTrainers)
call GetSRAMBank call GetSRAMBank
ld a, $ff ld a, $ff
ld hl, sBTTrainers ld hl, sBTTrainers
ld bc, $7 ld bc, BATTLETOWER_NROFTRAINERS
call ByteFill call ByteFill
xor a xor a
ld [sbe46], a ld [sNrOfBeatenBattleTowerTrainers], a
call CloseSRAM call CloseSRAM
ret ret
Function1706ee: ; 1706ee (5c:46ee) Function1706ee: ; 1706ee (5c:46ee)
ld a, BANK(sbe50) ld a, BANK(sbe50)
call GetSRAMBank call GetSRAMBank
ld a, [sbe50] ld a, [sbe50]
call CloseSRAM call CloseSRAM
ld [ScriptVar], a ld [ScriptVar], a

View File

@ -443,7 +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 wBT_OTTempCopy:: ; 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
@ -886,7 +886,7 @@ wc7e8:: ds 24
RSSET 0 ; Offsets for wBT_OTTempCopy:: @ $c608 RSSET 0 ; Offsets for wBT_OTTempCopy:: @ $c608
wBT_OTTempCopy_0 RB $a ; $c608 wBT_OTTempCopy_0 RB $A ; $c608
wBT_OTTempCopy_TrainerClass RB $1 ; $c608 + $a = $c612 wBT_OTTempCopy_TrainerClass RB $1 ; $c608 + $a = $c612
wBT_OTTempCopy_Pkmn1 RB $30 ; $c608 + $b = $c613 wBT_OTTempCopy_Pkmn1 RB $30 ; $c608 + $b = $c613
wBT_OTTempCopy_Pkmn1Name RB $A ; $c608 + $3b = $c643 wBT_OTTempCopy_Pkmn1Name RB $A ; $c608 + $3b = $c643
@ -897,7 +897,6 @@ wBT_OTTempCopy_80 RB $1 ; $c608 + $80 = $c688
wBT_OTTempCopy_Pkmn3 RB $30 ; $c608 + $81 = $c689 wBT_OTTempCopy_Pkmn3 RB $30 ; $c608 + $81 = $c689
wBT_OTTempCopy_Pkmn3Name RB $A ; $c608 + $b1 = $c6b9 wBT_OTTempCopy_Pkmn3Name RB $A ; $c608 + $b1 = $c6b9
wBT_OTTempCopy_BB RB $1 ; $c608 + $bb = $c6c3 wBT_OTTempCopy_BB RB $1 ; $c608 + $bb = $c6c3
;str_SIZEOF RB 0
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 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
@ -1191,6 +1190,7 @@ CurSpecies:: ; cf60
wcf61:: ds 2 wcf61:: ds 2
wcf63:: ds 1 wcf63:: ds 1
wNrOfBeatenBattleTowerTrainers::
wcf64:: ds 1 wcf64:: ds 1
IF !DEF(CRYSTAL11) IF !DEF(CRYSTAL11)
wPokedexStatus:: wPokedexStatus::
@ -2621,9 +2621,11 @@ SECTION "WRAM 3", WRAMX, BANK [3]
ds $100 ds $100
BT_OTrainer:: BT_OTrainer::
w3_d100:: ; BattleTower OpponentTrainer-Data (lengt = 0xe0) w3_d100:: ; BattleTower OpponentTrainer-Data (length = 0xe0 = $a + $1 + 3*$3b + $24)
ds $6 BT_OTrainer_Name::
ds $5 ds $A
BT_OTrainer_TrainerClass::
ds $1
BT_OTPkmn1:: ; w3_d10b BT_OTPkmn1:: ; w3_d10b
ds $1 ds $1
BT_OTPkmn1Item:: BT_OTPkmn1Item::
@ -2642,6 +2644,7 @@ BT_OTrainerEnd::
ds $620 ds $620
wBTChoiceOfLvlGroup::
w3_d800:: ds 1 w3_d800:: ds 1
@ -2813,6 +2816,7 @@ s1_be45:: ds 1
; data of the BattleTower must be in SRAM because you can save and leave between battles ; data of the BattleTower must be in SRAM because you can save and leave between battles
sBattleTower:: ; be46 sBattleTower:: ; be46
sNrOfBeatenBattleTowerTrainers::
sbe46:: ds 1 sbe46:: ds 1
sbe47:: ds 1 sbe47:: ds 1
; The 7 trainers of the BattleTower are saved here, so nobody appears more than once ; The 7 trainers of the BattleTower are saved here, so nobody appears more than once