summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-06-23 12:36:45 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-06-23 12:36:45 -0400
commitdb9096887b8e34f23d80354ff96435582ef97ad4 (patch)
tree9f10882eac5beb9fd1277f121ae4052f3e642fab
parentf11615cbe62f7fcc5de5a9d527a3cb0951b57ffb (diff)
Reorganize and add a screenshot to the radio channel tutorial
-rw-r--r--Add-a-new-radio-channel.md243
-rw-r--r--screenshots/national-park-radio.pngbin0 -> 684 bytes
2 files changed, 114 insertions, 129 deletions
diff --git a/Add-a-new-radio-channel.md b/Add-a-new-radio-channel.md
index 5efea04..e93755d 100644
--- a/Add-a-new-radio-channel.md
+++ b/Add-a-new-radio-channel.md
@@ -1,120 +1,131 @@
-This tutorial teaches you how to add a new radio channel in pokecrystal. (radio channels with text coming soon!)
+This tutorial teaches you how to add a new radio channel. (Radio channels with text coming soon!)
-For this tutorial we're going to add National Park as a channel that plays its own music.
+For this tutorial we're going to add a channel that plays the National Park music.
## Contents
-1. [Define a radio constant](#1-define-a-radio-constant)
-2. [Define a pointer to the radio station](#2-define-a-pointer-to-the-radio-station)
-3. [Define the music for the channel](#3-define-the-music-for-the-channel)
-4. [Set the name of the channel and add a pointer for loading it](#4-set-the-name-of-the-channel-and-add-a-pointer-for-loading-it)
-5. [Set the channel to a frequency you like](#5-set-the-channel-to-a-frequency-you-like)
+1. [Define a channel constant](#1-define-a-channel-constant)
+2. [Define the music for the channel](#2-define-the-music-for-the-channel)
+3. [Define the frequency and availability for the channel](#3-define-the-frequency-and-availability-for-the-channel)
+4. [Give the channel a name and text routine](#4-give-the-channel-a-name-and-text-routine)
+5. [Define a pointer to the radio station](#5-define-a-pointer-to-the-radio-station)
-## 1. Define a radio constant
-
+## 1. Define a channel constant
Edit [constants/radio_constants.asm](../blob/master/constants/radio_constants.asm):
```diff
-; radio channel ids
-; indexes for:
-; - RadioChannelSongs (see data/radio/channel_music.asm)
-; - PlayRadioShow/RadioJumptable (see engine/pokegear/radio.asm)
-; - RadioChannels (see engine/pokegear/radio.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 NATIONAL_PARK_RADIO ; 0b
+ ; radio channel ids
+ ; indexes for:
+ ; - RadioChannelSongs (see data/radio/channel_music.asm)
+ ; - PlayRadioShow/RadioJumptable (see engine/pokegear/radio.asm)
+ ; - RadioChannels (see engine/pokegear/radio.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 NATIONAL_PARK_RADIO
+ ...
```
-## 2. Define a pointer to the radio station
-
-
-Edit [engine/pokegear/radio.asm](../blob/master/engine/pokegear/radio.asm):
+## 2. Define the music for the channel
-```diff
-RadioJumptable:
-; entries correspond to constants/radio_constants.asm
- dw OaksPKMNTalk1 ; $00
- dw PokedexShow1 ; $01
- dw BenMonMusic1 ; $02
- dw LuckyNumberShow1 ; $03
- dw BuenasPassword1 ; $04
- dw PeoplePlaces1 ; $05
- dw FernMonMusic1 ; $06
- dw RocketRadio1 ; $07
- dw PokeFluteRadio ; $08
- dw UnownRadio ; $09
- dw EvolutionRadio ; $0a
-+ dw NationalParkRadio ; $0b
-```
+Edit [data/radio/channel_music.asm](../blob/master/data/radio/channel_music.asm):
```diff
-UnownRadio:
- call StartRadioStation
- ld a, 1
- ld [wNumRadioLinesPrinted], a
- ret
-
-EvolutionRadio:
- call StartRadioStation
- ld a, 1
- ld [wNumRadioLinesPrinted], a
- ret
-+
-+NationalParkRadio:
-+ call StartRadioStation
-+ ld a, 1
-+ ld [wNumRadioLinesPrinted], a
-+ ret
+ 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
++ dw MUSIC_NATIONAL_PARK
```
-## 3. Define the music for the channel
+## 3. Define the frequency and availability for the channel
-Edit [data/radio/channel_music.asm](../blob/master/data/radio/channel_music.asm):
-
+Edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
```diff
-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
-+ dw MUSIC_NATIONAL_PARK
+ RadioChannels:
+ ; entries correspond to constants/radio_constants.asm
+
+ ; frequency value given here = 4 × ingame_frequency − 2
+ dbw 16, .PKMNTalkAndPokedexShow
+ dbw 28, .PokemonMusic
+ dbw 32, .LuckyChannel
+ dbw 40, .BuenasPassword
+ dbw 52, .RuinsOfAlphRadio
++ dbw 58, .NationalPark
+ dbw 64, .PlacesAndPeople
+ dbw 72, .LetsAllSing
+ dbw 78, .PokeFluteRadio
+ dbw 80, .EvolutionRadio
+ db -1
+
+ ...
+
+ .RuinsOfAlphRadio:
+ ld a, [wPokegearMapPlayerIconLandmark]
+ cp RUINS_OF_ALPH
+ jr nz, .NoSignal
+ jp LoadStation_UnownRadio
++
++.NationalPark:
++ call .InJohto
++ jr nc, .NoSignal
++ jp LoadStation_NationalPark
+
+ .PlacesAndPeople:
+ call .InJohto
+ jr c, .NoSignal
+ ld a, [wPokegearFlags]
+ bit POKEGEAR_EXPN_CARD_F, a
+ jr z, .NoSignal
+ jp LoadStation_PlacesAndPeople
```
+Here we want the National Park channel to be at frequency 15, and 15×4−2=58, so that's its frequency value.
-## 4. Set the name of the channel and add a pointer for loading it
+Note how the routine determines when the channel is available. As long as you're in Johto, the National Park channel will play on frequency 15. Most Kanto channels have two requirements: that you're *not* in Johto (so you must be in Kanto), and that you have the Expn Card. The `.PlacesAndPeople` channel is an example of that. You can even invent other conditions, like how the Ruins of Alph channel is only available when you're actually in the Ruins of Alph.
-Edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
+Anyway, we haven't defined `LoadStation_NationalPark`, so let's do that next.
-```diff
-; 917c3 (24:57c3)
-BuenasPasswordName: db "BUENA'S PASSWORD@"
-NotBuenasPasswordName: db "@"
-+NationalParkName: db "Narional Park@"
+## 4. Give the channel a name and text routine
+
+Continue to edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
+
+```diff
+ LoadStation_UnownRadio: ; 917d5 (24:57d5)
+ ld a, UNOWN_RADIO
+ ld [wCurrentRadioLine], a
+ xor a
+ ld [wNumRadioLinesPrinted], a
+ ld a, BANK(PlayRadioShow)
+ ld hl, PlayRadioShow
+ call Radio_BackUpFarCallParams
+ ld de, UnownStationName
+ ret
+
+LoadStation_NationalPark:
+ ld a, NATIONAL_PARK_RADIO
@@ -124,53 +135,27 @@ NotBuenasPasswordName: db "@"
+ ld a, BANK(PlayRadioShow)
+ ld hl, PlayRadioShow
+ call Radio_BackUpFarCallParams
-+ ld de, NationalParkName
++ ld de, NationalParkRadioName
+ ret
-```
+ ...
-## 5. Set the channel to a frequency you like
+ OaksPKMNTalkName: db "OAK's <PK><MN> Talk@"
+ PokedexShowName: db "#DEX Show@"
+ PokemonMusicName: db "#MON Music@"
+ LuckyChannelName: db "Lucky Channel@"
+ UnownStationName: db "?????@"
++NationalParkRadioName: db "National Park@"
-Edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
-
-In this example, I set the frequency to 15.
-
-```diff
-RadioChannels:
-; entries correspond to constants/radio_constants.asm
-
-; frequency value given here = 4 × ingame_frequency − 2
- dbw 16, .PKMNTalkAndPokedexShow
- dbw 28, .PokemonMusic
- dbw 32, .LuckyChannel
- dbw 40, .BuenasPassword
- dbw 52, .RuinsOfAlphRadio
-+ dbw 58, .NationalPark
- dbw 64, .PlacesAndPeople
- dbw 72, .LetsAllSing
- dbw 78, .PokeFluteRadio
- dbw 80, .EvolutionRadio
- db -1
+ PlacesAndPeopleName: db "Places & People@"
+ LetsAllSingName: db "Let's All Sing!@"
+ PokeFluteStationName: db "# FLUTE@"
```
-Johto exclusive channel:
+Since this channel will just play music, not print any text, we can give it a simple definition like the other music-only channels.
-```diff
-+.NationalPark:
-+ call .InJohto
-+ jr nc, .NoSignal
-+ jp LoadStation_NationalPark
-```
+(Note that the label "`NationalParkName`" already exists, for the name of the National Park location in [data/maps/landmarks.asm](../blob/master/data/maps/landmarks.asm), so we have to use "`NationalParkRadioName`".)
-Kanto exclusive channel:
+Now we're done!
-```diff
-+.NationalPark:
-+ call .InJohto
-+ jr c, .NoSignal
-+ ld a, [wPokegearFlags]
-+ bit POKEGEAR_EXPN_CARD_F, a
-+ jr z, .NoSignal
-+ jp LoadStation_NationalPark
-```
-and we're done! \ No newline at end of file
+![Screenshot](screenshots/national-park-radio.png)
diff --git a/screenshots/national-park-radio.png b/screenshots/national-park-radio.png
new file mode 100644
index 0000000..b804ac8
--- /dev/null
+++ b/screenshots/national-park-radio.png
Binary files differ