fix: crash with hl25 structs on xash3d again

fix: %t placeholder should return damage inflictor when used in team attack section of chat
fix: all arguments in bot commands are lowercased (resolves #680)
bot: disable threads when engine's timescale is active
bot: a little refactor for the code all over the places
linkage: resolved crash due to sse alignment on ancient engines (resolves #614)
utils move wave parse into crlib
practice: move loading practice to thread pool
build: allow to build with static linkents instead of hooking dlsym

Co-Authored-By: Max <161382234+dyspose@users.noreply.github.com>
This commit is contained in:
jeefo 2025-03-16 18:25:15 +03:00
commit 38c45aff9a
No known key found for this signature in database
GPG key ID: D696786B81B667C8
37 changed files with 348 additions and 304 deletions

View file

@ -248,10 +248,10 @@ void BotConfig::loadChatterConfig () {
m_chatter.clear ();
struct EventMap {
String str;
int code;
float repeat;
static constexpr struct EventMap {
StringRef name {};
int code {};
float repeat {};
} chatterEventMap[] = {
{ "Radio_CoverMe", Radio::CoverMe, kMaxChatterRepeatInterval },
{ "Radio_YouTakePoint", Radio::YouTakeThePoint, kMaxChatterRepeatInterval },
@ -361,18 +361,21 @@ void BotConfig::loadChatterConfig () {
items[1].trim ("(;)");
for (const auto &event : chatterEventMap) {
if (event.str == items.first ()) {
if (event.name == items.first ().chars ()) {
// this does common work of parsing comma-separated chatter line
auto sentences = items[1].split (",");
sentences.shuffle ();
for (auto &sound : sentences) {
sound.trim ().trim ("\"");
const auto duration = util.getWaveLength (sound.chars ());
const auto duration = util.getWaveFileDuration (sound.chars ());
if (duration > 0.0f) {
m_chatter[event.code].emplace (cr::move (sound), event.repeat, duration);
}
else {
game.print ("Warning: Couldn't get duration of sound '%s.wav.", sound);
}
}
sentences.clear ();
}
@ -383,7 +386,12 @@ void BotConfig::loadChatterConfig () {
}
else {
cv_radio_mode.set (1);
game.print ("Bots chatter communication disabled.");
// only notify if has bot voice, but failed to open file
if (game.is (GameFlags::HasBotVoice)) {
game.print ("Bots chatter communication disabled.");
}
}
}