summaryrefslogtreecommitdiff
path: root/game/server/tf2/tf_func_weldable_door.h
blob: b887ba7d6e415506739e5faabc064dfeb0d94b35 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include "doors.h"

class CBeam;


//-----------------------------------------------------------------------------
// Purpose: Weld Point for a weldable door
//-----------------------------------------------------------------------------
class CWeldPoint : public CPointEntity
{
	DECLARE_CLASS( CWeldPoint, CPointEntity );
public:
	void	Spawn( void );
	void	SetEndPoint( const Vector &vecEndPoint );
	const Vector &GetStartPoint( void ) const;
	const Vector &GetEndPoint( void ) const;

private:
	Vector	m_vecEndPoint;
};

// Weld Leader
enum
{
	WL_UNASSIGNED,
	WL_WELD_LEADER,
	WL_WELD_CHILD,
};

//-----------------------------------------------------------------------------
// Purpose: A weldable door
//-----------------------------------------------------------------------------
class CWeldableDoor : public CBaseDoor
{
public:
	DECLARE_CLASS( CWeldableDoor, CBaseDoor );

	DECLARE_DATADESC();

	virtual void	Spawn( void );
	virtual void	Activate( void );

	// Welding
	virtual bool	IsWeldable( CBaseTFPlayer *pWeldee );
	virtual void	StartWelding( CBaseTFPlayer *pWeldee );
	virtual void	StopWelding( void );
	virtual float	GetWeldPercentage( void );
	virtual Vector	GetPlayerWeldPoint( void );
	virtual void	UpdateWeld( bool bCutting, float flWeldPercentage );
	CWeldableDoor	*GetWeldLeader( void );

	// Welding
	int			m_iWeldLeader;
	EHANDLE		m_hWeldingPlayer;

	// Weld points
	string_t	m_iszWeldPoints;
	CUtlVector	< CWeldPoint * >	m_aWeldPoints;

	// Weld beams
	float		m_flMaxWeldedPercentage;
	float		m_flWeldedPercentage;
	CUtlVector	< CBeam * >			m_aWeldBeams;
	CUtlVector	< CBeam * >			m_aCutBeams;
};


#endif // TF_FUNC_WELDABLE_DOOR_H