diff --git a/README.md b/README.md index d6efb542..617be6d4 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,8 @@ Configuration example: $DF Spawn Health: 100 // Initial player armor after spawn $DF Spawn Armor: 0 + // Time before a dropped CTF flag will return to base in ms (default is same as stock RF - 25000) + $DF CTF Flag Return Time: 25000 // Enable hit-sounds $DF Hitsounds: true // Sound used for hit notification diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3509326e..ffec0d8b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,6 +45,7 @@ Version 1.9.0 (not released yet) - Fix crash when `verify_level` command is run without a level being loaded - Fix cockpit not rendering for any jeeps after the first one entered each level load - Add `server_password` command +- Add `$DF CTF Flag Return Time` option in dedicated server config [@is-this-c](https://github.com/is-this-c) - Support `©` in TrueType fonts diff --git a/game_patch/multi/multi.cpp b/game_patch/multi/multi.cpp index 9742e0f0..1d6bd444 100644 --- a/game_patch/multi/multi.cpp +++ b/game_patch/multi/multi.cpp @@ -3,8 +3,10 @@ #include #include #include +#include #include "multi.h" #include "multi_private.h" +#include "server_internal.h" #include "../misc/misc.h" #include "../rf/os/os.h" #include "../rf/os/timer.h" @@ -335,6 +337,10 @@ void multi_do_patch() multi_limbo_init.install(); multi_start_injection.install(); + // Allow server to customize dropped flag return timer in ms + AsmWriter{0x00473B88}.push(g_additional_server_config.ctf_flag_return_time_ms); // blue flag + AsmWriter{0x00473B28}.push(g_additional_server_config.ctf_flag_return_time_ms); // red flag + // Fix CTF flag not returning to the base if the other flag was returned when the first one was waiting ctf_flag_return_fix.install(); diff --git a/game_patch/multi/server.cpp b/game_patch/multi/server.cpp index d63dd608..56ce6ca5 100644 --- a/game_patch/multi/server.cpp +++ b/game_patch/multi/server.cpp @@ -87,6 +87,10 @@ void load_additional_server_config(rf::Parser& parser) g_additional_server_config.spawn_armor = {parser.parse_float()}; } + if (parser.parse_optional("$DF CTF Flag Return Time:")) { + g_additional_server_config.ctf_flag_return_time_ms = parser.parse_int(); + } + if (parser.parse_optional("$DF Hitsounds:")) { g_additional_server_config.hit_sounds.enabled = parser.parse_bool(); if (parser.parse_optional("+Sound ID:")) { diff --git a/game_patch/multi/server_internal.h b/game_patch/multi/server_internal.h index 71317375..161eb770 100644 --- a/game_patch/multi/server_internal.h +++ b/game_patch/multi/server_internal.h @@ -37,6 +37,7 @@ struct ServerAdditionalConfig int spawn_protection_duration_ms = 1500; std::optional spawn_life; std::optional spawn_armor; + int ctf_flag_return_time_ms = 25000; HitSoundsConfig hit_sounds; std::map item_replacements; std::string default_player_weapon;