forked from teamnwah/openmw-tes3coop
Combat music; some minor combat fixes
This commit is contained in:
parent
698cbba6ef
commit
979128b2c5
2 changed files with 25 additions and 2 deletions
|
@ -970,6 +970,9 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// Kill dead actors, update some variables
|
||||
|
||||
int hostilesCount = 0; // need to know this to play Battle music
|
||||
|
||||
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
||||
{
|
||||
const MWWorld::Class &cls = iter->first.getClass();
|
||||
|
@ -988,6 +991,8 @@ namespace MWMechanics
|
|||
|
||||
if(!stats.isDead())
|
||||
{
|
||||
if (stats.isHostile()) hostilesCount++;
|
||||
|
||||
if(iter->second->isDead())
|
||||
{
|
||||
// Actor has been resurrected. Notify the CharacterController and re-enable collision.
|
||||
|
@ -1045,6 +1050,20 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
// check if we still have any player enemies to switch music
|
||||
static bool isBattleMusic = false;
|
||||
|
||||
if (isBattleMusic && hostilesCount == 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Explore"));
|
||||
isBattleMusic = false;
|
||||
}
|
||||
else if (!isBattleMusic && hostilesCount > 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playPlaylist(std::string("Battle"));
|
||||
isBattleMusic = true;
|
||||
}
|
||||
|
||||
// if player is in sneak state see if anyone detects him
|
||||
if (player.getClass().getCreatureStats(player).getMovementFlag(MWMechanics::CreatureStats::Flag_Sneak))
|
||||
{
|
||||
|
|
|
@ -405,8 +405,6 @@ namespace MWMechanics
|
|||
}
|
||||
else // (within attack dist)
|
||||
{
|
||||
if (!mAttack) mMovement.mPosition[1] = 0;
|
||||
|
||||
if(mMovement.mPosition[0] || mMovement.mPosition[1])
|
||||
{
|
||||
mTimerCombatMove = 0.1f + 0.1f * static_cast<float>(rand())/RAND_MAX;
|
||||
|
@ -501,6 +499,12 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
mMovement.mPosition[1] = 1;
|
||||
if (mReadyToAttack)
|
||||
{
|
||||
// to stop possible sideway moving after target moved out of attack range
|
||||
mCombatMove = true;
|
||||
mTimerCombatMove = 0;
|
||||
}
|
||||
mReadyToAttack = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue