bring back three-lined coords/stats widgets (#1180)

* bring back three-lined coords/stats widgets

Fixes #1131

* fix typo

* try to shut MSVC up

* restore original buffer length

* rearrange menu items

* simplify matters

* restore init ordering

* some final adjustments
This commit is contained in:
Fabian Greffrath 2023-08-22 08:24:16 +02:00 committed by GitHub
parent 4265250240
commit b7c669c47c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 13 deletions

View File

@ -44,6 +44,7 @@ int hud_displayed; //jff 2/23/98 turns heads-up display on/off
int hud_secret_message; // "A secret is revealed!" message
int hud_widget_font;
int hud_draw_bargraphs;
int hud_threelined_widgets;
int crispy_hud; // Crispy HUD
static boolean draw_crispy_hud;
@ -656,7 +657,7 @@ void HU_Start(void)
NULL, deathmatch ? HU_widget_build_frag : HU_widget_build_keys);
// create the hud monster/secret widget
HUlib_init_multiline(&w_monsec, 1,
HUlib_init_multiline(&w_monsec, hud_threelined_widgets ? 3 : 1,
&hu_font2, colrngs[CR_GRAY],
NULL, HU_widget_build_monsec);
@ -665,7 +666,7 @@ void HU_Start(void)
NULL, HU_widget_build_sttime);
// create the automaps coordinate widget
HUlib_init_multiline(&w_coord, 1,
HUlib_init_multiline(&w_coord, hud_threelined_widgets ? 3 : 1,
&hu_font2, colrngs[hudcolor_xyco],
NULL, HU_widget_build_coord);
@ -1158,13 +1159,27 @@ static void HU_widget_build_monsec(void)
offset += sprintf(hud_monsecstr + offset, "+%d", extrakills);
}
sprintf(hud_monsecstr + offset,
" \x1b%c%d%% \x1b%cI \x1b%c%d/%d \x1b%cS \x1b%c%d/%d",
kills_percent_color, kills_percent,
'0'+CR_RED, items_color, items, totalitems,
'0'+CR_RED, secrets_color, secrets, totalsecret);
if (hud_threelined_widgets)
{
sprintf(hud_monsecstr + offset, " \x1b%c%d%%", kills_percent_color, kills_percent);
HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr);
HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr);
sprintf(hud_monsecstr, "\x1b%cI \x1b%c%d/%d", ('0'+CR_RED), items_color, items, totalitems);
HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr);
sprintf(hud_monsecstr, "\x1b%cS \x1b%c%d/%d", ('0'+CR_RED), secrets_color, secrets, totalsecret);
HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr);
}
else
{
sprintf(hud_monsecstr + offset,
" \x1b%c%d%% \x1b%cI \x1b%c%d/%d \x1b%cS \x1b%c%d/%d",
kills_percent_color, kills_percent,
'0'+CR_RED, items_color, items, totalitems,
'0'+CR_RED, secrets_color, secrets, totalsecret);
HUlib_add_string_to_cur_line(&w_monsec, hud_monsecstr);
}
}
static void HU_widget_build_sttime(void)
@ -1202,12 +1217,26 @@ static void HU_widget_build_coord (void)
AM_Coordinates(plr->mo, &x, &y, &z);
//jff 2/16/98 output new coord display
sprintf(hud_coordstr, "X \x1b%c%d \x1b%cY \x1b%c%d \x1b%cZ \x1b%c%d",
'0'+CR_GRAY, x >> FRACBITS, '0'+hudcolor_xyco,
'0'+CR_GRAY, y >> FRACBITS, '0'+hudcolor_xyco,
'0'+CR_GRAY, z >> FRACBITS);
if (hud_threelined_widgets)
{
sprintf(hud_coordstr, "X \x1b%c%d", '0'+CR_GRAY, x >> FRACBITS);
HUlib_add_string_to_cur_line(&w_coord, hud_coordstr);
HUlib_add_string_to_cur_line(&w_coord, hud_coordstr);
sprintf(hud_coordstr, "Y \x1b%c%d", '0'+CR_GRAY, y >> FRACBITS);
HUlib_add_string_to_cur_line(&w_coord, hud_coordstr);
sprintf(hud_coordstr, "Z \x1b%c%d", '0'+CR_GRAY, z >> FRACBITS);
HUlib_add_string_to_cur_line(&w_coord, hud_coordstr);
}
else
{
sprintf(hud_coordstr, "X \x1b%c%d \x1b%cY \x1b%c%d \x1b%cZ \x1b%c%d",
'0'+CR_GRAY, x >> FRACBITS, '0'+hudcolor_xyco,
'0'+CR_GRAY, y >> FRACBITS, '0'+hudcolor_xyco,
'0'+CR_GRAY, z >> FRACBITS);
HUlib_add_string_to_cur_line(&w_coord, hud_coordstr);
}
}
static void HU_widget_build_fps (void)

View File

@ -84,6 +84,7 @@ extern int hud_level_stats, hud_level_time;
extern int hud_widget_font;
extern int hud_widescreen_widgets;
extern int hud_draw_bargraphs;
extern int hud_threelined_widgets;
extern boolean message_centered; // center messages
extern boolean message_colorized; // colorize player messages

View File

@ -3360,6 +3360,7 @@ enum {
stat2_crispyhud,
stat2_hudfont,
stat2_widescreen,
stat2_threelined,
stat2_bargraphs,
};
@ -3411,6 +3412,7 @@ setup_menu_t stat_settings2[] =
{"PREFER CRISPY HUD OVER BOOM HUD" ,S_YESNO ,m_null,M_X,M_Y+stat2_crispyhud*M_SPC, {"crispy_hud"}},
{"USE STANDARD DOOM FONT FOR WIDGETS", S_CHOICE,m_null,M_X,M_Y+stat2_hudfont*M_SPC, {"hud_widget_font"}, 0, NULL, show_widgets_strings},
{"WIDESCREEN WIDGET ARRANGEMENT", S_YESNO,m_null,M_X,M_Y+stat2_widescreen*M_SPC, {"hud_widescreen_widgets"}},
{"3-LINED COORDS/STATS WIDGETS", S_YESNO,m_null,M_X,M_Y+stat2_threelined*M_SPC, {"hud_threelined_widgets"}},
{"DRAW BAR GRAPHS IN WIDGETS", S_YESNO,m_null,M_X,M_Y+stat2_bargraphs*M_SPC, {"hud_draw_bargraphs"}},
{"<- PREV" ,S_SKIP|S_PREV,m_null,M_X_PREV,M_Y_PREVNEXT, {stat_settings1}},

View File

@ -2685,6 +2685,13 @@ default_t defaults[] = {
"draw bar graphs in Boom widgets"
},
{
"hud_threelined_widgets",
(config_t *) &hud_threelined_widgets, NULL,
{0}, {0,1}, number, ss_stat, wad_no,
"draw three-lined coords and stats widgets"
},
{
"hud_crosshair",
(config_t *) &hud_crosshair, NULL,