Strip material text icons from chat messages

This commit is contained in:
Jan 2021-08-20 18:36:36 +02:00
parent e84e0774a6
commit a7a8207a34
2 changed files with 27 additions and 0 deletions

View File

@ -76,6 +76,29 @@ namespace Components
}
}
void Dedicated::StripMaterialTextIcons(char* text)
{
char* currentChar = text;
bool isEscaped = false;
while (*currentChar)
{
if (*currentChar == '^')
{
isEscaped = true;
}
else if(isEscaped == true && (*currentChar == '\x01' || *currentChar == '\x02'))
{
*currentChar = ' ';
}
else
{
isEscaped = false;
}
currentChar++;
}
}
const char* Dedicated::EvaluateSay(char* text, Game::gentity_t* player)
{
Dedicated::SendChat = true;
@ -87,6 +110,8 @@ namespace Components
++text;
}
StripMaterialTextIcons(text);
Game::Scr_AddEntity(player);
Game::Scr_AddString(text + 1);
Game::Scr_NotifyLevel(Game::SL_GetString("say", 0), 2);

View File

@ -14,6 +14,8 @@ namespace Components
static void Heartbeat();
static void StripMaterialTextIcons(char* text);
private:
static bool SendChat;