shithub: pokecrystal

Download patch

ref: 22b607b664b1b350ad96340b39440c8e4296006c
parent: 16eb97ae9cca0ce52531860c499c3346e6a2cf9e
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Wed Jan 10 06:30:12 EST 2018

Move radio channel data into data/

--- a/constants/radio_constants.asm
+++ b/constants/radio_constants.asm
@@ -1,93 +1,97 @@
-; PlayRadioShow arguments, RadioJumptable indexes (see engine/radio.asm)
+; radio channel ids
+; indexes for:
+; - PlayRadioShow/RadioJumptable (see engine/radio.asm)
+; - RadioChannelSongs (see data/radio/channel_music.asm)
 	const_def
-	const OAKS_POKEMON_TALK      ; $00
-	const POKEDEX_SHOW           ; $01
-	const POKEMON_MUSIC          ; $02
-	const LUCKY_CHANNEL          ; $03
-	const BUENAS_PASSWORD        ; $04
-	const PLACES_AND_PEOPLE      ; $05
-	const LETS_ALL_SING          ; $06
-	const ROCKET_RADIO           ; $07
-	const POKE_FLUTE_RADIO       ; $08
-	const UNOWN_RADIO            ; $09
-	const EVOLUTION_RADIO        ; $0a
-	const OAKS_POKEMON_TALK_2    ; $0b
-	const OAKS_POKEMON_TALK_3    ; $0c
-	const OAKS_POKEMON_TALK_4    ; $0d
-	const OAKS_POKEMON_TALK_5    ; $0e
-	const OAKS_POKEMON_TALK_6    ; $0f
-	const OAKS_POKEMON_TALK_7    ; $10
-	const OAKS_POKEMON_TALK_8    ; $11
-	const OAKS_POKEMON_TALK_9    ; $12
-	const POKEDEX_SHOW_2         ; $13
-	const POKEDEX_SHOW_3         ; $14
-	const POKEDEX_SHOW_4         ; $15
-	const POKEDEX_SHOW_5         ; $16
-	const POKEMON_MUSIC_2        ; $17
-	const POKEMON_MUSIC_3        ; $18
-	const POKEMON_MUSIC_4        ; $19
-	const POKEMON_MUSIC_5        ; $1a
-	const POKEMON_MUSIC_6        ; $1b
-	const POKEMON_MUSIC_7        ; $1c
-	const LETS_ALL_SING_2        ; $1d
-	const LUCKY_NUMBER_SHOW_2    ; $1e
-	const LUCKY_NUMBER_SHOW_3    ; $1f
-	const LUCKY_NUMBER_SHOW_4    ; $20
-	const LUCKY_NUMBER_SHOW_5    ; $21
-	const LUCKY_NUMBER_SHOW_6    ; $22
-	const LUCKY_NUMBER_SHOW_7    ; $23
-	const LUCKY_NUMBER_SHOW_8    ; $24
-	const LUCKY_NUMBER_SHOW_9    ; $25
-	const LUCKY_NUMBER_SHOW_10   ; $26
-	const LUCKY_NUMBER_SHOW_11   ; $27
-	const LUCKY_NUMBER_SHOW_12   ; $28
-	const LUCKY_NUMBER_SHOW_13   ; $29
-	const LUCKY_NUMBER_SHOW_14   ; $2a
-	const LUCKY_NUMBER_SHOW_15   ; $2b
-	const PLACES_AND_PEOPLE_2    ; $2c
-	const PLACES_AND_PEOPLE_3    ; $2d
-	const PLACES_AND_PEOPLE_4    ; $2e
-	const PLACES_AND_PEOPLE_5    ; $2f
-	const PLACES_AND_PEOPLE_6    ; $30
-	const PLACES_AND_PEOPLE_7    ; $31
-	const ROCKET_RADIO_2         ; $32
-	const ROCKET_RADIO_3         ; $33
-	const ROCKET_RADIO_4         ; $34
-	const ROCKET_RADIO_5         ; $35
-	const ROCKET_RADIO_6         ; $36
-	const ROCKET_RADIO_7         ; $37
-	const ROCKET_RADIO_8         ; $38
-	const ROCKET_RADIO_9         ; $39
-	const ROCKET_RADIO_10        ; $3a
-	const OAKS_POKEMON_TALK_10   ; $3b
-	const OAKS_POKEMON_TALK_11   ; $3c
-	const OAKS_POKEMON_TALK_12   ; $3d
-	const OAKS_POKEMON_TALK_13   ; $3e
-	const OAKS_POKEMON_TALK_14   ; $3f
-	const BUENAS_PASSWORD_2      ; $40
-	const BUENAS_PASSWORD_3      ; $41
-	const BUENAS_PASSWORD_4      ; $42
-	const BUENAS_PASSWORD_5      ; $43
-	const BUENAS_PASSWORD_6      ; $44
-	const BUENAS_PASSWORD_7      ; $45
-	const BUENAS_PASSWORD_8      ; $46
-	const BUENAS_PASSWORD_9      ; $47
-	const BUENAS_PASSWORD_10     ; $48
-	const BUENAS_PASSWORD_11     ; $49
-	const BUENAS_PASSWORD_12     ; $4a
-	const BUENAS_PASSWORD_13     ; $4b
-	const BUENAS_PASSWORD_14     ; $4c
-	const BUENAS_PASSWORD_15     ; $4d
-	const BUENAS_PASSWORD_16     ; $4e
-	const BUENAS_PASSWORD_17     ; $4f
-	const BUENAS_PASSWORD_18     ; $50
-	const BUENAS_PASSWORD_19     ; $51
-	const BUENAS_PASSWORD_20     ; $52
-	const BUENAS_PASSWORD_21     ; $53
-	const RADIO_SCROLL           ; $54
-	const POKEDEX_SHOW_6         ; $55
-	const POKEDEX_SHOW_7         ; $56
-	const POKEDEX_SHOW_8         ; $57
+	const OAKS_POKEMON_TALK      ; 00
+	const POKEDEX_SHOW           ; 01
+	const POKEMON_MUSIC          ; 02
+	const LUCKY_CHANNEL          ; 03
+	const BUENAS_PASSWORD        ; 04
+	const PLACES_AND_PEOPLE      ; 05
+	const LETS_ALL_SING          ; 06
+	const ROCKET_RADIO           ; 07
+	const POKE_FLUTE_RADIO       ; 08
+	const UNOWN_RADIO            ; 09
+	const EVOLUTION_RADIO        ; 0a
+; internal indexes for channel segments
+	const OAKS_POKEMON_TALK_2    ; 0b
+	const OAKS_POKEMON_TALK_3    ; 0c
+	const OAKS_POKEMON_TALK_4    ; 0d
+	const OAKS_POKEMON_TALK_5    ; 0e
+	const OAKS_POKEMON_TALK_6    ; 0f
+	const OAKS_POKEMON_TALK_7    ; 10
+	const OAKS_POKEMON_TALK_8    ; 11
+	const OAKS_POKEMON_TALK_9    ; 12
+	const POKEDEX_SHOW_2         ; 13
+	const POKEDEX_SHOW_3         ; 14
+	const POKEDEX_SHOW_4         ; 15
+	const POKEDEX_SHOW_5         ; 16
+	const POKEMON_MUSIC_2        ; 17
+	const POKEMON_MUSIC_3        ; 18
+	const POKEMON_MUSIC_4        ; 19
+	const POKEMON_MUSIC_5        ; 1a
+	const POKEMON_MUSIC_6        ; 1b
+	const POKEMON_MUSIC_7        ; 1c
+	const LETS_ALL_SING_2        ; 1d
+	const LUCKY_NUMBER_SHOW_2    ; 1e
+	const LUCKY_NUMBER_SHOW_3    ; 1f
+	const LUCKY_NUMBER_SHOW_4    ; 20
+	const LUCKY_NUMBER_SHOW_5    ; 21
+	const LUCKY_NUMBER_SHOW_6    ; 22
+	const LUCKY_NUMBER_SHOW_7    ; 23
+	const LUCKY_NUMBER_SHOW_8    ; 24
+	const LUCKY_NUMBER_SHOW_9    ; 25
+	const LUCKY_NUMBER_SHOW_10   ; 26
+	const LUCKY_NUMBER_SHOW_11   ; 27
+	const LUCKY_NUMBER_SHOW_12   ; 28
+	const LUCKY_NUMBER_SHOW_13   ; 29
+	const LUCKY_NUMBER_SHOW_14   ; 2a
+	const LUCKY_NUMBER_SHOW_15   ; 2b
+	const PLACES_AND_PEOPLE_2    ; 2c
+	const PLACES_AND_PEOPLE_3    ; 2d
+	const PLACES_AND_PEOPLE_4    ; 2e
+	const PLACES_AND_PEOPLE_5    ; 2f
+	const PLACES_AND_PEOPLE_6    ; 30
+	const PLACES_AND_PEOPLE_7    ; 31
+	const ROCKET_RADIO_2         ; 32
+	const ROCKET_RADIO_3         ; 33
+	const ROCKET_RADIO_4         ; 34
+	const ROCKET_RADIO_5         ; 35
+	const ROCKET_RADIO_6         ; 36
+	const ROCKET_RADIO_7         ; 37
+	const ROCKET_RADIO_8         ; 38
+	const ROCKET_RADIO_9         ; 39
+	const ROCKET_RADIO_10        ; 3a
+	const OAKS_POKEMON_TALK_10   ; 3b
+	const OAKS_POKEMON_TALK_11   ; 3c
+	const OAKS_POKEMON_TALK_12   ; 3d
+	const OAKS_POKEMON_TALK_13   ; 3e
+	const OAKS_POKEMON_TALK_14   ; 3f
+	const BUENAS_PASSWORD_2      ; 40
+	const BUENAS_PASSWORD_3      ; 41
+	const BUENAS_PASSWORD_4      ; 42
+	const BUENAS_PASSWORD_5      ; 43
+	const BUENAS_PASSWORD_6      ; 44
+	const BUENAS_PASSWORD_7      ; 45
+	const BUENAS_PASSWORD_8      ; 46
+	const BUENAS_PASSWORD_9      ; 47
+	const BUENAS_PASSWORD_10     ; 48
+	const BUENAS_PASSWORD_11     ; 49
+	const BUENAS_PASSWORD_12     ; 4a
+	const BUENAS_PASSWORD_13     ; 4b
+	const BUENAS_PASSWORD_14     ; 4c
+	const BUENAS_PASSWORD_15     ; 4d
+	const BUENAS_PASSWORD_16     ; 4e
+	const BUENAS_PASSWORD_17     ; 4f
+	const BUENAS_PASSWORD_18     ; 50
+	const BUENAS_PASSWORD_19     ; 51
+	const BUENAS_PASSWORD_20     ; 52
+	const BUENAS_PASSWORD_21     ; 53
+	const RADIO_SCROLL           ; 54
+	const POKEDEX_SHOW_6         ; 55
+	const POKEDEX_SHOW_7         ; 56
+	const POKEDEX_SHOW_8         ; 57
 
 ; PlayRadio arguments (see engine/pokegear.asm)
 	const_def
