Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 39 additions & 24 deletions src/game/shared/tf/tf_weapon_parachute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ CTFParachute::CTFParachute()
//-----------------------------------------------------------------------------
void CTFParachute::CreateBanner()
{
#ifdef CLIENT_DLL
if ( m_hBannerEntity )
return;

BaseClass::CreateBanner();

#ifdef CLIENT_DLL

if ( m_hBannerEntity )
{
m_iParachuteAnimState = EParachuteRetracted_Idle;
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_RETRACT_IDLE );
m_hBannerEntity->ResetSequence( sequence );
m_flParachuteToIdleTime = -1;
}
#endif // CLIENT_DLL
}
Expand Down Expand Up @@ -91,37 +96,47 @@ void CTFParachute::ParachuteAnimThink( void )
bInCondition = false;
}

// Track Anim State
if ( m_iParachuteAnimState == EParachuteDeployed_Idle && !bInCondition )
{
// retract
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_RETRACT );
m_hBannerEntity->ResetSequence( sequence );
m_flParachuteToIdleTime = m_hBannerEntity->SequenceDuration() + gpGlobals->curtime;
bool bIsDeployed = m_iParachuteAnimState == EParachuteDeployed || m_iParachuteAnimState == EParachuteDeployed_Idle;
int iAct = -1;

m_iParachuteAnimState = EParachuteRetracted;
}
else if ( m_iParachuteAnimState == EParachuteRetracted_Idle && bInCondition )
// Track Anim State
if ( m_flParachuteToIdleTime < gpGlobals->curtime && m_flParachuteToIdleTime != -1 )
{
// deploy
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_DEPLOY );
m_hBannerEntity->ResetSequence( sequence );
m_flParachuteToIdleTime = m_hBannerEntity->SequenceDuration() + gpGlobals->curtime;
m_iParachuteAnimState = EParachuteDeployed;
if ( m_iParachuteAnimState == EParachuteDeployed )
{
iAct = ACT_PARACHUTE_DEPLOY_IDLE;
m_iParachuteAnimState = EParachuteDeployed_Idle;
}
else
{
iAct = ACT_PARACHUTE_RETRACT_IDLE;
m_iParachuteAnimState = EParachuteRetracted_Idle;
}
m_flParachuteToIdleTime = -1;
}

// To Idle
if ( m_iParachuteAnimState == EParachuteRetracted && m_flParachuteToIdleTime < gpGlobals->curtime )
if ( bIsDeployed != bInCondition )
{
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_RETRACT_IDLE );
m_hBannerEntity->ResetSequence( sequence );
m_iParachuteAnimState = EParachuteRetracted_Idle;
if ( bInCondition )
{
iAct = ACT_PARACHUTE_DEPLOY;
m_iParachuteAnimState = EParachuteDeployed;
}
else
{
iAct = ACT_PARACHUTE_RETRACT;
m_iParachuteAnimState = EParachuteRetracted;
}
}
else if ( m_iParachuteAnimState == EParachuteDeployed && m_flParachuteToIdleTime < gpGlobals->curtime )

if ( iAct != -1 )
{
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_DEPLOY_IDLE );
int sequence = m_hBannerEntity->SelectWeightedSequence( iAct );
m_hBannerEntity->ResetSequence( sequence );
m_iParachuteAnimState = EParachuteDeployed_Idle;
if ( m_iParachuteAnimState == EParachuteDeployed || m_iParachuteAnimState == EParachuteRetracted )
{
m_flParachuteToIdleTime = m_hBannerEntity->SequenceDuration() + gpGlobals->curtime;
}
}
}

Expand Down