mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Swimming working
This commit is contained in:
parent
5f9056c45d
commit
4d07ae7fe0
@ -67,6 +67,13 @@ namespace MWWorld
|
|||||||
|
|
||||||
return mEngine->rayTest2(from,to);
|
return mEngine->rayTest2(from,to);
|
||||||
}
|
}
|
||||||
|
void PhysicsSystem::setCurrentWater(bool hasWater, int waterHeight){
|
||||||
|
playerphysics->hasWater = hasWater;
|
||||||
|
if(hasWater){
|
||||||
|
playerphysics->waterHeight = waterHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
btVector3 PhysicsSystem::getRayPoint(float extent)
|
btVector3 PhysicsSystem::getRayPoint(float extent)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,8 @@ namespace MWWorld
|
|||||||
void insertActorPhysics(const MWWorld::Ptr&, std::string model);
|
void insertActorPhysics(const MWWorld::Ptr&, std::string model);
|
||||||
|
|
||||||
OEngine::Physic::PhysicEngine* getEngine();
|
OEngine::Physic::PhysicEngine* getEngine();
|
||||||
|
|
||||||
|
void setCurrentWater(bool hasWater, int waterHeight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &mRender;
|
OEngine::Render::OgreRenderer &mRender;
|
||||||
|
@ -117,6 +117,8 @@ namespace MWWorld
|
|||||||
void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position,
|
void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position,
|
||||||
bool adjustPlayerPos)
|
bool adjustPlayerPos)
|
||||||
{
|
{
|
||||||
|
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
||||||
|
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
||||||
if (adjustPlayerPos)
|
if (adjustPlayerPos)
|
||||||
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
|
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
|
||||||
|
|
||||||
|
@ -1715,11 +1715,11 @@ void PM_SetWaterLevel( playerMove* const pm )
|
|||||||
point[1] = pm->ps->origin[1];
|
point[1] = pm->ps->origin[1];
|
||||||
point[2] = pm->ps->origin[2] + MINS_Z + 1; */
|
point[2] = pm->ps->origin[2] + MINS_Z + 1; */
|
||||||
point.x = pm->ps.origin.x;
|
point.x = pm->ps.origin.x;
|
||||||
point.y = pm->ps.origin.y + MINS_Z + 1;
|
point.y = pm->ps.origin.y;
|
||||||
point.z = pm->ps.origin.z;
|
point.z = pm->ps.origin.z + MINS_Z + 1;
|
||||||
|
|
||||||
//cont = pm->pointcontents( point, pm->ps->clientNum );
|
//cont = pm->pointcontents( point, pm->ps->clientNum );
|
||||||
bool checkWater = (pml.hasWater && pml.waterHeight > point.y);
|
bool checkWater = (pml.hasWater && pml.waterHeight > point.z);
|
||||||
//if ( cont & MASK_WATER )
|
//if ( cont & MASK_WATER )
|
||||||
if ( checkWater)
|
if ( checkWater)
|
||||||
{
|
{
|
||||||
@ -1729,14 +1729,14 @@ void PM_SetWaterLevel( playerMove* const pm )
|
|||||||
pm->ps.watertype = CONTENTS_WATER;//cont;
|
pm->ps.watertype = CONTENTS_WATER;//cont;
|
||||||
pm->ps.waterlevel = WL_ANKLE;
|
pm->ps.waterlevel = WL_ANKLE;
|
||||||
//point[2] = pm->ps->origin[2] + MINS_Z + sample1;
|
//point[2] = pm->ps->origin[2] + MINS_Z + sample1;
|
||||||
point.y = pm->ps.origin.y + MINS_Z + sample1;
|
point.z = pm->ps.origin.z + MINS_Z + sample1;
|
||||||
//cont = pm->pointcontents (point, pm->ps->clientNum );
|
//cont = pm->pointcontents (point, pm->ps->clientNum );
|
||||||
//if ( cont & MASK_WATER )
|
//if ( cont & MASK_WATER )
|
||||||
if (checkWater)
|
if (checkWater)
|
||||||
{
|
{
|
||||||
pm->ps.waterlevel = WL_WAIST;
|
pm->ps.waterlevel = WL_WAIST;
|
||||||
//point[2] = pm->ps->origin[2] + MINS_Z + sample2;
|
//point[2] = pm->ps->origin[2] + MINS_Z + sample2;
|
||||||
point.y = pm->ps.origin.y + MINS_Z + sample2;
|
point.z = pm->ps.origin.z + MINS_Z + sample2;
|
||||||
//cont = pm->pointcontents (point, pm->ps->clientNum );
|
//cont = pm->pointcontents (point, pm->ps->clientNum );
|
||||||
//if ( cont & MASK_WATER )
|
//if ( cont & MASK_WATER )
|
||||||
if (checkWater )
|
if (checkWater )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user