mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-23 15:40:42 +00:00
Use a method to check if the view should be first person
This commit is contained in:
parent
bb8277920b
commit
dbba126344
@ -104,8 +104,8 @@ namespace MWRender
|
|||||||
void Player::toggleViewMode()
|
void Player::toggleViewMode()
|
||||||
{
|
{
|
||||||
mFirstPersonView = !mFirstPersonView;
|
mFirstPersonView = !mFirstPersonView;
|
||||||
mAnimation->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
|
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
||||||
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
|
NpcAnimation::VM_Normal);
|
||||||
if (mFirstPersonView) {
|
if (mFirstPersonView) {
|
||||||
mCamera->setPosition(0.f, 0.f, 0.f);
|
mCamera->setPosition(0.f, 0.f, 0.f);
|
||||||
setLowHeight(false);
|
setLowHeight(false);
|
||||||
@ -131,8 +131,8 @@ namespace MWRender
|
|||||||
return true;
|
return true;
|
||||||
mVanity.enabled = enable;
|
mVanity.enabled = enable;
|
||||||
|
|
||||||
mAnimation->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
|
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
||||||
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
|
NpcAnimation::VM_Normal);
|
||||||
|
|
||||||
float offset = mPreviewCam.offset;
|
float offset = mPreviewCam.offset;
|
||||||
Ogre::Vector3 rot(0.f, 0.f, 0.f);
|
Ogre::Vector3 rot(0.f, 0.f, 0.f);
|
||||||
@ -161,8 +161,8 @@ namespace MWRender
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mPreviewMode = enable;
|
mPreviewMode = enable;
|
||||||
mAnimation->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
|
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
||||||
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
|
NpcAnimation::VM_Normal);
|
||||||
|
|
||||||
float offset = mCamera->getPosition().z;
|
float offset = mCamera->getPosition().z;
|
||||||
if (mPreviewMode) {
|
if (mPreviewMode) {
|
||||||
@ -277,8 +277,8 @@ namespace MWRender
|
|||||||
if(mAnimation && mAnimation != anim)
|
if(mAnimation && mAnimation != anim)
|
||||||
mAnimation->setViewMode(NpcAnimation::VM_Normal);
|
mAnimation->setViewMode(NpcAnimation::VM_Normal);
|
||||||
mAnimation = anim;
|
mAnimation = anim;
|
||||||
mAnimation->setViewMode((mVanity.enabled || mPreviewMode || !mFirstPersonView) ?
|
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
||||||
NpcAnimation::VM_Normal : NpcAnimation::VM_FirstPerson);
|
NpcAnimation::VM_Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::setHeight(float height)
|
void Player::setHeight(float height)
|
||||||
|
@ -76,6 +76,9 @@ namespace MWRender
|
|||||||
|
|
||||||
void togglePreviewMode(bool enable);
|
void togglePreviewMode(bool enable);
|
||||||
|
|
||||||
|
bool isFirstPerson() const
|
||||||
|
{ return !(mVanity.enabled || mPreviewMode || !mFirstPersonView); }
|
||||||
|
|
||||||
void update(float duration);
|
void update(float duration);
|
||||||
|
|
||||||
/// Set camera distance for current mode. Don't work on 1st person view.
|
/// Set camera distance for current mode. Don't work on 1st person view.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user