mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:53:50 +00:00
Merge branch 'movement' of git://github.com/zinnschlag/openmw.git into collisions
This commit is contained in:
commit
53252897e9
5 changed files with 63 additions and 3 deletions
|
@ -125,6 +125,7 @@ set(GAMEWORLD
|
||||||
mwworld/actiontake.cpp
|
mwworld/actiontake.cpp
|
||||||
mwworld/containerutil.cpp
|
mwworld/containerutil.cpp
|
||||||
mwworld/player.cpp
|
mwworld/player.cpp
|
||||||
|
mwworld/doingphysics.cpp
|
||||||
)
|
)
|
||||||
set(GAMEWORLD_HEADER
|
set(GAMEWORLD_HEADER
|
||||||
mwworld/refdata.hpp
|
mwworld/refdata.hpp
|
||||||
|
@ -143,6 +144,7 @@ set(GAMEWORLD_HEADER
|
||||||
mwworld/manualref.hpp
|
mwworld/manualref.hpp
|
||||||
mwworld/containerutil.hpp
|
mwworld/containerutil.hpp
|
||||||
mwworld/player.hpp
|
mwworld/player.hpp
|
||||||
|
mwworld/doingphysics.hpp
|
||||||
)
|
)
|
||||||
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/doingphysics.hpp"
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
|
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
@ -100,6 +101,8 @@ std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
|
||||||
|
|
||||||
void MWScene::doPhysics (float duration, MWWorld::World& world)
|
void MWScene::doPhysics (float duration, MWWorld::World& world)
|
||||||
{
|
{
|
||||||
|
// stop changes to world from being reported back to the physics system
|
||||||
|
MWWorld::DoingPhysics scopeGuard;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
apps/openmw/mwworld/doingphysics.cpp
Normal file
22
apps/openmw/mwworld/doingphysics.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
#include "doingphysics.hpp"
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
int DoingPhysics::sCounter = 0;
|
||||||
|
|
||||||
|
DoingPhysics::DoingPhysics()
|
||||||
|
{
|
||||||
|
++sCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
DoingPhysics::~DoingPhysics()
|
||||||
|
{
|
||||||
|
--sCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DoingPhysics::isDoingPhysics()
|
||||||
|
{
|
||||||
|
return sCounter>0;
|
||||||
|
}
|
||||||
|
}
|
26
apps/openmw/mwworld/doingphysics.hpp
Normal file
26
apps/openmw/mwworld/doingphysics.hpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef GAME_MWWORLD_DOINGPHYSICS_H
|
||||||
|
#define GAME_MWWORLD_DOINGPHYSICS_H
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
///< Scope guard for blocking physics updates during physics simulation.
|
||||||
|
class DoingPhysics
|
||||||
|
{
|
||||||
|
static int sCounter;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
DoingPhysics (const DoingPhysics&);
|
||||||
|
DoingPhysics& operator= (const DoingPhysics&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DoingPhysics();
|
||||||
|
|
||||||
|
~DoingPhysics();
|
||||||
|
|
||||||
|
static bool isDoingPhysics();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
#include "doingphysics.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -745,14 +746,17 @@ namespace MWWorld
|
||||||
|
|
||||||
if (MWRender::CellRender *render = searchRender (ptr.getCell()))
|
if (MWRender::CellRender *render = searchRender (ptr.getCell()))
|
||||||
{
|
{
|
||||||
render->deleteObject (ptr.getRefData().getHandle());
|
|
||||||
ptr.getRefData().setHandle ("");
|
|
||||||
|
|
||||||
if (mActiveCells.find (ptr.getCell())!=mActiveCells.end())
|
if (mActiveCells.find (ptr.getCell())!=mActiveCells.end())
|
||||||
{
|
{
|
||||||
Class::get (ptr).disable (ptr, mEnvironment);
|
Class::get (ptr).disable (ptr, mEnvironment);
|
||||||
mEnvironment.mSoundManager->stopSound3D (ptr);
|
mEnvironment.mSoundManager->stopSound3D (ptr);
|
||||||
|
|
||||||
|
if (!DoingPhysics::isDoingPhysics())
|
||||||
|
mScene.removeObject (ptr.getRefData().getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render->deleteObject (ptr.getRefData().getHandle());
|
||||||
|
ptr.getRefData().setHandle ("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,6 +782,9 @@ namespace MWWorld
|
||||||
if (mCurrentCell->cell->data.gridX!=cellX || mCurrentCell->cell->data.gridY!=cellY)
|
if (mCurrentCell->cell->data.gridX!=cellX || mCurrentCell->cell->data.gridY!=cellY)
|
||||||
{
|
{
|
||||||
changeCell (cellX, cellY, mPlayer->getPlayer().getCellRef().pos);
|
changeCell (cellX, cellY, mPlayer->getPlayer().getCellRef().pos);
|
||||||
|
|
||||||
|
if (!DoingPhysics::isDoingPhysics())
|
||||||
|
mScene.moveObject (ptr.getRefData().getHandle(), Ogre::Vector3 (x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue