/
hu_stuff.h
195 lines (166 loc) · 6.15 KB
/
hu_stuff.h
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/**
* @file hu_stuff.h
* Miscellaneous routines for heads-up displays and UI.
*
* @authors Copyright © 2005-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 1993-1996 by id Software, Inc.
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#ifndef LIBCOMMON_HU_STUFF_H
#define LIBCOMMON_HU_STUFF_H
#include "doomsday.h"
#include "gl_drawpatch.h"
#ifdef __cplusplus
# include <de/Vector>
#endif
DENG_EXTERN_C patchid_t *pMapNames; // Name graphics of each map.
DENG_EXTERN_C uint pMapNamesSize;
#if __JHERETIC__ || __JHEXEN__
DENG_EXTERN_C patchid_t pInvItemBox;
DENG_EXTERN_C patchid_t pInvSelectBox;
DENG_EXTERN_C patchid_t pInvPageLeft[2];
DENG_EXTERN_C patchid_t pInvPageRight[2];
#endif
#if __JDOOM__ || __JDOOM64__
// Quit messages.
#define NUM_QUITMESSAGES 22
DENG_EXTERN_C char const *endmsg[NUM_QUITMESSAGES + 1];
#endif
DENG_EXTERN_C dd_bool shiftdown;
DENG_EXTERN_C char const shiftXForm[];
DENG_EXTERN_C patchid_t borderPatches[8];
// The fonts.
typedef enum {
GF_NONE,
GF_FIRST,
GF_FONTA = GF_FIRST,
GF_FONTB,
GF_STATUS,
#if __JDOOM__
GF_INDEX, // Used for the ready/max ammo on the statusbar
#endif
#if __JDOOM__ || __JDOOM64__
GF_SMALL, // Used on the intermission.
#endif
#if __JHERETIC__ || __JHEXEN__
GF_SMALLIN,
#endif
GF_MAPPOINT, ///< Marked points on the automap
NUM_GAME_FONTS
} gamefontid_t;
DENG_EXTERN_C fontid_t fonts[NUM_GAME_FONTS];
#define FID(idx) (fonts[idx])
// Vector graphics.
enum {
VG_FIRST = 1,
VG_KEY = VG_FIRST,
VG_TRIANGLE,
VG_ARROW,
#if __JDOOM__
VG_CHEATARROW,
#endif
VG_XHAIR1,
VG_XHAIR2,
VG_XHAIR3,
VG_XHAIR4,
VG_XHAIR5,
NUM_VECTOR_GRAPHICS
}; /* svgid_t*/
#ifdef __cplusplus
extern "C" {
#endif
void Hu_LoadData(void);
void Hu_Drawer(void);
void Hu_Ticker(void);
void HU_WakeWidgets(int player);
void Hu_UnloadData(void);
void Hu_MapTitleDrawer(const RectRaw* portGeometry);
void Hu_DrawMapTitle(float alpha, dd_bool mapIdInsteadOfAuthor);
dd_bool Hu_IsMapTitleVisible(void);
dd_bool Hu_IsStatusBarVisible(int player);
void Hu_FogEffectTicker(timespan_t time);
void Hu_FogEffectSetAlphaTarget(float alpha);
void Hu_DrawFogEffect(int effectID, DGLuint tex, float texOffset[2], float texAngle, float alpha, float arg1);
void HU_ScoreBoardUnHide(int player);
void HU_DrawScoreBoard(int player);
/**
* Determines the height of the map title, including the second line
* (author/map ID).
*/
int Hu_MapTitleHeight(void);
void Draw_BeginZoom(float s, float originX, float originY);
void Draw_EndZoom(void);
void M_DrawTextFragmentShadowed(const char* string, int x, int y, int alignFlags, short textFlags, float r, float g, float b, float a);
void M_DrawShadowedPatch(patchid_t id, int x, int y);
void M_DrawShadowedPatch2(patchid_t id, int x, int y, int alignFlags, int patchFlags);
void M_DrawShadowedPatch3(patchid_t id, int x, int y, int alignFlags, int patchFlags, float r, float g, float b, float a);
typedef enum {
PRM_NONE = 0, ///< No replacement.
PRM_ALLOW_TEXT ///< Use a text replacement if found.
} patchreplacemode_t;
#define PRM_FIRST (PRM_NONE)
#define PRM_LAST (PRM_ALLOW_TEXT)
/**
* @defgroup patchReplacementFlags Patch Replacement Flags.
* @{
*/
#define PRF_NO_IWAD 0x1 ///< Allow if resource does not originate from an IWAD.
#define PRF_NO_PWAD 0x2 ///< Allow if resource does not originate from a PWAD/external source.
/**@}*/
/**
* Given a unique patch identifier (@a id) lookup a patch replacement string
* associated with this.
*
* @param patchId Unique patch identifier.
* @param flags @ref patchReplacementFlags
*
* @return Patch replacement string if defined/found else @c NULL.
*/
const char* Hu_FindPatchReplacementString(patchid_t patchId, int flags);
/**
* Determine whether a string-replacement for the specified patch is allowed
* according the current user and/or game configuration.
*
* @note If the patch does not originate from an IWAD it will not be replaced.
*
* @param replaceMode Replacement mode.
* @param patchId Unique identifier of the patch to choose a replacement for.
* @param text A prechoosen string replacement to be used if appropriate.
*/
const char* Hu_ChoosePatchReplacement2(patchreplacemode_t replaceMode, patchid_t patchId, const char* text);
const char* Hu_ChoosePatchReplacement(patchreplacemode_t replaceMode, patchid_t patchId);
/**
* Misc specialised elements:
*/
void M_DrawGlowBar(const float a[2], const float b[2], float thickness, dd_bool left, dd_bool right, dd_bool caps, float red, float green, float blue, float alpha);
#ifdef __cplusplus
} // extern "C"
/**
* Implements patch replacement.
*
* @param patchId Unique identifier of the patch to be drawn if no replacement.
* @param replacement Patch replacement string. Will be drawn instead of the
* patch if not @c NULL.
* @param origin Orient drawing about this offset (topleft:[0,0]).
* @param alignFlags @ref alignmentFlags
* @param patchFlags @ref drawPatchFlags
* @param textFlags @ref drawTextFlags
*/
void WI_DrawPatch(patchid_t patchId, char const *replacement, de::Vector2i const &origin = de::Vector2i(0, 0),
int alignFlags = ALIGN_TOPLEFT, int patchFlags = 0, short textFlags = 0);
#endif // __cplusplus
#endif // LIBCOMMON_HU_STUFF_H