forked from mirror/openmw-tes3mp
		
	Fix World::isUnderwater to use dynamic waterlevel
This commit is contained in:
		
							parent
							
								
									73d48a95f6
								
							
						
					
					
						commit
						355390429e
					
				
					 4 changed files with 8 additions and 8 deletions
				
			
		|  | @ -288,7 +288,7 @@ namespace MWBase | |||
| 
 | ||||
|             virtual bool isFlying(const MWWorld::Ptr &ptr) const = 0; | ||||
|             virtual bool isSwimming(const MWWorld::Ptr &object) const = 0; | ||||
|             virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const = 0; | ||||
|             virtual bool isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const = 0; | ||||
|             virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0; | ||||
| 
 | ||||
|             virtual void togglePOV() = 0; | ||||
|  |  | |||
|  | @ -381,7 +381,7 @@ void RenderingManager::update (float duration, bool paused) | |||
| 
 | ||||
|         mWater->updateUnderwater( | ||||
|             world->isUnderwater( | ||||
|                 *world->getPlayer().getPlayer().getCell()->mCell, | ||||
|                 world->getPlayer().getPlayer().getCell(), | ||||
|                 Ogre::Vector3(cam.x, -cam.z, cam.y)) | ||||
|         ); | ||||
|         mWater->update(duration); | ||||
|  |  | |||
|  | @ -1411,16 +1411,16 @@ namespace MWWorld | |||
|         const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle()); | ||||
|         if(actor) pos.z += actor->getHalfExtents().z * 1.5; | ||||
| 
 | ||||
|         return isUnderwater(*object.getCell()->mCell, pos); | ||||
|         return isUnderwater(object.getCell(), pos); | ||||
|     } | ||||
| 
 | ||||
|     bool | ||||
|     World::isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const | ||||
|     World::isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const | ||||
|     { | ||||
|         if (!(cell.mData.mFlags & ESM::Cell::HasWater)) { | ||||
|         if (!(cell->mCell->mData.mFlags & ESM::Cell::HasWater)) { | ||||
|             return false; | ||||
|         } | ||||
|         return pos.z < cell.mWater; | ||||
|         return pos.z < cell->mWaterLevel; | ||||
|     } | ||||
| 
 | ||||
|     bool World::isOnGround(const MWWorld::Ptr &ptr) const | ||||
|  | @ -1448,7 +1448,7 @@ namespace MWWorld | |||
|         Ogre::Vector3 playerPos(refdata.getPosition().pos); | ||||
| 
 | ||||
|         const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle()); | ||||
|         if(!physactor->getOnGround() || isUnderwater(*currentCell->mCell, playerPos)) | ||||
|         if(!physactor->getOnGround() || isUnderwater(currentCell, playerPos)) | ||||
|             return 2; | ||||
|         if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep)) | ||||
|             return 1; | ||||
|  |  | |||
|  | @ -316,7 +316,7 @@ namespace MWWorld | |||
| 
 | ||||
|             virtual bool isFlying(const MWWorld::Ptr &ptr) const; | ||||
|             virtual bool isSwimming(const MWWorld::Ptr &object) const; | ||||
|             virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const; | ||||
|             virtual bool isUnderwater(const MWWorld::Ptr::CellStore* cell, const Ogre::Vector3 &pos) const; | ||||
|             virtual bool isOnGround(const MWWorld::Ptr &ptr) const; | ||||
| 
 | ||||
|             virtual void togglePOV() { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue