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

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

#include "triggers.h"

class CFuncRespawnRoomVisualizer;

// This class is to get around the fact that DEFINE_FUNCTION doesn't like multiple inheritance
class CFuncRespawnRoomShim : public CBaseTrigger
{
	virtual void RespawnRoomTouch( CBaseEntity *pOther ) = 0;
public:
	void	Touch( CBaseEntity *pOther ) { return RespawnRoomTouch( pOther ) ; }
};

//-----------------------------------------------------------------------------
// Purpose: Defines an area considered inside a respawn room
//-----------------------------------------------------------------------------
DECLARE_AUTO_LIST( IFuncRespawnRoomAutoList );


class CFuncRespawnRoom : public CFuncRespawnRoomShim, public IFuncRespawnRoomAutoList
{
	DECLARE_CLASS( CFuncRespawnRoom, CFuncRespawnRoomShim );

public:

	CFuncRespawnRoom();

	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();

	virtual void Spawn( void );
	virtual void Activate( void );
	virtual void ChangeTeam( int iTeamNum ) OVERRIDE;

	virtual void RespawnRoomTouch( CBaseEntity *pOther ) OVERRIDE;
	virtual void StartTouch(CBaseEntity *pOther) OVERRIDE;
	virtual void EndTouch(CBaseEntity *pOther) OVERRIDE;

	// Inputs
	void	InputSetActive( inputdata_t &inputdata );
	void	InputSetInactive( inputdata_t &inputdata );
	void	InputToggleActive( inputdata_t &inputdata );
	void	InputRoundActivate( inputdata_t &inputdata );

	void	SetActive( bool bActive );
	bool	GetActive() const;

	void	AddVisualizer( CFuncRespawnRoomVisualizer *pViz );
	
private:
	bool	m_bActive;
	int		m_iOriginalTeam;

	CUtlVector< CHandle<CFuncRespawnRoomVisualizer> >	m_hVisualizers;
};

//-----------------------------------------------------------------------------
// Is a given point contained within a respawn room?
//-----------------------------------------------------------------------------
bool PointInRespawnRoom( const CBaseEntity *pEntity, const Vector &vecOrigin, bool bTouching_SameTeamOnly = false );

bool PointsCrossRespawnRoomVisualizer( const Vector& vecStart, const Vector &vecEnd, int nTeamToIgnore = TEAM_UNASSIGNED );
#endif // FUNC_RESPAWNROOM_H