Rewrite messed up playerlooking switch handling (bug #5078)

pull/2438/head
Capostrophic 6 years ago committed by capostrophic
parent cad4ba0423
commit 0b074f2211

@ -111,6 +111,7 @@
Bug #5069: Blocking creatures' attacks doesn't degrade shields
Bug #5074: Paralyzed actors greet the player
Bug #5075: Enchanting cast style can be changed if there's no object
Bug #5078: DisablePlayerLooking is broken
Bug #5082: Scrolling with controller in GUI mode is broken
Bug #5092: NPCs with enchanted weapons play sound when out of charges
Bug #5093: Hand to hand sound plays on knocked out enemies

@ -407,7 +407,6 @@ namespace MWBase
virtual void togglePreviewMode(bool enable) = 0;
virtual bool toggleVanityMode(bool enable) = 0;
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 setCameraDistance(float dist, bool adjust = false, bool override = true)=0;

@ -589,7 +589,7 @@ namespace MWInput
rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1);
// Only actually turn player when we're not in vanity mode
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot))
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && mControlSwitch["playerlooking"])
{
mPlayer->yaw(rot[2]);
mPlayer->pitch(rot[0]);
@ -827,9 +827,6 @@ namespace MWInput
void InputManager::toggleControlSwitch (const std::string& sw, bool value)
{
if (mControlSwitch[sw] == value) {
return;
}
/// \note 7 switches at all, if-else is relevant
if (sw == "playercontrols" && !value) {
mPlayer->setLeftRight(0);
@ -841,8 +838,8 @@ namespace MWInput
mPlayer->setUpDown(0);
} else if (sw == "vanitymode") {
MWBase::Environment::get().getWorld()->allowVanityMode(value);
} else if (sw == "playerlooking") {
MWBase::Environment::get().getWorld()->togglePlayerLooking(value);
} else if (sw == "playerlooking" && !value) {
MWBase::Environment::get().getWorld()->rotateObject(mPlayer->getPlayer(), 0.f, 0.f, 0.f);
}
mControlSwitch[sw] = value;
}
@ -976,7 +973,7 @@ namespace MWInput
rot[2] = -x;
// Only actually turn player when we're not in vanity mode
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot))
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && mControlSwitch["playerlooking"])
{
mPlayer->yaw(x);
mPlayer->pitch(y);

@ -48,7 +48,6 @@ namespace MWRender
mAnimation(nullptr),
mFirstPersonView(true),
mPreviewMode(false),
mFreeLook(true),
mNearest(30.f),
mFurthest(800.f),
mIsNearest(false),
@ -393,11 +392,6 @@ namespace MWRender
camera = focal + offset;
}
void Camera::togglePlayerLooking(bool enable)
{
mFreeLook = enable;
}
bool Camera::isVanityOrPreviewModeEnabled()
{
return mPreviewMode || mVanity.enabled;

@ -37,7 +37,6 @@ namespace MWRender
bool mFirstPersonView;
bool mPreviewMode;
bool mFreeLook;
float mNearest;
float mFurthest;
bool mIsNearest;
@ -119,8 +118,6 @@ namespace MWRender
/// Stores focal and camera world positions in passed arguments
void getPosition(osg::Vec3f &focal, osg::Vec3f &camera);
void togglePlayerLooking(bool enable);
bool isVanityOrPreviewModeEnabled();
bool isNearest();

@ -1353,11 +1353,6 @@ namespace MWRender
mCamera->allowVanityMode(allow);
}
void RenderingManager::togglePlayerLooking(bool enable)
{
mCamera->togglePlayerLooking(enable);
}
void RenderingManager::changeVanityModeScale(float factor)
{
if(mCamera->isVanityOrPreviewModeEnabled())

@ -208,7 +208,6 @@ namespace MWRender
void togglePreviewMode(bool enable);
bool toggleVanityMode(bool enable);
void allowVanityMode(bool allow);
void togglePlayerLooking(bool enable);
void changeVanityModeScale(float factor);
/// temporarily override the field of view with given value.

@ -2389,11 +2389,6 @@ namespace MWWorld
mRendering->allowVanityMode(allow);
}
void World::togglePlayerLooking(bool enable)
{
mRendering->togglePlayerLooking(enable);
}
void World::changeVanityModeScale(float factor)
{
mRendering->changeVanityModeScale(factor);

@ -526,8 +526,6 @@ namespace MWWorld
void allowVanityMode(bool allow) override;
void togglePlayerLooking(bool enable) override;
void changeVanityModeScale(float factor) override;
bool vanityRotateCamera(float * rot) override;

Loading…
Cancel
Save