Planeshift

pssoundsector.h

Go to the documentation of this file.
00001 /*
00002  * pssoundsector.h
00003  *
00004  * Copyright (C) 2001-2010 Atomic Blue ([email protected], http://www.planeshift.it)
00005  *
00006  * Credits : Mathias 'AgY' Voeroes <[email protected]>
00007  *           and all past and present planeshift coders
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation (version 2 of the License.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  *
00021  */
00022 
00023 #ifndef _PSSOUNDSECTOR_H_
00024 #define _PSSOUNDSECTOR_H_
00025 
00026 //====================================================================================
00027 // Crystal Space Includes
00028 //====================================================================================
00029 #include <csutil/hash.h>
00030 #include <csutil/csstring.h>
00031 #include <csgeom/vector3.h>
00032 
00033 //------------------------------------------------------------------------------------
00034 // Forward Declarations
00035 //------------------------------------------------------------------------------------
00036 class psMusic;
00037 class psEntity;
00038 class psEmitter;
00039 class SoundControl;
00040 class GEMClientActor;
00041 struct iMeshWrapper;
00042 struct iDocumentNode;
00043 
00048 class psSoundSector
00049 {
00050 public:
00051     csString                     name;               
00052     bool                         active;             
00053     psMusic*                     activeambient;      
00054     psMusic*                     activemusic;        
00055     csArray<psMusic*>            ambientarray;       
00056     csArray<psMusic*>            musicarray;         
00057     csArray<psEmitter*>          emitterarray;       
00058     csHash<psEntity*, csString>  factories;          
00059     csHash<psEntity*, csString>  meshes;             
00060     csHash<psEntity*, uint>      tempEntities;       
00061 
00066     psSoundSector(iObjectRegistry* objectReg);
00067 
00074     psSoundSector(csRef<iDocumentNode> sectorNode, iObjectRegistry* objectReg);
00075 
00080     ~psSoundSector();
00081     void AddAmbient(csRef<iDocumentNode> Node);
00082     void UpdateAmbient(int type, SoundControl* &ctrl);
00083     void DeleteAmbient(psMusic* &ambient);
00084     void AddMusic(csRef<iDocumentNode> Node);
00085     void UpdateMusic(bool loopToggle, int type, SoundControl* &ctrl);
00086     void DeleteMusic(psMusic* &music);
00087 
00092     void AddEmitter(csRef<iDocumentNode> Node);
00093 
00098     void UpdateAllEmitters(SoundControl* &ctrl);
00099 
00104     void UpdateAllEntities(SoundControl* &ctrl);
00105 
00110     void DeleteEmitter(psEmitter* &emitter);
00115     void AddEntityDefinition(csRef<iDocumentNode> entityNode);
00116 
00123     void UpdateEntity(iMeshWrapper* mesh, const char* meshName, SoundControl* &ctrl);
00124     void DeleteEntity(psEntity* &entity);
00125 
00131     void AddObjectEntity(iMeshWrapper* mesh, const char* meshName);
00132 
00138     void RemoveObjectEntity(iMeshWrapper* mesh, const char* meshName);
00139 
00140 
00141 
00154     void SetEntityState(int state, iMeshWrapper* mesh, const char* actorName, bool forceChange);
00155 
00162     void Load(csRef<iDocumentNode> sectorNode);
00163     void Reload(csRef<iDocumentNode> sector);
00164     void Delete();
00165 
00166 private:
00167     iObjectRegistry* objectReg;
00168 
00178     psEntity* GetAssociatedEntity(iMeshWrapper* mesh, const char* meshName) const;
00179 };
00180 
00181 #endif /*_PSSOUNDSECTOR_H_*/