mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Consistent constants for radio data table sizes (could still be better)
This commit is contained in:
parent
f65448a4c0
commit
7729dcd204
@ -106,17 +106,23 @@
|
|||||||
const MAPRADIO_LETS_ALL_SING
|
const MAPRADIO_LETS_ALL_SING
|
||||||
const MAPRADIO_ROCKET
|
const MAPRADIO_ROCKET
|
||||||
|
|
||||||
|
; OaksPKMNTalkRoutes size (see data/radio/oaks_pkmn_talk_routes.asm)
|
||||||
|
NUM_OAKS_POKEMON_TALK_ROUTES EQU 15
|
||||||
|
|
||||||
; These tables in engine/pokegear/radio.asm are all sized to a power of 2
|
; These tables in engine/pokegear/radio.asm are all sized to a power of 2
|
||||||
; so there's no need for a rejection sampling loop
|
; so there's no need for a rejection sampling loop
|
||||||
NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
|
NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
|
||||||
NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
|
NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
|
||||||
NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
|
NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
|
||||||
NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
|
NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
|
||||||
|
|
||||||
; BuenasPasswordTable sizes (see data/radio/buenas_passwords.asm)
|
; BuenasPasswordTable sizes (see data/radio/buenas_passwords.asm)
|
||||||
NUM_PASSWORD_CATEGORIES EQU 11
|
NUM_PASSWORD_CATEGORIES EQU 11
|
||||||
NUM_PASSWORDS_PER_CATEGORY EQU 3
|
NUM_PASSWORDS_PER_CATEGORY EQU 3
|
||||||
|
|
||||||
|
; BuenaPrizeItems size (see data/items/buena_prizes.asm)
|
||||||
|
NUM_BUENA_PRIZES EQU 9
|
||||||
|
|
||||||
; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm)
|
; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm)
|
||||||
const_def
|
const_def
|
||||||
const BUENA_MON
|
const BUENA_MON
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
BuenaPrizeItems:
|
BuenaPrizeItems:
|
||||||
; there are NUM_BUENA_PRIZES items (see engine/events/buena.asm)
|
; there are NUM_BUENA_PRIZES entries
|
||||||
db ULTRA_BALL, 2
|
db ULTRA_BALL, 2
|
||||||
db FULL_RESTORE, 2
|
db FULL_RESTORE, 2
|
||||||
db NUGGET, 3
|
db NUGGET, 3
|
||||||
@ -9,4 +9,3 @@ BuenaPrizeItems:
|
|||||||
db CARBOS, 5
|
db CARBOS, 5
|
||||||
db CALCIUM, 5
|
db CALCIUM, 5
|
||||||
db HP_UP, 5
|
db HP_UP, 5
|
||||||
.End
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
; Oak's Pokémon Talk will list wild Pokémon on these maps.
|
; Oak's Pokémon Talk will list wild Pokémon on these maps.
|
||||||
|
|
||||||
OaksPKMNTalkRoutes:
|
OaksPKMNTalkRoutes:
|
||||||
|
; there are NUM_OAKS_POKEMON_TALK_ROUTES entries
|
||||||
map_id ROUTE_29
|
map_id ROUTE_29
|
||||||
map_id ROUTE_46
|
map_id ROUTE_46
|
||||||
map_id ROUTE_30
|
map_id ROUTE_30
|
||||||
@ -16,4 +17,3 @@ OaksPKMNTalkRoutes:
|
|||||||
map_id ROUTE_45
|
map_id ROUTE_45
|
||||||
map_id ROUTE_36
|
map_id ROUTE_36
|
||||||
map_id ROUTE_31
|
map_id ROUTE_31
|
||||||
.End
|
|
||||||
|
@ -262,9 +262,7 @@ Buena_PrizeMenu:
|
|||||||
dba .prizeitem
|
dba .prizeitem
|
||||||
dba .prizepoints
|
dba .prizepoints
|
||||||
|
|
||||||
NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2)
|
.indices:
|
||||||
|
|
||||||
.indices
|
|
||||||
db NUM_BUENA_PRIZES
|
db NUM_BUENA_PRIZES
|
||||||
x = 1
|
x = 1
|
||||||
rept NUM_BUENA_PRIZES
|
rept NUM_BUENA_PRIZES
|
||||||
@ -273,7 +271,7 @@ x = x + 1
|
|||||||
endr
|
endr
|
||||||
db -1
|
db -1
|
||||||
|
|
||||||
.prizeitem
|
.prizeitem:
|
||||||
ld a, [wMenuSelection]
|
ld a, [wMenuSelection]
|
||||||
call Buena_getprize
|
call Buena_getprize
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
@ -284,7 +282,7 @@ endr
|
|||||||
call PlaceString
|
call PlaceString
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.prizepoints
|
.prizepoints:
|
||||||
ld a, [wMenuSelection]
|
ld a, [wMenuSelection]
|
||||||
call Buena_getprize
|
call Buena_getprize
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -705,11 +705,14 @@ JumpRoamMons:
|
|||||||
JumpRoamMon:
|
JumpRoamMon:
|
||||||
.loop
|
.loop
|
||||||
ld hl, RoamMaps
|
ld hl, RoamMaps
|
||||||
.innerloop1 ; This loop happens to be unnecessary.
|
.innerloop1
|
||||||
call Random ; Choose a random number.
|
; 0-15 are all valid indexes into RoamMaps,
|
||||||
maskbits NUM_ROAMMON_MAPS ; Mask the number to limit it between 0 and 15.
|
; so this retry loop is unnecessary
|
||||||
cp NUM_ROAMMON_MAPS ; If the number is not less than 16, try again.
|
; since NUM_ROAMMON_MAPS happens to be 16
|
||||||
jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus.
|
call Random
|
||||||
|
maskbits NUM_ROAMMON_MAPS
|
||||||
|
cp NUM_ROAMMON_MAPS
|
||||||
|
jr nc, .innerloop1
|
||||||
inc a
|
inc a
|
||||||
ld b, a
|
ld b, a
|
||||||
.innerloop2 ; Loop to get hl to the address of the chosen roam map.
|
.innerloop2 ; Loop to get hl to the address of the chosen roam map.
|
||||||
|
@ -194,10 +194,10 @@ OaksPKMNTalk4:
|
|||||||
; Choose a random route, and a random Pokemon from that route.
|
; Choose a random route, and a random Pokemon from that route.
|
||||||
.sample
|
.sample
|
||||||
call Random
|
call Random
|
||||||
and %11111
|
and %11111 ; maskbits NUM_OAKS_POKEMON_TALK_ROUTES would be more efficient
|
||||||
cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2
|
cp NUM_OAKS_POKEMON_TALK_ROUTES
|
||||||
jr nc, .sample
|
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 hl, OaksPKMNTalkRoutes
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
|
Loading…
Reference in New Issue
Block a user