summaryrefslogtreecommitdiff
path: root/game/client/tf2/mapdata.h
blob: a251b9bc2c689fd00e568cbfa9b12408234b7cf9 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $Workfile:     $
// $NoKeywords: $
//=============================================================================//
#if !defined( MAPDATA_H )
#define MAPDATA_H
#ifdef _WIN32
#pragma once
#endif

#include <vgui_controls/Panel.h>
#include <vgui/IImage.h>
#include "mathlib/vector.h"
#include "mapdata_shared.h"
#include "sharedinterface.h"

#define MAX_ZONES		32
#define MAX_CLASSES		32
#define MAX_MAP_TEAMS	8
#define MINIMAP_MATERIAL_STRING_SIZE 64
#define MINIMAP_STRING_SIZE 128

class Vector;
class C_BaseEntity;
class BitmapImage;

class CMapClassColors
{
public:
	BitmapImage		*m_pClassImage;
	Color		m_clrClass;
};

class CMapTeamColors
{
public:
	CMapClassColors	m_ClassColors[ MAX_CLASSES ];

	BitmapImage		*m_pImage;
	Color		m_clrBlip;
	Color		m_clrTeam;
};

class CMapPlayers
{
public:
	int				m_nTeam;
	bool			m_bVisible;
	bool			m_bSelected;
	int				m_nSquadNumber;
	int				m_nXPos, m_nYPos;

	BitmapImage		*m_pImage;
	Color		m_clrPlayer;
};

class CMapZones
{
public:
	int				m_nControllingTeam;

	BitmapImage		*m_pZoneImage;
};

struct MinimapData_t
{
	char	m_szBackgroundMaterial[MINIMAP_MATERIAL_STRING_SIZE];
};

class CMapData : public IMapData
{
public:
					CMapData( void );
	virtual			~CMapData( void );

	void			Init( void );
	void			Clear( void );
	void			LevelInit( const char *map );
	void			LevelShutdown( void );

	void			Update( );
	bool			IsEntityVisibleToTactical( C_BaseEntity* pEnt ) const;

	void			UseDefaults( void );
	void			SetTeamDefaultColor( int iTeamNumber, int r, int g, int b );

	void			UserCmd_ForceMapReload( void );

	// map dimensions
	void			GetMapBounds(Vector& mins, Vector& maxs);
	void			GetMapOrigin(Vector& org);
	void			GetMapSize(Vector& size);

	// 3d skybox
	void			Get3DSkyboxOrigin( Vector &vecOrigin );
	float			Get3DSkyboxScale( void );

	// Indicates the area currently visible in commander mode
	void			SetVisibleArea( const Vector& mins, const Vector& maxs );
	void			GetVisibleArea( Vector& mins, Vector& maxs );

public:
	CMapZones		m_Zones[ MAX_ZONES ];
	CMapPlayers		m_Players[ MAX_PLAYERS ];
	CMapTeamColors	m_TeamColors[ MAX_MAP_TEAMS+1 ];
	MinimapData_t	m_Minimap;

private:
	char	m_szMap[ MINIMAP_STRING_SIZE ];

	// World size + visible size in commander mode
	Vector	m_WorldMins;
	Vector	m_WorldMaxs;
	Vector	m_VisibleMins;
	Vector	m_VisibleMaxs;
};


//-----------------------------------------------------------------------------
// Gets at the singleton map data 
//-----------------------------------------------------------------------------
CMapData& MapData();


#endif // MAPDATA_H