mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 13:23:55 +00:00
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();
|
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
||||||
|
|
||||||
// update actors
|
// update actors
|
||||||
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
|
MWBase::Environment::get().getMechanicsManager()->update(mEnvironment.getFrameDuration(),
|
||||||
MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(),
|
|
||||||
MWBase::Environment::get().getWindowManager()->isGuiMode());
|
MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||||
|
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
||||||
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
|
|
||||||
|
|
||||||
// update world
|
// update world
|
||||||
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame, MWBase::Environment::get().getWindowManager()->isGuiMode());
|
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
|
///< On each update look for changes in a previously registered actor and update the
|
||||||
/// GUI accordingly.
|
/// GUI accordingly.
|
||||||
|
|
||||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
virtual void update (float duration, bool paused) = 0;
|
||||||
float duration, bool paused) = 0;
|
|
||||||
///< Update actor stats and store desired velocity vectors in \a movement
|
///< 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
|
/// \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,
|
void Actors::update (float duration, bool paused)
|
||||||
bool paused)
|
|
||||||
{
|
{
|
||||||
mDuration += duration;
|
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)
|
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 vector = MWWorld::Class::get(iter->first).getMovementVector(iter->first);
|
Ogre::Vector3 vector = MWWorld::Class::get(iter->first).getMovementVector(iter->first);
|
||||||
if(vector!=Ogre::Vector3::ZERO)
|
if(vector!=Ogre::Vector3::ZERO)
|
||||||
movement.push_back(std::make_pair(iter->first.getRefData().getHandle(), vector));
|
movement.push_back(std::make_pair(iter->first.getRefData().getHandle(), vector));
|
||||||
}
|
}
|
||||||
|
if (!paused)
|
||||||
|
MWBase::Environment::get().getWorld()->doPhysics (movement, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::restoreDynamicStats()
|
void Actors::restoreDynamicStats()
|
||||||
|
|
|
@ -56,8 +56,7 @@ namespace MWMechanics
|
||||||
void dropActors (const MWWorld::CellStore *cellStore);
|
void dropActors (const MWWorld::CellStore *cellStore);
|
||||||
///< Deregister all actors in the given cell.
|
///< Deregister all actors in the given cell.
|
||||||
|
|
||||||
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
void update (float duration, bool paused);
|
||||||
float duration, bool paused);
|
|
||||||
///< Update actor stats and store desired velocity vectors in \a movement
|
///< Update actor stats and store desired velocity vectors in \a movement
|
||||||
|
|
||||||
void updateActor (const MWWorld::Ptr& ptr, float duration);
|
void updateActor (const MWWorld::Ptr& ptr, float duration);
|
||||||
|
|
|
@ -201,8 +201,7 @@ namespace MWMechanics
|
||||||
mWatched = ptr;
|
mWatched = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
void MechanicsManager::update (float duration, bool paused)
|
||||||
float duration, bool paused)
|
|
||||||
{
|
{
|
||||||
if (!mWatched.isEmpty())
|
if (!mWatched.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -298,7 +297,7 @@ namespace MWMechanics
|
||||||
winMgr->configureSkills (majorSkills, minorSkills);
|
winMgr->configureSkills (majorSkills, minorSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActors.update (movement, duration, paused);
|
mActors.update (duration, paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::restoreDynamicStats()
|
void MechanicsManager::restoreDynamicStats()
|
||||||
|
|
|
@ -54,8 +54,7 @@ namespace MWMechanics
|
||||||
///< On each update look for changes in a previously registered actor and update the
|
///< On each update look for changes in a previously registered actor and update the
|
||||||
/// GUI accordingly.
|
/// GUI accordingly.
|
||||||
|
|
||||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
virtual void update (float duration, bool paused);
|
||||||
float duration, bool paused);
|
|
||||||
///< Update actor stats and store desired velocity vectors in \a movement
|
///< 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
|
/// \param paused In game type does not currently advance (this usually means some GUI
|
||||||
|
|
Loading…
Reference in a new issue