From 5e05220444ce0742c80fd5c22df6879d4250b03c Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Fri, 8 May 2015 18:50:38 +0300 Subject: [PATCH] Host say format and localize bug fix --- rehlds/engine/host_cmd.cpp | 14 ++++++++++++++ rehlds/rehlds/precompiled.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index db6634d..769d13b 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -2550,7 +2550,12 @@ void Host_Say(qboolean teamonly) p[Q_strlen(p) - 1] = 0; } +#ifdef REHLDS_FIXES + // I think '\x01' don't need in TextMsg + Q_snprintf(text, sizeof(text), "<%s> ", Cvar_VariableString("hostname")); +#else // REHLDS_FIXES Q_snprintf(text, sizeof(text), "%c<%s> ", 1, Cvar_VariableString("hostname")); +#endif // REHLDS_FIXES if (Q_strlen(p) > 63) p[63] = 0; @@ -2569,10 +2574,19 @@ void Host_Say(qboolean teamonly) host_client = client; +#ifdef REHLDS_FIXES + // Text can be unsafe (format %, localize #) therefore need to send text as argument. TextMsg is used here instead of SayText, because SayText in Half-Life doesn't support arguments. + PF_MessageBegin_I(MSG_ONE, RegUserMsg("TextMsg", -1), NULL, &g_psv.edicts[j + 1]); + PF_WriteByte_I(HUD_PRINTTALK); + PF_WriteString_I("%s"); + PF_WriteString_I(text); + PF_MessageEnd_I(); +#else // REHLDS_FIXES PF_MessageBegin_I(MSG_ONE, RegUserMsg("SayText", -1), NULL, &g_psv.edicts[j + 1]); PF_WriteByte_I(0); PF_WriteString_I(text); PF_MessageEnd_I(); +#endif // REHLDS_FIXES } host_client = save; diff --git a/rehlds/rehlds/precompiled.h b/rehlds/rehlds/precompiled.h index 27e532d..870a216 100644 --- a/rehlds/rehlds/precompiled.h +++ b/rehlds/rehlds/precompiled.h @@ -49,3 +49,5 @@ #include "rehlds_api_impl.h" #include "FlightRecorderImpl.h" #include "flight_recorder.h" + +#include "dlls/cdll_dll.h"