From: Andrew C. <ac...@us...> - 2004-09-19 22:53:02
|
Update of /cvsroot/planeshift/planeshift/src/client/sound In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/client/sound Modified Files: pssoundmngr.cpp pssoundmngr.h Log Message: Battle music now causes fades in map sounds Index: pssoundmngr.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/sound/pssoundmngr.cpp,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** pssoundmngr.cpp 15 Sep 2004 03:12:49 -0000 1.63 --- pssoundmngr.cpp 19 Sep 2004 22:52:52 -0000 1.64 *************** *** 573,576 **** --- 573,584 ---- } + void psSoundManager::FadeSectorSounds( Fade_Direction dir ) + { + if ( currentSoundSector ) + { + currentSoundSector->Fade( dir ); + } + } + SCF_IMPLEMENT_FACTORY (psSoundManager) *************** *** 772,775 **** --- 780,785 ---- } + + psSectorSoundManager::psSectorSoundManager( csString& sectorName, iEngine* engine ) { *************** *** 778,781 **** --- 788,792 ---- music = true; this->engine = engine; + mainBG = NULL; } *************** *** 846,849 **** --- 857,877 ---- } + void psSectorSoundManager::Fade( Fade_Direction dir ) + { + if ( mainBG ) + mainBG->StartFade( dir ); + + size_t z; + for ( z = 0; z < ambient.Length(); z++ ) + { + ambient[z]->StartFade( dir ); + } + + for ( z = 0; z < emitters.Length(); z++ ) + { + emitters[z]->StartFade( dir ); + } + } + void psSectorSoundManager::Enter( psSectorSoundManager* leaveFrom, int timeOfDay, int weather, csVector3& position ) { *************** *** 877,880 **** --- 905,909 ---- bestTimeSong->StartFade( FADE_UP ); } + mainBG = bestTimeSong; } else if ( bestWeatherSong ) *************** *** 888,891 **** --- 917,921 ---- bestWeatherSong->StartFade( FADE_UP ); } + mainBG = bestWeatherSong; } else *************** *** 901,904 **** --- 931,935 ---- songs[0]->StartFade( FADE_UP ); } + mainBG = songs[0]; } } Index: pssoundmngr.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/sound/pssoundmngr.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pssoundmngr.h 15 Sep 2004 03:12:49 -0000 1.32 --- pssoundmngr.h 19 Sep 2004 22:52:52 -0000 1.33 *************** *** 50,58 **** struct psSoundFileInfo; - enum Fade_Direction - { - FADE_UP, - FADE_DOWN - }; --- 50,53 ---- *************** *** 86,89 **** --- 81,87 ---- virtual void StopOverrideBG(); + /** Fades all the sounds in that sector */ + void FadeSectorSounds( Fade_Direction dir ); + virtual void ToggleMusic(bool toggle); virtual void ToggleSounds(bool toggle); *************** *** 370,373 **** --- 368,373 ---- bool CheckSong( psSoundObject* bgSound ); bool CheckAmbient( psSoundObject* ambient ); + + void Fade( Fade_Direction dir ); private: csRef<iEngine> engine; *************** *** 378,381 **** --- 378,383 ---- csPDelArray<psSoundObject> emitters; + psSoundObject* mainBG; + // These are 3d sound emitters that are attached to a mesh but have not yet // had their positions set. When the map is loaded it will get their positions |