Ad some more constants for meaningful audio WRAM bits

This commit is contained in:
Remy Oukaour 2017-12-16 00:50:03 -05:00
parent cbde91d7ed
commit fbf931f5d3
4 changed files with 30 additions and 12 deletions

View File

@ -245,7 +245,7 @@ UpdateChannels: ; e8125
.Channel1:
ld a, [Danger]
bit 7, a
bit DANGER_ON_F, a
ret nz
.Channel5:
ld hl, Channel1NoteFlags - Channel1
@ -537,9 +537,9 @@ _CheckSFX: ; e82e7
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 @@ PlayDanger: ; e8307
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 @@ FadeMusic: ; e8358
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 @@ FadeMusic: ; e8358
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 @@ FadeMusic: ; e8358
pop bc
; fade in
ld hl, MusicFade
set 7, [hl]
set MUSIC_FADE_IN_F, [hl]
ret
.fadein
@ -2976,7 +2976,7 @@ PlayTrainerEncounterMusic:: ; e900a
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

View File

@ -4822,12 +4822,12 @@ CheckDanger: ; 3df9e
.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

View File

@ -67,4 +67,22 @@ NUM_CHANNELS EQU const_value
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

View File

@ -2398,7 +2398,7 @@ PokeFlute: ; f50c
call PrintText
ld a, [Danger]
and $80
and 1 << DANGER_ON_F
jr nz, .dummy2
.dummy2
ld hl, .AllSleepingMonWokeUp