move battle tower mon handling asm into battle_tower.asm

This commit is contained in:
yenatch 2013-08-29 23:27:17 -04:00
parent 7201ea8f0a
commit fd74b4d379
2 changed files with 251 additions and 250 deletions

251
main.asm
View File

@ -72632,256 +72632,7 @@ INCBIN "baserom.gbc", $1f4018, $1f636a - $1f4018
SECTION "bank7E",ROMX,BANK[$7E]
Function1f8000: ; 1f8000
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
xor a
ld hl, $d100
ld bc, $00e0
call ByteFill
ld a, $ff
ld [$d10c], a
ld [$d147], a
ld [$d182], a
ld de, $d100
ld a, [hRandomAdd]
ld b, a
.asm_1f8022
call RNG
ld a, [hRandomAdd]
add b
ld b, a
and $1f
cp $15
jr nc, .asm_1f8022
ld b, a
ld a, $1
call GetSRAMBank
ld c, $7
ld hl, $be48
.asm_1f803a
ld a, [hli]
cp b
jr z, .asm_1f8022
dec c
jr nz, .asm_1f803a
ld hl, $be48
ld a, [$be46]
ld c, a
ld a, b
ld b, 0
add hl, bc
ld [hl], a
call CloseSRAM
push af
ld hl, BattleTowerTrainers
ld bc, 11
call AddNTimes
ld bc, 11
call CopyBytes
call Function1f8081
pop af
ld hl, Function1f8000
ld bc, $0024
call AddNTimes
ld bc, $0024
.asm_1f8070
ld a, $7c
call GetFarByte
ld [de], a
inc hl
inc de
dec bc
ld a, b
or c
jr nz, .asm_1f8070
pop af
ld [rSVBK], a
ret
; 1f8081
Function1f8081: ; 1f8081
ld c, $3
push bc
ld a, $1
call GetSRAMBank
.asm_1f8089
ld a, [$d800]
dec a
ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1
call AddNTimes
ld a, [hRandomAdd]
ld b, a
.asm_1f8099
call RNG
ld a, [hRandomAdd]
add b
ld b, a
and $1f
cp (BattleTowerMons2 - BattleTowerMons1) / ($3b)
jr nc, .asm_1f8099
ld bc, $3b
call AddNTimes
ld a, [hli]
ld b, a
ld a, [hld]
ld c, a
ld a, [$d10b]
cp b
jr z, .asm_1f8089
ld a, [$d10c]
cp c
jr z, .asm_1f8089
ld a, [$d146]
cp b
jr z, .asm_1f8089
ld a, [$d147]
cp c
jr z, .asm_1f8089
ld a, [$d181]
cp b
jr z, .asm_1f8089
ld a, [$d182]
cp c
jr z, .asm_1f8089
ld a, [$be51]
cp b
jr z, .asm_1f8089
ld a, [$be52]
cp b
jr z, .asm_1f8089
ld a, [$be53]
cp b
jr z, .asm_1f8089
ld a, [$be54]
cp b
jr z, .asm_1f8089
ld a, [$be55]
cp b
jr z, .asm_1f8089
ld a, [$be56]
cp b
jr z, .asm_1f8089
ld bc, $3b
call CopyBytes
ld a, [$d265]
push af
push de
ld hl, -$3b
add hl, de
ld a, [hl]
ld [$d265], a
ld bc, $0030
add hl, bc
push hl
call GetPokemonName
ld h, d
ld l, e
pop de
ld bc, $000b
call CopyBytes
pop de
pop af
ld [$d265], a
pop bc
dec c
jp nz, $4083
ld a, [$be51]
ld [$be54], a
ld a, [$be52]
ld [$be55], a
ld a, [$be53]
ld [$be56], a
ld a, [$d10b]
ld [$be51], a
ld a, [$d146]
ld [$be52], a
ld a, [$d181]
ld [$be53], a
call CloseSRAM
ret
; 1f814e
BattleTowerTrainers: ; 1f814e
db "HANSON@@@@", FISHER
db "SAWYER@@@@", POKEMANIAC
db "MASUDA@@@@", GUITARIST
db "NICKEL@@@@", SCIENTIST
db "OLSON@@@@@", POKEFANM
db "ZABOROWSKI", LASS
db "WRIGHT@@@@", YOUNGSTER
db "ALEXANDER@", HIKER
db "KAWAKAMI@@", TEACHER
db "BICKETT@@@", POKEFANM
db "SAITO@@@@@", KIMONO_GIRL
db "CRAWFORD@@", BOARDER
db "DIAZ@@@@@@", PICNICKER
db "ERICKSON@@", BIKER
db "FAIRFIELD@", JUGGLER
db "HUNTER@@@@", POKEFANF
db "HILL@@@@@@", FIREBREATHER
db "JAVIER@@@@", SWIMMERF
db "KAUFMAN@@@", SWIMMERM
db "LANCASTER@", SKIER
db "McMAHILL@@", CAMPER
db "OBRIEN@@@@", GENTLEMAN
db "FROST@@@@@", BEAUTY
db "MORSE@@@@@", SUPER_NERD
db "YUFUNE@@@@", BLACKBELT_T
db "RAJAN@@@@@", COOLTRAINERF
db "RODRIGUEZ@", OFFICER
db "SANTIAGO@@", PSYCHIC_T
db "STOCK@@@@@", POKEFANM
db "THURMAN@@@", SCIENTIST
db "VALENTINO@", BEAUTY
db "WAGNER@@@@", CAMPER
db "YATES@@@@@", BIRD_KEEPER
db "ANDREWS@@@", PICNICKER
db "BAHN@@@@@@", POKEMANIAC
db "MORI@@@@@@", SCIENTIST
db "BUCKMAN@@@", SAGE
db "COBB@@@@@@", SCHOOLBOY
db "HUGHES@@@@", FISHER
db "ARITA@@@@@", KIMONO_GIRL
db "EASTON@@@@", PSYCHIC_T
db "FREEMAN@@@", CAMPER
db "GIESE@@@@@", LASS
db "HATCHER@@@", GENTLEMAN
db "JACKSON@@@", POKEFANF
db "KAHN@@@@@@", POKEMANIAC
db "LEONG@@@@@", YOUNGSTER
db "MARINO@@@@", TEACHER
db "NEWMAN@@@@", SAILOR
db "NGUYEN@@@@", BLACKBELT_T
db "OGDEN@@@@@", SUPER_NERD
db "PARK@@@@@@", COOLTRAINERF
db "RAINE@@@@@", SWIMMERM
db "SELLS@@@@@", BIRD_KEEPER
db "ROCKWELL@@", BOARDER
db "THORNTON@@", LASS
db "TURNER@@@@", OFFICER
db "VAN DYKE@@", SKIER
db "WALKER@@@@", SCHOOLBOY
db "MEYER@@@@@", SWIMMERF
db "JOHNSON@@@", YOUNGSTER
db "ADAMS@@@@@", GUITARIST
db "SMITH@@@@@", BUG_CATCHER
db "TAJIRI@@@@", BUG_CATCHER
db "BAKER@@@@@", POKEMANIAC
db "COLLINS@@@", SCIENTIST
db "SMART@@@@@", SUPER_NERD
db "DYKSTRA@@@", SWIMMERF
db "EATON@@@@@", BIKER
db "WONG@@@@@@", FIREBREATHER
; 1f8450
BattleTowerMons: ; 1f8450
; 1fc000
INCLUDE "stats/battle_tower.asm"
; 1fb4b6

