diff --git a/CMakeLists.txt b/CMakeLists.txt index b249966fa20..6f538ac49b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2129,6 +2129,7 @@ set_src(ENGINE_SHARED GLOB_RECURSE src/engine/shared storage.cpp stun.cpp stun.h + tater_variables.h teehistorian_ex.cpp teehistorian_ex.h teehistorian_ex_chunks.h @@ -2171,7 +2172,6 @@ set_src(GAME_SHARED GLOB src/game mapitems_ex_types.h prng.cpp prng.h - tater_variables.h teamscore.cpp teamscore.h tuning.h diff --git a/src/engine/client.h b/src/engine/client.h index 8b9192fdb64..e65c5a03fcf 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -57,9 +57,9 @@ class IClient : public IInterface }; /** - * More precise state for @see STATE_LOADING - * Sets what is actually happening in the client right now - */ + * More precise state for @see STATE_LOADING + * Sets what is actually happening in the client right now + */ enum ELoadingStateDetail { LOADING_STATE_DETAIL_INITIAL, @@ -268,7 +268,7 @@ class IClient : public IInterface virtual IGraphics::CTextureHandle GetDebugFont() const = 0; // TODO: remove this function - //DDRace + // DDRace virtual const char *GetCurrentMap() const = 0; virtual const char *GetCurrentMapPath() const = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 0c59e93a562..34cb2575b8e 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2093,7 +2093,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy) char aBufTO[256]; str_format(aBufTO, sizeof(aBufTO), "/timeout %s", m_aTimeoutCodes[Conn]); TOMsgp.m_pMessage = aBufTO; - CMsgPacker PackerTO(TOMsgp.ms_MsgId, false); + CMsgPacker PackerTO(CNetMsg_Cl_Say::ms_MsgId, false); TOMsgp.Pack(&PackerTO); SendMsg(Conn, &PackerTO, MSGFLAG_VITAL); @@ -3371,8 +3371,7 @@ bool CClient::InitNetworkClient(char *pError, size_t ErrorSize) BindAddr.type = NETTYPE_ALL; for(unsigned int i = 0; i < std::size(m_aNetClient); i++) { - int &PortRef = i == CONN_MAIN ? g_Config.m_ClPort : i == CONN_DUMMY ? g_Config.m_ClDummyPort : - g_Config.m_ClContactPort; + int &PortRef = i == CONN_MAIN ? g_Config.m_ClPort : i == CONN_DUMMY ? g_Config.m_ClDummyPort : g_Config.m_ClContactPort; if(PortRef < 1024) // Reject users setting ports that we don't want to use { PortRef = 0; diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 247e35a3fb9..ea95d99ddcf 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -507,7 +507,7 @@ class CClient : public IClient, public CDemoPlayer::IListener IFriends *Foes() override { return &m_Foes; } - void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; + void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; void AddWarning(const SWarning &Warning) override; diff --git a/src/engine/shared/config.cpp b/src/engine/shared/config.cpp index 22ddaa534bf..f16d3f0abd3 100644 --- a/src/engine/shared/config.cpp +++ b/src/engine/shared/config.cpp @@ -474,7 +474,7 @@ bool CConfigManager::TSave() WriteLine(aLineBuf); \ } -#include "././game/tater_variables.h" +#include "tater_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_COL @@ -485,7 +485,6 @@ bool CConfigManager::TSave() Callback.m_pfnFunc(this, Callback.m_pUserData); } - if(io_sync(m_ConfigFile) != 0) { m_Failed = true; @@ -522,7 +521,6 @@ void CConfigManager::RegisterTCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData m_vTCallbacks.emplace_back(pfnFunc, pUserData); } - void CConfigManager::WriteLine(const char *pLine) { if(!m_ConfigFile || diff --git a/src/engine/shared/config.h b/src/engine/shared/config.h index 1815a2ad5d4..b15c2ea2d57 100644 --- a/src/engine/shared/config.h +++ b/src/engine/shared/config.h @@ -225,7 +225,6 @@ class CConfigManager : public IConfigManager static void Con_Toggle(IConsole::IResult *pResult, void *pUserData); static void Con_ToggleStroke(IConsole::IResult *pResult, void *pUserData); - public: CConfigManager(); diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index ed46cbba5c7..66e3f1c9331 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -10,7 +10,7 @@ #define MACRO_CONFIG_STR(Name, ScriptName, Len, Def, Save, Desc) ; #endif -#include "././game/tater_variables.h" +#include "tater_variables.h" // client MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict client movements") diff --git a/src/game/tater_variables.h b/src/engine/shared/tater_variables.h similarity index 99% rename from src/game/tater_variables.h rename to src/engine/shared/tater_variables.h index e299559aab5..d2934c23ba4 100644 --- a/src/game/tater_variables.h +++ b/src/engine/shared/tater_variables.h @@ -1,3 +1,4 @@ +// This file can be included several times. #ifndef MACRO_CONFIG_INT #error "The config macros must be defined" @@ -129,4 +130,4 @@ MACRO_CONFIG_INT(ClRainbowOthers, tc_rainbow_others, 0, 0, 1, CFGFLAG_CLIENT | C MACRO_CONFIG_INT(ClRainbowMode, tc_rainbow_mode, 1, 1, 4, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow mode (1: rainbow, 2: pulse, 3: darkness)") // AAAAAAA -MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "") \ No newline at end of file +MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "") diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 088ae9f134c..cb7a979ce51 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -274,7 +274,7 @@ void CBinds::SetDefaults() Bind(KEY_MOUSE_1, "+fire"); Bind(KEY_MOUSE_2, "+hook"); Bind(KEY_LSHIFT, "+emote"); - Bind(KEY_Q, "+bindwheel"); + Bind(KEY_Q, "+bindwheel"); Bind(KEY_RETURN, "+show_chat; chat all"); Bind(KEY_RIGHT, "spectate_next"); Bind(KEY_LEFT, "spectate_previous"); diff --git a/src/game/client/components/bindwheel.cpp b/src/game/client/components/bindwheel.cpp index ea68122e0a5..c3c87eb89d2 100644 --- a/src/game/client/components/bindwheel.cpp +++ b/src/game/client/components/bindwheel.cpp @@ -28,14 +28,14 @@ void CBindWheel::ConBindwheel(IConsole::IResult *pResult, void *pUserData) void CBindWheel::ConBind(IConsole::IResult *pResult, void *pUserData) { - int bindpos = pResult->GetInteger(0); - char command[MAX_BINDWHEEL_CMD]; - char description[MAX_BINDWHEEL_DESC]; - str_format(description, sizeof(description), "%s", pResult->GetString(1)); - str_format(command, sizeof(command), "%s", pResult->GetString(2)); + int BindPos = pResult->GetInteger(0); + char Command[MAX_BINDWHEEL_CMD]; + char Description[MAX_BINDWHEEL_DESC]; + str_format(Description, sizeof(Description), "%s", pResult->GetString(1)); + str_format(Command, sizeof(Command), "%s", pResult->GetString(2)); CBindWheel *pThis = static_cast(pUserData); - pThis->updateBinds(bindpos, description, command); + pThis->updateBinds(BindPos, Description, Command); } void CBindWheel::ConchainBindwheel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData) @@ -43,14 +43,14 @@ void CBindWheel::ConchainBindwheel(IConsole::IResult *pResult, void *pUserData, pfnCallback(pResult, pCallbackUserData); if(pResult->NumArguments() == 3) { - int bindpos = pResult->GetInteger(0); - char command[MAX_BINDWHEEL_CMD]; - char description[MAX_BINDWHEEL_DESC]; - str_format(description, sizeof(description), "%s", pResult->GetString(1)); - str_format(command, sizeof(command), "%s", pResult->GetString(2)); + int BindPos = pResult->GetInteger(0); + char Command[MAX_BINDWHEEL_CMD]; + char Description[MAX_BINDWHEEL_DESC]; + str_format(Description, sizeof(Description), "%s", pResult->GetString(1)); + str_format(Command, sizeof(Command), "%s", pResult->GetString(2)); CBindWheel *pThis = static_cast(pUserData); - pThis->updateBinds(bindpos, description, command); + pThis->updateBinds(BindPos, Description, Command); } } @@ -61,19 +61,19 @@ void CBindWheel::OnConsoleInit() pConfigManager->RegisterTCallback(ConfigSaveCallback, this); Console()->Register("+bindwheel", "", CFGFLAG_CLIENT, ConBindwheel, this, "Open bindwheel selector"); - Console()->Register("bindwheel", "i[bindwheel] s[description:128] s[command:10]", CFGFLAG_CLIENT, ConBind, this, "Edit the command"); + Console()->Register("bindwheel", "i[bindwheel] s[Description:128] s[Command:10]", CFGFLAG_CLIENT, ConBind, this, "Edit the Command"); Console()->Chain("bindwheel", ConchainBindwheel, this); for(int i = 0; i < NUM_BINDWHEEL; i++) { - if(!(str_comp(m_BindWheelList[i].description, "EMPTY") == 0)) + if(!(str_comp(m_BindWheelList[i].Description, "EMPTY") == 0)) { - str_format(m_BindWheelList[i].description, sizeof(m_BindWheelList[i].description), "%s", "EMPTY"); + str_format(m_BindWheelList[i].Description, sizeof(m_BindWheelList[i].Description), "%s", "EMPTY"); } - if(str_comp(m_BindWheelList[i].command, "") == 0) + if(str_comp(m_BindWheelList[i].Command, "") == 0) { - str_format(m_BindWheelList[i].command, sizeof(m_BindWheelList[i].command), "%s", ""); + str_format(m_BindWheelList[i].Command, sizeof(m_BindWheelList[i].Command), "%s", ""); } } } @@ -112,7 +112,7 @@ void CBindWheel::OnRender() if(!m_Active) { if(g_Config.m_ClResetBindWheelMouse) - m_SelectorMouse = vec2(0, 0); + m_SelectorMouse = vec2(0.0f, 0.0f); if(m_WasActive && m_SelectedBind != -1) Binwheel(m_SelectedBind); m_WasActive = false; @@ -124,13 +124,13 @@ void CBindWheel::OnRender() if(length(m_SelectorMouse) > 170.0f) m_SelectorMouse = normalize(m_SelectorMouse) * 170.0f; - float SelectedAngle = angle(m_SelectorMouse) + 2 * pi / 24; - if(SelectedAngle < 0) - SelectedAngle += 2 * pi; + float SelectedAngle = angle(m_SelectorMouse) + 2.0f * pi / 24.0f; + if(SelectedAngle < 0.0f) + SelectedAngle += 2.0f * pi; m_SelectedBind = -1; if(length(m_SelectorMouse) > 110.0f) - m_SelectedBind = (int)(SelectedAngle / (2 * pi) * NUM_BINDWHEEL); + m_SelectedBind = (int)(SelectedAngle / (2.0f * pi) * NUM_BINDWHEEL); CUIRect Screen = *Ui()->Screen(); @@ -140,32 +140,32 @@ void CBindWheel::OnRender() Graphics()->TextureClear(); Graphics()->QuadsBegin(); - Graphics()->SetColor(0, 0, 0, 0.3f); - DrawCircle(Screen.w / 2, Screen.h / 2, 190.0f, 64); + Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.3f); + DrawCircle(Screen.w / 2.0f, Screen.h / 2.0f, 190.0f, 64); Graphics()->QuadsEnd(); Graphics()->WrapClamp(); for(int i = 0; i < NUM_BINDWHEEL; i++) { - float Angle = 2 * pi * i / NUM_BINDWHEEL; - float margin = 140.0f; + float Angle = 2.0f * pi * i / NUM_BINDWHEEL; + float Margin = 140.0f; if(Angle > pi) { - Angle -= 2 * pi; + Angle -= 2.0f * pi; } bool Selected = m_SelectedBind == i; - float Size = Selected ? 14.0 : 12.0f; + float Size = Selected ? 14.0f : 12.0f; - float NudgeX = margin * cosf(Angle); + float NudgeX = Margin * cosf(Angle); float NudgeY = 150.0f * sinf(Angle); char aBuf[MAX_BINDWHEEL_DESC]; - str_format(aBuf, sizeof(aBuf), "%s", m_BindWheelList[i].description); + str_format(aBuf, sizeof(aBuf), "%s", m_BindWheelList[i].Description); // str_format(aBuf, sizeof(aBuf), "%d -> %d", inv, orgAngle); - float x = Screen.w / 2 + NudgeX - TextRender()->TextWidth(Size, aBuf, -1, -1.0f) * 0.5; - float y = Screen.h / 2 + NudgeY; + float x = Screen.w / 2.0f + NudgeX - TextRender()->TextWidth(Size, aBuf, -1.0f, -1.0f) * 0.5f; + float y = Screen.h / 2.0f + NudgeY; float LineWidth = -1.0f; TextRender()->Text(x, y, Size, aBuf, LineWidth); } @@ -175,33 +175,33 @@ void CBindWheel::OnRender() { Graphics()->TextureClear(); Graphics()->QuadsBegin(); - Graphics()->SetColor(1.0, 1.0, 1.0, 0.3f); - DrawCircle(Screen.w / 2, Screen.h / 2, 100.0f, 64); + Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.3f); + DrawCircle(Screen.w / 2.0f, Screen.h / 2.0f, 100.0f, 64); Graphics()->QuadsEnd(); Graphics()->TextureClear(); Graphics()->QuadsBegin(); - Graphics()->SetColor(0, 0, 0, 0.3f); - DrawCircle(Screen.w / 2, Screen.h / 2, 30.0f, 64); + Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.3f); + DrawCircle(Screen.w / 2.0f, Screen.h / 2.0f, 30.0f, 64); Graphics()->QuadsEnd(); } - RenderTools()->RenderCursor(m_SelectorMouse + vec2(Screen.w, Screen.h) / 2, 24.0f); + RenderTools()->RenderCursor(m_SelectorMouse + vec2(Screen.w, Screen.h) / 2.0f, 24.0f); } void CBindWheel::Binwheel(int Bind) { // bindwheel 0 "123456789" "say hey" - Console()->ExecuteLine(m_BindWheelList[Bind].command); + Console()->ExecuteLine(m_BindWheelList[Bind].Command); } -void CBindWheel::updateBinds(int Bindpos, char *Description, char *Command) +void CBindWheel::updateBinds(int BindPos, char *Description, char *Command) { - str_format(m_BindWheelList[Bindpos].command, sizeof(m_BindWheelList[Bindpos].command), "%s", Command); - str_format(m_BindWheelList[Bindpos].description, sizeof(m_BindWheelList[Bindpos].description), "%s", Description); + str_format(m_BindWheelList[BindPos].Command, sizeof(m_BindWheelList[BindPos].Command), "%s", Command); + str_format(m_BindWheelList[BindPos].Description, sizeof(m_BindWheelList[BindPos].Description), "%s", Description); char aBuf[512]; - str_format(aBuf, sizeof(aBuf), "[%d]: '%s' -> '%s'", Bindpos, m_BindWheelList[Bindpos].description, m_BindWheelList[Bindpos].command); + str_format(aBuf, sizeof(aBuf), "[%d]: '%s' -> '%s'", BindPos, m_BindWheelList[BindPos].Description, m_BindWheelList[BindPos].Command); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "updateBinds", aBuf); } @@ -213,9 +213,9 @@ void CBindWheel::ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserD char aBuf[128] = {}; for(int i = 0; i < NUM_BINDWHEEL; ++i) { - char *command = pSelf->m_BindWheelList[i].command; - char *description = pSelf->m_BindWheelList[i].description; - str_format(aBuf, sizeof(aBuf), "bindwheel %d \"%s\" \"%s\"", i, description, command); + char *Command = pSelf->m_BindWheelList[i].Command; + char *Description = pSelf->m_BindWheelList[i].Description; + str_format(aBuf, sizeof(aBuf), "bindwheel %d \"%s\" \"%s\"", i, Description, Command); pConfigManager->WriteLine(aBuf); } diff --git a/src/game/client/components/bindwheel.h b/src/game/client/components/bindwheel.h index 2bf78ce0aa9..c4e7e4b62c7 100644 --- a/src/game/client/components/bindwheel.h +++ b/src/game/client/components/bindwheel.h @@ -1,6 +1,6 @@ -#ifndef GAME_CLIENT_COMPONENTS_BIND_WHEEL_H -#define GAME_CLIENT_COMPONENTS_BIND_WHEEL_H +#ifndef GAME_CLIENT_COMPONENTS_BINDWHEEL_H +#define GAME_CLIENT_COMPONENTS_BINDWHEEL_H #include class IConfigManager; @@ -10,7 +10,7 @@ class IConfigManager; class CBindWheel : public CComponent { - void DrawCircle(float x, float y, float r, int Segments); + void DrawCircle(float x, float y, float r, int Segments); bool m_WasActive; bool m_Active; @@ -25,12 +25,11 @@ class CBindWheel : public CComponent public: struct SClientBindWheel { - char description[MAX_BINDWHEEL_DESC]; - char command[MAX_BINDWHEEL_CMD]; + char Description[MAX_BINDWHEEL_DESC]; + char Command[MAX_BINDWHEEL_CMD]; }; SClientBindWheel m_BindWheelList[NUM_BINDWHEEL]; - CBindWheel(); virtual int Sizeof() const override { return sizeof(*this); } @@ -40,10 +39,9 @@ class CBindWheel : public CComponent virtual void OnRelease() override; virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override; static void ConchainBindwheel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); - + void updateBinds(int Bindpos, char *Description, char *Command); void Binwheel(int Bind); - }; #endif diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 4d5fb8f6c11..e3f2dff83ed 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -2,6 +2,7 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include +#include #include #include #include @@ -19,7 +20,6 @@ #include #include "chat.h" -#include "engine/external/remimu.h" char CChat::ms_aDisplayText[MAX_LINE_LENGTH] = {'\0'}; diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 6be1bbf9226..a60dc10a19d 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -497,9 +497,5 @@ bool CControls::CheckNewInput() m_FastInput = TestInput; - if (NewInput) - { - return true; - } - return false; + return NewInput; } diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index ff7618d0ee5..9fdceff88cd 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -265,10 +265,7 @@ void CHud::RenderScoreHud() if(GameFlags & GAMEFLAG_FLAGS) { - int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 && - (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ? - 10 : - 20; + int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 && (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ? 10 : 20; if(aFlagCarrier[t] == FLAG_ATSTAND || (aFlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy) / BlinkTimer) & 1))) { // draw flag @@ -304,7 +301,6 @@ void CHud::RenderScoreHud() CTeeRenderInfo TeeInfo = m_pClient->m_aClients[Id].m_RenderInfo; TeeInfo.m_Size = ScoreSingleBoxHeight; - const CAnimState *pIdleState = CAnimState::GetIdle(); vec2 OffsetToMid; CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid); @@ -575,19 +571,19 @@ void CHud::RenderTextInfo() if(g_Config.m_ClMiniDebug) { - float FontSize = 8; - float TextHeight = 11; + float FontSize = 8.0f; + float TextHeight = 11.0f; char aBuf[64]; - float yOff = 3; + float OffsetY = 3.0f; int PlayerId = m_pClient->m_Snap.m_LocalClientId; if(m_pClient->m_Snap.m_SpecInfo.m_Active) PlayerId = m_pClient->m_Snap.m_SpecInfo.m_SpectatorId; if(g_Config.m_ClShowhudDDRace && m_pClient->m_Snap.m_aCharacters[PlayerId].m_HasExtendedData && m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW) - yOff += 50; + OffsetY += 50.0f; else if(g_Config.m_ClShowhudHealthAmmo && m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW) - yOff += 27; + OffsetY += 27.0f; vec2 Pos; if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorId == SPEC_FREEVIEW) @@ -596,29 +592,29 @@ void CHud::RenderTextInfo() Pos = m_pClient->m_aClients[PlayerId].m_RenderPos; str_format(aBuf, sizeof(aBuf), "X: %.2f", Pos.x / 32.0f); - TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f); + TextRender()->Text(4, OffsetY, FontSize, aBuf, -1.0f); - yOff += TextHeight; + OffsetY += TextHeight; str_format(aBuf, sizeof(aBuf), "Y: %.2f", Pos.y / 32.0f); - TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f); + TextRender()->Text(4, OffsetY, FontSize, aBuf, -1.0f); if(m_pClient->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW) { - yOff += TextHeight; + OffsetY += TextHeight; str_format(aBuf, sizeof(aBuf), "Angle: %d", m_pClient->m_aClients[PlayerId].m_RenderCur.m_Angle); - TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f); + TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f); - yOff += TextHeight; - str_format(aBuf, sizeof(aBuf), "VelY: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelY / 256.0f * 50.0 / 32.0f); - TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f); + OffsetY += TextHeight; + str_format(aBuf, sizeof(aBuf), "VelY: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelY / 256.0f * 50.0f / 32.0f); + TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f); - yOff += TextHeight; + OffsetY += TextHeight; - str_format(aBuf, sizeof(aBuf), "VelX: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelX / 256.0f * 50.0 / 32.0f); - TextRender()->Text(4, yOff, FontSize, aBuf, -1.0f); + str_format(aBuf, sizeof(aBuf), "VelX: %.2f", m_pClient->m_Snap.m_aCharacters[PlayerId].m_Cur.m_VelX / 256.0f * 50.0f / 32.0f); + TextRender()->Text(4.0f, OffsetY, FontSize, aBuf, -1.0f); } } - //render team in freeze text and last notify + // render team in freeze text and last notify if((g_Config.m_ClShowFrozenText > 0 || g_Config.m_ClShowFrozenHud > 0 || g_Config.m_ClNotifyWhenLast) && GameClient()->m_GameInfo.m_EntitiesDDRace) { int NumInTeam = 0; @@ -644,7 +640,7 @@ void CHud::RenderTextInfo() } } - //Notify when last + // Notify when last if(g_Config.m_ClNotifyWhenLast) { if(NumInTeam > 1 && NumInTeam - NumFrozen == 1) @@ -656,18 +652,18 @@ void CHud::RenderTextInfo() TextRender()->TextColor(TextRender()->DefaultTextColor()); } } - //Show freeze text + // Show freeze text char aBuf[64]; if(g_Config.m_ClShowFrozenText == 1) str_format(aBuf, sizeof(aBuf), "%d / %d", NumInTeam - NumFrozen, NumInTeam); else if(g_Config.m_ClShowFrozenText == 2) str_format(aBuf, sizeof(aBuf), "%d / %d", NumFrozen, NumInTeam); if(g_Config.m_ClShowFrozenText > 0) - TextRender()->Text(m_Width / 2.0f - TextRender()->TextWidth(10.f, aBuf) / 2.0f, 12.0f, 10.0f, aBuf); + TextRender()->Text(m_Width / 2.0f - TextRender()->TextWidth(10.0f, aBuf) / 2.0f, 12.0f, 10.0f, aBuf); - //str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd); - //str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing); - //TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f); + // str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd); + // str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing); + // TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f); if(g_Config.m_ClShowFrozenHud > 0 && !m_pClient->m_Scoreboard.Active() && !(LocalTeamID == 0 && g_Config.m_ClFrozenHudTeamOnly)) { @@ -677,24 +673,23 @@ void CHud::RenderTextInfo() FreezeInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin; FreezeInfo.m_BloodColor = pSkin->m_BloodColor; FreezeInfo.m_SkinMetrics = pSkin->m_Metrics; - FreezeInfo.m_ColorBody = ColorRGBA(1, 1, 1); - FreezeInfo.m_ColorFeet = ColorRGBA(1, 1, 1); + FreezeInfo.m_ColorBody = ColorRGBA(1.0f, 1.0f, 1.0f); + FreezeInfo.m_ColorFeet = ColorRGBA(1.0f, 1.0f, 1.0f); FreezeInfo.m_CustomColoredSkin = false; - float progressiveOffset = 0.0f; float TeeSize = g_Config.m_ClFrozenHudTeeSize; - int MaxTees = (int)(8.3 * (m_Width / m_Height) * 13.0f / TeeSize); + int MaxTees = (int)(8.3f * (m_Width / m_Height) * 13.0f / TeeSize); if(!g_Config.m_ClShowfps && !g_Config.m_ClShowpred) - MaxTees = (int)(9.5 * (m_Width / m_Height) * 13.0f / TeeSize); + MaxTees = (int)(9.5f * (m_Width / m_Height) * 13.0f / TeeSize); int MaxRows = g_Config.m_ClFrozenMaxRows; - float StartPos = m_Width / 2 + 38.0f * (m_Width / m_Height) / 1.78; + float StartPos = m_Width / 2.0f + 38.0f * (m_Width / m_Height) / 1.78f; int TotalRows = std::min(MaxRows, (NumInTeam + MaxTees - 1) / MaxTees); Graphics()->TextureClear(); Graphics()->QuadsBegin(); Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.4f); - Graphics()->DrawRectExt(StartPos - TeeSize / 2, 0.0f, TeeSize * std::min(NumInTeam, MaxTees), TeeSize + 3.0f + (TotalRows - 1) * TeeSize, 5.0f, IGraphics::CORNER_B); + Graphics()->DrawRectExt(StartPos - TeeSize / 2.0f, 0.0f, TeeSize * std::min(NumInTeam, MaxTees), TeeSize + 3.0f + (TotalRows - 1) * TeeSize, 5.0f, IGraphics::CORNER_B); Graphics()->QuadsEnd(); bool Overflow = NumInTeam > MaxTees * MaxRows; @@ -744,12 +739,12 @@ void CHud::RenderTextInfo() if(g_Config.m_ClShowFrozenHudSkins && Frozen) { Alpha = 0.6f; - TeeInfo.m_ColorBody.r *= 0.4; - TeeInfo.m_ColorBody.g *= 0.4; - TeeInfo.m_ColorBody.b *= 0.4; - TeeInfo.m_ColorFeet.r *= 0.4; - TeeInfo.m_ColorFeet.g *= 0.4; - TeeInfo.m_ColorFeet.b *= 0.4; + TeeInfo.m_ColorBody.r *= 0.4f; + TeeInfo.m_ColorBody.g *= 0.4f; + TeeInfo.m_ColorBody.b *= 0.4f; + TeeInfo.m_ColorFeet.r *= 0.4f; + TeeInfo.m_ColorFeet.g *= 0.4f; + TeeInfo.m_ColorFeet.b *= 0.4f; } if(Frozen) RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_PAIN, vec2(1.0f, 0.0f), TeeRenderPos, Alpha); diff --git a/src/game/client/components/maplayers.h b/src/game/client/components/maplayers.h index 6aa408df1f9..f1bce1e280e 100644 --- a/src/game/client/components/maplayers.h +++ b/src/game/client/components/maplayers.h @@ -135,7 +135,6 @@ class CMapLayers : public CComponent public: bool m_OnlineOnly; - enum { TYPE_BACKGROUND = 0, diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 07b951c5f97..118f909476d 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -641,7 +641,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) static CButtonContainer s_RandomizeColors; if(*pUseCustomColor) { - //RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0); + // RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0); if(DoButton_Menu(&s_RandomizeColors, "Random Colors", 0, &RandomColorsButton, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0, 0, 0, 0.5f))) { if(m_Dummy) @@ -1749,7 +1749,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) char aCurDeviceName[256 + 4]; - int OldSelectedGpu = -1; + int RainbowSelectedOldGpu = -1; for(size_t i = 0; i < GpuCount; ++i) { if(i == 0) @@ -1758,7 +1758,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) s_vpGpuIdNames[i] = aCurDeviceName; if(str_comp("auto", g_Config.m_GfxGpuName) == 0) { - OldSelectedGpu = 0; + RainbowSelectedOldGpu = 0; } } else @@ -1766,27 +1766,27 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) s_vpGpuIdNames[i] = GpuList.m_vGpus[i - 1].m_aName; if(str_comp(GpuList.m_vGpus[i - 1].m_aName, g_Config.m_GfxGpuName) == 0) { - OldSelectedGpu = i; + RainbowSelectedOldGpu = i; } } } - static int s_OldSelectedGpu = -1; - if(s_OldSelectedGpu == -1) - s_OldSelectedGpu = OldSelectedGpu; + static int s_RainbowSelectedOldGpu = -1; + if(s_RainbowSelectedOldGpu == -1) + s_RainbowSelectedOldGpu = RainbowSelectedOldGpu; static CUi::SDropDownState s_GpuDropDownState; static CScrollRegion s_GpuDropDownScrollRegion; s_GpuDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_GpuDropDownScrollRegion; - const int NewGpu = Ui()->DoDropDown(&GpuDropDown, OldSelectedGpu, s_vpGpuIdNames.data(), GpuCount, s_GpuDropDownState); - if(OldSelectedGpu != NewGpu) + const int NewGpu = Ui()->DoDropDown(&GpuDropDown, RainbowSelectedOldGpu, s_vpGpuIdNames.data(), GpuCount, s_GpuDropDownState); + if(RainbowSelectedOldGpu != NewGpu) { if(NewGpu == 0) str_copy(g_Config.m_GfxGpuName, "auto"); else str_copy(g_Config.m_GfxGpuName, GpuList.m_vGpus[NewGpu - 1].m_aName); CheckSettings = true; - s_GfxGpuChanged = NewGpu != s_OldSelectedGpu; + s_GfxGpuChanged = NewGpu != s_RainbowSelectedOldGpu; } } @@ -3342,10 +3342,10 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorOffset, &g_Config.m_ClIndicatorOffset, &Button, Localize("Indicator offset"), 16, 200); LeftView.HSplitTop(LineSize * 2, nullptr, &LeftView); } - static CButtonContainer IndicatorAliveColorID, IndicatorDeadColorID, IndicatorSavedColorID; - DoLine_ColorPicker(&IndicatorAliveColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator alive color"), &g_Config.m_ClIndicatorAlive, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoLine_ColorPicker(&IndicatorDeadColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator dead color"), &g_Config.m_ClIndicatorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoLine_ColorPicker(&IndicatorSavedColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator save color"), &g_Config.m_ClIndicatorSaved, ColorRGBA(0.0f, 0.0f, 0.0f), false); + static CButtonContainer s_IndicatorAliveColorID, s_IndicatorDeadColorID, s_IndicatorSavedColorID; + DoLine_ColorPicker(&s_IndicatorAliveColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator alive color"), &g_Config.m_ClIndicatorAlive, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&s_IndicatorDeadColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator dead color"), &g_Config.m_ClIndicatorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&s_IndicatorSavedColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator save color"), &g_Config.m_ClIndicatorSaved, ColorRGBA(0.0f, 0.0f, 0.0f), false); LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); LeftView.HSplitTop(HeadlineHeight, &Label, &LeftView); @@ -3357,17 +3357,17 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRemoveAnti, Localize("Remove prediction & antiping in freeze"), &g_Config.m_ClRemoveAnti, &LeftView, LineSize); if(g_Config.m_ClRemoveAnti) { - static int ValueUnfreezeLagTicks, ValueUnfreezeLagDelayTicks; - ValueUnfreezeLagTicks = g_Config.m_ClUnfreezeLagTicks * 20; - ValueUnfreezeLagDelayTicks = g_Config.m_ClUnfreezeLagDelayTicks * 20; - if(ValueUnfreezeLagDelayTicks < ValueUnfreezeLagTicks) - ValueUnfreezeLagDelayTicks = ValueUnfreezeLagTicks; + static int s_ValueUnfreezeLagTicks, s_ValueUnfreezeLagDelayTicks; + s_ValueUnfreezeLagTicks = g_Config.m_ClUnfreezeLagTicks * 20; + s_ValueUnfreezeLagDelayTicks = g_Config.m_ClUnfreezeLagDelayTicks * 20; + if(s_ValueUnfreezeLagDelayTicks < s_ValueUnfreezeLagTicks) + s_ValueUnfreezeLagDelayTicks = s_ValueUnfreezeLagTicks; LeftView.HSplitTop(LineSize, &Button, &LeftView); - Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagTicks, &ValueUnfreezeLagTicks, &Button, Localize("Amount"), 100, 300, &CUi::ms_LinearScrollbarScale, 0, "ms"); + Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagTicks, &s_ValueUnfreezeLagTicks, &Button, Localize("Amount"), 100, 300, &CUi::ms_LinearScrollbarScale, 0, "ms"); LeftView.HSplitTop(LineSize, &Button, &LeftView); - Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagDelayTicks, &ValueUnfreezeLagDelayTicks, &Button, Localize("Delay"), 100, 3000, &CUi::ms_LinearScrollbarScale, 0, "ms"); - g_Config.m_ClUnfreezeLagTicks = ValueUnfreezeLagTicks / 20; - g_Config.m_ClUnfreezeLagDelayTicks = ValueUnfreezeLagDelayTicks / 20; + Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagDelayTicks, &s_ValueUnfreezeLagDelayTicks, &Button, Localize("Delay"), 100, 3000, &CUi::ms_LinearScrollbarScale, 0, "ms"); + g_Config.m_ClUnfreezeLagTicks = s_ValueUnfreezeLagTicks / 20; + g_Config.m_ClUnfreezeLagDelayTicks = s_ValueUnfreezeLagDelayTicks / 20; } else LeftView.HSplitTop(LineSize * 2, nullptr, &LeftView); @@ -3395,12 +3395,12 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) Ui()->DoScrollbarOption(&g_Config.m_ClOutlineAlpha, &g_Config.m_ClOutlineAlpha, &Button, Localize("Outline Alpha"), 0, 100); RightView.HSplitTop(LineSize, &Button, &RightView); Ui()->DoScrollbarOption(&g_Config.m_ClOutlineAlphaSolid, &g_Config.m_ClOutlineAlphaSolid, &Button, Localize("Outline Alpha (walls)"), 0, 100); - static CButtonContainer OutlineColorFreezeID, OutlineColorSolidID, OutlineColorTeleID, OutlineColorUnfreezeID; - DoLine_ColorPicker(&OutlineColorFreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Freeze Outline Color"), &g_Config.m_ClOutlineColorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoLine_ColorPicker(&OutlineColorSolidID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Walls Outline Color"), &g_Config.m_ClOutlineColorSolid, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoLine_ColorPicker(&OutlineColorTeleID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Teleporter Outline Color"), &g_Config.m_ClOutlineColorTele, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoLine_ColorPicker(&OutlineColorUnfreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Unfreeze Outline Color"), &g_Config.m_ClOutlineColorUnfreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); - + static CButtonContainer s_OutlineColorFreezeID, s_OutlineColorSolidID, s_OutlineColorTeleID, s_OutlineColorUnfreezeID; + DoLine_ColorPicker(&s_OutlineColorFreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Freeze Outline Color"), &g_Config.m_ClOutlineColorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&s_OutlineColorSolidID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Walls Outline Color"), &g_Config.m_ClOutlineColorSolid, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&s_OutlineColorTeleID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Teleporter Outline Color"), &g_Config.m_ClOutlineColorTele, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&s_OutlineColorUnfreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Unfreeze Outline Color"), &g_Config.m_ClOutlineColorUnfreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); RightView.HSplitTop(HeadlineHeight, &Label, &RightView); Ui()->DoLabel(&Label, Localize("Input"), HeadlineFontSize, TEXTALIGN_ML); @@ -3429,8 +3429,8 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHideFrozenGhosts, Localize("Hide ghosts of frozen players"), &g_Config.m_ClHideFrozenGhosts, &RightView, LineSize); DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderGhostAsCircle, Localize("Render ghosts as circles"), &g_Config.m_ClRenderGhostAsCircle, &RightView, LineSize); - static CKeyInfo Key = CKeyInfo{"Toggle Ghosts Key", "toggle tc_show_others_ghosts 0 1", 0, 0}; - Key.m_ModifierCombination = Key.m_KeyId = 0; + static CKeyInfo s_Key = CKeyInfo{"Toggle Ghosts Key", "toggle tc_show_others_ghosts 0 1", 0, 0}; + s_Key.m_ModifierCombination = s_Key.m_KeyId = 0; for(int Mod = 0; Mod < CBinds::MODIFIER_COMBINATION_COUNT; Mod++) { for(int KeyId = 0; KeyId < KEY_LAST; KeyId++) @@ -3439,10 +3439,10 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) if(!pBind[0]) continue; - if(str_comp(pBind, Key.m_pCommand) == 0) + if(str_comp(pBind, s_Key.m_pCommand) == 0) { - Key.m_KeyId = KeyId; - Key.m_ModifierCombination = Mod; + s_Key.m_KeyId = KeyId; + s_Key.m_ModifierCombination = Mod; break; } } @@ -3452,16 +3452,16 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) RightView.HSplitTop(LineSize, &KeyButton, &RightView); KeyButton.VSplitMid(&KeyLabel, &KeyButton); char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s:", Localize(Key.m_pName)); + str_format(aBuf, sizeof(aBuf), "%s:", Localize(s_Key.m_pName)); Ui()->DoLabel(&KeyLabel, aBuf, 12.0f, TEXTALIGN_ML); - int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination; - int NewId = DoKeyReader(&Key, &KeyButton, OldId, OldModifierCombination, &NewModifierCombination); + int OldId = s_Key.m_KeyId, OldModifierCombination = s_Key.m_ModifierCombination, NewModifierCombination; + int NewId = DoKeyReader(&s_Key, &KeyButton, OldId, OldModifierCombination, &NewModifierCombination); if(NewId != OldId || NewModifierCombination != OldModifierCombination) { if(OldId != 0 || NewId == 0) m_pClient->m_Binds.Bind(OldId, "", false, OldModifierCombination); if(NewId != 0) - m_pClient->m_Binds.Bind(NewId, Key.m_pCommand, false, NewModifierCombination); + m_pClient->m_Binds.Bind(NewId, s_Key.m_pCommand, false, NewModifierCombination); } RightView.HSplitTop(MarginSmall, nullptr, &RightView); @@ -3490,11 +3490,11 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) // A bit jank, but it works MainView.y = maximum(LeftView.y, RightView.y) + MarginSmall; - + MainView.HSplitTop(HeadlineHeight, &Label, &MainView); Ui()->DoLabel(&Label, Localize("Miscellaneous"), HeadlineFontSize, TEXTALIGN_MIDDLE); MainView.HSplitTop(MarginSmall, nullptr, &MainView); - + MainView.VSplitMid(&LeftView, &RightView, MarginBetweenViews); // ***** Miscellaneous Left ***** // @@ -3503,13 +3503,13 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) LeftView.HSplitTop(LineSize, &Button, &LeftView); if(g_Config.m_ClRunOnJoinConsole) { - static int Value; - Value = g_Config.m_ClRunOnJoinDelay * 20; - Ui()->DoScrollbarOption(&g_Config.m_ClRunOnJoinDelay, &Value, &Button, Localize("Delay"), 140, 2000, &CUi::ms_LinearScrollbarScale, 0, "ms"); - Value /= 20; + static int s_Value; + s_Value = g_Config.m_ClRunOnJoinDelay * 20; + Ui()->DoScrollbarOption(&g_Config.m_ClRunOnJoinDelay, &s_Value, &Button, Localize("Delay"), 140, 2000, &CUi::ms_LinearScrollbarScale, 0, "ms"); + s_Value /= 20; // Only set if the scroll value or already set is under psuedo-max of 100 (200ms) - if(Value < 100 || g_Config.m_ClRunOnJoinDelay < 100) - g_Config.m_ClRunOnJoinDelay = Value; + if(s_Value < 100 || g_Config.m_ClRunOnJoinDelay < 100) + g_Config.m_ClRunOnJoinDelay = s_Value; } DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeUpdateFix, Localize("Update tee skin faster after being frozen"), &g_Config.m_ClFreezeUpdateFix, &LeftView, LineSize); DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowCenterLines, Localize("Show screen center"), &g_Config.m_ClShowCenterLines, &LeftView, LineSize); @@ -3542,7 +3542,6 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) dbg_msg("menus", "couldn't open link"); } - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHammerRotatesWithCursor, Localize("Make hammer rotate with cursor"), &g_Config.m_ClHammerRotatesWithCursor, &RightView, LineSize); DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderNameplateSpec, Localize("Hide nameplates in spec"), &g_Config.m_ClRenderNameplateSpec, &RightView, LineSize); DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderCursorSpec, Localize("Show your cursor when in free spectate"), &g_Config.m_ClRenderCursorSpec, &RightView, LineSize); DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowSkinName, Localize("Show skin names in nameplate"), &g_Config.m_ClShowSkinName, &RightView, LineSize); @@ -3568,7 +3567,6 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) ScrollRegion.h = 0.0f; s_ScrollRegion.AddRect(ScrollRegion); s_ScrollRegion.End(); - } if(s_CurCustomTab == TCLIENT_TAB_BINDWHEEL) @@ -3579,7 +3577,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) CUIRect LeftColumn = MainView; MainView.HSplitTop(30.0f, &Section, &MainView); - CUIRect buttons[NUM_BINDWHEEL]; + static CUIRect s_Buttons[NUM_BINDWHEEL]; char pD[NUM_BINDWHEEL][MAX_BINDWHEEL_DESC]; char pC[NUM_BINDWHEEL][MAX_BINDWHEEL_CMD]; @@ -3597,7 +3595,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) { float Angle = 2 * pi * i / NUM_BINDWHEEL; float Size = 12.0f; - const char *pText = GameClient()->m_Bindwheel.m_BindWheelList[i].description; + const char *pText = GameClient()->m_Bindwheel.m_BindWheelList[i].Description; const STextBoundingBox BoundingBox = TextRender()->TextBoundingBox(Size, pText); vec2 TextPos; TextPos.x = Pos.x + Radius * cosf(Angle) * 0.75f - BoundingBox.m_W / 2.0f; @@ -3619,36 +3617,36 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) MainView.VSplitLeft(MainView.w * 0.5f, nullptr, &MainView); } - str_format(pD[i], sizeof(pD[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].description); + str_format(pD[i], sizeof(pD[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].Description); - str_format(pC[i], sizeof(pC[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].command); + str_format(pC[i], sizeof(pC[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].Command); // Description MainView.HSplitTop(15.0f, nullptr, &MainView); - MainView.HSplitTop(LineSize, &buttons[i], &MainView); - buttons[i].VSplitLeft(80.0f, &Label, &buttons[i]); - buttons[i].VSplitLeft(150.0f, &buttons[i], nullptr); + MainView.HSplitTop(LineSize, &s_Buttons[i], &MainView); + s_Buttons[i].VSplitLeft(80.0f, &Label, &s_Buttons[i]); + s_Buttons[i].VSplitLeft(150.0f, &s_Buttons[i], nullptr); char aBuf[MAX_BINDWHEEL_CMD]; str_format(aBuf, sizeof(aBuf), "%s %d:", Localize("Description"), i + 1); Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_ML); - s_BindWheelDesc[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].description, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].description)); + s_BindWheelDesc[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].Description, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].Description)); s_BindWheelDesc[i].SetEmptyText(Localize("Description")); - Ui()->DoEditBox(&s_BindWheelDesc[i], &buttons[i], 14.0f); + Ui()->DoEditBox(&s_BindWheelDesc[i], &s_Buttons[i], 14.0f); // Command MainView.HSplitTop(MarginSmall, nullptr, &MainView); - MainView.HSplitTop(LineSize, &buttons[i], &MainView); - buttons[i].VSplitLeft(80.0f, &Label, &buttons[i]); - buttons[i].VSplitLeft(150.0f, &buttons[i], nullptr); + MainView.HSplitTop(LineSize, &s_Buttons[i], &MainView); + s_Buttons[i].VSplitLeft(80.0f, &Label, &s_Buttons[i]); + s_Buttons[i].VSplitLeft(150.0f, &s_Buttons[i], nullptr); str_format(aBuf, sizeof(aBuf), "%s %d:", Localize("Command"), i + 1); Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_ML); - s_BindWheelCmd[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].command, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].command)); + s_BindWheelCmd[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].Command, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].Command)); s_BindWheelCmd[i].SetEmptyText(Localize("Command")); - Ui()->DoEditBox(&s_BindWheelCmd[i], &buttons[i], 14.0f); + Ui()->DoEditBox(&s_BindWheelCmd[i], &s_Buttons[i], 14.0f); } // Do Settings Key @@ -3699,7 +3697,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) void CMenus::RenderSettingsProfiles(CUIRect MainView) { CUIRect Label, LabelMid, Section, LabelRight; - static int SelectedProfile = -1; + static int s_SelectedProfile = -1; const float LineSize = 20.0f; const float MarginSmall = 5.0f; @@ -3749,7 +3747,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) Label.VSplitLeft(250.0f, &Label, &LabelMid); const CAnimState *pIdleState = CAnimState::GetIdle(); vec2 OffsetToMid; - RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); + CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); vec2 TeeRenderPos(Label.x + LineSize, Label.y + Label.h / 2.0f + OffsetToMid.y); int Emote = m_Dummy ? g_Config.m_ClDummyDefaultEyes : g_Config.m_ClPlayerDefaultEyes; RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, Emote, vec2(1.0f, 0.0f), TeeRenderPos); @@ -3774,23 +3772,23 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) str_format(aTempBuf, sizeof(aTempBuf), Localize("Skin: %s"), pSkinName); Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - FlagRect.VSplitRight(50.f, nullptr, &FlagRect); - FlagRect.HSplitBottom(25.f, nullptr, &FlagRect); + FlagRect.VSplitRight(50.0f, nullptr, &FlagRect); + FlagRect.HSplitBottom(25.0f, nullptr, &FlagRect); FlagRect.y -= 10.0f; ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); m_pClient->m_CountryFlags.Render(m_Dummy ? g_Config.m_ClDummyCountry : g_Config.m_PlayerCountry, Color, FlagRect.x, FlagRect.y, FlagRect.w, FlagRect.h); - bool doSkin = g_Config.m_ClApplyProfileSkin; - bool doColors = g_Config.m_ClApplyProfileColors; - bool doEmote = g_Config.m_ClApplyProfileEmote; - bool doName = g_Config.m_ClApplyProfileName; - bool doClan = g_Config.m_ClApplyProfileClan; - bool doFlag = g_Config.m_ClApplyProfileFlag; + bool DoSkin = g_Config.m_ClApplyProfileSkin; + bool DoColors = g_Config.m_ClApplyProfileColors; + bool DoEmote = g_Config.m_ClApplyProfileEmote; + bool DoName = g_Config.m_ClApplyProfileName; + bool DoClan = g_Config.m_ClApplyProfileClan; + bool DoFlag = g_Config.m_ClApplyProfileFlag; //======AFTER LOAD====== - if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) + if(s_SelectedProfile != -1 && s_SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { - CProfile LoadProfile = GameClient()->m_SkinProfiles.m_Profiles[SelectedProfile]; + CProfile LoadProfile = GameClient()->m_SkinProfiles.m_Profiles[s_SelectedProfile]; MainView.HSplitTop(LineSize, nullptr, &MainView); MainView.HSplitTop(10.0f, &Label, &MainView); str_format(aTempBuf, sizeof(aTempBuf), "%s:", Localize("After Load")); @@ -3799,29 +3797,29 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) MainView.HSplitTop(50.0f, &Label, &MainView); Label.VSplitLeft(250.0f, &Label, nullptr); - if(doSkin && strlen(LoadProfile.SkinName) != 0) + if(DoSkin && strlen(LoadProfile.SkinName) != 0) { const CSkin *pLoadSkin = m_pClient->m_Skins.Find(LoadProfile.SkinName); OwnSkinInfo.m_OriginalRenderSkin = pLoadSkin->m_OriginalSkin; OwnSkinInfo.m_ColorableRenderSkin = pLoadSkin->m_ColorableSkin; OwnSkinInfo.m_SkinMetrics = pLoadSkin->m_Metrics; } - if(*pUseCustomColor && doColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) + if(*pUseCustomColor && DoColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) { OwnSkinInfo.m_ColorBody = color_cast(ColorHSLA(LoadProfile.BodyColor).UnclampLighting(ColorHSLA::DARKEST_LGT)); OwnSkinInfo.m_ColorFeet = color_cast(ColorHSLA(LoadProfile.FeetColor).UnclampLighting(ColorHSLA::DARKEST_LGT)); } - RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); + CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); TeeRenderPos = vec2(Label.x + LineSize, Label.y + Label.h / 2.0f + OffsetToMid.y); int LoadEmote = Emote; - if(doEmote && LoadProfile.Emote != -1) + if(DoEmote && LoadProfile.Emote != -1) LoadEmote = LoadProfile.Emote; - RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, LoadEmote, vec2(1, 0), TeeRenderPos); + RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, LoadEmote, vec2(1.0f, 0.0f), TeeRenderPos); - if(doName && strlen(LoadProfile.Name) != 0) + if(DoName && strlen(LoadProfile.Name) != 0) str_format(aName, sizeof(aName), "%s", LoadProfile.Name); - if(doClan && strlen(LoadProfile.Clan) != 0) + if(DoClan && strlen(LoadProfile.Clan) != 0) str_format(aClan, sizeof(aClan), "%s", LoadProfile.Clan); Label.VSplitLeft(90.0f, &FlagRect, &Label); @@ -3835,14 +3833,14 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); Label.HSplitTop(LineSize, &Section, &Label); - str_format(aTempBuf, sizeof(aTempBuf), Localize("Skin: %s"), (doSkin && strlen(LoadProfile.SkinName) != 0) ? LoadProfile.SkinName : pSkinName); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Skin: %s"), (DoSkin && strlen(LoadProfile.SkinName) != 0) ? LoadProfile.SkinName : pSkinName); Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - FlagRect.VSplitRight(50.f, nullptr, &FlagRect); - FlagRect.HSplitBottom(25.f, nullptr, &FlagRect); + FlagRect.VSplitRight(50.0f, nullptr, &FlagRect); + FlagRect.HSplitBottom(25.0f, nullptr, &FlagRect); FlagRect.y -= 10.0f; int RenderFlag = m_Dummy ? g_Config.m_ClDummyCountry : g_Config.m_PlayerCountry; - if(doFlag && LoadProfile.CountryFlag != -2) + if(DoFlag && LoadProfile.CountryFlag != -2) RenderFlag = LoadProfile.CountryFlag; m_pClient->m_CountryFlags.Render(RenderFlag, Color, FlagRect.x, FlagRect.y, FlagRect.w, FlagRect.h); @@ -3891,43 +3889,43 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) if(DoButton_Menu(&s_LoadButton, Localize("Load"), 0, &Button)) { - if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) + if(s_SelectedProfile != -1 && s_SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { - CProfile LoadProfile = GameClient()->m_SkinProfiles.m_Profiles[SelectedProfile]; + CProfile LoadProfile = GameClient()->m_SkinProfiles.m_Profiles[s_SelectedProfile]; if(!m_Dummy) { - if(doSkin && strlen(LoadProfile.SkinName) != 0) + if(DoSkin && strlen(LoadProfile.SkinName) != 0) str_copy(g_Config.m_ClPlayerSkin, LoadProfile.SkinName, sizeof(g_Config.m_ClPlayerSkin)); - if(doColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) + if(DoColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) { g_Config.m_ClPlayerColorBody = LoadProfile.BodyColor; g_Config.m_ClPlayerColorFeet = LoadProfile.FeetColor; } - if(doEmote && LoadProfile.Emote != -1) + if(DoEmote && LoadProfile.Emote != -1) g_Config.m_ClPlayerDefaultEyes = LoadProfile.Emote; - if(doName && strlen(LoadProfile.Name) != 0) + if(DoName && strlen(LoadProfile.Name) != 0) str_copy(g_Config.m_PlayerName, LoadProfile.Name, sizeof(g_Config.m_PlayerName)); - if(doClan && strlen(LoadProfile.Clan) != 0) + if(DoClan && strlen(LoadProfile.Clan) != 0) str_copy(g_Config.m_PlayerClan, LoadProfile.Clan, sizeof(g_Config.m_PlayerClan)); - if(doFlag && LoadProfile.CountryFlag != -2) + if(DoFlag && LoadProfile.CountryFlag != -2) g_Config.m_PlayerCountry = LoadProfile.CountryFlag; } else { - if(doSkin && strlen(LoadProfile.SkinName) != 0) + if(DoSkin && strlen(LoadProfile.SkinName) != 0) str_copy(g_Config.m_ClDummySkin, LoadProfile.SkinName, sizeof(g_Config.m_ClDummySkin)); - if(doColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) + if(DoColors && LoadProfile.BodyColor != -1 && LoadProfile.FeetColor != -1) { g_Config.m_ClDummyColorBody = LoadProfile.BodyColor; g_Config.m_ClDummyColorFeet = LoadProfile.FeetColor; } - if(doEmote && LoadProfile.Emote != -1) + if(DoEmote && LoadProfile.Emote != -1) g_Config.m_ClDummyDefaultEyes = LoadProfile.Emote; - if(doName && strlen(LoadProfile.Name) != 0) + if(DoName && strlen(LoadProfile.Name) != 0) str_copy(g_Config.m_ClDummyName, LoadProfile.Name, sizeof(g_Config.m_ClDummyName)); - if(doClan && strlen(LoadProfile.Clan) != 0) + if(DoClan && strlen(LoadProfile.Clan) != 0) str_copy(g_Config.m_ClDummyClan, LoadProfile.Clan, sizeof(g_Config.m_ClDummyClan)); - if(doFlag && LoadProfile.CountryFlag != -2) + if(DoFlag && LoadProfile.CountryFlag != -2) g_Config.m_ClDummyCountry = LoadProfile.CountryFlag; } } @@ -3940,13 +3938,13 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &Button)) { GameClient()->m_SkinProfiles.AddProfile( - doColors ? *pColorBody : -1, - doColors ? *pColorFeet : -1, - doFlag ? CurrentFlag : -2, - doEmote ? Emote : -1, - doSkin ? pSkinName : "", - doName ? aName : "", - doClan ? aClan : ""); + DoColors ? *pColorBody : -1, + DoColors ? *pColorFeet : -1, + DoFlag ? CurrentFlag : -2, + DoEmote ? Emote : -1, + DoSkin ? pSkinName : "", + DoName ? aName : "", + DoClan ? aClan : ""); GameClient()->m_SkinProfiles.SaveProfiles(); } LabelRight.HSplitTop(5.0f, nullptr, &LabelRight); @@ -3961,9 +3959,9 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) static CButtonContainer s_DeleteButton; if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &Button)) { - if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) + if(s_SelectedProfile != -1 && s_SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { - GameClient()->m_SkinProfiles.m_Profiles.erase(GameClient()->m_SkinProfiles.m_Profiles.begin() + SelectedProfile); + GameClient()->m_SkinProfiles.m_Profiles.erase(GameClient()->m_SkinProfiles.m_Profiles.begin() + s_SelectedProfile); GameClient()->m_SkinProfiles.SaveProfiles(); } } @@ -3973,16 +3971,16 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) static CButtonContainer s_OverrideButton; if(DoButton_Menu(&s_OverrideButton, Localize("Override"), 0, &Button)) { - if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) + if(s_SelectedProfile != -1 && s_SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { - GameClient()->m_SkinProfiles.m_Profiles[SelectedProfile] = CProfile( - doColors ? *pColorBody : -1, - doColors ? *pColorFeet : -1, - doFlag ? CurrentFlag : -2, - doEmote ? Emote : -1, - doSkin ? pSkinName : "", - doName ? aName : "", - doClan ? aClan : ""); + GameClient()->m_SkinProfiles.m_Profiles[s_SelectedProfile] = CProfile( + DoColors ? *pColorBody : -1, + DoColors ? *pColorFeet : -1, + DoFlag ? CurrentFlag : -2, + DoEmote ? Emote : -1, + DoSkin ? pSkinName : "", + DoName ? aName : "", + DoClan ? aClan : ""); GameClient()->m_SkinProfiles.SaveProfiles(); } } @@ -3997,7 +3995,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) std::vector *pProfileList = &GameClient()->m_SkinProfiles.m_Profiles; static CListBox s_ListBox; - s_ListBox.DoStart(50.0f, pProfileList->size(), 4, 3, SelectedProfile, &SelectorRect, true); + s_ListBox.DoStart(50.0f, pProfileList->size(), 4, 3, s_SelectedProfile, &SelectorRect, true); static bool s_Indexs[1024]; @@ -4013,7 +4011,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) const CSkin *pSkinToBeDraw = m_pClient->m_Skins.Find(RenderSkin); - CListboxItem Item = s_ListBox.DoNextItem(&s_Indexs[i], SelectedProfile >= 0 && (size_t)SelectedProfile == i); + CListboxItem Item = s_ListBox.DoNextItem(&s_Indexs[i], s_SelectedProfile >= 0 && (size_t)s_SelectedProfile == i); if(!Item.m_Visible) continue; @@ -4023,7 +4021,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) CTeeRenderInfo Info; Info.m_ColorBody = color_cast(ColorHSLA(CurrentProfile.BodyColor).UnclampLighting(ColorHSLA::DARKEST_LGT)); Info.m_ColorFeet = color_cast(ColorHSLA(CurrentProfile.FeetColor).UnclampLighting(ColorHSLA::DARKEST_LGT)); - Info.m_CustomColoredSkin = 1; + Info.m_CustomColoredSkin = true; Info.m_OriginalRenderSkin = pSkinToBeDraw->m_OriginalSkin; Info.m_ColorableRenderSkin = pSkinToBeDraw->m_ColorableSkin; Info.m_SkinMetrics = pSkinToBeDraw->m_Metrics; @@ -4035,7 +4033,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) Info.m_ColorFeet = ColorRGBA(1.0f, 1.0f, 1.0f); } - RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &Info, OffsetToMid); + CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &Info, OffsetToMid); int RenderEmote = CurrentProfile.Emote == -1 ? Emote : CurrentProfile.Emote; TeeRenderPos = vec2(Item.m_Rect.x + 30.0f, Item.m_Rect.y + Item.m_Rect.h / 2.0f + OffsetToMid.y); @@ -4043,7 +4041,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) Item.m_Rect.VSplitLeft(60.0f, nullptr, &Item.m_Rect); CUIRect PlayerRect, ClanRect, FeetColorSquare, BodyColorSquare; - Item.m_Rect.VSplitLeft(60.0f, nullptr, &BodyColorSquare); //Delete this maybe + Item.m_Rect.VSplitLeft(60.0f, nullptr, &BodyColorSquare); // Delete this maybe Item.m_Rect.VSplitRight(60.0f, &BodyColorSquare, &FlagRect); BodyColorSquare.x -= 11.0f; @@ -4096,9 +4094,9 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) } const int NewSelected = s_ListBox.DoEnd(); - if(SelectedProfile != NewSelected) + if(s_SelectedProfile != NewSelected) { - SelectedProfile = NewSelected; + s_SelectedProfile = NewSelected; } static CButtonContainer s_ProfilesFile; FileButton.VSplitLeft(130.0f, &FileButton, nullptr); diff --git a/src/game/client/components/outlines.cpp b/src/game/client/components/outlines.cpp index 43c90109166..9b9211c7585 100644 --- a/src/game/client/components/outlines.cpp +++ b/src/game/client/components/outlines.cpp @@ -50,8 +50,7 @@ void COutlines::OnRender() if(!pTiles) return; unsigned int Size = GameClient()->Layers()->Map()->GetDataSize(pTMap->m_Data); - if(IsGameLayer) - pGameTiles = pTiles; + pGameTiles = pTiles; if((g_Config.m_ClOutlineFreeze || g_Config.m_ClOutlineSolid || g_Config.m_ClOutlineUnFreeze) && IsGameLayer && Size >= (size_t)pTMap->m_Width * pTMap->m_Height * sizeof(CTile)) { if(g_Config.m_ClOutlineUnFreeze) diff --git a/src/game/client/components/player_indicator.cpp b/src/game/client/components/player_indicator.cpp index 0f5a2519217..72ec844db09 100644 --- a/src/game/client/components/player_indicator.cpp +++ b/src/game/client/components/player_indicator.cpp @@ -10,14 +10,14 @@ #include "player_indicator.h" -vec2 NormalizedDirection(vec2 src, vec2 dst) +static vec2 NormalizedDirection(vec2 Src, vec2 Dst) { - return normalize(vec2(dst.x - src.x, dst.y - src.y)); + return normalize(vec2(Dst.x - Src.x, Dst.y - Src.y)); } -float DistanceBetweenTwoPoints(vec2 src, vec2 dst) +static float DistanceBetweenTwoPoints(vec2 Src, vec2 Dst) { - return sqrt(pow(dst.x - src.x, 2) + pow(dst.y - src.y, 2)); + return sqrt(pow(Dst.x - Src.x, 2.0f) + pow(Dst.y - Src.y, 2.0f)); } void CPlayerIndicator::OnRender() @@ -36,7 +36,7 @@ void CPlayerIndicator::OnRender() return; Graphics()->TextureClear(); - ColorRGBA col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); + ColorRGBA Col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); if(!(m_pClient->m_Teams.Team(m_pClient->m_Snap.m_LocalClientId) == 0 && g_Config.m_ClIndicatorTeamOnly)) { for(int i = 0; i < MAX_CLIENTS; ++i) @@ -54,7 +54,7 @@ void CPlayerIndicator::OnRender() if(g_Config.m_ClPlayerIndicatorFreeze && !(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen)) continue; - vec2 norm = NormalizedDirection(m_pClient->m_aClients[i].m_RenderPos, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_RenderPos) * (-1); + vec2 Norm = NormalizedDirection(m_pClient->m_aClients[i].m_RenderPos, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_RenderPos) * (-1); float Offset = g_Config.m_ClIndicatorOffset; if(g_Config.m_ClIndicatorVariableDistance) @@ -63,7 +63,7 @@ void CPlayerIndicator::OnRender() std::min(DistanceBetweenTwoPoints(Position, OtherTee.m_RenderPos) / g_Config.m_ClIndicatorMaxDistance, 1.0f)); } - vec2 IndicatorPos(norm.x * Offset + Position.x, norm.y * Offset + Position.y); + vec2 IndicatorPos(Norm.x * Offset + Position.x, Norm.y * Offset + Position.y); CTeeRenderInfo TeeInfo = OtherTee.m_RenderInfo; float Alpha = g_Config.m_ClIndicatorOpacity / 100.0f; if(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen) @@ -72,40 +72,40 @@ void CPlayerIndicator::OnRender() if(pOtherCharacter->m_IsInFreeze == 0) { // player is on the way to get free again - col = color_cast(ColorHSLA(g_Config.m_ClIndicatorSaved)); + Col = color_cast(ColorHSLA(g_Config.m_ClIndicatorSaved)); } else { // player is frozen - col = color_cast(ColorHSLA(g_Config.m_ClIndicatorFreeze)); + Col = color_cast(ColorHSLA(g_Config.m_ClIndicatorFreeze)); } if(g_Config.m_ClIndicatorTees) { - TeeInfo.m_ColorBody.r *= 0.4; - TeeInfo.m_ColorBody.g *= 0.4; - TeeInfo.m_ColorBody.b *= 0.4; - TeeInfo.m_ColorFeet.r *= 0.4; - TeeInfo.m_ColorFeet.g *= 0.4; - TeeInfo.m_ColorFeet.b *= 0.4; - Alpha *= 0.8; + TeeInfo.m_ColorBody.r *= 0.4f; + TeeInfo.m_ColorBody.g *= 0.4f; + TeeInfo.m_ColorBody.b *= 0.4f; + TeeInfo.m_ColorFeet.r *= 0.4f; + TeeInfo.m_ColorFeet.g *= 0.4f; + TeeInfo.m_ColorFeet.b *= 0.4f; + Alpha *= 0.8f; } } else { - col = color_cast(ColorHSLA(g_Config.m_ClIndicatorAlive)); + Col = color_cast(ColorHSLA(g_Config.m_ClIndicatorAlive)); } - col.a = Alpha; + Col.a = Alpha; - TeeInfo.m_Size = g_Config.m_ClIndicatorRadius * 4.f; + TeeInfo.m_Size = g_Config.m_ClIndicatorRadius * 4.0f; if(g_Config.m_ClIndicatorTees) { - RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, OtherTee.m_RenderCur.m_Emote, vec2(1.0f, 0.0f), IndicatorPos, col.a); + RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, OtherTee.m_RenderCur.m_Emote, vec2(1.0f, 0.0f), IndicatorPos, Col.a); } else { Graphics()->QuadsBegin(); - Graphics()->SetColor(col); + Graphics()->SetColor(Col); Graphics()->DrawCircle(IndicatorPos.x, IndicatorPos.y, g_Config.m_ClIndicatorRadius, 16); Graphics()->QuadsEnd(); } diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 2d465981944..434daa546c3 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -439,7 +439,7 @@ void CPlayers::RenderPlayer( bool Local = m_pClient->m_Snap.m_LocalClientId == ClientId; bool OtherTeam = m_pClient->IsOtherTeam(ClientId); - //float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f; + // float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f; bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active; float Alpha = 1.0f; @@ -603,18 +603,18 @@ void CPlayers::RenderPlayer( // static position for hammer WeaponPosition = Position + vec2(State.GetAttach()->m_X, State.GetAttach()->m_Y); WeaponPosition.y += g_pData->m_Weapons.m_aId[CurrentWeapon].m_Offsety; - if(Direction.x < 0) + if(Direction.x < 0.0f) WeaponPosition.x -= g_pData->m_Weapons.m_aId[CurrentWeapon].m_Offsetx; if(IsSit) WeaponPosition.y += 3.0f; // set rotation - float QuadsRotation = -pi / 2; + float QuadsRotation = -pi / 2.0f; QuadsRotation += State.GetAttach()->m_Angle * (Direction.x < 0 ? -1 : 1) * pi * 2; if(g_Config.m_ClHammerRotatesWithCursor) { QuadsRotation += Angle; - if (Direction.x < 0) + if (Direction.x < 0.0f) QuadsRotation += pi; } else if(Inactive && LastAttackTime > m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon)) @@ -884,7 +884,6 @@ void CPlayers::RenderPlayerGhost( if(!OtherTeam && FrozenSwappingHide) Alpha = 1.0f; - // set size RenderInfo.m_Size = 64.0f; @@ -956,7 +955,7 @@ void CPlayers::RenderPlayerGhost( m_pClient->m_Flow.Add(Position, Vel * 100.0f, 10.0f); - RenderInfo.m_GotAirJump = Player.m_Jumped & 2 ? 0 : 1; + RenderInfo.m_GotAirJump = Player.m_Jumped & 2 ? false : true; RenderInfo.m_FeetFlipped = false; @@ -1413,7 +1412,7 @@ void CPlayers::OnRender() bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active; - //If we are frozen and hiding frozen ghosts and not swapping render only the regular player + // If we are frozen and hiding frozen ghosts and not swapping render only the regular player if(RenderGhost && g_Config.m_ClShowOthersGhosts && !Spec && Client()->State() != IClient::STATE_DEMOPLAYBACK) RenderPlayerGhost(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId); diff --git a/src/game/client/components/rainbow.cpp b/src/game/client/components/rainbow.cpp index 803df635d86..3a17fabc2d2 100644 --- a/src/game/client/components/rainbow.cpp +++ b/src/game/client/components/rainbow.cpp @@ -10,34 +10,34 @@ #include "rainbow.h" -void CRainbow::TransformColor(unsigned char mode, int tick, CTeeRenderInfo *pinfo) +void CRainbow::TransformColor(unsigned char Mode, int Tick, CTeeRenderInfo *pinfo) { - if(!mode) + if(!Mode) return; - int deftick = tick % 255; + int deftick = Tick % 255; const ColorHSLA playercolbody = ColorHSLA(g_Config.m_ClPlayerColorBody); const ColorHSLA playercolfeet = ColorHSLA(g_Config.m_ClPlayerColorFeet); - const ColorRGBA col = color_cast(ColorHSLA((float)deftick / 255.0f, 1.0f, 0.5f)); - if(mode == COLORMODE_RAINBOW) + const ColorRGBA Col = color_cast(ColorHSLA((float)deftick / 255.0f, 1.0f, 0.5f)); + if(Mode == COLORMODE_RAINBOW) { pinfo->m_CustomColoredSkin = true; - pinfo->m_ColorBody = col; - pinfo->m_ColorFeet = col; - pinfo->m_BloodColor = col; + pinfo->m_ColorBody = Col; + pinfo->m_ColorFeet = Col; + pinfo->m_BloodColor = Col; return; } - else if(mode == COLORMODE_PULSE) + else if(Mode == COLORMODE_PULSE) { pinfo->m_CustomColoredSkin = true; pinfo->m_ColorBody.s = 1.0f; pinfo->m_ColorFeet.s = 1.0f; pinfo->m_BloodColor.s = 1.0f; - pinfo->m_ColorBody.l = 0.5f + fabs(((float)deftick / 255.0f) - 0.5f); - pinfo->m_ColorFeet.l = 0.5f + fabs(((float)deftick / 255.0f) - 0.5f); - pinfo->m_BloodColor.l = 0.5f + fabs(((float)deftick / 255.0f) - 0.5f); + pinfo->m_ColorBody.l = 0.5f + std::fabs(((float)deftick / 255.0f) - 0.5f); + pinfo->m_ColorFeet.l = 0.5f + std::fabs(((float)deftick / 255.0f) - 0.5f); + pinfo->m_BloodColor.l = 0.5f + std::fabs(((float)deftick / 255.0f) - 0.5f); pinfo->m_ColorBody.h = (float)deftick / 255.0f; pinfo->m_ColorFeet.h = (float)deftick / 255.0f; @@ -45,7 +45,7 @@ void CRainbow::TransformColor(unsigned char mode, int tick, CTeeRenderInfo *pinf return; } - else if(mode == COLORMODE_DARKNESS) + else if(Mode == COLORMODE_DARKNESS) { pinfo->m_CustomColoredSkin = true; pinfo->m_ColorBody = ColorRGBA(0.0f, 0.0f, 0.0f); diff --git a/src/game/client/components/skinprofiles.cpp b/src/game/client/components/skinprofiles.cpp index 64b67fa98bb..484909da59f 100644 --- a/src/game/client/components/skinprofiles.cpp +++ b/src/game/client/components/skinprofiles.cpp @@ -67,31 +67,31 @@ bool CSkinProfiles::SaveProfiles() char aBuf[256]; char aBufTemp[128]; char aEscapeBuf[256]; - for(int i = 0; i < (int)m_Profiles.size(); ++i) + for(auto &m_Profile : m_Profiles) { str_copy(aBuf, "add_profile ", sizeof(aBuf)); - str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profiles[i].BodyColor); + str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profile.BodyColor); str_append(aBuf, aBufTemp, sizeof(aBuf)); - str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profiles[i].FeetColor); + str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profile.FeetColor); str_append(aBuf, aBufTemp, sizeof(aBuf)); - str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profiles[i].CountryFlag); + str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profile.CountryFlag); str_append(aBuf, aBufTemp, sizeof(aBuf)); - str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profiles[i].Emote); + str_format(aBufTemp, sizeof(aBufTemp), "%d ", m_Profile.Emote); str_append(aBuf, aBufTemp, sizeof(aBuf)); - EscapeParam(aEscapeBuf, m_Profiles[i].SkinName, sizeof(aEscapeBuf)); + EscapeParam(aEscapeBuf, m_Profile.SkinName, sizeof(aEscapeBuf)); str_format(aBufTemp, sizeof(aBufTemp), "\"%s\" ", aEscapeBuf); str_append(aBuf, aBufTemp, sizeof(aBuf)); - EscapeParam(aEscapeBuf, m_Profiles[i].Name, sizeof(aEscapeBuf)); + EscapeParam(aEscapeBuf, m_Profile.Name, sizeof(aEscapeBuf)); str_format(aBufTemp, sizeof(aBufTemp), "\"%s\" ", aEscapeBuf); str_append(aBuf, aBufTemp, sizeof(aBuf)); - EscapeParam(aEscapeBuf, m_Profiles[i].Clan, sizeof(aEscapeBuf)); + EscapeParam(aEscapeBuf, m_Profile.Clan, sizeof(aEscapeBuf)); str_format(aBufTemp, sizeof(aBufTemp), "\"%s\"", aEscapeBuf); str_append(aBuf, aBufTemp, sizeof(aBuf)); diff --git a/src/game/client/components/skinprofiles.h b/src/game/client/components/skinprofiles.h index a03b25aea26..05abf6fa3a5 100644 --- a/src/game/client/components/skinprofiles.h +++ b/src/game/client/components/skinprofiles.h @@ -45,4 +45,4 @@ class CSkinProfiles : public CComponent virtual int Sizeof() const override { return sizeof(*this); } virtual void OnInit() override; }; -#endif \ No newline at end of file +#endif diff --git a/src/game/client/components/tater.cpp b/src/game/client/components/tater.cpp index f865beeb9a2..f068e020298 100644 --- a/src/game/client/components/tater.cpp +++ b/src/game/client/components/tater.cpp @@ -26,115 +26,108 @@ void CTater::ConchainRandomColor(IConsole::IResult *pResult, void *pUserData, IC CTater *pThis = static_cast(pUserData); // resolve type to randomize // check length of type (0 = all, 1 = body, 2 = feet, 3 = skin, 4 = flag) - bool randomizeBody = false; - bool randomizeFeet = false; - bool randomizeSkin = false; - bool randomizeFlag = false; + bool RandomizeBody = false; + bool RandomizeFeet = false; + bool RandomizeSkin = false; + bool RandomizeFlag = false; if(pResult->NumArguments() == 0) { - randomizeBody = true; - randomizeFeet = true; - randomizeSkin = true; - randomizeFlag = true; + RandomizeBody = true; + RandomizeFeet = true; + RandomizeSkin = true; + RandomizeFlag = true; } else if(pResult->NumArguments() == 1) { - const char *type = pResult->GetString(0); - int length = type ? str_length(type) : 0; - if(length == 1 && type[0] == '0') - { // randomize all - randomizeBody = true; - randomizeFeet = true; - randomizeSkin = true; - randomizeFlag = true; + const char *Type = pResult->GetString(0); + int Length = Type ? str_length(Type) : 0; + if(Length == 1 && Type[0] == '0') + { // Randomize all + RandomizeBody = true; + RandomizeFeet = true; + RandomizeSkin = true; + RandomizeFlag = true; } - else if(length == 1) - { // randomize body - randomizeBody = type[0] == '1'; + else if(Length == 1) + { + // randomize body + RandomizeBody = Type[0] == '1'; } - else if(length == 2) + else if(Length == 2) { // check for body and feet - randomizeBody = type[0] == '1'; - randomizeFeet = type[1] == '1'; + RandomizeBody = Type[0] == '1'; + RandomizeFeet = Type[1] == '1'; } - else if(length == 3) + else if(Length == 3) { // check for body, feet and skin - randomizeBody = type[0] == '1'; - randomizeFeet = type[1] == '1'; - randomizeSkin = type[2] == '1'; + RandomizeBody = Type[0] == '1'; + RandomizeFeet = Type[1] == '1'; + RandomizeSkin = Type[2] == '1'; } - else if(length == 4) + else if(Length == 4) { // check for body, feet, skin and flag - randomizeBody = type[0] == '1'; - randomizeFeet = type[1] == '1'; - randomizeSkin = type[2] == '1'; - randomizeFlag = type[3] == '1'; + RandomizeBody = Type[0] == '1'; + RandomizeFeet = Type[1] == '1'; + RandomizeSkin = Type[2] == '1'; + RandomizeFlag = Type[3] == '1'; } } - if(randomizeBody) - { + if(RandomizeBody) RandomBodyColor(); - } - if(randomizeFeet) - { + if(RandomizeFeet) RandomFeetColor(); - } - if(randomizeSkin) - { + if(RandomizeSkin) RandomSkin(pUserData); - } - if(randomizeFlag) - { + if(RandomizeFlag) RandomFlag(pUserData); - } pThis->m_pClient->SendInfo(false); } void CTater::OnConsoleInit() { - Console()->Register("tc_random_player", "s[type]", CFGFLAG_CLIENT, ConRandomTee, this, "randomize player color (0 = all, 1 = body, 2 = feet, 3 = skin, 4 = flag) example: 0011 = randomize skin and flag [number is position] "); + Console()->Register("tc_random_player", "s[type]", CFGFLAG_CLIENT, ConRandomTee, this, "Randomize player color (0 = all, 1 = body, 2 = feet, 3 = skin, 4 = flag) example: 0011 = randomize skin and flag [number is position] "); Console()->Chain("tc_random_player", ConchainRandomColor, this); } void CTater::RandomBodyColor() { - g_Config.m_ClPlayerColorBody = ColorHSLA((std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, 1).Pack(false); + g_Config.m_ClPlayerColorBody = ColorHSLA((std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, 1.0f).Pack(false); } void CTater::RandomFeetColor() { - g_Config.m_ClPlayerColorFeet = ColorHSLA((std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, 1).Pack(false); + g_Config.m_ClPlayerColorFeet = ColorHSLA((std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, (std::rand() % 100) / 100.0f, 1.0f).Pack(false); } void CTater::RandomSkin(void *pUserData) { CTater *pThis = static_cast(pUserData); // get the skin count - int skinCount = (int)pThis->m_pClient->m_Skins.GetSkinsUnsafe().size(); + int SkinCount = (int)pThis->m_pClient->m_Skins.GetSkinsUnsafe().size(); // get a random skin number - int skinNumber = std::rand() % skinCount; + int SkinNumber = std::rand() % SkinCount; // get all skins as a maps - const std::unordered_map> &skins = pThis->m_pClient->m_Skins.GetSkinsUnsafe(); + const std::unordered_map> &Skins = pThis->m_pClient->m_Skins.GetSkinsUnsafe(); // map to array - int counter = 0; + int Counter = 0; std::vector> skinArray; - for(const auto &skin : skins) + for(const auto &Skin : Skins) { - if(counter == skinNumber) + if(Counter == SkinNumber) { // set the skin name - const char *skinName = skin.first.data(); - str_copy(g_Config.m_ClPlayerSkin, skinName, sizeof(g_Config.m_ClPlayerSkin)); + const char *SkinName = Skin.first.data(); + str_copy(g_Config.m_ClPlayerSkin, SkinName, sizeof(g_Config.m_ClPlayerSkin)); } - counter++; + Counter++; } } @@ -142,14 +135,14 @@ void CTater::RandomFlag(void *pUserData) { CTater *pThis = static_cast(pUserData); // get the flag count - int flagCount = pThis->m_pClient->m_CountryFlags.Num(); + int FlagCount = pThis->m_pClient->m_CountryFlags.Num(); // get a random flag number - int flagNumber = std::rand() % flagCount; + int FlagNumber = std::rand() % FlagCount; // get the flag name - const CCountryFlags::CCountryFlag *pFlag = pThis->m_pClient->m_CountryFlags.GetByIndex(flagNumber); + const CCountryFlags::CCountryFlag *pFlag = pThis->m_pClient->m_CountryFlags.GetByIndex(FlagNumber); // set the flag code as number g_Config.m_PlayerCountry = pFlag->m_CountryCode; -} \ No newline at end of file +} diff --git a/src/game/client/components/verify.cpp b/src/game/client/components/verify.cpp index 571c6181278..3f2c0aa6098 100644 --- a/src/game/client/components/verify.cpp +++ b/src/game/client/components/verify.cpp @@ -41,12 +41,12 @@ void CVerify::OnRender() } else { - unsigned char *cChar[128]; - size_t cSize[128]; - pGet->Result(cChar, cSize); + unsigned char *ppResult[128]; + size_t pResultLength[128]; + pGet->Result(ppResult, pResultLength); dbg_msg("verify", "Verified client! Took %d ms", (int)Time.count()); verified = true; } return; } -} \ No newline at end of file +} diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 349dceb47e5..0b0524773a4 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2267,7 +2267,7 @@ void CGameClient::OnPredict() { m_PredictedChar = pLocalChar->GetCore(); } - if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0)) + if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0)) { for(int i = 0; i < MAX_CLIENTS; i++) if(CCharacter *pChar = m_PredictedWorld.GetCharacterById(i)) @@ -2325,10 +2325,8 @@ void CGameClient::OnPredict() // Remove other tees to reduce lag and because they aren't really important in this case for(int i = 0; i < MAX_CLIENTS; i++) if(i != m_Snap.m_LocalClientId) - if (CCharacter* pDelChar = m_ExtraPredictedWorld.GetCharacterById(i)) + if(CCharacter *pDelChar = m_ExtraPredictedWorld.GetCharacterById(i)) pDelChar->Destroy(); - - CCharacter *pExtraChar = m_ExtraPredictedWorld.GetCharacterById(m_Snap.m_LocalClientId); if(pExtraChar) @@ -2351,7 +2349,7 @@ void CGameClient::OnPredict() m_ExtraPredictedWorld.m_GameTick++; m_ExtraPredictedWorld.Tick(); } - else + else { pExtraChar->m_AliveAccumulation = std::max(pExtraChar->m_AliveAccumulation, 1); pExtraChar->m_AliveAccumulation = std::min(pExtraChar->m_AliveAccumulation + 1, g_Config.m_ClUnfreezeLagDelayTicks); @@ -3288,7 +3286,7 @@ vec2 CGameClient::GetSmoothPos(int ClientId) Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount); if(ClientId != m_Snap.m_LocalClientId && !g_Config.m_ClFastInputOthers && g_Config.m_ClFastInput) - SmoothTick -= 1; + SmoothTick -= 1; if(SmoothTick > 0 && m_aClients[ClientId].m_aPredTick[(SmoothTick - 1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientId].m_aPredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy)) Pos[i] = mix(m_aClients[ClientId].m_aPredPos[(SmoothTick - 1) % 200][i], m_aClients[ClientId].m_aPredPos[SmoothTick % 200][i], SmoothIntra); @@ -3306,8 +3304,8 @@ vec2 CGameClient::GetFreezePos(int ClientId) for(int i = 0; i < 2; i++) { - //int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq()); - //int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i]; + // int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq()); + // int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i]; float MixAmount = 0.0f; int SmoothTick; float SmoothIntra; @@ -3327,17 +3325,11 @@ vec2 CGameClient::GetFreezePos(int ClientId) AdjustTicks = std::min(FreezeTime, AdjustTicks); } if(g_Config.m_ClRemoveAnti && pChar && AdjustTicks > 0 && FreezeTime > 0) - { MixAmount = mix(0.0f, 1.0f, 1.0f - AdjustTicks / (float)DelayTicks); - } - //else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId) - //{ + // else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId) // MixAmount = 1.f - std::pow(1.f - TimePassed / (float)Len, 1.2f); - //} else // our tee when not frozen - { MixAmount = 1.f; - } Client()->GetSmoothFreezeTick(&SmoothTick, &SmoothIntra, MixAmount); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index fcff3078c2d..a6f42a439db 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -25,6 +25,7 @@ // components #include "components/background.h" #include "components/binds.h" +#include "components/bindwheel.h" #include "components/broadcast.h" #include "components/camera.h" #include "components/chat.h" @@ -48,25 +49,23 @@ #include "components/menus.h" #include "components/motd.h" #include "components/nameplates.h" +#include "components/outlines.h" #include "components/particles.h" #include "components/player_indicator.h" -#include "components/verify.h" -#include "components/bindwheel.h" -#include "components/tater.h" -#include "components/outlines.h" #include "components/players.h" #include "components/race_demo.h" #include "components/rainbow.h" #include "components/scoreboard.h" +#include "components/skinprofiles.h" #include "components/skins.h" #include "components/skins7.h" #include "components/sounds.h" #include "components/spectator.h" #include "components/statboard.h" +#include "components/tater.h" #include "components/tooltips.h" +#include "components/verify.h" #include "components/voting.h" -#include "components/skinprofiles.h" - class CGameInfo { @@ -154,11 +153,11 @@ class CGameClient : public IGameClient CStatboard m_Statboard; CSounds m_Sounds; CEmoticon m_Emoticon; - CBindWheel m_Bindwheel; - CTater m_Tater; + CBindWheel m_Bindwheel; + CTater m_Tater; CDamageInd m_DamageInd; CVoting m_Voting; - CVerify m_Verify; + CVerify m_Verify; CSpectator m_Spectator; CPlayers m_Players; @@ -177,7 +176,7 @@ class CGameClient : public IGameClient CMapSounds m_MapSounds; CRaceDemo m_RaceDemo; - CRainbow m_Rainbow; + CRainbow m_Rainbow; CGhost m_Ghost; CTooltips m_Tooltips; diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index d4f7c8eb11d..bc0d415537f 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -980,11 +980,10 @@ void CCharacter::DDRaceTick() m_AliveAccumulation = std::min(m_AliveAccumulation - 1, 0); m_AliveAccumulation = std::max(m_AliveAccumulation, -g_Config.m_ClUnfreezeLagDelayTicks); } - else + else { m_AliveAccumulation = std::max(m_AliveAccumulation, 1); m_AliveAccumulation = std::min(m_AliveAccumulation + 1, g_Config.m_ClUnfreezeLagDelayTicks); - } HandleTuneLayer(); @@ -1004,7 +1003,8 @@ void CCharacter::DDRaceTick() break; } } - if (m_Core.m_IsInFreeze && IsGrounded()) { + if(m_Core.m_IsInFreeze && IsGrounded()) + { m_FreezeAccumulation = std::min(m_FreezeAccumulation + 1, g_Config.m_ClUnfreezeLagDelayTicks); } else diff --git a/src/game/client/render_map.cpp b/src/game/client/render_map.cpp index dbcef3100fe..94a380636c4 100644 --- a/src/game/client/render_map.cpp +++ b/src/game/client/render_map.cpp @@ -667,7 +667,7 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, Color Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1); } -int ClampedIndex(int x, int y, int w, int h) +int ClampedIndex(int x, int y, int w, int h) { x = std::clamp(x, 0, w - 1); y = std::clamp(y, 0, h - 1); @@ -686,7 +686,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca int MaxScale = 12; if(EndX - StartX > Graphics()->ScreenWidth() / MaxScale || EndY - StartY > Graphics()->ScreenHeight() / MaxScale) { - int EdgeX = (EndX - StartX)-(Graphics()->ScreenWidth() / MaxScale); + int EdgeX = (EndX - StartX) - (Graphics()->ScreenWidth() / MaxScale); StartX += EdgeX / 2; EndX -= EdgeX / 2; int EdgeY = (EndY - StartY) - (Graphics()->ScreenHeight() / MaxScale); @@ -695,21 +695,17 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca } Graphics()->TextureClear(); Graphics()->QuadsBegin(); - ColorRGBA col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); - if (TileType == TILE_FREEZE) { - col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorFreeze)); - } + ColorRGBA Col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); + if(TileType == TILE_FREEZE) + Col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorFreeze)); else if(TileType == TILE_SOLID) - { - col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorSolid)); - } + Col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorSolid)); else if(TileType == TILE_UNFREEZE) - { - col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorUnfreeze)); - } - Graphics()->SetColor(col.r, col.g, col.b, Alpha); + Col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorUnfreeze)); + Graphics()->SetColor(Col.r, Col.g, Col.b, Alpha); for(int y = StartY; y < EndY; y++) + { for(int x = StartX; x < EndX; x++) { int mx = x; @@ -722,7 +718,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca bool IsUnFreeze = Index == TILE_UNFREEZE || Index == TILE_DUNFREEZE; bool IsSolid = Index == TILE_SOLID || Index == TILE_NOHOOK; - if(!(IsSolid || IsFreeze || IsUnFreeze)) //Not an tile we care about + if(!(IsSolid || IsFreeze || IsUnFreeze)) // Not an tile we care about continue; if(IsSolid && !(TileType == TILE_SOLID)) continue; @@ -736,7 +732,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca if(IsFreeze && TileType == TILE_FREEZE) { int IndexN; - + IndexN = pTiles[ClampedIndex(mx - 1, my - 1, w, h)].m_Index; Neighbors[0] = IndexN == TILE_AIR || IndexN == TILE_UNFREEZE || IndexN == TILE_DUNFREEZE; IndexN = pTiles[ClampedIndex(mx - 0, my - 1, w, h)].m_Index; @@ -795,11 +791,10 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Neighbors[7] = IndexN != TILE_UNFREEZE && IndexN != TILE_DUNFREEZE; } - float Size = (float)g_Config.m_ClOutlineWidth; int NumQuads = 0; - //Do lonely corners first + // Do lonely corners first if(Neighbors[0] && !Neighbors[1] && !Neighbors[3]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale, Size, Size); @@ -820,19 +815,19 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Array[NumQuads] = IGraphics::CQuadItem(mx * Scale + Scale - Size, my * Scale + Scale - Size, Size, Size); NumQuads++; } - //Top + // Top if(Neighbors[1]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale, Scale, Size); NumQuads++; } - //Bottom + // Bottom if(Neighbors[6]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale + Scale - Size, Scale, Size); NumQuads++; } - //Left + // Left if(Neighbors[3]) { if(!Neighbors[1] && !Neighbors[6]) @@ -845,7 +840,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale + Size, Size, Scale - Size * 2.0f); NumQuads++; } - //Right + // Right if(Neighbors[4]) { if(!Neighbors[1] && !Neighbors[6]) @@ -859,9 +854,9 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca NumQuads++; } - Graphics()->QuadsDrawTL(Array, NumQuads); } + } Graphics()->QuadsEnd(); Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1); } @@ -889,8 +884,8 @@ void CRenderTools::RenderTeleOutlines(CTile *pTiles, CTeleTile *pTele, int w, in Graphics()->TextureClear(); Graphics()->QuadsBegin(); - ColorRGBA col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorTele)); - Graphics()->SetColor(col.r, col.g, col.b, Alpha); + ColorRGBA Col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorTele)); + Graphics()->SetColor(Col.r, Col.g, Col.b, Alpha); for(int y = StartY; y < EndY; y++) for(int x = StartX; x < EndX; x++) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 00ccfadc6df..6cf0e3d488a 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -503,7 +503,7 @@ void CCharacter::FireWeapon() { auto *pTarget = static_cast(apEnts[i]); - //if ((pTarget == this) || Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) + // if ((pTarget == this) || Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) if((pTarget == this || (pTarget->IsAlive() && !CanCollide(pTarget->GetPlayer()->GetCid())))) continue; @@ -553,15 +553,15 @@ void CCharacter::FireWeapon() new CProjectile( GameWorld(), - WEAPON_GUN, //Type - m_pPlayer->GetCid(), //Owner - ProjStartPos, //Pos - Direction, //Dir - Lifetime, //Span - false, //Freeze - false, //Explosive - -1, //SoundImpact - MouseTarget //InitDir + WEAPON_GUN, // Type + m_pPlayer->GetCid(), // Owner + ProjStartPos, // Pos + Direction, // Dir + Lifetime, // Span + false, // Freeze + false, // Explosive + -1, // SoundImpact + MouseTarget // InitDir ); GameServer()->CreateSound(m_Pos, SOUND_GUN_FIRE, TeamMask()); // NOLINT(clang-analyzer-unix.Malloc) @@ -584,14 +584,14 @@ void CCharacter::FireWeapon() new CProjectile( GameWorld(), - WEAPON_GRENADE, //Type - m_pPlayer->GetCid(), //Owner - ProjStartPos, //Pos - Direction, //Dir - Lifetime, //Span - false, //Freeze - true, //Explosive - SOUND_GRENADE_EXPLODE, //SoundImpact + WEAPON_GRENADE, // Type + m_pPlayer->GetCid(), // Owner + ProjStartPos, // Pos + Direction, // Dir + Lifetime, // Span + false, // Freeze + true, // Explosive + SOUND_GRENADE_EXPLODE, // SoundImpact MouseTarget // MouseTarget ); @@ -634,7 +634,7 @@ void CCharacter::FireWeapon() void CCharacter::HandleWeapons() { - //ninja + // ninja HandleNinja(); HandleJetpack(); @@ -825,7 +825,7 @@ void CCharacter::TickDeferred() m_ReckoningCore.Quantize(); } - //lastsentcore + // lastsentcore vec2 StartPos = m_Core.m_Pos; vec2 StartVel = m_Core.m_Vel; bool StuckBefore = Collision()->TestBox(m_Core.m_Pos, CCharacterCore::PhysicalSizeVec2()); @@ -1019,7 +1019,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon) return true; } -//TODO: Move the emote stuff to a function +// TODO: Move the emote stuff to a function void CCharacter::SnapCharacter(int SnappingClient, int Id) { int SnappingClientVersion = GameServer()->GetClientVersion(SnappingClient); @@ -1492,7 +1492,7 @@ void CCharacter::SetTimeCheckpoint(int TimeCheckpoint) void CCharacter::HandleTiles(int Index) { int MapIndex = Index; - //int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); + // int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); m_TileIndex = Collision()->GetTileIndex(MapIndex); m_TileFIndex = Collision()->GetFTileIndex(MapIndex); m_MoveRestrictions = Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex);