summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-08-25 13:03:38 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-08-25 13:03:38 -0400
commit82cd736affcc52c89b60db0875225ca6a7e40eb9 (patch)
treed9f7b577ff7c31a96b7f724c87cee7997329ee2c
parent85b84e3f72c06e71d167abe1d08fc44db211c622 (diff)
Use diff syntax
-rw-r--r--Hard-coded-logic.md111
1 files changed, 62 insertions, 49 deletions
diff --git a/Hard-coded-logic.md b/Hard-coded-logic.md
index bf3c13c..88127e2 100644
--- a/Hard-coded-logic.md
+++ b/Hard-coded-logic.md
@@ -185,58 +185,71 @@ GetMapMusic::
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):
-```asm
-; 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
+```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`:
-```asm
-GetMapMusic::
- push hl
- push bc
- ld de, MAP_MUSIC
- call GetMapField
- ld a, c
- cp MUSIC_MAHOGANY_MART
- jr z, .mahoganymart
- 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
- 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
+```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`.
@@ -275,7 +288,7 @@ This is caused by `PlaceEnemysName` in [home/text.asm](../blob/master/home/text.
## Vital Throw always goes last
-Most move effects' priorities are specified in `MoveEffectPriorities` in [data/moves/effects_priorities.asm](../blob/master/data/moves/effects_priorities.asm).
+Most move effects' priorities are specified in `MoveEffectPriorities` in [data/moves/effects_priorities.asm](../blob/master/data/moves/effects_priorities.asm).
...except for Vital Throw. This move shares its effect with a lot of other moves, and they couldn't be bothered to make a new move effect ID for it like `EFFECT_PRIORITY_HIT`, so they hard-coded this case, in `GetMovePriority` of [engine/battle/core.asm](../blob/master/engine/battle/core.asm):
```asm