Open SmileyAG opened 2 years ago
There's also a version with color code support. https://github.com/tmp64/BugfixedHL-Rebased/blob/master/src/game/client/hud/message.cpp
Q_UTF8ToWString
may be replaced with this:
wchar_t wTextBuf[MAX_MESSAGE_TEXT_LENGTH];
#ifdef _WIN32
// std::mbsrtowcs doesn't use UTF-8 on Windows
MultiByteToWideChar(CP_UTF8, 0, pString, -1, wTextBuf, MAX_MESSAGE_TEXT_LENGTH);
#else
// Assume std::mbsrtowcs uses UTF-8 for multi-byte. That's what the engine does.
const char *strPtr = pString;
std::mbstate_t state = std::mbstate_t();
std::mbsrtowcs(wTextBuf, &strPtr, MAX_MESSAGE_TEXT_LENGTH, &state);
#endif
Before you say something, yes, it's possible to implement without serverside changes.
There is exist a source code of 10+ years old BugfixedHL which had a fixed drawing of UTF-8 characters for text messages (like
env_message
or title chapters), so there not should be issues with implementation. So, I might be do it later if I'll not forget about that.