announce map titles (#1704)

* announce map titles

https://www.doomworld.com/forum/topic/125256-nugget-doom-310-updated-may-16th-24/?page=22&tab=comments#comment-2801367

* make hud_map_announce static
This commit is contained in:
Fabian Greffrath 2024-05-25 11:01:51 +02:00 committed by GitHub
parent f673802db6
commit 46bc8de658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 5 deletions

View File

@ -168,6 +168,10 @@ boolean show_messages;
boolean show_toggle_messages;
boolean show_pickup_messages;
static boolean hud_map_announce;
static boolean title_on;
static int title_counter;
static boolean headsupactive = false;
//jff 2/16/98 hud supported automap colors added
@ -557,7 +561,7 @@ void HU_Start(void)
// create the map title widget
HUlib_init_multiline(&w_title, 1,
&doom_font, colrngs[hudcolor_titl],
&automapactive, HU_widget_build_title);
&title_on, HU_widget_build_title);
// [FG] built only once right here
w_title.builder();
@ -683,6 +687,11 @@ static void HU_widget_build_title (void)
*n = '\0';
}
if (hud_map_announce && leveltime == 0)
{
title_counter = HU_MSGTIMEOUT2;
}
M_StringConcat(hud_titlestr, s, sizeof(hud_titlestr));
HUlib_add_string_to_cur_line(&w_title, hud_titlestr);
@ -1564,7 +1573,7 @@ void HU_Ticker(void)
HUlib_add_string_to_cur_line(&w_secret, plr->secretmessage);
plr->secretmessage = NULL;
secret_on = true;
secret_counter = 5*TICRATE/2; // [crispy] 2.5 seconds
secret_counter = HU_MSGTIMEOUT2;
}
// if messages on, or "Messages Off" is being displayed
@ -1646,17 +1655,26 @@ void HU_Ticker(void)
// draw the automap widgets if automap is displayed
if (title_counter)
{
title_counter--;
}
if (automapactive)
{
HU_cond_build_widget(w_stats, hud_level_stats & HUD_WIDGET_AUTOMAP);
HU_cond_build_widget(&w_sttime, hud_level_time & HUD_WIDGET_AUTOMAP || plr->btuse_tics);
HU_cond_build_widget(&w_coord, STRICTMODE(hud_player_coords) & HUD_WIDGET_AUTOMAP);
title_on = true;
}
else
{
HU_cond_build_widget(w_stats, hud_level_stats & HUD_WIDGET_HUD);
HU_cond_build_widget(&w_sttime, hud_level_time & HUD_WIDGET_HUD || plr->btuse_tics);
HU_cond_build_widget(&w_coord, STRICTMODE(hud_player_coords) & HUD_WIDGET_HUD);
title_on = (title_counter > 0);
}
HU_cond_build_widget(&w_fps, plr->cheats & CF_SHOWFPS);
@ -2237,7 +2255,9 @@ void HU_BindHUDVariables(void)
BIND_BOOL(show_messages, true, "Show messages");
M_BindBool("hud_secret_message", &hud_secret_message, NULL,
true, ss_stat, wad_no, "Show secret-revealed message");
true, ss_stat, wad_no, "Announce revealed secrets");
M_BindBool("hud_map_announce", &hud_map_announce, NULL,
false, ss_stat, wad_no, "Announce map titles");
M_BindBool("show_toggle_messages", &show_toggle_messages, NULL,
true, ss_stat, wad_no, "Show toggle messages");
M_BindBool("show_pickup_messages", &show_pickup_messages, NULL,

View File

@ -29,6 +29,7 @@ struct mobj_s;
#define HU_BROADCAST 5
#define HU_MSGTIMEOUT (4*TICRATE)
#define HU_MSGTIMEOUT2 (5*TICRATE/2) // [crispy] 2.5 seconds
//
// Heads up text

View File

@ -1492,8 +1492,8 @@ static setup_menu_t stat_settings3[] = {
};
static setup_menu_t stat_settings4[] = {
{"\"A Secret is Revealed!\" Message", S_ONOFF, M_X, M_SPC,
{"hud_secret_message"}},
{"Announce Revealed Secrets", S_ONOFF, M_X, M_SPC, {"hud_secret_message"}},
{"Announce Map Titles", S_ONOFF, M_X, M_SPC, {"hud_map_announce"}},
{"Show Toggle Messages", S_ONOFF, M_X, M_SPC, {"show_toggle_messages"}},
{"Show Pickup Messages", S_ONOFF, M_X, M_SPC, {"show_pickup_messages"}},
{"Show Obituaries", S_ONOFF, M_X, M_SPC, {"show_obituary_messages"}},