Fixed: Mount stays invisible when unmounting while in first person view.

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-04-10 00:31:23 +03:00
parent f23fa7b0fe
commit 35f5c1b77f
2 changed files with 28 additions and 5 deletions

View file

@ -163,6 +163,7 @@ CUserEntity::CUserEntity()
// Your are not on a mount at the beginning. // Your are not on a mount at the beginning.
_OnMount = false; _OnMount = false;
_HiddenMount = CLFECOMMON::INVALID_SLOT;
_AnimAttackOn = false; _AnimAttackOn = false;
@ -3186,6 +3187,8 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView)
CEntityCL *mount = EntitiesMngr.entity(_Mount); CEntityCL *mount = EntitiesMngr.entity(_Mount);
if(mount) if(mount)
mount->displayable(false); mount->displayable(false);
_HiddenMount = _Mount;
} }
// Change Controls. // Change Controls.
if( isRiding() ) if( isRiding() )
@ -3203,11 +3206,14 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView)
case ThirdPV: case ThirdPV:
if(changeView) if(changeView)
ClientCfg.FPV = false; 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) if(mount)
mount->displayable(true); mount->displayable(true);
_HiddenMount == CLFECOMMON::INVALID_SLOT;
} }
// Change Controls. // Change Controls.
UserControls.mode(CUserControls::ThirdMode); UserControls.mode(CUserControls::ThirdMode);
@ -3391,9 +3397,24 @@ void CUserEntity::updateVisualDisplay()
if(UserControls.isInternalView() || View.forceFirstPersonView()) if(UserControls.isInternalView() || View.forceFirstPersonView())
{ {
// Hide the mount // Hide the mount
CCharacterCL *mount = dynamic_cast<CCharacterCL *>(EntitiesMngr.entity(_Mount)); if (_Mount != CLFECOMMON::INVALID_SLOT)
if(mount) {
mount->displayable(false); CCharacterCL *mount = dynamic_cast<CCharacterCL *>(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<CCharacterCL *>(EntitiesMngr.entity(_HiddenMount));
if(mount)
mount->displayable(true);
_HiddenMount = CLFECOMMON::INVALID_SLOT;
}
// Hide all user body parts. // Hide all user body parts.
for(uint i=0; i<_Instances.size(); ++i) for(uint i=0; i<_Instances.size(); ++i)
if(!_Instances[i].Current.empty()) if(!_Instances[i].Current.empty())

View file

@ -701,6 +701,8 @@ protected:
private: private:
/// TO know if the user is on a mount at the moment. /// TO know if the user is on a mount at the moment.
bool _OnMount; bool _OnMount;
/// Keep track of last hidden mount when switching to FPV mode
CLFECOMMON::TCLEntityId _HiddenMount;
/// Is the attack animation is currently playing. /// Is the attack animation is currently playing.
bool _AnimAttackOn; bool _AnimAttackOn;
/// Current View Mode (First/Third Person View). /// Current View Mode (First/Third Person View).