forked from mirror/openmw-tes3mp
Fix a new game crash, reset camera
This commit is contained in:
parent
53d1c3939c
commit
60563afc10
5 changed files with 20 additions and 0 deletions
|
@ -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)
|
void Camera::rotateCamera(const Ogre::Vector3 &rot, bool adjust)
|
||||||
{
|
{
|
||||||
if (adjust) {
|
if (adjust) {
|
||||||
|
|
|
@ -52,6 +52,9 @@ namespace MWRender
|
||||||
Camera(Ogre::Camera *camera);
|
Camera(Ogre::Camera *camera);
|
||||||
~Camera();
|
~Camera();
|
||||||
|
|
||||||
|
/// Reset to defaults
|
||||||
|
void reset();
|
||||||
|
|
||||||
/// Set where the camera is looking at. Uses Morrowind (euler) angles
|
/// Set where the camera is looking at. Uses Morrowind (euler) angles
|
||||||
/// \param rot Rotation angles in radians
|
/// \param rot Rotation angles in radians
|
||||||
void rotateCamera(const Ogre::Vector3 &rot, bool adjust);
|
void rotateCamera(const Ogre::Vector3 &rot, bool adjust);
|
||||||
|
|
|
@ -950,4 +950,9 @@ void RenderingManager::frameStarted(float dt)
|
||||||
mWater->frameStarted(dt);
|
mWater->frameStarted(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderingManager::resetCamera()
|
||||||
|
{
|
||||||
|
mCamera->reset();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -83,6 +83,8 @@ public:
|
||||||
mCamera->setCameraDistance(-factor/120.f*10, true, true);
|
mCamera->setCameraDistance(-factor/120.f*10, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetCamera();
|
||||||
|
|
||||||
bool vanityRotateCamera(const float *rot);
|
bool vanityRotateCamera(const float *rot);
|
||||||
|
|
||||||
void getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
|
void getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
|
||||||
|
|
|
@ -236,6 +236,8 @@ namespace MWWorld
|
||||||
setupPlayer();
|
setupPlayer();
|
||||||
const ESM::NPC* playerNpc = mStore.get<ESM::NPC>().find("player");
|
const ESM::NPC* playerNpc = mStore.get<ESM::NPC>().find("player");
|
||||||
MWWorld::Ptr player = mPlayer->getPlayer();
|
MWWorld::Ptr player = mPlayer->getPlayer();
|
||||||
|
renderPlayer();
|
||||||
|
mRendering->resetCamera();
|
||||||
|
|
||||||
// removes NpcStats, ContainerStore etc
|
// removes NpcStats, ContainerStore etc
|
||||||
player.getRefData().setCustomData(NULL);
|
player.getRefData().setCustomData(NULL);
|
||||||
|
|
Loading…
Reference in a new issue