1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

fix for turning animations playing when in vanity mode

This commit is contained in:
Tom Mason 2013-04-09 19:24:41 +01:00
parent 40bb772e34
commit 6ca2b1af74
6 changed files with 31 additions and 2 deletions

View file

@ -319,6 +319,7 @@ namespace MWBase
virtual void allowVanityMode(bool allow) = 0;
virtual void togglePlayerLooking(bool enable) = 0;
virtual void changeVanityModeScale(float factor) = 0;
virtual bool vanityRotateCamera(float * rot) = 0;
virtual void renderPlayer() = 0;

View file

@ -533,8 +533,17 @@ namespace MWInput
float scale = MWBase::Environment::get().getFrameDuration();
if(scale <= 0.0f) scale = 1.0f;
mPlayer.setYaw(x/scale);
mPlayer.setPitch(-y/scale);
float rot[3];
rot[0] = -y;
rot[1] = 0.0f;
rot[2] = x;
// Only actually turn player when we're not in vanity mode
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot))
{
mPlayer.setYaw(x/scale);
mPlayer.setPitch(-y/scale);
}
if (arg.state.Z.rel)
MWBase::Environment::get().getWorld()->changeVanityModeScale(arg.state.Z.rel);

View file

@ -891,6 +891,16 @@ void RenderingManager::getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float
mPlayer->getSightAngles(pitch, yaw);
}
bool RenderingManager::vanityRotateCamera(float* rot)
{
if(!mPlayer->isVanityOrPreviewModeEnabled())
return false;
Ogre::Vector3 vRot(rot);
mPlayer->rotateCamera(vRot, true);
return true;
}
void RenderingManager::getInteriorMapPosition (Ogre::Vector2 position, float& nX, float& nY, int &x, int& y)
{
return mLocalMap->getInteriorMapPosition (position, nX, nY, x, y);

View file

@ -88,6 +88,8 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
mPlayer->setCameraDistance(-factor/120.f*10, true, true);
}
bool vanityRotateCamera(float* rot);
void getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
void attachCameraTo(const MWWorld::Ptr &ptr);

View file

@ -1364,6 +1364,11 @@ namespace MWWorld
return physactor && physactor->getOnGround();
}
bool World::vanityRotateCamera(float * rot)
{
return mRendering->vanityRotateCamera(rot);
}
void World::renderPlayer()
{
mRendering->renderPlayer(mPlayer->getPlayer());

View file

@ -361,6 +361,8 @@ namespace MWWorld
mRendering->changeVanityModeScale(factor);
}
virtual bool vanityRotateCamera(float * rot);
virtual void renderPlayer();
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);