From 35f5c1b77fe2ddbada642ec01cea9d4aeb870803 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 10 Apr 2019 00:31:23 +0300 Subject: [PATCH] Fixed: Mount stays invisible when unmounting while in first person view. --HG-- branch : develop --- code/ryzom/client/src/user_entity.cpp | 31 ++++++++++++++++++++++----- code/ryzom/client/src/user_entity.h | 2 ++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 81a9e5a3a..6d905521c 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -163,6 +163,7 @@ CUserEntity::CUserEntity() // Your are not on a mount at the beginning. _OnMount = false; + _HiddenMount = CLFECOMMON::INVALID_SLOT; _AnimAttackOn = false; @@ -3186,6 +3187,8 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView) CEntityCL *mount = EntitiesMngr.entity(_Mount); if(mount) mount->displayable(false); + + _HiddenMount = _Mount; } // Change Controls. if( isRiding() ) @@ -3203,11 +3206,14 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView) case ThirdPV: if(changeView) ClientCfg.FPV = false; - if(_Mount != CLFECOMMON::INVALID_SLOT) + + if(_HiddenMount != CLFECOMMON::INVALID_SLOT) { - CEntityCL *mount = EntitiesMngr.entity(_Mount); + CEntityCL *mount = EntitiesMngr.entity(_HiddenMount); if(mount) mount->displayable(true); + + _HiddenMount == CLFECOMMON::INVALID_SLOT; } // Change Controls. UserControls.mode(CUserControls::ThirdMode); @@ -3391,9 +3397,24 @@ void CUserEntity::updateVisualDisplay() if(UserControls.isInternalView() || View.forceFirstPersonView()) { // Hide the mount - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - mount->displayable(false); + if (_Mount != CLFECOMMON::INVALID_SLOT) + { + CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); + if(mount) + mount->displayable(false); + + _HiddenMount = _Mount; + } + else if (_HiddenMount != CLFECOMMON::INVALID_SLOT) + { + // not on mount anymore, but still in FPV + CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_HiddenMount)); + if(mount) + mount->displayable(true); + + _HiddenMount = CLFECOMMON::INVALID_SLOT; + } + // Hide all user body parts. for(uint i=0; i<_Instances.size(); ++i) if(!_Instances[i].Current.empty()) diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index 8a4a27c16..5149b46e8 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -701,6 +701,8 @@ protected: private: /// TO know if the user is on a mount at the moment. bool _OnMount; + /// Keep track of last hidden mount when switching to FPV mode + CLFECOMMON::TCLEntityId _HiddenMount; /// Is the attack animation is currently playing. bool _AnimAttackOn; /// Current View Mode (First/Third Person View).