mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 15:36:41 +00:00
pasing movement data from mwmechanics to mwscene and fixed a very stupid interface bug
This commit is contained in:
parent
40d772b33a
commit
ca44b3640a
7 changed files with 27 additions and 9 deletions
|
@ -6,6 +6,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include <OgreVector3.h>
|
||||||
|
|
||||||
#include "components/esm/records.hpp"
|
#include "components/esm/records.hpp"
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
#include <components/misc/fileops.hpp>
|
#include <components/misc/fileops.hpp>
|
||||||
|
@ -158,7 +160,8 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
mEnvironment.mWorld->markCellAsUnchanged();
|
mEnvironment.mWorld->markCellAsUnchanged();
|
||||||
|
|
||||||
// update actors
|
// update actors
|
||||||
mEnvironment.mMechanicsManager->update();
|
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
|
||||||
|
mEnvironment.mMechanicsManager->update (movement);
|
||||||
|
|
||||||
if (focusFrameCounter++ == focusUpdateFrame)
|
if (focusFrameCounter++ == focusUpdateFrame)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +183,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
focusFrameCounter = 0;
|
focusFrameCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mEnvironment.mWorld->doPhysics (mEnvironment.mFrameDuration);
|
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,7 +255,7 @@ namespace MWMechanics
|
||||||
mWatched = ptr;
|
mWatched = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::update()
|
void MechanicsManager::update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement)
|
||||||
{
|
{
|
||||||
if (!mWatched.isEmpty())
|
if (!mWatched.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,12 +2,19 @@
|
||||||
#define GAME_MWMECHANICS_MECHANICSMANAGER_H
|
#define GAME_MWMECHANICS_MECHANICSMANAGER_H
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
#include "npcstats.hpp"
|
#include "npcstats.hpp"
|
||||||
|
|
||||||
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class Vector3;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Environment;
|
class Environment;
|
||||||
|
@ -53,8 +60,8 @@ 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.
|
||||||
|
|
||||||
void update();
|
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement);
|
||||||
///< Update actor stats
|
///< Update actor stats and store desired velocity vectors in \a movement
|
||||||
|
|
||||||
void setPlayerName (const std::string& name);
|
void setPlayerName (const std::string& name);
|
||||||
///< Set player name.
|
///< Set player name.
|
||||||
|
|
|
@ -106,7 +106,7 @@ void MWScene::doPhysics (float duration, MWWorld::World& world)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWScene::setMovement (const std::vector<std::string, Ogre::Vector3>& actors)
|
void MWScene::setMovement (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace MWRender
|
||||||
|
|
||||||
/// Inform phyiscs system about desired velocity vectors for actors
|
/// Inform phyiscs system about desired velocity vectors for actors
|
||||||
/// (in Morrowind coordinates).
|
/// (in Morrowind coordinates).
|
||||||
void setMovement (const std::vector<std::string, Ogre::Vector3>& actors);
|
void setMovement (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
|
||||||
|
|
||||||
/// Add object to physics system.
|
/// Add object to physics system.
|
||||||
void addObject (const std::string& handle, const std::string& mesh,
|
void addObject (const std::string& handle, const std::string& mesh,
|
||||||
|
|
|
@ -834,8 +834,10 @@ namespace MWWorld
|
||||||
--cellY;
|
--cellY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::doPhysics (float duration)
|
void World::doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
|
||||||
|
float duration)
|
||||||
{
|
{
|
||||||
|
mScene.setMovement (actors);
|
||||||
mScene.doPhysics (duration, *this);
|
mScene.doPhysics (duration, *this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
|
||||||
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class Vector3;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
struct Position;
|
struct Position;
|
||||||
|
@ -163,7 +168,8 @@ namespace MWWorld
|
||||||
void positionToIndex (float x, float y, int &cellX, int &cellY) const;
|
void positionToIndex (float x, float y, int &cellX, int &cellY) const;
|
||||||
///< Convert position to cell numbers
|
///< Convert position to cell numbers
|
||||||
|
|
||||||
void doPhysics (float duration);
|
void doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
|
||||||
|
float duration);
|
||||||
///< Run physics simulation and modify \a world accordingly.
|
///< Run physics simulation and modify \a world accordingly.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue