summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--constants/pokemon_data_constants.asm18
-rw-r--r--constants/radio_constants.asm173
-rw-r--r--data/radio/channel_music.asm12
-rw-r--r--data/radio/oaks_pkmn_talk_routes.asm19
-rw-r--r--data/radio/pnp_hidden_people.asm26
-rw-r--r--data/radio/pnp_places.asm13
-rwxr-xr-xdata/text/common_1.asm96
-rw-r--r--data/wild/treemon_maps.asm48
-rw-r--r--data/wild/treemons.asm91
-rw-r--r--engine/events/treemons.asm273
-rw-r--r--engine/menus/intro_menu.asm18
-rw-r--r--engine/pokegear/radio.asm1417
-rw-r--r--gfx/pics.asm5
-rw-r--r--main.asm23
-rw-r--r--pokegold.link4
-rw-r--r--pokesilver.link4
-rwxr-xr-xsram.asm5
-rw-r--r--wram.asm8
18 files changed, 2069 insertions, 184 deletions
diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm
index caacc8d1..838c8036 100644
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -102,6 +102,24 @@ NUM_WATERMON EQU 3
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
+; treemon sets
+; TreeMons indexes (see data/wild/treemons.asm)
+ const_def
+ const TREEMON_SET_NONE
+ const TREEMON_SET_FOREST
+ const TREEMON_SET_CANYON
+ const TREEMON_SET_ROCK
+NUM_TREEMON_SETS EQU const_value
+; last 2 are unused/ignored
+ const TREEMON_SET_UNUSED
+ const TREEMON_SET_CITY
+
+; treemon scores
+ const_def
+ const TREEMON_SCORE_BAD ; 0
+ const TREEMON_SCORE_GOOD ; 1
+ const TREEMON_SCORE_RARE ; 2
+
; ChangeHappiness arguments (see data/happiness_changes.asm)
const_value = 1
const HAPPINESS_GAINLEVEL ; 01
diff --git a/constants/radio_constants.asm b/constants/radio_constants.asm
index 14bc75a4..b1c2c287 100644
--- a/constants/radio_constants.asm
+++ b/constants/radio_constants.asm
@@ -3,90 +3,69 @@
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 PLACES_AND_PEOPLE ; $04
+ const LETS_ALL_SING ; $05
+ const ROCKET_RADIO ; $06
+ const POKE_FLUTE_RADIO ; $07
+ const UNOWN_RADIO ; $08
+ const EVOLUTION_RADIO ; $09
+ const OAKS_POKEMON_TALK_2 ; $0a
+ const OAKS_POKEMON_TALK_3 ; $0b
+ const OAKS_POKEMON_TALK_4 ; $0c
+ const OAKS_POKEMON_TALK_5 ; $0d
+ const OAKS_POKEMON_TALK_6 ; $0e
+ const OAKS_POKEMON_TALK_7 ; $0f
+ const OAKS_POKEMON_TALK_8 ; $10
+ const OAKS_POKEMON_TALK_9 ; $11
+ const POKEDEX_SHOW_2 ; $12
+ const POKEDEX_SHOW_3 ; $13
+ const POKEDEX_SHOW_4 ; $14
+ const POKEDEX_SHOW_5 ; $15
+ const POKEMON_MUSIC_2 ; $16
+ const POKEMON_MUSIC_3 ; $17
+ const POKEMON_MUSIC_4 ; $18
+ const POKEMON_MUSIC_5 ; $19
+ const POKEMON_MUSIC_6 ; $1a
+ const POKEMON_MUSIC_7 ; $1b
+ const LETS_ALL_SING_2 ; $1c
+ const LUCKY_NUMBER_SHOW_2 ; $1d
+ const LUCKY_NUMBER_SHOW_3 ; $1e
+ const LUCKY_NUMBER_SHOW_4 ; $1f
+ const LUCKY_NUMBER_SHOW_5 ; $20
+ const LUCKY_NUMBER_SHOW_6 ; $21
+ const LUCKY_NUMBER_SHOW_7 ; $22
+ const LUCKY_NUMBER_SHOW_8 ; $23
+ const LUCKY_NUMBER_SHOW_9 ; $24
+ const LUCKY_NUMBER_SHOW_10 ; $25
+ const LUCKY_NUMBER_SHOW_11 ; $26
+ const LUCKY_NUMBER_SHOW_12 ; $27
+ const LUCKY_NUMBER_SHOW_13 ; $28
+ const LUCKY_NUMBER_SHOW_14 ; $29
+ const LUCKY_NUMBER_SHOW_15 ; $2a
+ const PLACES_AND_PEOPLE_2 ; $2b
+ const PLACES_AND_PEOPLE_3 ; $2c
+ const PLACES_AND_PEOPLE_4 ; $2d
+ const PLACES_AND_PEOPLE_5 ; $2e
+ const PLACES_AND_PEOPLE_6 ; $2f
+ const PLACES_AND_PEOPLE_7 ; $30
+ const ROCKET_RADIO_2 ; $31
+ const ROCKET_RADIO_3 ; $32
+ const ROCKET_RADIO_4 ; $33
+ const ROCKET_RADIO_5 ; $34
+ const ROCKET_RADIO_6 ; $35
+ const ROCKET_RADIO_7 ; $36
+ const ROCKET_RADIO_8 ; $37
+ const ROCKET_RADIO_9 ; $38
+ const ROCKET_RADIO_10 ; $39
+ const OAKS_POKEMON_TALK_10 ; $3a
+ const OAKS_POKEMON_TALK_11 ; $3b
+ const OAKS_POKEMON_TALK_12 ; $3c
+ const OAKS_POKEMON_TALK_13 ; $3d
+ const OAKS_POKEMON_TALK_14 ; $3e
+ const RADIO_SCROLL ; $3f
+ const POKEDEX_SHOW_6 ; $40
+ const POKEDEX_SHOW_7 ; $41
+ const POKEDEX_SHOW_8 ; $42
const_def
const MAPRADIO_POKEMON_CHANNEL
@@ -99,23 +78,9 @@
const MAPRADIO_LETS_ALL_SING
const MAPRADIO_ROCKET
- const_def
- const BUENA_MON
- const BUENA_ITEM
- const BUENA_MOVE
- const BUENA_STRING
-
- 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
-NUM_PASSWORDS_PER_CATEGORY EQU 3
+; 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
+NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
+NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
+NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
+NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives
diff --git a/data/radio/channel_music.asm b/data/radio/channel_music.asm
new file mode 100644
index 00000000..c11360af
--- /dev/null
+++ b/data/radio/channel_music.asm
@@ -0,0 +1,12 @@
+RadioChannelSongs:
+; entries correspond to radio channel ids
+ dw MUSIC_POKEMON_TALK
+ dw MUSIC_POKEMON_CENTER
+ dw MUSIC_TITLE
+ dw MUSIC_GAME_CORNER
+ 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
diff --git a/data/radio/oaks_pkmn_talk_routes.asm b/data/radio/oaks_pkmn_talk_routes.asm
new file mode 100644
index 00000000..acef4bdd
--- /dev/null
+++ b/data/radio/oaks_pkmn_talk_routes.asm
@@ -0,0 +1,19 @@
+; Oak's Pokémon Talk will list wild Pokémon on these maps.
+
+OaksPKMNTalkRoutes:
+ map_id ROUTE_29
+ map_id ROUTE_46
+ map_id ROUTE_30
+ map_id ROUTE_32
+ map_id ROUTE_34
+ map_id ROUTE_35
+ map_id ROUTE_37
+ map_id ROUTE_38
+ map_id ROUTE_39
+ map_id ROUTE_42
+ map_id ROUTE_43
+ map_id ROUTE_44
+ map_id ROUTE_45
+ map_id ROUTE_36
+ map_id ROUTE_31
+.End
diff --git a/data/radio/pnp_hidden_people.asm b/data/radio/pnp_hidden_people.asm
new file mode 100644
index 00000000..5eb17857
--- /dev/null
+++ b/data/radio/pnp_hidden_people.asm
@@ -0,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
diff --git a/data/radio/pnp_places.asm b/data/radio/pnp_places.asm
new file mode 100644
index 00000000..540078ef
--- /dev/null
+++ b/data/radio/pnp_places.asm
@@ -0,0 +1,13 @@
+; Places and People will describe the landmarks of these maps.
+
+PnP_Places:
+ map_id PALLET_TOWN ; PALLET_TOWN
+ map_id ROUTE_22 ; ROUTE_22
+ map_id PEWTER_CITY ; PEWTER_CITY
+ map_id CERULEAN_POLICE_STATION ; CERULEAN_CITY
+ map_id ROUTE_12 ; ROUTE_12
+ map_id ROUTE_11 ; ROUTE_11
+ map_id ROUTE_16 ; ROUTE_16
+ map_id ROUTE_14 ; ROUTE_14
+ map_id CINNABAR_POKECENTER_2F_BETA ; CINNABAR_ISLAND
+.End
diff --git a/data/text/common_1.asm b/data/text/common_1.asm
index bab2855e..7cebc41e 100755
--- a/data/text/common_1.asm
+++ b/data/text/common_1.asm
@@ -498,162 +498,162 @@ _OPT_MaryText1::
text "'s"
done
-OPT_SweetAdorably::
+_OPT_SweetAdorablyText::
text_start
line "sweet and adorably"
done
-OPT_WigglySlickly::
+_OPT_WigglySlicklyText::
text_start
line "wiggly and slickly"
done
-OPT_AptlyNamed::
+_OPT_AptlyNamedText::
text_start
line "aptly named and"
done
-OPT_UndeniablyKindOf::
+_OPT_UndeniablyKindOfText::
text_start
line "undeniably kind of"
done
-OPT_Unbearably::
+_OPT_UnbearablyText::
text_start
line "so, so unbearably"
done
-OPT_WowImpressively::
+_OPT_WowImpressivelyText::
text_start
line "wow, impressively"
done
-OPT_AlmostPoisonously::
+_OPT_AlmostPoisonouslyText::
text_start
line "almost poisonously"
done
-OPT_Sensually::
+_OPT_SensuallyText::
text_start
line "ooh, so sensually"
done
-OPT_Mischievously::
+_OPT_MischievouslyText::
text_start
line "so mischievously"
done
-OPT_Topically::
+_OPT_TopicallyText::
text_start
line "so very topically"
done
-OPT_Addictively::
+_OPT_AddictivelyText::
text_start
line "sure addictively"
done
-OPT_LooksInWater::
+_OPT_LooksInWaterText::
text_start
line "looks in water is"
done
-OPT_EvolutionMustBe::
+_OPT_EvolutionMustBeText::
text_start
line "evolution must be"
done
-OPT_Provocatively::
+_OPT_ProvocativelyText::
text_start
line "provocatively"
done
-OPT_FlippedOut::
+_OPT_FlippedOutText::
text_start
line "so flipped out and"
done
-OPT_HeartMeltingly::
+_OPT_HeartMeltinglyText::
text_start
line "heart-meltingly"
done
-OPT_Cute::
+_OPT_CuteText::
text_start
line "cute."
done
-OPT_Weird::
+_OPT_WeirdText::
text_start
line "weird."
done
-OPT_Pleasant::
+_OPT_PleasantText::
text_start
line "pleasant."
done
-OPT_BoldSortOf::
+_OPT_BoldSortOfText::
text_start
line "bold, sort of."
done
-OPT_Frightening::
+_OPT_FrighteningText::
text_start
line "frightening."
done
-OPT_SuaveDebonair::
+_OPT_SuaveDebonairText::
text_start
line "suave & debonair!"
done
-OPT_Powerful::
+_OPT_PowerfulText::
text_start
line "powerful."
done
-OPT_Exciting::
+_OPT_ExcitingText::
text_start
line "exciting."
done
-OPT_Groovy::
+_OPT_GroovyText::
text_start
line "now!"
done
-OPT_Inspiring::
+_OPT_InspiringText::
text_start
line "inspiring."
done
-OPT_Friendly::
+_OPT_FriendlyText::
text_start
line "friendly."
done
-OPT_HotHotHot::
+_OPT_HotHotHotText::
text_start
line "hot, hot, hot!"
done
-OPT_Stimulating::
+_OPT_StimulatingText::
text_start
line "stimulating."
done
-OPT_Guarded::
+_OPT_GuardedText::
text_start
line "guarded."
done
-OPT_Lovely::
+_OPT_LovelyText::
text_start
line "lovely."
done
-OPT_Speedy::
+_OPT_SpeedyText::
text_start
line "speedy."
done
@@ -817,82 +817,82 @@ _PnP_Text4::
text_ram wStringBuffer1
db "@@"
-_PnP_cute::
+_PnP_CuteText::
text_start
line "is cute."
done
-_PnP_lazy::
+_PnP_LazyText::
text_start
line "is sort of lazy."
done
-_PnP_happy::
+_PnP_HappyText::
text_start
line "is always happy."
done
-_PnP_noisy::
+_PnP_NoisyText::
text_start
line "is quite noisy."
done
-_PnP_precocious::
+_PnP_PrecociousText::
text_start
line "is precocious."
done
-_PnP_bold::
+_PnP_BoldText::
text_start
line "is somewhat bold."
done
-_PnP_picky::
+_PnP_PickyText::
text_start
line "is too picky!"
done
-_PnP_sortofok::
+_PnP_SortOfOKText::
text_start
line "is sort of OK."
done
-_PnP_soso::
+_PnP_SoSoText::
text_start
line "is just so-so."
done
-_PnP_great::
+_PnP_GreatText::
text_start
line "is actually great."
done
-_PnP_mytype::
+_PnP_MyTypeText::
text_start
line "is just my type."
done
-_PnP_cool::
+_PnP_CoolText::
text_start
line "is so cool, no?"
done
-_PnP_inspiring::
+_PnP_InspiringText::
text_start
line "is inspiring!"
done
-_PnP_weird::
+_PnP_WeirdText::
text_start
line "is kind of weird."
done
-_PnP_rightforme::
+_PnP_RightForMeText::
text_start
line "is right for me?"
done
-_PnP_odd::
+_PnP_OddText::
text_start
line "is definitely odd!"
done
diff --git a/data/wild/treemon_maps.asm b/data/wild/treemon_maps.asm
new file mode 100644
index 00000000..ed547b84
--- /dev/null
+++ b/data/wild/treemon_maps.asm
@@ -0,0 +1,48 @@
+treemon_map: MACRO
+ map_id \1
+ db \2 ; treemon set
+ENDM
+
+TreeMonMaps:
+ treemon_map ROUTE_26, TREEMON_SET_FOREST
+ treemon_map ROUTE_27, TREEMON_SET_FOREST
+ treemon_map ROUTE_28, TREEMON_SET_NONE
+ treemon_map ROUTE_29, TREEMON_SET_CANYON
+ treemon_map ROUTE_30, TREEMON_SET_CANYON
+ treemon_map ROUTE_31, TREEMON_SET_CANYON
+ treemon_map ROUTE_32, TREEMON_SET_CANYON
+ treemon_map ROUTE_33, TREEMON_SET_CANYON
+ treemon_map ROUTE_34, TREEMON_SET_FOREST
+ treemon_map ROUTE_35, TREEMON_SET_FOREST
+ treemon_map ROUTE_36, TREEMON_SET_FOREST
+ treemon_map ROUTE_37, TREEMON_SET_FOREST
+ treemon_map ROUTE_38, TREEMON_SET_FOREST
+ treemon_map ROUTE_39, TREEMON_SET_FOREST
+ treemon_map ROUTE_40, TREEMON_SET_NONE
+ treemon_map ROUTE_41, TREEMON_SET_NONE
+ treemon_map ROUTE_42, TREEMON_SET_CANYON
+ treemon_map ROUTE_43, TREEMON_SET_CANYON
+ treemon_map ROUTE_44, TREEMON_SET_CANYON
+ treemon_map ROUTE_45, TREEMON_SET_CANYON
+ treemon_map ROUTE_46, TREEMON_SET_CANYON
+ treemon_map NEW_BARK_TOWN, TREEMON_SET_CITY
+ treemon_map CHERRYGROVE_CITY, TREEMON_SET_NONE
+ treemon_map VIOLET_CITY, TREEMON_SET_CITY
+ treemon_map AZALEA_TOWN, TREEMON_SET_FOREST
+ treemon_map CIANWOOD_CITY, TREEMON_SET_NONE
+ treemon_map GOLDENROD_CITY, TREEMON_SET_NONE
+ treemon_map OLIVINE_CITY, TREEMON_SET_NONE
+ treemon_map ECRUTEAK_CITY, TREEMON_SET_CITY
+ treemon_map MAHOGANY_TOWN, TREEMON_SET_CITY
+ treemon_map LAKE_OF_RAGE, TREEMON_SET_FOREST
+ treemon_map BLACKTHORN_CITY, TREEMON_SET_CITY
+ treemon_map SILVER_CAVE_OUTSIDE, TREEMON_SET_NONE
+ treemon_map ILEX_FOREST, TREEMON_SET_FOREST
+ db -1
+
+RockMonMaps:
+ treemon_map CIANWOOD_CITY, TREEMON_SET_ROCK
+ treemon_map ROUTE_40, TREEMON_SET_ROCK
+ treemon_map DARK_CAVE_VIOLET_ENTRANCE, TREEMON_SET_ROCK
+ treemon_map SLOWPOKE_WELL_B1F, TREEMON_SET_ROCK
+ db -1
diff --git a/data/wild/treemons.asm b/data/wild/treemons.asm
new file mode 100644
index 00000000..639b4607
--- /dev/null
+++ b/data/wild/treemons.asm
@@ -0,0 +1,91 @@
+TreeMons:
+; entries correspond to TREEMON_SET_* constants
+ dw TreeMonSet_None
+ dw TreeMonSet_Forest
+ dw TreeMonSet_Canyon
+ dw TreeMonSet_Rock
+ dw TreeMonSet_Unused
+ dw TreeMonSet_None
+
+; Two tables each (common, rare).
+; Structure:
+; db %, species, level
+
+TreeMonSet_None:
+TreeMonSet_Unused:
+; common
+ db 50, VENONAT, 15
+ db 30, VENONAT, 15
+ db 10, ABRA, 15
+ db 5, ABRA, 15
+ db 5, VENOMOTH, 15
+ db -1
+; rare
+ db 50, VENONAT, 15
+ db 30, MAGNEMITE, 15
+ db 10, ABRA, 15
+ db 5, ABRA, 15
+ db 5, VENOMOTH, 15
+ db -1
+
+TreeMonSet_Forest:
+
+IF DEF(_GOLD)
+; common
+ db 50, CATERPIE, 10
+ db 15, CATERPIE, 10
+ db 15, METAPOD, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, BUTTERFREE, 10
+ db -1
+; rare
+ db 50, CATERPIE, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, BUTTERFREE, 10
+ db -1
+
+ELIF DEF(_SILVER)
+; common
+ db 50, WEEDLE, 10
+ db 15, WEEDLE, 10
+ db 15, KAKUNA, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, BEEDRILL, 10
+ db -1
+; rare
+ db 50, WEEDLE, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, BEEDRILL, 10
+ db -1
+ENDC
+
+TreeMonSet_Canyon:
+; common
+ db 50, SPEAROW, 10
+ db 15, SPEAROW, 10
+ db 15, SPEAROW, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+; rare
+ db 50, SPEAROW, 10
+ db 15, HERACROSS, 10
+ db 15, HERACROSS, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+
+TreeMonSet_Rock:
+ db 90, KRABBY, 15
+ db 10, SHUCKLE, 15
+ db -1
diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm
new file mode 100644
index 00000000..94782643
--- /dev/null
+++ b/engine/events/treemons.asm
@@ -0,0 +1,273 @@
+TreeMonEncounter:
+ xor a
+ ld [wTempWildMonSpecies], a
+ ld [wCurPartyLevel], a
+
+ ld hl, TreeMonMaps
+ call GetTreeMonSet
+ jr nc, .no_battle
+
+ call GetTreeMons
+ jr nc, .no_battle
+
+ call GetTreeMon
+ jr nc, .no_battle
+
+ ld a, BATTLETYPE_TREE
+ ld [wBattleType], a
+ ld a, 1
+ ld [wScriptVar], a
+ ret
+
+.no_battle
+ xor a
+ ld [wScriptVar], a
+ ret
+
+RockMonEncounter:
+ xor a
+ ld [wTempWildMonSpecies], a
+ ld [wCurPartyLevel], a
+
+ ld hl, RockMonMaps
+ call GetTreeMonSet
+ jr nc, .no_battle
+
+ call GetTreeMons
+ jr nc, .no_battle
+
+ ; 40% chance of an encounter
+ ld a, 10
+ call RandomRange
+ cp 4
+ jr nc, .no_battle
+
+ call SelectTreeMon
+ jr nc, .no_battle
+
+ ret
+
+.no_battle
+ xor a
+ ret
+
+db $05 ; ????
+
+GetTreeMonSet:
+; Return carry and treemon set in a
+; if the current map is in table hl.
+ ld a, [wMapNumber]
+ ld e, a
+ ld a, [wMapGroup]
+ ld d, a
+.loop
+ ld a, [hli]
+ cp -1
+ jr z, .not_in_table
+
+ cp d
+ jr nz, .skip2
+
+ ld a, [hli]
+ cp e
+ jr nz, .skip1
+
+ jr .in_table
+
+.skip2
+ inc hl
+.skip1
+ inc hl
+ jr .loop
+
+.not_in_table
+ xor a
+ ret
+
+.in_table
+ ld a, [hl]
+ scf
+ ret
+
+INCLUDE "data/wild/treemon_maps.asm"
+
+GetTreeMons:
+; Return the address of TreeMon table a in hl.
+; Return nc if table a doesn't exist.
+
+ cp NUM_TREEMON_SETS
+ jr nc, .quit
+
+ and a
+ jr z, .quit
+
+ ld e, a
+ ld d, 0
+ ld hl, TreeMons
+ add hl, de
+ add hl, de
+
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+ scf
+ ret
+
+.quit
+ xor a
+ ret
+
+INCLUDE "data/wild/treemons.asm"
+
+GetTreeMon:
+ push hl
+ call GetTreeScore
+ pop hl
+ and a ; TREEMON_SCORE_BAD
+ jr z, .bad
+ cp TREEMON_SCORE_GOOD
+ jr z, .good
+ cp TREEMON_SCORE_RARE
+ jr z, .rare
+ ret
+
+.bad
+ ; 10% chance of an encounter
+ ld a, 10
+ call RandomRange
+ and a
+ jr nz, NoTreeMon
+ jr SelectTreeMon
+
+.good
+ ; 50% chance of an encounter
+ ld a, 10
+ call RandomRange
+ cp 5
+ jr nc, NoTreeMon
+ jr SelectTreeMon
+
+.rare
+ ; 80% chance of an encounter
+ ld a, 10
+ call RandomRange
+ cp 8
+ jr nc, NoTreeMon
+ jr .skip
+.skip
+ ld a, [hli]
+ cp -1
+ jr nz, .skip
+ call SelectTreeMon
+ ret
+
+SelectTreeMon:
+; Read a TreeMons table and pick one monster at random.
+
+ ld a, 100
+ call RandomRange
+.loop
+ sub [hl]
+ jr c, .ok
+ inc hl
+ inc hl
+ inc hl
+ jr .loop
+
+.ok
+ ld a, [hli]
+ cp -1
+ jr z, NoTreeMon
+
+ ld a, [hli]
+ ld [wTempWildMonSpecies], a
+ ld a, [hl]
+ ld [wCurPartyLevel], a
+ scf
+ ret
+
+NoTreeMon:
+ xor a
+ ld [wTempWildMonSpecies], a
+ ld [wCurPartyLevel], a
+ ret
+
+GetTreeScore:
+ call .CoordScore
+ ld [wBuffer1], a
+ call .OTIDScore
+ ld [wBuffer2], a
+ ld c, a
+ ld a, [wBuffer1]
+ sub c
+ jr z, .rare
+ jr nc, .ok
+ add 10
+.ok
+ cp 5
+ jr c, .good
+
+.bad
+ xor a ; TREEMON_SCORE_BAD
+ ret
+
+.good
+ ld a, TREEMON_SCORE_GOOD
+ ret
+
+.rare
+ ld a, TREEMON_SCORE_RARE
+ ret
+
+.CoordScore:
+ call GetFacingTileCoord
+ ld hl, 0
+ ld c, e
+ ld b, 0
+ ld a, d
+
+ and a
+ jr z, .next
+.loop
+ add hl, bc
+ dec a
+ jr nz, .loop
+.next
+
+ add hl, bc
+ ld c, d
+ add hl, bc
+
+ ld a, h
+ ldh [hDividend], a
+ ld a, l
+ ldh [hDividend + 1], a
+ ld a, 5
+ ldh [hDivisor], a
+ ld b, 2
+ call Divide
+
+ ldh a, [hQuotient + 2]
+ ldh [hDividend], a
+ ldh a, [hQuotient + 3]
+ ldh [hDividend + 1], a
+ ld a, 10
+ ldh [hDivisor], a
+ ld b, 2
+ call Divide
+
+ ldh a, [hRemainder]
+ ret
+
+.OTIDScore:
+ ld a, [wPlayerID]
+ ldh [hDividend], a
+ ld a, [wPlayerID + 1]
+ ldh [hDividend + 1], a
+ ld a, 10
+ ldh [hDivisor], a
+ ld b, 2
+ call Divide
+ ldh a, [hRemainder]
+ ret
diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm
index 7c46ed93..e7534472 100644
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -451,28 +451,28 @@ InitializeWorld: ; 5d97 (1:5d97)
ret
LoadOrRegenerateLuckyIDNumber: ; 5da7 (1:5da7)
- ld a, $0
+ ld a, 0
call OpenSRAM
ld a, [wCurDay]
inc a
ld b, a
- ld a, [s0_ac68]
+ ld a, [sLuckyNumberDay]
cp b
- ld a, [s0_ac6a]
+ ld a, [sLuckyIDNumber + 1]
ld c, a
- ld a, [s0_ac69]
+ ld a, [sLuckyIDNumber]
jr z, .asm_5dc9
ld a, b
- ld [s0_ac68], a
+ ld [sLuckyNumberDay], a
call Random
ld c, a
call Random
.asm_5dc9
- ld [wd9e9], a
- ld [s0_ac69], a
+ ld [wLuckyIDNumber], a
+ ld [sLuckyIDNumber], a
ld a, c
- ld [wd9ea], a
- ld [s0_ac6a], a
+ ld [wLuckyIDNumber + 1], a
+ ld [sLuckyIDNumber + 1], a
jp CloseSRAM
MainMenu_Continue:
diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm
new file mode 100644
index 00000000..44babe34
--- /dev/null
+++ b/engine/pokegear/radio.asm
@@ -0,0 +1,1417 @@
+PlayRadioShow:
+; If we're already in the radio program proper, we don't need to be here.
+ ld a, [wCurRadioLine]
+ cp POKE_FLUTE_RADIO
+ jr nc, .ok
+; If Team Rocket is not occupying the radio tower, we don't need to be here.
+ ld a, [wStatusFlags2]
+ bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a
+ jr z, .ok
+; If we're in Kanto, we don't need to be here.
+ call IsInJohto
+ and a
+ jr nz, .ok
+; Team Rocket broadcasts on all stations.
+ ld a, ROCKET_RADIO
+ ld [wCurRadioLine], a
+.ok
+; Jump to the currently loaded station. The index to which we need to jump is in wCurRadioLine.
+ ld a, [wCurRadioLine]
+ ld e, a
+ ld d, 0
+ ld hl, RadioJumptable
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp hl
+
+RadioJumptable:
+; entries correspond to constants/radio_constants.asm
+ dw OaksPKMNTalk1 ; $00
+ dw PokedexShow1 ; $01
+ dw BenMonMusic1 ; $02
+ dw LuckyNumberShow1 ; $03
+ dw PeoplePlaces1 ; $04
+ dw FernMonMusic1 ; $05
+ dw RocketRadio1 ; $06
+ dw PokeFluteRadio ; $07
+ dw UnownRadio ; $08
+ dw EvolutionRadio ; $09
+; OaksPKMNTalk
+ dw OaksPKMNTalk2 ; $0a
+ dw OaksPKMNTalk3 ; $0b
+ dw OaksPKMNTalk4 ; $0c
+ dw OaksPKMNTalk5 ; $0d
+ dw OaksPKMNTalk6 ; $0e
+ dw OaksPKMNTalk7 ; $0f
+ dw OaksPKMNTalk8 ; $10
+ dw OaksPKMNTalk9 ; $11
+ dw PokedexShow2 ; $12
+ dw PokedexShow3 ; $13
+ dw PokedexShow4 ; $14
+ dw PokedexShow5 ; $15
+; Ben Music
+ dw BenMonMusic2 ; $16
+ dw BenMonMusic3 ; $17
+ dw BenFernMusic4 ; $18
+ dw BenFernMusic5 ; $19
+ dw BenFernMusic6 ; $1a
+ dw BenFernMusic7 ; $1b
+ dw FernMonMusic2 ; $1c
+; Lucky Number Show
+ dw LuckyNumberShow2 ; $1d
+ dw LuckyNumberShow3 ; $1e
+ dw LuckyNumberShow4 ; $1f
+ dw LuckyNumberShow5 ; $20
+ dw LuckyNumberShow6 ; $21
+ dw LuckyNumberShow7 ; $22
+ dw LuckyNumberShow8 ; $23
+ dw LuckyNumberShow9 ; $24
+ dw LuckyNumberShow10 ; $25
+ dw LuckyNumberShow11 ; $26
+ dw LuckyNumberShow12 ; $27
+ dw LuckyNumberShow13 ; $28
+ dw LuckyNumberShow14 ; $29
+ dw LuckyNumberShow15 ; $2a
+; People & Places
+ dw PeoplePlaces2 ; $2b
+ dw PeoplePlaces3 ; $2c
+ dw PeoplePlaces4 ; $2d
+ dw PeoplePlaces5 ; $2e
+ dw PeoplePlaces6 ; $2f
+ dw PeoplePlaces7 ; $30
+; Rocket Radio
+ dw RocketRadio2 ; $31
+ dw RocketRadio3 ; $32
+ dw RocketRadio4 ; $33
+ dw RocketRadio5 ; $34
+ dw RocketRadio6 ; $35
+ dw RocketRadio7 ; $36
+ dw RocketRadio8 ; $37
+ dw RocketRadio9 ; $38
+ dw RocketRadio10 ; $39
+; More Pokemon Channel stuff
+ dw OaksPKMNTalk10 ; $3a
+ dw OaksPKMNTalk11 ; $3b
+ dw OaksPKMNTalk12 ; $3c
+ dw OaksPKMNTalk13 ; $3d
+ dw OaksPKMNTalk14 ; $3e
+ dw RadioScroll ; $3f
+; More Pokemon Channel stuff
+ dw PokedexShow6 ; $40
+ dw PokedexShow7 ; $41
+ dw PokedexShow8 ; $42
+
+PrintRadioLine:
+ ld [wNextRadioLine], a
+ ld hl, wRadioText
+ ld a, [wNumRadioLinesPrinted]
+ cp 2
+ jr nc, .print
+ inc hl
+ ld [hl], TX_START
+ inc a
+ ld [wNumRadioLinesPrinted], a
+ cp 2
+ jr nz, .print
+ bccoord 1, 16
+ call PlaceHLTextAtBC
+ jr .skip
+.print
+ call PrintTextboxText
+.skip
+ ld a, RADIO_SCROLL
+ ld [wCurRadioLine], a
+ ld a, 100
+ ld [wRadioTextDelay], a
+ ret
+
+ReplacePeriodsWithSpaces:
+ push hl
+ ld b, SCREEN_WIDTH * 2
+.loop
+ ld a, [hl]
+ cp "."
+ jr nz, .next
+ ld [hl], " "
+
+.next
+ inc hl
+ dec b
+ jr nz, .loop
+ pop hl
+ ret
+
+RadioScroll:
+ ld hl, wRadioTextDelay
+ ld a, [hl]
+ and a
+ jr z, .proceed
+ dec [hl]
+ ret
+.proceed
+ ld a, [wNextRadioLine]
+ ld [wCurRadioLine], a
+ ld a, [wNumRadioLinesPrinted]
+ cp 1
+ call nz, CopyBottomLineToTopLine
+ jp ClearBottomLine
+
+OaksPKMNTalk1:
+ ld a, 5
+ ld [wOaksPKMNTalkSegmentCounter], a
+ call StartRadioStation
+ ld hl, OPT_IntroText1
+ ld a, OAKS_POKEMON_TALK_2
+ jp NextRadioLine
+
+OaksPKMNTalk2:
+ ld hl, OPT_IntroText2
+ ld a, OAKS_POKEMON_TALK_3
+ jp NextRadioLine
+
+OaksPKMNTalk3:
+ ld hl, OPT_IntroText3
+ ld a, OAKS_POKEMON_TALK_4
+ jp NextRadioLine
+
+OaksPKMNTalk4:
+; Choose a random route, and a random Pokemon from that route.
+.sample
+ call Random
+ and %11111
+ cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2
+ jr nc, .sample
+ ; We now have a number between 0 and 14.
+ ld hl, OaksPKMNTalkRoutes
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ ; bc now contains the chosen map's group and number indices.
+ push bc
+
+ ; Search the JohtoGrassWildMons array for the chosen map.
+ ld hl, JohtoGrassWildMons
+.loop
+ ld a, BANK(JohtoGrassWildMons)
+ call GetFarByte
+ cp -1
+ jr z, .overflow
+ inc hl
+ cp b
+ jr nz, .next
+ ld a, BANK(JohtoGrassWildMons)
+ call GetFarByte
+ cp c
+ jr z, .done
+.next
+ dec hl
+ ld de, GRASS_WILDDATA_LENGTH
+ add hl, de
+ jr .loop
+
+.done
+ ; Point hl to the list of morning Pokémon., skipping percentages
+rept 4
+ inc hl
+endr
+ ; Generate a number, either 0, 1, or 2, to choose a time of day.
+.loop2
+ call Random
+ maskbits NUM_DAYTIMES
+ cp DARKNESS_F
+ jr z, .loop2
+
+ ld bc, 2 * NUM_GRASSMON
+ call AddNTimes
+.loop3
+ ; Choose one of the middle three Pokemon.
+ call Random
+ and NUM_GRASSMON
+ cp 2
+ jr c, .loop3
+ cp 5
+ jr nc, .loop3
+ ld e, a
+ ld d, 0
+ add hl, de
+ add hl, de
+ inc hl ; skip level
+ ld a, BANK(JohtoGrassWildMons)
+ call GetFarByte
+ ld [wNamedObjectIndexBuffer], a
+ ld [wCurPartySpecies], a
+ call GetPokemonName
+ ld hl, wStringBuffer1
+ ld de, wMonOrItemNameBuffer
+ ld bc, MON_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
+ call GetWorldMapLocation
+ ld e, a
+ callfar GetLandmarkName
+ ld hl, OPT_OakText1
+ call CopyRadioTextToRAM
+ ld a, OAKS_POKEMON_TALK_5
+ jp PrintRadioLine
+
+.overflow
+ pop bc
+ ld a, OAKS_POKEMON_TALK
+ jp PrintRadioLine
+
+INCLUDE "data/radio/oaks_pkmn_talk_routes.asm"
+
+OaksPKMNTalk5:
+ ld hl, OPT_OakText2
+ ld a, OAKS_POKEMON_TALK_6
+ jp NextRadioLine
+
+OaksPKMNTalk6:
+ ld hl, OPT_OakText3
+ ld a, OAKS_POKEMON_TALK_7
+ jp NextRadioLine
+
+OPT_IntroText1:
+ text_far _OPT_IntroText1
+ text_end
+
+OPT_IntroText2:
+ text_far _OPT_IntroText2
+ text_end
+
+OPT_IntroText3:
+ text_far _OPT_IntroText3
+ text_end
+
+OPT_OakText1:
+ text_far _OPT_OakText1
+ text_end
+
+OPT_OakText2:
+ text_far _OPT_OakText2
+ text_end
+
+OPT_OakText3:
+ text_far _OPT_OakText3
+ text_end
+
+OaksPKMNTalk7:
+ ld a, [wCurPartySpecies]
+ ld [wNamedObjectIndexBuffer], a
+ call GetPokemonName
+ ld hl, OPT_MaryText1
+ ld a, OAKS_POKEMON_TALK_8
+ jp NextRadioLine
+
+OPT_MaryText1:
+ text_far _OPT_MaryText1
+ text_end
+
+OaksPKMNTalk8:
+ ; 0-15 are all valid indexes into .Adverbs,
+ ; so no need for a retry loop
+ call Random
+ maskbits NUM_OAKS_POKEMON_TALK_ADVERBS
+ ld e, a
+ ld d, 0
+ ld hl, .Adverbs
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, OAKS_POKEMON_TALK_9
+ jp NextRadioLine
+
+.Adverbs:
+; there are NUM_OAKS_POKEMON_TALK_ADVERBS entries
+ dw .OPT_SweetAdorablyText
+ dw .OPT_WigglySlicklyText
+ dw .OPT_AptlyNamedText
+ dw .OPT_UndeniablyKindOfText
+ dw .OPT_UnbearablyText
+ dw .OPT_WowImpressivelyText
+ dw .OPT_AlmostPoisonouslyText
+ dw .OPT_SensuallyText
+ dw .OPT_MischievouslyText
+ dw .OPT_TopicallyText
+ dw .OPT_AddictivelyText
+ dw .OPT_LooksInWaterText
+ dw .OPT_EvolutionMustBeText
+ dw .OPT_ProvocativelyText
+ dw .OPT_FlippedOutText
+ dw .OPT_HeartMeltinglyText
+
+.OPT_SweetAdorablyText:
+ text_far _OPT_SweetAdorablyText
+ text_end
+
+.OPT_WigglySlicklyText:
+ text_far _OPT_WigglySlicklyText
+ text_end
+
+.OPT_AptlyNamedText:
+ text_far _OPT_AptlyNamedText
+ text_end
+
+.OPT_UndeniablyKindOfText:
+ text_far _OPT_UndeniablyKindOfText
+ text_end
+
+.OPT_UnbearablyText:
+ text_far _OPT_UnbearablyText
+ text_end
+
+.OPT_WowImpressivelyText:
+ text_far _OPT_WowImpressivelyText
+ text_end
+
+.OPT_AlmostPoisonouslyText:
+ text_far _OPT_AlmostPoisonouslyText
+ text_end
+
+.OPT_SensuallyText:
+ text_far _OPT_SensuallyText
+ text_end
+
+.OPT_MischievouslyText:
+ text_far _OPT_MischievouslyText
+ text_end
+
+.OPT_TopicallyText:
+ text_far _OPT_TopicallyText
+ text_end
+
+.OPT_AddictivelyText:
+ text_far _OPT_AddictivelyText
+ text_end
+
+.OPT_LooksInWaterText:
+ text_far _OPT_LooksInWaterText
+ text_end
+
+.OPT_EvolutionMustBeText:
+ text_far _OPT_EvolutionMustBeText
+ text_end
+
+.OPT_ProvocativelyText:
+ text_far _OPT_ProvocativelyText
+ text_end
+
+.OPT_FlippedOutText:
+ text_far _OPT_FlippedOutText
+ text_end
+
+.OPT_HeartMeltinglyText:
+ text_far _OPT_HeartMeltinglyText
+ text_end
+
+OaksPKMNTalk9:
+ ; 0-15 are all valid indexes into .Adjectives,
+ ; so no need for a retry loop
+ call Random
+ maskbits NUM_OAKS_POKEMON_TALK_ADJECTIVES
+ ld e, a
+ ld d, 0
+ ld hl, .Adjectives
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wOaksPKMNTalkSegmentCounter]
+ dec a
+ ld [wOaksPKMNTalkSegmentCounter], a
+ ld a, OAKS_POKEMON_TALK_4
+ jr nz, .ok
+ ld a, 5
+ ld [wOaksPKMNTalkSegmentCounter], a
+ ld a, OAKS_POKEMON_TALK_10
+.ok
+ jp NextRadioLine
+
+.Adjectives:
+; there are NUM_OAKS_POKEMON_TALK_ADJECTIVES entries
+ dw .OPT_CuteText
+ dw .OPT_WeirdText
+ dw .OPT_PleasantText
+ dw .OPT_BoldSortOfText
+ dw .OPT_FrighteningText
+ dw .OPT_SuaveDebonairText
+ dw .OPT_PowerfulText
+ dw .OPT_ExcitingText
+ dw .OPT_GroovyText
+ dw .OPT_InspiringText
+ dw .OPT_FriendlyText
+ dw .OPT_HotHotHotText
+ dw .OPT_StimulatingText
+ dw .OPT_GuardedText
+ dw .OPT_LovelyText
+ dw .OPT_SpeedyText
+
+.OPT_CuteText:
+ text_far _OPT_CuteText
+ text_end
+
+.OPT_WeirdText:
+ text_far _OPT_WeirdText
+ text_end
+
+.OPT_PleasantText:
+ text_far _OPT_PleasantText
+ text_end
+
+.OPT_BoldSortOfText:
+ text_far _OPT_BoldSortOfText
+ text_end
+
+.OPT_FrighteningText:
+ text_far _OPT_FrighteningText
+ text_end
+
+.OPT_SuaveDebonairText:
+ text_far _OPT_SuaveDebonairText
+ text_end
+
+.OPT_PowerfulText:
+ text_far _OPT_PowerfulText
+ text_end
+
+.OPT_ExcitingText:
+ text_far _OPT_ExcitingText
+ text_end
+
+.OPT_GroovyText:
+ text_far _OPT_GroovyText
+ text_end
+
+.OPT_InspiringText:
+ text_far _OPT_InspiringText
+ text_end
+
+.OPT_FriendlyText:
+ text_far _OPT_FriendlyText
+ text_end
+
+.OPT_HotHotHotText:
+ text_far _OPT_HotHotHotText
+ text_end
+
+.OPT_StimulatingText:
+ text_far _OPT_StimulatingText
+ text_end
+
+.OPT_GuardedText:
+ text_far _OPT_GuardedText
+ text_end
+
+.OPT_LovelyText:
+ text_far _OPT_LovelyText
+ text_end
+
+.OPT_SpeedyText:
+ text_far _OPT_SpeedyText
+ text_end
+
+OaksPKMNTalk10:
+ farcall RadioMusicRestartPokemonChannel
+ ld hl, OPT_RestartText
+ call PrintText
+ call WaitBGMap
+ ld hl, OPT_PokemonChannelText
+ call PrintText
+ ld a, OAKS_POKEMON_TALK_11
+ ld [wCurRadioLine], a
+ ld a, 100
+ ld [wRadioTextDelay], a
+ ret
+
+OPT_PokemonChannelText:
+ text_far _OPT_PokemonChannelText
+ text_end
+
+OPT_RestartText:
+ text_end
+
+OaksPKMNTalk11:
+ ld hl, wRadioTextDelay
+ dec [hl]
+ ret nz
+ hlcoord 9, 14
+ ld de, .pokemon_string
+ ld a, OAKS_POKEMON_TALK_12
+ jp PlaceRadioString
+
+.pokemon_string
+ db "#MON@"
+
+OaksPKMNTalk12:
+ ld hl, wRadioTextDelay
+ dec [hl]
+ ret nz
+ hlcoord 1, 16
+ ld de, .pokemon_channel_string
+ ld a, OAKS_POKEMON_TALK_13
+ jp PlaceRadioString
+
+.pokemon_channel_string
+ db "#MON Channel@"
+
+OaksPKMNTalk13:
+ ld hl, wRadioTextDelay
+ dec [hl]
+ ret nz
+ hlcoord 12, 16
+ ld de, .terminator
+ ld a, OAKS_POKEMON_TALK_14
+ jp PlaceRadioString
+
+.terminator
+ db "@"
+
+OaksPKMNTalk14:
+ ld hl, wRadioTextDelay
+ dec [hl]
+ ret nz
+ ld de, MUSIC_POKEMON_TALK
+ callfar RadioMusicRestartDE
+ ld hl, .terminator
+ call PrintText
+ ld a, OAKS_POKEMON_TALK_4
+ ld [wNextRadioLine], a
+ xor a
+ ld [wNumRadioLinesPrinted], a
+ ld a, RADIO_SCROLL
+ ld [wCurRadioLine], a
+ ld a, 10
+ ld [wRadioTextDelay], a
+ ret
+
+.terminator
+ db "@"
+
+PlaceRadioString:
+ ld [wCurRadioLine], a
+ ld a, 100
+ ld [wRadioTextDelay], a
+ jp PlaceString
+
+CopyBottomLineToTopLine:
+ hlcoord 0, 15
+ decoord 0, 13
+ ld bc, SCREEN_WIDTH * 2
+ jp CopyBytes
+
+ClearBottomLine:
+ hlcoord 1, 15
+ ld bc, SCREEN_WIDTH - 2
+ ld a, " "
+ call ByteFill
+ hlcoord 1, 16
+ ld bc, SCREEN_WIDTH - 2
+ ld a, " "
+ jp ByteFill
+
+PokedexShow1:
+ call StartRadioStation
+.loop
+ call Random
+ cp NUM_POKEMON
+ jr nc, .loop
+ ld c, a
+ push bc
+ ld a, c
+ call CheckCaughtMon
+ pop bc
+ jr z, .loop
+ inc c
+ ld a, c
+ ld [wCurPartySpecies], a
+ ld [wNamedObjectIndexBuffer], a
+ call GetPokemonName
+ ld hl, PokedexShowText
+ ld a, POKEDEX_SHOW_2
+ jp NextRadioLine
+
+PokedexShow2:
+ ld a, [wCurPartySpecies]
+ dec a
+ ld hl, PokedexDataPointerTable
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ rlca
+ rlca
+ and 3
+ add $68
+ push af
+ ld a, BANK(PokedexDataPointerTable)
+ call GetFarHalfword
+ pop af
+ push af
+ push hl
+ call CopyDexEntryPart1
+ dec hl
+ ld [hl], "<DONE>"
+ ld hl, wPokedexShowPointerAddr
+ call CopyRadioTextToRAM
+ pop hl
+ pop af
+ call CopyDexEntryPart2
+rept 4
+ inc hl
+endr
+ ld a, l
+ ld [wPokedexShowPointerAddr], a
+ ld a, h
+ ld [wPokedexShowPointerAddr + 1], a
+ ld a, POKEDEX_SHOW_3
+ jp PrintRadioLine
+
+PokedexShow3:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW_4
+ jp PrintRadioLine
+
+PokedexShow4:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW_5
+ jp PrintRadioLine
+
+PokedexShow5:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW_6
+ jp PrintRadioLine
+
+PokedexShow6:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW_7
+ jp PrintRadioLine
+
+PokedexShow7:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW_8
+ jp PrintRadioLine
+
+PokedexShow8:
+ call CopyDexEntry
+ ld a, POKEDEX_SHOW
+ jp PrintRadioLine
+
+CopyDexEntry:
+ ld a, [wPokedexShowPointerAddr]
+ ld l, a
+ ld a, [wPokedexShowPointerAddr + 1]
+ ld h, a
+ ld a, [wPokedexShowPointerBank]
+ push af
+ push hl
+ call CopyDexEntryPart1
+ dec hl
+ ld [hl], "<DONE>"
+ ld hl, wPokedexShowPointerAddr
+ call CopyRadioTextToRAM
+ pop hl
+ pop af
+ call CopyDexEntryPart2
+ ret
+
+CopyDexEntryPart1:
+ ld de, wPokedexShowPointerBank
+ ld bc, SCREEN_WIDTH - 1
+ call FarCopyBytes
+ ld hl, wPokedexShowPointerAddr
+ ld [hl], TX_START
+ inc hl
+ ld [hl], "<LINE>"
+ inc hl
+.loop
+ ld a, [hli]
+ cp "@"
+ ret z
+ cp "<NEXT>"
+ ret z
+ cp "<DEXEND>"
+ ret z
+ jr .loop
+
+CopyDexEntryPart2:
+ ld d, a
+.loop
+ ld a, d
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr z, .okay
+ cp "<NEXT>"
+ jr z, .okay
+ cp "<DEXEND>"
+ jr nz, .loop
+.okay
+ ld a, l
+ ld [wPokedexShowPointerAddr], a
+ ld a, h
+ ld [wPokedexShowPointerAddr + 1], a
+ ld a, d
+ ld [wPokedexShowPointerBank], a
+ ret
+
+PokedexShowText:
+ text_far _PokedexShowText
+ text_end
+
+BenMonMusic1:
+ call StartPokemonMusicChannel
+ ld hl, BenIntroText1
+ ld a, POKEMON_MUSIC_2
+ jp NextRadioLine
+
+BenMonMusic2:
+ ld hl, BenIntroText2
+ ld a, POKEMON_MUSIC_3
+ jp NextRadioLine
+
+BenMonMusic3:
+ ld hl, BenIntroText3
+ ld a, POKEMON_MUSIC_4
+ jp NextRadioLine
+
+FernMonMusic1:
+ call StartPokemonMusicChannel
+ ld hl, FernIntroText1
+ ld a, LETS_ALL_SING_2
+ jp NextRadioLine
+
+FernMonMusic2:
+ ld hl, FernIntroText2
+ ld a, POKEMON_MUSIC_4
+ jp NextRadioLine
+
+BenFernMusic4:
+ ld hl, BenFernText1
+ ld a, POKEMON_MUSIC_5
+ jp NextRadioLine
+
+BenFernMusic5:
+ call GetWeekday
+ and 1
+ ld hl, BenFernText2A
+ jr z, .SunTueThurSun
+ ld hl, BenFernText2B
+.SunTueThurSun:
+ ld a, POKEMON_MUSIC_6
+ jp NextRadioLine
+
+BenFernMusic6:
+ call GetWeekday
+ and 1
+ ld hl, BenFernText3A
+ jr z, .SunTueThurSun
+ ld hl, BenFernText3B
+.SunTueThurSun:
+ ld a, POKEMON_MUSIC_7
+ jp NextRadioLine
+
+BenFernMusic7:
+ ret
+
+StartPokemonMusicChannel:
+ call RadioTerminator
+ call PrintText
+ ld de, MUSIC_POKEMON_MARCH
+ call GetWeekday
+ and 1
+ jr z, .SunTueThurSun
+ ld de, MUSIC_POKEMON_LULLABY
+.SunTueThurSun:
+ callfar RadioMusicRestartDE
+ ret
+
+BenIntroText1:
+ text_far _BenIntroText1
+ text_end
+
+BenIntroText2:
+ text_far _BenIntroText2
+ text_end
+
+BenIntroText3:
+ text_far _BenIntroText3
+ text_end
+
+FernIntroText1:
+ text_far _FernIntroText1
+ text_end
+
+FernIntroText2:
+ text_far _FernIntroText2
+ text_end
+
+BenFernText1:
+ text_far _BenFernText1
+ text_end
+
+BenFernText2A:
+ text_far _BenFernText2A
+ text_end
+
+BenFernText2B:
+ text_far _BenFernText2B
+ text_end
+
+BenFernText3A:
+ text_far _BenFernText3A
+ text_end
+
+BenFernText3B:
+ text_far _BenFernText3B
+ text_end
+
+LuckyNumberShow1:
+ call StartRadioStation
+ callfar CheckLuckyNumberShowFlag
+ jr nc, .dontreset
+ callfar ResetLuckyNumberShowFlag
+.dontreset
+ ld hl, LC_Text1
+ ld a, LUCKY_NUMBER_SHOW_2
+ jp NextRadioLine
+
+LuckyNumberShow2:
+ ld hl, LC_Text2
+ ld a, LUCKY_NUMBER_SHOW_3
+ jp NextRadioLine
+
+LuckyNumberShow3:
+ ld hl, LC_Text3
+ ld a, LUCKY_NUMBER_SHOW_4
+ jp NextRadioLine
+
+LuckyNumberShow4:
+ ld hl, LC_Text4
+ ld a, LUCKY_NUMBER_SHOW_5
+ jp NextRadioLine
+
+LuckyNumberShow5:
+ ld hl, LC_Text5
+ ld a, LUCKY_NUMBER_SHOW_6
+ jp NextRadioLine
+
+LuckyNumberShow6:
+ ld hl, LC_Text6
+ ld a, LUCKY_NUMBER_SHOW_7
+ jp NextRadioLine
+
+LuckyNumberShow7:
+ ld hl, LC_Text7
+ ld a, LUCKY_NUMBER_SHOW_8
+ jp NextRadioLine
+
+LuckyNumberShow8:
+ ld hl, wStringBuffer1
+ ld de, wLuckyIDNumber
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 5
+ call PrintNum
+ ld a, "@"
+ ld [wStringBuffer1 + 5], a
+ ld hl, LC_Text8
+ ld a, LUCKY_NUMBER_SHOW_9
+ jp NextRadioLine
+
+LuckyNumberShow9:
+ ld hl, LC_Text9
+ ld a, LUCKY_NUMBER_SHOW_10
+ jp NextRadioLine
+
+LuckyNumberShow10:
+ ld hl, LC_Text7
+ ld a, LUCKY_NUMBER_SHOW_11
+ jp NextRadioLine
+
+LuckyNumberShow11:
+ ld hl, LC_Text8
+ ld a, LUCKY_NUMBER_SHOW_12
+ jp NextRadioLine
+
+LuckyNumberShow12:
+ ld hl, LC_Text10
+ ld a, LUCKY_NUMBER_SHOW_13
+ jp NextRadioLine
+
+LuckyNumberShow13:
+ ld hl, LC_Text11
+ call Random
+ and a
+ ld a, LUCKY_CHANNEL
+ jr nz, .okay
+ ld a, LUCKY_NUMBER_SHOW_14
+.okay
+ jp NextRadioLine
+
+LuckyNumberShow14:
+ ld hl, LC_DragText1
+ ld a, LUCKY_NUMBER_SHOW_15
+ jp NextRadioLine
+
+LuckyNumberShow15:
+ ld hl, LC_DragText2
+ ld a, LUCKY_CHANNEL
+ jp NextRadioLine
+
+LC_Text1:
+ text_far _LC_Text1
+ text_end
+
+LC_Text2:
+ text_far _LC_Text2
+ text_end
+
+LC_Text3:
+ text_far _LC_Text3
+ text_end
+
+LC_Text4:
+ text_far _LC_Text4
+ text_end
+
+LC_Text5:
+ text_far _LC_Text5
+ text_end
+
+LC_Text6:
+ text_far _LC_Text6
+ text_end
+
+LC_Text7:
+ text_far _LC_Text7
+ text_end
+
+LC_Text8:
+ text_far _LC_Text8
+ text_end
+
+LC_Text9:
+ text_far _LC_Text9
+ text_end
+
+LC_Text10:
+ text_far _LC_Text10
+ text_end
+
+LC_Text11:
+ text_far _LC_Text11
+ text_end
+
+LC_DragText1:
+ text_far _LC_DragText1
+ text_end
+
+LC_DragText2:
+ text_far _LC_DragText2
+ text_end
+
+PeoplePlaces1:
+ call StartRadioStation
+ ld hl, PnP_Text1
+ ld a, PLACES_AND_PEOPLE_2
+ jp NextRadioLine
+
+PeoplePlaces2:
+ ld hl, PnP_Text2
+ ld a, PLACES_AND_PEOPLE_3
+ jp NextRadioLine
+
+PeoplePlaces3:
+ ld hl, PnP_Text3
+ call Random
+ cp 49 percent - 1
+ ld a, PLACES_AND_PEOPLE_4 ; People
+ jr c, .ok
+ ld a, PLACES_AND_PEOPLE_6 ; Places
+.ok
+ jp NextRadioLine
+
+PnP_Text1:
+ text_far _PnP_Text1
+ text_end
+
+PnP_Text2:
+ text_far _PnP_Text2
+ text_end
+
+PnP_Text3:
+ text_far _PnP_Text3
+ text_end
+
+PeoplePlaces4: ; People
+ call Random
+ maskbits NUM_TRAINER_CLASSES
+ inc a
+ cp NUM_TRAINER_CLASSES
+ jr nc, PeoplePlaces4
+ push af
+ ld hl, PnP_HiddenPeople
+ ld a, [wStatusFlags]
+ bit STATUSFLAGS_HALL_OF_FAME_F, a
+ jr z, .ok
+ ld hl, PnP_HiddenPeople_BeatE4
+ ld a, [wKantoBadges]
+ cp %11111111 ; all badges
+ jr nz, .ok
+ ld hl, PnP_HiddenPeople_BeatKanto
+.ok
+ pop af
+ ld c, a
+ ld de, 1
+ push bc
+ call IsInArray
+ pop bc
+ jr c, PeoplePlaces4
+ push bc
+ callfar GetTrainerClassName
+ ld de, wStringBuffer1
+ call CopyName1
+ pop bc
+ ld b, 1
+ callfar GetTrainerName
+ ld hl, PnP_Text4
+ ld a, PLACES_AND_PEOPLE_5
+ jp NextRadioLine
+
+INCLUDE "data/radio/pnp_hidden_people.asm"
+
+PnP_Text4:
+ text_far _PnP_Text4
+ text_end
+
+PeoplePlaces5:
+ ; 0-15 are all valid indexes into .Adjectives,
+ ; so no need for a retry loop
+ call Random
+ maskbits NUM_PNP_PEOPLE_ADJECTIVES
+ ld e, a
+ ld d, 0
+ ld hl, .Adjectives
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call Random
+ cp 4 percent
+ ld a, PLACES_AND_PEOPLE
+ jr c, .ok
+ call Random
+ cp 49 percent - 1
+ ld a, PLACES_AND_PEOPLE_4 ; People
+ jr c, .ok
+ ld a, PLACES_AND_PEOPLE_6 ; Places
+.ok
+ jp NextRadioLine
+
+.Adjectives:
+; there are NUM_PNP_PEOPLE_ADJECTIVES entries
+ dw PnP_CuteText
+ dw PnP_LazyText
+ dw PnP_HappyText
+ dw PnP_NoisyText
+ dw PnP_PrecociousText
+ dw PnP_BoldText
+ dw PnP_PickyText
+ dw PnP_SortOfOKText
+ dw PnP_SoSoText
+ dw PnP_GreatText
+ dw PnP_MyTypeText
+ dw PnP_CoolText
+ dw PnP_InspiringText
+ dw PnP_WeirdText
+ dw PnP_RightForMeText
+ dw PnP_OddText
+
+PnP_CuteText:
+ text_far _PnP_CuteText
+ text_end
+
+PnP_LazyText:
+ text_far _PnP_LazyText
+ text_end
+
+PnP_HappyText:
+ text_far _PnP_HappyText
+ text_end
+
+PnP_NoisyText:
+ text_far _PnP_NoisyText
+ text_end
+
+PnP_PrecociousText:
+ text_far _PnP_PrecociousText
+ text_end
+
+PnP_BoldText:
+ text_far _PnP_BoldText
+ text_end
+
+PnP_PickyText:
+ text_far _PnP_PickyText
+ text_end
+
+PnP_SortOfOKText:
+ text_far _PnP_SortOfOKText
+ text_end
+
+PnP_SoSoText:
+ text_far _PnP_SoSoText
+ text_end
+
+PnP_GreatText:
+ text_far _PnP_GreatText
+ text_end
+
+PnP_MyTypeText:
+ text_far _PnP_MyTypeText
+ text_end
+
+PnP_CoolText:
+ text_far _PnP_CoolText
+ text_end
+
+PnP_InspiringText:
+ text_far _PnP_InspiringText
+ text_end
+
+PnP_WeirdText:
+ text_far _PnP_WeirdText
+ text_end
+
+PnP_RightForMeText:
+ text_far _PnP_RightForMeText
+ text_end
+
+PnP_OddText:
+ text_far _PnP_OddText
+ text_end
+
+PeoplePlaces6: ; Places
+ call Random
+ cp (PnP_Places.End - PnP_Places) / 2
+ jr nc, PeoplePlaces6
+ ld hl, PnP_Places
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ call GetWorldMapLocation
+ ld e, a
+ callfar GetLandmarkName
+ ld hl, PnP_Text5
+ ld a, PLACES_AND_PEOPLE_7
+ jp NextRadioLine
+
+INCLUDE "data/radio/pnp_places.asm"
+
+PnP_Text5:
+ text_far _PnP_Text5
+ text_end
+
+PeoplePlaces7:
+ ; 0-15 are all valid indexes into .Adjectives,
+ ; so no need for a retry loop
+ call Random
+ maskbits NUM_PNP_PLACES_ADJECTIVES
+ ld e, a
+ ld d, 0
+ ld hl, .Adjectives
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call CopyRadioTextToRAM
+ call Random
+ cp 4 percent
+ ld a, PLACES_AND_PEOPLE
+ jr c, .ok
+ call Random
+ cp 49 percent - 1
+ ld a, PLACES_AND_PEOPLE_4 ; People
+ jr c, .ok
+ ld a, PLACES_AND_PEOPLE_6 ; Places
+.ok
+ jp PrintRadioLine
+
+.Adjectives:
+; there are NUM_PNP_PLACES_ADJECTIVES entries
+ dw PnP_CuteText
+ dw PnP_LazyText
+ dw PnP_HappyText
+ dw PnP_NoisyText
+ dw PnP_PrecociousText
+ dw PnP_BoldText
+ dw PnP_PickyText
+ dw PnP_SortOfOKText
+ dw PnP_SoSoText
+ dw PnP_GreatText
+ dw PnP_MyTypeText
+ dw PnP_CoolText
+ dw PnP_InspiringText
+ dw PnP_WeirdText
+ dw PnP_RightForMeText
+ dw PnP_OddText
+
+RocketRadio1:
+ call StartRadioStation
+ ld hl, RocketRadioText1
+ ld a, ROCKET_RADIO_2
+ jp NextRadioLine
+
+RocketRadio2:
+ ld hl, RocketRadioText2
+ ld a, ROCKET_RADIO_3
+ jp NextRadioLine
+
+RocketRadio3:
+ ld hl, RocketRadioText3
+ ld a, ROCKET_RADIO_4
+ jp NextRadioLine
+
+RocketRadio4:
+ ld hl, RocketRadioText4
+ ld a, ROCKET_RADIO_5
+ jp NextRadioLine
+
+RocketRadio5:
+ ld hl, RocketRadioText5
+ ld a, ROCKET_RADIO_6
+ jp NextRadioLine
+
+RocketRadio6:
+ ld hl, RocketRadioText6
+ ld a, ROCKET_RADIO_7
+ jp NextRadioLine
+
+RocketRadio7:
+ ld hl, RocketRadioText7
+ ld a, ROCKET_RADIO_8
+ jp NextRadioLine
+
+RocketRadio8:
+ ld hl, RocketRadioText8
+ ld a, ROCKET_RADIO_9
+ jp NextRadioLine
+
+RocketRadio9:
+ ld hl, RocketRadioText9
+ ld a, ROCKET_RADIO_10
+ jp NextRadioLine
+
+RocketRadio10:
+ ld hl, RocketRadioText10
+ ld a, ROCKET_RADIO
+ jp NextRadioLine
+
+RocketRadioText1:
+ text_far _RocketRadioText1
+ text_end
+
+RocketRadioText2:
+ text_far _RocketRadioText2
+ text_end
+
+RocketRadioText3:
+ text_far _RocketRadioText3
+ text_end
+
+RocketRadioText4:
+ text_far _RocketRadioText4
+ text_end
+
+RocketRadioText5:
+ text_far _RocketRadioText5
+ text_end
+
+RocketRadioText6:
+ text_far _RocketRadioText6
+ text_end
+
+RocketRadioText7:
+ text_far _RocketRadioText7
+ text_end
+
+RocketRadioText8:
+ text_far _RocketRadioText8
+ text_end
+
+RocketRadioText9:
+ text_far _RocketRadioText9
+ text_end
+
+RocketRadioText10:
+ text_far _RocketRadioText10
+ text_end
+
+PokeFluteRadio:
+ call StartRadioStation
+ ld a, 1
+ ld [wNumRadioLinesPrinted], a
+ ret
+
+UnownRadio:
+ call StartRadioStation
+ ld a, 1
+ ld [wNumRadioLinesPrinted], a
+ ret
+
+EvolutionRadio:
+ call StartRadioStation
+ ld a, 1
+ ld [wNumRadioLinesPrinted], a
+ ret
+
+CopyRadioTextToRAM:
+ ld a, [hl]
+ cp TX_FAR
+ jp z, FarCopyRadioText
+ ld de, wRadioText
+ ld bc, SCREEN_WIDTH * 2
+ jp CopyBytes
+
+StartRadioStation:
+ ld a, [wNumRadioLinesPrinted]
+ and a
+ ret nz
+ call RadioTerminator
+ call PrintText
+ ld hl, RadioChannelSongs
+ ld a, [wCurRadioLine]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ callfar RadioMusicRestartDE
+ ret
+
+INCLUDE "data/radio/channel_music.asm"
+
+NextRadioLine:
+ push af
+ call CopyRadioTextToRAM
+ pop af
+ jp PrintRadioLine
diff --git a/gfx/pics.asm b/gfx/pics.asm
index 8722428b..fd6bde78 100644
--- a/gfx/pics.asm
+++ b/gfx/pics.asm
@@ -675,9 +675,7 @@ UnownIFrontpic: INCBIN "gfx/pokemon/unown_i/front.2bpp.lz"
UnownRBackpic: INCBIN "gfx/pokemon/unown_r/back.2bpp.lz"
UnownRFrontpic: INCBIN "gfx/pokemon/unown_r/front.2bpp.lz"
- dr $b99f2, $ba300
-
-ELSE ; IF DEF(_SILVER)
+ELIF DEF(_SILVER)
SECTION "Pic Pointers", ROMX
@@ -1351,5 +1349,4 @@ UnownIFrontpic: INCBIN "gfx/pokemon/unown_i/front.2bpp.lz"
UnownRBackpic: INCBIN "gfx/pokemon/unown_r/back.2bpp.lz"
UnownRFrontpic: INCBIN "gfx/pokemon/unown_r/front.2bpp.lz"
- dr $b9a43, $ba300
ENDC
diff --git a/main.asm b/main.asm
index e3d7fa29..0b4c2429 100644
--- a/main.asm
+++ b/main.asm
@@ -270,7 +270,9 @@ RandomUnseenWildMon:
RandomPhoneWildMon:
dr $2aa6b, $2aab3
RandomPhoneMon:
- dr $2aab3, $2c000
+ dr $2aab3, $2ab35
+JohtoGrassWildMons:
+ dr $2ab35, $2c000
SECTION "bankb", ROMX, BANK[$b]
dr $2c000, $2c352
@@ -649,7 +651,11 @@ MrChrono:
PrintHour:
dr $90b0f, $90b5e
PokeGear:
- dr $90b5e, $9188a
+ dr $90b5e, $917ca
+RadioMusicRestartDE:
+ dr $917ca, $917de
+RadioMusicRestartPokemonChannel:
+ dr $917de, $9188a
Function9188a:
dr $9188a, $919c1
Function919c1:
@@ -658,7 +664,9 @@ TownMap_:
dr $91a4f, $91c7f
Pokedex_GetArea::
- dr $91c7f, $92c36
+ dr $91c7f, $92364
+GetLandmarkName:
+ dr $92364, $92c36
Function92c36:
dr $92c36, $94000
@@ -720,15 +728,12 @@ INCLUDE "data/maps/blocks.asm"
SECTION "bank2d", ROMX, BANK[$2d]
dr $b4000, $b8000
-SECTION "bank2e", ROMX
+SECTION "bank2e_2", ROMX
INCLUDE "engine/events/checkforhiddenitems.asm"
+INCLUDE "engine/events/treemons.asm"
+INCLUDE "engine/pokegear/radio.asm"
-TreeMonEncounter:
- dr $ba378, $ba3a1
-
-RockMonEncounter:
- dr $ba3a1, $baeca
ReadPartyMonMail:
dr $baeca, $bbaed
ItemIsMail:
diff --git a/pokegold.link b/pokegold.link
index 001fde11..941e62a8 100644
--- a/pokegold.link
+++ b/pokegold.link
@@ -148,8 +148,10 @@ ROMX $2d
org $4000
"bank2d"
ROMX $2e
+ org $4000
"Pics 14"
- "bank2e"
+ org $6300
+ "bank2e_2"
ROMX $2f
org $4000
"bank2f"
diff --git a/pokesilver.link b/pokesilver.link
index 001fde11..941e62a8 100644
--- a/pokesilver.link
+++ b/pokesilver.link
@@ -148,8 +148,10 @@ ROMX $2d
org $4000
"bank2d"
ROMX $2e
+ org $4000
"Pics 14"
- "bank2e"
+ org $6300
+ "bank2e_2"
ROMX $2f
org $4000
"bank2f"
diff --git a/sram.asm b/sram.asm
index 83d2b35f..12829c2b 100755
--- a/sram.asm
+++ b/sram.asm
@@ -545,9 +545,8 @@ s0_ac64:: ds 1 ; 0:ac64
s0_ac65:: ds 1 ; 0:ac65
s0_ac66:: ds 1 ; 0:ac66
s0_ac67:: ds 1 ; 0:ac67
-s0_ac68:: ds 1 ; 0:ac68
-s0_ac69:: ds 1 ; 0:ac69
-s0_ac6a:: ds 1 ; 0:ac6a
+sLuckyNumberDay:: db ; 0:ac68
+sLuckyIDNumber:: dw ; 0:ac69
s0_ac6b:: ds 1 ; 0:ac6b
s0_ac6c:: ds 1 ; 0:ac6c
s0_ac6d:: ds 1 ; 0:ac6d
diff --git a/wram.asm b/wram.asm
index f7d67061..20480327 100644
--- a/wram.asm
+++ b/wram.asm
@@ -3650,8 +3650,7 @@ wd9e5:: ds 1 ; d9e5
wd9e6:: ds 1 ; d9e6
wLuckyNumberShowFlag:: ds 1 ; d9e7
wd9e8:: ds 1 ; d9e8
-wd9e9:: ds 1 ; d9e9
-wd9ea:: ds 1 ; d9ea
+wLuckyIDNumber:: dw ; d9e9
wRepelSteps:: ds 1 ; d9eb
wd9ec:: ds 1 ; d9ec
wd9ed:: ds 1 ; d9ed
@@ -3806,9 +3805,8 @@ wBestMagikarpLengthFeet:: ds 1 ; dd33
wBestMagikarpLengthInches:: ds 1 ; dd34
wMagikarpRecordHoldersName:: ds NAME_LENGTH ; dd35
-wdd40:: ds 1 ; dd40
-wdd41:: ds 1 ; dd41
-wdd42:: ds 1 ; dd42
+wPokedexShowPointerAddr:: dw ; dd40
+wPokedexShowPointerBank:: db ; dd42
wdd43:: ds 1 ; dd43
wdd44:: ds 1 ; dd44
wdd45:: ds 1 ; dd45