diff --git a/028.bs/foreground.tmx b/028.bs/foreground.tmx index e26f128..fa9809c 100644 --- a/028.bs/foreground.tmx +++ b/028.bs/foreground.tmx @@ -18,7 +18,7 @@ - eJztlVsKgCAQRXVpPSzoCYXtfyklJEyRzihGVh7ox65TnCvIWCJmco5nMkJGMXH6TJhriPmvovzaHBf8mPWZD2fMyIz2xX1Qz54N7ZjiGnZXGvKdYd2Up+7/E3JzIHbXvcUH7EM69KgRhKzt+1eEOJNPof4dPgrM53J6DzupPFxge4ab/br0F0vXrvdEHTA/RuIgkVgBbswOFg== + eJztlVsKgCAQRXVpvaEnFLb/pZSQMEnqjBhZeaCfuqNyrhBjiZjIOX0mQ87MnLaHyrUeZ/oS0q/NccHPWZ/14RqLY43uxX343G8d5RjjGnZXGvK94b0pj53/E2J3UB2uB4sP2Icg9KioEFnb/leEuJNPIc8OH4nL56p9h53UHi5cM+PNfin9xdI19T/RBMxPkThIJDZy/A4W diff --git a/028.bs/game1.s b/028.bs/game1.s index 2029d24..019a193 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -196,11 +196,6 @@ GameLoop: move.l #FOREGROUND_SCROLL_PIXELS,foregroundScrollPixels jsr WaitVerticalBlank - - if SFX=1 - move.w #2,AUD3LEN(a6) ; set the empty sound for the next sample to be played - move.l #emptySound,AUD3LCH(a6) - endif if TIMING_TEST=1 move.l #4000,d0 @@ -255,6 +250,7 @@ GameLoop: move.w #$f00,COLOR02(a6) endif + jsr PlayNextSound bra GameLoop Update: @@ -663,14 +659,13 @@ PostMissedTile: BigBang: PlaySound Falling jsr WaitVerticalBlank - - move.w #2,AUD3LEN(a6) ; set the empty sound for the next sample to be played - move.l #emptySound,AUD3LCH(a6) - + jsr PlayNextSound + jsr ResetItems move.w #0,moving move.l #0,frameCount .bigBangLoop: + add.l #1,frameCount cmp.l #BIGBANG_POST_DELAY,frameCount beq PostMissedTile @@ -1493,10 +1488,6 @@ panelFade: tileFade: include "out/tileFade.s" - align 2 -emptySound: - dc.l 0 - section .bss foregroundBitplanes1: diff --git a/028.bs/macros.i b/028.bs/macros.i index 1e94aca..b8212ff 100644 --- a/028.bs/macros.i +++ b/028.bs/macros.i @@ -4,6 +4,26 @@ PlaySound: macro endif endm +KillSound: macro + if SFX=1 + move.w #(DMAF_AUD3),DMACON(a6) + move.w #1,AUD3PER(a6) + move.w #2,AUD3LEN(a6) ; set the empty sound for the next sample to be played + move.l #emptySound,AUD3LCH(a6) + + + lea $dff004,a0 + move.l (a0),d0 + add.l #1<<8,d0 +.loop: + move.l (a0),d1 + cmp.l d0,d1 + ble .loop + + move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) + endif + endm + WaitBlitter: macro tst DMACONR(a6) ;for compatibility .\@: diff --git a/028.bs/sound.s b/028.bs/sound.s index 3dd7141..05f9828 100644 --- a/028.bs/sound.s +++ b/028.bs/sound.s @@ -1,4 +1,14 @@ include "includes.i" + + xdef PlayNextSound + +PlayNextSound: + if SFX=1 + move.w #2,AUD3LEN(a6) ; set the empty sound for the next sample to be played + move.l #emptySound,AUD3LCH(a6) + endif + rts + if SFX=1 xdef PlayJumpSound xdef PlayFallingSound @@ -15,6 +25,7 @@ PlayJumpSound: rts PlayWhooshSound: + KillSound lea whoosh,a1 move.l a1,AUD3LCH(a6) move.w #256,AUD3PER(a6) @@ -25,6 +36,7 @@ PlayWhooshSound: PlayFallingSound: + KillSound lea falling(pc),a1 move.l a1,AUD3LCH(a6) move.w #256,AUD3PER(a6) @@ -34,6 +46,7 @@ PlayFallingSound: rts PlayChachingSound: + KillSound lea chaching,a1 move.l a1,AUD3LCH(a6) move.w #256,AUD3PER(a6) @@ -57,4 +70,8 @@ endChaching: whoosh: incbin "out/whoosh.raw" endWhoosh: + + align 2 +emptySound: + dc.l 0 endif \ No newline at end of file