@@ -101,23 +105,11 @@
 	const MAPRADIO_LETS_ALL_SING
 	const MAPRADIO_ROCKET
 
-; PasswordTable indexes (see engine/radio.asm)
-	const_def
-	const BUENA_STARTERS
-	const BUENA_DRINKS
-	const BUENA_ITEMS
-	const BUENA_BALLS
-	const BUENA_MON1
-	const BUENA_MON2
-	const BUENA_TOWNS
-	const BUENA_TYPES
-	const BUENA_MOVES
-	const BUENA_XITEMS
-	const BUENA_STATIONS
-NUM_PASSWORD_CATEGORIES EQU const_value
+; BuenasPasswordTable sizes (see data/radio/buenas_passwords.asm)
+NUM_PASSWORD_CATEGORIES EQU 11
 NUM_PASSWORDS_PER_CATEGORY EQU 3
 
-; PasswordTable string types (see engine/radio.asm)
+; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/radio.asm)
 	const_def
 	const BUENA_MON
 	const BUENA_ITEM
--- /dev/null
+++ b/data/radio/buenas_passwords.asm
@@ -1,0 +1,26 @@
+BuenasPasswordTable:
+; there are NUM_PASSWORD_CATEGORIES entries
+	dw .JohtoStarters
+	dw .Beverages
+	dw .HealingItems
+	dw .Balls
+	dw .Pokemon1
+	dw .Pokemon2
+	dw .JohtoTowns
+	dw .Types
+	dw .Moves
+	dw .XItems
+	dw .RadioStations
+
+               ; string type, points, option 1, option 2, option 3
+.JohtoStarters: db BUENA_MON,    10, CYNDAQUIL, TOTODILE, CHIKORITA
+.Beverages:     db BUENA_ITEM,   12, FRESH_WATER, SODA_POP, LEMONADE
+.HealingItems:  db BUENA_ITEM,   12, POTION, ANTIDOTE, PARLYZ_HEAL
+.Balls:         db BUENA_ITEM,   12, POKE_BALL, GREAT_BALL, ULTRA_BALL
+.Pokemon1:      db BUENA_MON,    10, PIKACHU, RATTATA, GEODUDE
+.Pokemon2:      db BUENA_MON,    10, HOOTHOOT, SPINARAK, DROWZEE
+.JohtoTowns:    db BUENA_STRING, 16, "NEW BARK TOWN@", "CHERRYGROVE CITY@", "AZALEA TOWN@"
+.Types:         db BUENA_STRING,  6, "FLYING@", "BUG@", "GRASS@"
+.Moves:         db BUENA_MOVE,   12, TACKLE, GROWL, MUD_SLAP
+.XItems:        db BUENA_ITEM,   12, X_ATTACK, X_DEFEND, X_SPEED
+.RadioStations: db BUENA_STRING, 13, "#MON Talk@", "#MON Music@", "Lucky Channel@"
--- /dev/null
+++ b/data/radio/channel_music.asm
@@ -1,0 +1,13 @@
+RadioChannelSongs:
+; entries correspond to radio channel ids
+	dw MUSIC_POKEMON_TALK
+	dw MUSIC_POKEMON_CENTER
+	dw MUSIC_TITLE
+	dw MUSIC_GAME_CORNER
+	dw MUSIC_BUENAS_PASSWORD
+	dw MUSIC_VIRIDIAN_CITY
+	dw MUSIC_BICYCLE
+	dw MUSIC_ROCKET_OVERTURE
+	dw MUSIC_POKE_FLUTE_CHANNEL
+	dw MUSIC_RUINS_OF_ALPH_RADIO
+	dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO
--- /dev/null
+++ b/data/radio/oaks_pkmn_talk_routes.asm
@@ -1,0 +1,19 @@
+; Oak's Pokémon Talk will list wild Pokémon on these maps.
+
+OaksPkmnTalkRoutes:
+	map ROUTE_29
+	map ROUTE_46
+	map ROUTE_30
+	map ROUTE_32
+	map ROUTE_34
+	map ROUTE_35
+	map ROUTE_37
+	map ROUTE_38
+	map ROUTE_39
+	map ROUTE_42
+	map ROUTE_43
+	map ROUTE_44
+	map ROUTE_45
+	map ROUTE_36
+	map ROUTE_31
+OaksPkmnTalkRoutesEnd
--- /dev/null
+++ b/data/radio/pnp_hidden_people.asm
@@ -1,0 +1,26 @@
+; Places and People will not describe these trainers.
+
+PnP_HiddenPeople:
+	db WILL
+	db BRUNO
+	db KAREN
+	db KOGA
+	db CHAMPION
+	; fallthrough
+PnP_HiddenPeople_BeatE4:
+	db BROCK
+	db MISTY
+	db LT_SURGE
+	db ERIKA
+	db JANINE
+	db SABRINA
+	db BLAINE
+	db BLUE
+	; fallthrough
+PnP_HiddenPeople_BeatKanto:
+	db RIVAL1
+	db POKEMON_PROF
+	db CAL
+	db RIVAL2
+	db RED
+	db -1
--- /dev/null
+++ b/data/radio/pnp_hidden_places.asm
@@ -1,0 +1,13 @@
+; Places and People will not describe these maps.
+
+PnP_HiddenPlaces:
+	map PALLET_TOWN
+	map ROUTE_22
+	map PEWTER_CITY
+	map CERULEAN_POLICE_STATION
+	map ROUTE_12
+	map ROUTE_11
+	map ROUTE_16
+	map ROUTE_14
+	map CINNABAR_POKECENTER_2F_BETA
+PnP_HiddenPlacesEnd
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -28,6 +28,7 @@
 	jp hl
 
 RadioJumptable:
+; entries correspond to constants/radio_constants.asm
 	dw OaksPkmnTalk1  ; $00
 	dw PokedexShow1 ; $01
 	dw BenMonMusic1  ; $02
@@ -203,11 +204,11 @@
 ; Choose a random route, and a random Pokemon from that route.
 .sample
 	call Random
-	and $1f
-	cp $f ; so wasteful
+	and %11111
+	cp (OaksPkmnTalkRoutesEnd - OaksPkmnTalkRoutes) / 2
 	jr nc, .sample
 	; We now have a number between 0 and 14.
-	ld hl, .routes
+	ld hl, OaksPkmnTalkRoutes
 	ld c, a
 	ld b, 0
 	add hl, bc
@@ -239,6 +240,7 @@
 	jr .loop
 
 .done
+	; Point hl to the list of morning Pokémon., skipping percentages
 rept 4
 	inc hl
 endr
@@ -245,8 +247,8 @@
 	; Generate a number, either 0, 1, or 2, to choose a time of day.
 .loop2
 	call Random
-	and 3
-	cp 3
+	and $3
+	cp DARKNESS_F
 	jr z, .loop2
 
 	ld bc, 2 * NUM_GRASSMON
@@ -273,6 +275,7 @@
 	ld de, wMonOrItemNameBuffer
 	ld bc, PKMN_NAME_LENGTH
 	call CopyBytes
