mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Comment improvements (SuperRodCode).
hg-commit-id: acf34e68b820
This commit is contained in:
parent
27f13ecc9a
commit
153b21fb48
92
common.asm
92
common.asm
|
@ -8705,7 +8705,7 @@ Next625F:
|
||||||
call GenRandom
|
call GenRandom
|
||||||
srl a
|
srl a
|
||||||
jr c,Next6278
|
jr c,Next6278
|
||||||
and 3
|
and %11
|
||||||
cp 2
|
cp 2
|
||||||
jr nc,Next625F
|
jr nc,Next625F
|
||||||
; choose which monster appears
|
; choose which monster appears
|
||||||
|
@ -8730,33 +8730,34 @@ GoodRodMons:
|
||||||
|
|
||||||
SuperRodCode: ; $6283 0xe283
|
SuperRodCode: ; $6283 0xe283
|
||||||
call $62B4 ; probably sets carry if in battle or not by water
|
call $62B4 ; probably sets carry if in battle or not by water
|
||||||
jp c, ItemUseNotTime ; don't use SUPER_ROD in battle
|
jp c, ItemUseNotTime
|
||||||
Next6289: ; not in battle
|
|
||||||
call ReadSuperRodData ; 0xe8ea
|
call ReadSuperRodData ; 0xe8ea
|
||||||
ld a, e ; $2 means no fishing data found, $1 means a pokemon was picked
|
ld a, e
|
||||||
Next628E:
|
Next628E:
|
||||||
ld [$CD3D], a ; set ReadSuperRodData return value
|
ld [$CD3D], a
|
||||||
dec a ; decrease return value of ReadSuperRodData
|
|
||||||
jr nz, .next\@ ; if e was $2 (no fishing data for this map) then skip ahead
|
dec a ; is there a bite?
|
||||||
; store level and species data, SUPER_ROD always catches a bite
|
jr nz, .next\@
|
||||||
|
; if yes, store level and species data
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [$D05F], a ; set "found pokemon"
|
ld [$D05F], a
|
||||||
ld a, b ; load level into a
|
ld a, b ; level
|
||||||
ld [$D127], a ; set level
|
ld [W_CURENEMYLVL], a
|
||||||
ld a, c ; load species id into a
|
ld a, c ; species
|
||||||
ld [$D059], a ; set species id
|
ld [W_CUROPPONENT], a
|
||||||
|
|
||||||
.next\@
|
.next\@
|
||||||
ld hl, $D700 ; bike speed address?
|
ld hl, $D700
|
||||||
ld a, [hl] ; store the value in a
|
ld a, [hl] ; store the value in a
|
||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
ld [hl], 0 ; blank $D700
|
ld [hl], 0
|
||||||
ld b, $1C
|
ld b, $1C
|
||||||
ld hl, $47B6 ; probably setup battle?
|
ld hl, $47B6
|
||||||
call Bankswitch ; call 0x707b6
|
call Bankswitch
|
||||||
pop hl
|
pop hl
|
||||||
pop af
|
pop af
|
||||||
ld [hl], a ; restore the original value
|
ld [hl], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
INCBIN "baserom.gbc",$e2b4,$e30d - $e2b4
|
INCBIN "baserom.gbc",$e2b4,$e30d - $e2b4
|
||||||
|
@ -8845,42 +8846,53 @@ UnnamedText_e75f: ; 0xe75f
|
||||||
INCBIN "baserom.gbc",$e764,$e8ea - $e764
|
INCBIN "baserom.gbc",$e764,$e8ea - $e764
|
||||||
|
|
||||||
; 68EA 0xe8ea
|
; 68EA 0xe8ea
|
||||||
ReadSuperRodData: ; called from SuperRodCode
|
ReadSuperRodData:
|
||||||
ld a, [W_CURMAP] ; load map id
|
; return e = 2 if no fish on this map
|
||||||
ld de, $0003 ; third byte starts the pointer to this map's fishing group
|
; return e = 1 if a bite, bc = level,species
|
||||||
ld hl, SuperRodData ; array to search
|
; return e = 0 if no bite
|
||||||
call IsInArray ; search array at hl, skip de bytes between reads
|
ld a, [W_CURMAP]
|
||||||
jr c, .ReadFishingGroup ; jump if carry is set (b is index; hl has address of the bth index)
|
ld de, 3 ; each fishing group is three bytes wide
|
||||||
|
ld hl, SuperRodData
|
||||||
|
call IsInArray
|
||||||
|
jr c, .ReadFishingGroup
|
||||||
ld e, $2 ; $2 if no fishing groups found
|
ld e, $2 ; $2 if no fishing groups found
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.ReadFishingGroup ; 0xe8f6
|
.ReadFishingGroup ; 0xe8f6
|
||||||
inc hl ; first byte of pointer to fishing group is hl+1
|
; hl points to the fishing group
|
||||||
ld a, [hli] ; load first byte of fishing group pointer and increment hl
|
inc hl ; skip map id
|
||||||
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 a, [hli]
|
||||||
ld b, [hl] ; read fishing group data, how many mons
|
ld h, [hl]
|
||||||
inc hl ; first line of data in fishing group
|
ld l, a
|
||||||
ld e, $0 ; no level/mon selected yet
|
|
||||||
|
ld b, [hl] ; how many mons in group
|
||||||
|
inc hl ; point to data
|
||||||
|
ld e, $0 ; no bite yet
|
||||||
|
|
||||||
.RandomLoop ; 0xe90c
|
.RandomLoop ; 0xe90c
|
||||||
call GenRandom
|
call GenRandom
|
||||||
srl a ; shift right into carry
|
srl a
|
||||||
ret c ; no battle if carry
|
ret c ; 50% chance of no battle
|
||||||
and $3 ; check if first two bits are set
|
|
||||||
cp b ; check against b (H_RAND something) and set the carry
|
and %11 ; 2-bit random number
|
||||||
jr nc, .RandomLoop ; if carry then keep generating random numbers
|
cp b
|
||||||
add a ; double it (two bytes per mon)
|
jr nc, .RandomLoop ; if a is greater than the number of mons, regenerate
|
||||||
|
|
||||||
|
; get the mon
|
||||||
|
add a
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, $0
|
ld b, $0
|
||||||
add hl, bc ; get the address of this mon/level combo in this fishing group
|
add hl, bc
|
||||||
ld b, [hl] ; level
|
ld b, [hl] ; level
|
||||||
inc hl
|
inc hl
|
||||||
ld c, [hl] ; species id
|
ld c, [hl] ; species
|
||||||
ld e, $1 ; $1 if there's a bite
|
ld e, $1 ; $1 if there's a bite
|
||||||
ret
|
ret
|
||||||
; 0xe919
|
; 0xe919
|
||||||
|
|
||||||
; super rod data
|
; super rod data
|
||||||
; map, pointer to fishing group
|
; format: map, pointer to fishing group
|
||||||
SuperRodData: ; 6919
|
SuperRodData: ; 6919
|
||||||
dbw PALLET_TOWN, FishingGroup1
|
dbw PALLET_TOWN, FishingGroup1
|
||||||
dbw VIRIDIAN_CITY, FishingGroup1
|
dbw VIRIDIAN_CITY, FishingGroup1
|
||||||
|
|
Loading…
Reference in a new issue