mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-12-30 14:09:35 +13:00
figuring out SuperRodCode
hg-commit-id: ed1db927ca67
This commit is contained in:
parent
a43794ce2e
commit
332f141623
155
common.asm
155
common.asm
|
|
@ -8012,8 +8012,8 @@ ItemUsePtrTable: ;$D5E1
|
||||||
dw $6476 ; LIFT_KEY
|
dw $6476 ; LIFT_KEY
|
||||||
dw $6476 ; EXP__ALL
|
dw $6476 ; EXP__ALL
|
||||||
dw $624C ; OLD_ROD
|
dw $624C ; OLD_ROD
|
||||||
dw GoodRodCode ;$6259
|
dw GoodRodCode ; GOOD_ROD $6259
|
||||||
dw $6283 ; SUPER_ROD
|
dw SuperRodCode ; SUPER_ROD $6283
|
||||||
dw $6317 ; PP_UP (see other?)
|
dw $6317 ; PP_UP (see other?)
|
||||||
dw $631E ; ETHER
|
dw $631E ; ETHER
|
||||||
dw $631E ; MAX_ETHER
|
dw $631E ; MAX_ETHER
|
||||||
|
|
@ -8484,7 +8484,7 @@ UnnamedText_e247: ; 0xe247
|
||||||
INCBIN "baserom.gbc",$e24c,$d
|
INCBIN "baserom.gbc",$e24c,$d
|
||||||
|
|
||||||
GoodRodCode: ; 6259 0xe259
|
GoodRodCode: ; 6259 0xe259
|
||||||
call $62B4
|
call $62B4 ; probably sets carry if not in battle or not by water
|
||||||
jp c,ItemUseNotTime
|
jp c,ItemUseNotTime
|
||||||
Next625F:
|
Next625F:
|
||||||
call GenRandom
|
call GenRandom
|
||||||
|
|
@ -8513,34 +8513,35 @@ GoodRodMons:
|
||||||
db 10,GOLDEEN
|
db 10,GOLDEEN
|
||||||
db 10,POLIWAG
|
db 10,POLIWAG
|
||||||
|
|
||||||
Next6283:
|
SuperRodCode: ; $6283 0xe283
|
||||||
call $62B4
|
call $62B4 ; probably sets carry if in battle or not by water
|
||||||
jp c,ItemUseNotTime
|
jp c, ItemUseNotTime ; don't use SUPER_ROD in battle
|
||||||
Next6289:
|
Next6289: ; not in battle
|
||||||
call $68EA
|
call ReadSuperRodData ; 0xe8ea
|
||||||
ld a,e
|
ld a, e ; $2 means no fishing data found, $1 means a pokemon was picked
|
||||||
Next628E:
|
Next628E:
|
||||||
ld [$CD3D],a
|
ld [$CD3D], a ; set ReadSuperRodData return value
|
||||||
dec a
|
dec a ; decrease return value of ReadSuperRodData
|
||||||
jr nz,.next\@
|
jr nz, .next\@ ; if e was $2 (no fishing data for this map) then skip ahead
|
||||||
ld a,1
|
; store level and species data, SUPER_ROD always catches a bite
|
||||||
ld [$D05F],a
|
ld a, 1
|
||||||
ld a,b
|
ld [$D05F], a ; set "found pokemon"
|
||||||
ld [$D127],a
|
ld a, b ; load level into a
|
||||||
ld a,c
|
ld [$D127], a ; set level
|
||||||
ld [$D059],a
|
ld a, c ; load species id into a
|
||||||
|
ld [$D059], a ; set species id
|
||||||
.next\@
|
.next\@
|
||||||
ld hl,$D700
|
ld hl, $D700 ; bike speed address?
|
||||||
ld a,[hl]
|
ld a, [hl] ; store the value in a
|
||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
ld [hl],0
|
ld [hl], 0 ; blank $D700
|
||||||
ld b,$1C
|
ld b, $1C
|
||||||
ld hl,$47B6
|
ld hl, $47B6 ; probably setup battle?
|
||||||
call Bankswitch
|
call Bankswitch ; call 0x707b6
|
||||||
pop hl
|
pop hl
|
||||||
pop af
|
pop af
|
||||||
ld [hl],a
|
ld [hl], a ; restore the original value
|
||||||
ret
|
ret
|
||||||
|
|
||||||
INCBIN "baserom.gbc",$e2b4,$e30d - $e2b4
|
INCBIN "baserom.gbc",$e2b4,$e30d - $e2b4
|
||||||
|
|
@ -8626,44 +8627,80 @@ UnnamedText_e75f: ; 0xe75f
|
||||||
db $50
|
db $50
|
||||||
; 0xe75f + 5 bytes
|
; 0xe75f + 5 bytes
|
||||||
|
|
||||||
INCBIN "baserom.gbc",$e764,$1b5
|
INCBIN "baserom.gbc",$e764,$e8ea - $e764
|
||||||
|
|
||||||
|
; 68EA 0xe8ea
|
||||||
|
ReadSuperRodData: ; called from SuperRodCode
|
||||||
|
ld a, [W_CURMAP] ; load map id
|
||||||
|
ld de, $0003 ; third byte starts the pointer to this map's fishing group
|
||||||
|
ld hl, SuperRodData ; array to search
|
||||||
|
call IsInArray ; search array at hl, skip de bytes between reads
|
||||||
|
jr c, .ReadFishingGroup ; jump if carry is set (b is index; hl has address of the bth index)
|
||||||
|
ld e, $2 ; $2 if no fishing groups found
|
||||||
|
ret
|
||||||
|
.ReadFishingGroup ; 0xe8f6
|
||||||
|
inc hl ; first byte of pointer to fishing group is hl+1
|
||||||
|
ld a, [hli] ; load first byte of fishing group pointer and increment hl
|
||||||
|
ld h, [hl] ; load second byte of fishing group pointer
|
||||||
|
ld l, a ; set the first byte in the "l" part of the hl register
|
||||||
|
ld b, [hl] ; read fishing group data, how many mons
|
||||||
|
inc hl ; first line of data in fishing group
|
||||||
|
ld e, $0 ; no level/mon selected yet
|
||||||
|
.RandomLoop ; 0xe90c
|
||||||
|
call GenRandom
|
||||||
|
srl a ; shift right into carry
|
||||||
|
ret c ; no battle if carry
|
||||||
|
and $3 ; check if first two bits are set
|
||||||
|
cp b ; check against b (H_RAND something) and set the carry
|
||||||
|
jr nc, .RandomLoop ; if carry then keep generating random numbers
|
||||||
|
add a ; double it (two bytes per mon)
|
||||||
|
ld c, a
|
||||||
|
ld b, $0
|
||||||
|
add hl, bc ; get the address of this mon/level combo in this fishing group
|
||||||
|
ld b, [hl] ; level
|
||||||
|
inc hl
|
||||||
|
ld c, [hl] ; species id
|
||||||
|
ld e, $1 ; $1 if there's a bite
|
||||||
|
ret
|
||||||
|
; 0xe919
|
||||||
|
|
||||||
; super rod data
|
; super rod data
|
||||||
; map, pointer to fishing group
|
; map, pointer to fishing group
|
||||||
SuperRodData: ; 6919
|
SuperRodData: ; 6919
|
||||||
dbw $00,FishingGroup1
|
dbw PALLET_TOWN, FishingGroup1
|
||||||
dbw $01,FishingGroup1
|
dbw VIRIDIAN_CITY, FishingGroup1
|
||||||
dbw $03,FishingGroup3
|
dbw CERULEAN_CITY, FishingGroup3
|
||||||
dbw $05,FishingGroup4
|
dbw VERMILION_CITY, FishingGroup4
|
||||||
dbw $06,FishingGroup5
|
dbw CELADON_CITY, FishingGroup5
|
||||||
dbw $07,FishingGroup10
|
dbw FUCHSIA_CITY, FishingGroup10
|
||||||
dbw $08,FishingGroup8
|
dbw CINNABAR_ISLAND, FishingGroup8
|
||||||
dbw $0F,FishingGroup3
|
dbw ROUTE_4, FishingGroup3
|
||||||
dbw $11,FishingGroup4
|
dbw ROUTE_6, FishingGroup4
|
||||||
dbw $15,FishingGroup5
|
dbw ROUTE_10, FishingGroup5
|
||||||
dbw $16,FishingGroup4
|
dbw ROUTE_11, FishingGroup4
|
||||||
dbw $17,FishingGroup7
|
dbw ROUTE_12, FishingGroup7
|
||||||
dbw $18,FishingGroup7
|
dbw ROUTE_13, FishingGroup7
|
||||||
dbw $1C,FishingGroup7
|
dbw ROUTE_17, FishingGroup7
|
||||||
dbw $1D,FishingGroup7
|
dbw ROUTE_18, FishingGroup7
|
||||||
dbw $1E,FishingGroup8
|
dbw ROUTE_19, FishingGroup8
|
||||||
dbw $1F,FishingGroup8
|
dbw ROUTE_20, FishingGroup8
|
||||||
dbw $20,FishingGroup8
|
dbw ROUTE_21, FishingGroup8
|
||||||
dbw $21,FishingGroup2
|
dbw ROUTE_22, FishingGroup2
|
||||||
dbw $22,FishingGroup9
|
dbw ROUTE_23, FishingGroup9
|
||||||
dbw $23,FishingGroup3
|
dbw ROUTE_24, FishingGroup3
|
||||||
dbw $24,FishingGroup3
|
dbw ROUTE_25, FishingGroup3
|
||||||
dbw $41,FishingGroup3
|
dbw CERULEAN_GYM, FishingGroup3
|
||||||
dbw $5E,FishingGroup4
|
dbw VERMILION_DOCK, FishingGroup4
|
||||||
dbw $A1,FishingGroup8
|
;XXX syntax errors on the rest?
|
||||||
dbw $A2,FishingGroup8
|
dbw $A1, FishingGroup8 ; SEAFOAM_ISLANDS_4
|
||||||
dbw $D9,FishingGroup6
|
dbw $A2, FishingGroup8 ; SEAFOAM_ISLANDS_5
|
||||||
dbw $DA,FishingGroup6
|
dbw SAFARI_ZONE_EAST, FishingGroup6
|
||||||
dbw $DB,FishingGroup6
|
dbw $DA, FishingGroup6 ; SAFARI_ZONE_NORTH
|
||||||
dbw $DC,FishingGroup6
|
dbw SAFARI_ZONE_WEST, FishingGroup6
|
||||||
dbw $E2,FishingGroup9
|
dbw $DC, FishingGroup6 ; SAFARI_ZONE_CENTER
|
||||||
dbw $E3,FishingGroup9
|
dbw $E2, FishingGroup9 ; UNKNOWN_DUNGEON_2
|
||||||
dbw $E4,FishingGroup9
|
dbw $E3, FishingGroup9 ; UNKNOWN_DUNGEON_3
|
||||||
|
dbw $E4, FishingGroup9 ; UNKNOWN_DUNGEON_1
|
||||||
db $FF
|
db $FF
|
||||||
|
|
||||||
; fishing groups
|
; fishing groups
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue