mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-06 18:12:14 +00:00
- disabled view bob model while holding props
This commit is contained in:
parent
e4879beabc
commit
7805ec5ffb
4 changed files with 24 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
|||
IMPLEMENT_CLIENTCLASS_DT( C_GstringPlayer, DT_CGstringPlayer, CGstringPlayer )
|
||||
|
||||
RecvPropBool( RECVINFO( m_bNightvisionActive ) ),
|
||||
RecvPropBool( RECVINFO( m_bHasUseEntity ) ),
|
||||
|
||||
END_RECV_TABLE()
|
||||
|
||||
|
@ -38,6 +39,7 @@ C_GstringPlayer::C_GstringPlayer()
|
|||
, m_flBobModelAmount( 0.0f )
|
||||
, m_angLastBobAngle( vec3_angle )
|
||||
{
|
||||
m_bHasUseEntity = false;
|
||||
}
|
||||
|
||||
C_GstringPlayer::~C_GstringPlayer()
|
||||
|
@ -145,8 +147,6 @@ void C_GstringPlayer::OverrideView( CViewSetup *pSetup )
|
|||
// shake derived from viewmodel
|
||||
C_BaseViewModel *pViewModel = GetViewModel();
|
||||
|
||||
//m_flBobModelAmount
|
||||
|
||||
if ( pViewModel != NULL
|
||||
&& pViewModel->GetModelPtr() != NULL )
|
||||
{
|
||||
|
@ -191,15 +191,20 @@ void C_GstringPlayer::OverrideView( CViewSetup *pSetup )
|
|||
}
|
||||
}
|
||||
|
||||
float flGoalBobAmount = ( m_pBobViewModel && !m_pBobViewModel->IsInvalid() )
|
||||
float flGoalBobAmount = ( m_pBobViewModel
|
||||
&& !m_pBobViewModel->IsInvalid()
|
||||
&& !m_bHasUseEntity )
|
||||
? 1.0f : 0.0f;
|
||||
|
||||
if ( m_flBobModelAmount != flGoalBobAmount )
|
||||
{
|
||||
m_flBobModelAmount = Approach( flGoalBobAmount, m_flBobModelAmount, gpGlobals->frametime * 1.5f );
|
||||
m_flBobModelAmount = Approach( flGoalBobAmount, m_flBobModelAmount, gpGlobals->frametime * 5.0f );
|
||||
}
|
||||
|
||||
pSetup->angles += m_angLastBobAngle * m_flBobModelAmount;
|
||||
if ( !m_bHasUseEntity )
|
||||
{
|
||||
pSetup->angles += m_angLastBobAngle * m_flBobModelAmount;
|
||||
}
|
||||
}
|
||||
|
||||
void C_GstringPlayer::ProcessMuzzleFlashEvent()
|
||||
|
|
|
@ -51,6 +51,8 @@ private:
|
|||
C_BobModel *m_pBobViewModel;
|
||||
float m_flBobModelAmount;
|
||||
QAngle m_angLastBobAngle;
|
||||
|
||||
CNetworkVar( bool, m_bHasUseEntity );
|
||||
};
|
||||
|
||||
inline C_GstringPlayer *ToGstringPlayer( C_BaseEntity *pPlayer )
|
||||
|
|
|
@ -12,6 +12,7 @@ END_DATADESC()
|
|||
IMPLEMENT_SERVERCLASS_ST( CGstringPlayer, DT_CGstringPlayer )
|
||||
|
||||
SendPropBool( SENDINFO( m_bNightvisionActive ) ),
|
||||
SendPropBool( SENDINFO( m_bHasUseEntity ) ),
|
||||
|
||||
END_SEND_TABLE()
|
||||
|
||||
|
@ -19,6 +20,7 @@ LINK_ENTITY_TO_CLASS( player, CGstringPlayer );
|
|||
|
||||
CGstringPlayer::CGstringPlayer()
|
||||
{
|
||||
m_bHasUseEntity = false;
|
||||
m_bNightvisionActive = false;
|
||||
}
|
||||
|
||||
|
@ -101,4 +103,11 @@ void CGstringPlayer::ImpulseCommands()
|
|||
}
|
||||
|
||||
ClearImpulse();
|
||||
}
|
||||
|
||||
void CGstringPlayer::PhysicsSimulate()
|
||||
{
|
||||
BaseClass::PhysicsSimulate();
|
||||
|
||||
m_bHasUseEntity = GetUseEntity() != NULL;
|
||||
}
|
|
@ -18,6 +18,7 @@ public:
|
|||
void SetNightvisionActive( bool bActive );
|
||||
|
||||
virtual void ImpulseCommands();
|
||||
virtual void PhysicsSimulate();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -25,6 +26,8 @@ private:
|
|||
void ToggleNightvision();
|
||||
CNetworkVar( bool, m_bNightvisionActive );
|
||||
|
||||
CNetworkVar( bool, m_bHasUseEntity );
|
||||
|
||||
};
|
||||
|
||||
inline CGstringPlayer *ToGstringPlayer( CBaseEntity *pPlayer )
|
||||
|
|
Loading…
Reference in a new issue