forked from teamnwah/openmw-tes3coop
Added code to play music on level up and on death
This commit is contained in:
parent
d4007ad89e
commit
06e683d378
3 changed files with 14 additions and 5 deletions
|
@ -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)
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace MWMechanics
|
||||||
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer)
|
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer)
|
||||||
{
|
{
|
||||||
CreatureStats& creatureStats = actor1.getClass().getCreatureStats(actor1);
|
CreatureStats& creatureStats = actor1.getClass().getCreatureStats(actor1);
|
||||||
|
|
||||||
if (actor2.getClass().getCreatureStats(actor2).isDead()
|
if (actor2.getClass().getCreatureStats(actor2).isDead()
|
||||||
|| actor1.getClass().getCreatureStats(actor1).isDead())
|
|| actor1.getClass().getCreatureStats(actor1).isDead())
|
||||||
return;
|
return;
|
||||||
|
@ -296,7 +296,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool aggressive;
|
bool aggressive;
|
||||||
|
|
||||||
if (againstPlayer)
|
if (againstPlayer)
|
||||||
{
|
{
|
||||||
// followers with high fight should not engage in combat with the player (e.g. bm_bear_black_summon)
|
// followers with high fight should not engage in combat with the player (e.g. bm_bear_black_summon)
|
||||||
const std::list<MWWorld::Ptr>& followers = getActorsFollowing(actor2);
|
const std::list<MWWorld::Ptr>& followers = getActorsFollowing(actor2);
|
||||||
|
@ -1096,7 +1096,7 @@ namespace MWMechanics
|
||||||
void Actors::update (float duration, bool paused)
|
void Actors::update (float duration, bool paused)
|
||||||
{
|
{
|
||||||
if(!paused)
|
if(!paused)
|
||||||
{
|
{
|
||||||
static float timerUpdateAITargets = 0;
|
static float timerUpdateAITargets = 0;
|
||||||
|
|
||||||
// target lists get updated once every 1.0 sec
|
// target lists get updated once every 1.0 sec
|
||||||
|
@ -1207,12 +1207,13 @@ 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;
|
||||||
}
|
}
|
||||||
else if (!isBattleMusic && hostilesCount > 0)
|
else if (!isBattleMusic && hostilesCount > 0)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Battle"));
|
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Battle"));
|
||||||
isBattleMusic = true;
|
isBattleMusic = true;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue