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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef COMMANDEROVERLAYPANEL_H
#define COMMANDEROVERLAYPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "CommanderOverlay.h"
#include <vgui_controls/Panel.h>
#define TACTICAL_ZOFFSET 100
#define TACTICAL_MIN_VIEWABLE_SIZE 1000
#define TACTICAL_SPACEBAR_VIEWABLE_SIZE 4000
#define FOG_ALPHAMAP_SIZE 64
class C_TFTeam;
class IVTFTexture;
class ITexture;
class CCommanderOverlayPanel : public vgui::Panel
{
typedef vgui::Panel BaseClass;
// Panel overrides.
public:
CCommanderOverlayPanel( void );
virtual ~CCommanderOverlayPanel( void );
virtual void Paint();
virtual void OnMousePressed(vgui::MouseCode code);
virtual void OnMouseReleased(vgui::MouseCode code);
virtual void OnCursorMoved(int x, int y);
virtual void OnMouseWheeled(int delta);
virtual void OnKeyPressed(vgui::KeyCode code);
// Call on enable
void Enable();
void Disable();
// called when we're ticked (updates our state)...
void OnTick();
// Call when the map changes
void LevelInit( char const* pMapName );
void LevelShutdown( void );
// Returns the visible area (not including the tech tree)
void GetVisibleSize( int& w, int& h );
// Returns the visible area in world units
void GetVisibleArea( Vector& mins, Vector& maxs );
// Returns the number of world units per pixel
float WorldUnitsPerPixel();
// Fill in the rectangle that the view is rendered from.
// It is looking down negative Z, and goes from [vCenter.x-xSize, vCenter.y-ySize] to [vCenter.x+xSize, vCenter.y+ySize].
void GetOrthoRenderBox(Vector &vCenter, float &xSize, float &ySize);
void GetVisibleOrthoSize(float &xSize, float &ySize);
void ActualToVisibleOffset( Vector& offset );
void BoundOrigin( Vector& camera );
void CreatePickingRay( int mousex, int mousey,
int screenwidth, int screenheight,
const Vector& vecRenderOrigin,
const QAngle& vecRenderAngles,
Vector &rayOrigin,
Vector &rayDirection
);
Vector& TacticalOrigin() { return m_vecTacticalOrigin; }
QAngle& TacticalAngles() { return m_vecTacticalAngles; }
float GetZoom( void );
void SetCommanderView( CClientModeCommander *commander );
bool IsRightMouseMapMoving( void );
private:
struct MouseDown_t
{
bool m_bMouseDown;
int m_nXStart;
int m_nYStart;
int m_nXCurrent;
int m_nYCurrent;
int m_nXPrev;
int m_nYPrev;
};
// Compute render origin
void InitializeRenderOrigin();
// Methods relating to zoom
void ComputeZoomRange();
void LeftMousePressed( void );
void LeftMouseReleased( void );
void RightMousePressed( void );
void RightMouseReleased( void );
void RightMouseMapMove( void );
// Shows the entire view
void ChangeZoomLevel( float newZoom );
// Centers the view on the mouse
void CenterOnMouse( Vector& mouseWorldPos );
int CountSelectedPlayers( void );
void GetSelectedPlayerBitField( CBitVec< MAX_PLAYERS >& bits );
void SelectPlayersInRectangle( int x0, int y0, int x1, int y1, bool clearOldSelections = true );
void GetMousePos( int& x, int& y );
void StartMovingMouse( MouseDown_t& mouse );
void UpdateMousePos( int x, int y, MouseDown_t& mouse );
// camera origin
Vector m_vecTacticalOrigin;
QAngle m_vecTacticalAngles;
MouseDown_t m_left, m_right;
float m_fZoom; // 0 = sitting at world maxs.z. 1 = at maxs.z + (maxs.z-mins.z)*2.
float m_MinWorldWidth;
float m_MaxWorldWidth;
bool m_bHaveActiveSelection;
float m_flPreviousMaxWorldWidth;
CClientModeCommander *m_pCommanderView;
vgui::HCursor m_CursorCommander;
vgui::HCursor m_CursorRightMouseMove;
};
#endif // COMMANDEROVERLAYPANEL_H
|