[Debug] Cool font test feature
This commit is contained in:
parent
323021af5d
commit
d8a453d34d
@ -91,6 +91,16 @@ namespace Components
|
||||
"EF_SOFT",
|
||||
};
|
||||
|
||||
const char Debug::strButtons[] =
|
||||
{
|
||||
'\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x0E', '\x0F', '\x10',
|
||||
'\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\0'
|
||||
};
|
||||
|
||||
const char Debug::strTemplate[] = "%s: %s All those moments will be lost in time, like tears in rain.";
|
||||
|
||||
const float Debug::colorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
std::string Debug::BuildPMFlagsString(const Game::playerState_s* ps)
|
||||
{
|
||||
std::string result;
|
||||
@ -145,7 +155,6 @@ namespace Components
|
||||
auto* const scrPlace = Game::ScrPlace_GetActivePlacement(localClientNum);
|
||||
|
||||
constexpr auto maxChars = 4096;
|
||||
constexpr float colorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
auto* const font1 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE_2);
|
||||
auto* const font2 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE2);
|
||||
@ -154,16 +163,16 @@ namespace Components
|
||||
MY_SCALE2, colorWhite, 1);
|
||||
|
||||
const auto pmf = BuildPMFlagsString(&cgameGlob->predictedPlayerState);
|
||||
Game::UI_DrawText(scrPlace, pmf.data(), maxChars, font1, 30.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
Game::UI_DrawText(scrPlace, pmf.data(), maxChars, font1, 30.0f, MY_Y, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
|
||||
const auto pof = BuildPOFlagsString(&cgameGlob->predictedPlayerState);
|
||||
Game::UI_DrawText(scrPlace, pof.data(), maxChars, font1, 350.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
Game::UI_DrawText(scrPlace, pof.data(), maxChars, font1, 350.0f, MY_Y, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
|
||||
const auto plf = BuildPLFlagsString(&cgameGlob->predictedPlayerState);
|
||||
Game::UI_DrawText(scrPlace, plf.data(), maxChars, font1, 350.0f, 250.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
|
||||
const auto pef = BuildPEFlagsString(&cgameGlob->predictedPlayerState);
|
||||
Game::UI_DrawText(scrPlace, pef.data(), maxChars, font1, 525.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
Game::UI_DrawText(scrPlace, pef.data(), maxChars, font1, 525.0f, MY_Y, 1, 1, MY_SCALE_2, colorWhite, 3);
|
||||
}
|
||||
|
||||
void Debug::CG_DrawDebugPlayerHealth(const int localClientNum)
|
||||
@ -197,6 +206,39 @@ namespace Components
|
||||
Game::CL_DrawStretchPic(scrPlace, 10.0f, 10.0f, 100.0f * healtha, 10.0f, 1, 1, 0.0f, 0.0f, healtha, 1.0f, color2, *Game::whiteMaterial);
|
||||
}
|
||||
|
||||
void Debug::CG_Debug_DrawFontTest(const int localClientNum)
|
||||
{
|
||||
char strFinal[0x200]{};
|
||||
|
||||
auto* const scrPlace = Game::ScrPlace_GetActivePlacement(localClientNum);
|
||||
|
||||
auto* const font1 = Game::UI_GetFontHandle(scrPlace, 1, 0.4f);
|
||||
auto* const font2 = Game::UI_GetFontHandle(scrPlace, 2, 0.4f);
|
||||
auto* const font3 = Game::UI_GetFontHandle(scrPlace, 3, 0.4f);
|
||||
auto* const font5 = Game::UI_GetFontHandle(scrPlace, 5, 0.4f);
|
||||
auto* const font6 = Game::UI_GetFontHandle(scrPlace, 6, 0.4f);
|
||||
|
||||
sprintf_s(strFinal, strTemplate, font1->fontName, strButtons);
|
||||
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
|
||||
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font1, MY_X, 10.0f, 1, 1, 0.4f, colorWhite, 3);
|
||||
|
||||
sprintf_s(strFinal, strTemplate, font2->fontName, strButtons);
|
||||
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
|
||||
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font2, MY_X, 35.0f, 1, 1, 0.4f, colorWhite, 3);
|
||||
|
||||
sprintf_s(strFinal, strTemplate, font3->fontName, strButtons);
|
||||
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
|
||||
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font3, MY_X, 60.0f, 1, 1, 0.4f, colorWhite, 3);
|
||||
|
||||
sprintf_s(strFinal, strTemplate, font5->fontName, strButtons);
|
||||
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
|
||||
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font5, MY_X, 85.0f, 1, 1, 0.4f, colorWhite, 3);
|
||||
|
||||
sprintf_s(strFinal, strTemplate, font6->fontName, strButtons);
|
||||
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
|
||||
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font6, MY_X, 110.0f, 1, 1, 0.4f, colorWhite, 3);
|
||||
}
|
||||
|
||||
void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum)
|
||||
{
|
||||
switch (DebugOverlay->current.integer)
|
||||
@ -204,6 +246,9 @@ namespace Components
|
||||
case 2:
|
||||
CG_Debug_DrawPSFlags(localClientNum);
|
||||
break;
|
||||
case 5:
|
||||
CG_Debug_DrawFontTest(localClientNum);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -19,9 +19,17 @@ namespace Components
|
||||
static const char* PLFlagsValues[];
|
||||
static const char* PEFlagsValues[];
|
||||
|
||||
static const char strButtons[];
|
||||
static const char strTemplate[];
|
||||
|
||||
static constexpr auto MY_SCALE2 = 0.5f;
|
||||
static constexpr auto MY_SCALE_2 = 0.201f;
|
||||
|
||||
static constexpr auto MY_X = -25.0f;
|
||||
static constexpr auto MY_Y = 20.0f;
|
||||
|
||||
static const float colorWhite[];
|
||||
|
||||
static std::string BuildPMFlagsString(const Game::playerState_s* ps);
|
||||
static std::string BuildPOFlagsString(const Game::playerState_s* ps);
|
||||
static std::string BuildPLFlagsString(const Game::playerState_s* ps);
|
||||
@ -29,6 +37,7 @@ namespace Components
|
||||
|
||||
static void CG_Debug_DrawPSFlags(int localClientNum);
|
||||
static void CG_DrawDebugPlayerHealth(int localClientNum);
|
||||
static void CG_Debug_DrawFontTest(int localClientNum);
|
||||
|
||||
static void CG_DrawDebugOverlays_Hk(int localClientNum);
|
||||
|
||||
|
@ -1190,28 +1190,27 @@ namespace Game
|
||||
|
||||
void UI_FilterStringForButtonAnimation(char* str, unsigned int strMaxSize)
|
||||
{
|
||||
if (SEH_GetCurrentLanguage() == 8 || Sys_Milliseconds() % 1000 <= 800)
|
||||
if (SEH_GetCurrentLanguage() == 8)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
size_t i = 0;
|
||||
while (str[i] != '\0')
|
||||
const auto remainder = Sys_Milliseconds() % 1000;
|
||||
if (remainder <= 800)
|
||||
{
|
||||
if (i >= strMaxSize)
|
||||
break;
|
||||
|
||||
const auto value = str[i];
|
||||
if (value == 16)
|
||||
{
|
||||
str[i] = -68;
|
||||
}
|
||||
else if (value == 17)
|
||||
{
|
||||
str[i] = -67;
|
||||
return;
|
||||
}
|
||||
|
||||
++i;
|
||||
for (std::size_t idx = 0; str[idx] && idx < strMaxSize; ++idx)
|
||||
{
|
||||
if (str[idx] == 16)
|
||||
{
|
||||
str[idx] = -68;
|
||||
}
|
||||
else if (str[idx] == 17)
|
||||
{
|
||||
str[idx] = -67;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user