Move the sound code into a gameSound.s file. This is the first step towards going around the sound toolset for playing sounds.

This commit is contained in:
Jeremy Rand 2020-12-16 12:00:56 -05:00
parent 622f0e5f9f
commit d201f80c3b
12 changed files with 117 additions and 27 deletions

View File

@ -53,6 +53,7 @@
9D1553EC257F3E5200657188 /* kill.raw */ = {isa = PBXFileReference; lastKnownFileType = text; path = kill.raw; sourceTree = "<group>"; };
9D1553ED257F3E5200657188 /* segments.raw */ = {isa = PBXFileReference; lastKnownFileType = text; path = segments.raw; sourceTree = "<group>"; };
9D1553EE257F3E5200657188 /* spider.raw */ = {isa = PBXFileReference; lastKnownFileType = text; path = spider.raw; sourceTree = "<group>"; };
9D159805258A6BCB00BA42DF /* gameSound.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSound.s; sourceTree = "<group>"; };
9D1716842491C49300C83148 /* BuGS */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BuGS; sourceTree = BUILT_PRODUCTS_DIR; };
9D1716872491C49300C83148 /* BuGS.2mg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BuGS.2mg; sourceTree = BUILT_PRODUCTS_DIR; };
9D17168C2491C49300C83148 /* doNotBuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = doNotBuild; sourceTree = BUILT_PRODUCTS_DIR; };
@ -87,14 +88,14 @@
9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameMushroom.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D47CC14254A698900CDA5CB /* gamePlayer.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gamePlayer.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D47CCBA25525C1A00CDA5CB /* genData.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = genData.pl; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.perl; };
9D53E5B32562320300E10169 /* gameShot.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameShot.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D53E5B32562320300E10169 /* gameShot.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameShot.s; sourceTree = "<group>"; };
9D53E6472565939300E10169 /* BUGS.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = BUGS.md; sourceTree = "<group>"; };
9D62AF3B249871A300348F45 /* colour.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = colour.s; sourceTree = "<group>"; };
9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
9D8AF0B72535542400C10E3C /* level.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = level.s; sourceTree = "<group>"; };
9D8AF0B82535543000C10E3C /* score.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = score.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = "<group>"; };
9D8FFC612491CAF0005C9327 /* game.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = "<group>"; };
9D9F07F92553AB3800875B29 /* TODO.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = TODO.md; sourceTree = "<group>"; };
9DB1505024C3801100558B87 /* gameFlea.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameFlea.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
@ -168,6 +169,7 @@
9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */,
9D47CC14254A698900CDA5CB /* gamePlayer.s */,
9D53E5B32562320300E10169 /* gameShot.s */,
9D159805258A6BCB00BA42DF /* gameSound.s */,
9D8AF0B72535542400C10E3C /* level.s */,
9D8AF0B82535543000C10E3C /* score.s */,
9D62AF3B249871A300348F45 /* colour.s */,

View File

@ -7,7 +7,7 @@
<key>Binary.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<key>BuGS.xcscheme_^#shared#^_</key>
<dict>
@ -17,12 +17,12 @@
<key>DiskImage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>1</integer>
</dict>
<key>doNotBuild.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>3</integer>
</dict>
</dict>
</dict>

View File

@ -189,6 +189,7 @@ startGame_notRunning anop
jsl initPlayer
jsl spiderInitGame
jsl levelInit
jsl soundInit
; Fall through intentionally here...
startLevel entry
jsl segmentsInitLevel

View File

@ -288,7 +288,7 @@ shootFlea entry
beq shootFlea_faster
jsl explodeFlea
~FFStartPlaying #1|KILL_SOUND_GENERATOR
jsl playKillSound
jmp scoreAddTwoHundred
shootFlea_faster anop

View File

@ -79,14 +79,7 @@ resetMushrooms_keepChecking anop
lda #TILE_STATE_DIRTY
sta tileDirty,x
jsl scoreAddFive
~FFStartPlaying mushroomSound
lda mushroomSound
asl a
and #7|BONUS1_SOUND_GENERATOR
bne resetMushrooms_doneSound
lda #1|BONUS1_SOUND_GENERATOR
resetMushrooms_doneSound anop
sta mushroomSound
jsl playBonusSound
ldx mushroomToRefresh
lda #EXPLOSION_LAST_OFFSET
sta mushroomExplosionSprite
@ -166,7 +159,6 @@ shootMushroom_done anop
mushroomToRefresh dc i2'INVALID_TILE_NUM'
mushroomExplosionSprite dc i2'0'
mushroomSound dc i2'1|BONUS1_SOUND_GENERATOR'
mushroomRefreshWait dc i2'0'

