Insert Crystal audio engine and music

most credit goes to Sanqui
This commit is contained in:
dannye 2017-05-07 15:30:08 -05:00
parent 832c28eaea
commit 87eed68710
586 changed files with 193763 additions and 6447 deletions

View file

@ -200,7 +200,7 @@ PlayAnimation:
push hl
push de
call GetMoveSound
call PlaySound
call nc, AnimPlaySFX
pop de
pop hl
.skipPlayingSound
@ -256,6 +256,15 @@ 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
@ -551,7 +560,7 @@ PlaySubanimation:
cp a,$FF
jr z,.skipPlayingSound
call GetMoveSound
call PlaySound
call nc, AnimPlaySFX
.skipPlayingSound
ld hl,wOAMBuffer ; base address of OAM buffer
ld a,l
@ -2328,18 +2337,28 @@ GetMoveSound:
.next
ld a,[wEnemyMonSpecies]
.Continue
push hl
call GetCryData
ld b,a
pop hl
ld a,[wFrequencyModifier]
add [hl]
ld [wFrequencyModifier],a
inc hl
ld a,[wTempoModifier]
add [hl]
ld [wTempoModifier],a
jr .done
push af
ld a, 1
ld [wSFXDontWait], a
pop af
call PlayCry
xor a
ld [wSFXDontWait], a
ld a, b
scf
ret
;push hl
;call GetCryData
;ld b,a
;pop hl
;ld a,[wFrequencyModifier]
;add [hl]
;ld [wFrequencyModifier],a
;inc hl
;ld a,[wTempoModifier]
;add [hl]
;ld [wTempoModifier],a
;jr .done
.NotCryMove
ld a,[hli]
ld [wFrequencyModifier],a
@ -3011,24 +3030,27 @@ PlayApplyingAttackSound:
; play a different sound depending if move is not very effective, neutral, or super-effective
; don't play any sound at all if move is ineffective
call WaitForSoundToFinish
ld a, [wDamageMultipliers]
ld a, [wDamageMultipliers] ; effectiveness
and $7f
ret z
cp 10
ld a, $20
ld b, $30
ld c, SFX_DAMAGE
ld c, GSSFX_DAMAGE ; SFX_DAMAGE
jr z, .playSound
ld a, $e0
ld b, $ff
ld c, SFX_SUPER_EFFECTIVE
ld c, GSSFX_SUPER_EFFECTIVE ; SFX_SUPER_EFFECTIVE
jr nc, .playSound
ld a, $50
ld b, $1
ld c, SFX_NOT_VERY_EFFECTIVE
ld c, GSSFX_NOT_VERY_EFFECTIVE ; SFX_NOT_VERY_EFFECTIVE
.playSound
ld [wFrequencyModifier], a
ld a, b
ld [wTempoModifier], a
ld a, c
jp PlaySound
jp PlaySound

View file

@ -955,7 +955,7 @@ EndLowHealthAlarm:
; This function is called when the player has the won the battle. It turns off
; the low health alarm and prevents it from reactivating until the next battle.
xor a
ld [wLowHealthAlarm], a ; turn off low health alarm
ld [wDanger], a ; turn off low health alarm
ld [wChannelSoundIDs + Ch4], a
inc a
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
@ -1051,7 +1051,7 @@ PlayBattleVictoryMusic:
ld a, $ff
ld [wNewSoundID], a
call PlaySoundWaitForCurrent
ld c, BANK(Music_DefeatedTrainer)
ld c, 0 ; BANK(Music_DefeatedTrainer)
pop af
call PlayMusic
jp Delay3
@ -1098,11 +1098,11 @@ RemoveFaintedPlayerMon:
predef FlagActionPredef ; clear gain exp flag for fainted mon
ld hl, wEnemyBattleStatus1
res 2, [hl] ; reset "attacking multiple times" flag
ld a, [wLowHealthAlarm]
ld a, [wDanger]
bit 7, a ; skip sound flag (red bar (?))
jr z, .skipWaitForSound
ld a, $ff
ld [wLowHealthAlarm], a ;disable low health alarm
ld [wDanger], a ;disable low health alarm
call WaitForSoundToFinish
.skipWaitForSound
; a is 0, so this zeroes the enemy's accumulated damage.
@ -1949,7 +1949,7 @@ DrawPlayerHUDAndHPBar:
cp HP_BAR_RED
jr z, .setLowHealthAlarm
.fainted
ld hl, wLowHealthAlarm
ld hl, wDanger
bit 7, [hl] ;low health alarm enabled?
ld [hl], $0
ret z
@ -1957,7 +1957,7 @@ DrawPlayerHUDAndHPBar:
ld [wChannelSoundIDs + Ch4], a
ret
.setLowHealthAlarm
ld hl, wLowHealthAlarm
ld hl, wDanger
set 7, [hl] ;enable low health alarm
ret

View file

@ -45,7 +45,7 @@ EndOfBattle:
predef EvolutionAfterBattle
.resetVariables
xor a
ld [wLowHealthAlarm], a ;disable low health alarm
ld [wDanger], a ;disable low health alarm
ld [wChannelSoundIDs + Ch4], a
ld [wIsInBattle], a
ld [wBattleType], a