summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Short-beeping-noise-for-low-HP.md111
-rw-r--r--Tutorials.md2
2 files changed, 112 insertions, 1 deletions
diff --git a/Short-beeping-noise-for-low-HP.md b/Short-beeping-noise-for-low-HP.md
new file mode 100644
index 0000000..ef46d88
--- /dev/null
+++ b/Short-beeping-noise-for-low-HP.md
@@ -0,0 +1,111 @@
+When your Pokémon's HP is in the red, the battle music is replaced by a continuous beeping noise. This can be quite annoying. If you want a brief alert that your HP is low, just follow this tutorial.
+
+Edit [audio/engine.asm](../blob/master/audio/engine.asm):
+
+```diff
+ UpdateChannels:
+ ...
+
+ .Channel1:
+ ld a, [wLowHealthAlarm]
++ cp $ff
++ jr z, .Channel5
+ bit DANGER_ON_F, a
+ ret nz
+ .Channel5:
+ ...
+```
+
+```diff
+ PlayDanger:
+ ld a, [wLowHealthAlarm]
+ bit DANGER_ON_F, a
+ ret z
++ cp $ff
++ ret z
+
+- ; Don't do anything if SFX is being played
+- and $ff ^ (1 << DANGER_ON_F)
+ ld d, a
+ call _CheckSFX
+ jr c, .increment
++ ld a, d
+
+ ; Play the high tone
+- and a
+- jr z, .begin
++ and $1f
++ ld hl, DangerSoundHigh
++ jr z, .applychannel
+
+ ; Play the low tone
+ cp 16
++ jr nz, .increment
+- jr z, .halfway
+-
+- jr .increment
+-
+-.halfway
+ ld hl, DangerSoundLow
+- jr .applychannel
+-
+-.begin
+- ld hl, DangerSoundHigh
+
+ .applychannel
+ xor a
+ ldh [rNR10], a
+ ld a, [hli]
+ ldh [rNR11], a
+ ld a, [hli]
+ ldh [rNR12], a
+ ld a, [hli]
+ ldh [rNR13], a
+ ld a, [hli]
+ ldh [rNR14], a
+
+ .increment
+ ld a, d
++ and $e0
++ ld e, a
++ ld a, d
++ and $1f
+ inc a
+ cp 30 ; Ending frame
+ jr c, .noreset
+- xor a
++ add 2
+ .noreset
+- ; Make sure the danger sound is kept on
+- or 1 << DANGER_ON_F
++ add e
++ jr nz, .load
++ dec a
++.load
+ ld [wLowHealthAlarm], a
+
+ ; Enable channel 1 if it's off
+ ld a, [wSoundOutput]
+ and $11
+ ret nz
+ ld a, [wSoundOutput]
+ or $11
+ ld [wSoundOutput], a
+ ret
+
+ DangerSoundHigh:
+ db $80 ; duty 50%
+ db $e2 ; volume 14, envelope decrease sweep 2
+ db $50 ; frequency: $750
+ db $87 ; restart sound
+
+ DangerSoundLow:
+ db $80 ; duty 50%
+ db $e2 ; volume 14, envelope decrease sweep 2
+ db $ee ; frequency: $6ee
+ db $86 ; restart sound
+```
+
+TODO: Explain changes.
+
+With this short edit, the noise will stop after just four beeps. It plays when your HP first turns red, and when you send out a Pokémon with low HP.
diff --git a/Tutorials.md b/Tutorials.md
index 6933cab..cd8201d 100644
--- a/Tutorials.md
+++ b/Tutorials.md
@@ -52,6 +52,7 @@ Tutorials may use diff syntax to show edits:
- [Print text when you lose a trainer battle](Print-text-when-you-lose-a-trainer-battle)
- [Correct grammar for plural trainers like Twins](Correct-grammar-for-plural-trainers-like-Twins)
- [Custom order for the Old Pokédex mode](Custom-order-for-the-Old-Pokédex-mode)
+- [Short beeping noise for low HP](Short-beeping-noise-for-low-HP)
- [Remove the artificial save delay](Remove-the-artificial-save-delay)
**Removing features:**
@@ -98,7 +99,6 @@ Tutorials may use diff syntax to show edits:
- Implement dynamic overhead+underfoot bridges
- Sideways stairs, with step types for diagonal movement and collisions to trigger it
- Pan the camera for cutscenes by making the player invisible
-- Short beeping for low HP
- Gain experience from catching Pokémon
- Trainer dialog and music change for their last Pokémon
- Items that act like overworld moves