The sound update.
This commit is contained in:
parent
714f27c28b
commit
09f7f07827
|
@ -1238,12 +1238,8 @@ FieldProcess::
|
||||||
ldh [hCurrentPieceY], a
|
ldh [hCurrentPieceY], a
|
||||||
xor a, a
|
xor a, a
|
||||||
ldh [hCurrentLockDelayRemaining], a
|
ldh [hCurrentLockDelayRemaining], a
|
||||||
ldh a, [hCurrentIntegerGravity]
|
|
||||||
cp a, 1
|
|
||||||
jp nz, .draw
|
|
||||||
call SFXKill
|
|
||||||
ld a, SFX_LOCK
|
ld a, SFX_LOCK
|
||||||
call SFXEnqueue
|
call SFXTriggerNoise
|
||||||
jp .draw
|
jp .draw
|
||||||
|
|
||||||
; If we press down, we want to do a soft drop.
|
; If we press down, we want to do a soft drop.
|
||||||
|
@ -1342,12 +1338,8 @@ FieldProcess::
|
||||||
|
|
||||||
; Play the firm drop sound, and also reset the lock delay since the piece stepped down.
|
; Play the firm drop sound, and also reset the lock delay since the piece stepped down.
|
||||||
.playfirmdropsound
|
.playfirmdropsound
|
||||||
ldh a, [hCurrentIntegerGravity]
|
|
||||||
cp a, 1
|
|
||||||
jr nz, .postcheckforfirmdropsound
|
|
||||||
call SFXKill
|
|
||||||
ld a, SFX_LAND
|
ld a, SFX_LAND
|
||||||
call SFXEnqueue
|
call SFXTriggerNoise
|
||||||
|
|
||||||
; If the down button is held, lock.
|
; If the down button is held, lock.
|
||||||
.postcheckforfirmdropsound
|
.postcheckforfirmdropsound
|
||||||
|
@ -1428,12 +1420,8 @@ FieldProcess::
|
||||||
|
|
||||||
; Play the locking sound and draw the piece.
|
; Play the locking sound and draw the piece.
|
||||||
.dolock
|
.dolock
|
||||||
ldh a, [hCurrentIntegerGravity]
|
|
||||||
cp a, 1
|
|
||||||
jr nz, .draw
|
|
||||||
call SFXKill
|
|
||||||
ld a, SFX_LOCK
|
ld a, SFX_LOCK
|
||||||
call SFXEnqueue
|
call SFXTriggerNoise
|
||||||
jr .draw
|
jr .draw
|
||||||
|
|
||||||
; If we weren't grounded, reset the lock force.
|
; If we weren't grounded, reset the lock force.
|
||||||
|
@ -1825,12 +1813,8 @@ FieldDelay::
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
call ClearLines
|
call ClearLines
|
||||||
ldh a, [hCurrentIntegerGravity]
|
|
||||||
cp a, 1
|
|
||||||
jr nz, :+
|
|
||||||
call SFXKill
|
|
||||||
ld a, SFX_LINE_CLEAR
|
ld a, SFX_LINE_CLEAR
|
||||||
call SFXEnqueue
|
call SFXTriggerNoise
|
||||||
|
|
||||||
: ldh a, [hCurrentLineARE]
|
: ldh a, [hCurrentLineARE]
|
||||||
ldh [hRemainingDelay], a
|
ldh [hRemainingDelay], a
|
||||||
|
|
|
@ -131,6 +131,7 @@ Main::
|
||||||
EventLoop::
|
EventLoop::
|
||||||
; Play the sound effect, if any.
|
; Play the sound effect, if any.
|
||||||
call SFXPlay
|
call SFXPlay
|
||||||
|
call SFXPlayNoise
|
||||||
|
|
||||||
; Wrangle inputs and timers at the start of every frame.
|
; Wrangle inputs and timers at the start of every frame.
|
||||||
call GetInput
|
call GetInput
|
||||||
|
|
|
@ -2,10 +2,8 @@ IF !DEF(SFX_DATA_INC)
|
||||||
DEF SFX_DATA_INC EQU 1
|
DEF SFX_DATA_INC EQU 1
|
||||||
|
|
||||||
SECTION "SFX Data", ROMX, BANK[2]
|
SECTION "SFX Data", ROMX, BANK[2]
|
||||||
|
; These sound effects can contain any channel.
|
||||||
sSFXPieceI::
|
sSFXPieceI::
|
||||||
db REG_NR12_CH1_VOLEV, $00, REG_NR14_CH1_FRQHI, $80, REG_NR22_CH2_VOLEV, $00, REG_NR24_CH2_FRQHI, $80
|
|
||||||
db REG_NR32_CH3_VOLUM, $00, REG_NR34_CH3_FRQHI, $80, REG_NR42_CH4_VOLEV, $00, REG_NR44_CH4_CNTRL, $80
|
|
||||||
db REG_NR10_CH1_SWEEP, $00, REG_NR52_MASTERCTL, $8F, REG_NR51_MASTERPAN, $FF, REG_NR50_MVOLVINPN, $77
|
|
||||||
db REG_NR12_CH1_VOLEV, $F0, REG_NR22_CH2_VOLEV, $F0, REG_NR11_CH1_LENDT, $BF, REG_NR11_CH1_LENDT, $BF
|
db REG_NR12_CH1_VOLEV, $F0, REG_NR22_CH2_VOLEV, $F0, REG_NR11_CH1_LENDT, $BF, REG_NR11_CH1_LENDT, $BF
|
||||||
db REG_NR12_CH1_VOLEV, $F0, REG_NR13_CH1_FRQLO, $AC, REG_NR14_CH1_FRQHI, $85, REG_NR21_CH2_LENDT, $7F
|
db REG_NR12_CH1_VOLEV, $F0, REG_NR13_CH1_FRQLO, $AC, REG_NR14_CH1_FRQHI, $85, REG_NR21_CH2_LENDT, $7F
|
||||||
db REG_NR21_CH2_LENDT, $7F, REG_NR22_CH2_VOLEV, $80, REG_NR23_CH2_FRQLO, $14, REG_NR24_CH2_FRQHI, $87
|
db REG_NR21_CH2_LENDT, $7F, REG_NR22_CH2_VOLEV, $80, REG_NR23_CH2_FRQLO, $14, REG_NR24_CH2_FRQHI, $87
|
||||||
|
@ -1352,101 +1350,6 @@ sSFXIHSIRS::
|
||||||
db REG_NR12_CH1_VOLEV, $08, REG_NR12_CH1_VOLEV, $09, REG_NR12_CH1_VOLEV, $11, REG_NR12_CH1_VOLEV, $08
|
db REG_NR12_CH1_VOLEV, $08, REG_NR12_CH1_VOLEV, $09, REG_NR12_CH1_VOLEV, $11, REG_NR12_CH1_VOLEV, $08
|
||||||
db REG_NR12_CH1_VOLEV, $09, REG_NR12_CH1_VOLEV, $11, REG_NR12_CH1_VOLEV, $08, $FE
|
db REG_NR12_CH1_VOLEV, $09, REG_NR12_CH1_VOLEV, $11, REG_NR12_CH1_VOLEV, $08, $FE
|
||||||
sSFXIHSIRSEnd::
|
sSFXIHSIRSEnd::
|
||||||
sSFXLineClear::
|
|
||||||
db REG_NR12_CH1_VOLEV, $F0, REG_NR32_CH3_VOLUM, $20, REG_NR42_CH4_VOLEV, $F1, REG_NR11_CH1_LENDT, $7F
|
|
||||||
db REG_NR11_CH1_LENDT, $7F, REG_NR12_CH1_VOLEV, $F0, REG_NR13_CH1_FRQLO, $9D, REG_NR14_CH1_FRQHI, $84
|
|
||||||
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F1, REG_NR43_CH4_FQRND, $57, REG_NR44_CH4_CNTRL, $80
|
|
||||||
db $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $12, REG_NR14_CH1_FRQHI, $03, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $D2, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR11_CH1_LENDT, $7F, REG_NR11_CH1_LENDT, $7F, REG_NR12_CH1_VOLEV, $80, REG_NR13_CH1_FRQLO, $39
|
|
||||||
db REG_NR14_CH1_FRQHI, $81, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F1, REG_NR43_CH4_FQRND, $47
|
|
||||||
db REG_NR44_CH4_CNTRL, $80, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR12_CH1_VOLEV, $08, REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $80, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR13_CH1_FRQLO, $01, REG_NR14_CH1_FRQHI, $00, $FE
|
|
||||||
sSFXLineClearEnd::
|
|
||||||
sSFXLand::
|
|
||||||
db REG_NR42_CH4_VOLEV, $21, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $C1, REG_NR43_CH4_FQRND, $00
|
|
||||||
db REG_NR44_CH4_CNTRL, $80, $FE
|
|
||||||
sSFXLandEnd::
|
|
||||||
sSFXLock::
|
|
||||||
db REG_NR42_CH4_VOLEV, $F2, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $12, REG_NR43_CH4_FQRND, $14
|
|
||||||
db REG_NR44_CH4_CNTRL, $80, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F2, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
|
||||||
db $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $35, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $14, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $22, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
|
||||||
db $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $12, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
|
||||||
db $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $35, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $14, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
|
||||||
|
|
||||||
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FE
|
|
||||||
sSFXLockEnd::
|
|
||||||
sSFXLevelLock::
|
sSFXLevelLock::
|
||||||
db REG_NR12_CH1_VOLEV, $F1, REG_NR11_CH1_LENDT, $7F, REG_NR11_CH1_LENDT, $7F, REG_NR12_CH1_VOLEV, $F1
|
db REG_NR12_CH1_VOLEV, $F1, REG_NR11_CH1_LENDT, $7F, REG_NR11_CH1_LENDT, $7F, REG_NR12_CH1_VOLEV, $F1
|
||||||
db REG_NR13_CH1_FRQLO, $A7, REG_NR14_CH1_FRQHI, $87, $FF, $FF, $FF, $FF
|
db REG_NR13_CH1_FRQLO, $A7, REG_NR14_CH1_FRQHI, $87, $FF, $FF, $FF, $FF
|
||||||
|
@ -2016,4 +1919,62 @@ sSFXReadyGo::
|
||||||
db REG_NR22_CH2_VOLEV, $11, REG_NR22_CH2_VOLEV, $08, $FE
|
db REG_NR22_CH2_VOLEV, $11, REG_NR22_CH2_VOLEV, $08, $FE
|
||||||
sSFXReadyGoEnd::
|
sSFXReadyGoEnd::
|
||||||
|
|
||||||
|
; These sound effects contain only noise.
|
||||||
|
sSFXLineClear::
|
||||||
|
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F1, REG_NR43_CH4_FQRND, $57, REG_NR44_CH4_CNTRL, $80
|
||||||
|
db $FF, $FF, $FF, $FF, $FF
|
||||||
|
|
||||||
|
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F1, REG_NR43_CH4_FQRND, $47, REG_NR44_CH4_CNTRL, $80,
|
||||||
|
db $FE
|
||||||
|
sSFXLineClearEnd::
|
||||||
|
sSFXLand::
|
||||||
|
db REG_NR42_CH4_VOLEV, $21, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $C1, REG_NR43_CH4_FQRND, $00
|
||||||
|
db REG_NR44_CH4_CNTRL, $80, $FE
|
||||||
|
sSFXLandEnd::
|
||||||
|
sSFXLock::
|
||||||
|
db REG_NR42_CH4_VOLEV, $F2, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $12, REG_NR43_CH4_FQRND, $14
|
||||||
|
db REG_NR44_CH4_CNTRL, $80, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $F2, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
||||||
|
db $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $35, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $14, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $22, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
||||||
|
db $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $12, REG_NR43_CH4_FQRND, $A4, REG_NR44_CH4_CNTRL, $80
|
||||||
|
db $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $75, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $55, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $35, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $14, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FF
|
||||||
|
|
||||||
|
db REG_NR43_CH4_FQRND, $00, REG_NR44_CH4_CNTRL, $00, $FE
|
||||||
|
sSFXLockEnd::
|
||||||
|
|
||||||
ENDC
|
ENDC
|
||||||
|
|
Binary file not shown.
111
src/sfx.asm
111
src/sfx.asm
|
@ -66,6 +66,7 @@ INCLUDE "res/music_data.inc"
|
||||||
SECTION "High SFX Variables", HRAM
|
SECTION "High SFX Variables", HRAM
|
||||||
hPlayhead:: ds 2
|
hPlayhead:: ds 2
|
||||||
hPlayQueue:: ds 4
|
hPlayQueue:: ds 4
|
||||||
|
hNoisePlayhead:: ds 2
|
||||||
|
|
||||||
|
|
||||||
SECTION "SFX Functions", ROM0
|
SECTION "SFX Functions", ROM0
|
||||||
|
@ -86,6 +87,8 @@ SFXInit::
|
||||||
xor a, a
|
xor a, a
|
||||||
ldh [hPlayhead], a
|
ldh [hPlayhead], a
|
||||||
ldh [hPlayhead+1], a
|
ldh [hPlayhead+1], a
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,6 +154,32 @@ SFXProcessQueue:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
SFXTriggerNoise::
|
||||||
|
cp a, SFX_LINE_CLEAR
|
||||||
|
jr nz, :+
|
||||||
|
ld a, LOW(sSFXLineClear)
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ld a, HIGH(sSFXLineClear)
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
: cp a, SFX_LAND
|
||||||
|
jr nz, :+
|
||||||
|
ld a, LOW(sSFXLand)
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ld a, HIGH(sSFXLand)
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
: cp a, SFX_LOCK
|
||||||
|
ret nz
|
||||||
|
ld a, LOW(sSFXLock)
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ld a, HIGH(sSFXLock)
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Attempt to play the sound effect in A. Will enqueue the sound effect if the play routine is currently busy.
|
; Attempt to play the sound effect in A. Will enqueue the sound effect if the play routine is currently busy.
|
||||||
SFXEnqueue::
|
SFXEnqueue::
|
||||||
; If the playhead isn't null, then we're already playing something.
|
; If the playhead isn't null, then we're already playing something.
|
||||||
|
@ -340,35 +369,6 @@ SFXEnqueue::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Pieces dropping
|
|
||||||
: cp a, SFX_LINE_CLEAR
|
|
||||||
jr nz, :+
|
|
||||||
ld a, LOW(sSFXLineClear)
|
|
||||||
ldh [hPlayhead], a
|
|
||||||
ld a, HIGH(sSFXLineClear)
|
|
||||||
ldh [hPlayhead+1], a
|
|
||||||
call SFXPlay
|
|
||||||
ret
|
|
||||||
|
|
||||||
: cp a, SFX_LAND
|
|
||||||
jr nz, :+
|
|
||||||
ld a, LOW(sSFXLand)
|
|
||||||
ldh [hPlayhead], a
|
|
||||||
ld a, HIGH(sSFXLand)
|
|
||||||
ldh [hPlayhead+1], a
|
|
||||||
call SFXPlay
|
|
||||||
ret
|
|
||||||
|
|
||||||
: cp a, SFX_LOCK
|
|
||||||
jr nz, :+
|
|
||||||
ld a, LOW(sSFXLock)
|
|
||||||
ldh [hPlayhead], a
|
|
||||||
ld a, HIGH(sSFXLock)
|
|
||||||
ldh [hPlayhead+1], a
|
|
||||||
call SFXPlay
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
; Leveling
|
; Leveling
|
||||||
: cp a, SFX_LEVELLOCK
|
: cp a, SFX_LEVELLOCK
|
||||||
jr nz, :+
|
jr nz, :+
|
||||||
|
@ -435,6 +435,59 @@ SFXKill::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
SFXPlayNoise::
|
||||||
|
; Get the noise playhead.
|
||||||
|
ldh a, [hNoisePlayhead]
|
||||||
|
ld l, a
|
||||||
|
ldh a, [hNoisePlayhead+1]
|
||||||
|
ld h, a
|
||||||
|
or a, l
|
||||||
|
|
||||||
|
; Bail if it's null
|
||||||
|
ret z
|
||||||
|
|
||||||
|
ld b, BANK("SFX Data")
|
||||||
|
rst RSTSwitchBank
|
||||||
|
|
||||||
|
; Get the register to write to
|
||||||
|
.noisereg
|
||||||
|
ld a, [hl]
|
||||||
|
inc hl
|
||||||
|
|
||||||
|
; If it's $FE, then we're done.
|
||||||
|
cp a, $FE
|
||||||
|
jr nz, :+
|
||||||
|
rst RSTRestoreBank
|
||||||
|
xor a, a
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
; If it's $FF, then we're done for this frame.
|
||||||
|
: cp a, $FF
|
||||||
|
jr z, .savenoiseplayhead
|
||||||
|
|
||||||
|
; Otherwise, put the register in C.
|
||||||
|
ld c, a
|
||||||
|
|
||||||
|
; Get the value to write.
|
||||||
|
ld a, [hl]
|
||||||
|
inc hl
|
||||||
|
|
||||||
|
; Write it and loop.
|
||||||
|
ldh [$ff00+c], a
|
||||||
|
jr .noisereg
|
||||||
|
|
||||||
|
; Save the playhead position.
|
||||||
|
.savenoiseplayhead
|
||||||
|
ld a, l
|
||||||
|
ldh [hNoisePlayhead], a
|
||||||
|
ld a, h
|
||||||
|
ldh [hNoisePlayhead+1], a
|
||||||
|
rst RSTRestoreBank
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
; This play routine must be called every frame.
|
; This play routine must be called every frame.
|
||||||
SFXPlay::
|
SFXPlay::
|
||||||
; Bank to correct bank.
|
; Bank to correct bank.
|
||||||
|
|
Loading…
Reference in New Issue