diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 71e1630e..dade1ca7 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -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); diff --git a/src/Components/Modules/Dedicated.hpp b/src/Components/Modules/Dedicated.hpp index 002d28bb..0b362465 100644 --- a/src/Components/Modules/Dedicated.hpp +++ b/src/Components/Modules/Dedicated.hpp @@ -14,6 +14,8 @@ namespace Components static void Heartbeat(); + static void StripMaterialTextIcons(char* text); + private: static bool SendChat; diff --git a/src/Components/Modules/Materials.cpp b/src/Components/Modules/Materials.cpp index 79d70a12..5b53c434 100644 --- a/src/Components/Modules/Materials.cpp +++ b/src/Components/Modules/Materials.cpp @@ -161,7 +161,12 @@ namespace Components Materials::ImageNameLength = 4 + length; std::string image(imagePtr, length); - return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, image.data()).material; + auto* material = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, image.data()).material; + + if(material == nullptr || material->techniqueSet == nullptr || material->techniqueSet->name == nullptr || strcmp(material->techniqueSet->name, "2d") != 0) + return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material; + + return material; } Materials::ImageNameLength = 4; diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index 823e326d..3f181de4 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -469,6 +469,11 @@ namespace Components server.ping = (Game::Sys_Milliseconds() - i->sendTime); server.addr = address; + Dedicated::StripMaterialTextIcons(server.hostname.data()); + Dedicated::StripMaterialTextIcons(server.mapname.data()); + Dedicated::StripMaterialTextIcons(server.gametype.data()); + Dedicated::StripMaterialTextIcons(server.mod.data()); + // Remove server from queue i = ServerList::RefreshContainer.servers.erase(i);