From 4189df43ee4424cbbf1fbd33119ce8a1d4a8e1a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Ho=C5=A1ek?= Date: Wed, 12 Apr 2006 11:45:16 +0000 Subject: [PATCH] When invincibility time's running out, the invinc. music fades out. SVN-Revision: 3313 --- src/game_session.cpp | 16 +++++++++++----- src/sector.cpp | 3 +++ src/sector.hpp | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/game_session.cpp b/src/game_session.cpp index 6fc8fb3ac..2d21d6715 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -529,11 +529,17 @@ GameSession::update(float elapsed_time) sound_manager->set_listener_position(currentsector->player->get_pos()); /* Handle music: */ - if (currentsector->player->invincible_timer.started() && - currentsector->player->invincible_timer.get_timeleft() - > TUX_INVINCIBLE_TIME_WARNING && !end_sequence) { - currentsector->play_music(HERRING_MUSIC); - } else if(currentsector->get_music_type() != LEVEL_MUSIC && !end_sequence) { + if (end_sequence) + return; + + if(currentsector->player->invincible_timer.started()) { + if(currentsector->player->invincible_timer.get_timeleft() <= + TUX_INVINCIBLE_TIME_WARNING) { + currentsector->play_music(HERRING_WARNING_MUSIC); + } else { + currentsector->play_music(HERRING_MUSIC); + } + } else if(currentsector->get_music_type() != LEVEL_MUSIC) { currentsector->play_music(LEVEL_MUSIC); } } diff --git a/src/sector.cpp b/src/sector.cpp index 69571e106..d0c4a9591 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -1106,6 +1106,9 @@ Sector::play_music(MusicType type) case HERRING_MUSIC: sound_manager->play_music("music/salcon.ogg"); break; + case HERRING_WARNING_MUSIC: + sound_manager->stop_music(TUX_INVINCIBLE_TIME_WARNING); + break; default: sound_manager->play_music(""); break; diff --git a/src/sector.hpp b/src/sector.hpp index 7fff0f38b..d88bd4542 100644 --- a/src/sector.hpp +++ b/src/sector.hpp @@ -49,7 +49,8 @@ class CollisionHit; enum MusicType { LEVEL_MUSIC, - HERRING_MUSIC + HERRING_MUSIC, + HERRING_WARNING_MUSIC }; /** -- 2.11.0