diff --git a/.clang-tidy b/.clang-tidy index 3c7bbbd94..a8ac9036b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -102,5 +102,5 @@ CheckOptions: - key: readability-identifier-naming.LocalConstantCase value: aNy_CasE - key: readability-identifier-naming.LocalVariableIgnoredRegexp - value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|Tickdelta_legacy$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|GfxFsaaSamples_MouseButton$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|cData$|sub$|ret$|rendered$|(lower|upper)(16|26|24|32)|size$|wSearch$|bAlreadyHit$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_skin$|best_matches$|m_aClient$|matches$|nohook$|through_cut$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|m_TileF?Index$|mode$|maxModes$|numModes$|iLogLength$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*' + value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|sub$|ret$|rendered$|(lower|upper)(16|26|24|32)|size$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_matches$|matches$|nohook$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|mode$|maxModes$|numModes$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*' diff --git a/src/engine/client/backend/opengl/opengl_sl_program.cpp b/src/engine/client/backend/opengl/opengl_sl_program.cpp index 8da5498c3..0ad2e2ed3 100644 --- a/src/engine/client/backend/opengl/opengl_sl_program.cpp +++ b/src/engine/client/backend/opengl/opengl_sl_program.cpp @@ -58,8 +58,8 @@ void CGLSLProgram::LinkProgram() { char aInfoLog[1024]; char aFinalMessage[1536]; - int iLogLength; - glGetProgramInfoLog(m_ProgramId, 1024, &iLogLength, aInfoLog); + int LogLength; + glGetProgramInfoLog(m_ProgramId, 1024, &LogLength, aInfoLog); str_format(aFinalMessage, sizeof(aFinalMessage), "Error! Shader program wasn't linked! The linker returned:\n\n%s", aInfoLog); dbg_msg("glslprogram", "%s", aFinalMessage); } diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp index 4a2b6e699..1673472b3 100644 --- a/src/engine/shared/demo.cpp +++ b/src/engine/shared/demo.cpp @@ -493,15 +493,15 @@ CDemoPlayer::EReadChunkHeaderResult CDemoPlayer::ReadChunkHeader(int *pType, int if(Chunk & CHUNKTYPEFLAG_TICKMARKER) { // decode tick marker - int Tickdelta_legacy = Chunk & CHUNKMASK_TICK_LEGACY; // compatibility + int TickdeltaLegacy = Chunk & CHUNKMASK_TICK_LEGACY; // compatibility *pType = Chunk & (CHUNKTYPEFLAG_TICKMARKER | CHUNKTICKFLAG_KEYFRAME); int NewTick; - if(m_Info.m_Header.m_Version < gs_VersionTickCompression && Tickdelta_legacy != 0) + if(m_Info.m_Header.m_Version < gs_VersionTickCompression && TickdeltaLegacy != 0) { if(*pTick < 0) // initial tick not initialized before a tick delta return CHUNKHEADER_ERROR; - NewTick = *pTick + Tickdelta_legacy; + NewTick = *pTick + TickdeltaLegacy; } else if(Chunk & CHUNKTICKFLAG_TICK_COMPRESSED) { diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 1f808e4d1..ffb63f930 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -677,10 +677,10 @@ void CMenus::RenderServerControl(CUIRect MainView) TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE); Ui()->DoLabel(&QuickSearch, FONT_ICON_MAGNIFYING_GLASS, 14.0f, TEXTALIGN_ML); - float wSearch = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); + float SearchWidth = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); TextRender()->SetRenderFlags(0); TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT); - QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch); + QuickSearch.VSplitLeft(SearchWidth, 0, &QuickSearch); QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch); if(m_ControlPageOpening || (Input()->KeyPress(KEY_F) && Input()->ModifierIsPressed())) diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 0413df639..f26e7d03f 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -394,8 +394,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) TextRender()->SetRenderFlags(0); TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT); - float wSearch = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); - QuickSearch.VSplitLeft(wSearch - 1.5f, nullptr, &QuickSearch); + float SearchWidth = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); + QuickSearch.VSplitLeft(SearchWidth - 1.5f, nullptr, &QuickSearch); QuickSearch.VSplitLeft(5.0f, nullptr, &QuickSearch); QuickSearch.VSplitLeft(QuickSearch.w - 10.0f, &QuickSearch, &QuickSearchClearButton); @@ -919,10 +919,10 @@ void CMenus::RenderSettingsTee(CUIRect MainView) TextRender()->SetFontPreset(EFontPreset::ICON_FONT); TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE); Ui()->DoLabel(&QuickSearch, FONT_ICON_MAGNIFYING_GLASS, 14.0f, TEXTALIGN_ML); - float wSearch = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); + float SearchWidth = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); TextRender()->SetRenderFlags(0); TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT); - QuickSearch.VSplitLeft(wSearch + 5.0f, nullptr, &QuickSearch); + QuickSearch.VSplitLeft(SearchWidth + 5.0f, nullptr, &QuickSearch); static CLineInput s_SkinFilterInput(g_Config.m_ClSkinFilterString, sizeof(g_Config.m_ClSkinFilterString)); if(Input()->KeyPress(KEY_F) && Input()->ModifierIsPressed()) { @@ -1635,16 +1635,16 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) bool MultiSamplingChanged = false; MainView.HSplitTop(20.0f, &Button, &MainView); str_format(aBuf, sizeof(aBuf), "%s (%s)", Localize("FSAA samples"), Localize("may cause delay")); - int GfxFsaaSamples_MouseButton = DoButton_CheckBox_Number(&g_Config.m_GfxFsaaSamples, aBuf, g_Config.m_GfxFsaaSamples, &Button); + int GfxFsaaSamplesMouseButton = DoButton_CheckBox_Number(&g_Config.m_GfxFsaaSamples, aBuf, g_Config.m_GfxFsaaSamples, &Button); int CurFSAA = g_Config.m_GfxFsaaSamples == 0 ? 1 : g_Config.m_GfxFsaaSamples; - if(GfxFsaaSamples_MouseButton == 1) // inc + if(GfxFsaaSamplesMouseButton == 1) // inc { g_Config.m_GfxFsaaSamples = std::pow(2, (int)std::log2(CurFSAA) + 1); if(g_Config.m_GfxFsaaSamples > 64) g_Config.m_GfxFsaaSamples = 0; MultiSamplingChanged = true; } - else if(GfxFsaaSamples_MouseButton == 2) // dec + else if(GfxFsaaSamplesMouseButton == 2) // dec { if(CurFSAA == 1) g_Config.m_GfxFsaaSamples = 64; @@ -1662,7 +1662,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) { // try again with 0 if mouse click was increasing multi sampling // else just accept the current value as is - if((uint32_t)g_Config.m_GfxFsaaSamples > MultiSamplingCountBackend && GfxFsaaSamples_MouseButton == 1) + if((uint32_t)g_Config.m_GfxFsaaSamples > MultiSamplingCountBackend && GfxFsaaSamplesMouseButton == 1) Graphics()->SetMultiSampling(0, MultiSamplingCountBackend); g_Config.m_GfxFsaaSamples = (int)MultiSamplingCountBackend; } diff --git a/src/game/client/components/menus_settings_assets.cpp b/src/game/client/components/menus_settings_assets.cpp index df2e54288..c631547e4 100644 --- a/src/game/client/components/menus_settings_assets.cpp +++ b/src/game/client/components/menus_settings_assets.cpp @@ -608,10 +608,10 @@ void CMenus::RenderSettingsCustom(CUIRect MainView) TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE); Ui()->DoLabel(&QuickSearch, FONT_ICON_MAGNIFYING_GLASS, 14.0f, TEXTALIGN_ML); - float wSearch = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); + float SearchWidth = TextRender()->TextWidth(14.0f, FONT_ICON_MAGNIFYING_GLASS, -1, -1.0f); TextRender()->SetRenderFlags(0); TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT); - QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch); + QuickSearch.VSplitLeft(SearchWidth, 0, &QuickSearch); QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch); QuickSearch.VSplitLeft(QuickSearch.w - 10.0f, &QuickSearch, &QuickSearchClearButton); if(Input()->KeyPress(KEY_F) && Input()->ModifierIsPressed()) diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 0e8401c28..0f2dac306 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -832,13 +832,13 @@ void CPlayers::OnRender() } // render spectating players - for(auto &m_aClient : m_pClient->m_aClients) + for(auto &Client : m_pClient->m_aClients) { - if(!m_aClient.m_SpecCharPresent) + if(!Client.m_SpecCharPresent) { continue; } - RenderTools()->RenderTee(CAnimState::GetIdle(), &RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), m_aClient.m_SpecChar); + RenderTools()->RenderTee(CAnimState::GetIdle(), &RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Client.m_SpecChar); } // render everyone else's tee, then either our own or the tee we are spectating. diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 407da99c2..9177b3d1d 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2469,9 +2469,9 @@ int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, in if(i == ownId) continue; - const CClientData &cData = m_aClients[i]; + const CClientData &Data = m_aClients[i]; - if(!cData.m_Active) + if(!Data.m_Active) continue; CNetObj_Character Prev = m_Snap.m_aCharacters[i].m_Prev; @@ -2479,8 +2479,8 @@ int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, in vec2 Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), Client()->IntraGameTick(g_Config.m_ClDummy)); - bool IsOneSuper = cData.m_Super || OwnClientData.m_Super; - bool IsOneSolo = cData.m_Solo || OwnClientData.m_Solo; + bool IsOneSuper = Data.m_Super || OwnClientData.m_Super; + bool IsOneSolo = Data.m_Solo || OwnClientData.m_Solo; if(!IsOneSuper && (!m_Teams.SameTeam(i, ownId) || IsOneSolo || OwnClientData.m_HookHitDisabled)) continue; diff --git a/src/game/client/prediction/entities/character.cpp b/src/game/client/prediction/entities/character.cpp index a2f910955..8ce77b67e 100644 --- a/src/game/client/prediction/entities/character.cpp +++ b/src/game/client/prediction/entities/character.cpp @@ -160,13 +160,13 @@ void CCharacter::HandleNinja() return; // make sure we haven't Hit this object before - bool bAlreadyHit = false; + bool AlreadyHit = false; for(int j = 0; j < m_NumObjectsHit; j++) { if(m_aHitObjects[j] == pChr->GetCid()) - bAlreadyHit = true; + AlreadyHit = true; } - if(bAlreadyHit) + if(AlreadyHit) continue; // check so we are sufficiently close diff --git a/src/game/editor/mapitems/layer_game.cpp b/src/game/editor/mapitems/layer_game.cpp index fb20bb1e1..14dfd27e1 100644 --- a/src/game/editor/mapitems/layer_game.cpp +++ b/src/game/editor/mapitems/layer_game.cpp @@ -17,8 +17,8 @@ CTile CLayerGame::GetTile(int x, int y) { if(m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT) { - CTile through_cut = {TILE_THROUGH_CUT}; - return through_cut; + CTile ThroughCut = {TILE_THROUGH_CUT}; + return ThroughCut; } else { @@ -38,8 +38,8 @@ void CLayerGame::SetTile(int x, int y, CTile Tile) } CTile nohook = {TILE_NOHOOK}; CLayerTiles::SetTile(x, y, nohook); - CTile through_cut = {TILE_THROUGH_CUT}; - m_pEditor->m_Map.m_pFrontLayer->CLayerTiles::SetTile(x, y, through_cut); // NOLINT(bugprone-parent-virtual-call) + CTile ThroughCut = {TILE_THROUGH_CUT}; + m_pEditor->m_Map.m_pFrontLayer->CLayerTiles::SetTile(x, y, ThroughCut); // NOLINT(bugprone-parent-virtual-call) } else { diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index de6a54bce..4fa42231d 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -290,13 +290,13 @@ void CCharacter::HandleNinja() return; // make sure we haven't Hit this object before - bool bAlreadyHit = false; + bool AlreadyHit = false; for(int j = 0; j < m_NumObjectsHit; j++) { if(m_apHitObjects[j] == pChr) - bAlreadyHit = true; + AlreadyHit = true; } - if(bAlreadyHit) + if(AlreadyHit) continue; // check so we are sufficiently close diff --git a/src/game/server/gamemodes/DDRace.cpp b/src/game/server/gamemodes/DDRace.cpp index 3ab91ec0d..c44ba5b23 100644 --- a/src/game/server/gamemodes/DDRace.cpp +++ b/src/game/server/gamemodes/DDRace.cpp @@ -32,8 +32,8 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex) CPlayer *pPlayer = pChr->GetPlayer(); const int ClientId = pPlayer->GetCid(); - int m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex); - int m_TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); + int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex); + int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex); //Sensitivity int S1 = GameServer()->Collision()->GetPureMapIndex(vec2(pChr->GetPos().x + pChr->GetProximityRadius() / 3.f, pChr->GetPos().y - pChr->GetProximityRadius() / 3.f)); @@ -50,7 +50,7 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex) int FTile4 = GameServer()->Collision()->GetFTileIndex(S4); const int PlayerDDRaceState = pChr->m_DDRaceState; - bool IsOnStartTile = (m_TileIndex == TILE_START) || (m_TileFIndex == TILE_START) || FTile1 == TILE_START || FTile2 == TILE_START || FTile3 == TILE_START || FTile4 == TILE_START || Tile1 == TILE_START || Tile2 == TILE_START || Tile3 == TILE_START || Tile4 == TILE_START; + bool IsOnStartTile = (TileIndex == TILE_START) || (TileFIndex == TILE_START) || FTile1 == TILE_START || FTile2 == TILE_START || FTile3 == TILE_START || FTile4 == TILE_START || Tile1 == TILE_START || Tile2 == TILE_START || Tile3 == TILE_START || Tile4 == TILE_START; // start if(IsOnStartTile && PlayerDDRaceState != DDRACE_CHEAT) { @@ -88,23 +88,23 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex) } // finish - if(((m_TileIndex == TILE_FINISH) || (m_TileFIndex == TILE_FINISH) || FTile1 == TILE_FINISH || FTile2 == TILE_FINISH || FTile3 == TILE_FINISH || FTile4 == TILE_FINISH || Tile1 == TILE_FINISH || Tile2 == TILE_FINISH || Tile3 == TILE_FINISH || Tile4 == TILE_FINISH) && PlayerDDRaceState == DDRACE_STARTED) + if(((TileIndex == TILE_FINISH) || (TileFIndex == TILE_FINISH) || FTile1 == TILE_FINISH || FTile2 == TILE_FINISH || FTile3 == TILE_FINISH || FTile4 == TILE_FINISH || Tile1 == TILE_FINISH || Tile2 == TILE_FINISH || Tile3 == TILE_FINISH || Tile4 == TILE_FINISH) && PlayerDDRaceState == DDRACE_STARTED) Teams().OnCharacterFinish(ClientId); // unlock team - else if(((m_TileIndex == TILE_UNLOCK_TEAM) || (m_TileFIndex == TILE_UNLOCK_TEAM)) && Teams().TeamLocked(GameServer()->GetDDRaceTeam(ClientId))) + else if(((TileIndex == TILE_UNLOCK_TEAM) || (TileFIndex == TILE_UNLOCK_TEAM)) && Teams().TeamLocked(GameServer()->GetDDRaceTeam(ClientId))) { Teams().SetTeamLock(GameServer()->GetDDRaceTeam(ClientId), false); GameServer()->SendChatTeam(GameServer()->GetDDRaceTeam(ClientId), "Your team was unlocked by an unlock team tile"); } // solo part - if(((m_TileIndex == TILE_SOLO_ENABLE) || (m_TileFIndex == TILE_SOLO_ENABLE)) && !Teams().m_Core.GetSolo(ClientId)) + if(((TileIndex == TILE_SOLO_ENABLE) || (TileFIndex == TILE_SOLO_ENABLE)) && !Teams().m_Core.GetSolo(ClientId)) { GameServer()->SendChatTarget(ClientId, "You are now in a solo part"); pChr->SetSolo(true); } - else if(((m_TileIndex == TILE_SOLO_DISABLE) || (m_TileFIndex == TILE_SOLO_DISABLE)) && Teams().m_Core.GetSolo(ClientId)) + else if(((TileIndex == TILE_SOLO_DISABLE) || (TileFIndex == TILE_SOLO_DISABLE)) && Teams().m_Core.GetSolo(ClientId)) { GameServer()->SendChatTarget(ClientId, "You are now out of the solo part"); pChr->SetSolo(false); diff --git a/src/game/server/teeinfo.cpp b/src/game/server/teeinfo.cpp index 250d77623..90432fbeb 100644 --- a/src/game/server/teeinfo.cpp +++ b/src/game/server/teeinfo.cpp @@ -119,8 +119,8 @@ void CTeeInfo::FromSixup() } // find closest match - int best_skin = 0; - int best_matches = -1; + int BestSkin = 0; + int BestMatches = -1; for(int s = 0; s < 16; s++) { int matches = 0; @@ -128,14 +128,14 @@ void CTeeInfo::FromSixup() if(str_comp(m_apSkinPartNames[p], g_aStdSkins[s].m_apSkinPartNames[p]) == 0) matches++; - if(matches > best_matches) + if(matches > BestMatches) { - best_matches = matches; - best_skin = s; + BestMatches = matches; + BestSkin = s; } } - str_copy(m_aSkinName, g_aStdSkins[best_skin].m_aSkinName, sizeof(m_aSkinName)); + str_copy(m_aSkinName, g_aStdSkins[BestSkin].m_aSkinName, sizeof(m_aSkinName)); m_UseCustomColor = true; m_ColorBody = ColorHSLA(m_aUseCustomColors[0] ? m_aSkinPartColors[0] : 255).UnclampLighting(ms_DarkestLGT7).Pack(ColorHSLA::DARKEST_LGT); m_ColorFeet = ColorHSLA(m_aUseCustomColors[4] ? m_aSkinPartColors[4] : 255).UnclampLighting(ms_DarkestLGT7).Pack(ColorHSLA::DARKEST_LGT);