forked from teamnwah/openmw-tes3coop
animation updates were hooked up to the wrong update function
This commit is contained in:
parent
0c2de2c00c
commit
16bc374921
9 changed files with 35 additions and 36 deletions
|
@ -147,7 +147,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
mEnvironment.mWorld->advanceTime (
|
mEnvironment.mWorld->advanceTime (
|
||||||
mEnvironment.mFrameDuration*mEnvironment.mWorld->getTimeScaleFactor()/3600);
|
mEnvironment.mFrameDuration*mEnvironment.mWorld->getTimeScaleFactor()/3600);
|
||||||
|
|
||||||
|
|
||||||
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
||||||
mEnvironment.mWorld->markCellAsUnchanged();
|
mEnvironment.mWorld->markCellAsUnchanged();
|
||||||
|
|
||||||
|
@ -158,6 +158,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
||||||
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
||||||
|
|
||||||
|
// update world
|
||||||
|
mEnvironment.mWorld->update (evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// report focus object (for debugging)
|
// report focus object (for debugging)
|
||||||
if (mReportFocus)
|
if (mReportFocus)
|
||||||
updateFocusReport (mEnvironment.mFrameDuration);
|
updateFocusReport (mEnvironment.mFrameDuration);
|
||||||
|
@ -343,7 +346,7 @@ void OMW::Engine::go()
|
||||||
// Set up the GUI system
|
// Set up the GUI system
|
||||||
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false,
|
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false,
|
||||||
mCfgMgr.getLogPath().string() + std::string("/"));
|
mCfgMgr.getLogPath().string() + std::string("/"));
|
||||||
|
|
||||||
|
|
||||||
// Create window manager - this manages all the MW-specific GUI windows
|
// Create window manager - this manages all the MW-specific GUI windows
|
||||||
MWScript::registerExtensions (mExtensions);
|
MWScript::registerExtensions (mExtensions);
|
||||||
|
|
|
@ -12,15 +12,11 @@ void Actors::setMwRoot(Ogre::SceneNode* root){
|
||||||
mMwRoot = root;
|
mMwRoot = root;
|
||||||
}
|
}
|
||||||
void Actors::insertNPC(const MWWorld::Ptr& ptr){
|
void Actors::insertNPC(const MWWorld::Ptr& ptr){
|
||||||
|
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend);
|
NpcAnimation* anim = new MWRender::NpcAnimation(ptr, mEnvironment, mRend);
|
||||||
|
|
||||||
//
|
mAllActors[ptr] = anim;
|
||||||
|
|
||||||
mAllActors[ptr] = anim;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||||
Ogre::SceneNode* cellnode;
|
Ogre::SceneNode* cellnode;
|
||||||
|
@ -61,7 +57,7 @@ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||||
|
|
||||||
}
|
}
|
||||||
void Actors::insertCreature (const MWWorld::Ptr& ptr){
|
void Actors::insertCreature (const MWWorld::Ptr& ptr){
|
||||||
|
|
||||||
insertBegin(ptr, true, true);
|
insertBegin(ptr, true, true);
|
||||||
CreatureAnimation* anim = new MWRender::CreatureAnimation(ptr, mEnvironment, mRend);
|
CreatureAnimation* anim = new MWRender::CreatureAnimation(ptr, mEnvironment, mRend);
|
||||||
//mAllActors.insert(std::pair<MWWorld::Ptr, Animation*>(ptr,anim));
|
//mAllActors.insert(std::pair<MWWorld::Ptr, Animation*>(ptr,anim));
|
||||||
|
@ -75,7 +71,7 @@ bool Actors::deleteObject (const MWWorld::Ptr& ptr)
|
||||||
mAllActors.erase(ptr);
|
mAllActors.erase(ptr);
|
||||||
if (Ogre::SceneNode *base = ptr.getRefData().getBaseNode())
|
if (Ogre::SceneNode *base = ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
|
|
||||||
Ogre::SceneNode *parent = base->getParentSceneNode();
|
Ogre::SceneNode *parent = base->getParentSceneNode();
|
||||||
|
|
||||||
for (std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *>::const_iterator iter (
|
for (std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *>::const_iterator iter (
|
||||||
|
@ -110,7 +106,7 @@ void Actors::removeCell(MWWorld::Ptr::CellStore* store){
|
||||||
mAllActors.erase(iter);
|
mAllActors.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number){
|
void Actors::playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number){
|
||||||
|
@ -121,10 +117,9 @@ void Actors::skipAnimation (const MWWorld::Ptr& ptr){
|
||||||
if(mAllActors.find(ptr) != mAllActors.end())
|
if(mAllActors.find(ptr) != mAllActors.end())
|
||||||
mAllActors[ptr]->stopScript();
|
mAllActors[ptr]->stopScript();
|
||||||
}
|
}
|
||||||
void Actors::addTime(){
|
void Actors::update (float duration){
|
||||||
//std::cout << "Adding time in actors\n";
|
|
||||||
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++)
|
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++)
|
||||||
{
|
{
|
||||||
(iter->second)->runAnimation(mEnvironment.mFrameDuration);
|
(iter->second)->runAnimation(duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace MWRender{
|
||||||
MWWorld::Environment& mEnvironment;
|
MWWorld::Environment& mEnvironment;
|
||||||
std::map<MWWorld::Ptr, Animation*> mAllActors;
|
std::map<MWWorld::Ptr, Animation*> mAllActors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){}
|
Actors(OEngine::Render::OgreRenderer& _rend, MWWorld::Environment& _env): mRend(_rend), mEnvironment(_env){}
|
||||||
|
@ -52,8 +52,8 @@ namespace MWRender{
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
/// references that are currently not in the rendered scene should be ignored.
|
||||||
|
|
||||||
void addTime();
|
void update (float duration);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -121,7 +121,7 @@ void RenderingManager::moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Ve
|
||||||
|
|
||||||
void RenderingManager::update (float duration){
|
void RenderingManager::update (float duration){
|
||||||
|
|
||||||
|
mActors.update (duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::skyEnable ()
|
void RenderingManager::skyEnable ()
|
||||||
|
@ -240,9 +240,5 @@ void RenderingManager::skipAnimation (const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
mActors.skipAnimation(ptr);
|
mActors.skipAnimation(ptr);
|
||||||
}
|
}
|
||||||
void RenderingManager::addTime(){
|
|
||||||
mActors.addTime();
|
|
||||||
//Notify each animation that time has passed
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,14 +105,12 @@ class RenderingManager: private RenderingInterface {
|
||||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
/// references that are currently not in the rendered scene should be ignored.
|
||||||
|
|
||||||
void addTime();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setAmbientMode();
|
void setAmbientMode();
|
||||||
SkyManager* mSkyManager;
|
SkyManager* mSkyManager;
|
||||||
OEngine::Render::OgreRenderer &mRendering;
|
OEngine::Render::OgreRenderer &mRendering;
|
||||||
|
|
||||||
MWRender::Objects mObjects;
|
MWRender::Objects mObjects;
|
||||||
MWRender::Actors mActors;
|
MWRender::Actors mActors;
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ void insertCellRefList(MWRender::RenderingManager& rendering, MWWorld::Environme
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
void Scene::advanceTime(){
|
void Scene::update (float duration){
|
||||||
mRendering.addTime();
|
mRendering.update (duration);
|
||||||
}
|
}
|
||||||
void Scene::unloadCell (CellStoreCollection::iterator iter)
|
void Scene::unloadCell (CellStoreCollection::iterator iter)
|
||||||
{
|
{
|
||||||
|
@ -61,9 +61,9 @@ namespace MWWorld
|
||||||
ListHandles functor;
|
ListHandles functor;
|
||||||
|
|
||||||
MWWorld::Ptr::CellStore* active = *iter;
|
MWWorld::Ptr::CellStore* active = *iter;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
active->forEach<ListHandles>(functor);
|
active->forEach<ListHandles>(functor);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace MWWorld
|
||||||
mEnvironment.mMechanicsManager->dropActors (active);
|
mEnvironment.mMechanicsManager->dropActors (active);
|
||||||
mEnvironment.mSoundManager->stopSound (active);
|
mEnvironment.mSoundManager->stopSound (active);
|
||||||
mActiveCells.erase(active);
|
mActiveCells.erase(active);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::loadCell (Ptr::CellStore *cell)
|
void Scene::loadCell (Ptr::CellStore *cell)
|
||||||
|
|
|
@ -101,7 +101,8 @@ namespace MWWorld
|
||||||
void markCellAsUnchanged();
|
void markCellAsUnchanged();
|
||||||
|
|
||||||
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, MWWorld::Environment& environment);
|
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, MWWorld::Environment& environment);
|
||||||
void advanceTime();
|
|
||||||
|
void update (float duration);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,14 +348,13 @@ namespace MWWorld
|
||||||
void World::advanceTime (double hours)
|
void World::advanceTime (double hours)
|
||||||
{
|
{
|
||||||
hours += mGlobalVariables->getFloat ("gamehour");
|
hours += mGlobalVariables->getFloat ("gamehour");
|
||||||
|
|
||||||
setHour (hours);
|
setHour (hours);
|
||||||
|
|
||||||
int days = hours / 24;
|
int days = hours / 24;
|
||||||
|
|
||||||
if (days>0)
|
if (days>0)
|
||||||
mGlobalVariables->setInt ("dayspassed", days + mGlobalVariables->getInt ("dayspassed"));
|
mGlobalVariables->setInt ("dayspassed", days + mGlobalVariables->getInt ("dayspassed"));
|
||||||
mWorldScene->advanceTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setHour (double hour)
|
void World::setHour (double hour)
|
||||||
|
@ -691,4 +690,9 @@ namespace MWWorld
|
||||||
void World::setObjectPhysicsPosition(const std::string& handle, Ogre::Vector3 vec){
|
void World::setObjectPhysicsPosition(const std::string& handle, Ogre::Vector3 vec){
|
||||||
mPhysics->moveObject(handle, vec);
|
mPhysics->moveObject(handle, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::update (float duration)
|
||||||
|
{
|
||||||
|
mWorldScene->update (duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,8 @@ namespace MWWorld
|
||||||
/// references that are currently not in the rendered scene should be ignored.
|
/// references that are currently not in the rendered scene should be ignored.
|
||||||
void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat);
|
void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat);
|
||||||
void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector);
|
void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector);
|
||||||
|
|
||||||
|
void update (float duration);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue