Swimming working

This commit is contained in:
Jason Hooks 2012-04-18 00:13:38 -04:00
parent 5f9056c45d
commit 4d07ae7fe0
4 changed files with 16 additions and 5 deletions

View file

@ -67,6 +67,13 @@ namespace MWWorld
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)
{

View file

@ -50,6 +50,8 @@ namespace MWWorld
OEngine::Physic::PhysicEngine* getEngine();
void setCurrentWater(bool hasWater, int waterHeight);
private:
OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine;

View file

@ -117,6 +117,8 @@ namespace MWWorld
void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position,
bool adjustPlayerPos)
{
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->water);
if (adjustPlayerPos)
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);

View file

@ -1715,11 +1715,11 @@ void PM_SetWaterLevel( playerMove* const pm )
point[1] = pm->ps->origin[1];
point[2] = pm->ps->origin[2] + MINS_Z + 1; */
point.x = pm->ps.origin.x;
point.y = pm->ps.origin.y + MINS_Z + 1;
point.z = pm->ps.origin.z;
point.y = pm->ps.origin.y;
point.z = pm->ps.origin.z + MINS_Z + 1;
//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 ( checkWater)
{
@ -1729,14 +1729,14 @@ void PM_SetWaterLevel( playerMove* const pm )
pm->ps.watertype = CONTENTS_WATER;//cont;
pm->ps.waterlevel = WL_ANKLE;
//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 );
//if ( cont & MASK_WATER )
if (checkWater)
{
pm->ps.waterlevel = WL_WAIST;
//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 );
//if ( cont & MASK_WATER )
if (checkWater )