Debian Codegraph @

Descent3/CtlCfgElem.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/CtlCfgElem.cpp $
21 * $Revision: 26 $
22 * $Date: 3/20/00 12:03p $
23 * $Author: Matt $
24 *
25 * Control config element gadgets
26 *
27 * $Log: /DescentIII/main/CtlCfgElem.cpp $
28 *
29 * 26 3/20/00 12:03p Matt
30 * Merge of Duane's post-1.3 changes.
31 * Added Mac international keys (Mac only)
32 *
33 * 25 10/22/99 10:47a Matt
34 * Mac merge
35 *
36 * 24 7/30/99 1:05p Samir
37 * read POVs before buttons since most controllers map hat positions to
38 * buttons as well.
39 *
40 * 23 7/16/99 11:15a Samir
41 * multiple hat support
42 *
43 * 22 6/11/99 1:15a Samir
44 * localization issues.
45 *
46 * 21 5/20/99 9:11p Samir
47 * no bind '-' and '=' keys.
48 *
49 * 20 5/06/99 1:40a Samir
50 * adjusted some text.
51 *
52 * 19 4/29/99 2:59p Samir
53 * added help and made CTRL-C clear for controller screens.
54 *
55 * 18 4/29/99 2:23a Samir
56 * moved binding text functions to wincontroller.cpp and new text for
57 * multiple joysticks.
58 *
59 * 17 4/15/99 1:38a Jeff
60 * changes for linux compile
61 *
62 * 16 4/14/99 12:35p Samir
63 * localization issues.
64 *
65 * 15 4/14/99 2:50a Jeff
66 * fixed some case mismatched #includes
67 *
68 * 14 3/23/99 9:04p Samir
69 * moved mouse binding text to mouse library.
70 *
71 * 13 3/09/99 6:26p Samir
72 * flush mouse queue after configuring button.
73 *
74 * 12 3/05/99 4:34p Samir
75 * multiplayer bug in controller config.
76 *
77 * 11 3/02/99 1:17p Samir
78 * resume and suspend controls for config instead of directly going
79 * through controller. this is done so mask_controllers gets called with
80 * the latest Current_pillot.read_controller values...
81 *
82 * 10 2/26/99 2:09a Samir
83 * added '?' button.
84 *
85 * 9 2/21/99 6:36p Samir
86 * focusing changes and key input changes to ui.,
87 *
88 * 8 2/16/99 12:07p Samir
89 * redid controller config with new ui.
90 *
91 * 7 1/28/99 3:58p Jeff
92 * localization update
93 *
94 * 6 11/30/98 4:54p Samir
95 * added rear view config item.
96 *
97 * 5 10/23/98 12:51p Samir
98 * bail out of config if server says so: note there still is a bug with
99 * this system.
100 *
101 * 4 10/18/98 1:07p Samir
102 * tweaked user interface for controller config.
103 *
104 * 3 10/17/98 7:31p Samir
105 * added invertible axes
106 *
107 * 2 9/30/98 4:37p Samir
108 * 'incremental checkin'
109 *
110 * 1 9/28/98 3:47p Samir
111 * initial revision.
112 *
113 * $NoKeywords: $
114 */
115
116 #include "CtlCfgElem.h"cxx . . $ `<file>/Descent3/CtlCfgElem.h`/
117 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
118
119 #include "Macros.h"cxx . . $ `<file>/lib/Macros.h`/
120 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
121 #include "application.h"cxx . . $ `<file>/lib/application.h`/
122 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
123 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
124 #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/
125 #include "localization.h"cxx . . $ `<file>/Descent3/localization.h`/
126
127 #include <string.h>
128 #include "joystick.h"cxx . . $ `<file>/lib/joystick.h`/
129
130 // all controller binding texts
131 static char Ctltext_KeyBindingscxx . . $ Ctltext_KeyBindings.[][16] = {"",
132 "",
133 "",
134 "",
135 "",
136 "",
137 "",
138 "",
139 "",
140 "",
141 "",
142 "",
143 "",
144 "",
145 "bspc\0\0\0\0\0\0",
146 "tab\0\0\0\0\0\0",
147 "q",
148 "w",
149 "e",
150 "r",
151 "t",
152 "y",
153 "u",
154 "i",
155 "o",
156 "p",
157 "[",
158 "]",
159 "enter\0\0\0\0\0",
160 "lctrl\0\0\0\0\0",
161 "a",
162 "s",
163 "d",
164 "f",
165 "g",
166 "h",
167 "j",
168 "k",
169 "l",
170 ";",
171 "'",
172 "`",
173 "lshft\0\0\0\0\0",
174 "\\",
175 "z",
176 "x",
177 "c",
178 "v",
179 "b",
180 "n",
181 "m",
182 ",",
183 ".",
184 "/",
185 "rshft\0\0\0\0\0",
186 "pad*\0\0\0\0\0",
187 "lalt\0\0\0\0\0",
188 "spc\0\0\0\0\0",
189 "caps\0\0\0\0\0",
190 "",
191 "",
192 "",
193 "",
194 "",
195 "",
196 "",
197 "",
198 "",
199 "",
200 "num\0\0\0\0\0",
201 "sclk\0\0\0\0\0",
202 "pad7\0\0\0\0\0",
203 "pad8\0\0\0\0\0",
204 "pad9\0\0\0\0\0",
205 "pad-\0\0\0\0\0",
206 "pad4\0\0\0\0\0",
207 "pad5\0\0\0\0\0",
208 "pad6\0\0\0\0\0",
209 "pad+\0\0\0\0\0",
210 "pad1\0\0\0\0\0",
211 "pad2\0\0\0\0\0",
212 "pad3\0\0\0\0\0",
213 "pad0\0\0\0\0\0",
214 "pad.\0\0\0\0\0",
215 "",
216 "",
217 "",
218 "",
219 "",
220 "",
221 "",
222 "",
223 "",
224 "",
225 "",
226 "",
227 "",
228 "",
229 "",
230 "",
231 "",
232 "",
233 "",
234 "",
235 "",
236 "",
237 "",
238 "",
239 "",
240 "",
241 "",
242 "",
243 "",
244 "",
245 "",
246 "",
247 "",
248 "",
249 "",
250 "",
251 "",
252 "",
253 "",
254 "",
255 "",
256 "",
257 "",
258 "",
259 "",
260 "",
261 "",
262 "",
263 "",
264 "",
265 "",
266 "",
267 "",
268 "",
269 "",
270 "",
271 "",
272 "",
273 "",
274 "",
275 "",
276 "",
277 "",
278 "",
279 "",
280 "",
281 "",
282 "",
283 "",
284 "",
285 "",
286 "",
287 "pad�\0\0\0\0\0\0",
288 "rctrl\0\0\0\0\0",
289 "",
290 "",
291 "",
292 "",
293 "",
294 "",
295 "",
296 "",
297 "",
298 "",
299 "",
300 "",
301 "",
302 "",
303 "",
304 "",
305 "",
306 "",
307 "",
308 "",
309 "",
310 "",
311 "",
312 "pad/\0\0\0\0\0\0",
313 "",
314 "",
315 "ralt\0\0\0\0\0\0",
316 "",
317 "",
318 "",
319 "",
320 "",
321 "",
322 "",
323 "",
324 "",
325 "",
326 "",
327 "",
328 "",
329 "",
330 "home\0\0\0\0\0\0",
331 "up\0\0\0\0\0\0\0",
332 "pgup\0\0\0\0\0\0",
333 "",
334 "left\0\0\0\0\0\0",
335 "",
336 "right\0\0\0\0\0\0",
337 "",
338 "end\0\0\0\0\0\0\0",
339 "down\0\0\0\0\0\0",
340 "pgdn\0\0\0\0\0\0",
341 "ins\0\0\0\0\0\0",
342 "del\0\0\0\0\0\0",
343 "",
344 "",
345 "",
346 "",
347 "",
348 "",
349 "",
350 "",
351 "",
352 "",
353 "",
354 "",
355 "",
356 "",
357 "",
358 "",
359 "",
360 "",
361 "",
362 "",
363 "",
364 "",
365 "",
366 "",
367 "",
368 "",
369 "",
370 "",
371 "",
372 "",
373 "",
374 "",
375 "",
376 "",
377 "",
378 "",
379 "",
380 "",
381 "",
382 "",
383 "",
384 "",
385 "",
386 ""};
387
388 static int16_tcxx . . $ int16_t# key_binding_indicescxx . . $ key_binding_indices.[] = {
389 KEY_BACKSPcxx . . $ `ddio/ddio_common.h:269:9`!, KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`!, KEY_ENTERcxx . . $ `ddio/ddio_common.h:268:9`!, KEY_LCTRLcxx . . $ `ddio/ddio_common.h:279:9`!, KEY_LSHIFTcxx . . $ `ddio/ddio_common.h:275:9`!, KEY_RSHIFTcxx . . $ `ddio/ddio_common.h:276:9`!, KEY_PADMULTIPLYcxx . . $ `ddio/ddio_common.h:309:9`!, KEY_LALTcxx . . $ `ddio/ddio_common.h:277:9`!,
390 KEY_SPACEBARcxx . . $ `ddio/ddio_common.h:271:9`!, KEY_CAPSLOCKcxx . . $ `ddio/ddio_common.h:274:9`!, 0x45, KEY_SCROLLOCKcxx . . $ `ddio/ddio_common.h:273:9`!, KEY_PAD7cxx . . $ `ddio/ddio_common.h:302:9`!, KEY_PAD8cxx . . $ `ddio/ddio_common.h:303:9`!, KEY_PAD9cxx . . $ `ddio/ddio_common.h:304:9`!, KEY_PADMINUScxx . . $ `ddio/ddio_common.h:305:9`!,
391 KEY_PAD4cxx . . $ `ddio/ddio_common.h:299:9`!, KEY_PAD5cxx . . $ `ddio/ddio_common.h:300:9`!, KEY_PAD6cxx . . $ `ddio/ddio_common.h:301:9`!, KEY_PADPLUScxx . . $ `ddio/ddio_common.h:306:9`!, KEY_PAD1cxx . . $ `ddio/ddio_common.h:296:9`!, KEY_PAD2cxx . . $ `ddio/ddio_common.h:297:9`!, KEY_PAD3cxx . . $ `ddio/ddio_common.h:298:9`!, KEY_PAD0cxx . . $ `ddio/ddio_common.h:295:9`!,
392 KEY_PADPERIODcxx . . $ `ddio/ddio_common.h:307:9`!, KEY_PADENTERcxx . . $ `ddio/ddio_common.h:310:9`!, KEY_RCTRLcxx . . $ `ddio/ddio_common.h:280:9`!, KEY_PADDIVIDEcxx . . $ `ddio/ddio_common.h:308:9`!, KEY_RALTcxx . . $ `ddio/ddio_common.h:278:9`!, KEY_HOMEcxx . . $ `ddio/ddio_common.h:313:9`!, KEY_UPcxx . . $ `ddio/ddio_common.h:318:9`!, KEY_PAGEUPcxx . . $ `ddio/ddio_common.h:314:9`!,
393 KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`!, KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`!, KEY_ENDcxx . . $ `ddio/ddio_common.h:316:9`!, KEY_DOWNcxx . . $ `ddio/ddio_common.h:319:9`!, KEY_PAGEDOWNcxx . . $ `ddio/ddio_common.h:317:9`!, KEY_INSERTcxx . . $ `ddio/ddio_common.h:312:9`!, KEY_DELETEcxx . . $ `ddio/ddio_common.h:315:9`!, 0xff};
394
395 #define NUM_KEYBINDSTRINGScxx . . $ `Descent3/CtlCfgElem.cpp:395:9`! (sizeof(Ctltext_KeyBindings) / sizeof(char *))
396
397 #define F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`! 0x1
398 #define F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`! 0x2
399 #define F_ELEM_INVERTEDcxx . . $ `Descent3/CtlCfgElem.cpp:399:9`! 0x4
400
401 #define CFGELEM_BTN_Xcxx . . $ `Descent3/CtlCfgElem.cpp:401:9`! 132
402
403 /*
404 $$TABLE_GAMEFILE "SmallButton.ogf"
405 $$TABLE_GAMEFILE "SmallButtonLit.ogf"
406 $$TABLE_GAMEFILE "TinyButton.ogf"
407 $$TABLE_GAMEFILE "TinyButtonLit.ogf"
408 */
409 #define NEWUI_BTN_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:409:9`! "SmallButton.ogf"
410 #define NEWUI_BTNLIT_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:410:9`! "SmallButtonLit.ogf"
411 #define NEWUI_TINYBTN_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:411:9`! "TinyButton.ogf"
412 #define NEWUI_TINYBTNLIT_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:412:9`! "TinyButtonLit.ogf"
413
414 extern char Ctltext_AxisBindingscxx . . $ Ctltext_AxisBindings.[][16];
415 extern char Ctltext_PovBindingscxx . . $ Ctltext_PovBindings.[][16];
416 extern char Ctltext_MseBtnBindingscxx . . $ Ctltext_MseBtnBindings.[][32];
417 extern char Ctltext_MseAxisBindingscxx . . $ Ctltext_MseAxisBindings.[][32];
418
419 void Localize_ctl_bindingscxx . . $ Localize_ctl_bindings(49f6e7a06ebc5aa8).() {
420 char **strtable;
421 int n_strings, i;
422
423 // keyboard translations.
424 // no need to do for english!
425 if (Localization_GetLanguagecxx . . $ Localization_GetLanguage(b126dc7c1de90089).() == LANGUAGE_ENGLISHcxx . . $ `Descent3/localization.h:44:9`!)
426 return;
427
428 if (CreateStringTablecxx . . $ CreateStringTable(c1b497ce97e7b78).("bindkey.str", &strtable, &n_strings)) {
429 i = 0;
430 while (key_binding_indicescxx . . $ key_binding_indices.[i] != 0xff) {
431 if (i >= n_strings) {
432 break;
433 }
434 strcpy(Ctltext_KeyBindingscxx . . $ Ctltext_KeyBindings.[key_binding_indicescxx . . $ key_binding_indices.[i]], strtable[i]);
435 i++;
436 }
437 DestroyStringTablecxx . . $ DestroyStringTable(a50bc8ce1fe710a2).(strtable, n_strings);
438 }
439
440 // mouse translations.
441 if (CreateStringTablecxx . . $ CreateStringTable(c1b497ce97e7b78).("bindmse.str", &strtable, &n_strings)) {
442 for (i = 0; i < 6; i++) {
443 if (i >= n_strings) {
444 break;
445 }
446 strcpy(Ctltext_MseBtnBindingscxx . . $ Ctltext_MseBtnBindings.[i], strtable[i]);
447 }
448 for (i = 0; i < 3; i++) {
449 if ((i + 6) >= n_strings) {
450 break;
451 }
452 strcpy(Ctltext_MseAxisBindingscxx . . $ Ctltext_MseAxisBindings.[i], strtable[i + 6]);
453 }
454 DestroyStringTablecxx . . $ DestroyStringTable(a50bc8ce1fe710a2).(strtable, n_strings);
455 }
456
457 // joystick translations.
458 if (CreateStringTablecxx . . $ CreateStringTable(c1b497ce97e7b78).("bindjoy.str", &strtable, &n_strings)) {
459 for (i = 0; i < 6; i++) {
460 if (i >= n_strings) {
461 break;
462 }
463 strcpy(Ctltext_AxisBindingscxx . . $ Ctltext_AxisBindings.[i + 1], strtable[i]);
464 }
465 for (i = 0; i < 4; i++) {
466 if ((i + 6) >= n_strings) {
467 break;
468 }
469 strcpy(Ctltext_PovBindingscxx . . $ Ctltext_PovBindings.[i + 1], strtable[i + 6]);
470 }
471 DestroyStringTablecxx . . $ DestroyStringTable(a50bc8ce1fe710a2).(strtable, n_strings);
472 }
473 }
474
475 //////////////////////////////////////////////////////////////////////////////
476 const char *cfg_binding_textcxx . . $ cfg_binding_text(c156078267dcf458).(ct_typecxx . . $ ct_type# ctype, uint8_tcxx . . $ uint8_t# ctrl, uint8_tcxx . . $ uint8_t# binding) {
477 const char *str;
478
479 if (ctrl == NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!) {
480 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
481 }
482
483 switch (ctype) {
484 case ctKeycxx . . $ ctKey.: {
485 ASSERTcxx . . $ `misc/pserror.h:246:9`!(binding < NUM_KEYBINDSTRINGScxx . . $ `Descent3/CtlCfgElem.cpp:395:9`!);
486 str = Ctltext_KeyBindingscxx . . $ Ctltext_KeyBindings.[binding];
487 break;
488 }
489
490 case ctPOVcxx . . $ ctPOV.:
491 case ctPOV2cxx . . $ ctPOV2.:
492 case ctPOV3cxx . . $ ctPOV3.:
493 case ctPOV4cxx . . $ ctPOV4.:
494 case ctMouseButtoncxx . . $ ctMouseButton.:
495 case ctButtoncxx . . $ ctButton.:
496 case ctMouseAxiscxx . . $ ctMouseAxis.:
497 case ctAxiscxx . . $ ctAxis.:
498 str = Controllercxx . . $ Controller.->get_binding_textcxx . . $ gameController#get_binding_text(c156078267dcf458).(ctype, ctrl, binding);
499 break;
500
501 default:
502 if (ctype == ctNonecxx . . $ ctNone.) {
503 Int3cxx . . $ `misc/pserror.h:247:9`!();
504 }
505 return ("");
506 }
507
508 return str;
509 }
510
511 //////////////////////////////////////////////////////////////////////////////
512 //
513 class cfg_element_uicxx . . $ cfg_element_ui# : public newuiMessageBoxcxx . . $ newuiMessageBox# {
514 uint8_tcxx . . $ uint8_t# m_elementcxx . . $ cfg_element_ui#m_element.; // element passed and returned.
515 uint8_tcxx . . $ uint8_t# m_controllercxx . . $ cfg_element_ui#m_controller.; // controller.
516 int8_tcxx . . $ int8_t# m_alphacxx . . $ cfg_element_ui#m_alpha.; // used for fx.
517 ct_typecxx . . $ ct_type# m_typecxx . . $ cfg_element_ui#m_type.;
518
519 public:
520 void Createcxx . . $ cfg_element_ui#Create(1949a299c0ec5ea2).(const char *title, ct_typecxx . . $ ct_type# type, uint8_tcxx . . $ uint8_t# controller, uint8_tcxx . . $ uint8_t# element);
521 uint8_tcxx . . $ uint8_t# GetElementcxx . . $ cfg_element_ui#GetElement(bd807b21b9713a30).() const { return m_elementcxx . . $ cfg_element_ui#m_element.; };
522 uint8_tcxx . . $ uint8_t# GetControllercxx . . $ cfg_element_ui#GetController(bd807b21b9713a30).() const { return m_controllercxx . . $ cfg_element_ui#m_controller.; };
523 ct_typecxx . . $ ct_type# GetTypecxx . . $ cfg_element_ui#GetType(45edd857a5d848a4).() const { return m_typecxx . . $ cfg_element_ui#m_type.; };
524 int DoUIcxx . . $ cfg_element_ui#DoUI(b126dc7c1de90089).();
525
526 protected:
527 virtual void OnDrawcxx . . $ cfg_element_ui#OnDraw(49f6e7a06ebc5aa8).();
528 };
529
530 //////////////////////////////////////////////////////////////////////////////
531 //
532
533 UIBitmapItemcxx . . $ UIBitmapItem# *cfg_elementcxx . . $ cfg_element#::m_btn_bmp_litcxx . . $ cfg_element#m_btn_bmp_lit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
534 UIBitmapItemcxx . . $ UIBitmapItem# *cfg_elementcxx . . $ cfg_element#::m_btn_bmpcxx . . $ cfg_element#m_btn_bmp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
535 UIBitmapItemcxx . . $ UIBitmapItem# *cfg_elementcxx . . $ cfg_element#::m_xbtn_bmp_litcxx . . $ cfg_element#m_xbtn_bmp_lit. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
536 UIBitmapItemcxx . . $ UIBitmapItem# *cfg_elementcxx . . $ cfg_element#::m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
537 int16_tcxx . . $ int16_t# cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count. = 0;
538
539 // MTS: unused?
540 bool key_cfg_elementcxx . . $ key_cfg_element(ee5c1ec7cb9f69fd).(uint8_tcxx . . $ uint8_t# *element, uint8_tcxx . . $ uint8_t# *flags);
541
542 //////////////////////////////////////////////////////////////////////////////
543 //
544
545 void cfg_elementcxx . . $ cfg_element#::Createcxx . . $ cfg_element#Create(d616eeffcc609617).(UIWindowcxx . . $ UIWindow# *wnd, int str_i, int x, int y, int fnid, int id) {
546 m_titlecxx . . $ cfg_element#m_title. = TXTcxx . . $ `Descent3/stringtable.h:24:9`!(str_i);
547 m_fnidcxx . . $ cfg_element#m_fnid. = (int8_tcxx . . $ int8_t#)fnid;
548 m_slotcxx . . $ cfg_element#m_slot. = 0;
549 m_curslotcxx . . $ cfg_element#m_curslot. = -1;
550 m_flagscxx . . $ cfg_element#m_flags. = 0;
551 m_slot_alphacxx . . $ cfg_element#m_slot_alpha. = 255;
552 m_blink_statecxx . . $ cfg_element#m_blink_state. = 0;
553
554 if (cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count. == 0) {
555 cfg_elementcxx . . $ cfg_element#::m_btn_bmp_litcxx . . $ cfg_element#m_btn_bmp_lit. = newui_LoadBitmapcxx . . $ newui_LoadBitmap(9af3ea6534c90d0f).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(NEWUI_BTNLIT_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:410:9`!));
556 cfg_elementcxx . . $ cfg_element#::m_btn_bmpcxx . . $ cfg_element#m_btn_bmp. = newui_LoadBitmapcxx . . $ newui_LoadBitmap(9af3ea6534c90d0f).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(NEWUI_BTN_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:409:9`!));
557 cfg_elementcxx . . $ cfg_element#::m_xbtn_bmp_litcxx . . $ cfg_element#m_xbtn_bmp_lit. = newui_LoadBitmapcxx . . $ newui_LoadBitmap(9af3ea6534c90d0f).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(NEWUI_TINYBTNLIT_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:412:9`!));
558 cfg_elementcxx . . $ cfg_element#::m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp. = newui_LoadBitmapcxx . . $ newui_LoadBitmap(9af3ea6534c90d0f).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(NEWUI_TINYBTN_FILEcxx . . $ `Descent3/CtlCfgElem.cpp:411:9`!));
559 }
560 cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count.++;
561
562 UIGadgetcxx . . $ UIGadget#::Createcxx . . $ UIGadget#Create(43707b8add2f137d).(wnd, id, x, y, 10, 10, 0);
563
564 if (id == -1) {
565 UIGadgetcxx . . $ UIGadget#::Disablecxx . . $ UIGadget#Disable(49f6e7a06ebc5aa8).();
566 }
567 }
568
569 void cfg_elementcxx . . $ cfg_element#::OnFormatcxx . . $ cfg_element#OnFormat(49f6e7a06ebc5aa8).() {
570 UITextItemcxx . . $ UITextItem# titlecxx . . $ UITextItem#UITextItem(284d3affb5f9e25a).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!, m_titlecxx . . $ cfg_element#m_title., NEWUI_MONITORFONT_COLORcxx . . $ `Descent3/newui_core.h:70:9`!);
571 m_Wcxx . . $ UIObject#m_W. = CFGELEM_BTN_Xcxx . . $ `Descent3/CtlCfgElem.cpp:401:9`! + (N_CFGELEM_SLOTScxx . . $ `Descent3/CtlCfgElem.h:87:9`! * (m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).() + 2));
572 m_Hcxx . . $ UIObject#m_H. = title.heightcxx . . $ UITextItem#height(b126dc7c1de90089).();
573 }
574
575 void cfg_elementcxx . . $ cfg_element#::OnDrawcxx . . $ cfg_element#OnDraw(49f6e7a06ebc5aa8).() {
576 // draw text, then buttons, then...
577 UITextItemcxx . . $ UITextItem# titlecxx . . $ UITextItem#UITextItem(284d3affb5f9e25a).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!, m_titlecxx . . $ cfg_element#m_title., NEWUI_MONITORFONT_COLORcxx . . $ `Descent3/newui_core.h:70:9`!);
578
579 int x = 0, i;
580
581 if (m_infocuscxx . . $ UIGadget#m_infocus.) {
582 title.set_alphacxx . . $ UITextItem#set_alpha(ac50b47256ae7414).(m_slot_alphacxx . . $ cfg_element#m_slot_alpha.);
583 }
584
585 if (m_fnidcxx . . $ cfg_element#m_fnid. != -1) {
586 UITextItemcxx . . $ UITextItem# textcxx . . $ UITextItem#UITextItem(284d3affb5f9e25a).(GADGET9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:117:9`!, "?", NEWUI_GADGETFONT_COLORcxx . . $ `Descent3/newui_core.h:71:9`!);
587 if (m_curslotcxx . . $ cfg_element#m_curslot. == CFGELEM_SLOT_CLEARcxx . . $ `Descent3/CtlCfgElem.h:88:9`! && CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`!)) {
588 m_xbtn_bmp_litcxx . . $ cfg_element#m_xbtn_bmp_lit.->drawcxx . . $ UIBitmapItem#draw(84329bcd07240ccf).(x, 0);
589 } else {
590 m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.->drawcxx . . $ UIBitmapItem#draw(84329bcd07240ccf).(x, 0);
591 }
592 text.drawcxx . . $ UITextItem#draw(84329bcd07240ccf).(x + (m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).() - text.widthcxx . . $ UITextItem#width(b126dc7c1de90089).()) / 2, 1 + (m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.->heightcxx . . $ UIBitmapItem#height(b126dc7c1de90089).() - text.heightcxx . . $ UITextItem#height(b126dc7c1de90089).()) / 2);
593 x += 28;
594 }
595
596 title.drawcxx . . $ UITextItem#draw(84329bcd07240ccf).(x, 0);
597
598 if (m_fnidcxx . . $ cfg_element#m_fnid. != -1) {
599 ct_typecxx . . $ ct_type# ctype[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
600 uint8_tcxx . . $ uint8_t# cfgflags[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
601 ct_config_datacxx . . $ ct_config_data# cfgdata;
602 tCfgDataPartscxx . . $ tCfgDataParts# cfgparts;
603
604 x = CFGELEM_BTN_Xcxx . . $ `Descent3/CtlCfgElem.cpp:401:9`!;
605
606 Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(m_fnidcxx . . $ cfg_element#m_fnid., ctype, &cfgdata, cfgflags);
607 parse_config_datacxx . . $ parse_config_data(7e428e3458f6a03b).(&cfgparts, ctype[0], ctype[1], cfgdata);
608
609 for (i = 0; i < N_CFGELEM_SLOTScxx . . $ `Descent3/CtlCfgElem.h:87:9`!; i++) {
610 const char *txt;
611 uint8_tcxx . . $ uint8_t# one_binding = (i == 0) ? cfgparts.bind_0cxx . . $ tCfgDataParts#bind_0. : cfgparts.bind_1cxx . . $ tCfgDataParts#bind_1.;
612 uint8_tcxx . . $ uint8_t# one_ctrlbind = (i == 0) ? cfgparts.ctrl_0cxx . . $ tCfgDataParts#ctrl_0. : cfgparts.ctrl_1cxx . . $ tCfgDataParts#ctrl_1.;
613
614 txt = cfg_binding_textcxx . . $ cfg_binding_text(c156078267dcf458).(ctype[i], one_ctrlbind, one_binding);
615
616 // draw button
617 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`!) && m_curslotcxx . . $ cfg_element#m_curslot. == i) {
618 m_btn_bmp_litcxx . . $ cfg_element#m_btn_bmp_lit.->drawcxx . . $ UIBitmapItem#draw(84329bcd07240ccf).(x, 0);
619 } else {
620 m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->drawcxx . . $ UIBitmapItem#draw(84329bcd07240ccf).(x, 0);
621 }
622
623 // draw text
624 if (txt) {
625 UITextItemcxx . . $ UITextItem# textcxx . . $ UITextItem#UITextItem(284d3affb5f9e25a).(GADGET9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:117:9`!, txt, NEWUI_GADGETFONT_COLORcxx . . $ `Descent3/newui_core.h:71:9`!);
626
627 if (m_infocuscxx . . $ UIGadget#m_infocus.) {
628 if (m_curslotcxx . . $ cfg_element#m_curslot. == i) {
629 text.set_alphacxx . . $ UITextItem#set_alpha(ac50b47256ae7414).(m_slot_alphacxx . . $ cfg_element#m_slot_alpha.);
630 }
631 }
632
633 text.drawcxx . . $ UITextItem#draw(84329bcd07240ccf).(x + (m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).() - text.widthcxx . . $ UITextItem#width(b126dc7c1de90089).()) / 2, (m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->heightcxx . . $ UIBitmapItem#height(b126dc7c1de90089).() - text.heightcxx . . $ UITextItem#height(b126dc7c1de90089).()) / 2);
634 }
635
636 x += (m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).() + 2);
637 }
638
639 m_slot_alphacxx . . $ cfg_element#m_slot_alpha. += m_blink_statecxx . . $ cfg_element#m_blink_state.;
640 if (m_slot_alphacxx . . $ cfg_element#m_slot_alpha. == 25) {
641 m_blink_statecxx . . $ cfg_element#m_blink_state. = 25;
642 } else if (m_slot_alphacxx . . $ cfg_element#m_slot_alpha. == 250) {
643 m_blink_statecxx . . $ cfg_element#m_blink_state. = -25;
644 }
645 }
646 }
647
648 void cfg_elementcxx . . $ cfg_element#::OnKeyDowncxx . . $ cfg_element#OnKeyDown(d4f767463ce0a6b3).(int key) {
649 if (key == KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`! && m_curslotcxx . . $ cfg_element#m_curslot. < (N_CFGELEM_SLOTScxx . . $ `Descent3/CtlCfgElem.h:87:9`! - 1)) {
650 m_curslotcxx . . $ cfg_element#m_curslot.++;
651 } else if (key == KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`! && m_curslotcxx . . $ cfg_element#m_curslot. > 0) {
652 m_curslotcxx . . $ cfg_element#m_curslot.--;
653 } else if (key == (KEY_CTRLEDcxx . . $ `ddio/ddio_common.h:210:9`! + KEY_Ccxx . . $ `ddio/ddio_common.h:231:9`!)) {
654 // clear binding.
655 tCfgDataPartscxx . . $ tCfgDataParts# cfgparts;
656 ct_typecxx . . $ ct_type# ctype_fn[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
657 uint8_tcxx . . $ uint8_t# cfgflags_fn[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
658 ct_config_datacxx . . $ ct_config_data# ccfgdata_fn;
659
660 Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(m_fnidcxx . . $ cfg_element#m_fnid., ctype_fn, &ccfgdata_fn, cfgflags_fn);
661 parse_config_datacxx . . $ parse_config_data(7e428e3458f6a03b).(&cfgparts, ctype_fn[0], ctype_fn[1], ccfgdata_fn);
662 if (m_curslotcxx . . $ cfg_element#m_curslot. == 0) {
663 cfgparts.bind_0cxx . . $ tCfgDataParts#bind_0. = NULL_BINDINGcxx . . $ `lib/Controller.h:180:9`!;
664 cfgparts.ctrl_0cxx . . $ tCfgDataParts#ctrl_0. = NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!;
665 } else if (m_curslotcxx . . $ cfg_element#m_curslot. == 1) {
666 cfgparts.bind_1cxx . . $ tCfgDataParts#bind_1. = NULL_BINDINGcxx . . $ `lib/Controller.h:180:9`!;
667 cfgparts.ctrl_1cxx . . $ tCfgDataParts#ctrl_1. = NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!;
668 }
669 ccfgdata_fn = unify_config_datacxx . . $ unify_config_data(93c052a99c9f35a1).(&cfgparts);
670 Controllercxx . . $ Controller.->set_controller_functioncxx . . $ gameController#set_controller_function(a87bf4975f40b925).(m_fnidcxx . . $ cfg_element#m_fnid., ctype_fn, ccfgdata_fn, cfgflags_fn);
671
672 } else if (key == (KEY_SHIFTEDcxx . . $ `ddio/ddio_common.h:208:9`! + KEY_SLASHcxx . . $ `ddio/ddio_common.h:257:9`!)) {
673 m_slotcxx . . $ cfg_element#m_slot. = CFGELEM_SLOT_CLEARcxx . . $ `Descent3/CtlCfgElem.h:88:9`!;
674 OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).();
675 }
676 }
677
678 void cfg_elementcxx . . $ cfg_element#::OnMouseBtnDowncxx . . $ cfg_element#OnMouseBtnDown(d4f767463ce0a6b3).(int btn) {
679 if (btn == UILMSEBTNcxx . . $ `ui/uisys.h:36:9`!) {
680 int gadmx = SCREEN_TO_GAD_Xcxx . . $ SCREEN_TO_GAD_X(dafe5a5d85eeac89).(this, UI_inputcxx . . $ UI_input..mxcxx . . $ tUIInput#mx.), gadmy = SCREEN_TO_GAD_Ycxx . . $ SCREEN_TO_GAD_Y(dafe5a5d85eeac89).(this, UI_inputcxx . . $ UI_input..mycxx . . $ tUIInput#my.);
681 int x = 0;
682 int8_tcxx . . $ int8_t# curslot;
683
684 // determine what is the current slot
685 curslot = -1;
686
687 if (PT_IN_RECTcxx . . $ PT_IN_RECT(33820514f83722bc).(gadmx, gadmy, x, 0, x + m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).(), m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.->heightcxx . . $ UIBitmapItem#height(b126dc7c1de90089).())) {
688 curslot = CFGELEM_SLOT_CLEARcxx . . $ `Descent3/CtlCfgElem.h:88:9`!;
689 }
690
691 x = CFGELEM_BTN_Xcxx . . $ `Descent3/CtlCfgElem.cpp:401:9`!;
692 if (PT_IN_RECTcxx . . $ PT_IN_RECT(33820514f83722bc).(gadmx, gadmy, x, 0, x + m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).(), m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->heightcxx . . $ UIBitmapItem#height(b126dc7c1de90089).())) {
693 curslot = 0;
694 }
695
696 x += m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).() + 2;
697 if (PT_IN_RECTcxx . . $ PT_IN_RECT(33820514f83722bc).(gadmx, gadmy, x, 0, x + m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->widthcxx . . $ UIBitmapItem#width(b126dc7c1de90089).(), m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.->heightcxx . . $ UIBitmapItem#height(b126dc7c1de90089).())) {
698 curslot = 1;
699 }
700
701 // if not active and mouse button is down in a box, flag as active if not already active.
702 if (!CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`!)) {
703 m_slotcxx . . $ cfg_element#m_slot. = -1;
704 if (curslot != -1) {
705 m_flagscxx . . $ cfg_element#m_flags. |= F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`!;
706 LOCK_FOCUScxx . . $ `ui/uisys.h:107:9`!(this);
707 m_curslotcxx . . $ cfg_element#m_curslot. = curslot;
708 }
709 }
710
711 // if gadget is active, then check if we should be highlighted
712 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`!)) {
713 if (curslot != -1 && m_curslotcxx . . $ cfg_element#m_curslot. == curslot) {
714 m_flagscxx . . $ cfg_element#m_flags. |= F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`!;
715 } else {
716 m_flagscxx . . $ cfg_element#m_flags. &= (~F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`!);
717 }
718 }
719 }
720 }
721
722 void cfg_elementcxx . . $ cfg_element#::OnMouseBtnUpcxx . . $ cfg_element#OnMouseBtnUp(d4f767463ce0a6b3).(int btn) {
723 if (btn == UILMSEBTNcxx . . $ `ui/uisys.h:36:9`!) {
724 // only do something if active.
725 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`!)) {
726 UNLOCK_FOCUScxx . . $ `ui/uisys.h:109:9`!(this);
727 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(m_flags, F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`!)) {
728 OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).();
729 m_slotcxx . . $ cfg_element#m_slot. = m_curslotcxx . . $ cfg_element#m_curslot.;
730 } else {
731 m_slotcxx . . $ cfg_element#m_slot. = -1;
732 }
733 }
734 m_flagscxx . . $ cfg_element#m_flags. &= ~(F_ELEM_HILITEcxx . . $ `Descent3/CtlCfgElem.cpp:397:9`! + F_ELEM_ACTIVEcxx . . $ `Descent3/CtlCfgElem.cpp:398:9`!);
735 // m_curslot = -1;
736 }
737 }
738
739 void cfg_elementcxx . . $ cfg_element#::OnLostFocuscxx . . $ cfg_element#OnLostFocus(49f6e7a06ebc5aa8).() {
740 m_blink_statecxx . . $ cfg_element#m_blink_state. = 0;
741 m_slot_alphacxx . . $ cfg_element#m_slot_alpha. = 250;
742 }
743
744 void cfg_elementcxx . . $ cfg_element#::OnGainFocuscxx . . $ cfg_element#OnGainFocus(49f6e7a06ebc5aa8).() {
745 m_slot_alphacxx . . $ cfg_element#m_slot_alpha. = 250;
746 m_blink_statecxx . . $ cfg_element#m_blink_state. = -25;
747 m_curslotcxx . . $ cfg_element#m_curslot. = 0;
748 }
749
750 void cfg_elementcxx . . $ cfg_element#::OnDestroycxx . . $ cfg_element#OnDestroy(49f6e7a06ebc5aa8).() {
751 cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count.--;
752 if (cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count. <= 0) {
753 cfg_elementcxx . . $ cfg_element#::m_countcxx . . $ cfg_element#m_count. = 0;
754 newui_FreeBitmapcxx . . $ newui_FreeBitmap(4dc4c37c6aa93e7c).(cfg_elementcxx . . $ cfg_element#::m_btn_bmpcxx . . $ cfg_element#m_btn_bmp.);
755 newui_FreeBitmapcxx . . $ newui_FreeBitmap(4dc4c37c6aa93e7c).(cfg_elementcxx . . $ cfg_element#::m_btn_bmp_litcxx . . $ cfg_element#m_btn_bmp_lit.);
756 newui_FreeBitmapcxx . . $ newui_FreeBitmap(4dc4c37c6aa93e7c).(cfg_elementcxx . . $ cfg_element#::m_xbtn_bmpcxx . . $ cfg_element#m_xbtn_bmp.);
757 newui_FreeBitmapcxx . . $ newui_FreeBitmap(4dc4c37c6aa93e7c).(cfg_elementcxx . . $ cfg_element#::m_xbtn_bmp_litcxx . . $ cfg_element#m_xbtn_bmp_lit.);
758 }
759 }
760
761 // calls configuration routines
762 bool cfg_elementcxx . . $ cfg_element#::Configurecxx . . $ cfg_element#Configure(ccaa17bdaf66462f).(ct_typecxx . . $ ct_type# *new_elem_type, uint8_tcxx . . $ uint8_t# *controller, uint8_tcxx . . $ uint8_t# *new_cfg_element, int8_tcxx . . $ int8_t# *cfg_slot) {
763 cfg_element_uicxx . . $ cfg_element_ui# cfg_box;
764 ct_typecxx . . $ ct_type# ctype_fn[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
765 uint8_tcxx . . $ uint8_t# cfgflags_fn[CTLBINDS_PER_FUNCcxx . . $ `lib/Controller.h:200:9`!];
766 ct_config_datacxx . . $ ct_config_data# ccfgdata_fn;
767 tCfgDataPartscxx . . $ tCfgDataParts# cfgparts;
768 uint8_tcxx . . $ uint8_t# element, ctrl;
769 bool configure = false;
770
771 int8_tcxx . . $ int8_t# fnid = m_fnidcxx . . $ cfg_element#m_fnid.;
772 int8_tcxx . . $ int8_t# slot = m_slotcxx . . $ cfg_element#m_slot.;
773
774 if (m_fnidcxx . . $ cfg_element#m_fnid. == -1) {
775 Int3cxx . . $ `misc/pserror.h:247:9`!(); // get samir
776 return false;
777 }
778
779 // determine which configuration pipe to go down
780 Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(fnid, ctype_fn, &ccfgdata_fn, cfgflags_fn);
781
782 if (!new_elem_type) {
783 cfgparts.bind_0cxx . . $ tCfgDataParts#bind_0. = NULL_BINDINGcxx . . $ `lib/Controller.h:180:9`!;
784 cfgparts.bind_1cxx . . $ tCfgDataParts#bind_1. = NULL_BINDINGcxx . . $ `lib/Controller.h:180:9`!;
785 cfgparts.ctrl_0cxx . . $ tCfgDataParts#ctrl_0. = NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!;
786 cfgparts.ctrl_1cxx . . $ tCfgDataParts#ctrl_1. = NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!;
787
788 ccfgdata_fn = unify_config_datacxx . . $ unify_config_data(93c052a99c9f35a1).(&cfgparts);
789 cfgflags_fn[0] = 0;
790 cfgflags_fn[1] = 0;
791
792 Controllercxx . . $ Controller.->set_controller_functioncxx . . $ gameController#set_controller_function(a87bf4975f40b925).(fnid, ctype_fn, ccfgdata_fn, cfgflags_fn);
793 return false;
794 }
795
796 ASSERTcxx . . $ `misc/pserror.h:246:9`!(slot < N_CFGELEM_SLOTScxx . . $ `Descent3/CtlCfgElem.h:87:9`! && slot >= 0);
797
798 parse_config_datacxx . . $ parse_config_data(7e428e3458f6a03b).(&cfgparts, ctype_fn[0], ctype_fn[1], ccfgdata_fn);
799 element = (slot == 0) ? cfgparts.bind_0cxx . . $ tCfgDataParts#bind_0. : cfgparts.bind_1cxx . . $ tCfgDataParts#bind_1.;
800 ctrl = (slot == 0) ? cfgparts.ctrl_0cxx . . $ tCfgDataParts#ctrl_0. : cfgparts.ctrl_1cxx . . $ tCfgDataParts#ctrl_1.;
801
802 // check if we can configure this slot.
803 switch (ctype_fn[slot]) {
804 case ctNonecxx . . $ ctNone.:
805 break;
806 case ctKeycxx . . $ ctKey.:
807 configure = true;
808 break;
809 case ctMouseButtoncxx . . $ ctMouseButton.:
810 case ctButtoncxx . . $ ctButton.:
811 case ctPOVcxx . . $ ctPOV.:
812 case ctPOV2cxx . . $ ctPOV2.:
813 case ctPOV3cxx . . $ ctPOV3.:
814 case ctPOV4cxx . . $ ctPOV4.:
815 case ctAxiscxx . . $ ctAxis.:
816 case ctMouseAxiscxx . . $ ctMouseAxis.:
817 configure = true;
818 break;
819 }
820
821 // do configuration requested
822 *new_elem_type = ctNonecxx . . $ ctNone.;
823 *new_cfg_element = NULL_BINDINGcxx . . $ `lib/Controller.h:180:9`!;
824 *controller = NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!;
825 *cfg_slot = -1;
826 if (configure) {
827 const char *txt = m_titlecxx . . $ cfg_element#m_title.;
828 cfg_box.Createcxx . . $ cfg_element_ui#Create(1949a299c0ec5ea2).(txt, ctype_fn[slot], ctrl, element);
829 cfg_box.Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).();
830 if (cfg_box.DoUIcxx . . $ cfg_element_ui#DoUI(b126dc7c1de90089).() == UID_OKcxx . . $ `ui/ui.h:368:9`!) {
831 *new_elem_type = cfg_box.GetTypecxx . . $ cfg_element_ui#GetType(45edd857a5d848a4).();
832 *new_cfg_element = cfg_box.GetElementcxx . . $ cfg_element_ui#GetElement(bd807b21b9713a30).();
833 *controller = cfg_box.GetControllercxx . . $ cfg_element_ui#GetController(bd807b21b9713a30).();
834 *cfg_slot = m_slotcxx . . $ cfg_element#m_slot.;
835 configure = true;
836 } else {
837 configure = false;
838 }
839 cfg_box.Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).();
840 cfg_box.Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).();
841 }
842
843 return configure;
844 }
845
846 //////////////////////////////////////////////////////////////////////////////
847 bool key_cfg_elementcxx . . $ key_cfg_element(ee5c1ec7cb9f69fd).(uint8_tcxx . . $ uint8_t# *element, uint8_tcxx . . $ uint8_t# *flags) {
848 // put up configuration dialog
849
850 return true;
851 }
852
853 void cfg_element_uicxx . . $ cfg_element_ui#::Createcxx . . $ cfg_element_ui#Create(1949a299c0ec5ea2).(const char *title, ct_typecxx . . $ ct_type# type, uint8_tcxx . . $ uint8_t# controller, uint8_tcxx . . $ uint8_t# element) {
854 m_controllercxx . . $ cfg_element_ui#m_controller. = controller;
855 m_elementcxx . . $ cfg_element_ui#m_element. = element;
856 m_typecxx . . $ cfg_element_ui#m_type. = type;
857
858 newuiMessageBoxcxx . . $ newuiMessageBox#::Createcxx . . $ newuiMessageBox#Create(34d26762b42c433a).(title, MSGBOX_NULLcxx . . $ `Descent3/newui_core.h:77:9`!);
859
860 // put appropriate instructions in messagebox
861 newuiSheetcxx . . $ newuiSheet# *sheet = newuiMessageBoxcxx . . $ newuiMessageBox#::GetSheetcxx . . $ newuiMessageBox#GetSheet(661381a276e5b628).();
862
863 switch (type) {
864 case ctNonecxx . . $ ctNone.:
865 break;
866 case ctKeycxx . . $ ctKey.:
867 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_CTLBINDHELP1cxx . . $ `Descent3/stringtable.h:805:9`!);
868 break;
869 case ctButtoncxx . . $ ctButton.:
870 case ctMouseButtoncxx . . $ ctMouseButton.:
871 case ctPOVcxx . . $ ctPOV.:
872 case ctPOV2cxx . . $ ctPOV2.:
873 case ctPOV3cxx . . $ ctPOV3.:
874 case ctPOV4cxx . . $ ctPOV4.:
875 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_CTLBINDHELP2_0cxx . . $ `Descent3/stringtable.h:806:9`!);
876 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_CTLBINDHELP2_1cxx . . $ `Descent3/stringtable.h:807:9`!);
877 break;
878
879 case ctAxiscxx . . $ ctAxis.:
880 case ctMouseAxiscxx . . $ ctMouseAxis.:
881 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_CTLBINDHELP3_0cxx . . $ `Descent3/stringtable.h:808:9`!);
882 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_CTLBINDHELP3_1cxx . . $ `Descent3/stringtable.h:809:9`!);
883 break;
884 }
885 }
886
887 #define GCV_CONTROLLERcxx . . $ `Descent3/CtlCfgElem.cpp:887:9`!(_r) (CONTROLLER_CTL1_INFOcxx . . $ `lib/Controller.h:192:9`!(CONTROLLER_INFOcxx . . $ `lib/Controller.h:197:9`!(ccfgdata)))
888 #define GCV_VALUEcxx . . $ `Descent3/CtlCfgElem.cpp:888:9`!(_r) (CONTROLLER_CTL1_VALUEcxx . . $ `lib/Controller.h:188:9`!(CONTROLLER_VALUEcxx . . $ `lib/Controller.h:196:9`!(ccfgdata)))
889 #define GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(_r) (CONTROLLER_CTL1_INFOcxx . . $ `lib/Controller.h:192:9`!(CONTROLLER_INFOcxx . . $ `lib/Controller.h:197:9`!(ccfgdata)) != (int8_t)NULL_CONTROLLERcxx . . $ `lib/Controller.h:181:9`!)
890
891 int cfg_element_uicxx . . $ cfg_element_ui#::DoUIcxx . . $ cfg_element_ui#DoUI(b126dc7c1de90089).() {
892 extern void ddio_MouseQueueFlushcxx . . $ ddio_MouseQueueFlush(49f6e7a06ebc5aa8).();
893
894 int retval = UID_OKcxx . . $ `ui/ui.h:368:9`!;
895 bool quit = false, catch_press = false;
896 int8_tcxx . . $ int8_t# adj;
897
898 m_alphacxx . . $ cfg_element_ui#m_alpha. = 16;
899 adj = -1;
900
901 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
902
903 Descentcxx . . $ Descent.->delaycxx . . $ oeApplication#delay(9364e6e7bff7660).(0.3f);
904 ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
905 Control_poll_flagcxx . . $ Control_poll_flag. = false; // under multiplayer, the game frame is still running, so don't let
906 // assignments make it down to game frame (HACK)
907 newuiMessageBoxcxx . . $ newuiMessageBox#::GetSheetcxx . . $ newuiMessageBox#GetSheet(661381a276e5b628).()->Realizecxx . . $ newuiSheet#Realize(49f6e7a06ebc5aa8).();
908 while (!quit) {
909 int key;
910
911 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
912 key = ddio_KeyInKeycxx . . $ ddio_KeyInKey(b126dc7c1de90089).();
913
914 // quit if escape pressed
915 if (key == KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!) {
916 retval = UID_CANCELcxx . . $ `ui/ui.h:369:9`!;
917 quit = true;
918 }
919
920 // input must go here.
921 switch (m_typecxx . . $ cfg_element_ui#m_type.) {
922 case ctKeycxx . . $ ctKey.: {
923 // perform simple key processing.
924 if (key > 0) {
925 if (Ctltext_KeyBindingscxx . . $ Ctltext_KeyBindings.[key & 0xff]) {
926 m_elementcxx . . $ cfg_element_ui#m_element. = (key & 0xff);
927 quit = true;
928 } else {
929 // here tell user that this key can't be bound.
930 }
931 }
932 break;
933 }
934 case ctButtoncxx . . $ ctButton.:
935 case ctMouseButtoncxx . . $ ctMouseButton.:
936 case ctPOVcxx . . $ ctPOV.:
937 case ctPOV2cxx . . $ ctPOV2.:
938 case ctPOV3cxx . . $ ctPOV3.:
939 case ctPOV4cxx . . $ ctPOV4.: {
940 ct_config_datacxx . . $ ct_config_data# ccfgdata;
941 ct_typecxx . . $ ct_type# new_type;
942
943 // get each type of input.
944 Controllercxx . . $ Controller.->pollcxx . . $ gameController#poll(49f6e7a06ebc5aa8).();
945
946 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctMouseButtoncxx . . $ ctMouseButton.);
947 new_type = ctMouseButtoncxx . . $ ctMouseButton.;
948 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
949 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctPOVcxx . . $ ctPOV.);
950 new_type = ctPOVcxx . . $ ctPOV.;
951 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
952 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctPOV2cxx . . $ ctPOV2.);
953 new_type = ctPOV2cxx . . $ ctPOV2.;
954 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
955 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctPOV3cxx . . $ ctPOV3.);
956 new_type = ctPOV3cxx . . $ ctPOV3.;
957 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
958 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctPOV4cxx . . $ ctPOV4.);
959 new_type = ctPOV4cxx . . $ ctPOV4.;
960 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
961 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctButtoncxx . . $ ctButton.); // read hats before buttons
962 new_type = ctButtoncxx . . $ ctButton.;
963 }
964 }
965 }
966 }
967 }
968 if (GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata) && !catch_press) {
969 m_typecxx . . $ cfg_element_ui#m_type. = new_type;
970 m_elementcxx . . $ cfg_element_ui#m_element. = GCV_VALUEcxx . . $ `Descent3/CtlCfgElem.cpp:888:9`!(ccfgdata);
971 m_controllercxx . . $ cfg_element_ui#m_controller. = GCV_CONTROLLERcxx . . $ `Descent3/CtlCfgElem.cpp:887:9`!(ccfgdata);
972 catch_press = true;
973 // mprintf(0, "HERE?\n");
974 } else if (catch_press) {
975 quit = true;
976 // mprintf(0, "THERE?\n");
977 }
978 break;
979 }
980
981 case ctAxiscxx . . $ ctAxis.:
982 case ctMouseAxiscxx . . $ ctMouseAxis.: {
983 ct_config_datacxx . . $ ct_config_data# ccfgdata;
984 ct_typecxx . . $ ct_type# new_type;
985
986 // get each type of input.
987 Controllercxx . . $ Controller.->pollcxx . . $ gameController#poll(49f6e7a06ebc5aa8).();
988
989 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctAxiscxx . . $ ctAxis.);
990 new_type = ctAxiscxx . . $ ctAxis.;
991
992 if (!GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
993 ccfgdata = Controllercxx . . $ Controller.->get_controller_valuecxx . . $ gameController#get_controller_value(1248184eb8b5e5af).(ctMouseAxiscxx . . $ ctMouseAxis.);
994 new_type = ctMouseAxiscxx . . $ ctMouseAxis.;
995 }
996 if (GCV_VALID_RESULTcxx . . $ `Descent3/CtlCfgElem.cpp:889:9`!(ccfgdata)) {
997 m_typecxx . . $ cfg_element_ui#m_type. = new_type;
998 m_elementcxx . . $ cfg_element_ui#m_element. = GCV_VALUEcxx . . $ `Descent3/CtlCfgElem.cpp:888:9`!(ccfgdata);
999 m_controllercxx . . $ cfg_element_ui#m_controller. = GCV_CONTROLLERcxx . . $ `Descent3/CtlCfgElem.cpp:887:9`!(ccfgdata);
1000 quit = true;
1001 }
1002 break;
1003 }
1004
1005 case ctNonecxx . . $ ctNone.:
1006 quit = true;
1007 break;
1008
1009 default:
1010 Int3cxx . . $ `misc/pserror.h:247:9`!();
1011 quit = true;
1012 }
1013
1014 DoUIFrameWithoutInputcxx . . $ DoUIFrameWithoutInput(49f6e7a06ebc5aa8).();
1015 rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).();
1016
1017 if (GetUIFrameResultcxx . . $ GetUIFrameResult(b126dc7c1de90089).() == NEWUIRES_FORCEQUITcxx . . $ `Descent3/newui_core.h:131:9`!) {
1018 quit = true;
1019 }
1020
1021 m_alphacxx . . $ cfg_element_ui#m_alpha. += adj;
1022 if (m_alphacxx . . $ cfg_element_ui#m_alpha. < -15) {
1023 m_alphacxx . . $ cfg_element_ui#m_alpha. = -15;
1024 adj = 1;
1025 } else if (m_alphacxx . . $ cfg_element_ui#m_alpha. > 16) {
1026 m_alphacxx . . $ cfg_element_ui#m_alpha. = 16;
1027 adj = -1;
1028 }
1029 }
1030 newuiMessageBoxcxx . . $ newuiMessageBox#::GetSheetcxx . . $ newuiMessageBox#GetSheet(661381a276e5b628).()->Unrealizecxx . . $ newuiSheet#Unrealize(49f6e7a06ebc5aa8).();
1031
1032 SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
1033
1034 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
1035 ddio_MouseQueueFlushcxx . . $ ddio_MouseQueueFlush(49f6e7a06ebc5aa8).();
1036 ui_Flushcxx . . $ ui_Flush(49f6e7a06ebc5aa8).();
1037
1038 return UID_OKcxx . . $ `ui/ui.h:368:9`!;
1039 }
1040
1041 void cfg_element_uicxx . . $ cfg_element_ui#::OnDrawcxx . . $ cfg_element_ui#OnDraw(49f6e7a06ebc5aa8).() {
1042 UITextItemcxx . . $ UITextItem# promptcxx . . $ UITextItem#UITextItem(284d3affb5f9e25a).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!, "?", NEWUI_MONITORFONT_COLORcxx . . $ `Descent3/newui_core.h:70:9`!, (uint8_tcxx . . $ uint8_t#)(m_alphacxx . . $ cfg_element_ui#m_alpha. * 8) + 127);
1043
1044 newuiMessageBoxcxx . . $ newuiMessageBox#::OnDrawcxx . . $ newuiMessageBox#OnDraw(49f6e7a06ebc5aa8).();
1045
1046 prompt.drawcxx . . $ UITextItem#draw(84329bcd07240ccf).(16, 60);
1047 }