summaryrefslogtreecommitdiff
path: root/game/server/tf/entity_rune.h
blob: 6dac698055d171b8ae000e1e71ba5c3db0e81ccc (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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: CTF Powerup Rune.
//
//=============================================================================//
#ifndef ENTITY_RUNE_H
#define ENTITY_RUNE_H

#ifdef _WIN32
#pragma once
#endif

#include "tf_powerup.h"
#include "tf_gamerules.h"

#define TF_RUNE_STRENGTH		"models/pickups/pickup_powerup_strength.mdl"
#define TF_RUNE_RESIST			"models/pickups/pickup_powerup_defense.mdl"
#define TF_RUNE_REGEN			"models/pickups/pickup_powerup_regen.mdl"
#define TF_RUNE_HASTE			"models/pickups/pickup_powerup_haste.mdl"
#define TF_RUNE_VAMPIRE			"models/pickups/pickup_powerup_vampire.mdl"
#define TF_RUNE_REFLECT 		"models/pickups/pickup_powerup_reflect.mdl"
#define TF_RUNE_PRECISION 		"models/pickups/pickup_powerup_precision.mdl"
#define TF_RUNE_AGILITY 		"models/pickups/pickup_powerup_agility.mdl"
#define TF_RUNE_KNOCKOUT 		"models/pickups/pickup_powerup_knockout.mdl"
#define TF_RUNE_KING			"models/pickups/pickup_powerup_king.mdl"
#define TF_RUNE_PLAGUE			"models/pickups/pickup_powerup_plague.mdl"
#define TF_RUNE_SUPERNOVA		"models/pickups/pickup_powerup_supernova.mdl"

#define TF_RUNE_TEMP_CRIT		"models/pickups/pickup_powerup_crit.mdl"
#define TF_RUNE_TEMP_UBER		"models/pickups/pickup_powerup_uber.mdl"

DECLARE_AUTO_LIST( IInfoPowerupSpawnAutoList );

//=============================================================================
//
// CTF Rune class. Powerups which last the life of the player and drop when they die
//
//=============================================================================

class CTFRune : public CTFPowerup
{
public:
	DECLARE_CLASS( CTFRune, CTFPowerup );

	CTFRune();
	~CTFRune();

	virtual void	Spawn( void ) OVERRIDE;
	virtual void	Precache( void ) OVERRIDE;
	virtual bool	MyTouch( CBasePlayer *pPlayer );
	static CTFRune*	CreateRune( const Vector &vecOrigin, RuneTypes_t nType, int nTeam, bool bShouldReposition, bool bApplyForce, Vector vecSpawnDirection = vec3_origin );
	static bool		RepositionRune( RuneTypes_t nType, int nTeamNumber );
	float			GetRuneRepositionTime( void );

	virtual const char *GetDefaultPowerupModel( void )
	{
		if ( m_nRuneType == RUNE_STRENGTH )
		{
			return TF_RUNE_STRENGTH;
		}
		else if ( m_nRuneType == RUNE_RESIST )
		{
			return TF_RUNE_RESIST;
		}
		else if ( m_nRuneType == RUNE_REGEN )
		{
			return TF_RUNE_REGEN;
		}
		else if ( m_nRuneType == RUNE_HASTE )
		{
			return TF_RUNE_HASTE;
		}
		else if ( m_nRuneType == RUNE_VAMPIRE )
		{
			return TF_RUNE_VAMPIRE;
		}
		else if ( m_nRuneType == RUNE_REFLECT )
		{
			return TF_RUNE_REFLECT;
		}
		else if ( m_nRuneType == RUNE_PRECISION )
		{
			return TF_RUNE_PRECISION;
		}
		else if ( m_nRuneType == RUNE_AGILITY )
		{
			return TF_RUNE_AGILITY;
		}
		else if ( m_nRuneType == RUNE_KNOCKOUT )
		{
			return TF_RUNE_KNOCKOUT;
		}
		else if ( m_nRuneType == RUNE_KING )
		{
			return TF_RUNE_KING;
		}
		else if ( m_nRuneType == RUNE_PLAGUE )
		{
			return TF_RUNE_PLAGUE;
		}
		else if ( m_nRuneType == RUNE_SUPERNOVA )
		{
			return TF_RUNE_SUPERNOVA;
		}
		return TF_RUNE_STRENGTH;
	}
	
	virtual int		UpdateTransmitState( void ) OVERRIDE;
	virtual	int		ShouldTransmit( const CCheckTransmitInfo *pInfo ) OVERRIDE;

protected:
	bool m_bApplyForce;
	virtual void ComeToRest( void );
	Vector m_vecSpawnDirection;

private:
	void BlinkThink();

	RuneTypes_t m_nRuneType;
	int m_nBlinkCount;
	float m_flKillTime;
	float m_flCanPickupTime;
	int m_nTeam;
	bool m_bShouldReposition;
};

//=============================================================================
//
// CTF Rune Temp class - Powerups whose effect lasts a length of time, then deactivates
//
//=============================================================================

class CTFRuneTemp : public CTFPowerup
{
public:
	DECLARE_CLASS( CTFRuneTemp, CTFPowerup );

	CTFRuneTemp();

	virtual void		Spawn( void ) OVERRIDE;
	virtual void		Precache( void ) OVERRIDE;
	virtual bool		MyTouch( CBasePlayer *pPlayer ) OVERRIDE;
	virtual const char 	*GetDefaultPowerupModel( void ) OVERRIDE { return TF_RUNE_TEMP_CRIT; }
	virtual float		GetRespawnDelay( void ) OVERRIDE;
		
protected:
	void	TempRuneRespawnThink( void );

	int		m_nRuneTempType;
};

//=============================================================================
//
// Temporary Crit boost
//
//=============================================================================

class CTFRuneTempCrit : public CTFRuneTemp
{
public:
	DECLARE_CLASS( CTFRuneTempCrit, CTFRuneTemp );

	CTFRuneTempCrit();
};

//=============================================================================
//
// Temporary Uber boost
//
//=============================================================================

class CTFRuneTempUber : public CTFRuneTemp
{
public:
	DECLARE_CLASS( CTFRuneTempUber, CTFRuneTemp );

	CTFRuneTempUber();

	virtual const char 	*GetDefaultPowerupModel( void ) OVERRIDE { return TF_RUNE_TEMP_UBER; }

};

//=============================================================================
//
// Powerup Spawn point class - location to spawn a powerup at
//
//=============================================================================

class CTFInfoPowerupSpawn : public CPointEntity, public IInfoPowerupSpawnAutoList
{
public:
	DECLARE_CLASS( CTFInfoPowerupSpawn, CPointEntity );
	CTFInfoPowerupSpawn();
	DECLARE_DATADESC();
	
	virtual void Spawn() OVERRIDE;

	bool IsDisabled() const { return m_bDisabled; }
	bool HasRune() const { return m_hRune != NULL; }
	void SetRune( CTFRune *pRune ) { m_hRune = pRune; }

private:
	bool m_bDisabled;
	int m_nTeam;
	CHandle< CTFRune > m_hRune;
};
#endif // ENTITY_RUNE_H