ref: fbf931f5d3b505bb336c3bc17d4d332ab374d033
parent: cbde91d7edb4be3c8773d71ef814fb599ee7e7f3
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Fri Dec 15 19:50:03 EST 2017
Ad some more constants for meaningful audio WRAM bits
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -245,7 +245,7 @@
.Channel1:
ld a, [Danger]
- bit 7, a
+ bit DANGER_ON_F, a
ret nz
.Channel5:
ld hl, Channel1NoteFlags - Channel1
@@ -537,9 +537,9 @@
PlayDanger: ; e8307
ld a, [Danger]
- bit 7, a
+ bit DANGER_ON_F, a
ret z
- and $7f
+ and $ff - (1 << DANGER_ON_F)
ld d, a
call _CheckSFX
jr c, .asm_e8335
@@ -573,7 +573,7 @@
jr c, .asm_e833c
xor a
.asm_e833c
- or $80
+ or 1 << DANGER_ON_F
ld [Danger], a
; is hw ch1 on?
ld a, [SoundOutput]
@@ -632,9 +632,9 @@
ld [MusicFadeCount], a
; get SO1 volume
ld a, [Volume]
- and $7
+ and VOLUME_SO1_LEVEL
; which way are we fading?
- bit 7, d
+ bit MUSIC_FADE_IN_F, d
jr nz, .fadein
; fading out
and a
@@ -648,7 +648,7 @@
ld [Volume], a
; did we just get on a bike?
ld a, [PlayerState]
- cp $1 ; bicycle
+ cp PLAYER_BIKE
jr z, .bicycle
push bc
; restart sound
@@ -688,7 +688,7 @@
pop bc
; fade in
ld hl, MusicFade
- set 7, [hl]
+ set MUSIC_FADE_IN_F, [hl]
ret
.fadein
@@ -2976,7 +2976,7 @@
ld [MusicFade], a
; play nothing for one frame
push de
- ld de, 0 ; id: Music_Nothing
+ ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
; play new song
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -4822,12 +4822,12 @@
.no_danger
ld hl, Danger
- res 7, [hl]
+ res DANGER_ON_F, [hl]
jr .done
.danger
ld hl, Danger
- set 7, [hl]
+ set DANGER_ON_F, [hl]
.done
ret
--- a/constants/audio_constants.asm
+++ b/constants/audio_constants.asm
@@ -67,4 +67,22 @@
const NOTE_VIBRATO_OVERRIDE ; 6
; Volume:
+VOLUME_SO1_F EQU 3
+VOLUME_SO2_F EQU 7
+VOLUME_SO1_LEVEL EQU %00000111
+VOLUME_SO2_LEVEL EQU %01110000
MAX_VOLUME EQU $77
+
+; SoundInput:
+SOUND_INPUT_CH1_F EQU 0
+SOUND_INPUT_CH2_F EQU 1
+SOUND_INPUT_CH3_F EQU 2
+SOUND_INPUT_CH4_F EQU 3
+SOUND_INPUT_GLOBAL_F EQU 7
+
+; Danger:
+DANGER_PITCH_F EQU 4
+DANGER_ON_F EQU 7
+
+; MusicFade:
+MUSIC_FADE_IN_F EQU 7
--- a/engine/item_effects.asm
+++ b/engine/item_effects.asm
@@ -2398,7 +2398,7 @@
call PrintText
ld a, [Danger]
- and $80
+ and 1 << DANGER_ON_F
jr nz, .dummy2
.dummy2
ld hl, .AllSleepingMonWokeUp