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