[PlayerName] Fix format

This commit is contained in:
Diavolo 2022-07-08 18:42:09 +02:00
parent a0c1e4e464
commit 2a21f754e0
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5

View File

@ -2,57 +2,57 @@
namespace Components
{
Dvar::Var PlayerName::sv_allowColoredNames;
Dvar::Var PlayerName::sv_allowColoredNames;
void PlayerName::UserInfoCopy(char* buffer, const char* name, const size_t size)
{
if (!sv_allowColoredNames.get<bool>())
{
char nameBuffer[64] = {0};
TextRenderer::StripColors(name, nameBuffer, sizeof(nameBuffer));
TextRenderer::StripAllTextIcons(nameBuffer, buffer, size);
}
else
{
TextRenderer::StripAllTextIcons(name, buffer, size);
}
void PlayerName::UserInfoCopy(char* buffer, const char* name, const size_t size)
{
if (!sv_allowColoredNames.get<bool>())
{
char nameBuffer[64] = {0};
TextRenderer::StripColors(name, nameBuffer, sizeof(nameBuffer));
TextRenderer::StripAllTextIcons(nameBuffer, buffer, size);
}
else
{
TextRenderer::StripAllTextIcons(name, buffer, size);
}
std::string readablePlayerName(buffer);
readablePlayerName = Utils::String::Trim(readablePlayerName);
std::string readablePlayerName(buffer);
readablePlayerName = Utils::String::Trim(readablePlayerName);
if (readablePlayerName.size() < 3)
{
strncpy(buffer, "Unknown Soldier", size);
}
}
if (readablePlayerName.size() < 3)
{
strncpy(buffer, "Unknown Soldier", size);
}
}
__declspec(naked) void PlayerName::ClientCleanName()
{
__asm
{
mov eax, [esp + 4h] // length
__declspec(naked) void PlayerName::ClientCleanName()
{
__asm
{
mov eax, [esp + 4h] // length
push eax
push eax
push ecx // name
push edx // buffer
push ecx // name
push edx // buffer
call UserInfoCopy
call UserInfoCopy
add esp, 0Ch
retn
}
}
add esp, 0Ch
retn
}
}
char* PlayerName::GetClientName(int localClientNum, int index, char* buf, size_t size)
{
Game::CL_GetClientName(localClientNum, index, buf, size);
char* PlayerName::GetClientName(int localClientNum, int index, char* buf, size_t size)
{
Game::CL_GetClientName(localClientNum, index, buf, size);
// Append clantag to username & remove the colors
strncpy_s(buf, size, TextRenderer::StripColors(ClanTags::GetUserClantag(index, buf)).data(), size);
// Append clantag to username & remove the colors
strncpy_s(buf, size, TextRenderer::StripColors(ClanTags::GetUserClantag(index, buf)).data(), size);
return buf;
}
return buf;
}
char* PlayerName::CleanStrStub(char* string)
{