+
 	; Now that we've chosen our wild Pokemon,
 	; let's recover the map index info and get its name.
 	pop bc
@@ -289,22 +292,7 @@
 	ld a, OAKS_POKEMON_TALK
 	jp PrintRadioLine
 
-.routes
-	map ROUTE_29
-	map ROUTE_46
-	map ROUTE_30
-	map ROUTE_32
-	map ROUTE_34
-	map ROUTE_35
-	map ROUTE_37
-	map ROUTE_38
-	map ROUTE_39
-	map ROUTE_42
-	map ROUTE_43
-	map ROUTE_44
-	map ROUTE_45
-	map ROUTE_36
-	map ROUTE_31
+INCLUDE "data/radio/oaks_pkmn_talk_routes.asm"
 
 OaksPkmnTalk5:
 	ld hl, OPT_OakText2
@@ -361,7 +349,7 @@
 
 OaksPkmnTalk8:
 	call Random
-	and $f
+	and $f ; 0-15 are all the valid indexes into .Descriptors
 	ld e, a
 	ld d, 0
 	ld hl, .Descriptors
@@ -473,7 +461,7 @@
 
 OaksPkmnTalk9:
 	call Random
-	and $f
+	and $f ; 0-15 are all the valid indexes into .Descriptors
 	ld e, a
 	ld d, 0
 	ld hl, .Descriptors
