diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | src/Game.h | 2 | ||||
-rw-r--r-- | src/GameInitDispose.cpp | 942 | ||||
-rw-r--r-- | src/Person.h | 1 | ||||
-rw-r--r-- | src/SConstruct | 10 | ||||
-rw-r--r-- | src/Skeleton.h | 1 | ||||
-rw-r--r-- | src/Support.cpp | 31 | ||||
-rw-r--r-- | src/Support.h | 10 |
8 files changed, 42 insertions, 962 deletions
diff --git a/Makefile b/Makefile index 7e14cd9..86792a4 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,7 @@ BINDIR := ./build EXE := $(BINDIR)/blackshades CXXFLAGS := -O2 -Wall -g -I$(SRCDIR) -LDFLAGS := -lSDL -lGL -lGLU -lopenal -lalut - -# Don't want ogg? -#CFLAGS += -DNOOGG -# Got ogg? -LDFLAGS += -lvorbisfile -lvorbis +LDFLAGS := -lSDL -lGL -lGLU -lopenal -lalut -lvorbisfile SRCS := Camera.cpp \ Decals.cpp \ diff --git a/src/Game.h b/src/Game.h index 03643d1..60b745f 100644 --- a/src/Game.h +++ b/src/Game.h @@ -10,7 +10,7 @@ #include <cstdarg> #include <SDL/SDL.h> #include <AL/al.h> -#include <AL/alut.h> + #include "Timer.h" #include "MacInput.h" #include "Quaternions.h" diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp index 69396c5..c11f3c1 100644 --- a/src/GameInitDispose.cpp +++ b/src/GameInitDispose.cpp @@ -1,1014 +1,398 @@ #include <ctype.h> #include <time.h> +#include <AL/alut.h> + #include "Textures.h" #include "Game.h" extern unsigned int gSourceID[100]; - extern unsigned int gSampleSet[100]; - extern Camera camera; - extern Skeleton testskeleton; - extern Sprites sprites; - extern Decals decals; /*********************> InitGame()<*****/ - extern Model skeletonmodels[10]; - extern Model gunmodels[10]; - extern Costume costume[10]; - extern Animation animation[30]; - extern int visions; - extern float rad2deg; - extern Fog fog; - extern bool blood; - extern float fogcolorr; - extern float fogcolorg; - extern float fogcolorb; - extern int environment; - extern float precipitationhorz; - extern float precipitationvert; - extern float precipitationdensity; - extern float soundscalefactor; - extern int slomo; - extern int forwardskey; - extern int backwardskey; - extern int leftkey; - extern int rightkey; - extern int aimkey; - extern int psychicaimkey; - extern int psychickey; -void LoadSounds(bool musictoggle); - void LoadSounds(bool musictoggle) - { char *pBuffer1; - long lBuffer1Len; - ALenum formatBuffer1; - ALsizei freqBuffer1; - SInt16 iNumSources, iNumSampleSets; // initialize OpenAL - alutInit(NULL, 0); // load up some audio data... - // generate ten OpenAL sample sets and two sources - iNumSources = 37; - iNumSampleSets = 37; - alGenSources(iNumSources, &gSourceID[0]); - alGenBuffers(iNumSampleSets, &gSampleSet[0]); - -#ifdef NOOGG - alutLoadWAVFile((char *)":Data:Sounds:underwater.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[visionsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[visionsound], AL_BUFFER, gSampleSet[visionsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:soulin.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[soulinsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[soulinsound], AL_BUFFER, gSampleSet[soulinsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:soulout.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[souloutsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[souloutsound], AL_BUFFER, gSampleSet[souloutsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:footstep1.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[footstepsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[footstepsound], AL_BUFFER, gSampleSet[footstepsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:footstep2.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[footstepsound+1], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[footstepsound+1], AL_BUFFER, gSampleSet[footstepsound+1]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:footstep3.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[footstepsound+2], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[footstepsound+2], AL_BUFFER, gSampleSet[footstepsound+2]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:footstep4.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[footstepsound+3], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[footstepsound+3], AL_BUFFER, gSampleSet[footstepsound+3]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:footstep5.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[footstepsound+4], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[footstepsound+4], AL_BUFFER, gSampleSet[footstepsound+4]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:bodyland.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[bodylandsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[bodylandsound], AL_BUFFER, gSampleSet[bodylandsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:headland.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[headlandsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[headlandsound], AL_BUFFER, gSampleSet[headlandsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:sniperrifle.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[riflesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[riflesound], AL_BUFFER, gSampleSet[riflesound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:BodyHit.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[bodyhitsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[bodyhitsound], AL_BUFFER, gSampleSet[bodyhitsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:WallHit.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[wallhitsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[wallhitsound], AL_BUFFER, gSampleSet[wallhitsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:machinegun.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[machinegunsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[machinegunsound], AL_BUFFER, gSampleSet[machinegunsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:Nearbullet.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[nearbulletsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[nearbulletsound], AL_BUFFER, gSampleSet[nearbulletsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:riflewhack.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[headwhacksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[headwhacksound], AL_BUFFER, gSampleSet[headwhacksound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:headshot.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[headshotsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[headshotsound], AL_BUFFER, gSampleSet[headshotsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:reload.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[reloadsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[reloadsound], AL_BUFFER, gSampleSet[reloadsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:click.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[clicksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[clicksound], AL_BUFFER, gSampleSet[clicksound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:SW.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[pistol1sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[pistol1sound], AL_BUFFER, gSampleSet[pistol1sound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:glock.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[pistol2sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[pistol2sound], AL_BUFFER, gSampleSet[pistol2sound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:pinpull.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[pinpullsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[pinpullsound], AL_BUFFER, gSampleSet[pinpullsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:pinreplace.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[pinreplacesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[pinreplacesound], AL_BUFFER, gSampleSet[pinreplacesound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:handlerelease.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[grenadethrowsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[grenadethrowsound], AL_BUFFER, gSampleSet[grenadethrowsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:bounce.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[bouncesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[bouncesound], AL_BUFFER, gSampleSet[bouncesound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:bounce2.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[bounce2sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[bounce2sound], AL_BUFFER, gSampleSet[bounce2sound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:explosion.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[explosionsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[explosionsound], AL_BUFFER, gSampleSet[explosionsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:headland.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[bodywhacksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[bodywhacksound], AL_BUFFER, gSampleSet[bodywhacksound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:rain.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[rainsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[rainsound], AL_BUFFER, gSampleSet[rainsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:Lose.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[losesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[losesound], AL_BUFFER, gSampleSet[losesound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:Disguisekill.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[disguisekillsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[disguisekillsound], AL_BUFFER, gSampleSet[disguisekillsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:knifeslash.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[knifeslashsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[knifeslashsound], AL_BUFFER, gSampleSet[knifeslashsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:shotgun.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[shotgunsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[shotgunsound], AL_BUFFER, gSampleSet[shotgunsound]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - if(musictoggle){ - alutLoadWAVFile((char *)":Data:Sounds:mainmenusong.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[mainmenusong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[mainmenusong], AL_BUFFER, gSampleSet[mainmenusong]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:shootsong.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[shootsong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[shootsong], AL_BUFFER, gSampleSet[shootsong]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:zombiesong.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[zombiesong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[zombiesong], AL_BUFFER, gSampleSet[zombiesong]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alutLoadWAVFile((char *)":Data:Sounds:knifesong.wav",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[knifesong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[knifesong], AL_BUFFER, gSampleSet[knifesong]); - - alutUnloadWAV(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - } -#else LoadOGG_CFH((char *)":Data:Sounds:underwater.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[visionsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[visionsound], AL_BUFFER, gSampleSet[visionsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:soulin.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[soulinsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[soulinsound], AL_BUFFER, gSampleSet[soulinsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:soulout.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[souloutsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[souloutsound], AL_BUFFER, gSampleSet[souloutsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:footstep1.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[footstepsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[footstepsound], AL_BUFFER, gSampleSet[footstepsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:footstep2.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[footstepsound+1], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[footstepsound+1], AL_BUFFER, gSampleSet[footstepsound+1]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:footstep3.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[footstepsound+2], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[footstepsound+2], AL_BUFFER, gSampleSet[footstepsound+2]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:footstep4.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[footstepsound+3], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[footstepsound+3], AL_BUFFER, gSampleSet[footstepsound+3]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:footstep5.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[footstepsound+4], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[footstepsound+4], AL_BUFFER, gSampleSet[footstepsound+4]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:bodyland.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[bodylandsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[bodylandsound], AL_BUFFER, gSampleSet[bodylandsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:headland.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[headlandsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[headlandsound], AL_BUFFER, gSampleSet[headlandsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:sniperrifle.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[riflesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[riflesound], AL_BUFFER, gSampleSet[riflesound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:BodyHit.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[bodyhitsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[bodyhitsound], AL_BUFFER, gSampleSet[bodyhitsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:WallHit.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[wallhitsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[wallhitsound], AL_BUFFER, gSampleSet[wallhitsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:machinegun.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[machinegunsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[machinegunsound], AL_BUFFER, gSampleSet[machinegunsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:Nearbullet.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[nearbulletsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[nearbulletsound], AL_BUFFER, gSampleSet[nearbulletsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:riflewhack.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[headwhacksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[headwhacksound], AL_BUFFER, gSampleSet[headwhacksound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:headshot.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[headshotsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[headshotsound], AL_BUFFER, gSampleSet[headshotsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:reload.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[reloadsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[reloadsound], AL_BUFFER, gSampleSet[reloadsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:click.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[clicksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[clicksound], AL_BUFFER, gSampleSet[clicksound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:SW.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[pistol1sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[pistol1sound], AL_BUFFER, gSampleSet[pistol1sound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:glock.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[pistol2sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[pistol2sound], AL_BUFFER, gSampleSet[pistol2sound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:pinpull.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[pinpullsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[pinpullsound], AL_BUFFER, gSampleSet[pinpullsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:pinreplace.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[pinreplacesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[pinreplacesound], AL_BUFFER, gSampleSet[pinreplacesound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:handlerelease.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[grenadethrowsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[grenadethrowsound], AL_BUFFER, gSampleSet[grenadethrowsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:bounce.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[bouncesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[bouncesound], AL_BUFFER, gSampleSet[bouncesound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:bounce2.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[bounce2sound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[bounce2sound], AL_BUFFER, gSampleSet[bounce2sound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:explosion.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[explosionsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[explosionsound], AL_BUFFER, gSampleSet[explosionsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:headland.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[bodywhacksound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[bodywhacksound], AL_BUFFER, gSampleSet[bodywhacksound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:rain.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[rainsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[rainsound], AL_BUFFER, gSampleSet[rainsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:Lose.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[losesound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[losesound], AL_BUFFER, gSampleSet[losesound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:Disguisekill.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[disguisekillsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[disguisekillsound], AL_BUFFER, gSampleSet[disguisekillsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:knifeslash.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[knifeslashsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[knifeslashsound], AL_BUFFER, gSampleSet[knifeslashsound]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - LoadOGG_CFH((char *)":Data:Sounds:shotgun.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - alBufferData(gSampleSet[shotgunsound], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - alSourcei(gSourceID[shotgunsound], AL_BUFFER, gSampleSet[shotgunsound]); - - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - if(musictoggle){ - - LoadOGG_CFH((char *)":Data:Sounds:mainmenusong.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[mainmenusong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[mainmenusong], AL_BUFFER, gSampleSet[mainmenusong]); - - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - LoadOGG_CFH((char *)":Data:Sounds:shootsong.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[shootsong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[shootsong], AL_BUFFER, gSampleSet[shootsong]); - - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - LoadOGG_CFH((char *)":Data:Sounds:zombiesong.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[zombiesong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[zombiesong], AL_BUFFER, gSampleSet[zombiesong]); - - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - LoadOGG_CFH((char *)":Data:Sounds:knifesong.ogg",&formatBuffer1, (void **) &pBuffer1,(unsigned int *)&lBuffer1Len,&freqBuffer1); - - alBufferData(gSampleSet[knifesong], formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); - - alSourcei(gSourceID[knifesong], AL_BUFFER, gSampleSet[knifesong]); - FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); + if (musictoggle) { + LoadOGG_CFH((char *) ":Data:Sounds:mainmenusong.ogg", + &formatBuffer1, (void **) &pBuffer1, + (unsigned int *) &lBuffer1Len, &freqBuffer1); + alBufferData(gSampleSet[mainmenusong], formatBuffer1, pBuffer1, + lBuffer1Len, freqBuffer1); + alSourcei(gSourceID[mainmenusong], AL_BUFFER, + gSampleSet[mainmenusong]); + FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); + + LoadOGG_CFH((char *) ":Data:Sounds:shootsong.ogg", + &formatBuffer1, (void **) &pBuffer1, + (unsigned int *) &lBuffer1Len, &freqBuffer1); + alBufferData(gSampleSet[shootsong], formatBuffer1, pBuffer1, + lBuffer1Len, freqBuffer1); + alSourcei(gSourceID[shootsong], AL_BUFFER, + gSampleSet[shootsong]); + FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); + + LoadOGG_CFH((char *) ":Data:Sounds:zombiesong.ogg", + &formatBuffer1, (void **) &pBuffer1, + (unsigned int *) &lBuffer1Len, &freqBuffer1); + alBufferData(gSampleSet[zombiesong], formatBuffer1, pBuffer1, + lBuffer1Len, freqBuffer1); + alSourcei(gSourceID[zombiesong], AL_BUFFER, + gSampleSet[zombiesong]); + FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); + + LoadOGG_CFH((char *) ":Data:Sounds:knifesong.ogg", + &formatBuffer1, (void **) &pBuffer1, + (unsigned int *) &lBuffer1Len, &freqBuffer1); + alBufferData(gSampleSet[knifesong], formatBuffer1, pBuffer1, + lBuffer1Len, freqBuffer1); + alSourcei(gSourceID[knifesong], AL_BUFFER, + gSampleSet[knifesong]); + FreeOGG(formatBuffer1, pBuffer1, lBuffer1Len, freqBuffer1); } -#endif - float gLoc[3]; - gLoc[0]=0; - gLoc[1]=0; - gLoc[2]=0; alSourcefv(gSourceID[visionsound], AL_POSITION, gLoc); - alSourcei(gSourceID[visionsound], AL_LOOPING, 1); - alSourcef(gSourceID[visionsound], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[soulinsound], AL_POSITION, gLoc); - alSourcei(gSourceID[soulinsound], AL_LOOPING, 0); - alSourcef(gSourceID[soulinsound], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[souloutsound], AL_POSITION, gLoc); - alSourcei(gSourceID[souloutsound], AL_LOOPING, 0); - alSourcef(gSourceID[souloutsound], AL_MIN_GAIN, 1); for(int i=0;i<5;i++){ - alSourcefv(gSourceID[footstepsound+i], AL_POSITION, gLoc); - alSourcei(gSourceID[footstepsound+i], AL_LOOPING, 0); - alSourcef(gSourceID[footstepsound+i], AL_MIN_GAIN, 0); - } alSourcefv(gSourceID[bodylandsound], AL_POSITION, gLoc); - alSourcei(gSourceID[bodylandsound], AL_LOOPING, 0); - alSourcef(gSourceID[bodylandsound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[headlandsound], AL_POSITION, gLoc); - alSourcei(gSourceID[headlandsound], AL_LOOPING, 0); - alSourcef(gSourceID[headlandsound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[riflesound], AL_POSITION, gLoc); - alSourcei(gSourceID[riflesound], AL_LOOPING, 0); - alSourcef(gSourceID[riflesound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[bodyhitsound], AL_POSITION, gLoc); - alSourcei(gSourceID[bodyhitsound], AL_LOOPING, 0); - alSourcef(gSourceID[bodyhitsound], AL_MIN_GAIN, .1); - alSourcefv(gSourceID[wallhitsound], AL_POSITION, gLoc); - alSourcei(gSourceID[wallhitsound], AL_LOOPING, 0); - alSourcef(gSourceID[wallhitsound], AL_MIN_GAIN, 0); - alSourcef(gSourceID[wallhitsound], AL_MAX_GAIN, .6); - alSourcefv(gSourceID[machinegunsound], AL_POSITION, gLoc); - alSourcei(gSourceID[machinegunsound], AL_LOOPING, 0); - alSourcef(gSourceID[machinegunsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[nearbulletsound], AL_POSITION, gLoc); - alSourcei(gSourceID[nearbulletsound], AL_LOOPING, 0); - alSourcef(gSourceID[nearbulletsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[headwhacksound], AL_POSITION, gLoc); - alSourcei(gSourceID[headwhacksound], AL_LOOPING, 0); - alSourcef(gSourceID[headwhacksound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[headshotsound], AL_POSITION, gLoc); - alSourcei(gSourceID[headshotsound], AL_LOOPING, 0); - alSourcef(gSourceID[headshotsound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[reloadsound], AL_POSITION, gLoc); - alSourcei(gSourceID[reloadsound], AL_LOOPING, 0); - alSourcef(gSourceID[reloadsound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[clicksound], AL_POSITION, gLoc); - alSourcei(gSourceID[clicksound], AL_LOOPING, 0); - alSourcef(gSourceID[clicksound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[pistol1sound], AL_POSITION, gLoc); - alSourcei(gSourceID[pistol1sound], AL_LOOPING, 0); - alSourcef(gSourceID[pistol1sound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[pistol2sound], AL_POSITION, gLoc); - alSourcei(gSourceID[pistol2sound], AL_LOOPING, 0); - alSourcef(gSourceID[pistol2sound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[pinpullsound], AL_POSITION, gLoc); - alSourcei(gSourceID[pinpullsound], AL_LOOPING, 0); - alSourcef(gSourceID[pinpullsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[pinreplacesound], AL_POSITION, gLoc); - alSourcei(gSourceID[pinreplacesound], AL_LOOPING, 0); - alSourcef(gSourceID[pinreplacesound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[grenadethrowsound], AL_POSITION, gLoc); - alSourcei(gSourceID[grenadethrowsound], AL_LOOPING, 0); - alSourcef(gSourceID[grenadethrowsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[bouncesound], AL_POSITION, gLoc); - alSourcei(gSourceID[bouncesound], AL_LOOPING, 0); - alSourcef(gSourceID[bouncesound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[bounce2sound], AL_POSITION, gLoc); - alSourcei(gSourceID[bounce2sound], AL_LOOPING, 0); - alSourcef(gSourceID[bounce2sound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[explosionsound], AL_POSITION, gLoc); - alSourcei(gSourceID[explosionsound], AL_LOOPING, 0); - alSourcef(gSourceID[explosionsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[bodywhacksound], AL_POSITION, gLoc); - alSourcei(gSourceID[bodywhacksound], AL_LOOPING, 0); - alSourcef(gSourceID[bodywhacksound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[rainsound], AL_POSITION, gLoc); - alSourcei(gSourceID[rainsound], AL_LOOPING, 1); - alSourcef(gSourceID[rainsound], AL_MIN_GAIN, .3); - alSourcefv(gSourceID[losesound], AL_POSITION, gLoc); - alSourcei(gSourceID[losesound], AL_LOOPING, 0); - alSourcef(gSourceID[losesound], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[disguisekillsound], AL_POSITION, gLoc); - alSourcei(gSourceID[disguisekillsound], AL_LOOPING, 0); - alSourcef(gSourceID[disguisekillsound], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[knifeslashsound], AL_POSITION, gLoc); - alSourcei(gSourceID[knifeslashsound], AL_LOOPING, 0); - alSourcef(gSourceID[knifeslashsound], AL_MIN_GAIN,0); - alSourcefv(gSourceID[shotgunsound], AL_POSITION, gLoc); - alSourcei(gSourceID[shotgunsound], AL_LOOPING, 0); - alSourcef(gSourceID[shotgunsound], AL_MIN_GAIN, 0); - alSourcefv(gSourceID[knifesong], AL_POSITION, gLoc); - alSourcei(gSourceID[knifesong], AL_LOOPING, 1); - alSourcef(gSourceID[knifesong], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[mainmenusong], AL_POSITION, gLoc); - alSourcei(gSourceID[mainmenusong], AL_LOOPING, 1); - alSourcef(gSourceID[mainmenusong], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[zombiesong], AL_POSITION, gLoc); - alSourcei(gSourceID[zombiesong], AL_LOOPING, 1); - alSourcef(gSourceID[zombiesong], AL_MIN_GAIN, 1); - alSourcefv(gSourceID[shootsong], AL_POSITION, gLoc); - alSourcei(gSourceID[shootsong], AL_LOOPING, 1); - alSourcef(gSourceID[shootsong], AL_MIN_GAIN, 1); - } void Game::LoadingScreen(float percent) - { glLoadIdentity(); //Clear to black glClearColor(0,0,0,1); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Background glDisable(GL_TEXTURE_2D); - glDisable(GL_DEPTH_TEST); // Disables Depth Testing - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glDepthMask(0); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPushMatrix(); // Store The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPushMatrix(); // Store The Modelview Matrix for(int i=19;i>=0;i--){ - glLoadIdentity(); // Reset The Modelview Matrix - glTranslatef(120-i*1,190-i*1,0); - glScalef(400+i*2,30+i*2,1); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - if(i)glColor4f(1-(float)i/20-percent/100,1-(float)i/20-percent/100,1-(float)i/20-percent/100,1); - if(!i)glColor4f(0,0,0,1); - glBegin(GL_QUADS); - glVertex3f(0, 0, 0.0f); - glVertex3f(1, 0, 0.0f); - glVertex3f(1, 1, 0.0f); - glVertex3f(0, 1, 0.0f); - glEnd(); - } glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glDisable(GL_BLEND); - glDepthMask(1); //Progress - glDisable(GL_DEPTH_TEST); // Disables Depth Testing - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glDisable(GL_TEXTURE_2D); - glDepthMask(0); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPushMatrix(); // Store The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPushMatrix(); // Store The Modelview Matrix for(int i=19;i>=0;i--){ @@ -1055,13 +439,9 @@ void Game::LoadingScreen(float percent) sprintf (string, "LOADING..."); text.glPrint(280,195,string,1,1,640,480); SDL_GL_SwapBuffers( ); - } -void LoadPersonSpriteTexture(char *fileName, GLuint *textureid); - void LoadPersonSpriteTexture(char *fileName, GLuint *textureid) - { *textureid = loadTexture(fileName); glBindTexture(GL_TEXTURE_2D, *textureid); @@ -1069,45 +449,29 @@ void LoadPersonSpriteTexture(char *fileName, GLuint *textureid) } void Game::InitGame() - { - //Setup loading screen - float loadingscreenamount=0; - float loadingscreenamounttotal=200; - if(initialized)loadingscreenamounttotal=20; - if(!initialized)LoadingScreen(loadingscreenamount/loadingscreenamounttotal*100); //Set up rain and snow - precipitationhorz=60; - precipitationvert=40; - precipitationdensity=25; //Bodyguard stats - person[0].playercoords=camera.position; - person[0].oldplayercoords=person[0].playercoords; - person[0].type=playertype; - person[0].existing=1; for(int i=0;i<10;i++){ - person[0].reloads[i]=0; - } //Level setup - killedinnocent=0; //Haven't shot any civilians yet... if(customlevels){ //Load custom levels @@ -1223,339 +587,184 @@ void Game::InitGame() if(!customlevels){ //Setup hardcoded default levels if(mission==0){ - environment=sunny_environment; - type=randomshoot_type; - possiblegun[0]=handgun1; - possiblegun[1]=handgun2; - possiblegun[2]=shotgun; - numpossibleguns=3; - evilprobability=6; - person[0].whichgun=assaultrifle; - person[0].reloads[person[0].whichgun]=6; - if(!gameinprogress)score=0; - timeremaining=50; - difficulty=.6; - } if(mission==1){ - environment=snowy_environment; - type=randomshoot_type; - possiblegun[0]=knife; - possiblegun[1]=assaultrifle; - numpossibleguns=2; - evilprobability=5; - person[0].whichgun=handgun2; - person[0].reloads[person[0].whichgun]=3; - if(!gameinprogress)score=0; - timeremaining=40; - difficulty=.6; - } if(mission==2){ - environment=foggy_environment; - type=randomshoot_type; - possiblegun[0]=sniperrifle; - numpossibleguns=1; - evilprobability=5; - person[0].whichgun=sniperrifle; - person[0].reloads[person[0].whichgun]=4; - if(!gameinprogress)score=0; - timeremaining=50; - difficulty=0.9; - } if(mission==3){ - environment=firey_environment; - type=zombie_type; - numpossibleguns=0; - evilprobability=5; - person[0].whichgun=shotgun; - person[0].reloads[person[0].whichgun]=5; - if(!gameinprogress)score=0; - timeremaining=35; - difficulty=.7; - } if(mission==4){ - environment=snowy_environment; - type=randomshoot_type; - possiblegun[0]=sniperrifle; - possiblegun[1]=assaultrifle; - numpossibleguns=2; - evilprobability=5; - person[0].whichgun=grenade; - person[0].reloads[person[0].whichgun]=20; - if(!gameinprogress)score=0; - timeremaining=30; - difficulty=.5; - } if(mission==5){ - environment=rainy_environment; - type=randomshoot_type; - possiblegun[0]=handgun1; - possiblegun[1]=shotgun; - possiblegun[2]=assaultrifle; - numpossibleguns=3; - evilprobability=6; - person[0].whichgun=knife; - person[0].reloads[person[0].whichgun]=3; - if(!gameinprogress)score=0; - timeremaining=40; - difficulty=.8; - } if(mission==6){ - environment=night_environment; - type=randomshoot_type; - possiblegun[1]=handgun1; - possiblegun[2]=handgun2; - possiblegun[3]=shotgun; - numpossibleguns=3; - evilprobability=5; - person[0].whichgun=handgun1; - person[0].reloads[person[0].whichgun]=4; - if(!gameinprogress)score=0; - timeremaining=30; - difficulty=1; - } if(mission==7){ - environment=firey_environment; - type=zombie_type; - person[0].whichgun=assaultrifle; - person[0].reloads[person[0].whichgun]=5; - if(!gameinprogress)score=0; - timeremaining=30; - difficulty=1; - } if(mission==8){ - environment=rainy_environment; - type=randomshoot_type; - possiblegun[0]=handgun1; - possiblegun[1]=handgun2; - possiblegun[2]=shotgun; - possiblegun[3]=sniperrifle; - possiblegun[4]=assaultrifle; - numpossibleguns=5; - evilprobability=5; - person[0].whichgun=nogun; - person[0].reloads[person[0].whichgun]=3; - if(!gameinprogress)score=0; - timeremaining=40; - difficulty=.8; - } if(mission==9){ - environment=snowy_environment; - type=randomshoot_type; - possiblegun[0]=knife; - possiblegun[1]=handgun1; - possiblegun[2]=handgun2; - possiblegun[3]=shotgun; - possiblegun[4]=sniperrifle; - possiblegun[5]=assaultrifle; - numpossibleguns=6; - evilprobability=4; - person[0].whichgun=handgun1; - person[0].reloads[person[0].whichgun]=3; - if(!gameinprogress)score=0; - timeremaining=90; - difficulty=1; - } if(mission==10){ - environment=night_environment; - type=randomshoot_type; - possiblegun[0]=sniperrifle; - numpossibleguns=1; - evilprobability=5; - person[0].whichgun=sniperrifle; - person[0].reloads[person[0].whichgun]=4; - if(!gameinprogress)score=0; - timeremaining=30; - difficulty=1.3; - } if(mission==11){ - environment=sunny_environment; - type=randomshoot_type; - possiblegun[0]=knife; - possiblegun[1]=sniperrifle; - numpossibleguns=2; - evilprobability=4; - person[0].whichgun=knife; - if(!gameinprogress)score=0; - timeremaining=30; - difficulty=1.5; - } if(mission==12){ - environment=firey_environment; - type=zombie_type; - possiblegun[0]=knife; - possiblegun[1]=sniperrifle; - person[0].whichgun=handgun2; - person[0].reloads[person[0].whichgun]=10; - if(!gameinprogress)score=0; - timeremaining=60; - difficulty=1.5; - } nummissions=13; @@ -1563,113 +772,72 @@ void Game::InitGame() } //Setup fast radian to degree conversion - rad2deg= 56.54866776; - visions=0; //Setup bounding cylinder model - float boundingscale=3; if(!initialized){ - boundingpoints[0]=0; - boundingpoints[0].z=boundingscale; - boundingpoints[0].y=0; for(int i=1;i<8;i++){ - boundingpoints[i]=DoRotation(boundingpoints[0],0,i*360/7,0); - } - } civkills=0; - badkills=0; - goodkills=0; - enemystate=2; if(!initialized){ - if(!azertykeyboard){ - forwardskey=MAC_W_KEY; - backwardskey=MAC_S_KEY; - leftkey=MAC_A_KEY; - rightkey=MAC_D_KEY; - aimkey=MAC_Q_KEY; - psychicaimkey=MAC_E_KEY; - psychickey=MAC_Z_KEY; - } if(azertykeyboard){ - forwardskey=MAC_Z_KEY; - backwardskey=MAC_S_KEY; - leftkey=MAC_Q_KEY; - rightkey=MAC_D_KEY; - aimkey=MAC_A_KEY; - psychicaimkey=MAC_E_KEY; - psychickey=MAC_W_KEY; - } soundscalefactor=soundscalefactordefault; //Setup sound falloff - gQuit=false; //Sounds - LoadSounds(musictoggle); //Play correct song - if(environment==rainy_environment)alSourcePlay(gSourceID[rainsound]); - if(environment!=rainy_environment)alSourcePause(gSourceID[rainsound]); alSourceStop(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 0); whichsong=mainmenusong; - alSourceStop(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_PITCH, 1); - alSourcePlay(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 1); } loadingscreenamount+=5; - if(!initialized)LoadingScreen(loadingscreenamount/loadingscreenamounttotal*100); //Setup random seed @@ -1696,91 +864,57 @@ void Game::InitGame() person[0].speedmult=1.3; //Add vip - person[numpeople].playerrotation=0; - person[numpeople].whichcostume=vipcostume; - person[numpeople].whichblockx=((person[0].playercoords.x+block_spacing/2)/block_spacing); - person[numpeople].whichblocky=((person[0].playercoords.x+block_spacing/2)/block_spacing); - person[numpeople].pathnum=-1; - person[numpeople].oldpathnum=-1; - person[numpeople].oldoldpathnum=-1; - person[numpeople].oldoldoldpathnum=-1; while(person[numpeople].pathnum<0||person[numpeople].pathnum>=path.vertexNum||person[numpeople].pathnum==1){ - person[numpeople].pathnum=Random()%path.vertexNum; - } person[numpeople].pathtarget.x=path.vertex[person[numpeople].pathnum].x; - person[numpeople].pathtarget.z=path.vertex[person[numpeople].pathnum].z; - person[numpeople].pathsize=.98+float(abs(Random()%20))/400; - person[numpeople].pathtarget*=person[numpeople].pathsize; - person[numpeople].pathtarget.x+=person[numpeople].whichblockx*block_spacing; - person[numpeople].pathtarget.z+=person[numpeople].whichblocky*block_spacing; - person[numpeople].playercoords=person[numpeople].pathtarget; - person[numpeople].oldplayercoords=person[numpeople].playercoords; person[0].playercoords=person[numpeople].playercoords; - person[0].playercoords.x+=1; - person[0].playercoords.z+=1; - person[0].oldplayercoords=person[0].playercoords; person[numpeople].skeleton.free=0; - person[numpeople].targetanimation=walkanim; - person[numpeople].speed=1; - person[numpeople].existing=0; - person[numpeople].speedmult=1; - if(type==zombie_type)person[numpeople].speedmult=.8; person[numpeople].health=100; - person[numpeople].playerrotation2=0;//20; - person[numpeople].lastdistancevictim=200000; if(person[numpeople].skeleton.broken)person[numpeople].skeleton.Load((char *)":Data:Skeleton:Basic Figure"); person[numpeople].type=viptype; - person[numpeople].whichgun=nogun; person[numpeople].aiming=0; person[numpeople].killtarget=-1; - person[numpeople].existing=1; citypeoplenum[person[numpeople].whichblockx][person[numpeople].whichblocky]++; - numpeople++; - spawndelay=.1; XYZ vipdistance; - vipdistance=0; - vipdistance.x=10000000; - vipgoal=person[1].playercoords+DoRotation(vipdistance,0,Random()%360,0); //Setup block models diff --git a/src/Person.h b/src/Person.h index d831e1f..aa3a53e 100644 --- a/src/Person.h +++ b/src/Person.h @@ -5,7 +5,6 @@ #include <cmath> #include <GL/gl.h> #include <AL/al.h> -#include <AL/alut.h> #include "Quaternions.h" #include "Constants.h" diff --git a/src/SConstruct b/src/SConstruct deleted file mode 100644 index f764f34..0000000 --- a/src/SConstruct +++ /dev/null @@ -1,10 +0,0 @@ -Program( - 'blackshades', - Split('Camera.cpp Decals.cpp Fog.cpp Frustum.cpp GameDraw.cpp GameInitDispose.cpp GameLoop.cpp GameTick.cpp ' + - 'Globals.cpp MacInput.cpp Main.cpp Maths.cpp Models.cpp Person.cpp Quaternions.cpp Serialize.cpp Skeleton.cpp ' + - 'Sprites.cpp Support.cpp Text.cpp Timer.cpp Textures.cpp'), - CPPDEFS=['GNUSOURCE=1'], - CPPPATH=['.'], - CPPFLAGS=['-O2', '-Wall' ,'-g'], - LIBS=['GL', 'GLU', 'openal', 'alut', 'SDL', 'SDL_image', 'vorbisfile', 'vorbis'] -) diff --git a/src/Skeleton.h b/src/Skeleton.h index 78d9d3d..b408b3c 100644 --- a/src/Skeleton.h +++ b/src/Skeleton.h @@ -4,7 +4,6 @@ /**> HEADER FILES <**/ #include <GL/gl.h> #include <AL/al.h> -#include <AL/alut.h> #include "Quaternions.h" #include "Constants.h" diff --git a/src/Support.cpp b/src/Support.cpp index 083de12..b88d3b1 100644 --- a/src/Support.cpp +++ b/src/Support.cpp @@ -6,7 +6,8 @@ #include <fcntl.h> #include <unistd.h> -#include "SDL/SDL.h" +#include <SDL/SDL.h> +#include <vorbis/vorbisfile.h> #include "Support.h" #include "Files.h" @@ -243,33 +244,6 @@ void Files::EndLoad() sFile = -1; } -#ifdef NOOGG -/* - Our own special magic version that fixes the filename. - */ -void alutLoadWAVFile_CFH(char *filename, ALenum *format, void **wave, - unsigned int *size, ALsizei *freq) -{ - char filename1[MAX_PATH]; - ALsizei format1, size1, bits1, freq1; - - fix_filename(filename, filename1); - - alutLoadWAV(filename1, wave, &format1, &size1, &bits1, &freq1); - - *format = format1; - *size = size1; - *freq = freq1; -} - -void alutUnloadWAV_CFH(ALenum format, void *wave, unsigned int size, - ALsizei freq) -{ - free(wave); -} -#else -#include <vorbis/vorbisfile.h> - /* Read the requested OGG file into memory, and extract the information required by OpenAL @@ -383,4 +357,3 @@ void FreeOGG(ALenum format, void *wave, unsigned int size, { free(wave); } -#endif diff --git a/src/Support.h b/src/Support.h index 99e264e..633a51a 100644 --- a/src/Support.h +++ b/src/Support.h @@ -5,7 +5,6 @@ #include <unistd.h> #include <AL/al.h> -#include <AL/alut.h> #define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid()) @@ -40,19 +39,10 @@ void GetMouse(Point *p); void GetMouseRel(Point *p); void GetKeys(unsigned long *keys); int Button(void); -#ifdef NOOGG -void alutLoadWAVFile_CFH(char *filename, ALenum *format, void **wave, - unsigned int *size, ALsizei *freq); -void alutUnloadWAV_CFH(ALenum format, void *wave, unsigned int size, - ALsizei freq); -#define alutLoadWAVFile alutLoadWAVFile_CFH -#define alutUnloadWAV alutUnloadWAV_CFH -#else void LoadOGG_CFH(char *filename, ALenum *format, void **wave, unsigned int *size, ALsizei *freq); void FreeOGG(ALenum format, void *wave, unsigned int size, ALsizei freq); -#endif FILE *cfh_fopen(const char *filename, const char *mode); |