1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Added code to play music on level up and on death

This commit is contained in:
Ragora 2014-09-14 16:29:06 -04:00
parent d4007ad89e
commit 06e683d378
3 changed files with 14 additions and 5 deletions

View file

@ -5,6 +5,7 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/fallback.hpp" #include "../mwworld/fallback.hpp"
@ -191,6 +192,9 @@ namespace MWGui
setAttributeValues(); setAttributeValues();
center(); center();
// Play LevelUp Music
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Triumph.mp3");
} }
void LevelupDialog::onOkButtonClicked(MyGUI::Widget* sender) void LevelupDialog::onOkButtonClicked(MyGUI::Widget* sender)

View file

@ -1207,7 +1207,8 @@ namespace MWMechanics
// check if we still have any player enemies to switch music // check if we still have any player enemies to switch music
static bool isBattleMusic = false; static bool isBattleMusic = false;
if (isBattleMusic && hostilesCount == 0) if (isBattleMusic && hostilesCount == 0 && !(player.getClass().getCreatureStats(player).isDead() &&
MWBase::Environment::get().getSoundManager()->isMusicPlaying()))
{ {
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Explore")); MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Explore"));
isBattleMusic = false; isBattleMusic = false;

View file

@ -1634,6 +1634,10 @@ bool CharacterController::kill()
mIdleState = CharState_None; mIdleState = CharState_None;
mCurrentIdle.clear(); mCurrentIdle.clear();
// Play Death Music if it was the player dying
if(mPtr.getRefData().getHandle()=="player")
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Death.mp3");
return true; return true;
} }