View File

@ -1,4 +1,254 @@
Function1f8000: ; 1f8000
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
xor a
ld hl, $d100
ld bc, $00e0
call ByteFill
ld a, $ff
ld [$d10c], a
ld [$d147], a
ld [$d182], a
ld de, $d100
ld a, [hRandomAdd]
ld b, a
.asm_1f8022
call RNG
ld a, [hRandomAdd]
add b
ld b, a
and $1f
cp $15
jr nc, .asm_1f8022
ld b, a
ld a, $1
call GetSRAMBank
ld c, $7
ld hl, $be48
.asm_1f803a
ld a, [hli]
cp b
jr z, .asm_1f8022
dec c
jr nz, .asm_1f803a
ld hl, $be48
ld a, [$be46]
ld c, a
ld a, b
ld b, 0
add hl, bc
ld [hl], a
call CloseSRAM
push af
ld hl, BattleTowerTrainers
ld bc, 11
call AddNTimes
ld bc, 11
call CopyBytes
call Function1f8081
pop af
ld hl, Function1f8000
ld bc, $0024
call AddNTimes
ld bc, $0024
.asm_1f8070
ld a, $7c
call GetFarByte
ld [de], a
inc hl
inc de
dec bc
ld a, b
or c
jr nz, .asm_1f8070
pop af
ld [rSVBK], a
ret
; 1f8081
Function1f8081: ; 1f8081
ld c, $3
push bc
ld a, $1
call GetSRAMBank
.asm_1f8089
ld a, [$d800]
dec a
ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1
call AddNTimes
ld a, [hRandomAdd]
ld b, a
.asm_1f8099
call RNG
ld a, [hRandomAdd]
add b
ld b, a
and $1f
cp (BattleTowerMons2 - BattleTowerMons1) / ($3b)
jr nc, .asm_1f8099
ld bc, $3b
call AddNTimes
ld a, [hli]
ld b, a
ld a, [hld]
ld c, a
ld a, [$d10b]
cp b
jr z, .asm_1f8089
ld a, [$d10c]
cp c
jr z, .asm_1f8089
ld a, [$d146]
cp b
jr z, .asm_1f8089
ld a, [$d147]
cp c
jr z, .asm_1f8089
ld a, [$d181]
cp b
jr z, .asm_1f8089
ld a, [$d182]
cp c
jr z, .asm_1f8089
ld a, [$be51]
cp b
jr z, .asm_1f8089
ld a, [$be52]
cp b
jr z, .asm_1f8089
ld a, [$be53]
cp b
jr z, .asm_1f8089
ld a, [$be54]
cp b
jr z, .asm_1f8089
ld a, [$be55]
cp b
jr z, .asm_1f8089
ld a, [$be56]
cp b
jr z, .asm_1f8089
ld bc, $3b
call CopyBytes
ld a, [$d265]
push af
push de
ld hl, -$3b
add hl, de
ld a, [hl]
ld [$d265], a
ld bc, $0030
add hl, bc
push hl
call GetPokemonName
ld h, d
ld l, e
pop de
ld bc, $000b
call CopyBytes
pop de
pop af
ld [$d265], a
pop bc
dec c
jp nz, $4083
ld a, [$be51]
ld [$be54], a
ld a, [$be52]
ld [$be55], a
ld a, [$be53]
ld [$be56], a
ld a, [$d10b]
ld [$be51], a
ld a, [$d146]
ld [$be52], a
ld a, [$d181]
ld [$be53], a
call CloseSRAM
ret
; 1f814e
BattleTowerTrainers: ; 1f814e
db "HANSON@@@@", FISHER
db "SAWYER@@@@", POKEMANIAC
db "MASUDA@@@@", GUITARIST
db "NICKEL@@@@", SCIENTIST
db "OLSON@@@@@", POKEFANM
db "ZABOROWSKI", LASS
db "WRIGHT@@@@", YOUNGSTER
db "ALEXANDER@", HIKER
db "KAWAKAMI@@", TEACHER
db "BICKETT@@@", POKEFANM
db "SAITO@@@@@", KIMONO_GIRL
db "CRAWFORD@@", BOARDER
db "DIAZ@@@@@@", PICNICKER
db "ERICKSON@@", BIKER
db "FAIRFIELD@", JUGGLER
db "HUNTER@@@@", POKEFANF
db "HILL@@@@@@", FIREBREATHER
db "JAVIER@@@@", SWIMMERF
db "KAUFMAN@@@", SWIMMERM
db "LANCASTER@", SKIER
db "McMAHILL@@", CAMPER
db "OBRIEN@@@@", GENTLEMAN
db "FROST@@@@@", BEAUTY
db "MORSE@@@@@", SUPER_NERD
db "YUFUNE@@@@", BLACKBELT_T
db "RAJAN@@@@@", COOLTRAINERF
db "RODRIGUEZ@", OFFICER
db "SANTIAGO@@", PSYCHIC_T
db "STOCK@@@@@", POKEFANM
db "THURMAN@@@", SCIENTIST
db "VALENTINO@", BEAUTY
db "WAGNER@@@@", CAMPER
db "YATES@@@@@", BIRD_KEEPER
db "ANDREWS@@@", PICNICKER
db "BAHN@@@@@@", POKEMANIAC
db "MORI@@@@@@", SCIENTIST
db "BUCKMAN@@@", SAGE
db "COBB@@@@@@", SCHOOLBOY
db "HUGHES@@@@", FISHER
db "ARITA@@@@@", KIMONO_GIRL
db "EASTON@@@@", PSYCHIC_T
db "FREEMAN@@@", CAMPER
db "GIESE@@@@@", LASS
db "HATCHER@@@", GENTLEMAN
db "JACKSON@@@", POKEFANF
db "KAHN@@@@@@", POKEMANIAC
db "LEONG@@@@@", YOUNGSTER
db "MARINO@@@@", TEACHER
db "NEWMAN@@@@", SAILOR
db "NGUYEN@@@@", BLACKBELT_T
db "OGDEN@@@@@", SUPER_NERD
db "PARK@@@@@@", COOLTRAINERF
db "RAINE@@@@@", SWIMMERM
db "SELLS@@@@@", BIRD_KEEPER
db "ROCKWELL@@", BOARDER
db "THORNTON@@", LASS
db "TURNER@@@@", OFFICER
db "VAN DYKE@@", SKIER
db "WALKER@@@@", SCHOOLBOY
db "MEYER@@@@@", SWIMMERF
db "JOHNSON@@@", YOUNGSTER
db "ADAMS@@@@@", GUITARIST
db "SMITH@@@@@", BUG_CATCHER
db "TAJIRI@@@@", BUG_CATCHER
db "BAKER@@@@@", POKEMANIAC
db "COLLINS@@@", SCIENTIST
db "SMART@@@@@", SUPER_NERD
db "DYKSTRA@@@", SWIMMERF
db "EATON@@@@@", BIKER
db "WONG@@@@@@", FIREBREATHER
; 1f8450
BattleTowerMons: ; 1f8450
BattleTowerMons1: