Fewer hard-coded values

This commit is contained in:
Remy Oukaour 2018-01-16 17:36:12 -05:00
parent 7b3de85a06
commit 50ce0a219e

View File

@ -212,7 +212,7 @@ TryWildEncounter:: ; 2a0e7
GetMapEncounterRate: ; 2a111 GetMapEncounterRate: ; 2a111
ld hl, wMornEncounterRate ld hl, wMornEncounterRate
call CheckOnWater call CheckOnWater
ld a, 3 ld a, wWaterEncounterRate - wMornEncounterRate
jr z, .ok jr z, .ok
ld a, [TimeOfDay] ld a, [TimeOfDay]
.ok .ok
@ -571,7 +571,7 @@ CheckEncounterRoamMon: ; 2a2ce
ld hl, wRoamMon1MapGroup ld hl, wRoamMon1MapGroup
ld c, a ld c, a
ld b, 0 ld b, 0
ld a, 7 ; length of the RoamMon struct ld a, 7 ; length of the roam_struct
call AddNTimes call AddNTimes
ld a, d ld a, d
cp [hl] cp [hl]
@ -821,7 +821,7 @@ Special_RandomUnseenWildMon: ; 2a4ab
ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map
add hl, bc add hl, bc
ld a, [TimeOfDay] ld a, [TimeOfDay]
ld bc, 7 * 2 ld bc, NUM_GRASSMON * 2
call AddNTimes call AddNTimes
.randloop1 .randloop1
call Random call Random
@ -893,7 +893,7 @@ Special_RandomPhoneWildMon: ; 2a51f
add hl, bc add hl, bc
ld a, [TimeOfDay] ld a, [TimeOfDay]
inc a inc a
ld bc, 7 * 2 ld bc, NUM_GRASSMON * 2
.loop .loop
dec a dec a
jr z, .done jr z, .done
@ -952,16 +952,17 @@ Special_RandomPhoneMon: ; 2a567
ld a, BANK(Trainers) ld a, BANK(Trainers)
call GetFarByte call GetFarByte
inc hl inc hl
ld bc, 2 ld bc, 2 ; level, species
cp 0 cp TRAINERTYPE_NORMAL
jr z, .got_mon_length jr z, .got_mon_length
ld bc, 2 + NUM_MOVES ld bc, 2 + NUM_MOVES ; level, species, moves
cp 1 cp TRAINERTYPE_MOVES
jr z, .got_mon_length jr z, .got_mon_length
ld bc, 2 + 1 ld bc, 2 + 1 ; level, species, item
cp 2 cp TRAINERTYPE_ITEM
jr z, .got_mon_length jr z, .got_mon_length
ld bc, 2 + 1 + NUM_MOVES ; TRAINERTYPE_ITEM_MOVES
ld bc, 2 + 1 + NUM_MOVES ; level, species, item, moves
.got_mon_length .got_mon_length
ld e, 0 ld e, 0
@ -977,7 +978,7 @@ Special_RandomPhoneMon: ; 2a567
.rand .rand
call Random call Random
and 7 maskbits PARTY_LENGTH
cp e cp e
jr nc, .rand jr nc, .rand