@@ -652,7 +640,7 @@
 	ld hl, wRadioTextDelay
 	dec [hl]
 	ret nz
-	ld de, $1d
+	ld de, MUSIC_POKEMON_TALK
 	callfar RadioMusicRestartDE
 	ld hl, .terminator
 	call PrintText
@@ -1146,7 +1134,7 @@
 PeoplePlaces3:
 	ld hl, PnP_Text3
 	call Random
-	cp $7b ; 48 percent
+	cp 49 percent - 1
 	ld a, PLACES_AND_PEOPLE_4 ; People
 	jr c, .ok
 	ld a, PLACES_AND_PEOPLE_6 ; Places
@@ -1175,15 +1163,15 @@
 	cp NUM_TRAINER_CLASSES - 1
 	jr nc, PeoplePlaces4
 	push af
-	ld hl, .E4Names
+	ld hl, PnP_HiddenPeople
 	ld a, [wStatusFlags]
 	bit 6, a ; ENGINE_CREDITS_SKIP
 	jr z, .ok
-	ld hl, .KantoLeaderNames
+	ld hl, PnP_HiddenPeople_BeatE4
 	ld a, [wKantoBadges]
-	cp %11111111
+	cp %11111111 ; all badges
 	jr nz, .ok
-	ld hl, .MiscNames
+	ld hl, PnP_HiddenPeople_BeatKanto
 .ok
 	pop af
 	ld c, a