View File

@ -492,7 +492,7 @@ updatePlayer_contCollision anop
sta playerFrameCount
lda #SHIP_EXPLOSION_LAST_OFFSET
sta playerExplosionOffset
~FFStartPlaying #1|DEATH_SOUND_GENERATOR
jsl playDeathSound
jmp updatePlayer_exploding
updatePlayer_noCollision anop

View File

@ -371,7 +371,7 @@ shootScorpion entry
inc a
inc a
sta scorpionScreenOffset
~FFStartPlaying #1|KILL_SOUND_GENERATOR
jsl playKillSound
jmp scoreAddOneThousand
shootScorpion_done anop

View File

@ -1781,7 +1781,7 @@ isSegmentCollision_returnTrue anop
; Call this with the segment num * 2 in the X register
shootSegment entry
phx
~FFStartPlaying #1|KILL_SOUND_GENERATOR
jsl playKillSound
lda segmentStates,x
cmp #SEGMENT_STATE_BODY
beq shootSegment_body

View File

@ -75,14 +75,7 @@ updateShot_shifted anop
updateShot_notNone anop
cmp #SHOT_STATE_START_SHOOTING
bne updateShot_shooting
~FFStartPlaying shotSound
lda shotSound
asl a
and #31|FIRE1_SOUND_GENERATOR
bne updateShot_doneSound
lda #1|FIRE1_SOUND_GENERATOR
updateShot_doneSound anop
sta shotSound
jsl playFireSound
lda SHOT_STATE_SHOOTING
sta shotState
lda #1

99
BuGS/gameSound.s Normal file
View File

@ -0,0 +1,99 @@
;
; gameSound.s
; BuGS
;
; Created by Jeremy Rand on 2020-12-16.
;Copyright © 2020 Jeremy Rand. All rights reserved.
;
case on
mcopy gameSound.macros
keep gameSound
gameSound start
using globalData
using tileData
soundInit entry
; Write this code...
rtl
updateSounds entry
; Write this code...
rtl
playBonusSound entry
~FFStartPlaying bonusSoundGen
lda bonusSoundGen
asl a
and #7|BONUS1_SOUND_GENERATOR
bne playBonusSound_doneSound
lda #1|BONUS1_SOUND_GENERATOR
playBonusSound_doneSound anop
sta bonusSoundGen
rtl
playDeathSound entry
~FFStartPlaying #1|DEATH_SOUND_GENERATOR
rtl
playKillSound entry
~FFStartPlaying #1|KILL_SOUND_GENERATOR
rtl
playExtraLifeSound entry
; Write this code...
rtl
playFireSound entry
~FFStartPlaying fireSoundGen
lda fireSoundGen
asl a
and #31|FIRE1_SOUND_GENERATOR
bne playFireSound_doneSound
lda #1|FIRE1_SOUND_GENERATOR
playFireSound_doneSound anop
sta fireSoundGen
rtl
startSpiderSound entry
; Write this code...
rtl
stopSpiderSound entry
; Write this code...
rtl
startScorpionSound entry
; Write this code...
rtl
stopScorpionSound entry
; Write this code...
rtl
startFleaSound entry
; Write this code...
rtl
stopFleaSound entry
; Write this code...
rtl
bonusSoundGen dc i2'1|BONUS1_SOUND_GENERATOR'
fireSoundGen dc i2'1|FIRE1_SOUND_GENERATOR'
end

View File

@ -810,7 +810,7 @@ shootSpider entry
cmp #SPIDER_STATE_LEFT_DIAG_DOWN
blt shootSpider_done
~FFStartPlaying #1|KILL_SOUND_GENERATOR
jsl playKillSound
jsl explodeSpider
cmp mouseAddress
blt shootSpider_playerBelow

View File

@ -109,6 +109,9 @@ void setupSound(word soundNum, SoundParamBlock * soundParams, word genNum, word
for (word i = 0; i < numGenerators; i++)
FFSetUpSound(((genNum + i) << 8) | 1, (Pointer)soundParams);
HUnlock(handle);
ReleaseResource(1, rRawSound, soundNum);
}