diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 716c94305bb..b481c44a892 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -28,11 +28,6 @@ #include #include #include -#include -#include -#include -#include - #include #include #include diff --git a/src/engine/client/client.h b/src/engine/client/client.h index d2c6b12e665..4fa118a8fcd 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -390,7 +390,7 @@ class CClient : public IClient, public CDemoPlayer::IListener void RequestInfclassInfo() override; void ResetInfclassInfoTask(); void LoadInfclassInfo(); - + bool IsSixup() const override { return m_Sixup; } const NETADDR &ServerAddress() const override { return *m_aNetClient[CONN_MAIN].ServerAddress(); } diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 8d01dd1e92d..206338a5f41 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -630,7 +630,7 @@ static int TranslateKeyEventKey(const SDL_KeyboardEvent &KeyEvent) } #endif - if (g_Config.m_ClReplaceEscapeKey && Key == g_Config.m_ClReplaceEscapeKey) + if(g_Config.m_ClReplaceEscapeKey && Key == g_Config.m_ClReplaceEscapeKey) { Key = KEY_ESCAPE; } diff --git a/src/engine/client/notifications.cpp b/src/engine/client/notifications.cpp index cb39b5c0181..2bda7448a0c 100644 --- a/src/engine/client/notifications.cpp +++ b/src/engine/client/notifications.cpp @@ -1,6 +1,7 @@ #include "notifications.h" #include + #include #if defined(CONF_PLATFORM_MACOS) diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 1dccfcb24b3..fc42773f152 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -1544,13 +1544,12 @@ void CServerBrowser::LoadDDNetServers() vCommunities.insert( vCommunities.end(), Communities.u.array.values, - Communities.u.array.values + Communities.u.array.length - ); + Communities.u.array.values + Communities.u.array.length); } } if(m_CustomCommunitiesFunction) m_CustomCommunitiesFunction(vCommunities); - + for(unsigned CommunityIndex = 0; CommunityIndex < vCommunities.size(); ++CommunityIndex) { const json_value &Community = *vCommunities[CommunityIndex]; diff --git a/src/engine/server/main.cpp b/src/engine/server/main.cpp index e7ebdb6ff24..3d01ee8c52e 100644 --- a/src/engine/server/main.cpp +++ b/src/engine/server/main.cpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include diff --git a/src/game/classes.h b/src/game/classes.h index 53d01267510..2fbde01dddd 100644 --- a/src/game/classes.h +++ b/src/game/classes.h @@ -5,7 +5,7 @@ enum PLAYERCLASS { PLAYERCLASS_INVALID = -1, PLAYERCLASS_NONE = 0, - + START_HUMANCLASS, PLAYERCLASS_MERCENARY, PLAYERCLASS_MEDIC, @@ -18,7 +18,7 @@ enum PLAYERCLASS PLAYERCLASS_BIOLOGIST, PLAYERCLASS_LOOPER, END_HUMANCLASS, - + START_INFECTEDCLASS, PLAYERCLASS_SMOKER, PLAYERCLASS_BOOMER, @@ -33,7 +33,7 @@ enum PLAYERCLASS PLAYERCLASS_UNDEAD, PLAYERCLASS_TANK, END_INFECTEDCLASS, - + NB_PLAYERCLASS, NB_HUMANCLASS = END_HUMANCLASS - START_HUMANCLASS - 1, NB_INFECTEDCLASS = END_INFECTEDCLASS - START_INFECTEDCLASS - 1, diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index f8a094c0b60..33bfb42c75d 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -1188,11 +1188,11 @@ void CChat::OnRender() { Graphics()->TextureClear(); int yy = y - 1.0f; - int ContainerIndex = Graphics()->CreateRectQuadContainer(x/2, yy/2, Width - 189.0f, 2.5f*ScaledFontSize, MessageRounding(), IGraphics::CORNER_ALL); + int ContainerIndex = Graphics()->CreateRectQuadContainer(x / 2, yy / 2, Width - 189.0f, 2.5f * ScaledFontSize, MessageRounding(), IGraphics::CORNER_ALL); if(0 != -1) { Graphics()->SetColor(color_cast(ColorHSLA(g_Config.m_ClChatBackgroundColor, true))); - Graphics()->RenderQuadContainerEx(ContainerIndex, 0, -1, x/2, yy/2); + Graphics()->RenderQuadContainerEx(ContainerIndex, 0, -1, x / 2, yy / 2); } } diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 2544b143268..7b3469b4e4f 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -1095,9 +1095,10 @@ void CGameConsole::OnRender() Ui()->MapScreen(); int ExtraHeight = 0; - if (g_Config.m_ClOldClientConsole >= 1) + if(g_Config.m_ClOldClientConsole >= 1) ExtraHeight = 10; - if (g_Config.m_ClOldClientConsole >= 2) { + if(g_Config.m_ClOldClientConsole >= 2) + { // do background Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CONSOLE_BG].m_Id); Graphics()->QuadsBegin(); @@ -1108,7 +1109,9 @@ void CGameConsole::OnRender() IGraphics::CQuadItem QuadItem(0, 0, Screen.w, ConsoleHeight + ExtraHeight); Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->QuadsEnd(); - } else { + } + else + { // background Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BACKGROUND_NOISE].m_Id); Graphics()->QuadsBegin(); @@ -1127,7 +1130,8 @@ void CGameConsole::OnRender() Graphics()->QuadsDrawTL(&QuadItemBorder, 1); Graphics()->QuadsEnd(); - if (g_Config.m_ClOldClientConsole >= 1) { + if(g_Config.m_ClOldClientConsole >= 1) + { // do console shadow Graphics()->TextureClear(); Graphics()->QuadsBegin(); @@ -1162,7 +1166,9 @@ void CGameConsole::OnRender() IGraphics::CQuadItem QuadItemBar(0, ConsoleHeight, Screen.w, 10.0f); Graphics()->QuadsDrawTL(&QuadItemBar, 1); Graphics()->QuadsEnd(); - } else { + } + else + { // bottom shadow Graphics()->TextureClear(); Graphics()->QuadsBegin(); diff --git a/src/game/client/components/effects.cpp b/src/game/client/components/effects.cpp index f3e1d0d0796..2b749b50dd2 100644 --- a/src/game/client/components/effects.cpp +++ b/src/game/client/components/effects.cpp @@ -49,11 +49,12 @@ void CEffects::AirJump(vec2 Pos, float Alpha) void CEffects::LaserBounce(vec2 Pos, float Alpha, unsigned int Color) { - if (!g_Config.m_ClExtraParticles) + if(!g_Config.m_ClExtraParticles) return; CParticle p; - for (int i = 0; i < 3; i++) { + for(int i = 0; i < 3; i++) + { p.SetDefault(); p.m_Spr = SPRITE_PART_HIT01; p.m_Pos = Pos + vec2(-6.0f, 16.0f); @@ -296,7 +297,8 @@ void CEffects::PlayerDeath(vec2 Pos, int ClientId, float Alpha) } // Pointer31's - if (g_Config.m_ClBloodParticles) { + if(g_Config.m_ClBloodParticles) + { for(int i = 0; i < 64; i++) { CParticle p; @@ -401,13 +403,13 @@ void CEffects::Explosion(vec2 Pos, float Alpha) p.m_StartAlpha = Alpha; GameClient()->m_Particles.Add(CParticles::GROUP_EXPLOSIONS, &p); - if (g_Config.m_ClExtraParticles) + if(g_Config.m_ClExtraParticles) for(int i = 0; i < 14; i++) { p.SetDefault(); p.m_Spr = SPRITE_PART_SMOKE; // SPRITE_PART_AIRJUMP p.m_Pos = Pos + random_direction() * (random_float(0.0f, 1.0f) * 32.0f); - p.m_Vel = {0,0}; + p.m_Vel = {0, 0}; p.m_LifeSpan = random_float(1.5f, 1.7f); p.m_StartSize = random_float(28.0f, 35.0f); p.m_EndSize = random_float(28.0f, 35.0f); @@ -418,7 +420,7 @@ void CEffects::Explosion(vec2 Pos, float Alpha) p.m_StartAlpha = p.m_Color.a; p.m_EndAlpha = 0.0f; p.m_UseAlphaFading = true; - if (Collision()->CheckPoint(p.m_Pos)) + if(Collision()->CheckPoint(p.m_Pos)) GameClient()->m_Particles.Add(CParticles::GROUP_EXPLOSIONS, &p); } @@ -491,7 +493,7 @@ void CEffects::Snow(vec2 Pos, float Alpha) p.SetDefault(); p.m_Spr = SPRITE_PART_SNOWFLAKE; p.m_Pos = Pos + vec2(random_float(-120.0f, 120.0f), random_float(-100.5f, 30.0f)) * Size; - if (Collision()->CheckPoint(p.m_Pos)) + if(Collision()->CheckPoint(p.m_Pos)) return; p.m_Vel = vec2(random_float(-50.0f, -10.0f), 50); p.m_LifeSpan = 8.5f; @@ -511,7 +513,6 @@ void CEffects::Snow(vec2 Pos, float Alpha) GameClient()->m_Particles.Add(CParticles::GROUP_EXTRA, &p); } - void CEffects::OnRender() { float Speed = 1.0f; diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index d6066c01b31..446b2d1c41b 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -872,12 +872,12 @@ void CHud::RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter) Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, m_aAmmoOffset[CurWeapon] + QuadOffsetSixup, Ammo); } - if (pCharacter->m_AmmoCount == -1) + if(pCharacter->m_AmmoCount == -1) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_SYMBOL_INFINITE].m_Id); Graphics()->QuadsBegin(); Graphics()->SetColor(vec4(1.0f, 1.0f, 1.0f, 1.0)); - IGraphics::CQuadItem QuadItemBackground(18.0f, AmmoOffsetY+3, 16, 16); + IGraphics::CQuadItem QuadItemBackground(18.0f, AmmoOffsetY + 3, 16, 16); Graphics()->QuadsDrawTL(&QuadItemBackground, 1); Graphics()->QuadsEnd(); } diff --git a/src/game/client/components/infc_binds.cpp b/src/game/client/components/infc_binds.cpp index 81cb4ef655f..c6808177d16 100644 --- a/src/game/client/components/infc_binds.cpp +++ b/src/game/client/components/infc_binds.cpp @@ -1,6 +1,7 @@ #include "infc_binds.h" #include + #include void CInfCBinds::OnConsoleInit() @@ -9,7 +10,7 @@ void CInfCBinds::OnConsoleInit() IConfigManager *pConfigManager = Kernel()->RequestInterface(); if(pConfigManager) pConfigManager->RegisterCallback(ConfigSaveCallback, this); - + Console()->Register("infc_bind", "s[key] ?r[command]", CFGFLAG_CLIENT, ConBind, this, "Bind key to execute a command or view keybindings"); Console()->Register("infc_binds", "?s[key]", CFGFLAG_CLIENT, ConBinds, this, "Print command executed by this keybindind or all binds"); Console()->Register("infc_unbind", "s[key]", CFGFLAG_CLIENT, ConUnbind, this, "Unbind key"); @@ -40,7 +41,7 @@ void CInfCBinds::ConfigSaveCallback(IConfigManager *pConfigManager, void *pUserD char *pBuf = pSelf->GetKeyBindCommand(Modifier, Key); char pBuf2[128]; - str_format(pBuf2, sizeof(pBuf2), "infc_%s", pBuf); + str_format(pBuf2, sizeof(pBuf2), "infc_%s", pBuf); pConfigManager->WriteLine(pBuf2, InfclassConfigDomainId()); free(pBuf); } diff --git a/src/game/client/components/infc_commands.cpp b/src/game/client/components/infc_commands.cpp index 18f530a418e..37e180e179d 100644 --- a/src/game/client/components/infc_commands.cpp +++ b/src/game/client/components/infc_commands.cpp @@ -1,12 +1,12 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ -#include +#include "infc_commands.h" #include #include -#include "infc_commands.h" +#include static const int LocationsCount = static_cast(CInfCCommands::ELocation::Count); static const char *gs_pLocationNames[LocationsCount] = { diff --git a/src/game/client/components/infomessages.cpp b/src/game/client/components/infomessages.cpp index 07c7f9a22aa..5b929492651 100644 --- a/src/game/client/components/infomessages.cpp +++ b/src/game/client/components/infomessages.cpp @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include static constexpr float ROW_HEIGHT = 46.0f; static constexpr float FONT_SIZE = 36.0f; diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 09cbc7d96ac..bc488071221 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -126,7 +126,7 @@ int CMenus::DoButton_Menu(CButtonContainer *pButtonContainer, const char *pText, if(Checked) Color = ColorRGBA(0.6f, 0.6f, 0.6f, 0.5f); - if (Color.r == 1.0f && Color.g == 1.0f && Color.b == 1.0f) + if(Color.r == 1.0f && Color.g == 1.0f && Color.b == 1.0f) Color = ColorRGBA(ms_GuiColorButtons.r, ms_GuiColorButtons.g, ms_GuiColorButtons.b, Color.a); Color.a *= Ui()->ButtonColorMul(pButtonContainer); @@ -749,7 +749,7 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState) Box.VSplitLeft(BrowserButtonWidth, &Button, &Box); const int Page = PAGE_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex; const char *pName = pCommunity->Name(); - + if(g_Config.m_ClEnableCommunities == 0) { if(str_comp(pCommunity->Id(), IServerBrowser::COMMUNITY_DDNET) == 0) @@ -761,13 +761,13 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState) pName = "KoG"; } } - + if(DoButton_MenuTab(&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], pName, ActivePage == Page, &Button, IGraphics::CORNER_T, &m_aAnimatorsBigPage[BIT_TAB_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex], nullptr, nullptr, nullptr, 10.0f, m_CommunityIcons.Find(pCommunity->Id()))) { NewPage = Page; } GameClient()->m_Tooltips.DoToolTip(&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], &Button, pCommunity->Name()); - + ++FavoriteCommunityIndex; if(FavoriteCommunityIndex >= std::size(s_aFavoriteCommunityButtons)) break; @@ -1177,13 +1177,13 @@ void CMenus::Render() { RenderBackground(); } - if (g_Config.m_UiColorMainMenu) + if(g_Config.m_UiColorMainMenu) { ms_ColorTabbarInactive = ms_ColorTabbarInactiveIngame; ms_ColorTabbarActive = ms_ColorTabbarActiveIngame; ms_ColorTabbarHover = ms_ColorTabbarHoverIngame; ms_GuiColorButtons = color_cast(ColorHSLA(g_Config.m_UiColorButtons, true)); - if (g_Config.m_UiColorMainMenu == 1) + if(g_Config.m_UiColorMainMenu == 1) { ms_ColorTabbarInactive.a = ms_ColorTabbarInactiveOutgame.a; ms_ColorTabbarActive.a = ms_ColorTabbarActiveOutgame.a; diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index a23b835d604..5ccc8691937 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -870,7 +870,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView, bool UpdateScroll) for(int i = pOption->m_IsSubheader ? 1 : 0; i < pOption->m_Depth; i++) Item.m_Rect.VSplitLeft(10.0f, 0, &Item.m_Rect); Item.m_Rect.VMargin(2.0f, &Label); - + Ui()->DoLabel(&Label, pOption->m_aDescription, 13.0f, TEXTALIGN_ML); } diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index c0f013984b4..7e7f910a5d4 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -309,7 +309,6 @@ void CMenus::RenderSettingsDuckClient(CUIRect MainView) static CButtonContainer s_UiColorButtonsResetId; DoLine_ColorPicker(&s_UiColorButtonsResetId, 25.0f, 13.0f, 2.0f, &Left, Localize("Button Color"), &g_Config.m_UiColorButtons, color_cast(ColorHSLA(0xFFFFFFFF, true)), false, nullptr, true); - Left.HSplitTop(VerticalSpacing, nullptr, &Left); Left.HSplitTop(20.0f, &Button, &Left); Ui()->DoScrollbarOption(&g_Config.m_UiColorMainMenu, &g_Config.m_UiColorMainMenu, &Button, Localize("UI color on main menu"), 0, 2, &CUi::ms_LinearScrollbarScale, CUi::SCROLLBAR_OPTION_NOCLAMPVALUE, ""); @@ -322,14 +321,11 @@ void CMenus::RenderSettingsDuckClient(CUIRect MainView) Left.HSplitTop(20.0f, &Button, &Left); Ui()->DoScrollbarOption(&g_Config.m_ClScoreboardShorten, &g_Config.m_ClScoreboardShorten, &Button, Localize("Shorten Scoreboard"), 0, 2, &CUi::ms_LinearScrollbarScale, CUi::SCROLLBAR_OPTION_NOCLAMPVALUE, ""); - // miscellaneous Left.HSplitTop(40.0f, &Label, &Left); Left.HSplitTop(30.0f, &Label, &Left); Ui()->DoLabel(&Label, Localize("Miscellaneous"), 20.0f, TEXTALIGN_ML); - - Left.HSplitTop(VerticalSpacing, nullptr, &Left); Left.HSplitTop(20.0f, &Button, &Left); if(DoButton_CheckBox(&g_Config.m_ClOldDoorLaser, Localize("Old door laser"), g_Config.m_ClOldDoorLaser, &Button)) @@ -352,7 +348,7 @@ void CMenus::RenderSettingsDuckClient(CUIRect MainView) Left.HSplitTop(VerticalSpacing, nullptr, &Left); Left.HSplitTop(20.0f, &Button, &Left); - if (g_Config.m_ClConfirmKillTime != -1) + if(g_Config.m_ClConfirmKillTime != -1) str_copy(aBuf, Localize("s", "Seconds"), sizeof(aBuf)); else { @@ -369,7 +365,6 @@ void CMenus::RenderSettingsDuckClient(CUIRect MainView) Left.HSplitTop(VerticalSpacing, nullptr, &Left); Left.HSplitTop(20.0f, &Button, &Left); Ui()->DoScrollbarOption(&g_Config.m_ClWeatherSnow, &g_Config.m_ClWeatherSnow, &Button, Localize("Snow Weather (won't be saved)"), 0, 15, &CUi::ms_LinearScrollbarScale, CUi::SCROLLBAR_OPTION_NOCLAMPVALUE, ""); - } // From T-Client @@ -2391,7 +2386,8 @@ void CMenus::RenderSettings(CUIRect MainView) Localize("Sound"), Localize("DDNet"), Localize("Assets"), - Localize("DuckC"),}; + Localize("DuckC"), + }; static CButtonContainer s_aTabButtons[SETTINGS_LENGTH]; for(int i = 0; i < SETTINGS_LENGTH; i++) diff --git a/src/game/client/components/nameplates.cpp b/src/game/client/components/nameplates.cpp index 153c54fed43..75023658f34 100644 --- a/src/game/client/components/nameplates.cpp +++ b/src/game/client/components/nameplates.cpp @@ -1,5 +1,6 @@ #include "nameplates.h" +#include //TClient #include #include #include @@ -14,8 +15,6 @@ #include #include -#include //TClient - static constexpr float DEFAULT_PADDING = 5.0f; // Part Types @@ -475,12 +474,12 @@ class CNamePlatePartCustomClient : public CNamePlatePartSprite CNamePlatePartCustomClient(CGameClient &This) : CNamePlatePartSprite(This) - { - m_Texture = g_pData->m_aImages[IMAGE_KZ_KAIZOICON].m_Id; - m_Padding = vec2(0.0f, 0.0f); - m_Sprite = SPRITE_KZ_KAIZOICON; - m_Size = vec2(20 + DEFAULT_PADDING, 20 + DEFAULT_PADDING); - } + { + m_Texture = g_pData->m_aImages[IMAGE_KZ_KAIZOICON].m_Id; + m_Padding = vec2(0.0f, 0.0f); + m_Sprite = SPRITE_KZ_KAIZOICON; + m_Size = vec2(20 + DEFAULT_PADDING, 20 + DEFAULT_PADDING); + } }; // Name Plates @@ -539,7 +538,7 @@ class CNamePlate AddPart(This); AddPart(This); - AddPart(This); + AddPart(This); } public: diff --git a/src/game/client/components/particles.cpp b/src/game/client/components/particles.cpp index 2b12474742d..2b57e5fd618 100644 --- a/src/game/client/components/particles.cpp +++ b/src/game/client/components/particles.cpp @@ -40,9 +40,9 @@ void CParticles::OnReset() void CParticles::Add(int Group, CParticle *pPart, float TimePassed) { - if (g_Config.m_ClParticleLimit == 0) + if(g_Config.m_ClParticleLimit == 0) return; - + if(Client()->State() == IClient::STATE_DEMOPLAYBACK) { const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 910d363695c..d545271807f 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -25,8 +26,6 @@ #include #include -#include - static float CalculateHandAngle(vec2 Dir, float AngleOffset) { const float Angle = angle(Dir); @@ -636,7 +635,7 @@ void CPlayers::RenderPlayer( if(g_Config.m_ClHammerRotatesWithCursor) { QuadsRotation += Angle; - if (Direction.x < 0) + if(Direction.x < 0) QuadsRotation += pi; Graphics()->QuadsSetRotation(QuadsRotation); } diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index d692c67e025..0b289a3b854 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -129,7 +129,7 @@ void CScoreboard::RenderTitle(CUIRect TitleBar, int Team, const char *pTitle) void CScoreboard::RenderGoals(CUIRect Goals) { - if (g_Config.m_ClScoreboardStyle >= 2) + if(g_Config.m_ClScoreboardStyle >= 2) Goals.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.6f), g_Config.m_ClScoreboardStyle == 2 ? IGraphics::CORNER_T : IGraphics::CORNER_ALL, 15.0f); else Goals.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f), IGraphics::CORNER_ALL, 15.0f); @@ -183,8 +183,8 @@ void CScoreboard::RenderSpectators(CUIRect Spectators) { static int LinesUsed = 1; int MaxHeight = Spectators.h; - if (g_Config.m_ClScoreboardShorten >= 1) - Spectators.HSplitTop(LinesUsed*22.0f, &Spectators, nullptr); + if(g_Config.m_ClScoreboardShorten >= 1) + Spectators.HSplitTop(LinesUsed * 22.0f, &Spectators, nullptr); const CNetObj_GameInfo *pGameInfoObj = GameClient()->m_Snap.m_pGameInfoObj; if(g_Config.m_ClScoreboardStyle == 2 && pGameInfoObj && (pGameInfoObj->m_ScoreLimit || pGameInfoObj->m_TimeLimit || (pGameInfoObj->m_RoundNum && pGameInfoObj->m_RoundCurrent))) Spectators.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f), IGraphics::CORNER_B, 15.0f); @@ -697,7 +697,7 @@ void CScoreboard::OnRender() const float ScoreboardWidth = !Teams && NumPlayers <= 16 ? ScoreboardSmallWidth : 1500.0f; const float TitleHeight = 60.0f; - CUIRect Scoreboard = {(Width - ScoreboardWidth) / 2.0f, 150.0f, ScoreboardWidth, (g_Config.m_ClScoreboardShorten >= 2 && NumPlayers <= 8 ? 50.0f + 76.0f*NumPlayers : 710.0f) + TitleHeight}; + CUIRect Scoreboard = {(Width - ScoreboardWidth) / 2.0f, 150.0f, ScoreboardWidth, (g_Config.m_ClScoreboardShorten >= 2 && NumPlayers <= 8 ? 50.0f + 76.0f * NumPlayers : 710.0f) + TitleHeight}; CScoreboardRenderState RenderState{}; if(Teams) @@ -763,8 +763,8 @@ void CScoreboard::OnRender() } else { - if (!g_Config.m_ClScoreboardStyle) - Scoreboard.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f), IGraphics::CORNER_ALL, 15.0f); + if(!g_Config.m_ClScoreboardStyle) + Scoreboard.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f), IGraphics::CORNER_ALL, 15.0f); const char *pTitle; if(pGameInfoObj && (pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER)) @@ -778,7 +778,7 @@ void CScoreboard::OnRender() CUIRect Title; Scoreboard.HSplitTop(TitleHeight, &Title, &Scoreboard); - if (g_Config.m_ClScoreboardStyle) + if(g_Config.m_ClScoreboardStyle) { Title.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.6f), g_Config.m_ClScoreboardStyle <= 2 ? IGraphics::CORNER_T : IGraphics::CORNER_ALL, 15.0f); Scoreboard.Draw(ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f), g_Config.m_ClScoreboardStyle <= 2 ? IGraphics::CORNER_B : IGraphics::CORNER_ALL, 15.0f); @@ -825,8 +825,8 @@ void CScoreboard::OnRender() { CUIRect Goals; Spectators.HSplitTop(50.0f, &Goals, &Spectators); - if (g_Config.m_ClScoreboardStyle <= 1) - Spectators.HSplitTop(10.0f, nullptr, &Spectators); + if(g_Config.m_ClScoreboardStyle <= 1) + Spectators.HSplitTop(10.0f, nullptr, &Spectators); RenderGoals(Goals); } RenderSpectators(Spectators); diff --git a/src/game/client/components/statboard.cpp b/src/game/client/components/statboard.cpp index 3decb5d72ed..353477ad205 100644 --- a/src/game/client/components/statboard.cpp +++ b/src/game/client/components/statboard.cpp @@ -13,13 +13,13 @@ #include static const vec4 s_aWeaponColors[] = -{ - vec4(201/255.0f, 197/255.0f, 205/255.0f, 1.0f), - vec4(156/255.0f, 158/255.0f, 100/255.0f, 1.0f), - vec4(98/255.0f, 80/255.0f, 46/255.0f, 1.0f), - vec4(163/255.0f, 51/255.0f, 56/255.0f, 1.0f), - vec4(65/255.0f, 97/255.0f, 161/255.0f, 1.0f), - vec4(182/255.0f, 137/255.0f, 40/255.0f, 1.0f), + { + vec4(201 / 255.0f, 197 / 255.0f, 205 / 255.0f, 1.0f), + vec4(156 / 255.0f, 158 / 255.0f, 100 / 255.0f, 1.0f), + vec4(98 / 255.0f, 80 / 255.0f, 46 / 255.0f, 1.0f), + vec4(163 / 255.0f, 51 / 255.0f, 56 / 255.0f, 1.0f), + vec4(65 / 255.0f, 97 / 255.0f, 161 / 255.0f, 1.0f), + vec4(182 / 255.0f, 137 / 255.0f, 40 / 255.0f, 1.0f), }; CStatboard::CStatboard() @@ -200,7 +200,7 @@ void CStatboard::RenderGlobalStats() bool GameWithFlags = GameClient()->m_Snap.m_pGameInfoObj && GameClient()->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_FLAGS; - StatboardContentWidth += 3*85 + 1*95 + 2*125 + 4; // Suicides 95; other labels 85 + StatboardContentWidth += 3 * 85 + 1 * 95 + 2 * 125 + 4; // Suicides 95; other labels 85 if(GameWithFlags) StatboardContentWidth += 150; // Grabs & Flags @@ -305,7 +305,7 @@ void CStatboard::RenderGlobalStats() if(j == 31) { char aBuf[64]; - str_format(aBuf, sizeof(aBuf), Localize("⋅⋅⋅ %d other players"), NumPlayers-j); + str_format(aBuf, sizeof(aBuf), Localize("⋅⋅⋅ %d other players"), NumPlayers - j); CTextCursor Cursor; Cursor.SetPosition(vec2(x, y + (LineHeight * 0.95f - FontSize) / 2.f)); @@ -418,7 +418,7 @@ void CStatboard::RenderGlobalStats() } // WEAPONS px -= 40; - if (!Config()->m_ClStatboardWeaponsStyle) + if(!Config()->m_ClStatboardWeaponsStyle) { for(int i = 0; i < NUM_WEAPONS; i++) { @@ -430,11 +430,13 @@ void CStatboard::RenderGlobalStats() TextRender()->Text(x + px - tw / 2, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f); px += 80; } - } else { - const float BarHeight = 0.3f*LineHeight; + } + else + { + const float BarHeight = 0.3f * LineHeight; const float Offset = 40.0f; const float StartX = px - Offset; - const float RoundSize = BarHeight/2.0f; + const float RoundSize = BarHeight / 2.0f; float EndX = StartX; // each bar will have its width incremented by the roundsize so this avoids that last one would overflow int TotalKills = 0; for(int i = 0; i < NUM_WEAPONS; i++) @@ -443,9 +445,9 @@ void CStatboard::RenderGlobalStats() { EndX += 80.0f; TotalKills += pStats->m_aFragsWith[i]; - } + } } - float ExploitableLength = (EndX-StartX) - RoundSize; + float ExploitableLength = (EndX - StartX) - RoundSize; CUIRect Rect = {x + StartX, y + LineHeight / 2.0f - BarHeight / 2.0f, 0.0f, BarHeight}; for(int i = 0; i < NUM_WEAPONS; i++) { diff --git a/src/game/client/components/tclient/custom_communities.cpp b/src/game/client/components/tclient/custom_communities.cpp index 703d8eddec6..d34d75f4269 100644 --- a/src/game/client/components/tclient/custom_communities.cpp +++ b/src/game/client/components/tclient/custom_communities.cpp @@ -2,10 +2,8 @@ #include -#include - #include - +#include #include static constexpr char CUSTOM_COMMUNITIES_DDNET_INFO_FILE[] = "custom-communities-ddnet-info.json"; @@ -54,8 +52,7 @@ void CCustomCommunities::CustomCommunitiesFunction(std::vector &vC vCommunities.insert( vCommunities.end(), Communities.u.array.values, - Communities.u.array.values + Communities.u.array.length - ); + Communities.u.array.values + Communities.u.array.length); } } } diff --git a/src/game/client/components/tclient/custom_communities.h b/src/game/client/components/tclient/custom_communities.h index 733582f8ec9..c412787eaf4 100644 --- a/src/game/client/components/tclient/custom_communities.h +++ b/src/game/client/components/tclient/custom_communities.h @@ -1,11 +1,11 @@ #ifndef GAME_CLIENT_COMPONENTS_TCLIENT_CUSTOM_COMMUNITIES_H #define GAME_CLIENT_COMPONENTS_TCLIENT_CUSTOM_COMMUNITIES_H -#include - #include #include +#include + class CCustomCommunities : public CComponent { private: diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index b8abe637bb3..f8f04142ef3 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -188,7 +188,8 @@ void CVoting::AddOption(const char *pDescription) // start of 0.7 depth code int Depth = 0; - for(;*pDescription == '#'; pDescription++, Depth++); + for(; *pDescription == '#'; pDescription++, Depth++) + ; pOption->m_Depth = Depth ? Depth : pOption->m_pPrev ? pOption->m_pPrev->m_Depth : 0; pOption->m_IsSubheader = Depth; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 6b7d11b3701..a81aa7cd31c 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -3,9 +3,6 @@ #include "gameclient.h" -#include -#include - #include "components/background.h" #include "components/binds.h" #include "components/broadcast.h" @@ -57,26 +54,29 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include #include -#include - #include #include #include #include #include +#include +#include #include +#include #include #include #include @@ -84,10 +84,6 @@ #include #include -#include - -#include - using namespace std::chrono_literals; const char *CGameClient::Version() const { return GAME_VERSION; } @@ -938,14 +934,14 @@ void CGameClient::OnRender() UpdateManagedTeeRenderInfos(); - if (g_Config.m_ClWeatherSnow) { + if(g_Config.m_ClWeatherSnow) + { static int snowTick = 1; - if (Client()->PredGameTick(0)/2 > snowTick || Client()->PredGameTick(0)/2 < snowTick - 50) { - snowTick = Client()->PredGameTick(0)/2; - if (g_Config.m_ClWeatherSnow >= 3 - || (g_Config.m_ClWeatherSnow == 2 && snowTick % 2 == 0) - || (g_Config.m_ClWeatherSnow == 1 && snowTick % 4 == 0)) - for (int i = 0; i < maximum(1, g_Config.m_ClWeatherSnow - 2); i++) + if(Client()->PredGameTick(0) / 2 > snowTick || Client()->PredGameTick(0) / 2 < snowTick - 50) + { + snowTick = Client()->PredGameTick(0) / 2; + if(g_Config.m_ClWeatherSnow >= 3 || (g_Config.m_ClWeatherSnow == 2 && snowTick % 2 == 0) || (g_Config.m_ClWeatherSnow == 1 && snowTick % 4 == 0)) + for(int i = 0; i < maximum(1, g_Config.m_ClWeatherSnow - 2); i++) m_Effects.Snow(m_LocalCharacterPos); } } @@ -1451,7 +1447,8 @@ void CGameClient::ProcessEvents() if(m_GameInfo.m_RaceSounds && ((pEvent->m_SoundId == SOUND_GUN_FIRE && !g_Config.m_SndGun) || (pEvent->m_SoundId == SOUND_PLAYER_PAIN_LONG && !g_Config.m_SndLongPain))) continue; - if (pEvent->m_SoundId == SOUND_LASER_BOUNCE && g_Config.m_ClExtraParticles) { + if(pEvent->m_SoundId == SOUND_LASER_BOUNCE && g_Config.m_ClExtraParticles) + { vec2 Pos = vec2(pEvent->m_X, pEvent->m_Y); bool IsShotgun = false; for(const CSnapEntities &Ent : SnapEntities()) @@ -1462,7 +1459,8 @@ void CGameClient::ProcessEvents() if(EntItem.m_Type == NETOBJTYPE_LASER || EntItem.m_Type == NETOBJTYPE_DDNETLASER) { CLaserData Data = ExtractLaserInfo(EntItem.m_Type, pData, &m_GameWorld, pEntEx); - if (std::abs(Data.m_To.x - Pos.x) < 10 && std::abs(Data.m_To.y - Pos.y) < 10) { + if(std::abs(Data.m_To.x - Pos.x) < 10 && std::abs(Data.m_To.y - Pos.y) < 10) + { if(Data.m_Type == LASERTYPE_SHOTGUN) IsShotgun = true; // else if(Data.m_Type == LASERTYPE_RIFLE) @@ -1472,10 +1470,10 @@ void CGameClient::ProcessEvents() } } } - if (IsShotgun) + if(IsShotgun) m_Effects.LaserBounce(Pos, Alpha, g_Config.m_ClLaserShotgunInnerColor); else - m_Effects.LaserBounce(Pos, Alpha, g_Config.m_ClLaserRifleInnerColor); + m_Effects.LaserBounce(Pos, Alpha, g_Config.m_ClLaserRifleInnerColor); } m_Sounds.PlayAt(CSounds::CHN_WORLD, pEvent->m_SoundId, 1.0f, vec2(pEvent->m_X, pEvent->m_Y)); @@ -1770,9 +1768,9 @@ void CGameClient::OnNewSnapshot() pClient->m_ColorBody = pInfo->m_ColorBody; pClient->m_ColorFeet = pInfo->m_ColorFeet; - if (g_Config.m_ClDuckFilter) + if(g_Config.m_ClDuckFilter) str_copy(pClient->m_aSkinName, "Scrubby Duck"); - + //identify kaizo union { @@ -3291,13 +3289,13 @@ void CGameClient::ConKill(IConsole::IResult *pResult, void *pUserData) int time = pClient->CurrentRaceTime(); // after 1-2 seconds, the attempts should be reset - if (abs(lastKillTime - time) > 1) + if(abs(lastKillTime - time) > 1) killAttempts = 0; - + lastKillTime = time; - + // if not enough time has passed for the protection to be avtive, or it had already been activated prior, then kill - if (g_Config.m_ClConfirmKillTime == -1 || time <= g_Config.m_ClConfirmKillTime || killAttempts >= 1) + if(g_Config.m_ClConfirmKillTime == -1 || time <= g_Config.m_ClConfirmKillTime || killAttempts >= 1) pClient->SendKill(); else pClient->m_Chat.Echo("Self kill attempt prevented. Trigger self kill again to confirm."); @@ -3418,7 +3416,7 @@ void CGameClient::UpdateLocalTuning() m_GameWorld.GetTuning(0)->m_PlayerHooking = 1; m_GameWorld.GetTuning(0)->m_JetpackStrength = 400; } - + if(!m_Snap.m_pLocalCharacter && !m_Snap.m_pSpectatorInfo) return; @@ -4835,12 +4833,12 @@ IGraphics::CTextureHandle *CGameClient::GetInfclassTexturePtrForDamageType(EDama { switch(DamageType) { -// case EDamageType::SNIPER_RIFLE: -// return &m_InfclassSkin.m_SpriteSniperRifle; -// case EDamageType::SCIENTIST_LASER: -// return &m_InfclassSkin.m_SpriteScientistLaser; -// case EDamageType::MEDIC_SHOTGUN: -// return &m_InfclassSkin.m_SpriteMedicShotgun; + // case EDamageType::SNIPER_RIFLE: + // return &m_InfclassSkin.m_SpriteSniperRifle; + // case EDamageType::SCIENTIST_LASER: + // return &m_InfclassSkin.m_SpriteScientistLaser; + // case EDamageType::MEDIC_SHOTGUN: + // return &m_InfclassSkin.m_SpriteMedicShotgun; case EDamageType::LASER_WALL: return &m_InfclassSkin.m_SpriteLaserWall; @@ -4852,8 +4850,8 @@ IGraphics::CTextureHandle *CGameClient::GetInfclassTexturePtrForDamageType(EDama return &m_InfclassSkin.m_SpriteBiologistMine; case EDamageType::MERCENARY_BOMB: return &m_InfclassSkin.m_SpriteMercenaryBomb; -// case EDamageType::WHITE_HOLE: -// return &m_InfclassSkin.m_SpriteWhiteHole; + // case EDamageType::WHITE_HOLE: + // return &m_InfclassSkin.m_SpriteWhiteHole; case EDamageType::TURRET_DESTRUCTION: return &m_InfclassSkin.m_SpriteTurretDestruction; case EDamageType::TURRET_LASER: @@ -5396,7 +5394,6 @@ int CGameClient::FindFirstMultiViewId() void CGameClient::OnKZUpdate() { - } void CGameClient::OnKZReset() @@ -5415,24 +5412,24 @@ void CGameClient::CClientData::KZReset() // function originally from Kaizo Network by +KZ, credit if used int CGameClient::InsertCustomClientIdIntoSkinColor(int Color) { - if(!g_Config.m_ClSendClientType) - { - return Color; - } - - union - { - int c = 0; - unsigned char b[4]; - } a; - - a.c = Color; - - //printf("color %d %d %d %d\n", a.b[0], a.b[1], a.b[2], a.b[3]); - - //alpha is unused - a.b[3] = (unsigned char)CCID_COLOR_BODY_PDUCKCLIENT; - Color = a.c; + if(!g_Config.m_ClSendClientType) + { + return Color; + } + + union + { + int c = 0; + unsigned char b[4]; + } a; + + a.c = Color; + + //printf("color %d %d %d %d\n", a.b[0], a.b[1], a.b[2], a.b[3]); + + //alpha is unused + a.b[3] = (unsigned char)CCID_COLOR_BODY_PDUCKCLIENT; + Color = a.c; return Color; } diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 74f866b1ad8..1b6dca14e0b 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -325,7 +325,7 @@ class CGameClient : public IGameClient }; int m_ServerMode; CGameInfo m_GameInfo; - + char m_aSavedLocalRconPassword[sizeof(g_Config.m_SvRconPassword)]{}; int m_TimeLimitInSeconds; int m_InfClassHeroGiftTick; diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index 04906154ef7..5c65be3af05 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -9,13 +9,10 @@ #include +#include #include #include -#include - -#include - // Character, "physical" player's part void CCharacter::SetWeapon(int Weapon) @@ -570,7 +567,7 @@ void CCharacter::FireWeapon() return; } } - break; + break; case PLAYERCLASS_LOOPER: LaserReach = LaserReach * 0.7f; FireDelay = 250; diff --git a/src/game/client/prediction/entities/laser.h b/src/game/client/prediction/entities/laser.h index 99f0b99a7f6..316192ea52e 100644 --- a/src/game/client/prediction/entities/laser.h +++ b/src/game/client/prediction/entities/laser.h @@ -12,7 +12,8 @@ class CLaser : public CEntity friend class CGameWorld; public: - enum EBounce { + enum EBounce + { Bounce, NoBounce }; diff --git a/src/game/client/prediction/gameworld.cpp b/src/game/client/prediction/gameworld.cpp index ea7e3b20860..04dbb4d9cf5 100644 --- a/src/game/client/prediction/gameworld.cpp +++ b/src/game/client/prediction/gameworld.cpp @@ -15,10 +15,11 @@ #include +#include + #include #include #include -#include #include #include @@ -606,7 +607,7 @@ void CGameWorld::NetObjAdd(int ObjId, int ObjType, const void *pObjData, const C NetObject.SetSnapData1(pObject->m_Data1); CIcPlacedObject *pExisting = static_cast(GetEntity(ObjId, ENTTYPE_IC_PLACED_OBJECT)); - if (pExisting && pExisting->Match(&NetObject)) + if(pExisting && pExisting->Match(&NetObject)) { pExisting->Keep(); pExisting->Read(NetObject); diff --git a/src/game/client/ui_listbox.cpp b/src/game/client/ui_listbox.cpp index 8994375b6f4..2a2f1cc089d 100644 --- a/src/game/client/ui_listbox.cpp +++ b/src/game/client/ui_listbox.cpp @@ -182,7 +182,7 @@ CListboxItem CListBox::DoNextItem(const void *pId, bool Selected, float CornerRa CListboxItem CListBox::DoSubheader() { CListboxItem Item = DoNextRow(); - + ColorRGBA color = color_cast(ColorHSLA(g_Config.m_UiColor, false)); color.a = 0.1; Item.m_Rect.Draw(color, IGraphics::CORNER_NONE, 0.0f); diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h index 2930e907659..9acd91fbef6 100644 --- a/src/game/editor/editor.h +++ b/src/game/editor/editor.h @@ -812,7 +812,6 @@ class CEditor : public IEditor, public IEnvelopeEval void DoAudioPreview(CUIRect View, const void *pPlayPauseButtonId, const void *pStopButtonId, const void *pSeekBarId, int SampleId); - // Zooming void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View); void UpdateZoomEnvelopeX(const CUIRect &View);