Fix battle sound pitch/tempo modifiers

This commit is contained in:
dannye 2021-04-03 13:02:22 -05:00
parent b2afaae7ab
commit 17044ab7eb
6 changed files with 200 additions and 43 deletions

View file

@ -200,7 +200,7 @@ PlayAnimation:
push hl
push de
call GetMoveSound
call nc, AnimPlaySFX
call nc, PlayBattleSound
pop de
pop hl
.skipPlayingSound
@ -256,15 +256,6 @@ PlayAnimation:
.AnimationOver
ret
AnimPlaySFX:
push de
ld e, a
xor a
ld d, a
call PlaySFX
pop de
ret
LoadSubanimation:
ld a, [wSubAnimAddrPtr + 1]
ld h, a
@ -560,7 +551,7 @@ PlaySubanimation:
cp NO_MOVE - 1
jr z, .skipPlayingSound
call GetMoveSound
call nc, AnimPlaySFX
call nc, PlayBattleSound
.skipPlayingSound
ld hl, wOAMBuffer ; base address of OAM buffer
ld a, l
@ -2208,13 +2199,19 @@ GetMoveSound:
; jr .done
.NotCryMove
; todo: fix sound modifiers
push bc
ld a, [hli]
; ld [wFrequencyModifier], a
ld c, a
ld b, 0
ld a, [hli]
; ld [wTempoModifier], a
add $80
ld e, a
ld a, 0
adc 0
ld d, a
pop af
.done
ld a, b
and a
ret
IsCryMove:
@ -2625,21 +2622,20 @@ PlayApplyingAttackSound:
and $7f
ret z
cp 10
ld a, $20
ld b, $30
ld c, GSSFX_DAMAGE ; SFX_DAMAGE
ld bc, $20
ld de, $30 + $80
ld a, SFX_DAMAGE
jr z, .playSound
ld a, $e0
ld b, $ff
ld c, GSSFX_SUPER_EFFECTIVE ; SFX_SUPER_EFFECTIVE
ld bc, $e0
ld de, $ff + $80
ld a, SFX_SUPER_EFFECTIVE
jr nc, .playSound
ld a, $50
ld b, $1
ld c, GSSFX_NOT_VERY_EFFECTIVE ; SFX_NOT_VERY_EFFECTIVE
ld bc, $50
ld de, $1 + $80
ld a, SFX_NOT_VERY_EFFECTIVE
.playSound
; todo: fix sound modifiers
; ld [wFrequencyModifier], a
ld a, b
; ld a, b
; ld [wTempoModifier], a
ld a, c
jp PlaySound
; ld a, c
jp PlayBattleSound

View file

@ -776,16 +776,19 @@ FaintEnemyPokemon:
ld a, [wIsInBattle]
dec a
jr z, .wild_win
call WaitForSoundToFinish
ld bc, $00
ld de, $80
ld a, SFX_FAINT_FALL
call PlayBattleSound
; xor a
; ld [wFrequencyModifier], a
; ld [wTempoModifier], a
ld a, SFX_FAINT_FALL
call PlaySoundWaitForCurrent
; ld a, SFX_FAINT_FALL
; call PlaySoundWaitForCurrent
; using WaitForSoundToFinish causes a noticeable delay
; so use a smaller hard-coded delay for now
ld c, 10
call DelayFrames
call WaitForSoundToFinish
;.sfxwait
; ld a, [wChannelSoundIDs + Ch5]
; cp SFX_FAINT_FALL