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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef VEHICLE_APC_H
#define VEHICLE_APC_H
#ifdef _WIN32
#pragma once
#endif
#include "vehicle_base.h"
#include "smoke_trail.h"
//-----------------------------------------------------------------------------
// Purpose: Four wheel physics vehicle server vehicle with weaponry
//-----------------------------------------------------------------------------
class CAPCFourWheelServerVehicle : public CFourWheelServerVehicle
{
typedef CFourWheelServerVehicle BaseClass;
// IServerVehicle
public:
bool NPC_HasPrimaryWeapon( void ) { return true; }
void NPC_AimPrimaryWeapon( Vector vecTarget );
bool NPC_HasSecondaryWeapon( void ) { return true; }
void NPC_AimSecondaryWeapon( Vector vecTarget );
// Weaponry
void Weapon_PrimaryRanges( float *flMinRange, float *flMaxRange );
void Weapon_SecondaryRanges( float *flMinRange, float *flMaxRange );
float Weapon_PrimaryCanFireAt( void ); // Return the time at which this vehicle's primary weapon can fire again
float Weapon_SecondaryCanFireAt( void ); // Return the time at which this vehicle's secondary weapon can fire again
};
//-----------------------------------------------------------------------------
// A driveable vehicle with a gun that shoots wherever the driver looks.
//-----------------------------------------------------------------------------
class CPropAPC : public CPropVehicleDriveable
{
DECLARE_CLASS( CPropAPC, CPropVehicleDriveable );
public:
// CBaseEntity
virtual void Precache( void );
void Think( void );
virtual void Spawn(void);
virtual void Activate();
virtual void UpdateOnRemove( void );
virtual void OnRestore( void );
// CPropVehicle
virtual void CreateServerVehicle( void );
virtual void DriveVehicle( float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased );
virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMoveData );
virtual Class_T ClassifyPassenger( CBaseCombatCharacter *pPassenger, Class_T defaultClassification );
virtual int OnTakeDamage( const CTakeDamageInfo &info );
virtual float PassengerDamageModifier( const CTakeDamageInfo &info );
// Weaponry
const Vector &GetPrimaryGunOrigin( void );
void AimPrimaryWeapon( const Vector &vecForward );
void AimSecondaryWeaponAt( CBaseEntity *pTarget );
float PrimaryWeaponFireTime( void ) { return m_flMachineGunTime; }
float SecondaryWeaponFireTime( void ) { return m_flRocketTime; }
float MaxAttackRange() const;
bool IsInPrimaryFiringCone() const { return m_bInFiringCone; }
// Muzzle flashes
const char *GetTracerType( void ) ;
void DoImpactEffect( trace_t &tr, int nDamageType );
void DoMuzzleFlash( void );
virtual Vector EyePosition( ); // position of eyes
Vector BodyTarget( const Vector &posSrc, bool bNoisy );
virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
private:
enum
{
MAX_SMOKE_TRAILS = 4,
MAX_EXPLOSIONS = 4,
};
// Should we trigger a damage effect?
bool ShouldTriggerDamageEffect( int nPrevHealth, int nEffectCount ) const;
// Add a smoke trail since we've taken more damage
void AddSmokeTrail( const Vector &vecPos );
// Creates the breakable husk of an attack chopper
void CreateChopperHusk();
// Pow!
void ExplodeAndThrowChunk( const Vector &vecExplosionPos );
void Event_Killed( const CTakeDamageInfo &info );
// Purpose:
void GetRocketShootPosition( Vector *pPosition );
void FireMachineGun( void );
void FireRocket( void );
// Death volley
void FireDying( );
// Create a corpse
void CreateCorpse( );
// Blows da shizzle up
void InputDestroy( inputdata_t &inputdata );
void InputFireMissileAt( inputdata_t &inputdata );
void CreateAPCLaserDot( void );
virtual bool ShouldAttractAutoAim( CBaseEntity *pAimingEnt );
private:
// Danger sounds made by the APC
float m_flDangerSoundTime;
// handbrake after the fact to keep vehicles from rolling
float m_flHandbrakeTime;
bool m_bInitialHandbrake;
// Damage effects
int m_nSmokeTrailCount;
// Machine gun attacks
int m_nMachineGunMuzzleAttachment;
int m_nMachineGunBaseAttachment;
float m_flMachineGunTime;
int m_iMachineGunBurstLeft;
Vector m_vecBarrelPos;
bool m_bInFiringCone;
// Rocket attacks
EHANDLE m_hLaserDot;
EHANDLE m_hRocketTarget;
int m_iRocketSalvoLeft;
float m_flRocketTime;
int m_nRocketAttachment;
int m_nRocketSide;
EHANDLE m_hSpecificRocketTarget;
string_t m_strMissileHint;
COutputEvent m_OnDeath;
COutputEvent m_OnFiredMissile;
COutputEvent m_OnDamaged;
COutputEvent m_OnDamagedByPlayer;
DECLARE_DATADESC();
};
#endif // VEHICLE_APC_H
|