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

#ifndef ENV_METEOR_H
#define ENV_METEOR_H
#pragma once

#include "BaseEntity.h"
#include "BaseAnimating.h"
#include "Env_Meteor_Shared.h"
#include "utlvector.h"

//=============================================================================
//
// Server-side Meteor Factory Class
//
class CMeteorFactory : public IMeteorFactory
{
public:

	void CreateMeteor( int nID, int iType, const Vector &vecPosition, 
		               const Vector &vecDirection, float flSpeed, float flStartTime,
					   float flDamageRadius,
					   const Vector &vecTriggerMins, const Vector &vecTriggerMaxs );
};

//=============================================================================
//
// Meteor Spawner Class
//
class CEnvMeteorSpawner : public CBaseEntity
{
public:
	
	DECLARE_CLASS( CEnvMeteorSpawner, CBaseEntity );

	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();

	CEnvMeteorSpawner();

	void	Spawn( void );
	void	Precache( void );
	void	MeteorSpawnerThink( void );
	int		UpdateTransmitState() { return SetTransmitState( FL_EDICT_FULLCHECK ); }
	int 	ShouldTransmit( const CCheckTransmitInfo *pInfo );
	void	Activate( void );

private:

	// Inputs
	void	InputEnable( inputdata_t &inputdata );
	void	InputDisable( inputdata_t &inputdata );

	void	Get3DSkyboxWorldBounds( Vector &vecTriggerMins, Vector &vecTriggerMaxs );

	CMeteorFactory				m_Factory;
	CNetworkVarEmbedded( CEnvMeteorSpawnerShared, m_SpawnerShared );

	CNetworkVar( bool, m_fDisabled );				// Spawner active (trigger). NOTE: uses an f to remain consistent
	                                                        // with entity input system
};

//=============================================================================
//
// Meteor Target Class
//
class CEnvMeteorTarget : public CBaseEntity
{
public:

	DECLARE_CLASS( CEnvMeteorTarget, CBaseEntity );
	DECLARE_DATADESC();

	CEnvMeteorTarget();
	void	Spawn( void );
	
	int			m_iTargetID;
	float		m_flRadius;
};

//=============================================================================
//
// Meteor Class
//
class CEnvMeteor : public CBaseAnimating
{

	DECLARE_CLASS( CEnvMeteor, CBaseAnimating );

public:

	DECLARE_DATADESC();

	//-------------------------------------------------------------------------
	// Initialization
	//-------------------------------------------------------------------------
	CEnvMeteor();
	static CEnvMeteor  *Create( int nID, int iMeteorType, const Vector &vecOrigin, 
		                       const Vector &vecDirection, float flSpeed, float flStartTime,
							   float flDamageRadius,
							   const Vector &vecTriggerMins, const Vector &vecTriggerMaxs );
	void				Spawn( void );
	
	//-------------------------------------------------------------------------
	// Think(s)
	//-------------------------------------------------------------------------
	void				MeteorSkyboxThink( void );
	void				MeteorWorldThink( void );

private:

	CEnvMeteorShared			m_Meteor;
	bool						m_bPrevInSkybox;
	Vector						m_vecMin, m_vecMax;
};

//=============================================================================
//
// Shooting Star Spawner Class
//
class CShootingStarSpawner : public CBaseEntity
{
	DECLARE_CLASS( CShootingStarSpawner, CBaseEntity );

public:

	CShootingStarSpawner();

	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();

	virtual int		UpdateTransmitState() { return SetTransmitState( FL_EDICT_FULLCHECK ); }
	virtual int		ShouldTransmit( const CCheckTransmitInfo *pInfo );

public:

	CNetworkVar( float, m_flSpawnInterval );		// How often do I spawn shooting stars?
	bool		m_bSkybox;				// Is the spawner in the skybox?
};

#endif // ENV_METEOR_H