From: <wha...@us...> - 2011-06-08 17:44:00
|
Revision: 7376 http://planeshift.svn.sourceforge.net/planeshift/?rev=7376&view=rev Author: whacko88 Date: 2011-06-08 17:43:52 +0000 (Wed, 08 Jun 2011) Log Message: ----------- Lots of minor style changes, fixed compilation after Jam build Modified Paths: -------------- soc/2011/sound/include/isoundctrl.h soc/2011/sound/include/isoundmngr.h soc/2011/sound/src/plugins/common/soundmanager/data.cpp soc/2011/sound/src/plugins/common/soundmanager/data.h soc/2011/sound/src/plugins/common/soundmanager/handle.cpp soc/2011/sound/src/plugins/common/soundmanager/handle.h soc/2011/sound/src/plugins/common/soundmanager/manager.cpp soc/2011/sound/src/plugins/common/soundmanager/manager.h soc/2011/sound/src/plugins/common/soundmanager/psemitter.cpp soc/2011/sound/src/plugins/common/soundmanager/psemitter.h soc/2011/sound/src/plugins/common/soundmanager/psentity.cpp soc/2011/sound/src/plugins/common/soundmanager/psentity.h soc/2011/sound/src/plugins/common/soundmanager/psmusic.cpp soc/2011/sound/src/plugins/common/soundmanager/psmusic.h soc/2011/sound/src/plugins/common/soundmanager/pssound.h soc/2011/sound/src/plugins/common/soundmanager/pssoundsector.cpp soc/2011/sound/src/plugins/common/soundmanager/pssoundsector.h soc/2011/sound/src/plugins/common/soundmanager/queue.cpp soc/2011/sound/src/plugins/common/soundmanager/queue.h soc/2011/sound/src/plugins/common/soundmanager/soundctrl.cpp soc/2011/sound/src/plugins/common/soundmanager/soundmanager.cpp soc/2011/sound/src/plugins/common/soundmanager/soundmanager.h soc/2011/sound/src/plugins/common/soundmanager/system.cpp soc/2011/sound/src/plugins/common/soundmanager/system.h Modified: soc/2011/sound/include/isoundctrl.h =================================================================== --- soc/2011/sound/include/isoundctrl.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/include/isoundctrl.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -21,7 +21,7 @@ #define __ISOUNDCONTROL_H__ -enum SNDCTRL_TYPE +enum SndCtrl_Type { SNDCTRL_TYPE_NORMAL = 0, SNDCTRL_TYPE_AMBIENT = 1, Modified: soc/2011/sound/include/isoundmngr.h =================================================================== --- soc/2011/sound/include/isoundmngr.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/include/isoundmngr.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -42,7 +42,7 @@ struct iView; class csVector3; -enum SNDCTRL_IDENTIFIER +enum SndCtrl_ID { AMBIENT_SNDCTRL = 0, MUSIC_SNDCTRL = 1, @@ -52,7 +52,7 @@ GUI_SNDCTRL = 5 }; -enum QUEUE_IDENTIFIER +enum Queue_ID { VOICE_QUEUE = 0 }; Modified: soc/2011/sound/src/plugins/common/soundmanager/data.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/data.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/data.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -26,7 +26,7 @@ #include <csutil/xmltiny.h> -SoundFile::SoundFile (const char *newname, const char *newfilename) +SoundFile::SoundFile(const char* newname, const char* newfilename) { name = csString(newname); filename = csString(newfilename); @@ -35,7 +35,7 @@ lasttouch = csGetTicks(); } -SoundFile::SoundFile (SoundFile* const ©that) +SoundFile::SoundFile(SoundFile* const ©that) { name = csString(copythat->name); filename = csString(copythat->filename); @@ -44,7 +44,7 @@ lasttouch = csGetTicks(); } -SoundFile::~SoundFile () +SoundFile::~SoundFile() { } @@ -53,17 +53,17 @@ * simple interface */ -SoundData::SoundData () +SoundData::SoundData() { } -SoundData::~SoundData () +SoundData::~SoundData() { csArray<SoundFile*> allsoundfiles; allsoundfiles = soundfiles.GetAll(); - for (size_t i = 0; i < allsoundfiles.GetSize(); i++) + for(size_t i = 0; i < allsoundfiles.GetSize(); i++) { delete allsoundfiles[i]; } @@ -80,14 +80,14 @@ bool SoundData::Initialize(iObjectRegistry* objectReg) { - if (!(sndloader = csQueryRegistry<iSndSysLoader> (objectReg))) + if(!(sndloader = csQueryRegistry<iSndSysLoader>(objectReg))) { Error1("Failed to locate Sound loader!"); return false; } - if (!(vfs = csQueryRegistry<iVFS> (objectReg))) + if(!(vfs = csQueryRegistry<iVFS>(objectReg))) { Error1("psSndSourceMngr: Could not initialize. Cannot find iVFS"); return false; @@ -101,12 +101,12 @@ * it checks if we have the resource and loads it if its not already loaded */ -bool SoundData::LoadSoundFile (const char *name, csRef<iSndSysData> &snddata) +bool SoundData::LoadSoundFile(const char* name, csRef<iSndSysData> &snddata) { - SoundFile *snd; + SoundFile* snd; csRef<iDataBuffer> soundbuf; - if ((snd = GetSound(name)) != NULL) + if((snd = GetSound(name)) != NULL) { /* Sound exists in "known or loaded state * get the sound with GetSound @@ -114,7 +114,7 @@ * return true if it is * if not load it and mark it loaded */ - if (snd->loaded == true) + if(snd->loaded == true) { snddata = snd->snddata; return true; @@ -123,19 +123,19 @@ else { // maybe this is a dynamic file create a handle and push it into our array - snd = new SoundFile (name, name); + snd = new SoundFile(name, name); PutSound(snd); } /* load the sounddata into a buffer */ - if (!(soundbuf = vfs->ReadFile (snd->filename))) + if(!(soundbuf = vfs->ReadFile(snd->filename))) { Error2("Can't load file '%s'!", name); /* FIXME */ return false; } /* extract sound from data */ - if (!(snddata = sndloader->LoadSound (soundbuf))) + if(!(snddata = sndloader->LoadSound(soundbuf))) { Error2("Can't load sound '%s'!", name); return false; @@ -151,7 +151,7 @@ * it DOES it. It doesnt care if its still used or not! */ -void SoundData::UnloadSoundFile (const char *name) +void SoundData::UnloadSoundFile(const char* name) { // do *not* use GetSound here as it potentially creates // a new sound, why would we want to create a new one @@ -170,17 +170,17 @@ * NULL if it doesnt */ -SoundFile *SoundData::GetSound (const char *name) +SoundFile* SoundData::GetSound(const char* name) { - SoundFile *sound; + SoundFile* sound; sound = soundfiles.Get(csHashCompute(name), NULL); // sound is null when theres no cached SoundFile - if (sound == NULL) + if(sound == NULL) { // we go search the library .. maybe it has it - if (libsoundfiles.Contains(csHashCompute(name))) + if(libsoundfiles.Contains(csHashCompute(name))) { // SoundFile is in our library, copy it sound = new SoundFile(libsoundfiles.Get(csHashCompute(name), NULL)); @@ -198,13 +198,13 @@ return sound; } -void SoundData::PutSound (SoundFile* &sound) +void SoundData::PutSound(SoundFile* &sound) { // i know theres PutUnique but i have a bad feeling about overwriting soundfiles.Put(csHashCompute((const char*) sound->name), sound); } -void SoundData::DeleteSound (SoundFile* &sound) +void SoundData::DeleteSound(SoundFile* &sound) { // do *not* delete all, but only the *specific* one as we don't check // for an existing key upon putting by maybe deleting a duplicate @@ -213,23 +213,23 @@ delete sound; } -void SoundData::Update () +void SoundData::Update() { csTicks now; csArray<SoundFile*> allsoundfiles; - SoundFile *sound; + SoundFile* sound; // FIXME csticks now = csGetTicks(); allsoundfiles = soundfiles.GetAll(); - for (size_t i = 0; i < allsoundfiles.GetSize(); i++) + for(size_t i = 0; i < allsoundfiles.GetSize(); i++) { sound = allsoundfiles[i]; - if ((sound->lasttouch + SOUNDFILE_CACHETIME) <= now - && sound->loaded == true - && sound->snddata->GetRefCount() == 1) + if((sound->lasttouch + SOUNDFILE_CACHETIME) <= now + && sound->loaded == true + && sound->snddata->GetRefCount() == 1) { // UnloadSoundFile takes "names" as arguments and works on our hash UnloadSoundFile(sound->name); @@ -253,7 +253,7 @@ * */ -bool SoundData::LoadSoundLib (const char* filename, iObjectRegistry* objectReg) +bool SoundData::LoadSoundLib(const char* filename, iObjectRegistry* objectReg) { csRef<iDocumentSystem> xml; /* try get existing Document System or create one*/ csRef<iDataBuffer> buff; /* buffer for reading the xml */ @@ -263,14 +263,14 @@ csRef<iDocumentNode> topNode; /* topnode to work with */ csRef<iDocumentNodeIterator> iter; /* node iterator */ csRef<iDocumentNode> node; /* yet another node .... */ - SoundFile *snd; ///< soundfile + SoundFile* snd; ///< soundfile - if (!(xml = csQueryRegistry<iDocumentSystem> (objectReg))) - xml = csPtr<iDocumentSystem> (new csTinyDocumentSystem); + if(!(xml = csQueryRegistry<iDocumentSystem>(objectReg))) + xml = csPtr<iDocumentSystem>(new csTinyDocumentSystem); buff = vfs->ReadFile(filename); - if ( !buff || !buff->GetSize()) + if(!buff || !buff->GetSize()) { return false; } @@ -278,21 +278,21 @@ doc = xml->CreateDocument(); error = doc->Parse(buff); - if (error) + if(error) { Error3("Parsing file %s gave error %s", filename, error); return false; } - if( !(root = doc->GetRoot())) + if(!(root = doc->GetRoot())) { Error1("No XML root in soundlib.xml"); return false; } - if( !(topNode = root->GetNode("Sounds"))) + if(!(topNode = root->GetNode("Sounds"))) { Error1("No <sounds> tag in soundlib.xml"); return false; @@ -300,14 +300,14 @@ iter = topNode->GetNodes(); - while (iter->HasNext()) + while(iter->HasNext()) { node = iter->Next(); - if (node->GetType() != CS_NODE_ELEMENT) + if(node->GetType() != CS_NODE_ELEMENT) continue; - if (strcmp(node->GetValue(), "Sound") == 0) + if(strcmp(node->GetValue(), "Sound") == 0) { snd = new SoundFile(node->GetAttributeValue("name"), node->GetAttributeValue("file")); @@ -318,13 +318,13 @@ return true; } -void SoundData::UnloadSoundLib () +void SoundData::UnloadSoundLib() { csArray<SoundFile*> allsoundfiles; allsoundfiles = libsoundfiles.GetAll(); - for (size_t i = 0; i < allsoundfiles.GetSize(); i++) + for(size_t i = 0; i < allsoundfiles.GetSize(); i++) { delete allsoundfiles[i]; } Modified: soc/2011/sound/src/plugins/common/soundmanager/data.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/data.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/data.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -92,6 +92,9 @@ // FIXME i should be an option ;) #define SOUNDFILE_CACHETIME 300000 ///<- number of milliseconds a file remains cached +//==================================================================================== +// Crystal Space Includes +//==================================================================================== #include <cssysdef.h> #include <iutil/objreg.h> #include <csutil/csstring.h> @@ -108,7 +111,7 @@ class SoundFile { - public: +public: csString name; ///< name of this file/resource MUST be unique csString filename; ///< filename in our vfs (maybe not unique) csRef<iSndSysData> snddata; ///< data in suitable format @@ -120,12 +123,12 @@ * @param newname name of this SoundFile (must be unique) * @param newfilename filename this SoundFile is using */ - SoundFile(const char *newname, const char *newfilename); + SoundFile(const char* newname, const char* newfilename); /** * Copy Constructor. * Copys the whole SoundFile. */ - SoundFile (SoundFile* const ©that); + SoundFile(SoundFile* const ©that); /** * Destructor. */ @@ -140,20 +143,19 @@ class SoundData { - public: +public: /** * Constructor .. empty. * Initialization is done via Initialize because its not guaranteed * that its successful. */ - SoundData (); + SoundData(); /** * Deconstructor. * Unloads everything and destroys all SoundFile object. */ - ~SoundData (); - + ~SoundData(); /** * Initializes Loader and VFS. * Will return true on success and false if not. @@ -167,54 +169,53 @@ * @param filename filename to load * @param objectReg ps objectreg because we need iDocumentSystem */ - bool LoadSoundLib (const char* filename, iObjectRegistry* objectReg); + bool LoadSoundLib(const char* filename, iObjectRegistry* objectReg); /** * Unloads everything LoadSoundLib created. * Will purge the hash and delete all reference SoundFile objects. */ - void UnloadSoundLib (); - + void UnloadSoundLib(); /** * Loads a soundfile out of the vfs. * The file given by name will be loaded into a iSndSysData object. * @param name filename to load * @param snddata iSndSysData object to write the data into */ - bool LoadSoundFile (const char *name, csRef<iSndSysData> &snddata); + bool LoadSoundFile(const char* name, csRef<iSndSysData> &snddata); /** * Unloads a soundfile and deletes its snddata object. * The Soundfile given by name will be unloaded. Be careful with this one! * It doesnt check if its still in use. * @param name SoundFile by name */ - void UnloadSoundFile (const char *name); + void UnloadSoundFile(const char* name); /** * Checks usage of all SoundFile objects and unloads them if appropriate. * Each SoundFile has a Timestamp and a Refcount that help to determine * if it can be freed. Unload happens if its Cachetime is expired if its * RefCount is 1. RefCount 1 means were the one that holds it. */ - void Update (); + void Update(); - private: +private: csRef<iSndSysLoader> sndloader; ///< Crystalspace soundloader - csHash<SoundFile *> soundfiles; ///< Hash of loaded SoundFiles - csHash<SoundFile *> libsoundfiles; ///< Hash of Resources soundlib.xml provides - csRef<iVFS> vfs; ///< vfs where were reading from + csHash<SoundFile*> soundfiles; ///< Hash of loaded SoundFiles + csHash<SoundFile*> libsoundfiles; ///< Hash of Resources soundlib.xml provides + csRef<iVFS> vfs; ///< vfs where were reading from /** * Fetches a SoundFile object out of our cache. * @param name Name of the SoundFile we are searching. */ - SoundFile *GetSound (const char *name); + SoundFile* GetSound(const char* name); /** * Adds a SoundFile object to our cache. */ - void PutSound (SoundFile* &sound); + void PutSound(SoundFile* &sound); /** * Delete a SoundFile and deletes it from our hash. */ - void DeleteSound (SoundFile* &sound); + void DeleteSound(SoundFile* &sound); }; #endif /*_SOUND_DATA_H_*/ Modified: soc/2011/sound/src/plugins/common/soundmanager/handle.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/handle.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/handle.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -34,7 +34,7 @@ * volumes, fading parameters */ -SoundHandle::SoundHandle (SoundSystemManager* manager) +SoundHandle::SoundHandle(SoundSystemManager* manager) { fade = 0; fade_stop = false; @@ -45,9 +45,9 @@ this->manager = manager; } -SoundHandle::~SoundHandle () +SoundHandle::~SoundHandle() { - if (hasCallback == true) + if(hasCallback == true) { Callback(); } @@ -57,12 +57,12 @@ * sources get removed even if you dont do RemoveSource * but it will not dereference them! .. */ - if (sndstream != NULL) + if(sndstream != NULL) { manager->GetSoundSystem()->RemoveStream(sndstream); } - if (sndsource != NULL) + if(sndsource != NULL) { manager->GetSoundSystem()->RemoveSource(sndsource); } @@ -79,17 +79,17 @@ * Thats done within the Play*D functions before the sounds are unpaused */ -bool SoundHandle::Init (const char *resname, bool loop, float volume_preset, - int type, SoundControl* &ctrl) +bool SoundHandle::Init(const char* resname, bool loop, float volume_preset, + int type, SoundControl* &ctrl) { csRef<iSndSysData> snddata; - if (!manager->GetSoundData()->LoadSoundFile(resname, snddata)) + if(!manager->GetSoundData()->LoadSoundFile(resname, snddata)) { return false; } - if (!manager->GetSoundSystem()->CreateStream(snddata, loop, type, sndstream)) + if(!manager->GetSoundSystem()->CreateStream(snddata, loop, type, sndstream)) { manager->GetSoundData()->UnloadSoundFile(resname); return false; @@ -116,11 +116,11 @@ */ -void SoundHandle::Fade (float volume, int time, int direction) +void SoundHandle::Fade(float volume, int time, int direction) { volume = volume*sndCtrl->GetVolume(); - if (direction == FADE_UP) + if(direction == FADE_UP) { fade = (0 + (time / 100)); } @@ -131,7 +131,7 @@ fade_volume = (volume / (time / 100)); - if (direction == FADE_STOP) + if(direction == FADE_STOP) { fade_stop = true; } @@ -146,26 +146,26 @@ * adds a 3D Source and a Directional 3D Source if theres a rad bigger 0 */ -void SoundHandle::ConvertTo3D (float mindist, float maxdist, csVector3 pos, +void SoundHandle::ConvertTo3D(float mindist, float maxdist, csVector3 pos, csVector3 dir, float rad) { - manager->GetSoundSystem()->Create3dSource (sndsource, sndsource3d, mindist, maxdist, + manager->GetSoundSystem()->Create3dSource(sndsource, sndsource3d, mindist, maxdist, pos); /* create a directional source if rad > 0 */ - if (rad > 0) + if(rad > 0) { - manager->GetSoundSystem()->CreateDirectional3dSource (sndsource3d, sndsourcedir, + manager->GetSoundSystem()->CreateDirectional3dSource(sndsource3d, sndsourcedir, dir, rad); } } -void SoundHandle::SetAutoRemove (bool toggle) +void SoundHandle::SetAutoRemove(bool toggle) { autoremove = toggle; } -bool SoundHandle::GetAutoRemove () +bool SoundHandle::GetAutoRemove() { return autoremove; } @@ -177,9 +177,9 @@ hasCallback = true; } -void SoundHandle::Callback () +void SoundHandle::Callback() { - if (hasCallback == true) + if(hasCallback == true) { callbackfunction(callbackobject); } Modified: soc/2011/sound/src/plugins/common/soundmanager/handle.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/handle.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/handle.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -41,7 +41,7 @@ { public: csString name; ///< name of the resource or the file - not unique - SoundControl *sndCtrl; ///< @see SoundControl + SoundControl* sndCtrl; ///< @see SoundControl float preset_volume; ///< the volume all calculations are based upon int fade; ///< >0 is number of steps up <0 is number of steps down, 0 is nothing float fade_volume; ///< volume we add or remove in each step (during fading) @@ -54,15 +54,15 @@ csRef<iSndSysSource3D> sndsource3d; ///< sndsource if 3D csRef<iSndSysSource3DDirectionalSimple> sndsourcedir; ///< additional source if 3D and directional - SoundHandle (SoundSystemManager*); ///< constructor - ~SoundHandle (); ///< destructor + SoundHandle(SoundSystemManager*); ///< constructor + ~SoundHandle(); ///< destructor /** * Does fading calculation for this Handle * @param volume volume to add / substract * @param time time within this must be done * @param direction FADE_DOWN / FADE_UP or FADE_STOP */ - void Fade (float volume, int time, int direction); + void Fade(float volume, int time, int direction); /** * Initialize this Handle. * Done within this because its not failsave. Returns true or false. @@ -72,9 +72,9 @@ * @param type 3d type: can be CS_SND3D_DISABLE=0. CS_SND3D_RELATIVE=1 or CS_SND3D_ABSOLUTE=2 * @param ctrl SoundControl which controls this Handle */ - bool Init (const char *resname, bool loop, - float volume_preset, int type, - SoundControl* &ctrl); + bool Init(const char* resname, bool loop, + float volume_preset, int type, + SoundControl* &ctrl); /** * Converts this Handle to a 3D Handle. @@ -86,9 +86,9 @@ * @param dir direction this sound is emitting to (if rad > 0) * @param rad radiation of the directional cone */ - void ConvertTo3D (float mindist, float maxdist, - csVector3 pos, csVector3 dir, - float rad); + void ConvertTo3D(float mindist, float maxdist, + csVector3 pos, csVector3 dir, + float rad); /** * Whether to remove this Sound/Handle on pause. @@ -96,11 +96,11 @@ * False means it will stay and leak if you dont take care (Managed Sound). * @param toggle true or false */ - void SetAutoRemove (bool toggle); + void SetAutoRemove(bool toggle); /** * Returns state of AutoRemove */ - bool GetAutoRemove (); + bool GetAutoRemove(); /** * Sets a Callback to a object function. @@ -123,7 +123,7 @@ * Makes the callback if set. * Calls callbackfunction of callbackobject. */ - void Callback (); + void Callback(); }; Modified: soc/2011/sound/src/plugins/common/soundmanager/manager.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/manager.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/manager.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -35,7 +35,7 @@ * Set Initialized to true if successfull / to false if not */ -SoundSystemManager::SoundSystemManager (iObjectRegistry* objectReg) +SoundSystemManager::SoundSystemManager(iObjectRegistry* objectReg) { // Initialised to false to make sure it is .. Initialised = false; @@ -45,18 +45,18 @@ soundData = new SoundData; mainSndCtrl = new SoundControl(-1); - if (soundSystem->Initialize (objectReg) - && soundData->Initialize (objectReg)) + if(soundSystem->Initialize(objectReg) + && soundData->Initialize(objectReg)) { // soundLib = cfg->GetStr("PlaneShift.Sound.SoundLib", "/planeshift/art/soundlib.xml"); /* FIXME HARDCODED*/ // also FIXME what if soundlib.xml doesnt exist? - soundData->LoadSoundLib ("/planeshift/art/soundlib.xml", objectReg); + soundData->LoadSoundLib("/planeshift/art/soundlib.xml", objectReg); LastUpdateTime = csGetTicks(); Initialised = true; } } -SoundSystemManager::~SoundSystemManager () +SoundSystemManager::~SoundSystemManager() { Initialised = false; @@ -103,12 +103,12 @@ * but i already have a plan.. :) */ -void SoundSystemManager::Update () +void SoundSystemManager::Update() { SndTime = csGetTicks(); // call it all 100 Ticks - if (Initialised && LastUpdateTime + 100 <= SndTime) + if(Initialised && LastUpdateTime + 100 <= SndTime) { UpdateSound(); // make a update on sounddata to check if there are sounds to unload @@ -124,31 +124,31 @@ */ bool SoundSystemManager:: -Play2DSound (const char *name, bool loop, size_t loopstart, size_t loopend, - float volume_preset, SoundControl* &sndCtrl, SoundHandle* &handle) +Play2DSound(const char* name, bool loop, size_t loopstart, size_t loopend, + float volume_preset, SoundControl* &sndCtrl, SoundHandle* &handle) { /* FIXME redundant code Play3DSound */ - if (Initialised == false) + if(Initialised == false) { Debug1(LOG_SOUND,0,"Sound not Initialised\n"); return false; } - if (name == NULL) + if(name == NULL) { Error1("Error: Play2DSound got NULL as soundname\n"); return false; } - if (sndCtrl->GetToggle() == false) /* FIXME */ + if(sndCtrl->GetToggle() == false) /* FIXME */ { return false; } handle = new SoundHandle(this); - if (!handle->Init(name, loop, volume_preset, CS_SND3D_DISABLE, sndCtrl)) + if(!handle->Init(name, loop, volume_preset, CS_SND3D_DISABLE, sndCtrl)) { delete handle; handle = NULL; @@ -156,7 +156,7 @@ } handle->sndstream->SetLoopBoundaries(loopstart, loopend); - handle->sndsource->SetVolume(( volume_preset * sndCtrl->GetVolume())); + handle->sndsource->SetVolume((volume_preset * sndCtrl->GetVolume())); handle->sndstream->Unpause(); soundHandles.Put(name, handle); @@ -173,32 +173,32 @@ */ bool SoundSystemManager:: -Play3DSound (const char *name, bool loop, size_t loopstart, size_t loopend, - float volume_preset, SoundControl* &sndCtrl, csVector3 pos, - csVector3 dir, float mindist, float maxdist, float rad, - int type3d, SoundHandle* &handle) +Play3DSound(const char* name, bool loop, size_t loopstart, size_t loopend, + float volume_preset, SoundControl* &sndCtrl, csVector3 pos, + csVector3 dir, float mindist, float maxdist, float rad, + int type3d, SoundHandle* &handle) { // FIXME redundant code Play2DSound - if (Initialised == false) + if(Initialised == false) { Debug1(LOG_SOUND,0,"Sound not Initialised\n"); return false; } - if (name == NULL) + if(name == NULL) { Error1("Error: Play2DSound got NULL as soundname\n"); return false; } - if (sndCtrl->GetToggle() == false) /* FIXME */ + if(sndCtrl->GetToggle() == false) /* FIXME */ { return false; } handle = new SoundHandle(this); - if (!handle->Init(name, loop, volume_preset, type3d, sndCtrl)) + if(!handle->Init(name, loop, volume_preset, type3d, sndCtrl)) { delete handle; handle = NULL; @@ -209,7 +209,7 @@ handle->sndsource->SetVolume((volume_preset * sndCtrl->GetVolume())); /* make it 3d */ - handle->ConvertTo3D (mindist, maxdist, pos, dir, rad); + handle->ConvertTo3D(mindist, maxdist, pos, dir, rad); handle->sndstream->Unpause(); soundHandles.Put(name, handle); @@ -261,8 +261,8 @@ { sh = handleIter.Next(); - if (sh->sndstream->GetPauseState() == CS_SNDSYS_STREAM_PAUSED - && sh->GetAutoRemove() == true) + if(sh->sndstream->GetPauseState() == CS_SNDSYS_STREAM_PAUSED + && sh->GetAutoRemove() == true) { RemoveHandle(sh->name); continue; @@ -270,7 +270,7 @@ // fade in or out // fade >0 is number of steps up <0 is number of steps down, 0 is nothing - if (sh->fade > 0) + if(sh->fade > 0) { sh->sndsource->SetVolume(sh->sndsource->GetVolume() + ((sh->fade_volume @@ -278,7 +278,7 @@ * mainSndCtrl->GetVolume())); sh->fade--; } - else if (sh->fade < 0) + else if(sh->fade < 0) { /* * fading down means we might want to stop the sound @@ -289,9 +289,9 @@ * also check the toggle just pause if its false */ - if ((sh->fade == -1 - && sh->fade_stop == true) - || sh->sndCtrl->GetToggle() == false) + if((sh->fade == -1 + && sh->fade_stop == true) + || sh->sndCtrl->GetToggle() == false) { RemoveHandle(sh->name); continue; @@ -305,9 +305,9 @@ sh->fade++; } } - else if (sh->sndCtrl->GetToggle() == true) + else if(sh->sndCtrl->GetToggle() == true) { - if (mainSndCtrl->GetToggle() == false) + if(mainSndCtrl->GetToggle() == false) { vol = VOLUME_ZERO; } @@ -318,7 +318,7 @@ } // limit volume to 2.0f (VOLUME_MAX defined in manager.h) - if (vol >= VOLUME_MAX) + if(vol >= VOLUME_MAX) { sh->sndsource->SetVolume(VOLUME_MAX); } @@ -336,9 +336,9 @@ * Update Listener position */ -void SoundSystemManager::UpdateListener (csVector3 v, csVector3 f, csVector3 t) +void SoundSystemManager::UpdateListener(csVector3 v, csVector3 f, csVector3 t) { - soundSystem->UpdateListener (v, f, t); + soundSystem->UpdateListener(v, f, t); } SoundControl* SoundSystemManager::AddSoundControl(int ctrlID) Modified: soc/2011/sound/src/plugins/common/soundmanager/manager.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/manager.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/manager.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -74,19 +74,19 @@ * will return false if its not Initialised. Be prepared to handle such Error conditions * because they may do that at any time (when something goes wrong). */ - SoundSystemManager (iObjectRegistry* objectReg); + SoundSystemManager(iObjectRegistry* objectReg); /** * Destructor will remove everything this SoundManager created. * It will stop and delete all Handles, removes @see SoundData and @see SoundSystem. * All Pointers to objects within this Manager becoming invalid (handles SoundControls etc). * Make Sure that you dont use them after destruction. */ - ~SoundSystemManager (); + ~SoundSystemManager(); /** * Checks all SoundHandles alters Volume, does fading and removes them if Unmanaged (Autoremove true). */ - void UpdateSound (); + void UpdateSound(); /** * Plays a 2D sound (Cannot be converted to 3D). @@ -98,9 +98,9 @@ * @param sndCtrl SoundControl to control this sound * @param handle a Handle you have to supply. You may discard it if you dont want to manage this sound. */ - bool Play2DSound (const char *name, bool loop, size_t loopstart, - size_t loopend, float volume_preset, - SoundControl* &sndCtrl, SoundHandle * &handle); + bool Play2DSound(const char* name, bool loop, size_t loopstart, + size_t loopend, float volume_preset, + SoundControl* &sndCtrl, SoundHandle* &handle); /** * Plays a 3D sound. @@ -116,11 +116,11 @@ * @param rad radiation of the directional cone. Set it to 0 if you dont want a directional sound. * @param handle a Handle you have to supply. You may discard it if you dont want to manage this sound. * */ - bool Play3DSound (const char *name, bool loop, size_t loopstart, - size_t loopend, float volume_preset, - SoundControl* &sndCtrl, csVector3 pos, csVector3 dir, - float mindist, float maxdist, float rad, int type3d, - SoundHandle * &handle); + bool Play3DSound(const char* name, bool loop, size_t loopstart, + size_t loopend, float volume_preset, + SoundControl* &sndCtrl, csVector3 pos, csVector3 dir, + float mindist, float maxdist, float rad, int type3d, + SoundHandle* &handle); bool StopSound(const char* fileName); bool SetSoundSource(const char* fileName, csVector3 position); @@ -131,14 +131,14 @@ * @param f front * @param t top */ - void UpdateListener (csVector3 v, csVector3 f, csVector3 t); + void UpdateListener(csVector3 v, csVector3 f, csVector3 t); /** * Updates this SoundManager and everything its driving. * Consider this as its Mainloop. It does ten updates per second. * It calls UpdateSound and updates SoundData. */ - void Update (); + void Update(); /** * Returns a NEW SoundControl. * It creates a new SoundControl and returns it. Also keeps Modified: soc/2011/sound/src/plugins/common/soundmanager/psemitter.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psemitter.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psemitter.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -25,7 +25,7 @@ extern SoundSystemManager* sndSysMgr; -psEmitter::psEmitter () +psEmitter::psEmitter() { minvol = VOLUME_ZERO; maxvol = VOLUME_ZERO; @@ -41,7 +41,7 @@ handle = NULL; } -psEmitter::psEmitter (psEmitter* const &emitter) +psEmitter::psEmitter(psEmitter* const &emitter) { // FIXME, this copy constructor is incomplete resource = csString(emitter->resource); @@ -53,13 +53,13 @@ timeofdayrange = emitter->timeofdayrange; } -psEmitter::~psEmitter () +psEmitter::~psEmitter() { // stop deletes the handle Stop(); } -bool psEmitter::CheckRange (csVector3 playerpos) +bool psEmitter::CheckRange(csVector3 playerpos) { csVector3 rangeVec; float range; @@ -67,11 +67,11 @@ rangeVec = position - playerpos; range = rangeVec.Norm(); - if (!range) /* if range is NAN */ + if(!range) /* if range is NAN */ { return false; } - else if (range <= maxrange) + else if(range <= maxrange) { return true; } @@ -79,10 +79,10 @@ return false; } -bool psEmitter::CheckTimeOfDay (int time) +bool psEmitter::CheckTimeOfDay(int time) { - if ((timeofday <= time) - && (timeofdayrange >= time)) + if((timeofday <= time) + && (timeofdayrange >= time)) { return true; } @@ -90,15 +90,15 @@ return false; } -bool psEmitter::Play (SoundControl* &ctrl) +bool psEmitter::Play(SoundControl* &ctrl) { Stop(); // stop any previous play - if (sndSysMgr->Play3DSound (resource, LOOP, 0, 0, - maxvol, ctrl, - position, direction, - minrange, maxrange, - VOLUME_ZERO, CS_SND3D_ABSOLUTE, - handle)) + if(sndSysMgr->Play3DSound(resource, LOOP, 0, 0, + maxvol, ctrl, + position, direction, + minrange, maxrange, + VOLUME_ZERO, CS_SND3D_ABSOLUTE, + handle)) { active = true; handle->SetCallback(this, &StopCallback); @@ -108,11 +108,11 @@ return false; } -void psEmitter::Stop () +void psEmitter::Stop() { active = false; - if (handle != NULL) + if(handle != NULL) { sndSysMgr->StopSound(handle->name); } @@ -120,7 +120,7 @@ void psEmitter::StopCallback(void* object) { - psEmitter *which = (psEmitter *) object; + psEmitter* which = (psEmitter*) object; which->active = false; which->handle = NULL; } Modified: soc/2011/sound/src/plugins/common/soundmanager/psemitter.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psemitter.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psemitter.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -22,8 +22,8 @@ */ -#ifndef PSEMITTER_H_ -#define PSEMITTER_H_ +#ifndef _PSEMITTER_H_ +#define _PSEMITTER_H_ /** * This object represents a planeshift soundEmitter. @@ -49,48 +49,48 @@ bool active; ///< is this emitter active? int timeofday; ///< time when this emitter starts playing int timeofdayrange; ///< time when this emitter stops - SoundHandle *handle; ///< @see SoundHandle if it is active + SoundHandle* handle; ///< @see SoundHandle if it is active /** * Constructor */ - psEmitter (); + psEmitter(); /** * Destructor * Removes our Callback from the Handle if its still playing. */ - ~psEmitter (); + ~psEmitter(); /** * Copy Constructor * copies resource volume range and time parameters * everything else remains uninitialized! * @param emitter a existing emitter */ - psEmitter (psEmitter* const &emitter); + psEmitter(psEmitter* const &emitter); /** * Check range to the given position. * Calculates the distance to the given position and returns * true if this emitter is in range. * @param playerpos position used for calculation */ - bool CheckRange (csVector3 playerpos); + bool CheckRange(csVector3 playerpos); /** * Check time of day. * Checks if time is within this emitters timewindow. * Returns true if it is. * @param time <24 && >0 is resonable but can be any valid int */ - bool CheckTimeOfDay (int time); + bool CheckTimeOfDay(int time); /** * Play this emitter. * Makes this emitter play - you need to provide a SoundControl. * @param ctrl SoundControl for this emitter */ - bool Play (SoundControl* &ctrl); + bool Play(SoundControl* &ctrl); /** * Stops this emitter. */ - void Stop (); + void Stop(); /** * Callback function for Stop. * SoundHandles callback will point to this and inform us if it gets destroyed. @@ -99,4 +99,4 @@ static void StopCallback(void* object); }; -#endif /*PSEMITTER_H_*/ +#endif /*_PSEMITTER_H_*/ Modified: soc/2011/sound/src/plugins/common/soundmanager/psentity.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psentity.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psentity.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -26,7 +26,7 @@ extern SoundSystemManager* sndSysMgr; -psEntity::psEntity () +psEntity::psEntity() { minvol = VOLUME_ZERO; maxvol = VOLUME_ZERO; @@ -39,22 +39,22 @@ handle = NULL; } -psEntity::psEntity (psEntity* const& /*entity*/) +psEntity::psEntity(psEntity* const& /*entity*/) { } -psEntity::~psEntity () +psEntity::~psEntity() { - if (handle != NULL) + if(handle != NULL) { handle->RemoveCallback(); } } -bool psEntity::CheckTimeOfDay (int time) +bool psEntity::CheckTimeOfDay(int time) { - if ((timeofday <= time) - && (timeofdayrange >= time)) + if((timeofday <= time) + && (timeofdayrange >= time)) { return true; } @@ -62,19 +62,19 @@ return false; } -bool psEntity::Play (SoundControl* &ctrl, csVector3 entityposition) +bool psEntity::Play(SoundControl* &ctrl, csVector3 entityposition) { - if (handle != NULL) + if(handle != NULL) { handle->RemoveCallback(); // stop previous play } - if (sndSysMgr->Play3DSound (resource, DONT_LOOP, 0, 0, - maxvol, ctrl, - entityposition, 0, - minrange, maxrange, - VOLUME_ZERO, CS_SND3D_ABSOLUTE, - handle)) + if(sndSysMgr->Play3DSound(resource, DONT_LOOP, 0, 0, + maxvol, ctrl, + entityposition, 0, + minrange, maxrange, + VOLUME_ZERO, CS_SND3D_ABSOLUTE, + handle)) { active = true; when = (delay_after*1000); @@ -87,7 +87,7 @@ void psEntity::StopCallback(void* object) { - psEntity *which = (psEntity *) object; + psEntity* which = (psEntity*) object; which->active = false; which->handle = NULL; } Modified: soc/2011/sound/src/plugins/common/soundmanager/psentity.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psentity.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psentity.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -22,8 +22,8 @@ */ -#ifndef PSENTITY_H_ -#define PSENTITY_H_ +#ifndef _PSENTITY_H_ +#define _PSENTITY_H_ /** * This object represents a planeshift entity sound. @@ -45,36 +45,36 @@ float probability; ///< how high is the probability that this entity makes this sound int when; ///< counter to keep track when it has been played - zero means i may play at any time bool active; ///< is the sound active? - SoundHandle *handle; ///< pointer to the SoundHandle if active + SoundHandle* handle; ///< pointer to the SoundHandle if active int timeofday; ///< time when this entity starts playing int timeofdayrange; ///< time when this entity stops /** * Constructer */ - psEntity (); + psEntity(); /** * Destructor */ - ~psEntity (); + ~psEntity(); /** * Copy Constructor - WARNING INCOMPLETE */ - psEntity (psEntity* const &entity); + psEntity(psEntity* const &entity); /** * Check time of day. * Checks if time is within this entitys timewindow. * Returns true if it is. * @param time <24 && >0 is resonable but can be any valid int */ - bool CheckTimeOfDay (int time); + bool CheckTimeOfDay(int time); /** * Play this entity sound. * You need to supply a SoundControl and the position for this sound. * @param ctrl SoundControl * @param entityposition position of this entity */ - bool Play (SoundControl* &ctrl, csVector3 entityposition); + bool Play(SoundControl* &ctrl, csVector3 entityposition); /** * The Callback gets called if the SoundHandle is destroyed. * It sets active to false and handle to NULL @@ -82,4 +82,4 @@ static void StopCallback(void* object); }; -#endif /*PSENTITY_H_*/ +#endif /*_PSENTITY_H_*/ Modified: soc/2011/sound/src/plugins/common/soundmanager/psmusic.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psmusic.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psmusic.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -25,21 +25,21 @@ extern SoundSystemManager* sndSysMgr; -psMusic::psMusic () +psMusic::psMusic() { active = false; handle = NULL; } -psMusic::~psMusic () +psMusic::~psMusic() { Stop(); } -bool psMusic::CheckTimeOfDay (int time) +bool psMusic::CheckTimeOfDay(int time) { - if ((timeofday <= time) - && (timeofdayrange >= time)) + if((timeofday <= time) + && (timeofdayrange >= time)) { return true; } @@ -47,9 +47,9 @@ return false; } -bool psMusic::CheckType (const int _type) +bool psMusic::CheckType(const int _type) { - if (type == _type) + if(type == _type) { return true; } @@ -57,27 +57,27 @@ return false; } -void psMusic::FadeUp () +void psMusic::FadeUp() { - if (handle != NULL) + if(handle != NULL) { handle->Fade((maxvol - minvol), fadedelay, FADE_UP); } } -void psMusic::FadeDown () +void psMusic::FadeDown() { - if (handle != NULL) + if(handle != NULL) { handle->Fade(maxvol, fadedelay, FADE_DOWN); } } -void psMusic::FadeDownAndStop () +void psMusic::FadeDownAndStop() { active = false; - if (handle != NULL) + if(handle != NULL) { handle->RemoveCallback(); handle->Fade(maxvol, fadedelay, FADE_STOP); @@ -85,13 +85,13 @@ } } -bool psMusic::Play (bool loopToggle, SoundControl* &ctrl) +bool psMusic::Play(bool loopToggle, SoundControl* &ctrl) { Stop(); // stop any previous sound - if (sndSysMgr->Play2DSound (resource, loopToggle, - loopstart, loopend, - minvol, ctrl, - handle)) + if(sndSysMgr->Play2DSound(resource, loopToggle, + loopstart, loopend, + minvol, ctrl, + handle)) { active = true; handle->preset_volume = maxvol; @@ -102,32 +102,32 @@ return false; } -void psMusic::Stop () +void psMusic::Stop() { active = false; - if (handle != NULL) + if(handle != NULL) { sndSysMgr->StopSound(handle->name); } } -void psMusic::SetManaged () +void psMusic::SetManaged() { handle->SetAutoRemove(false); } -void psMusic::SetUnManaged () +void psMusic::SetUnManaged() { handle->SetAutoRemove(true); } -void psMusic::DontLoop () +void psMusic::DontLoop() { handle->sndstream->SetLoopState(DONT_LOOP); } -void psMusic::Loop () +void psMusic::Loop() { handle->sndstream->SetLoopState(LOOP); handle->sndstream->Unpause(); @@ -140,7 +140,7 @@ void psMusic::StopCallback(void* object) { - psMusic *which = (psMusic *) object; + psMusic* which = (psMusic*) object; which->active = false; which->handle = NULL; } Modified: soc/2011/sound/src/plugins/common/soundmanager/psmusic.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/psmusic.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/psmusic.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -21,8 +21,8 @@ * */ -#ifndef PSMUSIC_H_ -#define PSMUSIC_H_ +#ifndef _PSMUSIC_H_ +#define _PSMUSIC_H_ /** * This object represents a planeshift Soundtrack. @@ -43,72 +43,72 @@ size_t loopstart; ///< frame to start at when looping size_t loopend; ///< frame when jumping back to loopstart (when looping) bool active; ///< is this soundtrack active? - SoundHandle *handle; ///< handle if this soundtrack is active + SoundHandle* handle; ///< handle if this soundtrack is active /** * Constructor * Sets active to false and handle to NULL */ - psMusic (); + psMusic(); /** * Destructor * Removes Handle callback if theres one */ - ~psMusic (); + ~psMusic(); /** * Check time of day. * Checks if time is within this soundtracks timewindow. * Returns true if it is. * @param time <24 && >0 is resonable but can be any valid int */ - bool CheckTimeOfDay (int time); + bool CheckTimeOfDay(int time); /** * Compares soundstracks type against a given type. * Returns true if they are both equal * @param _type type to compare against */ - bool CheckType (const int _type); + bool CheckType(const int _type); /** * Fades this Soundtrack down and stops it. */ - void FadeDownAndStop (); + void FadeDownAndStop(); /** * Fades this Soundtrack down. */ - void FadeDown (); + void FadeDown(); /** * Fades this Soundtrack up. */ - void FadeUp (); + void FadeUp(); /** * Play this SoundTrack * @param loopToggle loop? maybe true or false * @param ctrl SoundControl for this sound */ - bool Play (bool loopToggle, SoundControl* &ctrl); + bool Play(bool loopToggle, SoundControl* &ctrl); /** * Stops this Soundtrack immediatly */ - void Stop (); + void Stop(); /** * Sets Autoremove to true. * The SoundHandle will be removed when this sound has stopped playing. * Warning: doesnt happen when looping! */ - void SetUnManaged (); + void SetUnManaged(); /** * Set Autoremove to false. * The SoundHandle wont be removed even if paused. */ - void SetManaged (); + void SetManaged(); /** * Enable or resume looping. */ - void Loop (); + void Loop(); /** * Disable looping. */ - void DontLoop (); + void DontLoop(); /** * Updates Handles Callback. */ @@ -121,4 +121,4 @@ static void StopCallback(void* object); }; -#endif /*PSMUSIC_H_*/ +#endif /*_PSMUSIC_H_*/ Modified: soc/2011/sound/src/plugins/common/soundmanager/pssound.h =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/pssound.h 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/pssound.h 2011-06-08 17:43:52 UTC (rev 7376) @@ -21,8 +21,8 @@ * */ -#ifndef PSSOUND_H_ -#define PSSOUND_H_ +#ifndef _PSSOUND_H_ +#define _PSSOUND_H_ #include <crystalspace.h> #include "util/pstoggle.h" @@ -33,4 +33,4 @@ #include "psemitter.h" #include "pssoundsector.h" -#endif /*PSSOUND_H_*/ +#endif /*_PSSOUND_H_*/ Modified: soc/2011/sound/src/plugins/common/soundmanager/pssoundsector.cpp =================================================================== --- soc/2011/sound/src/plugins/common/soundmanager/pssoundsector.cpp 2011-06-08 15:27:25 UTC (rev 7375) +++ soc/2011/sound/src/plugins/common/soundmanager/pssoundsector.cpp 2011-06-08 17:43:52 UTC (rev 7376) @@ -25,7 +25,7 @@ #include "pssound.h" -psSoundSector::psSoundSector (csRef<iDocumentNode> sector, iObjectRegistry* objReg) +psSoundSector::psSoundSector(csRef<iDocumentNode> sector, iObjectRegistry* objReg) { name = sector->GetAttributeValue("NAME"); playerposition = csVector3(0); @@ -39,14 +39,14 @@ Load(sector); } -psSoundSector::~psSoundSector () +psSoundSector::~psSoundSector() { Delete(); } -void psSoundSector::AddAmbient (csRef<iDocumentNode> Node) +void psSoundSector::AddAmbient(csRef<iDocumentNode> Node) { - psMusic *ambient; + psMusic* ambient; ambient = new psMusic; @@ -62,7 +62,7 @@ ambient->active = false; // for wrong xmls - FIXME when youve fixed the xmls - if (ambient->timeofday == -1) + if(ambient->timeofday == -1) { ambient->timeofday = 0; ambient->timeofdayrange = 24; @@ -71,26 +71,26 @@ ambientarray.Push(ambient); } -void psSoundSector::UpdateAmbient (int type, SoundControl* &ctrl) +void psSoundSector::UpdateAmbient(int type, SoundControl* &ctrl) { - psMusic *ambient; + psMusic* ambient; - for (size_t i = 0; i< ambientarray.GetSize(); i++) + for(size_t i = 0; i< ambientarray.GetSize(); i++) { ambient = ambientarray[i]; // check parameters against our world, is this the track we are searching? - if (ambient->CheckType(type) == true + if(ambient->CheckType(type) == true && active == true && ctrl->GetToggle() == true && ambient->CheckTimeOfDay(timeofday) == true) { - if (ambient->active == true) + if(ambient->active == true) { continue; } - if (ambient->Play(LOOP, ctrl)) + if(ambient->Play(LOOP, ctrl)) { ambient->FadeUp(); activeambient = ambient; @@ -101,12 +101,12 @@ break; } } - else if (ambient->active == true) + else if(ambient->active == true) { // state doesnt matter, this handle will be stopped ambient->FadeDownAndStop(); - if (activeambient == ambient) + if(activeambient == ambient) { activeambient = NULL; } @@ -114,15 +114,15 @@ } } -void psSoundSector::DeleteAmbient (psMusic* &ambient) +void psSoundSector::DeleteAmbient(psMusic* &ambient) { ambientarray.Delete(ambient); delete ambient; } -void psSoundSector::AddMusic (csRef<iDocumentNode> Node) +void psSoundSector::AddMusic(csRef<iDocumentNode> Node) { - psMusic *music; + psMusic* music; music = new psMusic; @@ -138,7 +138,7 @@ music->active = false; // for wrong xmls - FIXME when youve fixed the xmls - if (music->timeofday == -1) + if(music->timeofday == -1) { music->timeofday = 0; music->timeofdayrange = 24; @@ -147,28 +147,28 @@ musicarray.Push(music); } -void psSoundSector::UpdateMusic (bool loopToggle, int type, +void psSoundSector::UpdateMusic(bool loopToggle, int type, SoundControl* &ctrl) { - psMusic *music; + psMusic* music; - for (size_t i = 0; i< musicarray.GetSize(); i++) + for(size_t i = 0; i< musicarray.GetSize(); i++) { music = musicarray[i]; // check parameters against our world, is this the track we are searching? - if (music->CheckType(type) == true + if(music->CheckType(type) == true && active == true && ctrl->GetToggle() == true && music->CheckTimeOfDay(timeofday) == true) { - if (music->active == true) + if(music->active == true) { // difficult logic. user doesnt want looping BGM // therefor we set this to managed and leave it active // so it wont be played again unless he reenabled looping or changes sectors etc .. - if (loopToggle == false) + if(loopToggle == false) { // set managed as we want keep track of it music->SetManaged(); @@ -185,7 +185,7 @@ } } - if (music->Play(loopToggle, ctrl)) + if(music->Play(loopToggle, ctrl)) { music->FadeUp(); activemusic = music; @@ -196,12 +196,12 @@ DeleteMusic(music); } } - else if (music->active == true) + else if(music->active == true) { // state doesnt matter, this handle will be stopped music->FadeDownAndStop(); - if (activemusic == music) + if(activemusic == music) { activemusic = NULL; } @@ -209,15 +209,15 @@ } } -void psSoundSector::DeleteMusic (psMusic* &music) +void psSoundSector::DeleteMusic(psMusic* &music) { musicarray.Delete(music); delete music; } -void psSoundSector::AddEmitter (csRef<iDocumentNode> Node) +void psSoundSector::AddEmitter(csRef<iDocumentNode> Node) { - psEmitter *emitter; + psEmitter* emitter; emitter = new psEmitter; @@ -229,17 +229,17 @@ emitter->fadedelay = Node->GetAttributeValueAsInt("FADEDELAY"); emitter->factory = Node->GetAttributeValue("FACTORY"); emitter->factory_prob = Node->GetAttributeValueAsFloat("FACTORY_PROBABILITY"); - emitter->position = csVector3 (Node->GetAttributeValueAsFloat("X"), - Node->GetAttributeValueAsFloat("Y"), - Node->GetAttributeValueAsFloat("Z") ); - emitter->direction = csVector3 (Node->GetAttributeValueAsFloat("2X"), - Node->GetAttributeValueAsFloat("2Y"), - Node->GetAttributeValueAsFloat("2Z") ); + emitter->position = csVector3(Node->GetAttributeValueAsFloat("X"), + Node->GetAttributeValueAsFloat("Y"), + Node->GetAttributeValueAsFloat("Z")); + emitter->direction = csVector3(Node->GetAttributeValueAsFloat("2X"), + Node->GetAttributeValueAsFloat("2Y"), + Node->GetAttributeValueAsFloat("2Z")); emitter->timeofday = Node->GetAttributeValueAsInt("TIME"); emitter->timeofdayrange = Node->GetAttributeValueAsInt("TIME_RANGE"); emitter->active = false; - if (emitter->timeofday == -1) + if(emitter->timeofday == -1) { emitter->timeofday = 0; emitter->timeofdayrange = 24; @@ -249,26 +249,26 @@ //update on position change -void psSoundSector::UpdateEmitter (SoundControl* &ctrl) +void psSoundSector::UpdateEmitter(SoundControl* &ctrl) { - psEmitter *emitter; + psEmitter* emitter; // start/stop all emitters in range - for (size_t i = 0; i< emitterarray.GetSize(); i++) + for(size_t i = 0; i< emitterarray.GetSize(); i++) { emitter = emitterarray[i]; - if (emitter->CheckRange(playerposition) == true - && active == true - && ctrl->GetToggle() == true - && emitter->CheckTimeOfDay(timeofday) == true) + if(emitter->CheckRange(playerposition) == true + && active == true + && ctrl->GetToggle() == true + && emitter->CheckTimeOfDay(timeofday) == true) { - if (emitter->active == true) + if(emitter->active == true) { continue; } - if (!emitter->Play(ctrl)) + if(!emitter->Play(ctrl)) { // error occured .. emitter cant be played .. remove it DeleteEmitter(emitter); @@ -276,22 +276,22 @@ } } - else if (emitter->active != false) + else if(emitter->active != false) { emitter->Stop(); } } } -void psSoundSector::DeleteEmitter (psEmitter* &emitter) +void psSoundSector::DeleteEmitter(psEmitter* &emitter) { emitterarray.Delete(emitter); delete emitter; } -void psSoundSector::AddEntity (csRef<iDocumentNode> Node) +void psSoundSector::AddEntity(csRef<iDocumentNode> Node) { - psEntity *entity; + psEntity* entity; entity = new psEntity; @@ -308,7 +308,7 @@ entity->timeofdayrange = Node->GetAttributeValueAsInt("TIME_RANGE"); entity->active = false; - if (entity->timeofday == -1) + if(entity->timeofday == -1) { entity->timeofday = 0; entity->timeofdayrange = 24; @@ -320,14 +320,14 @@ void psSoundSector::UpdateEntity(SoundControl* &ctrl) { csRef<iEngine> engine; - psEntity *entity; + psEntity* entity; iMeshWrapper* mesh; iMeshList* entities; csVector3 rangeVec; float range; engine = csQueryRegistry<iEngine>(objectReg); - if (!engine) + ... [truncated message content] |