From: Matthias Braun Date: Thu, 12 Jan 2006 17:21:37 +0000 (+0000) Subject: oops X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5cf95aefef3362677c57c81f3f723c4a0aa7051f;p=supertux.git oops SVN-Revision: 2991 --- diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index 1490768c9..656caacff 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -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; diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index b39162bb4..1d3f76531 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -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; } diff --git a/src/game_session.cpp b/src/game_session.cpp index c64b9ba07..7ccf19bf7 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -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) { diff --git a/src/game_session.hpp b/src/game_session.hpp index 114c27de6..c5ed8259f 100644 --- a/src/game_session.hpp +++ b/src/game_session.hpp @@ -136,7 +136,6 @@ private: CodeController* end_sequence_controller; bool game_pause; - bool music_playing; std::string levelfile; diff --git a/src/misc.cpp b/src/misc.cpp index 1420bc88a..b8279b585 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -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: