diff --git a/apps/openmw/mwrender/camera.cpp b/apps/openmw/mwrender/camera.cpp index b4fd6a543..e71e694f9 100644 --- a/apps/openmw/mwrender/camera.cpp +++ b/apps/openmw/mwrender/camera.cpp @@ -37,6 +37,14 @@ namespace MWRender { } + void Camera::reset() + { + togglePreviewMode(false); + toggleVanityMode(false); + if (!mFirstPersonView) + toggleViewMode(); + } + void Camera::rotateCamera(const Ogre::Vector3 &rot, bool adjust) { if (adjust) { diff --git a/apps/openmw/mwrender/camera.hpp b/apps/openmw/mwrender/camera.hpp index 7bbdd303d..ad5e35f93 100644 --- a/apps/openmw/mwrender/camera.hpp +++ b/apps/openmw/mwrender/camera.hpp @@ -52,6 +52,9 @@ namespace MWRender Camera(Ogre::Camera *camera); ~Camera(); + /// Reset to defaults + void reset(); + /// Set where the camera is looking at. Uses Morrowind (euler) angles /// \param rot Rotation angles in radians void rotateCamera(const Ogre::Vector3 &rot, bool adjust); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 0811d8774..6586cbba6 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -950,4 +950,9 @@ void RenderingManager::frameStarted(float dt) mWater->frameStarted(dt); } +void RenderingManager::resetCamera() +{ + mCamera->reset(); +} + } // namespace diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 6a35bfb6d..b492a0db9 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -83,6 +83,8 @@ public: mCamera->setCameraDistance(-factor/120.f*10, true, true); } + void resetCamera(); + bool vanityRotateCamera(const float *rot); void getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ce1a100e3..8b76efdae 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -236,6 +236,8 @@ namespace MWWorld setupPlayer(); const ESM::NPC* playerNpc = mStore.get().find("player"); MWWorld::Ptr player = mPlayer->getPlayer(); + renderPlayer(); + mRendering->resetCamera(); // removes NpcStats, ContainerStore etc player.getRefData().setCustomData(NULL);