summaryrefslogtreecommitdiffstats
path: root/src/render/Hud.h
blob: bae19ee462d379cd76076319fc4a3d04a8cfe4db (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
#pragma once
#include "Sprite2d.h"

enum eItems
{
	ITEM_NONE = -1,
	ITEM_ARMOUR = 3,
	ITEM_HEALTH = 4,
	ITEM_RADAR = 8
};

// Thanks for vague name, R*
enum DRAW_FADE_STATE
{
	HUD_WANTED_FADING = 0,
	HUD_ENERGY_FADING,
	HUD_SCORE_FADING,
	HUD_WEAPON_FADING,
};

// My name
enum eFadeOperation
{
	FADED_OUT = 0,
	START_FADE_OUT,
	FADING_IN,
	FADING_OUT,
	FADE_DISABLED = 5,
};

enum eSprites 
{
	HUD_FIST,
	HUD_BAT,
	HUD_PISTOL,
	HUD_UZI,
	HUD_SHOTGUN,
	HUD_AK47,
	HUD_M16,
	HUD_SNIPER,
	HUD_ROCKET,
	HUD_FLAME,
	HUD_MOLOTOV,
	HUD_GRENADE,
	HUD_DETONATOR,
	HUD_RADARDISC = 15,
	HUD_PAGER = 16,
	HUD_SITESNIPER = 20,
	HUD_SITEM16,
	HUD_SITEROCKET,
	NUM_HUD_SPRITES,
};

// TODO(Miami): Make those 0.7f - 1.25f once fonts have been ported
#define HUD_TEXT_SCALE_X 0.8f
#define HUD_TEXT_SCALE_Y 1.35f

class CHud
{
public:
	static CSprite2d Sprites[NUM_HUD_SPRITES];
	static wchar m_HelpMessage[256];
	static wchar m_LastHelpMessage[256];
	static uint32 m_HelpMessageState;
	static uint32 m_HelpMessageTimer;
	static int32 m_HelpMessageFadeTimer;
	static wchar m_HelpMessageToPrint[256];
	static float &m_HelpMessageDisplayTime;
	static float m_fHelpMessageTime;
	static bool	m_HelpMessageQuick;
	static uint32 m_ZoneState;
	static int32 m_ZoneFadeTimer;
	static uint32 m_ZoneNameTimer;
	static wchar *m_pZoneName;
	static wchar *m_pLastZoneName;
	static wchar *m_ZoneToPrint;
	static wchar *m_VehicleName;
	static wchar *m_pLastVehicleName;
	static wchar *m_pVehicleNameToPrint;
	static uint32 m_VehicleState;
	static int32 m_VehicleFadeTimer;
	static uint32 m_VehicleNameTimer;
	static wchar m_Message[256];
	static wchar m_PagerMessage[256];
	static bool m_Wants_To_Draw_Hud;
	static bool m_Wants_To_Draw_3dMarkers;
	static wchar m_BigMessage[6][128];
	static int16 m_ItemToFlash;

	// These aren't really in CHud
	static float BigMessageInUse[6];
	static float BigMessageAlpha[6];
	static float BigMessageX[6];
	static float OddJob2OffTimer;
	static bool CounterOnLastFrame;
	static float OddJob2XOffset;
	static uint16 CounterFlashTimer;
	static uint16 OddJob2Timer;
	static bool TimerOnLastFrame;
	static int16 OddJob2On;
	static uint16 TimerFlashTimer;
	static int16 PagerSoundPlayed;
	static int32 SpriteBrightness;
	static float PagerXOffset;
	static int16 PagerTimer;
	static int16 PagerOn;

	static uint32 m_WantedFadeTimer;
	static uint32 m_WantedState;
	static uint32 m_WantedTimer;
	static uint32 m_EnergyLostFadeTimer;
	static uint32 m_EnergyLostState;
	static uint32 m_EnergyLostTimer;
	static uint32 m_DisplayScoreFadeTimer;
	static uint32 m_DisplayScoreState;
	static uint32 m_DisplayScoreTimer;
	static uint32 m_WeaponFadeTimer;
	static uint32 m_WeaponState;
	static uint32 m_WeaponTimer;

	static uint32 m_LastDisplayScore;

public:
	static void Draw();
	static void DrawAfterFade();
	static void GetRidOfAllHudMessages();
	static void Initialise();
	static void ReInitialise();
	static void SetBigMessage(wchar *message, int16 style);
	static void SetHelpMessage(wchar *message, bool quick);
	static void SetMessage(wchar *message);
	static void SetPagerMessage(wchar *message);
	static void SetVehicleName(wchar *name);
	static void SetZoneName(wchar *name);
	static void Shutdown();
	static float DrawFadeState(DRAW_FADE_STATE, int);
};