summaryrefslogtreecommitdiff
path: root/game/server/dod/dod_control_point.h
blob: 50905c3bed43376ca1a27d1e8475afedc52fb152 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//

#ifndef DOD_CONTROL_POINT_H
#define DOD_CONTROL_POINT_H
#ifdef _WIN32
#pragma once
#endif

#include "dod_player.h"

#define CAP_ICON_ALLIES_FLAG	1
#define CAP_ICON_BRIT_FLAG		27	//from dod_objectives.cpp

#define CAP_POINT_HIDEFLAG		(1<<0)
#define CAP_POINT_HIDE_MODEL	(1<<1)
#define CAP_POINT_TICK_FOR_BOMBS_REMAINING	(1<<2)

#define PLAYER_POINTS_FOR_CAP	1
#define PLAYER_POINTS_FOR_BLOCK 1
#define PLAYER_POINTS_FOR_BOMB_PLANT	1
#define PLAYER_POINTS_FOR_BOMB_EXPLODED	3


class CControlPoint : public CBaseAnimating
{

public:
	DECLARE_CLASS( CControlPoint, CBaseAnimating );
	DECLARE_DATADESC();

	CControlPoint();

	virtual void Spawn( void );
	virtual bool KeyValue( const char *szKeyName, const char *szValue );
	virtual void Precache( void );

	void		Reset( void );

	//Inputs
	inline void Enable( inputdata_t &input )	{ SetActive( false ); }
	inline void Disable( inputdata_t &input )	{ SetActive( true ); }
	void		InputReset( inputdata_t &input );
	void		InputSetOwner( inputdata_t &input );

	void		InputShowModel( inputdata_t &input );
	void		InputHideModel( inputdata_t &input );

	int			PointValue( void );
	
	void		RoundRespawn( void );	//Mugsy - resetting
	void		TriggerTargets( void );

	void		SetActive( bool active );

	bool		PointIsVisible( void ) { return !( FBitSet( m_spawnflags, CAP_POINT_HIDEFLAG ) ); }

	void		SendCapString( int team, int iNumCappers, int *pCappingPlayers );

	void		SetOwner( int team, bool bMakeSound = true, int iNumCappers = 0, int *iCappingPlayers = NULL );
	int			GetOwner( void ) const;

	int			GetDefaultOwner( void ) const;

	inline const char *GetName( void ) { return STRING(m_iszPrintName); }
	int			GetCPGroup( void );
	int			GetPointIndex( void ) { return m_iPointIndex; }	//the mapper set index
	void		SetPointIndex( int index ) { m_iPointIndex = index; }
	int			GetAlliesIcon( void ) { return m_iAlliesIcon; }
	int			GetAxisIcon( void ) { return m_iAxisIcon; }
	int			GetNeutralIcon( void ) { return m_iNeutralIcon; }

	int			GetCurrentHudIconIndex( void );
	int			GetHudIconIndexForTeam( int team );
	int			GetTimerCapHudIcon( void );
	int			GetBombedHudIcon( void );

	inline bool	IsActive( void ) { return m_bActive; }

	void		SetNumCappersRequired( int alliesRequired, int axisRequired );

	void		CaptureBlocked( CDODPlayer *pPlayer );

	// Bomb interface
	void		BombPlanted( float flTimerLength, CDODPlayer *pPlantingPlayer );
	void		BombExploded( CDODPlayer *pPlantingPlayer = NULL, int iPlantingTeam = TEAM_UNASSIGNED );
	void		BombDisarmed( CDODPlayer *pDisarmingPlayer );
	void		CancelBombPlanted( void );

	int			GetBombsRemaining( void ) { return m_iBombsRemaining; }	// total bombs required
	int			GetBombsRequired( void ) { return m_iBombsRequired; }		// number of bombs remaining

private:
	void		InternalSetOwner( int team, bool bMakeSound = true, int iNumCappers = 0, int *iCappingPlayers = NULL );

	int			m_iTeam;			//0 - clear, 2 - allies, 3 - axis
	int			m_iDefaultOwner;	//team that initially owns the cap point
	int			m_iIndex;			//the index of this point in the controlpointArray

	string_t	m_iszPrintName;
	
	string_t	m_iszAlliesCapSound;	//the sound to play on cap
	string_t	m_iszAxisCapSound;
	string_t	m_iszResetSound;

	string_t	m_iszAlliesModel;		//models to set the ent to on capture
	string_t	m_iszAxisModel;
	string_t	m_iszResetModel;

	int			m_iAlliesModelBodygroup;//which bodygroup to use in the model
	int			m_iAxisModelBodygroup;
	int			m_iResetModelBodygroup;

	COutputEvent	m_AlliesCapOutput;	//outputs to fire when capped
	COutputEvent	m_AxisCapOutput;
	COutputEvent	m_PointResetOutput;

	COutputEvent m_OwnerChangedToAllies;
	COutputEvent m_OwnerChangedToAxis;

	int			m_iAlliesIcon;			//custom hud sprites for cap point
	int			m_iAxisIcon;
	int			m_iNeutralIcon;
	int			m_iTimerCapIcon;
	int			m_iBombedIcon;

	string_t	m_iszAlliesIcon;
	string_t	m_iszAxisIcon;
	string_t	m_iszNeutralIcon;
	string_t	m_iszTimerCapIcon;
	string_t    m_iszBombedIcon;

	int			m_bPointVisible;		//should this capture point be visible on the hud?
	int			m_iPointIndex;			//the mapper set index value of this control point

	int			m_iCPGroup;			//the group that this control point belongs to
	bool		m_bActive;			//

	string_t	m_iszName;				//Name used in cap messages

	bool		m_bStartDisabled;

	int m_iAlliesRequired;		// if we're controlled by an area cap, 
	int m_iAxisRequired;		// these hold the number of cappers required. Used to calc point value

	int m_iTimedPointsAllies;	// timed points value of this flag, per team
	int m_iTimedPointsAxis;

	bool m_bBombPlanted;
	float m_flBombExplodeTime;

	int m_iBombsRemaining;
	int m_iBombsRequired;	// number of bombs required to flip this control point

	bool m_bSetOwnerIsBombPlant;	// temp flag to indicate if the set owner we're doing is the result of a bomb

private:
	CControlPoint( const CControlPoint & );
};

#endif //DOD_CONTROL_POINT_H