blob: 8be2eb0a33bb055dd62dc1067cceec6e37cf23d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include "cbase.h"
#include "tf_weapon_parachute.h"
#include "tf_gamerules.h"
// Client specific.
#ifdef CLIENT_DLL
#include "c_tf_player.h"
// Server specific.
#else
#include "tf_player.h"
#include "tf_gamestats.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//=============================================================================
//
// Weapon Buff Item tables.
//
CREATE_SIMPLE_WEAPON_TABLE( TFParachute, tf_weapon_parachute )
CREATE_SIMPLE_WEAPON_TABLE( TFParachute_Primary, tf_weapon_parachute_primary )
CREATE_SIMPLE_WEAPON_TABLE( TFParachute_Secondary, tf_weapon_parachute_secondary )
//-----------------------------------------------------------------------------
CTFParachute::CTFParachute()
{
#ifdef CLIENT_DLL
m_iParachuteAnimState = EParachuteRetracted;
#endif // CLIENT_DLL
}
//-----------------------------------------------------------------------------
void CTFParachute::CreateBanner()
{
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 );
}
#endif // CLIENT_DLL
}
#ifdef CLIENT_DLL
//-----------------------------------------------------------------------------
void CTFParachute::ClientThink( void )
{
BaseClass::ClientThink();
ParachuteAnimThink();
}
//-----------------------------------------------------------------------------
void CTFParachute::ParachuteAnimThink( void )
{
if ( m_iBuffType == -1 || m_iBuffType == 0 )
{
m_iBuffType = GetBuffType();
}
if ( m_iBuffType != EParachute )
return;
CTFPlayer* pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return;
CreateBanner();
if ( !m_hBannerEntity )
return;
bool bInCondition = pPlayer->m_Shared.InCond( TF_COND_PARACHUTE_DEPLOYED );
if ( pPlayer->m_Shared.InCond( TF_COND_HALLOWEEN_KART ) )
{
// Halloween Kart has its own parachute and we don't want to interfer with it here
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;
m_iParachuteAnimState = EParachuteRetracted;
}
else if ( m_iParachuteAnimState == EParachuteRetracted_Idle && bInCondition )
{
// deploy
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_DEPLOY );
m_hBannerEntity->ResetSequence( sequence );
m_flParachuteToIdleTime = m_hBannerEntity->SequenceDuration() + gpGlobals->curtime;
m_iParachuteAnimState = EParachuteDeployed;
}
// To Idle
if ( m_iParachuteAnimState == EParachuteRetracted && m_flParachuteToIdleTime < gpGlobals->curtime )
{
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_RETRACT_IDLE );
m_hBannerEntity->ResetSequence( sequence );
m_iParachuteAnimState = EParachuteRetracted_Idle;
}
else if ( m_iParachuteAnimState == EParachuteDeployed && m_flParachuteToIdleTime < gpGlobals->curtime )
{
int sequence = m_hBannerEntity->SelectWeightedSequence( ACT_PARACHUTE_DEPLOY_IDLE );
m_hBannerEntity->ResetSequence( sequence );
m_iParachuteAnimState = EParachuteDeployed_Idle;
}
}
#endif // CLIENT_DLL
|