Add nice little race end fanfare and race summary song by Dundersylt
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8648 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
47d03595de
commit
c5ddfb1d6d
@ -482,25 +482,29 @@ void SFXManager::positionListener(const Vec3 &position, const Vec3 &front)
|
||||
/** Positional sound is cool, but creating a new object just to play a simple
|
||||
* menu sound is not. This function allows for 'quick sounds' in a single call.
|
||||
* \param sound_type Internal name of the sfx to play.
|
||||
* \return a pointer to the sound, for instance to check when the sound finished.
|
||||
* don't delete the returned pointer.
|
||||
*/
|
||||
|
||||
void SFXManager::quickSound(const std::string &sound_type)
|
||||
SFXBase* SFXManager::quickSound(const std::string &sound_type)
|
||||
{
|
||||
if(!sfxAllowed()) return;
|
||||
if (!sfxAllowed()) return NULL;
|
||||
std::map<std::string, SFXBase*>::iterator sound = m_quick_sounds.find(sound_type);
|
||||
|
||||
if (sound == m_quick_sounds.end())
|
||||
{
|
||||
// sound not yet in our local list of quick sounds
|
||||
SFXBase* newSound = sfx_manager->createSoundSource(sound_type, false);
|
||||
if (newSound == NULL) return NULL;
|
||||
newSound->play();
|
||||
m_quick_sounds[sound_type] = newSound;
|
||||
return newSound;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*sound).second->play();
|
||||
return (*sound).second;
|
||||
}
|
||||
|
||||
|
||||
// m_locked_sound = sfx_manager->newSFX(SFXManager::SOUND_LOCKED);
|
||||
// m_locked_sound->play();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
static const std::string getErrorString(int err);
|
||||
|
||||
void positionListener(const Vec3 &position, const Vec3 &front);
|
||||
void quickSound(const std::string &soundName);
|
||||
SFXBase* quickSound(const std::string &soundName);
|
||||
|
||||
/** Called when sound was muted/unmuted */
|
||||
void soundToggled(const bool newValue);
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "states_screens/race_result_gui.hpp"
|
||||
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
@ -55,6 +57,9 @@ void RaceResultGUI::init()
|
||||
getWidget("top")->setVisible(false);
|
||||
getWidget("middle")->setVisible(false);
|
||||
getWidget("bottom")->setVisible(false);
|
||||
|
||||
music_manager->stopMusic();
|
||||
m_finish_sound = sfx_manager->quickSound("race_finish");
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -374,6 +379,11 @@ GUIEngine::EventPropagation RaceResultGUI::filterActions(PlayerAction action,
|
||||
void RaceResultGUI::onUpdate(float dt, irr::video::IVideoDriver*)
|
||||
{
|
||||
renderGlobal(dt);
|
||||
|
||||
if (m_finish_sound != NULL && m_finish_sound->getStatus() != SFXManager::SFX_PLAYING)
|
||||
{
|
||||
music_manager->startMusic( music_manager->getMusicInformation("race_summary.music") );
|
||||
}
|
||||
} // onUpdate
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -160,6 +160,8 @@ private:
|
||||
/** The previous monospace state of the font. */
|
||||
bool m_was_monospace;
|
||||
|
||||
SFXBase* m_finish_sound;
|
||||
|
||||
void displayOneEntry(unsigned int x, unsigned int y,
|
||||
unsigned int n, bool display_points);
|
||||
void determineTableLayout();
|
||||
|
Loading…
x
Reference in New Issue
Block a user