From 90a5d8b6f59623d12d0cbe9e1d3aa0c829555ddb Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 30 Jul 2013 23:24:18 +0200 Subject: [PATCH] Fix uninitialized AL listener position/orientation when the game is paused during the first frame --- apps/openmw/mwrender/camera.cpp | 4 +++- apps/openmw/mwrender/camera.hpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 4 ++-- apps/openmw/mwsound/soundmanagerimp.cpp | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/camera.cpp b/apps/openmw/mwrender/camera.cpp index 941b8fde7..ffabaac9c 100644 --- a/apps/openmw/mwrender/camera.cpp +++ b/apps/openmw/mwrender/camera.cpp @@ -99,9 +99,11 @@ namespace MWRender MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up); } - void Camera::update(float duration) + void Camera::update(float duration, bool paused) { updateListener(); + if (paused) + return; // only show the crosshair in game mode and in first person mode. MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager(); diff --git a/apps/openmw/mwrender/camera.hpp b/apps/openmw/mwrender/camera.hpp index cbfbd0919..dc552371e 100644 --- a/apps/openmw/mwrender/camera.hpp +++ b/apps/openmw/mwrender/camera.hpp @@ -84,7 +84,7 @@ namespace MWRender void processViewChange(); - void update(float duration); + void update(float duration, bool paused=false); /// Set camera distance for current mode. Don't work on 1st person view. /// \param adjust Indicates should distance be adjusted or set. diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 2f48a0ce9..65fe5014c 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -351,11 +351,11 @@ void RenderingManager::update (float duration, bool paused) applyFog(world->isUnderwater(player.getCell(), cam)); + mCamera->update(duration, paused); + if(paused) return; - mCamera->update(duration); - mActors.update (duration); mObjects.update (duration); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 1e431d54a..c820a7e16 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -53,6 +53,9 @@ namespace MWSound , mFootstepsVolume(1.0f) , mVoiceVolume(1.0f) , mPausedSoundTypes(0) + , mListenerPos(0,0,0) + , mListenerDir(1,0,0) + , mListenerUp(0,0,1) { if(!useSound) return;