diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 11dc06460..f7fa62746 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -127,6 +127,7 @@ Version 1.5.0 (Trillium): Not yet released - Load levels with very large face counts or many level sounds much faster [@is-this-c](https://github.com/is-this-c) +- Add `bighud_health` and `bighud_ammo` console variables to disable `bighud` for health and ammo, which is useful for mods incompatible with `bighud` - Render `LOADING...` upon level changes in multi - Support TrueType fonts in 3D text rendering - Render world HUD text (player labels, damage numbers, ping labels, countdowns) in 3D for smooth sub-pixel motion diff --git a/game_patch/hud/hud.cpp b/game_patch/hud/hud.cpp index a11cbb030..b8f00b872 100644 --- a/game_patch/hud/hud.cpp +++ b/game_patch/hud/hud.cpp @@ -157,7 +157,7 @@ static bool is_screen_resolution_too_low_for_big_hud() void set_big_hud(bool is_big) { - hud_status_set_big(is_big); + hud_status_set_big(is_big && g_alpine_game_config.big_hud_health); multi_hud_chat_set_big(is_big); hud_personas_set_big(is_big); weapon_select_set_big(is_big); @@ -167,7 +167,7 @@ void set_big_hud(bool is_big) g_target_player_name_font = hud_get_default_font(); hud_setup_positions(rf::gr::screen_width()); - hud_weapons_set_big(is_big); + hud_weapons_set_big(is_big && g_alpine_game_config.big_hud_ammo); set_big_countdown_counter(is_big); // TODO: Message Log - Note: it remembers text height in save files so method of recalculation is needed @@ -189,6 +189,48 @@ ConsoleCommand2 bighud_cmd{ "bighud", }; +ConsoleCommand2 bighud_health_cmd{ + "bighud_health", + [] (const std::optional enabled) { + g_alpine_game_config.big_hud_health = + enabled.value_or(!g_alpine_game_config.big_hud_health); + set_big_hud(g_alpine_game_config.big_hud); + if (!g_alpine_game_config.big_hud && g_alpine_game_config.big_hud_health) { + rf::console::print( + "Big HUD health is enabled but ignored, because big HUD is disabled" + ); + } else { + rf::console::print( + "Big HUD health is {}", + g_alpine_game_config.big_hud_health ? "enabled" : "disabled" + ); + } + }, + "Toggle big HUD for health", + "bighud_health", +}; + +ConsoleCommand2 bighud_ammo_cmd{ + "bighud_ammo", + [] (const std::optional enabled) { + g_alpine_game_config.big_hud_ammo = + enabled.value_or(!g_alpine_game_config.big_hud_ammo); + set_big_hud(g_alpine_game_config.big_hud); + if (!g_alpine_game_config.big_hud && g_alpine_game_config.big_hud_ammo) { + rf::console::print( + "Big HUD ammo is enabled but ignored, because big HUD is disabled" + ); + } else { + rf::console::print( + "Big HUD ammo is {}", + g_alpine_game_config.big_hud_ammo ? "enabled" : "disabled" + ); + } + }, + "Toggle big HUD for ammo", + "bighud_ammo", +}; + ConsoleCommand2 ui_realarmor_cmd{ "ui_realarmor", []() { @@ -462,6 +504,8 @@ void hud_apply_patches() // Other commands bighud_cmd.register_cmd(); + bighud_health_cmd.register_cmd(); + bighud_ammo_cmd.register_cmd(); ui_realarmor_cmd.register_cmd(); #ifndef NDEBUG hud_coords_cmd.register_cmd(); diff --git a/game_patch/misc/alpine_settings.cpp b/game_patch/misc/alpine_settings.cpp index f93b51def..cd33fba42 100644 --- a/game_patch/misc/alpine_settings.cpp +++ b/game_patch/misc/alpine_settings.cpp @@ -742,6 +742,14 @@ bool alpine_player_settings_load(rf::Player* player) } // Load UI settings + if (settings.count("BigHUDHealth")) { + g_alpine_game_config.big_hud_health = std::stoi(settings["BigHUDHealth"]); + processed_keys.insert("BigHUDHealth"); + } + if (settings.count("BigHUDAmmo")) { + g_alpine_game_config.big_hud_ammo = std::stoi(settings["BigHUDAmmo"]); + processed_keys.insert("BigHUDAmmo"); + } if (settings.count("BigHUD")) { g_alpine_game_config.big_hud = std::stoi(settings["BigHUD"]); set_big_hud(g_alpine_game_config.big_hud); @@ -1648,6 +1656,8 @@ void alpine_player_settings_save(rf::Player* player) // UI file << "\n[UISettings]\n"; file << "BigHUD=" << g_alpine_game_config.big_hud << "\n"; + file << "BigHUDHealth=" << g_alpine_game_config.big_hud_health << "\n"; + file << "BigHUDAmmo=" << g_alpine_game_config.big_hud_ammo << "\n"; if (g_alpine_game_config.sniper_scope_color_override) { file << "SniperScopeColor=" << format_hex_color_string(*g_alpine_game_config.sniper_scope_color_override) << "\n"; } diff --git a/game_patch/misc/alpine_settings.h b/game_patch/misc/alpine_settings.h index 6f95d7f8b..6afee7d80 100644 --- a/game_patch/misc/alpine_settings.h +++ b/game_patch/misc/alpine_settings.h @@ -85,6 +85,8 @@ struct AlpineGameSettings bool mouse_linear_pitch = true; int mouse_scale = 0; // 0=Classic (RF native), 1=Raw (pure degrees), 2=Modern (id Tech/Source 0.022 deg/pixel) bool big_hud = false; + bool big_hud_health = true; + bool big_hud_ammo = true; int skip_cutscene_bind_alias = -1; bool try_disable_weapon_shake = false; bool try_fullbright_characters = false;