aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/hl1_CBaseHelicopter.h
blob: 015861264830ce198a4f7d28c3f21aed479a8360 (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
129
130
131
132
133
134
135
136
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//
//---------------------------------------------------------
//  Helicopter flags
//---------------------------------------------------------
enum HelicopterFlags_t
{
	BITS_HELICOPTER_GUN_ON			= 0x00000001,	// Gun is on and aiming
	BITS_HELICOPTER_MISSILE_ON		= 0x00000002,	// Missile turrets are on and aiming
};


//---------------------------------------------------------
//---------------------------------------------------------

#define SF_NOWRECKAGE		0x08
#define SF_NOROTORWASH		0x20
#define SF_AWAITINPUT		0x40


//---------------------------------------------------------
//---------------------------------------------------------
#define BASECHOPPER_MAX_SPEED			400.0f
#define BASECHOPPER_MAX_FIRING_SPEED	250.0f
#define BASECHOPPER_MIN_ROCKET_DIST		1000.0f
#define BASECHOPPER_MAX_GUN_DIST		2000.0f


//=========================================================
//=========================================================
class CBaseHelicopter : public CAI_BaseNPC
{
public:
	DECLARE_CLASS( CBaseHelicopter, CAI_BaseNPC );

	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();

	void Spawn( void );
	void Precache( void );
	
	void Event_Killed( const CTakeDamageInfo &info );
	void StopLoopingSounds();

	int  BloodColor( void ) { return DONT_BLEED; }
	void GibMonster( void );

	Class_T Classify ( void ) { return CLASS_HUMAN_MILITARY; }

	void CallDyingThink( void ) { DyingThink(); }

	bool HasEnemy( void ) { return GetEnemy() != NULL; }
	void CheckEnemy( CBaseEntity *pEnemy );
	virtual bool ChooseEnemy( void );
	virtual void HelicopterThink( void );
	virtual void HelicopterPostThink( void ) { };
	virtual void FlyTouch( CBaseEntity *pOther );
	virtual void CrashTouch( CBaseEntity *pOther );
	virtual void DyingThink( void );
	virtual void Startup( void );
	virtual void NullThink( void );

	virtual void Flight( void );

	virtual void ShowDamage( void ) {};

	virtual void FlyPathCorners( void );
	void UpdatePlayerDopplerShift( void );

	virtual void Hunt( void );

	virtual bool IsCrashing( void ) { return m_lifeState != LIFE_ALIVE; }
	virtual float GetAcceleration( void ) { return 5; }
	virtual bool HasReachedTarget( void ); 
	virtual void OnReachedTarget( CBaseEntity *pTarget ) {};

	virtual void ApplySidewaysDrag( const Vector &vecRight );
	virtual void ApplyGeneralDrag( void );


	int		OnTakeDamage_Alive( const CTakeDamageInfo &info );
	void	TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );

	virtual bool FireGun( void );

	virtual float GetRotorVolume( void ) { return 1.0; }
	virtual void InitializeRotorSound( void );
	virtual void UpdateRotorSoundPitch( int iPitch );

	virtual void AimRocketGun(void) {};
	virtual void FireRocket(  Vector vLaunchPos, Vector vLaunchDir  ) {};

	void	DrawDebugGeometryOverlays(void);

	CSoundPatch *m_pRotorSound;

	float			m_flForce;
	int				m_fHelicopterFlags;

	Vector			m_vecDesiredFaceDir;
	Vector			m_vecDesiredPosition;

	Vector			m_vecGoalOrientation; // orientation of the goal entity.

	float			m_flLastSeen;
	float			m_flPrevSeen;

	int				m_iSoundState;		// don't save this

	Vector			m_vecTarget;
	Vector			m_vecTargetPosition;

	float			m_flMaxSpeed;		// Maximum speed of the helicopter.
	float			m_flMaxSpeedFiring;	// Maximum speed of the helicopter whilst firing guns.

	float			m_flGoalSpeed;		// Goal speed
	float			m_flInitialSpeed;
	float			m_angleVelocity;

	void ChangePathCorner( const char *pszName );

	// Inputs
	void InputChangePathCorner( inputdata_t &inputdata );
	void InputActivate( inputdata_t &inputdata );

	// Outputs
	COutputEvent	m_AtTarget;			// Fired when pathcorner has been reached
	COutputEvent	m_LeaveTarget;		// Fired when pathcorner is left

	float			m_flNextCrashExplosion;
};