@@ -1203,10 +1191,7 @@
 	ld a, PLACES_AND_PEOPLE_5
 	jp NextRadioLine
 
-.E4Names:          db WILL, BRUNO, KAREN, KOGA, CHAMPION
-.KantoLeaderNames: db BROCK, MISTY, LT_SURGE, ERIKA, JANINE, SABRINA, BLAINE, BLUE
-.MiscNames:        db RIVAL1, POKEMON_PROF, CAL, RIVAL2, RED
-                   db -1
+INCLUDE "data/radio/pnp_hidden_people.asm"
 
 PnP_Text4:
 	; @  @ @
@@ -1215,7 +1200,7 @@
 
 PeoplePlaces5:
 	call Random
-	and $f
+	and $f ; 0-15 are all the valid indexes into .Descriptors
 	ld e, a
 	ld d, 0
 	ld hl, .Descriptors
@@ -1225,11 +1210,11 @@
 	ld h, [hl]
 	ld l, a
 	call Random
-	cp $a ; 6.25 percent
+	cp 4 percent
 	ld a, PLACES_AND_PEOPLE
 	jr c, .ok
 	call Random
-	cp $7b ; 48 percent
+	cp 49 percent - 1
 	ld a, PLACES_AND_PEOPLE_4 ; People
 	jr c, .ok
 	ld a, PLACES_AND_PEOPLE_6 ; Places
@@ -1336,9 +1321,9 @@
 
 PeoplePlaces6: ; Places
 	call Random
-	cp 9
+	cp (PnP_HiddenPlacesEnd - PnP_HiddenPlaces) / 2
 	jr nc, PeoplePlaces6
-	ld hl, .Maps
+	ld hl, PnP_HiddenPlaces
 	ld c, a
 	ld b, 0
 	add hl, bc
@@ -1353,16 +1338,7 @@
 	ld a, PLACES_AND_PEOPLE_7
 	jp NextRadioLine
 
-.Maps:
-	map PALLET_TOWN
-	map ROUTE_22
-	map PEWTER_CITY
-	map CERULEAN_POLICE_STATION
-	map ROUTE_12
-	map ROUTE_11
-	map ROUTE_16
-	map ROUTE_14
-	map CINNABAR_POKECENTER_2F_BETA
+INCLUDE "data/radio/pnp_hidden_places.asm"
 
 PnP_Text5:
 	; @ @
@@ -1371,7 +1347,7 @@
 
 PeoplePlaces7:
 	call Random
-	and $f
+	and $f ; 0-15 are all the valid indexes into .Descriptors
 	ld e, a
 	ld d, 0
 	ld hl, .Descriptors
@@ -1386,7 +1362,7 @@
 	ld a, PLACES_AND_PEOPLE
 	jr c, .ok
 	call Random
-	cp 1 + 48 percent
+	cp 49 percent - 1
 	ld a, PLACES_AND_PEOPLE_4 ; People
 	jr c, .ok
 	ld a, PLACES_AND_PEOPLE_6 ; Places
@@ -1572,7 +1548,7 @@
 	ld a, [wBuenasPassword]
 ; If we already generated the password today, we don't need to generate a new one.
 	ld hl, wWeeklyFlags
-	bit 7, [hl]
+	bit 7, [hl] ; ENGINE_BUENAS_PASSWORD
 	jr nz, .AlreadyGotIt
 ; There are only 11 groups to choose from.
 .greater_than_11
@@ -1586,7 +1562,7 @@
 ; For each group, choose one of the three passwords.
 .greater_than_three
 	call Random
-	and $3
+	maskbits NUM_PASSWORDS_PER_CATEGORY
 	cp NUM_PASSWORDS_PER_CATEGORY
 	jr nc, .greater_than_three
 ; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password.
@@ -1594,7 +1570,7 @@
 	ld [wBuenasPassword], a
 ; Set the flag so that we don't generate a new password this week.
 	ld hl, wWeeklyFlags
-	set 7, [hl]
+	set 7, [hl] ; ENGINE_BUENAS_PASSWORD
 .AlreadyGotIt:
 	ld c, a
 	call GetBuenasPassword
