Debian Codegraph @

prboom2/src/dsda/exhud.c

raw
1 //
2 // Copyright(C) 2021 by Ryan Krafnick
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 // DSDA Extended HUD
16 //
17
18 #include <stdio.h>
19
20 #include "am_map.h"
21 #include "doomstat.h"
22 #include "hu_stuff.h"
23 #include "lprintf.h"
24 #include "m_file.h"
25 #include "r_main.h"
26 #include "v_video.h"
27 #include "w_wad.h"
28
29 #include "dsda/args.h"
30 #include "dsda/console.h"
31 #include "dsda/global.h"
32 #include "dsda/hud_components.h"
33 #include "dsda/render_stats.h"
34 #include "dsda/settings.h"
35 #include "dsda/utility.h"
36
37 #include "exhud.h"
38
39 typedef struct {
40 void (*init)(int x_offset, int y_offset, int vpt_flags, int* args, int arg_count, void** data);
41 void (*update)(void* data);
42 void (*draw)(void* data);
43 const char* name;
44 const int default_vpt;
45 const dboolean strict;
46 const dboolean off_by_default;
47 const dboolean intermission;
48 const dboolean not_level;
49 dboolean on;
50 dboolean initialized;
51 void* data;
52 } exhud_component_t;
53
54 typedef enum {
55 exhud_ammo_text,
56 exhud_armor_text,
57 exhud_big_ammo,
58 exhud_big_armor,
59 exhud_big_armor_text,
60 exhud_big_artifact,
61 exhud_big_health,
62 exhud_big_health_text,
63 exhud_composite_time,
64 exhud_health_text,
65 exhud_keys,
66 exhud_ready_ammo_text,
67 exhud_speed_text,
68 exhud_stat_totals,
69 exhud_tracker,
70 exhud_weapon_text,
71 exhud_render_stats,
72 exhud_fps,
73 exhud_attempts,
74 exhud_local_time,
75 exhud_coordinate_display,
76 exhud_line_display,
77 exhud_command_display,
78 exhud_event_split,
79 exhud_level_splits,
80 exhud_color_test,
81 exhud_free_text,
82 exhud_message,
83 exhud_secret_message,
84 exhud_map_coordinates,
85 exhud_map_time,
86 exhud_map_title,
87 exhud_map_totals,
88 exhud_minimap,
89 exhud_component_count,
90 } exhud_component_id_t;
91
92 exhud_component_t components_template[exhud_component_count] = {
93 [exhud_ammo_text] = {
94 dsda_InitAmmoTextHC,
95 dsda_UpdateAmmoTextHC,
96 dsda_DrawAmmoTextHC,
97 "ammo_text",
98 .default_vpt = VPT_EX_TEXT,
99 },
100 [exhud_armor_text] = {
101 dsda_InitArmorTextHC,
102 dsda_UpdateArmorTextHC,
103 dsda_DrawArmorTextHC,
104 "armor_text",
105 .default_vpt = VPT_EX_TEXT,
106 },
107 [exhud_big_ammo] = {
108 dsda_InitBigAmmoHC,
109 dsda_UpdateBigAmmoHC,
110 dsda_DrawBigAmmoHC,
111 "big_ammo",
112 .default_vpt = VPT_EX_TEXT,
113 },
114 [exhud_big_armor] = {
115 dsda_InitBigArmorHC,
116 dsda_UpdateBigArmorHC,
117 dsda_DrawBigArmorHC,
118 "big_armor",
119 .default_vpt = VPT_EX_TEXT | VPT_NOOFFSET,
120 },
121 [exhud_big_armor_text] = {
122 dsda_InitBigArmorTextHC,
123 dsda_UpdateBigArmorTextHC,
124 dsda_DrawBigArmorTextHC,
125 "big_armor_text",
126 .default_vpt = VPT_EX_TEXT,
127 },
128 [exhud_big_artifact] = {
129 dsda_InitBigArtifactHC,
130 dsda_UpdateBigArtifactHC,
131 dsda_DrawBigArtifactHC,
132 "big_artifact",
133 .default_vpt = VPT_EX_TEXT,
134 },
135 [exhud_big_health] = {
136 dsda_InitBigHealthHC,
137 dsda_UpdateBigHealthHC,
138 dsda_DrawBigHealthHC,
139 "big_health",
140 .default_vpt = VPT_EX_TEXT | VPT_NOOFFSET,
141 },
142 [exhud_big_health_text] = {
143 dsda_InitBigHealthTextHC,
144 dsda_UpdateBigHealthTextHC,
145 dsda_DrawBigHealthTextHC,
146 "big_health_text",
147 .default_vpt = VPT_EX_TEXT,
148 },
149 [exhud_composite_time] = {
150 dsda_InitCompositeTimeHC,
151 dsda_UpdateCompositeTimeHC,
152 dsda_DrawCompositeTimeHC,
153 "composite_time",
154 .default_vpt = VPT_EX_TEXT,
155 },
156 [exhud_health_text] = {
157 dsda_InitHealthTextHC,
158 dsda_UpdateHealthTextHC,
159 dsda_DrawHealthTextHC,
160 "health_text",
161 .default_vpt = VPT_EX_TEXT,
162 },
163 [exhud_keys] = {
164 dsda_InitKeysHC,
165 dsda_UpdateKeysHC,
166 dsda_DrawKeysHC,
167 "keys",
168 .default_vpt = VPT_EX_TEXT | VPT_NOOFFSET,
169 },
170 [exhud_ready_ammo_text] = {
171 dsda_InitReadyAmmoTextHC,
172 dsda_UpdateReadyAmmoTextHC,
173 dsda_DrawReadyAmmoTextHC,
174 "ready_ammo_text",
175 .default_vpt = VPT_EX_TEXT,
176 },
177 [exhud_speed_text] = {
178 dsda_InitSpeedTextHC,
179 dsda_UpdateSpeedTextHC,
180 dsda_DrawSpeedTextHC,
181 "speed_text",
182 .default_vpt = VPT_EX_TEXT,
183 },
184 [exhud_stat_totals] = {
185 dsda_InitStatTotalsHC,
186 dsda_UpdateStatTotalsHC,
187 dsda_DrawStatTotalsHC,
188 "stat_totals",
189 .default_vpt = VPT_EX_TEXT,
190 },
191 [exhud_tracker] = {
192 dsda_InitTrackerHC,
193 dsda_UpdateTrackerHC,
194 dsda_DrawTrackerHC,
195 "tracker",
196 .default_vpt = VPT_EX_TEXT,
197 .strict = true,
198 },
199 [exhud_weapon_text] = {
200 dsda_InitWeaponTextHC,
201 dsda_UpdateWeaponTextHC,
202 dsda_DrawWeaponTextHC,
203 "weapon_text",
204 .default_vpt = VPT_EX_TEXT,
205 },
206 [exhud_render_stats] = {
207 dsda_InitRenderStatsHC,
208 dsda_UpdateRenderStatsHC,
209 dsda_DrawRenderStatsHC,
210 "render_stats",
211 .default_vpt = VPT_EX_TEXT,
212 .strict = true,
213 .off_by_default = true,
214 },
215 [exhud_fps] = {
216 dsda_InitFPSHC,
217 dsda_UpdateFPSHC,
218 dsda_DrawFPSHC,
219 "fps",
220 .default_vpt = VPT_EX_TEXT,
221 .off_by_default = true,
222 },
223 [exhud_attempts] = {
224 dsda_InitAttemptsHC,
225 dsda_UpdateAttemptsHC,
226 dsda_DrawAttemptsHC,
227 "attempts",
228 .default_vpt = VPT_EX_TEXT,
229 },
230 [exhud_local_time] = {
231 dsda_InitLocalTimeHC,
232 dsda_UpdateLocalTimeHC,
233 dsda_DrawLocalTimeHC,
234 "local_time",
235 .default_vpt = VPT_EX_TEXT,
236 },
237 [exhud_coordinate_display] = {
238 dsda_InitCoordinateDisplayHC,
239 dsda_UpdateCoordinateDisplayHC,
240 dsda_DrawCoordinateDisplayHC,
241 "coordinate_display",
242 .default_vpt = VPT_EX_TEXT,
243 .strict = true,
244 .off_by_default = true,
245 },
246 [exhud_line_display] = {
247 dsda_InitLineDisplayHC,
248 dsda_UpdateLineDisplayHC,
249 dsda_DrawLineDisplayHC,
250 "line_display",
251 .default_vpt = VPT_EX_TEXT,
252 .strict = true,
253 .off_by_default = true,
254 },
255 [exhud_command_display] = {
256 dsda_InitCommandDisplayHC,
257 dsda_UpdateCommandDisplayHC,
258 dsda_DrawCommandDisplayHC,
259 "command_display",
260 .default_vpt = VPT_EX_TEXT,
261 .strict = true,
262 .off_by_default = true,
263 .intermission = true,
264 },
265 [exhud_event_split] = {
266 dsda_InitEventSplitHC,
267 dsda_UpdateEventSplitHC,
268 dsda_DrawEventSplitHC,
269 "event_split",
270 .default_vpt = VPT_EX_TEXT,
271 },
272 [exhud_level_splits] = {
273 dsda_InitLevelSplitsHC,
274 dsda_UpdateLevelSplitsHC,
275 dsda_DrawLevelSplitsHC,
276 "level_splits",
277 .default_vpt = VPT_EX_TEXT,
278 .intermission = true,
279 .not_level = true,
280 },
281 [exhud_color_test] = {
282 dsda_InitColorTestHC,
283 dsda_UpdateColorTestHC,
284 dsda_DrawColorTestHC,
285 "color_test",
286 .default_vpt = VPT_EX_TEXT,
287 },
288 [exhud_free_text] = {
289 dsda_InitFreeTextHC,
290 dsda_UpdateFreeTextHC,
291 dsda_DrawFreeTextHC,
292 "free_text",
293 .default_vpt = VPT_EX_TEXT,
294 },
295 [exhud_message] = {
296 dsda_InitMessageHC,
297 dsda_UpdateMessageHC,
298 dsda_DrawMessageHC,
299 "message",
300 },
301 [exhud_secret_message] = {
302 dsda_InitSecretMessageHC,
303 dsda_UpdateSecretMessageHC,
304 dsda_DrawSecretMessageHC,
305 "secret_message",
306 },
307 [exhud_map_coordinates] = {
308 dsda_InitMapCoordinatesHC,
309 dsda_UpdateMapCoordinatesHC,
310 dsda_DrawMapCoordinatesHC,
311 "map_coordinates",
312 .strict = true,
313 },
314 [exhud_map_time] = {
315 dsda_InitMapTimeHC,
316 dsda_UpdateMapTimeHC,
317 dsda_DrawMapTimeHC,
318 "map_time",
319 },
320 [exhud_map_title] = {
321 dsda_InitMapTitleHC,
322 dsda_UpdateMapTitleHC,
323 dsda_DrawMapTitleHC,
324 "map_title",
325 },
326 [exhud_map_totals] = {
327 dsda_InitMapTotalsHC,
328 dsda_UpdateMapTotalsHC,
329 dsda_DrawMapTotalsHC,
330 "map_totals",
331 },
332 [exhud_minimap] = {
333 dsda_InitMinimapHC,
334 dsda_UpdateMinimapHC,
335 dsda_DrawMinimapHC,
336 "minimap",
337 .default_vpt = VPT_EX_TEXT,
338 .off_by_default = true,
339 },
340 };
341
342 typedef struct {
343 const char* name;
344 dboolean status_bar;
345 dboolean allow_offset;
346 dboolean loaded;
347 exhud_component_t components[exhud_component_count];
348 int y_offset[VPT_ALIGN_MAX];
349 } dsda_hud_container_t;
350
351 typedef enum {
352 hud_ex,
353 hud_off,
354 hud_full,
355 hud_map,
356 hud_null,
357 } dsda_hud_variant_t;
358
359 static dsda_hud_container_t containers[] = {
360 [hud_ex] = { "ex", true, true },
361 [hud_off] = { "off", true, true },
362 [hud_full] = { "full", false, true },
363 [hud_map] = { "map", true, false },
364 [hud_null] = { NULL }
365 };
366
367 static dsda_hud_container_t* container;
368 static exhud_component_t* components;
369
370 int dsda_show_render_stats;
371
372 int dsda_ExHudVerticalOffset(void) {
373 if (container && container->status_bar)
374 return g_st_height;
375
376 return 0;
377 }
378
379 static void dsda_TurnComponentOn(int id) {
380 if (!components[id].initialized)
381 return;
382
383 components[id].on = true;
384 }
385
386 static void dsda_TurnComponentOff(int id) {
387 components[id].on = false;
388 }
389
390 static void dsda_InitializeComponent(int id, int x, int y, int vpt, int* args, int arg_count) {
391 components[id].initialized = true;
392 components[id].init(x, y, vpt | components[id].default_vpt,
393 args, arg_count, &components[id].data);
394
395 if (components[id].off_by_default)
396 dsda_TurnComponentOff(id);
397 else
398 dsda_TurnComponentOn(id);
399 }
400
401 static int dsda_AlignmentToVPT(const char* alignment) {
402 if (!strcmp(alignment, "bottom_left"))
403 return VPT_ALIGN_LEFT_BOTTOM;
404 else if (!strcmp(alignment, "bottom_right"))
405 return VPT_ALIGN_RIGHT_BOTTOM;
406 else if (!strcmp(alignment, "top_left"))
407 return VPT_ALIGN_LEFT_TOP;
408 else if (!strcmp(alignment, "top_right"))
409 return VPT_ALIGN_RIGHT_TOP;
410 else if (!strcmp(alignment, "top"))
411 return VPT_ALIGN_TOP;
412 else if (!strcmp(alignment, "bottom"))
413 return VPT_ALIGN_BOTTOM;
414 else if (!strcmp(alignment, "left"))
415 return VPT_ALIGN_LEFT;
416 else if (!strcmp(alignment, "right"))
417 return VPT_ALIGN_RIGHT;
418 else if (!strcmp(alignment, "none"))
419 return VPT_STRETCH;
420 else
421 return -1;
422 }
423
424 static int dsda_ParseHUDConfig(char** hud_config, int line_i) {
425 int i;
426 int count;
427 dboolean found;
428 const char* line;
429 char command[64];
430 char args[64];
431
432 for (++line_i; hud_config[line_i]; ++line_i) {
433 line = hud_config[line_i];
434
435 if (line[0] == '#' || line[0] == '/' || line[0] == '!' || !line[0])
436 continue;
437
438 count = sscanf(line, "%63s %63[^\n\r]", command, args);
439 if (count != 2)
440 I_Error("Invalid hud definition \"%s\"", line);
441
442 // The start of another definition
443 if (!strncmp(command, "doom", sizeof(command)) ||
444 !strncmp(command, "heretic", sizeof(command)) ||
445 !strncmp(command, "hexen", sizeof(command)))
446 break;
447
448 found = false;
449
450 for (i = 0; i < exhud_component_count; ++i)
451 if (!strncmp(command, components[i].name, sizeof(command))) {
452 int x, y;
453 int vpt;
454 int component_args[6] = { 0 };
455 char alignment[16];
456
457 found = true;
458
459 count = sscanf(args, "%d %d %15s %d %d %d %d %d %d", &x, &y, alignment,
460 &component_args[0], &component_args[1],
461 &component_args[2], &component_args[3],
462 &component_args[4], &component_args[5]);
463 if (count < 3)
464 I_Error("Invalid hud component args \"%s\"", line);
465
466 vpt = dsda_AlignmentToVPT(alignment);
467 if (vpt < 0)
468 I_Error("Invalid hud component alignment \"%s\"", line);
469
470 dsda_InitializeComponent(i, x, y, vpt, component_args, count - 3);
471 }
472
473 if (!strncmp(command, "add_offset", sizeof(command))) {
474 int offset;
475 int vpt;
476 char alignment[16];
477
478 found = true;
479
480 if (!container->allow_offset)
481 I_Error("The %s config does not support add_offset", container->name);
482
483 count = sscanf(args, "%d %15s", &offset, alignment);
484 if (count != 2)
485 I_Error("Invalid hud offset \"%s\"", line);
486
487 vpt = dsda_AlignmentToVPT(alignment);
488 if (vpt < 0) {
489 I_Error("Invalid hud offset alignment \"%s\"", line);
490 vpt = 0; // TODO: remove after I_Error marked noreturn
491 }
492
493 container->y_offset[vpt] = offset;
494
495 if (BOTTOM_ALIGNMENT(vpt))
496 container->y_offset[vpt] = -container->y_offset[vpt];
497 }
498
499 if (!found)
500 I_Error("Invalid hud component \"%s\"", line);
501 }
502
503 // roll back the line that wasn't part of this config
504 return line_i - 1;
505 }
506
507 static void dsda_ParseHUDConfigs(char** hud_config) {
508 const char* line;
509 int line_i;
510 const char* target_format;
511 char hud_variant[5];
512
513 target_format = hexen ? "hexen %s" : heretic ? "heretic %s" : "doom %s";
514
515 for (line_i = 0; hud_config[line_i]; ++line_i) {
516 line = hud_config[line_i];
517
518 if (sscanf(line, target_format, hud_variant)) {
519 for (container = containers; container->name; container++)
520 if (!strncmp(container->name, hud_variant, sizeof(hud_variant))) {
521 if (container->loaded)
522 break;
523
524 container->loaded = true;
525 components = container->components;
526 memcpy(components, components_template, sizeof(components_template));
527
528 line_i = dsda_ParseHUDConfig(hud_config, line_i);
529
530 break;
531 }
532 }
533 }
534 }
535
536 static void dsda_LoadHUDConfig(void) {
537 DO_ONCE
538 char* hud_config = NULL;
539 char** lines;
540 dsda_arg_t* arg;
541 int lump;
542 int length = 0;
543
544 arg = dsda_Arg(dsda_arg_hud);
545 if (arg->found)
546 length = M_ReadFileToString(arg->value.v_string, &hud_config);
547
548 lump = -1;
549 while ((lump = W_FindNumFromName("DSDAHUD", lump)) >= 0) {
550 if (!hud_config) {
551 hud_config = W_ReadLumpToString(lump);
552 length = W_LumpLength(lump);
553 }
554 else {
555 hud_config = Z_Realloc(hud_config, length + W_LumpLength(lump) + 2);
556 hud_config[length++] = '\n'; // in case the file didn't end in a new line
557 W_ReadLump(lump, hud_config + length);
558 length += W_LumpLength(lump);
559 hud_config[length] = '\0';
560 }
561 }
562
563 if (hud_config) {
564 lines = dsda_SplitString(hud_config, "\n\r");
565
566 if (lines) {
567 dsda_ParseHUDConfigs(lines);
568
569 Z_Free(lines);
570 }
571
572 Z_Free(hud_config);
573 }
574 END_ONCE
575 }
576
577 static dboolean dsda_HideHUD(void) {
578 return dsda_Flag(dsda_arg_nodraw) ||
579 (R_FullView() && !dsda_IntConfig(dsda_config_hud_displayed));
580 }
581
582 static dboolean dsda_HUDActive(void) {
583 return container && container->loaded;
584 }
585
586 static void dsda_ResetActiveHUD(void) {
587 container = NULL;
588 components = NULL;
589 }
590
591 static void dsda_UpdateActiveHUD(void) {
592 container = R_FullView() ? &containers[hud_full] :
593 dsda_IntConfig(dsda_config_exhud) ? &containers[hud_ex] :
594 &containers[hud_off];
595
596 if (container->loaded)
597 components = container->components;
598 else
599 dsda_ResetActiveHUD();
600 }
601
602 static void dsda_ResetOffsets(void) {
603 void dsda_UpdateExTextOffset(enum patch_translation_e flags, int offset);
604 void dsda_ResetExTextOffsets(void);
605
606 int i;
607
608 dsda_ResetExTextOffsets();
609
610 for (i = 0; i < VPT_ALIGN_MAX; ++i)
611 if (container->y_offset[i])
612 dsda_UpdateExTextOffset(i, container->y_offset[i]);
613 }
614
615 static void dsda_RefreshHUD(void) {
616 if (!dsda_HUDActive())
617 return;
618
619 dsda_ResetOffsets();
620
621 if (dsda_show_render_stats)
622 dsda_TurnComponentOn(exhud_render_stats);
623
624 dsda_RefreshExHudFPS();
625 dsda_RefreshExHudMinimap();
626 dsda_RefreshExHudLevelSplits();
627 dsda_RefreshExHudCoordinateDisplay();
628 dsda_RefreshExHudCommandDisplay();
629 dsda_RefreshMapCoordinates();
630 dsda_RefreshMapTotals();
631 dsda_RefreshMapTime();
632 dsda_RefreshMapTitle();
633
634 if (in_game && gamestate == GS_LEVEL)
635 dsda_UpdateExHud();
636 }
637
638 void dsda_InitExHud(void) {
639 dsda_ResetActiveHUD();
640
641 if (dsda_HideHUD())
642 return;
643
644 dsda_LoadHUDConfig();
645 dsda_UpdateActiveHUD();
646 dsda_RefreshHUD();
647 }
648
649 static void dsda_UpdateComponents(exhud_component_t* update_components) {
650 int i;
651
652 for (i = 0; i < exhud_component_count; ++i)
653 if (
654 update_components[i].on &&
655 !update_components[i].not_level &&
656 (!update_components[i].strict || !dsda_StrictMode())
657 )
658 update_components[i].update(update_components[i].data);
659 }
660
661 void dsda_UpdateExHud(void) {
662 if (automap_stbar) {
663 if (containers[hud_map].loaded)
664 dsda_UpdateComponents(containers[hud_map].components);
665
666 return;
667 }
668
669 if (!dsda_HUDActive())
670 return;
671
672 dsda_UpdateComponents(components);
673 }
674
675 static void dsda_DrawComponents(exhud_component_t* draw_components) {
676 int i;
677
678 for (i = 0; i < exhud_component_count; ++i)
679 if (
680 draw_components[i].on &&
681 !draw_components[i].not_level &&
682 (!draw_components[i].strict || !dsda_StrictMode())
683 )
684 draw_components[i].draw(draw_components[i].data);
685 }
686
687 int global_patch_top_offset;
688
689 void dsda_DrawExHud(void) {
690 global_patch_top_offset = M_ConsoleOpen() ? dsda_ConsoleHeight() : 0;
691
692 if (automap_stbar) {
693 if (containers[hud_map].loaded)
694 dsda_DrawComponents(containers[hud_map].components);
695 }
696 else if (dsda_HUDActive())
697 dsda_DrawComponents(components);
698
699 global_patch_top_offset = 0;
700 }
701
702 void dsda_DrawExIntermission(void) {
703 int i;
704
705 if (!dsda_HUDActive())
706 return;
707
708 for (i = 0; i < exhud_component_count; ++i)
709 if (
710 components[i].on &&
711 components[i].intermission &&
712 (!components[i].strict || !dsda_StrictMode())
713 )
714 components[i].draw(components[i].data);
715 }
716
717 void dsda_ToggleRenderStats(void) {
718 dsda_show_render_stats = !dsda_show_render_stats;
719
720 if (!dsda_HUDActive())
721 return;
722
723 if (components[exhud_render_stats].on && !dsda_show_render_stats)
724 dsda_TurnComponentOff(exhud_render_stats);
725 else if (!components[exhud_render_stats].on && dsda_show_render_stats) {
726 dsda_BeginRenderStats();
727 dsda_TurnComponentOn(exhud_render_stats);
728 }
729 }
730
731 static void dsda_BasicRefresh(dboolean (*show_component)(void), exhud_component_id_t id) {
732 if (!dsda_HUDActive())
733 return;
734
735 if (show_component())
736 dsda_TurnComponentOn(id);
737 else
738 dsda_TurnComponentOff(id);
739 }
740
741 static void dsda_BasicMapRefresh(dboolean (*show_component)(void), exhud_component_id_t id) {
742 exhud_component_t* old_components;
743
744 if (!dsda_HUDActive())
745 return;
746
747 old_components = components;
748 components = containers[hud_map].components;
749
750 if (show_component())
751 dsda_TurnComponentOn(id);
752 else
753 dsda_TurnComponentOff(id);
754
755 components = old_components;
756 }
757
758 void dsda_RefreshExHudFPS(void) {
759 dsda_BasicRefresh(dsda_ShowFPS, exhud_fps);
760 }
761
762 void dsda_RefreshExHudMinimap(void) {
763 if (!dsda_HUDActive())
764 return;
765
766 if (dsda_ShowMinimap()) {
767 dsda_TurnComponentOn(exhud_minimap);
768
769 // Need to update the component before calling AM_Start
770 if (components[exhud_minimap].initialized)
771 components[exhud_minimap].update(components[exhud_minimap].data);
772
773 if (in_game && gamestate == GS_LEVEL)
774 AM_Start(false);
775 }
776 else
777 dsda_TurnComponentOff(exhud_minimap);
778 }
779
780 void dsda_RefreshExHudLevelSplits(void) {
781 dsda_BasicRefresh(dsda_ShowLevelSplits, exhud_level_splits);
782 }
783
784 void dsda_RefreshExHudCoordinateDisplay(void) {
785 if (!dsda_HUDActive())
786 return;
787
788 if (dsda_CoordinateDisplay()) {
789 dsda_TurnComponentOn(exhud_coordinate_display);
790 dsda_TurnComponentOn(exhud_line_display);
791 }
792 else {
793 dsda_TurnComponentOff(exhud_coordinate_display);
794 dsda_TurnComponentOff(exhud_line_display);
795 }
796 }
797
798 void dsda_RefreshExHudCommandDisplay(void) {
799 dsda_BasicRefresh(dsda_CommandDisplay, exhud_command_display);
800 }
801
802 void dsda_RefreshMapCoordinates(void) {
803 dsda_BasicMapRefresh(dsda_MapCoordinates, exhud_map_coordinates);
804 }
805
806 void dsda_RefreshMapTotals(void) {
807 dsda_BasicMapRefresh(dsda_MapTotals, exhud_map_totals);
808 }
809
810 void dsda_RefreshMapTime(void) {
811 dsda_BasicMapRefresh(dsda_MapTime, exhud_map_time);
812 }
813
814 void dsda_RefreshMapTitle(void) {
815 dsda_BasicMapRefresh(dsda_MapTitle, exhud_map_title);
816 }