mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 21:38:39 -04:00
fix use-button timer widget (#2206)
* fix use-button timer widget * decrease timer even if the widget is not visible * show use button timer widget even if level time widget is not visible Fixes #2204 * move "Show Use-Button Timer" back to "Widget Types" section
This commit is contained in:
parent
0f2363c19d
commit
a629f57a83
@ -1864,7 +1864,6 @@ static setup_menu_t stat_settings1[] = {
|
||||
};
|
||||
|
||||
static void UpdateStatsFormatItem(void);
|
||||
static void UpdateUseButtonItem(void);
|
||||
|
||||
static const char *show_widgets_strings[] = {"Off", "Automap", "HUD", "Always"};
|
||||
static const char *show_adv_widgets_strings[] = {"Off", "Automap", "HUD",
|
||||
@ -1882,7 +1881,7 @@ static setup_menu_t stat_settings2[] = {
|
||||
.strings_id = str_show_widgets, .action = UpdateStatsFormatItem},
|
||||
|
||||
{"Show Level Time", S_CHOICE, H_X, M_SPC, {"hud_level_time"},
|
||||
.strings_id = str_show_widgets, .action = UpdateUseButtonItem},
|
||||
.strings_id = str_show_widgets},
|
||||
|
||||
{"Show Player Coords", S_CHOICE | S_STRICT, H_X, M_SPC,
|
||||
{"hud_player_coords"}, .strings_id = str_show_adv_widgets},
|
||||
@ -1890,6 +1889,8 @@ static setup_menu_t stat_settings2[] = {
|
||||
{"Show Command History", S_ONOFF | S_STRICT, H_X, M_SPC,
|
||||
{"hud_command_history"}, .action = HU_ResetCommandHistory},
|
||||
|
||||
{"Show Use-Button Timer", S_ONOFF, H_X, M_SPC, {"hud_time_use"}},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Widget Appearance", S_SKIP | S_TITLE, H_X, M_SPC},
|
||||
@ -1900,8 +1901,6 @@ static setup_menu_t stat_settings2[] = {
|
||||
{"Level Stats Format", S_CHOICE, H_X, M_SPC, {"hud_stats_format"},
|
||||
.strings_id = str_stats_format},
|
||||
|
||||
{"Use-Button Timer", S_ONOFF, H_X, M_SPC, {"hud_time_use"}},
|
||||
|
||||
MI_END
|
||||
};
|
||||
|
||||
@ -1962,11 +1961,6 @@ static void UpdateStatsFormatItem(void)
|
||||
DisableItem(!hud_level_stats, stat_settings2, "hud_stats_format");
|
||||
}
|
||||
|
||||
static void UpdateUseButtonItem(void)
|
||||
{
|
||||
DisableItem(!hud_level_time, stat_settings2, "hud_time_use");
|
||||
}
|
||||
|
||||
static void UpdateCrosshairItems(void)
|
||||
{
|
||||
DisableItem(!hud_crosshair, stat_settings3, "hud_crosshair_health");
|
||||
@ -4953,7 +4947,6 @@ void MN_SetupResetMenu(void)
|
||||
DisableItem(M_ParmExists("-save"), gen_settings6, "organize_savefiles");
|
||||
UpdateInterceptsEmuItem();
|
||||
UpdateStatsFormatItem();
|
||||
UpdateUseButtonItem();
|
||||
UpdateCrosshairItems();
|
||||
UpdateCenteredWeaponItem();
|
||||
UpdateGamepadItems();
|
||||
|
@ -509,7 +509,7 @@ void P_PlayerThink (player_t* player)
|
||||
{
|
||||
// to match the timer, we use the leveltime value at the end of the frame
|
||||
player->btuse = leveltime + 1;
|
||||
player->btuse_tics = 5*TICRATE/2; // [crispy] 2.5 seconds
|
||||
player->btuse_tics = 5*TICRATE/2 + 1; // [crispy] 2.5 seconds
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -522,6 +522,9 @@ void P_PlayerThink (player_t* player)
|
||||
|
||||
// Counters, time dependent power ups.
|
||||
|
||||
if (player->btuse_tics > 0)
|
||||
player->btuse_tics--;
|
||||
|
||||
// Strength counts up to diminish fade.
|
||||
|
||||
if (player->powers[pw_strength])
|
||||
|
@ -936,7 +936,7 @@ static void UpdateStTime(sbe_widget_t *widget, player_t *player)
|
||||
{
|
||||
ST_ClearLines(widget);
|
||||
|
||||
if (!WidgetEnabled(hud_level_time))
|
||||
if (!WidgetEnabled(hud_level_time) && !player->btuse_tics)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -947,40 +947,42 @@ static void UpdateStTime(sbe_widget_t *widget, player_t *player)
|
||||
|
||||
int offset = 0;
|
||||
|
||||
if (time_scale != 100)
|
||||
if (WidgetEnabled(hud_level_time))
|
||||
{
|
||||
offset +=
|
||||
M_snprintf(string, sizeof(string), "%s%d%% ",
|
||||
(widget->font == stcfnt) ? BLUE2_S : BLUE1_S, time_scale);
|
||||
if (time_scale != 100)
|
||||
{
|
||||
offset +=
|
||||
M_snprintf(string, sizeof(string), "%s%d%% ",
|
||||
(widget->font == stcfnt) ? BLUE2_S : BLUE1_S, time_scale);
|
||||
}
|
||||
|
||||
if (levelTimer == true)
|
||||
{
|
||||
const int time = levelTimeCount / TICRATE;
|
||||
|
||||
offset += M_snprintf(string + offset, sizeof(string) - offset,
|
||||
BROWN_S "%d:%02d ", time / 60, time % 60);
|
||||
}
|
||||
else if (totalleveltimes)
|
||||
{
|
||||
const int time = (totalleveltimes + leveltime) / TICRATE;
|
||||
|
||||
offset += M_snprintf(string + offset, sizeof(string) - offset,
|
||||
GREEN_S "%d:%02d ", time / 60, time % 60);
|
||||
}
|
||||
}
|
||||
|
||||
if (levelTimer == true)
|
||||
{
|
||||
const int time = levelTimeCount / TICRATE;
|
||||
|
||||
offset += M_snprintf(string + offset, sizeof(string) - offset,
|
||||
BROWN_S "%d:%02d ", time / 60, time % 60);
|
||||
}
|
||||
else if (totalleveltimes)
|
||||
{
|
||||
const int time = (totalleveltimes + leveltime) / TICRATE;
|
||||
|
||||
offset += M_snprintf(string + offset, sizeof(string) - offset,
|
||||
GREEN_S "%d:%02d ", time / 60, time % 60);
|
||||
}
|
||||
|
||||
if (!player->btuse_tics)
|
||||
{
|
||||
M_snprintf(string + offset, sizeof(string) - offset,
|
||||
GRAY_S "%d:%05.2f\t", leveltime / TICRATE / 60,
|
||||
(float)(leveltime % (60 * TICRATE)) / TICRATE);
|
||||
}
|
||||
else
|
||||
if (player->btuse_tics)
|
||||
{
|
||||
M_snprintf(string + offset, sizeof(string) - offset,
|
||||
GOLD_S "U %d:%05.2f\t", player->btuse / TICRATE / 60,
|
||||
(float)(player->btuse % (60 * TICRATE)) / TICRATE);
|
||||
player->btuse_tics--;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_snprintf(string + offset, sizeof(string) - offset,
|
||||
GRAY_S "%d:%05.2f\t", leveltime / TICRATE / 60,
|
||||
(float)(leveltime % (60 * TICRATE)) / TICRATE);
|
||||
}
|
||||
|
||||
ST_AddLine(widget, string);
|
||||
|
Loading…
x
Reference in New Issue
Block a user