From 0bf45f2ea9370780470418432f32f87ef1c61646 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Wed, 1 Jun 2016 15:39:57 +1000 Subject: [PATCH] fixed bonus life sound corruption --- 028.bs/game1.s | 3 +++ 028.bs/macros.i | 4 ++-- 028.bs/menu.s | 3 +++ 028.bs/sound.s | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/028.bs/game1.s b/028.bs/game1.s index 7b4a0b5..f369602 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -126,6 +126,7 @@ Reset: jsr PreRenderColumnsRemaining jsr RenderPlayerScore jsr ResetPickups + jsr ResetSound move.l startForegroundMapPtr,foregroundMapPtr move.l startPathwayMapPtr,pathwayMapPtr @@ -264,6 +265,7 @@ PostCheckPlayerMiss: bra GameLoop + if TRACKLOADER=0 QuitGame: jsr WaitVerticalBlank jsr PlayNextSound @@ -273,6 +275,7 @@ QuitGame: jsr P61_End movem.l (sp)+,d0-a6 jmp LongJump + endif Update: jsr UpdatePlayer diff --git a/028.bs/macros.i b/028.bs/macros.i index 1edb88a..e645997 100644 --- a/028.bs/macros.i +++ b/028.bs/macros.i @@ -19,7 +19,7 @@ KillSound: macro 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) - WaitScanLines 1 + WaitScanLines 3 move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) .\@skip: endif @@ -198,7 +198,7 @@ AddToScore: macro cmp.l __nextPlayerBonus,d0 blt .\@skip movem.l d0-a6,-(sp) - PlaySound Yay + PlaySound Bonus lea livesCounterText,a0 jsr IncrementCounter lea livesCounterShortText,a1 diff --git a/028.bs/menu.s b/028.bs/menu.s index c0aee68..b5216ba 100644 --- a/028.bs/menu.s +++ b/028.bs/menu.s @@ -20,6 +20,7 @@ ShowMenu: lea CUSTOM,a6 jsr ReloadSplashScreen jsr RestoreSplashMenuSection + jsr ResetSound ReShowMenu: jsr WaitVerticalBlank @@ -201,8 +202,10 @@ ButtonPressed: beq .quitButton endif bra .done + if TRACKLOADER=0 .quitButton: jmp QuitGame + endif .difficultyButton: bsr ToggleDifficulty bra .done diff --git a/028.bs/sound.s b/028.bs/sound.s index 6d2c192..7124201 100644 --- a/028.bs/sound.s +++ b/028.bs/sound.s @@ -1,8 +1,13 @@ include "includes.i" xdef PlayNextSound + xdef ResetSound xdef fadeMusic +ResetSound: + move.l #0,blackoutFrame + rts + PlayNextSound: cmp.w #0,fadeMusic beq .dontFadeOutMusic @@ -30,8 +35,13 @@ PlayNextSound: xdef PlayChachingSound xdef PlayWhooshSound xdef PlayYaySound + xdef PlayBonusSound PlayJumpSound: + move.l d0,-(sp) + move.l blackoutFrame,d0 + cmp.l frameCount,d0 + bgt .skip move.w #0,dontKillSound lea jump(pc),a1 move.l a1,AUD3LCH(a6) @@ -39,9 +49,15 @@ PlayJumpSound: move.w #64,AUD3VOL(a6) move.w #(endJump-jump)/2,AUD3LEN(a6) ;Set length in words move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) +.skip: + move.l (sp)+,d0 rts PlayWhooshSound: + move.l d0,-(sp) + move.l blackoutFrame,d0 + cmp.l frameCount,d0 + bgt .skip KillSound move.w #0,dontKillSound lea whoosh,a1 @@ -50,6 +66,8 @@ PlayWhooshSound: move.w #64,AUD3VOL(a6) move.w #(endWhoosh-whoosh)/2,AUD3LEN(a6) ;Set length in words move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) +.skip: + move.l (sp)+,d0 rts @@ -65,6 +83,10 @@ PlayFallingSound: rts PlayChachingSound: + move.l d0,-(sp) + move.l blackoutFrame,d0 + cmp.l frameCount,d0 + bgt .skip KillSound move.w #0,dontKillSound lea chaching,a1 @@ -73,6 +95,8 @@ PlayChachingSound: move.w #64,AUD3VOL(a6) move.w #(endChaching-chaching)/2,AUD3LEN(a6) ;Set length in words move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) +.skip: + move.l (sp)+,d0 rts PlayYaySound: @@ -86,6 +110,22 @@ PlayYaySound: move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) rts +PlayBonusSound: + KillSound + move.l d0,-(sp) + move.l frameCount,d0 + add.l #41,d0 + move.l d0,blackoutFrame + move.l (sp)+,d0 + move.w #0,dontKillSound + lea yay,a1 + move.l a1,AUD3LCH(a6) + move.w #423,AUD3PER(a6) + move.w #64,AUD3VOL(a6) + move.w #(endYay-yay)/2,AUD3LEN(a6) ;Set length in words + move.w #(DMAF_AUD3|DMAF_SETCLR),DMACON(a6) + rts + align 4 jump: incbin "out/jump.raw" @@ -108,6 +148,8 @@ yay: endYay: align 2 +blackoutFrame: + dc.l 0 emptySound: dc.l 0 dontKillSound: