Planeshift
|
00001 /* 00002 * sectormngr.h, Author: Andrea Rizzi <[email protected]> 00003 * 00004 * Copyright (C) 2001-2012 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef SND_SECTOR_MNGR_H 00021 #define SND_SECTOR_MNGR_H 00022 00023 00024 //==================================================================================== 00025 // Crystal Space Includes 00026 //==================================================================================== 00027 #include <cssysdef.h> 00028 00029 //==================================================================================== 00030 // Project Includes 00031 //==================================================================================== 00032 #include "util/singleton.h" 00033 00034 //==================================================================================== 00035 // Local Includes 00036 //==================================================================================== 00037 #include "soundctrl.h" 00038 00039 //------------------------------------------------------------------------------------ 00040 // Forward Declarations 00041 //------------------------------------------------------------------------------------ 00042 class csString; 00043 class SoundControl; 00044 class psSoundSector; 00045 struct iMeshWrapper; 00046 struct iObjectRegistry; 00047 00052 class SoundSectorManager: public iSoundControlListener, public Singleton<SoundSectorManager> 00053 { 00054 public: 00055 00059 SoundSectorManager(); 00060 00064 virtual ~SoundSectorManager(); 00065 00072 bool Initialize(iObjectRegistry* objectReg); 00073 00077 void UnloadSectors(); 00078 00084 bool ReloadSectors(); 00085 00090 void Update(); 00091 00096 bool IsLoopBGMOn() const 00097 { 00098 return loopBGM; 00099 } 00100 00105 void SetLoopBGMToggle(bool toggle); 00106 00111 bool IsCombatMusicOn() const 00112 { 00113 return isCombatMusicOn; 00114 } 00115 00120 void SetCombatMusicToggle(bool toggle); 00121 00126 psSoundSector* GetCommonSector() 00127 { 00128 return commonSector; 00129 } 00130 00137 bool SetActiveSector(const char* sectorName); 00138 00143 int GetCombatStance() const 00144 { 00145 return combatStance; 00146 } 00147 00152 void SetCombatStance(int newCombatStance); 00153 00158 int GetTimeOfDay() const 00159 { 00160 return timeOfDay; 00161 } 00162 00167 void SetTimeOfDay(int newTimeOfDay); 00168 00173 void SetWeather(int newWeather); 00174 00187 void SetEntityState(int state, iMeshWrapper* mesh, const char* meshName, bool forceChange); 00188 00194 void AddObjectEntity(iMeshWrapper* mesh, const char* meshName); 00195 00201 void RemoveObjectEntity(iMeshWrapper* mesh, const char* meshName); 00202 00208 void UpdateObjectEntity(iMeshWrapper* mesh, const char* meshName); 00209 00210 00211 // From iSoundControlListener 00212 //----------------------------- 00213 virtual void OnSoundChange(SoundControl* sndCtrl); 00214 00215 private: 00216 iObjectRegistry* objectReg; 00217 00218 int weather; 00219 int timeOfDay; 00220 int combatStance; 00221 00222 bool loopBGM; 00223 bool isCombatMusicOn; 00224 00225 SoundControl* musicSndCtrl; 00226 SoundControl* ambientSndCtrl; 00227 00228 bool areSectorsLoaded; 00229 psSoundSector* activeSector; 00230 psSoundSector* commonSector; 00231 csArray<psSoundSector*> sectors; 00232 00240 bool LoadSectors(); 00241 00247 psSoundSector* FindSector(const csString §orName) const; 00248 00253 void UpdateSector(psSoundSector* sector); 00254 00260 void ConvertFactoriesToEmitter(psSoundSector* sector); 00261 00269 void TransferHandles(psSoundSector* oldSector, psSoundSector* newSector); 00270 00271 }; 00272 00273 #endif /* SND_SECTOR_MNGR_H */ 00274