Skip to content

Commit

Permalink
Merge branch 'rafalh:master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
is-this-c authored Nov 26, 2024
2 parents 59851be + 5dfb486 commit 7df4d1b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions game_patch/multi/multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <winsock2.h>
#include <patch_common/FunHook.h>
#include <patch_common/CodeInjection.h>
#include <patch_common/AsmWriter.h>
#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"
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 4 additions & 0 deletions game_patch/multi/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:")) {
Expand Down
1 change: 1 addition & 0 deletions game_patch/multi/server_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct ServerAdditionalConfig
int spawn_protection_duration_ms = 1500;
std::optional<float> spawn_life;
std::optional<float> spawn_armor;
int ctf_flag_return_time_ms = 25000;
HitSoundsConfig hit_sounds;
std::map<std::string, std::string> item_replacements;
std::string default_player_weapon;
Expand Down

0 comments on commit 7df4d1b

Please sign in to comment.