oops
authorMatthias Braun <matze@braunis.de>
Thu, 12 Jan 2006 17:21:37 +0000 (17:21 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 12 Jan 2006 17:21:37 +0000 (17:21 +0000)
SVN-Revision: 2991

src/audio/sound_manager.cpp
src/audio/sound_manager.hpp
src/game_session.cpp
src/game_session.hpp
src/misc.cpp

index 1490768..656caac 100644 (file)
@@ -151,12 +151,12 @@ SoundManager::enable_music(bool enable)
 }
 
 void
-SoundManager::stop_music(bool fade)
+SoundManager::stop_music(float fadetime)
 {
-  if(fade) {
+  if(fadetime > 0) {
     if(music_source
         && music_source->get_fade_state() != StreamSoundSource::FadingOff)
-      music_source->set_fading(StreamSoundSource::FadingOff, .5f);
+      music_source->set_fading(StreamSoundSource::FadingOff, fadetime);
   } else {
     delete music_source;
     music_source = 0;
index b39162b..1d3f765 100644 (file)
@@ -40,7 +40,7 @@ public:
 
   void enable_music(bool music_enabled);
   void play_music(const std::string& filename, bool fade = false);
-  void stop_music(bool fade = true);
+  void stop_music(float fadetime = 0);
   
   bool is_sound_enabled() { return sound_enabled; }
 
index c64b9ba..7ccf19b 100644 (file)
@@ -85,7 +85,6 @@ GameSession::GameSession(const std::string& levelfile_, GameSessionMode mode,
   currentsector = 0;
   
   game_pause = false;
-  music_playing = false;
   fps_fps = 0;
 
   context = new DrawingContext();
@@ -148,11 +147,7 @@ GameSession::restart_level()
   if(mode == ST_GL_PLAY || mode == ST_GL_LOAD_LEVEL_FILE)
     levelintro();
 
-  if (!music_playing)
-  {
-    currentsector->play_music(LEVEL_MUSIC);
-    music_playing = true;
-  }
+  currentsector->play_music(LEVEL_MUSIC);
 
   if(capture_file != "")
     record_demo(capture_file);
@@ -208,6 +203,8 @@ GameSession::levelintro()
 {
   char str[60];
 
+  sound_manager->stop_music();
+
   DrawingContext context;
   for(Sector::GameObjects::iterator i = currentsector->gameobjects.begin();
       i != currentsector->gameobjects.end(); ++i) {
index 114c27d..c5ed825 100644 (file)
@@ -136,7 +136,6 @@ private:
   CodeController* end_sequence_controller;
 
   bool game_pause;
-  bool music_playing;
 
   std::string levelfile;
 
index 1420bc8..b8279b5 100644 (file)
@@ -47,18 +47,21 @@ void process_options_menu()
       if(config->use_fullscreen != options_menu->is_toggled(MNID_FULLSCREEN)) {
         config->use_fullscreen = !config->use_fullscreen;
         init_video();
+        config->save();
       }
       break;
     case MNID_SOUND:
       if(config->sound_enabled != options_menu->is_toggled(MNID_SOUND)) {
         config->sound_enabled = !config->sound_enabled;
         sound_manager->enable_sound(config->sound_enabled);
+        config->save();
       }
       break;
     case MNID_MUSIC:
       if(config->music_enabled != options_menu->is_toggled(MNID_MUSIC)) {
         config->music_enabled = !config->music_enabled;
         sound_manager->enable_music(config->music_enabled);
+        config->save();
       }
       break;
     default: