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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef TF_WEAPON_PASSTIME_GUN_H
#define TF_WEAPON_PASSTIME_GUN_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_weaponbase.h"
class CPasstimeBall;
#ifdef CLIENT_DLL
#define CPasstimeBall C_PasstimeBall
#define CPasstimeGun C_PasstimeGun
class C_PasstimeBounceReticle;
#else
#include "passtime_ballcontroller_homing.h"
#endif
//-----------------------------------------------------------------------------
class CPasstimeGun : public CTFWeaponBase, public ITFChargeUpWeapon
{
DECLARE_CLASS( CPasstimeGun, CTFWeaponBase );
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE(); // this has to be here because the client's precache code uses it to get the classname of this entity...
public:
CPasstimeGun();
~CPasstimeGun();
virtual float GetChargeBeginTime() OVERRIDE;
virtual float GetCurrentCharge() OVERRIDE;
static bool BValidPassTarget( CTFPlayer *pSource, CTFPlayer *pTarget, HudNotification_t *pReason = 0 );
struct LaunchParams
{
Vector eyePos;
Vector viewFwd;
Vector viewRight;
Vector viewUp;
Vector traceHullSize;
float traceHullDistance;
Vector startPos;
Vector startDir;
Vector startVel;
static LaunchParams Default( CTFPlayer *pPlayer );
};
static LaunchParams CalcLaunch( CTFPlayer *pPlayer, bool bHoming );
protected:
virtual int GetWeaponID() const OVERRIDE { return TF_WEAPON_PASSTIME_GUN; }
virtual void Spawn() OVERRIDE;
virtual void Equip( CBaseCombatCharacter *pOwner ) OVERRIDE;
virtual void Precache() OVERRIDE;
virtual bool CanHolster() const OVERRIDE;
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo ) OVERRIDE;
virtual void WeaponReset() OVERRIDE;
virtual bool CanCharge() OVERRIDE;
virtual float GetChargeMaxTime() OVERRIDE;
virtual void UpdateOnRemove() OVERRIDE;
virtual bool VisibleInWeaponSelection() OVERRIDE;
virtual acttable_t* ActivityList(int &iActivityCount) OVERRIDE;
virtual void ItemPostFrame() OVERRIDE;
virtual void ItemHolsterFrame() OVERRIDE;
virtual bool Deploy() OVERRIDE;
virtual bool CanDeploy() OVERRIDE;
virtual const char *GetWorldModel() const OVERRIDE;
virtual bool SendWeaponAnim( int actBase ) OVERRIDE;
virtual Activity GetDrawActivity() OVERRIDE { return ACT_BALL_VM_CATCH; }
// HasPrimaryAmmo, CanBeSelected, IsEnergyWeapon:
// these exist to make other code have correct side-effects
// search for where these are called to see the specifics.
virtual bool HasPrimaryAmmo() OVERRIDE { return true; }
virtual bool CanBeSelected() OVERRIDE { return true; }
virtual bool IsEnergyWeapon() const OVERRIDE { return true; }
#ifdef CLIENT_DLL
virtual void UpdateAttachmentModels() OVERRIDE;
virtual void ClientThink() OVERRIDE;
void UpdateThrowArch();
void DestroyThrowArch();
C_PasstimeBounceReticle *m_pBounceReticle;
#endif
void Throw( CTFPlayer *pOwner );
enum EThrowState
{
THROWSTATE_IDLE,
THROWSTATE_CHARGING,
THROWSTATE_CHARGED,
THROWSTATE_THROWN,
THROWSTATE_CANCELLED,
THROWSTATE_DISABLED,
};
enum EButtonState
{
BUTTONSTATE_UP, // not pressed
BUTTONSTATE_PRESSED, // was just pressed and is down
BUTTONSTATE_DOWN, // continues to be down
BUTTONSTATE_RELEASED, // was just released and is not down
BUTTONSTATE_DISABLED, // ignore input
};
struct AttackInputState
{
AttackInputState( int button )
: iButton( button ), eButtonState( BUTTONSTATE_UP )
, bLatchedUp( false )
{}
const int iButton;
EButtonState eButtonState;
bool bLatchedUp;
bool Is( EButtonState state ) const { return eButtonState == state; }
void Disable() { eButtonState = BUTTONSTATE_DISABLED; }
void Enable()
{
if ( eButtonState == BUTTONSTATE_DISABLED )
eButtonState = BUTTONSTATE_UP;
}
void Update( int held, int pressed, int released );
void LatchUp();
void UnlatchUp();
};
int m_iHalloweenAttachmentIndex;
int m_iAttachmentIndex;
float m_flTargetResetTime;
float m_flThrowLoopStartTime;
AttackInputState m_attack, m_attack2;
CNetworkVar( EThrowState, m_eThrowState );
CNetworkVar( float, m_fChargeBeginTime );
CHandle<CBaseCombatWeapon> m_hStoredLastWpn;
#ifdef GAME_DLL
CPasstimeBallControllerHoming m_ballController;
#endif
};
#endif // TF_WEAPON_PASSTIME_GUN_H
|