Skip to content

Commit

Permalink
Add a couple new sound effects for the garden and lava bosses
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Feb 24, 2024
1 parent 30d2261 commit eb0ea87
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/newgame.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/newgame.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/rooms/boss_garden.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/rooms/boss_lava.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
79 changes: 79 additions & 0 deletions src/sounds/fireball.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
;;;=========================================================================;;;
;;; Copyright 2022 Matthew D. Steele <[email protected]> ;;;
;;; ;;;
;;; 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 <http://www.gnu.org/licenses/>. ;;;
;;;=========================================================================;;;

.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

;;;=========================================================================;;;
58 changes: 58 additions & 0 deletions src/sounds/windup.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
;;;=========================================================================;;;
;;; Copyright 2022 Matthew D. Steele <[email protected]> ;;;
;;; ;;;
;;; 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 <http://www.gnu.org/licenses/>. ;;;
;;;=========================================================================;;;

.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

;;;=========================================================================;;;

0 comments on commit eb0ea87

Please sign in to comment.