forked from teamnwah/openmw-tes3coop
Run physics right after updating the actors
This commit is contained in:
parent
1ce8eaf52c
commit
3c02e1ccc9
6 changed files with 10 additions and 16 deletions
|
@ -96,13 +96,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
||||
|
||||
// update actors
|
||||
std::vector<std::pair<std::string, Ogre::Vector3> > 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());
|
||||
|
||||
|
|
|
@ -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<std::pair<std::string, Ogre::Vector3> >& 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
|
||||
|
|
|
@ -193,8 +193,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
void Actors::update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement, float duration,
|
||||
bool paused)
|
||||
void Actors::update (float duration, bool paused)
|
||||
{
|
||||
mDuration += duration;
|
||||
|
||||
|
@ -257,12 +256,15 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, Ogre::Vector3> > 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()
|
||||
|
|
|
@ -56,8 +56,7 @@ namespace MWMechanics
|
|||
void dropActors (const MWWorld::CellStore *cellStore);
|
||||
///< Deregister all actors in the given cell.
|
||||
|
||||
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& 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);
|
||||
|
|
|
@ -201,8 +201,7 @@ namespace MWMechanics
|
|||
mWatched = ptr;
|
||||
}
|
||||
|
||||
void MechanicsManager::update (std::vector<std::pair<std::string, Ogre::Vector3> >& 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()
|
||||
|
|
|
@ -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<std::pair<std::string, Ogre::Vector3> >& 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
|
||||
|
|
Loading…
Reference in a new issue