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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: A stationary gun that players can man
//
// $NoKeywords: $
//=============================================================================//
#ifndef TF_OBJ_BASE_MANNED_GUN_H
#define TF_OBJ_BASE_MANNED_GUN_H
#ifdef _WIN32
#pragma once
#endif
#include "basetfvehicle.h"
#include "tf_obj_manned_plasmagun_shared.h"
#include "env_laserdesignation.h"
#include "beam_shared.h"
class CMoveData;
#if defined( CLIENT_DLL )
#define CObjectBaseMannedGun C_ObjectBaseMannedGun
#define CBaseTFVehicle C_BaseTFVehicle
#endif
// ------------------------------------------------------------------------ //
// A stationary gun that players can man that's built by the player
// ------------------------------------------------------------------------ //
class CObjectBaseMannedGun : public CBaseTFVehicle
{
public:
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
DECLARE_CLASS( CObjectBaseMannedGun, CBaseTFVehicle );
CObjectBaseMannedGun();
virtual void Spawn();
virtual void Precache();
virtual void UpdateOnRemove( void );
virtual void GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
virtual bool CanTakeEMPDamage( void ) { return true; }
virtual void OnGoInactive( void );
// Vehicle overrides
#ifndef CLIENT_DLL
virtual void SetPassenger( int nRole, CBasePlayer *pEnt );
#endif
virtual bool IsPassengerVisible( int nRole = VEHICLE_DRIVER ) { return true; }
// Returns the eye position
virtual void GetVehicleViewPosition( int nRole, Vector *pOrigin, QAngle *pAngles, float *pFOV = NULL );
// Manned plasma passengers aren't damagable
//virtual bool IsPassengerDamagable( int nRole = VEHICLE_DRIVER ) { return false; }
virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove );
virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
virtual void FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move );
virtual bool ShouldAttachToParent( void ) { return true; }
virtual bool MustNotBeBuiltInConstructionYard( void ) const { return true; }
virtual bool ShouldUseThirdPersonVehicleView( void );
virtual void BaseMannedGunThink( void );
float GetGunYaw() const;
float GetGunPitch() const;
// Buff
bool CanBeHookedToBuffStation( void );
#if defined ( CLIENT_DLL )
// IClientVehicle overrides.
public:
virtual void DrawHudElements( void );
virtual void UpdateViewAngles( C_BasePlayer *pLocalPlayer, CUserCmd *pCmd );
virtual QAngle GetPassengerAngles( QAngle angCurrent, int nRole );
// C_BaseEntity overrides.
public:
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual void GetBoneControllers(float controllers[MAXSTUDIOBONECTRLS], float dadt);
private:
void DrawCrosshair( void );
#endif
protected:
// Sets up various attachment points once the model is selected
// Derived classes should call this from within their SetTeamModel call
void OnModelSelected();
// Can we get into the vehicle?
virtual bool CanGetInVehicle( CBaseTFPlayer *pPlayer );
// Here's where we deal with weapons
virtual void OnItemPostFrame( CBaseTFPlayer *pPassenger );
// Fire the weapon
virtual void Fire( void ) {}
void StopDesignating( void );
void UpdateDesignator( void );
virtual void SetupAttachedVersion( void );
virtual void SetupUnattachedVersion( void );
// Sets the movement style
void SetMovementStyle( MovementStyle_t style );
// Calculate the max range of this gun
void CalculateMaxRange( float flDefensiveRange, float flOffensiveRange );
protected:
// Movement...
CObjectMannedPlasmagunMovement m_Movement;
float m_flMaxRange;
// attachment points
int m_nBarrelAttachment;
int m_nBarrelPivotAttachment;
int m_nStandAttachment;
int m_nEyesAttachment;
// Movement style
CNetworkVar( MovementStyle_t, m_nMoveStyle );
// Barrel height...
float m_flBarrelHeight;
CNetworkVar( int, m_nAmmoType );
CNetworkVar( int, m_nAmmoCount );
CNetworkVar( float, m_flGunYaw ); // 0 = front, 90 = left, 180 = back, 270 = right
CNetworkVar( float, m_flGunPitch ); // 0 = forward, -90 = pointing down, 90 = pointing up..
CNetworkVar( float, m_flBarrelPitch );
float m_flReturnToInitialTime;
// Laser designation
CNetworkHandle( CBeam, m_hBeam );
CNetworkHandle( CEnvLaserDesignation, m_hLaserDesignation );
#if defined( CLIENT_DLL )
CHudTexture *iconCrosshair;
private:
CObjectBaseMannedGun( const CObjectBaseMannedGun & ); // not defined, not accessible
#endif
};
//-----------------------------------------------------------------------------
// Inline methods
//-----------------------------------------------------------------------------
inline bool CObjectBaseMannedGun::CanBeHookedToBuffStation( void )
{
return true;
}
#endif // TF_OBJ_BASE_MANNED_GUN_H
|