mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 11:23:52 +00:00
parent
f0c5d1a7e1
commit
b28dfa94cd
2 changed files with 44 additions and 21 deletions
|
@ -845,36 +845,46 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if(!paused)
|
if(!paused)
|
||||||
{
|
{
|
||||||
// Update actors from previous frame
|
// Reset data from previous frame
|
||||||
for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
||||||
{
|
{
|
||||||
// Reset last hit object, which is only valid for one frame
|
// Reset last hit object, which is only valid for one frame
|
||||||
// Note, the new hit object for this frame may be set by CharacterController::update -> Animation::runAnimation
|
// Note, the new hit object for this frame may be set by CharacterController::update -> Animation::runAnimation
|
||||||
// (below)
|
// (below)
|
||||||
iter->first.getClass().getCreatureStats(iter->first).setLastHitObject(std::string());
|
iter->first.getClass().getCreatureStats(iter->first).setLastHitObject(std::string());
|
||||||
|
}
|
||||||
|
|
||||||
// AI and magic effects update
|
// AI and magic effects update
|
||||||
|
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||||
|
{
|
||||||
if (!iter->first.getClass().getCreatureStats(iter->first).isDead())
|
if (!iter->first.getClass().getCreatureStats(iter->first).isDead())
|
||||||
{
|
{
|
||||||
updateActor(iter->first, duration);
|
updateActor(iter->first, duration);
|
||||||
if(iter->first.getTypeName() == typeid(ESM::NPC).name())
|
if(iter->first.getTypeName() == typeid(ESM::NPC).name())
|
||||||
updateNpc(iter->first, duration, paused);
|
updateNpc(iter->first, duration, paused);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Looping magic VFX update
|
// Looping magic VFX update
|
||||||
// Note: we need to do this before any of the animations are updated.
|
// Note: we need to do this before any of the animations are updated.
|
||||||
// Reaching the text keys may trigger Hit / Spellcast (and as such, particles),
|
// Reaching the text keys may trigger Hit / Spellcast (and as such, particles),
|
||||||
// so updating VFX immediately after that would just remove the particle effects instantly.
|
// so updating VFX immediately after that would just remove the particle effects instantly.
|
||||||
// There needs to be a magic effect update in between.
|
// There needs to be a magic effect update in between.
|
||||||
|
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||||
iter->second->updateContinuousVfx();
|
iter->second->updateContinuousVfx();
|
||||||
|
|
||||||
// Animation/movement update
|
// Animation/movement update
|
||||||
|
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||||
|
{
|
||||||
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
||||||
ESM::MagicEffect::Paralyze).mMagnitude > 0)
|
ESM::MagicEffect::Paralyze).mMagnitude > 0)
|
||||||
iter->second->skipAnim();
|
iter->second->skipAnim();
|
||||||
iter->second->update(duration);
|
iter->second->update(duration);
|
||||||
|
}
|
||||||
|
|
||||||
// Kill dead actors
|
// Kill dead actors
|
||||||
|
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++)
|
||||||
|
{
|
||||||
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
||||||
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
||||||
|
|
||||||
|
@ -902,8 +912,13 @@ namespace MWMechanics
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::ActiveSpells& spells = iter->first.getClass().getCreatureStats(iter->first).getActiveSpells();
|
// Make sure spell effects with CasterLinked flag are removed
|
||||||
|
// TODO: would be nice not to do this all the time...
|
||||||
|
for(PtrControllerMap::iterator iter2(mActors.begin());iter2 != mActors.end();++iter2)
|
||||||
|
{
|
||||||
|
MWMechanics::ActiveSpells& spells = iter2->first.getClass().getCreatureStats(iter2->first).getActiveSpells();
|
||||||
spells.purge(iter->first.getRefData().getHandle());
|
spells.purge(iter->first.getRefData().getHandle());
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: see http://bugs.openmw.org/issues/869
|
// FIXME: see http://bugs.openmw.org/issues/869
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(iter->first, false);
|
MWBase::Environment::get().getWorld()->enableActorCollision(iter->first, false);
|
||||||
|
|
|
@ -134,6 +134,8 @@ namespace MWWorld
|
||||||
|
|
||||||
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
||||||
|
|
||||||
|
if (sneak == true)
|
||||||
|
{
|
||||||
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
// Find all the actors who might be able to see the player
|
// Find all the actors who might be able to see the player
|
||||||
|
@ -141,10 +143,16 @@ namespace MWWorld
|
||||||
MWBase::Environment::get().getMechanicsManager()->getActorsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
|
MWBase::Environment::get().getMechanicsManager()->getActorsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
|
||||||
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
|
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
|
||||||
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||||
|
{
|
||||||
if ( MWBase::Environment::get().getMechanicsManager()->awarenessCheck(ptr, *it) )
|
if ( MWBase::Environment::get().getMechanicsManager()->awarenessCheck(ptr, *it) )
|
||||||
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
{
|
||||||
if (!neighbors.size())
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(false);
|
||||||
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (neighbors.size() == 0)
|
||||||
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::yaw(float yaw)
|
void Player::yaw(float yaw)
|
||||||
|
|
Loading…
Reference in a new issue