diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2019-02-17 13:19:24 -0500 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2019-02-17 13:19:24 -0500 |
commit | df4b4ee4dd3adc7d44d495e650be48434ee32c59 (patch) | |
tree | a3fa4fc3fbb3b57ca95000bac1cadd33787833f6 /Hard-coded-logic.md | |
parent | d19b13e4c22280ba8e4b394a89e9daf723729157 (diff) |
- Move assembly programming links from docs to the wiki
- Move music ID behavior from the wiki to docs
Diffstat (limited to 'Hard-coded-logic.md')
-rw-r--r-- | Hard-coded-logic.md | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/Hard-coded-logic.md b/Hard-coded-logic.md index ce5c863..34f3975 100644 --- a/Hard-coded-logic.md +++ b/Hard-coded-logic.md @@ -7,7 +7,6 @@ Much of the game logic can be changed via the files in [data/](../blob/master/da - [Maps that don't display a location sign](#maps-that-dont-display-a-location-sign) - [Outdoor maps within indoor maps don't confuse Dig or Escape Rope](#outdoor-maps-within-indoor-maps-dont-confuse-dig-or-escape-rope) - [Landmark limits when scrolling in the Town Map](#landmark-limits-when-scrolling-in-the-town-map) -- [Some high values for maps' music IDs play incorrectly](#some-high-values-for-maps-music-ids-play-incorrectly) - [Trainer classes with different battle music](#trainer-classes-with-different-battle-music) - [`RIVAL1`'s first Pokémon has no held item](#rival1s-first-pokémon-has-no-held-item) - [`RIVAL1` and `RIVAL2` don't print their trainer class in battle](#rival1-and-rival2-dont-print-their-trainer-class-in-battle) @@ -131,130 +130,6 @@ This is caused by `InitEnemyTrainer` in [engine/battle/core.asm](../blob/master/ ``` -## Some high values for maps' music IDs play incorrectly - -If a map's music ID in [data/maps/maps.asm](../blob/master/data/maps/maps.asm) is $64 (the value of `MUSIC_MAHOGANY_MART` or `MUSIC_SUICUNE_BATTLE`) it will play either `MUSIC_ROCKET_HIDEOUT` or `MUSIC_CHERRYGROVE_CITY`. Moreover, if a map's music ID is $80 or above (the value of `RADIO_TOWER_MUSIC`) it might play `MUSIC_ROCKET_OVERTURE` or something else. - -This is caused by `GetMapMusic` in [home/map.asm](../blob/master/home/map.asm): - -```asm -GetMapMusic:: - push hl - push bc - ld de, MAP_MUSIC - call GetMapField - ld a, c - cp MUSIC_MAHOGANY_MART - jr z, .mahoganymart - bit RADIO_TOWER_MUSIC_F, c - jr nz, .radiotower - farcall Function8b342 - ld e, c - ld d, 0 -.done - pop bc - pop hl - ret - -.radiotower - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a - jr z, .clearedradiotower - ld de, MUSIC_ROCKET_OVERTURE - jr .done - -.clearedradiotower - ; the rest of the byte - ld a, c - and RADIO_TOWER_MUSIC - 1 - ld e, a - ld d, 0 - jr .done - -.mahoganymart - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F, a - jr z, .clearedmahogany - ld de, MUSIC_ROCKET_HIDEOUT - jr .done - -.clearedmahogany - ld de, MUSIC_CHERRYGROVE_CITY - jr .done -``` - -This can cause problems if you add too many new songs, or rearrange the existing ones. A solution would be to redefine the special music constants in [constants/music_constants.asm](../blob/master/constants/music_constants.asm): - -```diff --; GetMapMusic picks music for this value (see home/map.asm) --MUSIC_MAHOGANY_MART EQU $64 -+; GetMapMusic picks music for these values (see home/map.asm) -+MUSIC_MAHOGANY_MART EQU $fc -+MUSIC_RADIO_TOWER EQU $fd - - ; ExitPokegearRadio_HandleMusic uses these values - RESTART_MAP_MUSIC EQU $fe - ENTER_MAP_MUSIC EQU $ff -- --; GetMapMusic picks music for this bit flag --RADIO_TOWER_MUSIC_F EQU 7 --RADIO_TOWER_MUSIC EQU 1 << RADIO_TOWER_MUSIC_F -``` - -And then edit `GetMapMusic`: - -```diff - GetMapMusic:: - push hl - push bc - ld de, MAP_MUSIC - call GetMapField - ld a, c - cp MUSIC_MAHOGANY_MART - jr z, .mahoganymart -- bit RADIO_TOWER_MUSIC_F, c -- jr nz, .radiotower -+ cp MUSIC_RADIO_TOWER -+ jr z, .radiotower - farcall Function8b342 - ld e, c - ld d, 0 - .done - pop bc - pop hl - ret - - .radiotower - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a - jr z, .clearedradiotower - ld de, MUSIC_ROCKET_OVERTURE - jr .done - - .clearedradiotower -- ; the rest of the byte -- ld a, c -- and RADIO_TOWER_MUSIC - 1 -- ld e, a -- ld d, 0 -+ ld de, MUSIC_GOLDENROD_CITY - jr .done - - .mahoganymart - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F, a - jr z, .clearedmahogany - ld de, MUSIC_ROCKET_HIDEOUT - jr .done - - .clearedmahogany - ld de, MUSIC_CHERRYGROVE_CITY - jr .done -``` - -You'll also need to edit [data/maps/maps.asm](../blob/master/data/maps/maps.asm) so the Radio Tower maps use `MUSIC_RADIO_TOWER` instead of `RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY`. - - ## Trainer classes with different battle music This is caused by `PlayBattleMusic` in [engine/battle/start_battle.asm](../blob/master/engine/battle/start_battle.asm). The routine's logic is: |