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: .Channel1:
ld a, [Danger] ld a, [Danger]
bit 7, a bit DANGER_ON_F, a
ret nz ret nz
.Channel5: .Channel5:
ld hl, Channel1NoteFlags - Channel1 ld hl, Channel1NoteFlags - Channel1
@ -537,9 +537,9 @@ _CheckSFX: ; e82e7
PlayDanger: ; e8307 PlayDanger: ; e8307
ld a, [Danger] ld a, [Danger]
bit 7, a bit DANGER_ON_F, a
ret z ret z
and $7f and $ff - (1 << DANGER_ON_F)
ld d, a ld d, a
call _CheckSFX call _CheckSFX
jr c, .asm_e8335 jr c, .asm_e8335
@ -573,7 +573,7 @@ PlayDanger: ; e8307
jr c, .asm_e833c jr c, .asm_e833c
xor a xor a
.asm_e833c .asm_e833c
or $80 or 1 << DANGER_ON_F
ld [Danger], a ld [Danger], a
; is hw ch1 on? ; is hw ch1 on?
ld a, [SoundOutput] ld a, [SoundOutput]
@ -632,9 +632,9 @@ FadeMusic: ; e8358
ld [MusicFadeCount], a ld [MusicFadeCount], a
; get SO1 volume ; get SO1 volume
ld a, [Volume] ld a, [Volume]
and $7 and VOLUME_SO1_LEVEL
; which way are we fading? ; which way are we fading?
bit 7, d bit MUSIC_FADE_IN_F, d
jr nz, .fadein jr nz, .fadein
; fading out ; fading out
and a and a
@ -648,7 +648,7 @@ FadeMusic: ; e8358
ld [Volume], a ld [Volume], a
; did we just get on a bike? ; did we just get on a bike?
ld a, [PlayerState] ld a, [PlayerState]
cp $1 ; bicycle cp PLAYER_BIKE
jr z, .bicycle jr z, .bicycle
push bc push bc
; restart sound ; restart sound
@ -688,7 +688,7 @@ FadeMusic: ; e8358
pop bc pop bc
; fade in ; fade in
ld hl, MusicFade ld hl, MusicFade
set 7, [hl] set MUSIC_FADE_IN_F, [hl]
ret ret
.fadein .fadein
@ -2976,7 +2976,7 @@ PlayTrainerEncounterMusic:: ; e900a
ld [MusicFade], a ld [MusicFade], a
; play nothing for one frame ; play nothing for one frame
push de push de
ld de, 0 ; id: Music_Nothing ld de, MUSIC_NONE
call PlayMusic call PlayMusic
call DelayFrame call DelayFrame
; play new song ; play new song

View File

@ -4822,12 +4822,12 @@ CheckDanger: ; 3df9e
.no_danger .no_danger
ld hl, Danger ld hl, Danger
res 7, [hl] res DANGER_ON_F, [hl]
jr .done jr .done
.danger .danger
ld hl, Danger ld hl, Danger
set 7, [hl] set DANGER_ON_F, [hl]
.done .done
ret ret

View File

@ -67,4 +67,22 @@ NUM_CHANNELS EQU const_value
const NOTE_VIBRATO_OVERRIDE ; 6 const NOTE_VIBRATO_OVERRIDE ; 6
; Volume: ; 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 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 call PrintText
ld a, [Danger] ld a, [Danger]
and $80 and 1 << DANGER_ON_F
jr nz, .dummy2 jr nz, .dummy2
.dummy2 .dummy2
ld hl, .AllSleepingMonWokeUp ld hl, .AllSleepingMonWokeUp