diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-13 13:47:50 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-13 13:47:50 -0400 |
commit | 7729dcd20420b6ec869bd82c954ced935186bfed (patch) | |
tree | 3ff69879079dc4adf6462098c86970f2f94dcc2b /engine | |
parent | f65448a4c0d6c1b3877ceb8ad138e40669f97c86 (diff) |
Consistent constants for radio data table sizes (could still be better)
Diffstat (limited to 'engine')
-rw-r--r-- | engine/events/buena.asm | 8 | ||||
-rw-r--r-- | engine/overworld/wildmons.asm | 13 | ||||
-rw-r--r-- | engine/pokegear/radio.asm | 6 |
3 files changed, 14 insertions, 13 deletions
diff --git a/engine/events/buena.asm b/engine/events/buena.asm index ef8c70bfc..452f5d62a 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -262,9 +262,7 @@ Buena_PrizeMenu: dba .prizeitem dba .prizepoints -NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2) - -.indices +.indices: db NUM_BUENA_PRIZES x = 1 rept NUM_BUENA_PRIZES @@ -273,7 +271,7 @@ x = x + 1 endr db -1 -.prizeitem +.prizeitem: ld a, [wMenuSelection] call Buena_getprize ld a, [hl] @@ -284,7 +282,7 @@ endr call PlaceString ret -.prizepoints +.prizepoints: ld a, [wMenuSelection] call Buena_getprize inc hl diff --git a/engine/overworld/wildmons.asm b/engine/overworld/wildmons.asm index 61ef89b18..902226041 100644 --- a/engine/overworld/wildmons.asm +++ b/engine/overworld/wildmons.asm @@ -705,11 +705,14 @@ JumpRoamMons: JumpRoamMon: .loop ld hl, RoamMaps -.innerloop1 ; This loop happens to be unnecessary. - call Random ; Choose a random number. - maskbits NUM_ROAMMON_MAPS ; Mask the number to limit it between 0 and 15. - cp NUM_ROAMMON_MAPS ; If the number is not less than 16, try again. - jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus. +.innerloop1 + ; 0-15 are all valid indexes into RoamMaps, + ; so this retry loop is unnecessary + ; since NUM_ROAMMON_MAPS happens to be 16 + call Random + maskbits NUM_ROAMMON_MAPS + cp NUM_ROAMMON_MAPS + jr nc, .innerloop1 inc a ld b, a .innerloop2 ; Loop to get hl to the address of the chosen roam map. diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index c5961bea8..9455170d5 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -194,10 +194,10 @@ OaksPKMNTalk4: ; Choose a random route, and a random Pokemon from that route. .sample call Random - and %11111 - cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2 + and %11111 ; maskbits NUM_OAKS_POKEMON_TALK_ROUTES would be more efficient + cp NUM_OAKS_POKEMON_TALK_ROUTES jr nc, .sample - ; We now have a number between 0 and 14. + ; We now have a number between 0 and NUM_OAKS_POKEMON_TALK_ROUTES - 1. ld hl, OaksPKMNTalkRoutes ld c, a ld b, 0 |