diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7f5d1fc43..6fce1a63b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,6 +9,9 @@ Version 1.5.0 (TBD): Not yet released [@GooberRF](https://github.com/GooberRF) - Restore cut first person weapon aim sway, toggleable with `cl_weaponsway` +[@nickalreadyinuse](https://github.com/nickalreadyinuse) +- Add `ui_color_console` console command to set the console background color + ### Bug fixes Version 1.4.0 (Lupin): Released Aug-25-2026 diff --git a/game_patch/hud/hud_colors.cpp b/game_patch/hud/hud_colors.cpp index b7c059116..a27edfdcf 100644 --- a/game_patch/hud/hud_colors.cpp +++ b/game_patch/hud/hud_colors.cpp @@ -338,6 +338,17 @@ ConsoleCommand2 r_outlines_color_team_cmd{ "r_outlines_color_team ", }; +ConsoleCommand2 console_color_cmd{ + "ui_color_console", + [](std::optional color_opt) { + handle_required_color_command(color_opt, "Console background color", g_alpine_game_config.console_color, + AlpineGameSettings::default_console_color); + apply_console_color_setting(); + }, + "Set the console background color", + "ui_color_console ", +}; + void hud_colors_apply_patch() { sniper_scope_color_cmd.register_cmd(); @@ -357,4 +368,5 @@ void hud_colors_apply_patch() r_outlines_color_team_b_cmd.register_cmd(); r_outlines_color_enemy_cmd.register_cmd(); r_outlines_color_team_cmd.register_cmd(); + console_color_cmd.register_cmd(); } diff --git a/game_patch/misc/alpine_settings.cpp b/game_patch/misc/alpine_settings.cpp index 87ef43d2a..ecf244751 100644 --- a/game_patch/misc/alpine_settings.cpp +++ b/game_patch/misc/alpine_settings.cpp @@ -406,6 +406,14 @@ bool alpine_player_settings_load(rf::Player* player) apply_console_history_setting(); processed_keys.insert("SaveConsoleHistory"); } + if (settings.count("ConsoleColor")) { + auto c = parse_hex_color_string(settings["ConsoleColor"]); + if (c) { + g_alpine_game_config.console_color = *c; + apply_console_color_setting(); + } + processed_keys.insert("ConsoleColor"); + } if (settings.count("AlpineBranding")) { g_alpine_game_config.af_branding = std::stoi(settings["AlpineBranding"]); processed_keys.insert("AlpineBranding"); @@ -1417,6 +1425,7 @@ void alpine_player_settings_save(rf::Player* player) file << "ShowSpeed=" << g_alpine_game_config.speed_display << "\n"; file << "FPSCounterAverageMs=" << g_alpine_game_config.fps_counter_average_ms << "\n"; file << "SaveConsoleHistory=" << g_alpine_game_config.save_console_history << "\n"; + file << "ConsoleColor=" << format_hex_color_string(g_alpine_game_config.console_color) << "\n"; file << "AlpineBranding=" << g_alpine_game_config.af_branding << "\n"; file << "SeasonalEffect=" << g_alpine_game_config.seasonal_effect << "\n"; file << "RealArmorValues=" << g_alpine_game_config.real_armor_values << "\n"; diff --git a/game_patch/misc/alpine_settings.h b/game_patch/misc/alpine_settings.h index f1ce64878..aafe4b6c9 100644 --- a/game_patch/misc/alpine_settings.h +++ b/game_patch/misc/alpine_settings.h @@ -167,6 +167,8 @@ struct AlpineGameSettings bool spectate_show_camera_meshes = true; // draw camera meshes in free look bool spectate_povcomp = true; // delay other players to match what the spectated player saw bool save_console_history = false; // checked before config loaded, must be false here + static constexpr uint32_t default_console_color = 0x274E69C0; // RRGGBBAA + uint32_t console_color = default_console_color; bool screen_shake_force_off = false; bool display_target_player_names = true; bool verbose_time_left_display = true; @@ -457,6 +459,7 @@ void update_scanner_sensitivity(); void recalc_mesh_static_lighting(); void apply_show_enemy_bullets(); void apply_console_history_setting(); +void apply_console_color_setting(); void build_time_left_string_format(); void gr_update_texture_filtering(); void set_play_sound_events_volume_scale(); diff --git a/game_patch/os/console.cpp b/game_patch/os/console.cpp index 0f3cf4cc8..ad5033fd1 100644 --- a/game_patch/os/console.cpp +++ b/game_patch/os/console.cpp @@ -332,6 +332,15 @@ void apply_console_history_setting() { rf::console::console_keep_history = g_alpine_game_config.save_console_history; } +void apply_console_color_setting() { + auto [r, g, b, a] = extract_color_components(g_alpine_game_config.console_color); + write_mem(0x005098D1, a); + write_mem(0x005098D6, b); + write_mem(0x005098D8, g); + write_mem(0x005098DA, r); + rf::console::background_color.set(r, g, b, a); +} + extern void console_commands_apply_patches(); extern void console_auto_complete_apply_patches(); extern void console_commands_init(); @@ -342,11 +351,7 @@ void console_apply_patches() write_mem_ptr(0x004B2534, "-- " PRODUCT_NAME " Initializing --\n"); // Console background color - constexpr rf::Color console_color{0x27, 0x4E, 0x69, 0xC0}; - write_mem(0x005098D1, console_color.alpha); - write_mem(0x005098D6, console_color.blue); - write_mem(0x005098D8, console_color.green); - write_mem(0x005098DA, console_color.red); + apply_console_color_setting(); // Support unsigned hexadecimal arguments. AsmWriter{0x0050B0B0}.call(std::strtoul); diff --git a/game_patch/rf/os/console.h b/game_patch/rf/os/console.h index 2677862ec..1970509a1 100644 --- a/game_patch/rf/os/console.h +++ b/game_patch/rf/os/console.h @@ -85,4 +85,5 @@ namespace rf::console static auto& history_max_index = addr_as_ref(0x005A4030); static auto& console_is_visible = addr_as_ref(0x0050B520); static auto& console_keep_history = addr_as_ref(0x005A402C); + static auto& background_color = addr_as_ref(0x017751DC); }