Don't set an underwater environment when there's no water

This commit is contained in:
Chris Robinson 2012-04-01 12:46:49 -07:00
parent 54ce95cfaf
commit 2147210ad7

View file

@ -407,7 +407,7 @@ namespace MWSound
if(!isMusicPlaying()) if(!isMusicPlaying())
startRandomTitle(); startRandomTitle();
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayer().getPlayer().getCell(); const ESM::Cell *cell = mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell;
Ogre::Camera *cam = mEnvironment.mWorld->getPlayer().getRenderer()->getCamera(); Ogre::Camera *cam = mEnvironment.mWorld->getPlayer().getRenderer()->getCamera();
Ogre::Vector3 nPos, nDir, nUp; Ogre::Vector3 nPos, nDir, nUp;
nPos = cam->getRealPosition(); nPos = cam->getRealPosition();
@ -415,7 +415,7 @@ namespace MWSound
nUp = cam->getRealUp(); nUp = cam->getRealUp();
Environment env = Env_Normal; Environment env = Env_Normal;
if(nPos.y < current->cell->water) if((cell->data.flags&cell->HasWater) && nPos.y < cell->water)
env = Env_Underwater; env = Env_Underwater;
// The output handler is expecting vectors oriented like the game // The output handler is expecting vectors oriented like the game