From 3c02e1ccc9f82a7ede31a0634a5688aec359216a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 16 Jan 2013 08:22:38 -0800 Subject: [PATCH] Run physics right after updating the actors --- apps/openmw/engine.cpp | 6 +----- apps/openmw/mwbase/mechanicsmanager.hpp | 3 +-- apps/openmw/mwmechanics/actors.cpp | 6 ++++-- apps/openmw/mwmechanics/actors.hpp | 3 +-- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 5 ++--- apps/openmw/mwmechanics/mechanicsmanagerimp.hpp | 3 +-- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index e6296ab96..b1554fc75 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -96,13 +96,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt) MWBase::Environment::get().getWorld()->markCellAsUnchanged(); // update actors - std::vector > movement; - MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(), + MWBase::Environment::get().getMechanicsManager()->update(mEnvironment.getFrameDuration(), MWBase::Environment::get().getWindowManager()->isGuiMode()); - if (!MWBase::Environment::get().getWindowManager()->isGuiMode()) - MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration()); - // update world MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame, MWBase::Environment::get().getWindowManager()->isGuiMode()); diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index a1023c986..55eb729a4 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -52,8 +52,7 @@ namespace MWBase ///< On each update look for changes in a previously registered actor and update the /// GUI accordingly. - virtual void update (std::vector >& movement, - float duration, bool paused) = 0; + virtual void update (float duration, bool paused) = 0; ///< Update actor stats and store desired velocity vectors in \a movement /// /// \param paused In game type does not currently advance (this usually means some GUI diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 4eae6e213..485d7448b 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -193,8 +193,7 @@ namespace MWMechanics } } - void Actors::update (std::vector >& movement, float duration, - bool paused) + void Actors::update (float duration, bool paused) { mDuration += duration; @@ -257,12 +256,15 @@ namespace MWMechanics } } + std::vector > movement; for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter) { Ogre::Vector3 vector = MWWorld::Class::get(iter->first).getMovementVector(iter->first); if(vector!=Ogre::Vector3::ZERO) movement.push_back(std::make_pair(iter->first.getRefData().getHandle(), vector)); } + if (!paused) + MWBase::Environment::get().getWorld()->doPhysics (movement, duration); } void Actors::restoreDynamicStats() diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index f1e5ab437..faf21a12f 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -56,8 +56,7 @@ namespace MWMechanics void dropActors (const MWWorld::CellStore *cellStore); ///< Deregister all actors in the given cell. - void update (std::vector >& movement, - float duration, bool paused); + void update (float duration, bool paused); ///< Update actor stats and store desired velocity vectors in \a movement void updateActor (const MWWorld::Ptr& ptr, float duration); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index dae417d44..3b57c3485 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -201,8 +201,7 @@ namespace MWMechanics mWatched = ptr; } - void MechanicsManager::update (std::vector >& movement, - float duration, bool paused) + void MechanicsManager::update (float duration, bool paused) { if (!mWatched.isEmpty()) { @@ -298,7 +297,7 @@ namespace MWMechanics winMgr->configureSkills (majorSkills, minorSkills); } - mActors.update (movement, duration, paused); + mActors.update (duration, paused); } void MechanicsManager::restoreDynamicStats() diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index d3a97db36..0efe12f32 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -54,8 +54,7 @@ namespace MWMechanics ///< On each update look for changes in a previously registered actor and update the /// GUI accordingly. - virtual void update (std::vector >& movement, - float duration, bool paused); + virtual void update (float duration, bool paused); ///< Update actor stats and store desired velocity vectors in \a movement /// /// \param paused In game type does not currently advance (this usually means some GUI