From de107be4e045d33d1f5e510d01e2c5fc28e9aff2 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 20 Sep 2021 20:40:42 +0200 Subject: [PATCH] Code clearity improvements to Fonticons patch --- src/Components/Modules/Chat.cpp | 6 +++++- src/Components/Modules/TextRenderer.cpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Chat.cpp b/src/Components/Modules/Chat.cpp index 332e90a4..5c849c3b 100644 --- a/src/Components/Modules/Chat.cpp +++ b/src/Components/Modules/Chat.cpp @@ -169,9 +169,13 @@ namespace Components len += 1.0f; } } + *p = 0; + Game::cgsArray[0].teamChatMsgTimes[Game::cgsArray[0].teamChatPos % chatHeight] = Game::cgArray[0].time; - if (Game::cgsArray[0].teamChatPos++ + 1 - Game::cgsArray[0].teamLastChatPos > chatHeight) + + Game::cgsArray[0].teamChatPos++; + if (Game::cgsArray[0].teamChatPos - Game::cgsArray[0].teamLastChatPos > chatHeight) Game::cgsArray[0].teamLastChatPos = Game::cgsArray[0].teamChatPos + 1 - chatHeight; } diff --git a/src/Components/Modules/TextRenderer.cpp b/src/Components/Modules/TextRenderer.cpp index 3af4935c..33b704ec 100644 --- a/src/Components/Modules/TextRenderer.cpp +++ b/src/Components/Modules/TextRenderer.cpp @@ -395,7 +395,7 @@ namespace Components UpdateAutocompleteContext(autocompleteContext, edit, font, ww); if (autocompleteContext.autocompleteActive) { - DrawAutocomplete(autocompleteContext, std::floor(xx), /*std::floor(*/ yy/*)*/, font, ww, hh); + DrawAutocomplete(autocompleteContext, std::floor(xx), std::floor(yy), font, ww, hh); } } @@ -1075,6 +1075,8 @@ namespace Components const auto width = text[1]; const auto materialNameLength = text[3]; + // This is how the game calculates width and height. Probably some 1 byte floating point number. + // Details to be investigated if necessary. const auto v9 = font->pixelHeight * (width - 16) + 16; const auto w = ((((v9 >> 24) & 0x1F) + v9) >> 5);