From eb0ea87b9e746295a7a633416520cf9ba04e96e4 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Sat, 24 Feb 2024 11:03:27 -0500 Subject: [PATCH] Add a couple new sound effects for the garden and lava bosses --- src/newgame.asm | 4 ++ src/newgame.inc | 1 + src/rooms/boss_garden.asm | 10 +++-- src/rooms/boss_lava.asm | 5 ++- src/sounds/fireball.asm | 79 +++++++++++++++++++++++++++++++++++++++ src/sounds/windup.asm | 58 ++++++++++++++++++++++++++++ 6 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 src/sounds/fireball.asm create mode 100644 src/sounds/windup.asm diff --git a/src/newgame.asm b/src/newgame.asm index e21f7d6c..397e20e4 100644 --- a/src/newgame.asm +++ b/src/newgame.asm @@ -109,6 +109,7 @@ _SetFlags: d_byte Nave, " NAVE " d_byte Tomb, " TOMB " d_byte Breaker3, "BREAKER3" + d_byte Volcanic, "VOLCANIC" d_byte Breaker4, "BREAKER4" d_byte Collapse, " MINE " d_byte Breaker5, "BREAKER5" @@ -134,6 +135,7 @@ _SetFlags: d_byte Nave, eRoom::TempleNave d_byte Tomb, eRoom::CryptTomb d_byte Breaker3, eRoom::BossCrypt + d_byte Volcanic, eRoom::BossLava ; TODO start just outside d_byte Breaker4, eRoom::BossLava d_byte Collapse, eRoom::MineCollapse d_byte Breaker5, eRoom::BossMine @@ -159,6 +161,7 @@ _SetFlags: d_byte Nave, bSpawn::Passage | 3 d_byte Tomb, bSpawn::Device | 3 ; TODO: use a constant d_byte Breaker3, bSpawn::Device | kBossDoorDeviceIndex + d_byte Volcanic, bSpawn::Device | kBossDoorDeviceIndex ; TODO d_byte Breaker4, bSpawn::Device | kBossDoorDeviceIndex d_byte Collapse, bSpawn::Device | 2 ; TODO: use a constant d_byte Breaker5, bSpawn::Device | kBossDoorDeviceIndex @@ -184,6 +187,7 @@ _SetFlags: d_byte Nave, eFlag::TempleNaveTalkedToAlex d_byte Tomb, eFlag::BossCrypt d_byte Breaker3, eFlag::BreakerCrypt + d_byte Volcanic, eFlag::BossLava d_byte Breaker4, eFlag::BreakerLava d_byte Collapse, eFlag::BossMine d_byte Breaker5, eFlag::BreakerMine diff --git a/src/newgame.inc b/src/newgame.inc index 85025742..ed597935 100644 --- a/src/newgame.inc +++ b/src/newgame.inc @@ -29,6 +29,7 @@ Nave ; start in the temple nave, when Alex is waiting there Tomb ; start just outside the crypt boss room Breaker3 ; start in the crypt boss room, just after defeating it + Volcanic ; start just outside the lava boss room Breaker4 ; start in the lava boss room, just after defeating it Collapse ; start just outside the mine boss room Breaker5 ; start in the mine boss room, just after defeating it diff --git a/src/rooms/boss_garden.asm b/src/rooms/boss_garden.asm index 69761f23..74d5a35e 100644 --- a/src/rooms/boss_garden.asm +++ b/src/rooms/boss_garden.asm @@ -54,6 +54,8 @@ .IMPORT FuncA_Room_FindGrenadeActor .IMPORT FuncA_Room_InitBoss .IMPORT FuncA_Room_MachineCannonReset +.IMPORT FuncA_Room_PlaySfxShootFireball +.IMPORT FuncA_Room_PlaySfxWindup .IMPORT FuncA_Room_ResetLever .IMPORT FuncA_Room_TickBoss .IMPORT FuncA_Room_TurnProjectilesToSmoke @@ -121,7 +123,7 @@ kBossShootFireballCooldown = 60 kBossSprayFireballCooldown = 15 ;;; How many frames the boss stays in SprayWindup mode before starting to shoot ;;; the spray. -kBossSprayWindupCooldown = 60 +kBossSprayWindupCooldown = 80 ;;; How many spikes to drop when the boss is in Angry mode. kBossAngryNumSpikes = 3 @@ -555,8 +557,7 @@ _StartSprayMode: sta Zp_RoomState + sState::BossCooldown_u8 lda #eBossMode::SprayWindup sta Zp_RoomState + sState::Current_eBossMode - ;; TODO: play a sound - rts + jmp FuncA_Room_PlaySfxWindup _StartShootMode: ;; Choose a random number of fireballs to shoot, from 4-7. jsr Func_GetRandomByte ; returns A @@ -628,7 +629,7 @@ _Close: tay lda _FireballAngle_u8_arr2_arr, y ; param: aim angle jsr Func_InitActorProjFireball - ;; TODO: play a sound + jmp FuncA_Room_PlaySfxShootFireball @done: rts _FireballAngle_u8_arr2_arr: @@ -723,6 +724,7 @@ _HitEye: _HitClosedEye: ;; If the hit eye is closed, shake the room and switch the boss to Angry ;; mode. + ;; TODO: Perhaps only if not in spray mode? lda #kBossAngrySpikeCooldown * kBossAngryNumSpikes ; param: num frames jsr Func_ShakeRoom ; preserves X lda #eBossMode::Angry diff --git a/src/rooms/boss_lava.asm b/src/rooms/boss_lava.asm index be3c1300..67f84857 100644 --- a/src/rooms/boss_lava.asm +++ b/src/rooms/boss_lava.asm @@ -63,6 +63,8 @@ .IMPORT FuncA_Room_InitBoss .IMPORT FuncA_Room_MachineBlasterReset .IMPORT FuncA_Room_MachineBoilerReset +.IMPORT FuncA_Room_PlaySfxShootFireball +.IMPORT FuncA_Room_PlaySfxWindup .IMPORT FuncA_Room_ResetLever .IMPORT FuncA_Room_TickBoss .IMPORT FuncA_Terrain_FadeInShortRoomWithLava @@ -543,7 +545,7 @@ _BossFiresprayPrepare: sta Zp_RoomState + sState::Current_eBossMode lda #70 sta Zp_RoomState + sState::BossCooldown_u8 - ;; TODO: play a sound for the windup + jmp FuncA_Room_PlaySfxWindup @done: rts _BossFiresprayWindup: @@ -711,6 +713,7 @@ _BossFiresprayShoot: mul #2 ; clears the carry bit adc #$10 ; param: aim angle jsr Func_InitActorProjFireball + jsr FuncA_Room_PlaySfxShootFireball ;; When the last fireball is fired, change modes. lda Zp_RoomState + sState::BossCooldown_u8 beq _StartScuttling diff --git a/src/sounds/fireball.asm b/src/sounds/fireball.asm new file mode 100644 index 00000000..09f4fc29 --- /dev/null +++ b/src/sounds/fireball.asm @@ -0,0 +1,79 @@ +;;;=========================================================================;;; +;;; 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 "../audio.inc" +.INCLUDE "../macros.inc" +.INCLUDE "../sound.inc" + +.IMPORT Func_PlaySfxSequence + +;;;=========================================================================;;; + +.SEGMENT "PRG8" + +;;; SFX sequence data for the "shoot fireball" sound effect. +.PROC Data_ShootFireball_sSfxSeq_arr + D_STRUCT sSfxSeq + d_byte Duration_u8, 3 + d_byte Env_bEnvelope, bEnvelope::NoLength | bEnvelope::ConstVol | 4 + d_byte Sweep_byte, 0 + d_word Timer_u16, $000a + D_END + D_STRUCT sSfxSeq + d_byte Duration_u8, 3 + d_byte Env_bEnvelope, bEnvelope::NoLength | bEnvelope::ConstVol | 8 + d_byte Sweep_byte, 0 + d_word Timer_u16, $000b + D_END + D_STRUCT sSfxSeq + d_byte Duration_u8, 3 + d_byte Env_bEnvelope, bEnvelope::NoLength | bEnvelope::ConstVol | 12 + d_byte Sweep_byte, 0 + d_word Timer_u16, $000c + D_END + D_STRUCT sSfxSeq + d_byte Duration_u8, 3 + d_byte Env_bEnvelope, bEnvelope::NoLength | bEnvelope::ConstVol | 8 + d_byte Sweep_byte, 0 + d_word Timer_u16, $000d + D_END + D_STRUCT sSfxSeq + d_byte Duration_u8, 3 + d_byte Env_bEnvelope, bEnvelope::NoLength | bEnvelope::ConstVol | 4 + d_byte Sweep_byte, 0 + d_word Timer_u16, $000e + D_END + .byte 0 +.ENDPROC + +;;;=========================================================================;;; + +.SEGMENT "PRGA_Room" + +;;; Starts playing the sound for when a boss shoots a fireball. +;;; @preserve T0+ +.EXPORT FuncA_Room_PlaySfxShootFireball +.PROC FuncA_Room_PlaySfxShootFireball + ldx #eChan::Noise + ldya #Data_ShootFireball_sSfxSeq_arr + jmp Func_PlaySfxSequence ; preserves T0+ +.ENDPROC + +;;;=========================================================================;;; diff --git a/src/sounds/windup.asm b/src/sounds/windup.asm new file mode 100644 index 00000000..1c79d12e --- /dev/null +++ b/src/sounds/windup.asm @@ -0,0 +1,58 @@ +;;;=========================================================================;;; +;;; 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 "../audio.inc" +.INCLUDE "../macros.inc" +.INCLUDE "../sound.inc" + +.IMPORT Func_PlaySfxSequence + +;;;=========================================================================;;; + +.SEGMENT "PRG8" + +;;; SFX sequence data for the "windup" sound effect. +.PROC Data_Windup_sSfxSeq_arr + .linecont + + D_STRUCT sSfxSeq + d_byte Duration_u8, 85 + d_byte Env_bEnvelope, \ + bEnvelope::Duty18 | bEnvelope::NoLength | bEnvelope::ConstVol | 15 + d_byte Sweep_byte, pulse_sweep -2, 1 + d_word Timer_u16, $0280 + D_END + .byte 0 + .linecont - +.ENDPROC + +;;;=========================================================================;;; + +.SEGMENT "PRGA_Room" + +;;; Starts playing the sound for when a boss winds up a big attack. +;;; @preserve T0+ +.EXPORT FuncA_Room_PlaySfxWindup +.PROC FuncA_Room_PlaySfxWindup + ldx #eChan::Pulse2 + ldya #Data_Windup_sSfxSeq_arr + jmp Func_PlaySfxSequence ; preserves T0+ +.ENDPROC + +;;;=========================================================================;;;