diff options
Diffstat (limited to 'apps/plugins/doom/hu_lib.h')
-rw-r--r-- | apps/plugins/doom/hu_lib.h | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/apps/plugins/doom/hu_lib.h b/apps/plugins/doom/hu_lib.h new file mode 100644 index 0000000000..76d26bbb0f --- /dev/null +++ b/apps/plugins/doom/hu_lib.h | |||
@@ -0,0 +1,264 @@ | |||
1 | /* Emacs style mode select -*- C++ -*- | ||
2 | *----------------------------------------------------------------------------- | ||
3 | * | ||
4 | * | ||
5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom | ||
6 | * based on BOOM, a modified and improved DOOM engine | ||
7 | * Copyright (C) 1999 by | ||
8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman | ||
9 | * Copyright (C) 1999-2000 by | ||
10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
25 | * 02111-1307, USA. | ||
26 | * | ||
27 | * DESCRIPTION: none | ||
28 | * | ||
29 | *-----------------------------------------------------------------------------*/ | ||
30 | |||
31 | #ifndef __HULIB__ | ||
32 | #define __HULIB__ | ||
33 | |||
34 | // We are referring to patches. | ||
35 | #include "r_defs.h" | ||
36 | #include "v_video.h" //jff 2/16/52 include color range defs | ||
37 | |||
38 | |||
39 | /* background and foreground screen numbers | ||
40 | * different from other modules. */ | ||
41 | #define BG 1 | ||
42 | #define FG 0 | ||
43 | |||
44 | /* font stuff | ||
45 | * #define HU_CHARERASE KEYD_BACKSPACE / not used / phares | ||
46 | */ | ||
47 | |||
48 | #define HU_MAXLINES 4 | ||
49 | #define HU_MAXLINELENGTH 80 | ||
50 | #define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/ | ||
51 | /*jff 2/26/98 maximum number of messages allowed in refresh list */ | ||
52 | #define HU_MAXMESSAGES 16 | ||
53 | |||
54 | /* | ||
55 | * Typedefs of widgets | ||
56 | */ | ||
57 | |||
58 | /* Text Line widget | ||
59 | * (parent of Scrolling Text and Input Text widgets) */ | ||
60 | typedef struct | ||
61 | { | ||
62 | // left-justified position of scrolling text window | ||
63 | int x; | ||
64 | int y; | ||
65 | |||
66 | const patchnum_t* f; // font | ||
67 | int sc; // start character | ||
68 | //const char *cr; //jff 2/16/52 output color range | ||
69 | // Proff - Made this an int again. Needed for OpenGL | ||
70 | int cm; //jff 2/16/52 output color range | ||
71 | |||
72 | // killough 1/23/98: Support multiple lines: | ||
73 | #define MAXLINES 25 | ||
74 | |||
75 | int linelen; | ||
76 | char l[HU_MAXLINELENGTH*MAXLINES+1]; // line of text | ||
77 | int len; // current line length | ||
78 | |||
79 | // whether this line needs to be udpated | ||
80 | int needsupdate; | ||
81 | |||
82 | } hu_textline_t; | ||
83 | |||
84 | |||
85 | |||
86 | // Scrolling Text window widget | ||
87 | // (child of Text Line widget) | ||
88 | typedef struct | ||
89 | { | ||
90 | hu_textline_t l[HU_MAXLINES]; // text lines to draw | ||
91 | int h; // height in lines | ||
92 | int cl; // current line number | ||
93 | |||
94 | // pointer to boolean stating whether to update window | ||
95 | boolean* on; | ||
96 | boolean laston; // last value of *->on. | ||
97 | |||
98 | } hu_stext_t; | ||
99 | |||
100 | //jff 2/26/98 new widget to display last hud_msg_lines of messages | ||
101 | // Message refresh window widget | ||
102 | typedef struct | ||
103 | { | ||
104 | hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw | ||
105 | int nl; // height in lines | ||
106 | int nr; // total height in rows | ||
107 | int cl; // current line number | ||
108 | |||
109 | int x,y,w,h; // window position and size | ||
110 | const patchnum_t *bg; // patches for background | ||
111 | |||
112 | // pointer to boolean stating whether to update window | ||
113 | boolean* on; | ||
114 | boolean laston; // last value of *->on. | ||
115 | |||
116 | } hu_mtext_t; | ||
117 | |||
118 | |||
119 | |||
120 | // Input Text Line widget | ||
121 | // (child of Text Line widget) | ||
122 | typedef struct | ||
123 | { | ||
124 | hu_textline_t l; // text line to input on | ||
125 | |||
126 | // left margin past which I am not to delete characters | ||
127 | int lm; | ||
128 | |||
129 | // pointer to boolean stating whether to update window | ||
130 | boolean* on; | ||
131 | boolean laston; // last value of *->on; | ||
132 | |||
133 | } hu_itext_t; | ||
134 | |||
135 | |||
136 | // | ||
137 | // Widget creation, access, and update routines | ||
138 | // | ||
139 | |||
140 | // initializes heads-up widget library | ||
141 | void HUlib_init(void); | ||
142 | |||
143 | // | ||
144 | // textline code | ||
145 | // | ||
146 | |||
147 | // clear a line of text | ||
148 | void HUlib_clearTextLine(hu_textline_t *t); | ||
149 | |||
150 | void HUlib_initTextLine | ||
151 | ( | ||
152 | hu_textline_t *t, | ||
153 | int x, | ||
154 | int y, | ||
155 | const patchnum_t *f, | ||
156 | int sc, | ||
157 | int cm //jff 2/16/98 add color range parameter | ||
158 | ); | ||
159 | |||
160 | // returns success | ||
161 | boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); | ||
162 | |||
163 | // returns success | ||
164 | boolean HUlib_delCharFromTextLine(hu_textline_t *t); | ||
165 | |||
166 | // draws tline | ||
167 | void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); | ||
168 | |||
169 | // erases text line | ||
170 | void HUlib_eraseTextLine(hu_textline_t *l); | ||
171 | |||
172 | |||
173 | // | ||
174 | // Scrolling Text window widget routines | ||
175 | // | ||
176 | |||
177 | // initialize an stext widget | ||
178 | void HUlib_initSText | ||
179 | ( hu_stext_t* s, | ||
180 | int x, | ||
181 | int y, | ||
182 | int h, | ||
183 | const patchnum_t* font, | ||
184 | int startchar, | ||
185 | int cm, //jff 2/16/98 add color range parameter | ||
186 | boolean* on ); | ||
187 | |||
188 | // add a new line | ||
189 | void HUlib_addLineToSText(hu_stext_t* s); | ||
190 | |||
191 | // add a text message to an stext widget | ||
192 | void HUlib_addMessageToSText(hu_stext_t* s, const char* prefix, const char* msg); | ||
193 | |||
194 | // draws stext | ||
195 | void HUlib_drawSText(hu_stext_t* s); | ||
196 | |||
197 | // erases all stext lines | ||
198 | void HUlib_eraseSText(hu_stext_t* s); | ||
199 | |||
200 | //jff 2/26/98 message refresh widget | ||
201 | // initialize refresh text widget | ||
202 | void HUlib_initMText(hu_mtext_t *m, int x, int y, int w, int h, const patchnum_t* font, | ||
203 | int startchar, int cm, const patchnum_t* bgfont, boolean *on); | ||
204 | |||
205 | //jff 2/26/98 message refresh widget | ||
206 | // add a text line to refresh text widget | ||
207 | void HUlib_addLineToMText( hu_mtext_t* m ); | ||
208 | |||
209 | //jff 2/26/98 message refresh widget | ||
210 | // add a text message to refresh text widget | ||
211 | void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg); | ||
212 | |||
213 | //jff 2/26/98 new routine to display a background on which | ||
214 | // the list of last hud_msg_lines are displayed | ||
215 | void HUlib_drawMBg | ||
216 | ( int x, | ||
217 | int y, | ||
218 | int w, | ||
219 | int h, | ||
220 | const patchnum_t* bgp | ||
221 | ); | ||
222 | |||
223 | //jff 2/26/98 message refresh widget | ||
224 | // draws mtext | ||
225 | void HUlib_drawMText(hu_mtext_t* m); | ||
226 | |||
227 | //jff 4/28/98 erases behind message list | ||
228 | void HUlib_eraseMText(hu_mtext_t* m); | ||
229 | |||
230 | // Input Text Line widget routines | ||
231 | void HUlib_initIText | ||
232 | ( hu_itext_t* it, | ||
233 | int x, | ||
234 | int y, | ||
235 | const patchnum_t* font, | ||
236 | int startchar, | ||
237 | int cm, //jff 2/16/98 add color range parameter | ||
238 | boolean* on ); | ||
239 | |||
240 | // enforces left margin | ||
241 | void HUlib_delCharFromIText(hu_itext_t* it); | ||
242 | |||
243 | // enforces left margin | ||
244 | void HUlib_eraseLineFromIText(hu_itext_t* it); | ||
245 | |||
246 | // resets line and left margin | ||
247 | void HUlib_resetIText(hu_itext_t* it); | ||
248 | |||
249 | // left of left-margin | ||
250 | void HUlib_addPrefixToIText | ||
251 | ( hu_itext_t* it, | ||
252 | char* str ); | ||
253 | |||
254 | // whether eaten | ||
255 | boolean HUlib_keyInIText | ||
256 | ( hu_itext_t* it, | ||
257 | unsigned char ch ); | ||
258 | |||
259 | void HUlib_drawIText(hu_itext_t* it); | ||
260 | |||
261 | // erases all itext lines | ||
262 | void HUlib_eraseIText(hu_itext_t* it); | ||
263 | |||
264 | #endif | ||