@@ -1608,7 +1584,7 @@
 	ld a, c
 	swap a
 	and $f
-	ld hl, PasswordTable
+	ld hl, BuenasPasswordTable
 	ld d, 0
 	ld e, a
 	add hl, de
@@ -1640,12 +1616,12 @@
 	ret
 
 .StringFunctionJumpTable:
-	dw .Mon
-	dw .Item
-	dw .Move
-	dw .RawString
+; entries correspond to BUENA_* constants
+	dw .Mon       ; BUENA_MON
+	dw .Item      ; BUENA_ITEM
+	dw .Move      ; BUENA_MOVE
+	dw .RawString ; BUENA_STRING
 
-
 .Mon:
 	call .GetTheIndex
 	call GetPokemonName
@@ -1693,30 +1669,7 @@
 	ld de, StringBuffer1
 	ret
 
-PasswordTable:
-	dw .JohtoStarters
-	dw .Beverages
-	dw .HealingItems
-	dw .Balls
-	dw .Pokemon1
-	dw .Pokemon2
-	dw .JohtoTowns
-	dw .Types
-	dw .Moves
-	dw .XItems
-	dw .RadioStations
-                    ; string type, points, option 1, option 2, option 3
-.JohtoStarters:      db BUENA_MON,    10, CYNDAQUIL, TOTODILE, CHIKORITA
-.Beverages:          db BUENA_ITEM,   12, FRESH_WATER, SODA_POP, LEMONADE
-.HealingItems:       db BUENA_ITEM,   12, POTION, ANTIDOTE, PARLYZ_HEAL
-.Balls:              db BUENA_ITEM,   12, POKE_BALL, GREAT_BALL, ULTRA_BALL
-.Pokemon1:           db BUENA_MON,    10, PIKACHU, RATTATA, GEODUDE
-.Pokemon2:           db BUENA_MON,    10, HOOTHOOT, SPINARAK, DROWZEE
-.JohtoTowns:         db BUENA_STRING, 16, "NEW BARK TOWN@", "CHERRYGROVE CITY@", "AZALEA TOWN@"
-.Types:              db BUENA_STRING,  6, "FLYING@", "BUG@", "GRASS@"
-.Moves:              db BUENA_MOVE,   12, TACKLE, GROWL, MUD_SLAP
-.XItems:             db BUENA_ITEM,   12, X_ATTACK, X_DEFEND, X_SPEED
-.RadioStations:      db BUENA_STRING, 13, "#MON Talk@", "#MON Music@", "Lucky Channel@"
+INCLUDE "data/radio/buenas_passwords.asm"
 
 BuenasPassword5:
 	ld hl, BuenaRadioText5
@@ -1738,7 +1691,7 @@
 BuenasPasswordAfterMidnight:
 	push hl
 	ld hl, wWeeklyFlags
-	res 7, [hl]
+	res 7, [hl] ; ENGINE_BUENAS_PASSWORD
 	pop hl
 	ld a, BUENAS_PASSWORD_8
 	jp NextRadioLine
@@ -1745,7 +1698,7 @@
 
 BuenasPassword8:
 	ld hl, wWeeklyFlags
-	res 7, [hl]
+	res 7, [hl] ; ENGINE_BUENAS_PASSWORD
 	ld hl, BuenaRadioMidnightText10
 	ld a, BUENAS_PASSWORD_9
 	jp NextRadioLine
@@ -1958,18 +1911,7 @@
 	callfar RadioMusicRestartDE
 	ret
 
-RadioChannelSongs:
-	dw MUSIC_POKEMON_TALK
-	dw MUSIC_POKEMON_CENTER
-	dw MUSIC_TITLE
-	dw MUSIC_GAME_CORNER
-	dw MUSIC_BUENAS_PASSWORD
-	dw MUSIC_VIRIDIAN_CITY
-	dw MUSIC_BICYCLE
-	dw MUSIC_ROCKET_OVERTURE
-	dw MUSIC_POKE_FLUTE_CHANNEL
-	dw MUSIC_RUINS_OF_ALPH_RADIO
-	dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO
+INCLUDE "data/radio/channel_music.asm"
 
 NextRadioLine:
 	push af