summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shockwave.bb118
1 files changed, 89 insertions, 29 deletions
diff --git a/shockwave.bb b/shockwave.bb
index 3d654c1..12882d4 100644
--- a/shockwave.bb
+++ b/shockwave.bb
@@ -1,7 +1,7 @@
;
; SHOCKWAVE (c) COPYRIGHT Ian Cowburn 2004
;
-; $Id: shockwave.bb,v 1.4 2005-03-05 02:10:49 ianc Exp $
+; $Id: shockwave.bb,v 1.5 2005-03-05 03:27:05 ianc Exp $
;
Include "gfx/font.bb"
@@ -58,6 +58,12 @@ Type PowerUp
Field count
End Type
+Type QSound
+ Field snd
+ Field time
+ Field obj
+End Type
+
; ============================================
; CONSTS
; ============================================
@@ -95,7 +101,7 @@ Const POWTURBOTURN=2
Const POWSHIELD=3
; ============================================
-; STATICS
+; GLOBLS
; ============================================
;
Global WINW=800
@@ -113,6 +119,22 @@ Graphics3D WINW,WINH,32;,2
SetBuffer BackBuffer()
Global camera=CreateCamera()
+Global listener=CreateListener(camera,0.001)
+
+Dim snd_emitter(7)
+
+For f=0 To 7
+ snd_emitter(f)=CreatePivot(camera)
+Next
+
+PositionEntity snd_emitter(0),0,0,2
+PositionEntity snd_emitter(1),1,0,1
+PositionEntity snd_emitter(2),2,0,0
+PositionEntity snd_emitter(3),1,0,-1
+PositionEntity snd_emitter(4),0,0,-2
+PositionEntity snd_emitter(5),-1,0,-1
+PositionEntity snd_emitter(6),-2,0,0
+PositionEntity snd_emitter(7),-1,0,1
CameraRange camera,0.1,10000
CameraFogMode camera,0
@@ -136,16 +158,16 @@ Global map=CreateMap()
Global radar_spr=CreateSprite(camera)
Global hud_spr=CreateSprite(camera)
-Global start_sfx=LoadSound("sfx/start.wav")
-Global bonus_level_sfx=LoadSound("sfx/bonus_level.wav")
-Global laugh_sfx=LoadSound("sfx/laugh.wav")
-Global explode_sfx=LoadSound("sfx/explode.wav")
-Global pop_sfx=LoadSound("sfx/pop.wav")
-Global turbostart_sfx=LoadSound("sfx/powerstart.wav")
-Global turbostop_sfx=LoadSound("sfx/powerstop.wav")
-Global turnstart_sfx=LoadSound("sfx/powerstart.wav")
-Global turnstop_sfx=LoadSound("sfx/powerstop.wav")
-Global smartbomb_sfx=LoadSound("sfx/smartbomb.wav")
+Global start_sfx=Load3DSound("sfx/start.wav")
+Global bonus_level_sfx=Load3DSound("sfx/bonus_level.wav")
+Global laugh_sfx=Load3DSound("sfx/laugh.wav")
+Global explode_sfx=Load3DSound("sfx/explode.wav")
+Global pop_sfx=Load3DSound("sfx/pop.wav")
+Global turbostart_sfx=Load3DSound("sfx/powerstart.wav")
+Global turbostop_sfx=Load3DSound("sfx/powerstop.wav")
+Global turnstart_sfx=Load3DSound("sfx/powerstart.wav")
+Global turnstop_sfx=Load3DSound("sfx/powerstop.wav")
+Global smartbomb_sfx=Load3DSound("sfx/smartbomb.wav")
HideEntity particle
HideEntity large_asteroid
@@ -242,6 +264,7 @@ Repeat
end_level=False
FlushKeys
+ Delete Each QSound
While (Not dead) And (Not done) And (Not KeyHit(1))
@@ -275,13 +298,13 @@ Repeat
NewCameraSpriteText("BONUS LEVEL "+Str$(level),$ffffff,0,0,EntityZ(camera)+f,-0.4,1,0.01)
Next
- PlaySound bonus_level_sfx
+ EmitSound(bonus_level_sfx,camera)
Else
For f=30 To 50 Step 4
NewCameraSpriteText("LEVEL "+Str$(level),$ffffff,0,0,EntityZ(camera)+f,-0.4,1,0.01)
Next
- PlaySound start_sfx
+ EmitSound(start_sfx,camera)
EndIf
total_chain=0
@@ -365,7 +388,7 @@ Repeat
turn_count=turn_count-1
If turn_count=0
- PlaySound turnstop_sfx
+ CircleQSound(turnstop_sfx,1)
turn=2
EndIf
EndIf
@@ -374,7 +397,7 @@ Repeat
turbo_count=turbo_count-1
If turbo_count=0
- PlaySound turbostop_sfx
+ CircleQSound(turbostop_sfx,1)
MAX_SPEED=1
EndIf
EndIf
@@ -456,6 +479,7 @@ Repeat
MoveEntity ship,0,speed,0
EndIf
+ ProcessQSounds()
Flip
WaitTimer(timer)
@@ -469,7 +493,7 @@ Repeat
If dead
- PlaySound explode_sfx
+ CircleQSound(explode_sfx,25)
fov#=60
@@ -498,6 +522,7 @@ Repeat
f=0
While (f<700) And (Not (KeyDown(57) Or KeyDown(1)))
+ ProcessQSounds()
SetCameraFOV(fov)
If fov<175
fov=fov+1
@@ -513,6 +538,7 @@ Repeat
Wend
While fov>60
+ ProcessQSounds()
SetCameraFOV(fov)
fov=fov-5
UpdateAsteroids()
@@ -557,10 +583,10 @@ End Function
Function SubShield(s)
orig=shield
shield=shield-s
- If shield<0 And (Not dead) Then shield=0:dead=True:PlaySound laugh_sfx
+ If shield<0 And (Not dead) Then shield=0:dead=True:EmitSound(laugh_sfx,snd_emitter(Rand(0,7)))
If shield>300 Then shield=300
- If orig=>50 And shield<50 Then PlaySound laugh_sfx
- If orig=>20 And shield<20 Then PlaySound laugh_sfx
+ If orig=>50 And shield<50 Then EmitSound(laugh_sfx,snd_emitter(Rand(0,7)))
+ If orig=>20 And shield<20 Then EmitSound(laugh_sfx,snd_emitter(Rand(0,7)))
HudText(150,0,"SHEILD")
HudTextCol(206,0,shield+" ",$ff0000)
End Function
@@ -891,7 +917,7 @@ Function NewAsteroid(size,x#,y#)
Else
a\id=CopyEntity(small_asteroid)
EndIf
-
+
a\size=size
EntityTexture a\id,shieldtex
@@ -959,7 +985,7 @@ Function UpdateAsteroids()
hit_count=hit_count+1
If Not a\split
- PlaySound pop_sfx
+ EmitSound(pop_sfx,a\id)
For f=10 To 100 Step 10
NewAlphaParticle(particle,EntityX(a\id),EntityY(a\id),EntityZ(a\id)-f,1.0,-0.01)
Next
@@ -981,7 +1007,7 @@ Function UpdateAsteroids()
Case POWSPLIT
NewCameraSpriteText("SMART BOMB!",$ff0000,0,0,EntityZ(camera)+30,-0.4,1,0.01)
do_split=True
- PlaySound smartbomb_sfx
+ CircleQSound(smartbomb_sfx,2)
Case POWSHIELD
NewCameraSpriteText("SHEILD UP!",$ff0000,0,0,EntityZ(camera)+31,-0.4,1,0.01)
@@ -990,12 +1016,12 @@ Function UpdateAsteroids()
Case POWTURBOTURN
If Rand(100)>50
NewCameraSpriteText("TURBO NUTTER!",$ff0000,0,0,EntityZ(camera)+32,-0.4,1,0.01)
- PlaySound turbostart_sfx
+ CircleQSOund(turbostart_sfx,1)
turbo_count=turbo_count+500
MAX_SPEED=2
Else
NewCameraSpriteText("TURN NUTTER!",$ff0000,0,0,EntityZ(camera)+33,-0.4,1,0.01)
- PlaySound turnstart_sfx
+ CircleQSound(turnstart_sfx,1)
turn_count=turn_count+500
turn=4
EndIf
@@ -1502,7 +1528,7 @@ Function Menu()
HudTextCentre(80,"PRESS ESC TO QUIT",$ffff00)
HudTextCentre(170,"HIGH SCORE",$ffffff)
- HudTextCentre(200,"HIGHEST LOST CHAIN",$ffffff)
+ HudTextCentre(200,"LARGEST LOST CHAIN",$ffffff)
AddScore(0)
@@ -1517,15 +1543,15 @@ Function Menu()
ti=MilliSecs()
EndIf
- HudTextCentre(110," START LEVEL " + start_level+" ",$00ffff)
- HudTextCentre(120," BONUS " + start_bonus+" ",$00ffff)
+ HudTextCentre(100," START LEVEL " + start_level+" ",$00ffff)
+ HudTextCentre(110," BONUS " + start_bonus+" ",$00ffff)
If new_highscore
HudTextCentre(170,"NEW HIGH SCORE",(g Shl 16) Or (b Shl 8) Or r)
EndIf
If new_highlostchain
- HudTextCentre(200,"NEW HIGHEST LOST CHAIN",(g Shl 16) Or (b Shl 8) Or r)
+ HudTextCentre(200,"NEW LARGEST LOST CHAIN",(g Shl 16) Or (b Shl 8) Or r)
EndIf
HudTextCentre(180,Str$(highscore),(r Shl 16) Or (g Shl 8) Or b)
@@ -1705,6 +1731,40 @@ End Function
; ============================================
+; Queued Sound Routines
+; ============================================
+;
+.QSoundRoutines
+
+Function ProcessQSounds()
+ For s.QSound=Each QSound
+ If s\time=0
+ EmitSound(s\snd,s\obj)
+ Delete s
+ Else
+ s\time=s\time-1
+ EndIf
+ Next
+End Function
+
+
+Function QueueQSound(snd,time,source)
+ s.QSound=New QSound
+ s\snd=snd
+ s\time=time
+ s\obj=source
+End Function
+
+
+Function CircleQSound(snd,del)
+ For f=0 To 7
+ QueueQSound(snd,del*f,snd_emitter(f))
+ Next
+End Function
+
+
+
+; ============================================
; Instruction Data
; ============================================
;