fix up TreeMons/RockMons

This commit is contained in:
yenatch 2013-09-07 17:35:41 -04:00
parent 6e5876377f
commit 353b4ac6da

146
main.asm
View File

@ -72429,22 +72429,29 @@ Functionb81e2: ; b81e2
INCBIN "baserom.gbc", $b81ea, $b8219 - $b81ea INCBIN "baserom.gbc", $b81ea, $b8219 - $b81ea
Functionb8219: ; b8219 Functionb8219: ; b8219
; deals strictly with rockmon encounter ; get a RockMon encounter
xor a xor a
ld [$d22e], a ld [$d22e], a
ld [CurPartyLevel], a ld [CurPartyLevel], a
ld hl, WildRockMonMapTable
ld hl, RockMonMaps
call GetTreeMonEncounterTable call GetTreeMonEncounterTable
jr nc, .quit jr nc, .quit
call LoadWildTreeMonData
call LoadTreeMonData
jr nc, .quit jr nc, .quit
ld a, $0a
ld a, 10
call Function2fb1 call Function2fb1
cp a, $04 cp 4
jr nc, .quit jr nc, .quit
call $441f
call Functionb841f
jr nc, .quit jr nc, .quit
ret ret
.quit .quit
xor a xor a
ret ret
@ -72453,16 +72460,15 @@ Functionb8219: ; b8219
db $05 ; ???? db $05 ; ????
GetTreeMonEncounterTable: ; b823f GetTreeMonEncounterTable: ; b823f
; reads a map-sensitive encounter table ; Return carry and table id in a
; compares current map with maps in the table ; if MapGroup and MapNumber are in table hl
; if there is a match, encounter table # is loaded into a
ld a, [MapNumber] ld a, [MapNumber]
ld e, a ld e, a
ld a, [MapGroup] ld a, [MapGroup]
ld d, a ld d, a
.loop .loop
ld a, [hli] ld a, [hli]
cp a, $ff cp $ff
jr z, .quit jr z, .quit
cp d cp d
jr nz, .skip2 jr nz, .skip2
@ -72486,55 +72492,60 @@ GetTreeMonEncounterTable: ; b823f
INCBIN "baserom.gbc", $B825E, $b82c5 - $b825e INCBIN "baserom.gbc", $B825E, $b82c5 - $b825e
WildRockMonMapTable: ; b82c5 RockMonMaps: ; b82c5
db GROUP_CIANWOOD_CITY, MAP_CIANWOOD_CITY, $07 db GROUP_CIANWOOD_CITY, MAP_CIANWOOD_CITY, 7
db GROUP_ROUTE_40, MAP_ROUTE_40, $07 db GROUP_ROUTE_40, MAP_ROUTE_40, 7
db GROUP_DARK_CAVE_VIOLET_ENTRANCE, MAP_DARK_CAVE_VIOLET_ENTRANCE, $07 db GROUP_DARK_CAVE_VIOLET_ENTRANCE, MAP_DARK_CAVE_VIOLET_ENTRANCE, 7
db GROUP_SLOWPOKE_WELL_B1F, MAP_SLOWPOKE_WELL_B1F, $07 db GROUP_SLOWPOKE_WELL_B1F, MAP_SLOWPOKE_WELL_B1F, 7
db $ff ; end db $ff ; end
; b82d2 ; b82d2
LoadWildTreeMonData: ; b82d2 LoadTreeMonData: ; b82d2
; input: a = table number ; Return TreeMon pointer a in hl
; returns wildtreemontable pointer in hl ; Return carry on success
; sets carry if successful
cp a, $08 ; which table? ; only 7 tables
jr nc, .quit ; only 8 tables cp 8
jr nc, .quit
and a and a
jr z, .quit ; 0 is invalid jr z, .quit
ld e, a ld e, a
ld d, $00 ld d, 0
ld hl, WildTreeMonPointerTable ld hl, TreeMonPointers
add hl, de add hl, de
add hl, de add hl, de
ld a, [hli] ; store pointer in hl
ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
scf scf
ret ret
.quit .quit
xor a xor a
ret ret
; b82e8 ; b82e8
WildTreeMonPointerTable: ; b82e8 TreeMonPointers: ; b82e8
; seems to point to "normal" tree encounter data ; seems to point to "normal" tree encounter data
; as such only odd-numbered tables are used ; so only odd-numbered tables are used
; rockmon is 13th dw TreeMons1 ; filler
dw WildTreeMonTable1 ; filler dw TreeMons1 ; 1
dw WildTreeMonTable1 ; 1 dw TreeMons3 ; 2
dw WildTreeMonTable3 ; 2 dw TreeMons5 ; 3
dw WildTreeMonTable5 ; 3 dw TreeMons7 ; 4
dw WildTreeMonTable7 ; 4 dw TreeMons9 ; 5
dw WildTreeMonTable9 ; 5 dw TreeMons11 ; 6
dw WildTreeMonTable11 ; 6 dw RockMons ; 7
dw WildRockMonTable ; 7 dw TreeMons1 ; filler
dw WildTreeMonTable1 ; 8
; b82fa ; b82fa
; structure: % species level ; structure: % species level
WildTreeMonTable1: ; b82fa TreeMons1: ; b82fa
db 50, SPEAROW, 10 db 50, SPEAROW, 10
db 15, SPEAROW, 10 db 15, SPEAROW, 10
db 15, SPEAROW, 10 db 15, SPEAROW, 10
@ -72544,7 +72555,7 @@ WildTreeMonTable1: ; b82fa
db $ff ; end db $ff ; end
; b830d ; b830d
WildTreeMonTable2 ; b830d TreeMons2 ; b830d
; unused ; unused
db 50, SPEAROW, 10 db 50, SPEAROW, 10
db 15, HERACROSS, 10 db 15, HERACROSS, 10
@ -72555,7 +72566,7 @@ WildTreeMonTable2 ; b830d
db $ff ; end db $ff ; end
; b8320 ; b8320
WildTreeMonTable3: ; b8320 TreeMons3: ; b8320
db 50, SPEAROW, 10 db 50, SPEAROW, 10
db 15, EKANS, 10 db 15, EKANS, 10
db 15, SPEAROW, 10 db 15, SPEAROW, 10
@ -72565,7 +72576,7 @@ WildTreeMonTable3: ; b8320
db $ff ; end db $ff ; end
; b8333 ; b8333
WildTreeMonTable4: ; b8333 TreeMons4: ; b8333
; unused ; unused
db 50, SPEAROW, 10 db 50, SPEAROW, 10
db 15, HERACROSS, 10 db 15, HERACROSS, 10
@ -72576,7 +72587,7 @@ WildTreeMonTable4: ; b8333
db $ff ; end db $ff ; end
; b8346 ; b8346
WildTreeMonTable5: ; b8346 TreeMons5: ; b8346
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, SPINARAK, 10 db 15, SPINARAK, 10
db 15, LEDYBA, 10 db 15, LEDYBA, 10
@ -72586,7 +72597,7 @@ WildTreeMonTable5: ; b8346
db $ff ; end db $ff ; end
; b8359 ; b8359
WildTreeMonTable6: ; b8359 TreeMons6: ; b8359
; unused ; unused
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, PINECO, 10 db 15, PINECO, 10
@ -72597,7 +72608,7 @@ WildTreeMonTable6: ; b8359
db $ff ; end db $ff ; end
; b836c ; b836c
WildTreeMonTable7: ; b836c TreeMons7: ; b836c
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, EKANS, 10 db 15, EKANS, 10
db 15, HOOTHOOT, 10 db 15, HOOTHOOT, 10
@ -72607,7 +72618,7 @@ WildTreeMonTable7: ; b836c
db $ff ; end db $ff ; end
; b837f ; b837f
WildTreeMonTable8: ; b837f TreeMons8: ; b837f
; unused ; unused
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, PINECO, 10 db 15, PINECO, 10
@ -72618,7 +72629,7 @@ WildTreeMonTable8: ; b837f
db $ff ; end db $ff ; end
; b8392 ; b8392
WildTreeMonTable9: ; b8392 TreeMons9: ; b8392
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, VENONAT, 10 db 15, VENONAT, 10
db 15, HOOTHOOT, 10 db 15, HOOTHOOT, 10
@ -72628,7 +72639,7 @@ WildTreeMonTable9: ; b8392
db $ff ; end db $ff ; end
; b83a5 ; b83a5
WildTreeMonTable10: ; b83a5 TreeMons10: ; b83a5
; unused ; unused
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, PINECO, 10 db 15, PINECO, 10
@ -72639,7 +72650,7 @@ WildTreeMonTable10: ; b83a5
db $ff ; end db $ff ; end
; b83b8 ; b83b8
WildTreeMonTable11: ; b83b8 TreeMons11: ; b83b8
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, PINECO, 10 db 15, PINECO, 10
db 15, PINECO, 10 db 15, PINECO, 10
@ -72649,7 +72660,7 @@ WildTreeMonTable11: ; b83b8
db $ff ; end db $ff ; end
; b83cb ; b83cb
WildTreeMonTable12; b83cb TreeMons12; b83cb
; unused ; unused
db 50, HOOTHOOT, 10 db 50, HOOTHOOT, 10
db 15, CATERPIE, 10 db 15, CATERPIE, 10
@ -72660,13 +72671,46 @@ WildTreeMonTable12; b83cb
db $ff ; end db $ff ; end
; b83de ; b83de
WildRockMonTable: ; b83de RockMons: ; b83de
db 90, KRABBY, 15 db 90, KRABBY, 15
db 10, SHUCKLE, 15 db 10, SHUCKLE, 15
db $ff ; end db $ff ; end
; b83e5 ; b83e5
INCBIN "baserom.gbc", $b83e5, $b8f8f - $b83e5 INCBIN "baserom.gbc", $b83e5, $b841f - $b83e5
Functionb841f: ; b841f
; Read a TreeMons table.
ld a, 100
call Function2fb1
.asm_b8424
sub [hl]
jr c, .asm_b842c
inc hl
inc hl
inc hl
jr .asm_b8424
.asm_b842c
ld a, [hli]
cp $ff
jr z, .asm_b843b
ld a, [hli]
ld [$d22e], a
ld a, [hl]
ld [CurPartyLevel], a
scf
ret
.asm_b843b
xor a
ld [$d22e], a
ld [CurPartyLevel], a
ret
; b8443
INCBIN "baserom.gbc", $b8443, $b8f8f - $b8443
Functionb8f8f: ; b8f8f Functionb8f8f: ; b8f8f
ld a, c ld a, c