From 2d3ed0789d6e3c066e825abcd760f8970acc89b7 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Thu, 5 Dec 2024 08:33:43 -0500 Subject: [PATCH] Add sound effect for collecting a new paper --- src/paper.asm | 3 +- src/sounds/paper.asm | 65 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/sounds/paper.asm diff --git a/src/paper.asm b/src/paper.asm index 0dff1c9..29ecd66 100644 --- a/src/paper.asm +++ b/src/paper.asm @@ -132,6 +132,7 @@ .IMPORT Data_PowersOfTwo_u8_arr8 .IMPORT FuncA_Pause_DirectDrawWindowBlankLine .IMPORT FuncA_Pause_DirectDrawWindowLineSide +.IMPORT FuncA_Pause_PlaySfxCollectPaper .IMPORT Func_AllocObjects .IMPORT Func_BufferPpuTransfer .IMPORT Func_IsFlagSet @@ -219,7 +220,7 @@ Ram_CollectedPapers_u8_arr: .res kPaperGridCols tax ; param: flag jsr Func_SetFlag ; sets C if flag was already set bcs @doneSfx - ;; TODO: play a sound for collecting a new paper + jsr FuncA_Pause_PlaySfxCollectPaper @doneSfx: pla ; eFlag::Paper* value .assert eDialog::PaperJerome01 > eFlag::PaperJerome01, error diff --git a/src/sounds/paper.asm b/src/sounds/paper.asm new file mode 100644 index 0000000..e9d24bb --- /dev/null +++ b/src/sounds/paper.asm @@ -0,0 +1,65 @@ +;;;=========================================================================;;; +;;; Copyright 2022 Matthew D. Steele ;;; +;;; ;;; +;;; This file is part of Annalog. ;;; +;;; ;;; +;;; Annalog is free software: you can redistribute it and/or modify it ;;; +;;; under the terms of the GNU General Public License as published by the ;;; +;;; Free Software Foundation, either version 3 of the License, or (at your ;;; +;;; option) any later version. ;;; +;;; ;;; +;;; Annalog is distributed in the hope that it will be useful, but WITHOUT ;;; +;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;;; +;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;;; +;;; for more details. ;;; +;;; ;;; +;;; You should have received a copy of the GNU General Public License along ;;; +;;; with Annalog. If not, see . ;;; +;;;=========================================================================;;; + +.INCLUDE "../apu.inc" +.INCLUDE "../macros.inc" +.INCLUDE "../sound.inc" + +.IMPORT Func_PlaySfxOnNoiseChannel + +;;;=========================================================================;;; + +.SEGMENT "PRG8" + +;;; SFX data for the "collect paper" sound effect. +.PROC Data_CollectPaper_sSfx + sfx_SetTimer $0007 + sfx_Func _EnvUp + sfx_SetTimerLo $8b + sfx_Func _EnvUp + sfx_SetTimerLo $08 + sfx_Func _EnvUp + sfx_End +_EnvUp: + lda _Env_bEnvelope_arr6, y + sta Hw_Channels_sChanRegs_arr5 + sChanRegs::Envelope_wo, x + cpy #5 + rts +_Env_bEnvelope_arr6: + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 1 + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 4 + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 6 + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 9 + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 11 + .byte bEnvelope::ConstVol | bEnvelope::NoLength | 14 +.ENDPROC + +;;;=========================================================================;;; + +.SEGMENT "PRGA_Pause" + +;;; Starts playing the sound for when the player avatar collects a new paper. +;;; @preserve X, T0+ +.EXPORT FuncA_Pause_PlaySfxCollectPaper +.PROC FuncA_Pause_PlaySfxCollectPaper + ldya #Data_CollectPaper_sSfx + jmp Func_PlaySfxOnNoiseChannel ; preserves X and T0+ +.ENDPROC + +;;;=========================================================================;;;