From 32b7dfe419b7386067ef481c150b4d482b2c9ec2 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 13:56:20 +0200 Subject: [PATCH 01/30] refactor(server): misc minor renames and changes to appease compiler move type into for rename filter.GetRecipientCount rename RGB -> RGBnext rename for loop i -> j rename KeyValues fix i visiblity remove unused attackerTeam rename index -> iIndex rename pPRecipient rename mass -> massHeld remove unused result of V_snprintf inline fPhysObjectMass rename pPlayer -> pPClient inline count fix sit visibility (while -> for) inline dir rename te -> tempEntity rename pTartget -> pTarget2 rename a -> ia rename inc -> incAdj rename color -> blockedColor move x declaration inside scopes where it is used rename hFunc -> hScopedFunc --- src/game/server/EventLog.cpp | 7 +---- src/game/server/ai_baseactor.cpp | 8 +++--- src/game/server/ai_navigator.cpp | 4 +-- src/game/server/ai_scriptconditions.cpp | 6 ++-- src/game/server/baseflex.cpp | 9 ++---- src/game/server/basetempentity.cpp | 8 +++--- src/game/server/baseviewmodel.cpp | 8 +++--- src/game/server/episodic/npc_hunter.cpp | 4 +-- src/game/server/hl2/cbasehelicopter.cpp | 4 +-- src/game/server/hltvdirector.cpp | 28 +++++++++---------- src/game/server/nav_area.cpp | 24 ++++++++-------- src/game/server/nav_file.cpp | 6 ++-- src/game/server/nav_generate.cpp | 10 +++---- src/game/server/physics_impact_damage.cpp | 6 ++-- src/game/server/player.cpp | 2 +- src/game/server/props.cpp | 8 +++--- src/game/server/sceneentity.cpp | 6 ++-- .../server/swarm/asw_gamerules_vscript.cpp | 6 ++-- 18 files changed, 71 insertions(+), 83 deletions(-) diff --git a/src/game/server/EventLog.cpp b/src/game/server/EventLog.cpp index 733135ecc..4c883125d 100644 --- a/src/game/server/EventLog.cpp +++ b/src/game/server/EventLog.cpp @@ -193,12 +193,7 @@ bool CEventLog::PrintPlayerEvent( IGameEvent *event ) CBasePlayer *pAttacker = UTIL_PlayerByUserId( attackerid ); CTeam *team = pPlayer->GetTeam(); - CTeam *attackerTeam = NULL; - - if ( pAttacker ) - { - attackerTeam = pAttacker->GetTeam(); - } + if ( pPlayer == pAttacker && pPlayer ) { diff --git a/src/game/server/ai_baseactor.cpp b/src/game/server/ai_baseactor.cpp index 90c4fd913..ff370b1d0 100644 --- a/src/game/server/ai_baseactor.cpp +++ b/src/game/server/ai_baseactor.cpp @@ -294,14 +294,14 @@ bool CAI_BaseActor::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, } else if (stricmp( event->GetParameters(), "AI_IGNORECOLLISION") == 0) { - CBaseEntity *pTarget = FindNamedEntity( event->GetParameters2( ) ); + CBaseEntity *pTarget2 = FindNamedEntity( event->GetParameters2( ) ); - if (pTarget) + if (pTarget2) { info->m_nType = SCENE_AI_IGNORECOLLISION; - info->m_hTarget = pTarget; + info->m_hTarget = pTarget2; float remaining = event->GetEndTime() - scene->GetTime(); - NPCPhysics_CreateSolver( this, pTarget, true, remaining ); + NPCPhysics_CreateSolver( this, pTarget2, true, remaining ); info->m_flNext = gpGlobals->curtime + remaining; return true; } diff --git a/src/game/server/ai_navigator.cpp b/src/game/server/ai_navigator.cpp index bb1f98678..e01f1209e 100644 --- a/src/game/server/ai_navigator.cpp +++ b/src/game/server/ai_navigator.cpp @@ -4262,8 +4262,8 @@ void CAI_Navigator::DrawDebugRouteOverlay(void) if (waypoint->GetNext()) { - Vector RGB = GetRouteColor(waypoint->GetNext()->NavType(), waypoint->GetNext()->Flags()); - NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(),RGB[0],RGB[1],RGB[2], true,0); + Vector RGBnext = GetRouteColor(waypoint->GetNext()->NavType(), waypoint->GetNext()->Flags()); + NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(),RGBnext[0],RGBnext[1],RGBnext[2], true,0); } waypoint = waypoint->GetNext(); } diff --git a/src/game/server/ai_scriptconditions.cpp b/src/game/server/ai_scriptconditions.cpp index 0a2472de2..058dd172b 100644 --- a/src/game/server/ai_scriptconditions.cpp +++ b/src/game/server/ai_scriptconditions.cpp @@ -537,14 +537,14 @@ void CAI_ScriptConditions::EvaluationThink() m_hTarget.Get() }; - for ( int i = 0; i < nEvaluators; ++i ) + for ( int j = 0; j < nEvaluators; ++j ) { - if ( !(this->*gm_Evaluators[i].pfnEvaluator)( args ) ) + if ( !(this->*gm_Evaluators[j].pfnEvaluator)( args ) ) { pConditionElement->GetTimer()->Reset(); result = false; - ScrCondDbgMsg( ( "%s failed on: %s\n", GetDebugName(), gm_Evaluators[ i ].pszName ) ); + ScrCondDbgMsg( ( "%s failed on: %s\n", GetDebugName(), gm_Evaluators[ j ].pszName ) ); break; } diff --git a/src/game/server/baseflex.cpp b/src/game/server/baseflex.cpp index a4a0f8943..291e75035 100644 --- a/src/game/server/baseflex.cpp +++ b/src/game/server/baseflex.cpp @@ -576,8 +576,7 @@ bool CBaseFlex::HandleStartGestureSceneEvent( CSceneEventInfo *info, CChoreoScen char szEndLoop[CEventAbsoluteTag::MAX_EVENTTAG_LENGTH] = { "end" }; // check in the tag indexes - KeyValues *pkvFaceposer; - for ( pkvFaceposer = pkvAllFaceposer->GetFirstSubKey(); pkvFaceposer; pkvFaceposer = pkvFaceposer->GetNextKey() ) + for ( KeyValues *pkvFaceposer = pkvAllFaceposer->GetFirstSubKey(); pkvFaceposer; pkvFaceposer = pkvFaceposer->GetNextKey() ) { if (!stricmp( pkvFaceposer->GetName(), "startloop" )) { @@ -619,8 +618,7 @@ bool CBaseFlex::HandleStartGestureSceneEvent( CSceneEventInfo *info, CChoreoScen mstudioanimdesc_t &animdesc = pstudiohdr->pAnimdesc( pstudiohdr->iRelativeAnim( info->m_nSequence, seqdesc.anim(0,0) ) ); // check in the tag indexes - KeyValues *pkvFaceposer; - for ( pkvFaceposer = pkvAllFaceposer->GetFirstSubKey(); pkvFaceposer; pkvFaceposer = pkvFaceposer->GetNextKey() ) + for ( KeyValues *pkvFaceposer = pkvAllFaceposer->GetFirstSubKey(); pkvFaceposer; pkvFaceposer = pkvFaceposer->GetNextKey() ) { if (!stricmp( pkvFaceposer->GetName(), "tags" )) { @@ -1062,8 +1060,7 @@ class CFlexSceneFileManager : CAutoGameSystem Q_FixSlashes( szFilename ); // See if it's already loaded - int i; - for ( i = 0; i < m_FileList.Count(); i++ ) + for ( int i = 0; i < m_FileList.Count(); i++ ) { CFlexSceneFile *file = m_FileList[ i ]; if ( file && !V_stricmp( file->filename, szFilename ) ) diff --git a/src/game/server/basetempentity.cpp b/src/game/server/basetempentity.cpp index 45c049764..bbdc68152 100644 --- a/src/game/server/basetempentity.cpp +++ b/src/game/server/basetempentity.cpp @@ -106,11 +106,11 @@ void CBaseTempEntity::Test( const Vector& current_origin, const QAngle& current_ //----------------------------------------------------------------------------- void CBaseTempEntity::PrecacheTempEnts( void ) { - CBaseTempEntity *te = GetList(); - while ( te ) + CBaseTempEntity *tempEntity = GetList(); + while ( tempEntity ) { - te->Precache(); - te = te->GetNext(); + tempEntity->Precache(); + tempEntity = tempEntity->GetNext(); } } diff --git a/src/game/server/baseviewmodel.cpp b/src/game/server/baseviewmodel.cpp index bf00abe4a..98fb82b71 100644 --- a/src/game/server/baseviewmodel.cpp +++ b/src/game/server/baseviewmodel.cpp @@ -80,8 +80,8 @@ int CBaseViewModel::ShouldTransmit( const CCheckTransmitInfo *pInfo ) } // check if recipient (or one of his splitscreen parasites) is spectating the owner of this viewmodel - CBasePlayer *pPlayer = ToBasePlayer( CBaseEntity::Instance( pInfo->m_pClientEnt ) ); - if ( pPlayer) + CBasePlayer *pPClient = ToBasePlayer( CBaseEntity::Instance( pInfo->m_pClientEnt ) ); + if ( pPClient) { // Bug 28591: In splitscreen, when the second slot is the one in spectator mode, it wouldn't // get the viewmodel for the spectatee. @@ -93,8 +93,8 @@ int CBaseViewModel::ShouldTransmit( const CCheckTransmitInfo *pInfo ) // This container was the source of most of the allocation cost in CS:GO so using a CUtlVectorFixed to avoid // allocations is important. CUtlVectorFixedGrowable< CBasePlayer *, MAX_SPLITSCREEN_CLIENTS > checkList; - checkList.AddToTail( pPlayer ); - CUtlVector< CHandle< CBasePlayer > > &vecParasites = pPlayer->GetSplitScreenPlayers(); + checkList.AddToTail( pPClient ); + CUtlVector< CHandle< CBasePlayer > > &vecParasites = pPClient->GetSplitScreenPlayers(); for ( int i = 0; i < vecParasites.Count(); ++i ) { checkList.AddToTail( vecParasites[ i ] ); diff --git a/src/game/server/episodic/npc_hunter.cpp b/src/game/server/episodic/npc_hunter.cpp index ea06f4a8e..c5006db48 100644 --- a/src/game/server/episodic/npc_hunter.cpp +++ b/src/game/server/episodic/npc_hunter.cpp @@ -6029,8 +6029,8 @@ void CNPC_Hunter::GetShootDir( Vector &vecDir, const Vector &vecSrc, CBaseEntity Vector vecTarget = vecBodyTarget; - Vector vecDelta = pTargetEntity->GetAbsOrigin() - GetAbsOrigin(); - float flDist = vecDelta.Length(); + Vector vecAbsDelta = pTargetEntity->GetAbsOrigin() - GetAbsOrigin(); + float flDist = vecAbsDelta.Length(); if ( !bStriderBuster ) { diff --git a/src/game/server/hl2/cbasehelicopter.cpp b/src/game/server/hl2/cbasehelicopter.cpp index 11c934f70..d46b9f47d 100644 --- a/src/game/server/hl2/cbasehelicopter.cpp +++ b/src/game/server/hl2/cbasehelicopter.cpp @@ -506,9 +506,9 @@ bool CBaseHelicopter::DoWashPush( washentity_t *pWash, const Vector &vecWashOrig NDebugOverlay::Cross3D( pEntity->GetAbsOrigin(), -Vector(4,4,4), Vector(4,4,4), 255, 0, 0, true, 0.1f ); NDebugOverlay::Line( pEntity->GetAbsOrigin(), pEntity->GetAbsOrigin() + vecForce, 255, 255, 0, true, 0.1f ); - IPhysicsObject *pPhysObject = pEntity->VPhysicsGetObject(); + const float fPhysObjectMass = pEntity->VPhysicsGetObject()->GetMass(); Msg("Pushed %s (index %d) (mass %f) with force %f (min %.2f max %.2f) at time %.2f\n", - pEntity->GetClassname(), pEntity->entindex(), pPhysObject->GetMass(), flWashAmount, + pEntity->GetClassname(), pEntity->entindex(), fPhysObjectMass, flWashAmount, BASECHOPPER_WASH_PUSH_MIN * flMass, BASECHOPPER_WASH_PUSH_MAX * flMass, gpGlobals->curtime ); } diff --git a/src/game/server/hltvdirector.cpp b/src/game/server/hltvdirector.cpp index 12f1d9d11..1b82113f4 100644 --- a/src/game/server/hltvdirector.cpp +++ b/src/game/server/hltvdirector.cpp @@ -378,17 +378,17 @@ void CHLTVDirector::StartBestPlayerCameraShot() // search for camera ranking events if ( Q_strcmp( dc.m_Event->GetName(), "hltv_rank_entity") == 0 ) { - int index = dc.m_Event->GetInt("index"); + int iIndex = dc.m_Event->GetInt("index"); - if ( index < MAX_PLAYERS ) + if ( iIndex < MAX_PLAYERS ) { - flPlayerRanking[index] += dc.m_Event->GetFloat("rank" ); + flPlayerRanking[iIndex] += dc.m_Event->GetFloat("rank" ); // find best camera - if ( flPlayerRanking[index] > flBestRank ) + if ( flPlayerRanking[iIndex] > flBestRank ) { - iBestCamera = index; - flBestRank = flPlayerRanking[index]; + iBestCamera = iIndex; + flBestRank = flPlayerRanking[iIndex]; iBestTarget = dc.m_Event->GetInt("target"); } } @@ -487,14 +487,14 @@ void CHLTVDirector::StartBestFixedCameraShot( bool bForce ) // search for camera ranking events if ( Q_strcmp( dc.m_Event->GetName(), "hltv_rank_camera") == 0 ) { - int index = dc.m_Event->GetInt("index"); - flCameraRanking[index] += dc.m_Event->GetFloat("rank" ); + int iIndex = dc.m_Event->GetInt("index"); + flCameraRanking[iIndex] += dc.m_Event->GetFloat("rank" ); // find best camera - if ( flCameraRanking[index] > flBestRank ) + if ( flCameraRanking[iIndex] > flBestRank ) { - iBestCamera = index; - flBestRank = flCameraRanking[index]; + iBestCamera = iIndex; + flBestRank = flCameraRanking[iIndex]; iBestTarget = dc.m_Event->GetInt("target"); } } @@ -686,11 +686,11 @@ bool CHLTVDirector::SetCameraMan( int iPlayerIndex ) for ( int i = 1; i <= gpGlobals->maxClients; i++ ) { - CBasePlayer *pPlayer = UTIL_PlayerByIndex( i ); + CBasePlayer *pPRecipient = UTIL_PlayerByIndex( i ); - if ( pPlayer && pPlayer->GetTeamNumber() == TEAM_SPECTATOR && !pPlayer->IsFakeClient() ) + if ( pPRecipient && pPRecipient->GetTeamNumber() == TEAM_SPECTATOR && !pPRecipient->IsFakeClient() ) { - filter.AddRecipient( pPlayer ); + filter.AddRecipient( pPRecipient ); } } diff --git a/src/game/server/nav_area.cpp b/src/game/server/nav_area.cpp index 81afacd3e..009c22d92 100644 --- a/src/game/server/nav_area.cpp +++ b/src/game/server/nav_area.cpp @@ -1326,25 +1326,25 @@ void CNavArea::FinishSplitEdit( CNavArea *newArea, NavDirType ignoreEdge ) break; } - for ( int a = 0; a < m_incomingConnect[d].Count(); a++ ) - { - CNavArea *adj = m_incomingConnect[d][a].area; + for ( int ia = 0; ia < m_incomingConnect[d].Count(); ia++ ) + { + CNavArea *incAdj = m_incomingConnect[d][ia].area; switch( d ) { case NORTH: case SOUTH: - if (newArea->IsOverlappingX( adj )) + if (newArea->IsOverlappingX( incAdj )) { - adj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); + incAdj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); } break; case EAST: case WEST: - if (newArea->IsOverlappingY( adj )) + if (newArea->IsOverlappingY( incAdj )) { - adj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); + incAdj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); } break; } @@ -2973,7 +2973,7 @@ void CNavArea::Draw( void ) const if ( IsBlocked( TEAM_ANY ) || HasAvoidanceObstacle() || IsDamaging() ) { - NavEditColor color = (IsBlocked( TEAM_ANY ) && ( m_attributeFlags & NAV_MESH_NAV_BLOCKER ) ) ? NavBlockedByFuncNavBlockerColor : NavBlockedByDoorColor; + NavEditColor blockedColor = (IsBlocked( TEAM_ANY ) && ( m_attributeFlags & NAV_MESH_NAV_BLOCKER ) ) ? NavBlockedByFuncNavBlockerColor : NavBlockedByDoorColor; const float blockedInset = 4.0f; nw.x += blockedInset; nw.y += blockedInset; @@ -2983,10 +2983,10 @@ void CNavArea::Draw( void ) const sw.y -= blockedInset; se.x -= blockedInset; se.y -= blockedInset; - NavDrawLine( nw, ne, color ); - NavDrawLine( ne, se, color ); - NavDrawLine( se, sw, color ); - NavDrawLine( sw, nw, color ); + NavDrawLine( nw, ne, blockedColor ); + NavDrawLine( ne, se, blockedColor ); + NavDrawLine( se, sw, blockedColor ); + NavDrawLine( sw, nw, blockedColor ); } } diff --git a/src/game/server/nav_file.cpp b/src/game/server/nav_file.cpp index 71195cb0a..734e01cb9 100644 --- a/src/game/server/nav_file.cpp +++ b/src/game/server/nav_file.cpp @@ -283,8 +283,7 @@ void CNavArea::Save( CUtlBuffer &fileBuffer, unsigned int version ) const // { // save number of encounter paths for this area - unsigned int count = m_spotEncounters.Count(); - fileBuffer.PutUnsignedInt( count ); + fileBuffer.PutUnsignedInt( m_spotEncounters.Count() ); SpotEncounter *e; FOR_EACH_VEC( m_spotEncounters, it ) @@ -348,8 +347,7 @@ void CNavArea::Save( CUtlBuffer &fileBuffer, unsigned int version ) const for ( i=0; iComputeLighting() ) @@ -4038,8 +4039,7 @@ CNavNode *CNavMesh::AddNode( const Vector &destPos, const Vector &normal, NavDir // determine if there's a cliff nearby and set an attribute on this node for ( int i = 0; i < NUM_DIRECTIONS; i++ ) { - NavDirType dir = (NavDirType) i; - if ( CheckCliff( node->GetPosition(), dir ) ) + if ( CheckCliff( node->GetPosition(), static_cast(i) ) ) { node->SetAttributes( node->GetAttributes() | NAV_MESH_CLIFF ); break; diff --git a/src/game/server/physics_impact_damage.cpp b/src/game/server/physics_impact_damage.cpp index e954fc14e..a6024ec74 100644 --- a/src/game/server/physics_impact_damage.cpp +++ b/src/game/server/physics_impact_damage.cpp @@ -440,10 +440,10 @@ float CalculatePhysicsImpactDamage( int index, gamevcollisionevent_t *pEvent, co CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); if ( pPlayer ) { - float mass = pPlayer->GetHeldObjectMass( pEvent->pObjects[index] ); - if ( mass > 0 ) + float massHeld = pPlayer->GetHeldObjectMass( pEvent->pObjects[index] ); + if ( massHeld > 0 ) { - invMass = 1.0f / mass; + invMass = 1.0f / massHeld; } } } diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 08a1fb417..18f1c6eee 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -8789,7 +8789,7 @@ void CBasePlayer::SetPlayerName( const char *name ) if(rd_add_index_to_name.GetBool()) { - int n = V_snprintf(m_szNetname, sizeof(m_szNetname) - 1, "%d-%s", ENTINDEX(edict()), name); + V_snprintf(m_szNetname, sizeof(m_szNetname) - 1, "%d-%s", ENTINDEX(edict()), name); UTIL_SafeUtf8Truncate(m_szNetname, sizeof(m_szNetname)); } else diff --git a/src/game/server/props.cpp b/src/game/server/props.cpp index dfc43c38c..0fe9ac4bb 100644 --- a/src/game/server/props.cpp +++ b/src/game/server/props.cpp @@ -1795,16 +1795,16 @@ void CBreakableProp::Break( CBaseEntity *pBreaker, const CTakeDamageInfo &info ) { CPASFilter filter( WorldSpaceCenter() ); - Vector velocity; velocity.Init(); + Vector vVelocity; vVelocity.Init(); if ( pPhysics ) - pPhysics->GetVelocity( &velocity, NULL ); + pPhysics->GetVelocity( &vVelocity, NULL ); switch ( GetMultiplayerBreakMode() ) { case MULTIPLAYER_BREAK_DEFAULT: // default is to break client-side case MULTIPLAYER_BREAK_CLIENTSIDE: - te->PhysicsProp( filter, -1, GetModelIndex(), m_nSkin, GetAbsOrigin(), GetAbsAngles(), velocity, true, GetEffects() ); + te->PhysicsProp( filter, -1, GetModelIndex(), m_nSkin, GetAbsOrigin(), GetAbsAngles(), vVelocity, true, GetEffects() ); break; case MULTIPLAYER_BREAK_SERVERSIDE: // server-side break if ( m_PerformanceMode != PM_NO_GIBS || breakable_disable_gib_limit.GetBool() ) @@ -1813,7 +1813,7 @@ void CBreakableProp::Break( CBaseEntity *pBreaker, const CTakeDamageInfo &info ) } break; case MULTIPLAYER_BREAK_BOTH: // pieces break from both dlls - te->PhysicsProp( filter, -1, GetModelIndex(), m_nSkin, GetAbsOrigin(), GetAbsAngles(), velocity, true, GetEffects() ); + te->PhysicsProp( filter, -1, GetModelIndex(), m_nSkin, GetAbsOrigin(), GetAbsAngles(), vVelocity, true, GetEffects() ); if ( m_PerformanceMode != PM_NO_GIBS || breakable_disable_gib_limit.GetBool() ) { PropBreakableCreateAll( GetModelIndex(), pPhysics, params, this, -1, ( m_PerformanceMode == PM_FULL_GIBS ), false ); diff --git a/src/game/server/sceneentity.cpp b/src/game/server/sceneentity.cpp index d7ff56216..46f724e60 100644 --- a/src/game/server/sceneentity.cpp +++ b/src/game/server/sceneentity.cpp @@ -1850,8 +1850,7 @@ void CSceneEntity::DispatchStartSpeak( CChoreoScene *scene, CBaseFlex *actor, CC if ( !event->IsSuppressingCaptionAttenuation() && ( filter.GetRecipientCount() > 0 ) ) { - int c = filter.GetRecipientCount(); - for ( int i = c - 1 ; i >= 0; --i ) + for ( int i = filter.GetRecipientCount() - 1 ; i >= 0; --i ) { CBasePlayer *player = UTIL_PlayerByIndex( filter.GetRecipientIndex( i ) ); if ( !player ) @@ -2247,8 +2246,7 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata ) } CUtlVector< CAI_BaseActor * > candidates; - int i; - for ( i = 0 ; i < m_pScene->GetNumActors(); i++ ) + for ( int i = 0 ; i < m_pScene->GetNumActors(); i++ ) { CBaseFlex *pTestActor = FindNamedActor( i ); if ( !pTestActor ) diff --git a/src/game/server/swarm/asw_gamerules_vscript.cpp b/src/game/server/swarm/asw_gamerules_vscript.cpp index f6e50b6ce..0af07e006 100644 --- a/src/game/server/swarm/asw_gamerules_vscript.cpp +++ b/src/game/server/swarm/asw_gamerules_vscript.cpp @@ -1368,15 +1368,15 @@ void CAlienSwarm::RunScriptFunctionInListenerScopes( const char *szFunctionName, CASW_Challenge_Thinker *pThinker = CASW_Challenge_Thinker::s_Thinkers[i]; if ( HSCRIPT hScope = pThinker->GetScriptScope() ) { - if ( HSCRIPT hFunc = g_pScriptVM->LookupFunction( szFunctionName, hScope ) ) + if ( HSCRIPT hScopedFunc = g_pScriptVM->LookupFunction( szFunctionName, hScope ) ) { - ScriptStatus_t nStatus = g_pScriptVM->ExecuteFunction( hFunc, pArgs, nArgs, pReturn, hScope, false ); + ScriptStatus_t nStatus = g_pScriptVM->ExecuteFunction( hScopedFunc, pArgs, nArgs, pReturn, hScope, false ); if ( nStatus != SCRIPT_DONE ) { DevWarning( "%s VScript function for thinker #%d:%s did not finish!\n", szFunctionName, pThinker->entindex(), pThinker->GetDebugName() ); } - g_pScriptVM->ReleaseFunction( hFunc ); + g_pScriptVM->ReleaseFunction( hScopedFunc ); } } } From f51f48bf80ca1a33e59fc81f4e659540c13a8ff7 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 16:17:43 +0200 Subject: [PATCH 02/30] rename value -> position --- src/game/server/buttons.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/server/buttons.cpp b/src/game/server/buttons.cpp index aa44e7351..e70968ac5 100644 --- a/src/game/server/buttons.cpp +++ b/src/game/server/buttons.cpp @@ -1316,18 +1316,18 @@ void CMomentaryRotButton::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, US // Must be first! g_EventQueue.AddEvent( this, "_DisableUpdateTarget", 0, this, this ); - variant_t value; - value.SetFloat( flDist ); - g_EventQueue.AddEvent( this, "SetPosition", value, 0.01, this, this ); + variant_t position; + position.SetFloat( flDist ); + g_EventQueue.AddEvent( this, "SetPosition", position, 0.01, this, this ); - value.SetFloat( 0.0 ); - g_EventQueue.AddEvent( this, "SetPosition", value, 0.1, this, this ); + position.SetFloat( 0.0 ); + g_EventQueue.AddEvent( this, "SetPosition", position, 0.1, this, this ); - value.SetFloat( 0.5 * flDist ); - g_EventQueue.AddEvent( this, "SetPosition", value, 0.2, this, this ); + position.SetFloat( 0.5 * flDist ); + g_EventQueue.AddEvent( this, "SetPosition", position, 0.2, this, this ); - value.SetFloat( 0.0 ); - g_EventQueue.AddEvent( this, "SetPosition", value, 0.3, this, this ); + position.SetFloat( 0.0 ); + g_EventQueue.AddEvent( this, "SetPosition", position, 0.3, this, this ); // Must be last! And must be late enough to cover the settling time. g_EventQueue.AddEvent( this, "_EnableUpdateTarget", 0.5, this, this ); From 1a19c8fa6cb5a68ec17befb82b05eb4764811c5a Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 15:58:00 +0200 Subject: [PATCH 03/30] rename ptag -> ptagOriginal --- src/game/server/baseflex.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/server/baseflex.cpp b/src/game/server/baseflex.cpp index 291e75035..8eb299442 100644 --- a/src/game/server/baseflex.cpp +++ b/src/game/server/baseflex.cpp @@ -631,14 +631,14 @@ bool CBaseFlex::HandleStartGestureSceneEvent( CSceneEventInfo *info, CChoreoScen { float percentage = (float)pkvTags->GetInt() / maxFrame; - CEventAbsoluteTag *ptag = event->FindAbsoluteTag( CChoreoEvent::ORIGINAL, pkvTags->GetName() ); - if (ptag) + CEventAbsoluteTag *ptagOriginal = event->FindAbsoluteTag( CChoreoEvent::ORIGINAL, pkvTags->GetName() ); + if (ptagOriginal) { - if (fabs(ptag->GetPercentage() - percentage) > 0.05) + if (fabs(ptagOriginal->GetPercentage() - percentage) > 0.05) { - DevWarning("%s repositioned tag: %s : %.3f -> %.3f (%s:%s:%s)\n", scene->GetFilename(), pkvTags->GetName(), ptag->GetPercentage(), percentage, scene->GetFilename(), actor->GetName(), event->GetParameters() ); + DevWarning("%s repositioned tag: %s : %.3f -> %.3f (%s:%s:%s)\n", scene->GetFilename(), pkvTags->GetName(), ptagOriginal->GetPercentage(), percentage, scene->GetFilename(), actor->GetName(), event->GetParameters() ); // reposition tag - ptag->SetPercentage( percentage ); + ptagOriginal->SetPercentage( percentage ); } } } From 44f348781d5817169a234a596bfc0b4c24c52d9f Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 14:20:44 +0200 Subject: [PATCH 04/30] rename flGain --- src/game/server/ambientgeneric.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game/server/ambientgeneric.cpp b/src/game/server/ambientgeneric.cpp index d5c7b83bf..82e5f993f 100644 --- a/src/game/server/ambientgeneric.cpp +++ b/src/game/server/ambientgeneric.cpp @@ -185,8 +185,8 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( ) // Sadly, there's no direct way of getting at this. // We have to do an interative computation. - float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, m_radius ); - if ( flGain <= MIN_AUDIBLE_VOLUME ) + const float flGainMRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, m_radius ); + if ( flGainMRadius <= MIN_AUDIBLE_VOLUME ) { m_flMaxRadius = m_radius; return; @@ -197,8 +197,8 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( ) while ( true ) { // First, find a min + max range surrounding the desired distance gain - float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flMaxRadius ); - if ( flGain <= MIN_AUDIBLE_VOLUME ) + const float flGainMaxRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flMaxRadius ); + if ( flGainMaxRadius <= MIN_AUDIBLE_VOLUME ) break; // Always audible. @@ -216,9 +216,9 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( ) int nInterations = 4; while ( --nInterations >= 0 ) { - float flTestRadius = (flMinRadius + flMaxRadius) * 0.5f; - float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flTestRadius ); - if ( flGain <= MIN_AUDIBLE_VOLUME ) + const float flTestRadius = (flMinRadius + flMaxRadius) * 0.5f; + const float flGainTestRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flTestRadius ); + if ( flGainTestRadius <= MIN_AUDIBLE_VOLUME ) { flMaxRadius = flTestRadius; } From f41678dbdda1f4184ca6dcff0fa1d627e10bd59c Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 16:04:50 +0200 Subject: [PATCH 05/30] remove second controller reference getter --- src/game/server/hl2/npc_attackchopper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/hl2/npc_attackchopper.cpp b/src/game/server/hl2/npc_attackchopper.cpp index 2499a0c00..1a436623c 100644 --- a/src/game/server/hl2/npc_attackchopper.cpp +++ b/src/game/server/hl2/npc_attackchopper.cpp @@ -3743,7 +3743,7 @@ void CNPC_AttackHelicopter::Event_Killed( const CTakeDamageInfo &info ) SetDesiredPosition( pCrashPoint->GetAbsOrigin() ); // Start the failing engine sound - CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); + // CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); controller.SoundDestroy( m_pRotorSound ); CPASAttenuationFilter filter( this ); From e2d90e9319d966219b9ee628c003439704ab6d09 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Wed, 3 Jun 2026 17:43:58 +0200 Subject: [PATCH 06/30] remove second compute flTotalDist --- src/game/server/ai_pathfinder.cpp | 6 +++--- src/game/server/ai_pathfinder.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/server/ai_pathfinder.cpp b/src/game/server/ai_pathfinder.cpp index c2d10d0f1..98b5b3eff 100644 --- a/src/game/server/ai_pathfinder.cpp +++ b/src/game/server/ai_pathfinder.cpp @@ -929,13 +929,13 @@ AI_Waypoint_t *CAI_Pathfinder::BuildSimpleRoute( Navigation_t navType, const Vec //----------------------------------------------------------------------------- // Builds a complex route (triangulation, making way) //----------------------------------------------------------------------------- -AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( Navigation_t navType, const Vector &vStart, +AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( const Navigation_t navType, const Vector &vStart, const Vector &vEnd, const CBaseEntity *pTarget, int endFlags, int nodeID, int buildFlags, float flYaw, float goalTolerance, float maxLocalNavDistance ) { AI_PROFILE_SCOPE( CAI_Pathfinder_BuildComplexRoute ); - float flTotalDist = ComputePathDistance( navType, vStart, vEnd ); + const float flTotalDist = ComputePathDistance( navType, vStart, vEnd ); if ( flTotalDist < 0.0625 ) { return new AI_Waypoint_t( vEnd, flYaw, navType, endFlags, nodeID ); @@ -980,7 +980,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( Navigation_t navType, const Ve { if ( !UseStrongOptimizations() || ( GetOuter()->GetState() == NPC_STATE_SCRIPT || GetOuter()->IsCurSchedule( SCHED_SCENE_GENERIC, false ) ) ) { - float flTotalDist = ComputePathDistance( navType, vStart, vEnd ); + // float flTotalDist = ComputePathDistance( navType, vStart, vEnd ); // already calculated above AI_Waypoint_t *triangRoute = BuildTriangulationRoute(vStart, vEnd, pTarget, endFlags, nodeID, flYaw, flTotalDist - moveTrace.flDistObstructed, navType); diff --git a/src/game/server/ai_pathfinder.h b/src/game/server/ai_pathfinder.h index db765c644..675a016e2 100644 --- a/src/game/server/ai_pathfinder.h +++ b/src/game/server/ai_pathfinder.h @@ -134,7 +134,7 @@ class CAI_Pathfinder : public CAI_Component const CBaseEntity *pTarget, int endFlags, int nodeID, int nodeTargetType, float flYaw); // Builds a complex route (triangulation, making way) - AI_Waypoint_t *BuildComplexRoute( Navigation_t navType, const Vector &vStart, + AI_Waypoint_t *BuildComplexRoute( const Navigation_t navType, const Vector &vStart, const Vector &vEnd, const CBaseEntity *pTarget, int endFlags, int nodeID, int buildFlags, float flYaw, float goalTolerance, float maxLocalNavDistance ); From 9fc1112c83f8c0fd9842f05c260be3061b0cffd1 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 19:27:33 +0200 Subject: [PATCH 07/30] rename origin/angles -> shadowOrigin/shadowAngles --- src/game/server/baseentity.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index f455f6237..c8aef63c8 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -3037,17 +3037,17 @@ void CBaseEntity::VPhysicsUpdatePusher( IPhysicsObject *pPhysics ) if ( !PhysIsFinalTick() ) return; - Vector origin; - QAngle angles; + Vector shadowOrigin; + QAngle shadowAngles; // physics updated the shadow, so check to see if I got blocked // NOTE: SOLID_BSP cannont compute consistent collisions wrt vphysics, so // don't allow vphysics to block. Assume game physics has handled it. - if ( GetSolid() != SOLID_BSP && pPhysics->GetShadowPosition( &origin, &angles ) ) + if ( GetSolid() != SOLID_BSP && pPhysics->GetShadowPosition( &shadowOrigin, &shadowAngles ) ) { CUtlVector list; GetAllInHierarchy( this, list ); - //NDebugOverlay::BoxAngles( origin, CollisionProp()->OBBMins(), CollisionProp()->OBBMaxs(), angles, 255,0,0,0, gpGlobals->frametime); + //NDebugOverlay::BoxAngles( shadowOrigin, CollisionProp()->OBBMins(), CollisionProp()->OBBMaxs(), shadowAngles, 255,0,0,0, gpGlobals->frametime); physicspushlist_t *pList = NULL; if ( HasDataObjectType(PHYSICSPUSHLIST) ) From 8f1e38a8b9d399ed09aedde0ccbba5e96042dcaa Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 19:21:06 +0200 Subject: [PATCH 08/30] rename origin -> hanging_origin --- src/game/server/ai_basenpc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/server/ai_basenpc.cpp b/src/game/server/ai_basenpc.cpp index 4bee28965..66f5cf568 100644 --- a/src/game/server/ai_basenpc.cpp +++ b/src/game/server/ai_basenpc.cpp @@ -12158,9 +12158,9 @@ bool CAI_BaseNPC::CineCleanup() } else if ( drop == 0 ) // Hanging in air? { - Vector origin = GetLocalOrigin(); - origin.z = new_origin.z; - SetLocalOrigin( origin ); + Vector hanging_origin = GetLocalOrigin(); + hanging_origin.z = new_origin.z; + SetLocalOrigin( hanging_origin ); SetGroundEntity( NULL ); } } From bf8ae78c071eacf7b02b63da3ee8911e9882b2b1 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 19:32:31 +0200 Subject: [PATCH 09/30] remove second pInflictor getter --- src/game/server/episodic/npc_hunter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/episodic/npc_hunter.cpp b/src/game/server/episodic/npc_hunter.cpp index c5006db48..b30ef7c73 100644 --- a/src/game/server/episodic/npc_hunter.cpp +++ b/src/game/server/episodic/npc_hunter.cpp @@ -5659,7 +5659,7 @@ int CNPC_Hunter::OnTakeDamage_Alive( const CTakeDamageInfo &info ) } else { - CBaseEntity *pInflictor = info.GetInflictor(); + // CBaseEntity *pInflictor = info.GetInflictor(); if ( ( info.GetDamageType() & DMG_VEHICLE ) || ( pInflictor && pInflictor->GetServerVehicle() && ( ( bHitByUnoccupiedCar = ( dynamic_cast(pInflictor) && static_cast(pInflictor)->GetDriver() == NULL ) ) == false ) ) ) From 2b4bfa48cb14dca777e8ae4f512d35f967c77919 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 14:56:35 +0200 Subject: [PATCH 10/30] rename args -> scriptArgs --- src/game/server/client.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/server/client.cpp b/src/game/server/client.cpp index d8bb54dba..ccab8cb74 100644 --- a/src/game/server/client.cpp +++ b/src/game/server/client.cpp @@ -239,14 +239,14 @@ void Host_Say( edict_t *pEdict, const CCommand &args, bool teamonly ) #ifdef INFESTED_DLL if ( CAlienSwarm *pAlienSwarm = ASWGameRules() ) { - ScriptVariant_t args[3]; - args[0] = ToHScript( client ); - args[1] = ToHScript( pPlayer ); - args[2] = ScriptVariant_t( newText ); + ScriptVariant_t scriptArgs[3]; + scriptArgs[0] = ToHScript( client ); + scriptArgs[1] = ToHScript( pPlayer ); + scriptArgs[2] = ScriptVariant_t( newText ); - pAlienSwarm->RunScriptFunctionInListenerScopes( "OnReceivedTextMessage", &args[2], NELEMS(args), args ); + pAlienSwarm->RunScriptFunctionInListenerScopes( "OnReceivedTextMessage", &scriptArgs[2], NELEMS(scriptArgs), scriptArgs ); - ScriptVariant_t result = args[2]; + ScriptVariant_t result = scriptArgs[2]; if ( result.m_type != FIELD_CSTRING ) continue; From b0d6232557fbb3b9c159f810b47e58531a3be9bf Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 18:29:09 +0200 Subject: [PATCH 11/30] rename p1234 -> vP1234 --- src/game/shared/util_shared.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/shared/util_shared.cpp b/src/game/shared/util_shared.cpp index 97f555e4e..f90e2897c 100644 --- a/src/game/shared/util_shared.cpp +++ b/src/game/shared/util_shared.cpp @@ -1837,37 +1837,37 @@ int UTIL_CalcFrustumThroughConvexPolygon( const Vector *pPolyVertices, int iPoly i3 = (iMinSideFirstPoint + 1)%(iOldVertCount); i4 = (iMinSideFirstPoint + 2)%(iOldVertCount); - Vector *p1, *p2, *p3, *p4; - p1 = &pClippedVerts[i1]; - p2 = &pClippedVerts[i2]; - p3 = &pClippedVerts[i3]; //this is the one we'll actually be dropping in the merge - p4 = &pClippedVerts[i4]; + Vector *vP1, *vP2, *vP3, *vP4; + vP1 = &pClippedVerts[i1]; + vP2 = &pClippedVerts[i2]; + vP3 = &pClippedVerts[i3]; //this is the one we'll actually be dropping in the merge + vP4 = &pClippedVerts[i4]; //now we know the two points that we have to merge to one, project and make a merged point from the surrounding lines //if( fMinSide >= 0.1f ) //only worth doing the math if it's actually going to be accurate and make a difference { //http://mathworld.wolfram.com/Line-LineIntersection.html (20) - Vector vA = *p2 - *p1; - Vector vB = *p4 - *p3; - Vector vC = *p3 - *p1; + Vector vA = *vP2 - *vP1; + Vector vB = *vP4 - *vP3; + Vector vC = *vP3 - *vP1; Vector vCxB = vC.Cross( vB ); Vector vAxB = vA.Cross( vB ); float fS = vCxB.Dot(vAxB)/vAxB.LengthSqr(); - *p2 = *p1 + (vA * fS); + *vP2 = *vP1 + (vA * fS); - fLineLengthSqr[i1] = (*p2 - *p1).LengthSqr(); + fLineLengthSqr[i1] = (*vP2 - *vP1).LengthSqr(); } - fLineLengthSqr[i2] = (*p4 - *p2).LengthSqr(); //must do this BEFORE possibly shifting points p4+ left + fLineLengthSqr[i2] = (*vP4 - *vP2).LengthSqr(); //must do this BEFORE possibly shifting points p4+ left if( i3 < i4 ) //not the last point in the array { int iElementShift = (iOldVertCount - i4); //eliminate p3, we merged p2+p3 and already stored the result in p2 - memmove( p3, p4, sizeof( Vector ) * iElementShift ); + memmove( vP3, vP4, sizeof( Vector ) * iElementShift ); memmove( &fLineLengthSqr[i3], &fLineLengthSqr[i4], sizeof( float ) * iElementShift ); } } From 3fd975b1055201363bedd928eedf171c23e5c73f Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 14:15:48 +0200 Subject: [PATCH 12/30] rename taskID -> taskID2 --- src/game/server/ai_schedule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/server/ai_schedule.cpp b/src/game/server/ai_schedule.cpp index 46944ae5d..1882177d1 100644 --- a/src/game/server/ai_schedule.cpp +++ b/src/game/server/ai_schedule.cpp @@ -287,8 +287,8 @@ bool CAI_SchedulesManager::LoadSchedulesFromBuffer( const char *prefix, char *pS pfile = engine->ParseFile(pfile, token, sizeof( token ) ); // Convert generic ID to sub-class specific enum - int taskID = CAI_BaseNPC::GetTaskID(token); - tempTask[taskNum].flTaskData = (pIdSpace) ? pIdSpace->TaskGlobalToLocal(taskID) : AI_RemapFromGlobal( taskID ); + int taskID2 = CAI_BaseNPC::GetTaskID(token); + tempTask[taskNum].flTaskData = (pIdSpace) ? pIdSpace->TaskGlobalToLocal(taskID2) : AI_RemapFromGlobal( taskID2 ); if (tempTask[taskNum].flTaskData == -1) { From 0bf110c4fc6d9a71fd18705f3eba0974627f10c2 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:10:31 +0200 Subject: [PATCH 13/30] rename goal -> lateralCoverGoal --- src/game/server/ai_basenpc_schedule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/server/ai_basenpc_schedule.cpp b/src/game/server/ai_basenpc_schedule.cpp index 832e71c76..74ade787f 100644 --- a/src/game/server/ai_basenpc_schedule.cpp +++ b/src/game/server/ai_basenpc_schedule.cpp @@ -2146,8 +2146,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask ) if ( GetTacticalServices()->FindLateralCover( pEntity->EyePosition(), 0, &coverPos ) ) { - AI_NavGoal_t goal( coverPos, ACT_RUN ); - GetNavigator()->SetGoal( goal, AIN_CLEAR_PREVIOUS_STATE ); + AI_NavGoal_t lateralCoverGoal( coverPos, ACT_RUN ); + GetNavigator()->SetGoal( lateralCoverGoal, AIN_CLEAR_PREVIOUS_STATE ); //FIXME: What exactly is this doing internally? m_flMoveWaitFinished = gpGlobals->curtime + pTask->flTaskData; From 9bbda5da4d3804c44ef8995c76bb10eb039710da Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:10:48 +0200 Subject: [PATCH 14/30] add comment for coverGoal --- src/game/server/ai_basenpc_schedule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/server/ai_basenpc_schedule.cpp b/src/game/server/ai_basenpc_schedule.cpp index 74ade787f..fb402263d 100644 --- a/src/game/server/ai_basenpc_schedule.cpp +++ b/src/game/server/ai_basenpc_schedule.cpp @@ -2166,7 +2166,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask ) AIN_HULL_TOLERANCE, AIN_DEF_FLAGS, m_hStoredPathTarget ); - + + // bug? why goal and not coverGoal? foundPath = GetNavigator()->SetGoal( goal ); m_flMoveWaitFinished = gpGlobals->curtime + pTask->flTaskData; From 01f702373c6902f88d90c1dee455f70cec2aba42 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 20:09:09 +0200 Subject: [PATCH 15/30] refactor(client): rename index -> m_index maybe missed some outcommented --- src/game/client/c_baseanimating.cpp | 6 ++-- src/game/client/c_baseentity.cpp | 32 +++++++++---------- src/game/client/c_baseentity.h | 4 +-- src/game/client/c_baseplayer.cpp | 10 +++--- src/game/client/c_beamspotlight.cpp | 4 +-- src/game/client/c_dynamiclight.cpp | 12 +++---- src/game/client/c_entityflame.cpp | 2 +- src/game/client/c_plasma.cpp | 4 +-- src/game/client/c_recipientfilter.cpp | 6 ++-- src/game/client/c_spotlight_end.cpp | 8 ++--- src/game/client/c_te_legacytempents.cpp | 8 ++--- src/game/client/c_team.cpp | 4 +-- src/game/client/hl2/fx_hl2_tracers.cpp | 2 +- .../swarm/c_asw_aoegrenade_projectile.cpp | 2 +- src/game/client/swarm/c_asw_dynamic_light.cpp | 4 +-- .../client/swarm/c_asw_flamer_projectile.cpp | 4 +-- .../client/swarm/c_asw_flare_projectile.cpp | 2 +- src/game/client/swarm/c_asw_marine.cpp | 8 ++--- .../swarm/c_asw_mesh_emitter_entity.cpp | 6 ++-- src/game/client/swarm/c_asw_player.cpp | 2 +- src/game/client/swarm/c_asw_weapon.cpp | 2 +- src/game/client/swarm/clientmode_asw.cpp | 2 +- src/game/shared/predictioncopy_helpers.cpp | 6 ++-- src/game/shared/swarm/asw_deathmatch_mode.cpp | 4 +-- .../swarm/asw_weapon_revive_tool_shared.cpp | 2 +- 25 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 1f8a1fc37..54870b6bb 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -2741,7 +2741,7 @@ bool C_BaseAnimating::SetupBones( matrix3x4a_t *pBoneToWorldOut, int nMaxBones, // Prevent spammage!!! if ( gpGlobals->realtime >= lastWarning + 1.0f ) { - DevMsgRT( "*** ERROR: Bone access not allowed (entity %i:%s)\n", index, GetClassname() ); + DevMsgRT( "*** ERROR: Bone access not allowed (entity %i:%s)\n", m_index, GetClassname() ); lastWarning = gpGlobals->realtime; } } @@ -3504,7 +3504,7 @@ int C_BaseAnimating::InternalDrawModel( int flags, const RenderableInstance_t &i pInfo->flags = flags; pInfo->pRenderable = this; pInfo->instance = GetModelInstance(); - pInfo->entity_index = index; + pInfo->entity_index = m_index; pInfo->pModel = GetModel(); pInfo->origin = GetRenderOrigin(); pInfo->angles = GetRenderAngles(); @@ -3579,7 +3579,7 @@ void C_BaseAnimating::ProcessMuzzleFlashEvent() GetAttachment( 1, vAttachment, dummyAngles ); // Make an elight - dlight_t *el = effects->CL_AllocElight( LIGHT_INDEX_MUZZLEFLASH + index ); + dlight_t *el = effects->CL_AllocElight( LIGHT_INDEX_MUZZLEFLASH + m_index ); el->origin = vAttachment; el->radius = random->RandomInt( 32, 64 ); el->decay = el->radius / 0.05f; diff --git a/src/game/client/c_baseentity.cpp b/src/game/client/c_baseentity.cpp index f2816dce3..3209ca692 100644 --- a/src/game/client/c_baseentity.cpp +++ b/src/game/client/c_baseentity.cpp @@ -1139,7 +1139,7 @@ void C_BaseEntity::Clear( void ) m_hThink = INVALID_THINK_HANDLE; m_AimEntsListHandle = INVALID_AIMENTS_LIST_HANDLE; - index = -1; + m_index = -1; m_Collision.Init( this ); CleanUpAlphaProperty(); m_pClientAlphaProperty = static_cast< CClientAlphaProperty * >( g_pClientAlphaPropertyMgr->CreateClientAlphaProperty( this ) ); @@ -1237,8 +1237,8 @@ bool C_BaseEntity::Init( int entnum, int iSerialNum ) { Assert( entnum >= 0 && entnum < NUM_ENT_ENTRIES ); - index = entnum; - m_pClientAlphaProperty->SetDesyncOffset( index ); + m_index = entnum; + m_pClientAlphaProperty->SetDesyncOffset( m_index ); cl_entitylist->AddNetworkableEntity( GetIClientUnknown(), entnum, iSerialNum ); @@ -1301,7 +1301,7 @@ bool C_BaseEntity::InitializeAsClientEntityByIndex( int iIndex, bool bRenderWith // Add the client entity to the spatial partition. (Collidable) CollisionProp()->CreatePartitionHandle(); - index = -1; + m_index = -1; m_pClientAlphaProperty->SetDesyncOffset( rand() % 1024 ); SpawnClientEntity(); @@ -1350,7 +1350,7 @@ void C_BaseEntity::Term() CollisionProp()->DestroyPartitionHandle(); // If Client side only entity index will be -1 - if ( index != -1 ) + if ( m_index != -1 ) { beams->KillDeadBeams( this ); } @@ -1703,7 +1703,7 @@ bool C_BaseEntity::ShouldDraw() return false; } - return (model != 0) && !IsEffectActive(EF_NODRAW) && (index != 0); + return (model != 0) && !IsEffectActive(EF_NODRAW) && (m_index != 0); } bool C_BaseEntity::TestCollision( const Ray_t& ray, unsigned int mask, trace_t& trace ) @@ -1891,15 +1891,15 @@ IClientRenderable *C_BaseEntity::NextShadowPeer() //----------------------------------------------------------------------------- int C_BaseEntity::entindex( void ) const { - return index; + return m_index; } int C_BaseEntity::GetSoundSourceIndex() const { #ifdef _DEBUG - if ( index != -1 ) + if ( m_index != -1 ) { - Assert( index == GetRefEHandle().GetEntryIndex() ); + Assert( m_index == GetRefEHandle().GetEntryIndex() ); } #endif return GetRefEHandle().GetEntryIndex(); @@ -2833,7 +2833,7 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType ) } // If it's the world, force solid flags - if ( index == 0 ) + if ( m_index == 0 ) { m_nModelIndex = 1; SetSolid( SOLID_BSP ); @@ -3285,7 +3285,7 @@ bool C_BaseEntity::CreateLightEffects( void ) if (IsEffectActive(EF_BRIGHTLIGHT)) { bHasLightEffects = true; - dl = effects->CL_AllocDlight ( index ); + dl = effects->CL_AllocDlight ( m_index ); dl->origin = GetAbsOrigin(); dl->origin[2] += 16; dl->color.r = dl->color.g = dl->color.b = 250; @@ -3295,7 +3295,7 @@ bool C_BaseEntity::CreateLightEffects( void ) if (IsEffectActive(EF_DIMLIGHT)) { bHasLightEffects = true; - dl = effects->CL_AllocDlight ( index ); + dl = effects->CL_AllocDlight ( m_index ); dl->origin = GetAbsOrigin(); dl->color.r = dl->color.g = dl->color.b = 100; dl->radius = random->RandomFloat(200,231); @@ -3319,7 +3319,7 @@ bool C_BaseEntity::ShouldInterpolate() if ( IsViewEntity() ) return true; - if ( index == 0 || !GetModel() ) + if ( m_index == 0 || !GetModel() ) return false; // always interpolate if visible @@ -3607,7 +3607,7 @@ void C_BaseEntity::OnDataChanged( DataUpdateType_t type ) // These may have changed in the network update AlphaProp()->SetRenderFX( GetRenderFX(), GetRenderMode() ); - AlphaProp()->SetDesyncOffset( index ); + AlphaProp()->SetDesyncOffset( m_index ); // Copy in fade parameters AlphaProp()->SetFade( m_flFadeScale, m_fadeMinDist, m_fadeMaxDist ); @@ -3738,7 +3738,7 @@ void C_BaseEntity::AddBrushModelDecal( const Ray_t& ray, const Vector& decalCent vecNormal *= -1.0f; } - effects->DecalShoot( decalIndex, index, + effects->DecalShoot( decalIndex, m_index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, NULL, 0, &vecNormal ); } @@ -4045,7 +4045,7 @@ void C_BaseEntity::SetDormant( bool bDormant ) ParticleProp()->OwnerSetDormantTo( bDormant ); OnSetDormant( bDormant ); - cl_entitylist->SetDormant(index, bDormant); + cl_entitylist->SetDormant(m_index, bDormant); } //----------------------------------------------------------------------------- diff --git a/src/game/client/c_baseentity.h b/src/game/client/c_baseentity.h index 64e477210..43d4c5022 100644 --- a/src/game/client/c_baseentity.h +++ b/src/game/client/c_baseentity.h @@ -1387,7 +1387,7 @@ class C_BaseEntity : public IClientEntity public: // Determine what entity this corresponds to - int index; + int m_index; // Entity flags that are only for the client (ENTCLIENTFLAG_ defines). unsigned short m_EntClientFlags; @@ -1908,7 +1908,7 @@ inline const CParticleProperty *C_BaseEntity::ParticleProp() const //----------------------------------------------------------------------------- inline bool C_BaseEntity::IsServerEntity( void ) { - return index != -1; + return m_index != -1; } //----------------------------------------------------------------------------- diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index 437a2e3a7..eed616924 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -689,7 +689,7 @@ void C_BasePlayer::CheckForLocalPlayer( int nSplitScreenSlot ) if ( g_nKillCamMode ) iLocalPlayerIndex = g_nKillCamTarget1; - if ( iLocalPlayerIndex == index ) + if ( iLocalPlayerIndex == m_index ) { Assert( s_pLocalPlayer[ nSplitScreenSlot ] == NULL ); s_pLocalPlayer[ nSplitScreenSlot ] = this; @@ -738,7 +738,7 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType ) FOR_EACH_VALID_SPLITSCREEN_PLAYER( i ) { int nIndex = engine->GetSplitScreenPlayer( i ); - if ( nIndex == index ) + if ( nIndex == m_index ) { nSlot = i; break; @@ -1182,7 +1182,7 @@ void C_BasePlayer::UpdateFlashlight() if ( pFlashlightPlayer ) { - FlashlightEffectManager().SetEntityIndex( pFlashlightPlayer->index ); + FlashlightEffectManager().SetEntityIndex( pFlashlightPlayer->m_index ); } // The dim light is the flashlight. @@ -1195,12 +1195,12 @@ void C_BasePlayer::UpdateFlashlight() // Turned on the headlight; create it. if ( pszTextureName ) { - FlashlightEffectManager().TurnOnFlashlight( pFlashlightPlayer->index, pszTextureName, pFlashlightPlayer->GetFlashlightFOV(), + FlashlightEffectManager().TurnOnFlashlight( pFlashlightPlayer->m_index, pszTextureName, pFlashlightPlayer->GetFlashlightFOV(), pFlashlightPlayer->GetFlashlightFarZ(), pFlashlightPlayer->GetFlashlightLinearAtten() ); } else { - FlashlightEffectManager().TurnOnFlashlight( pFlashlightPlayer->index ); + FlashlightEffectManager().TurnOnFlashlight( pFlashlightPlayer->m_index ); } m_bFlashlightEnabled[ iSsPlayer ] = true; } diff --git a/src/game/client/c_beamspotlight.cpp b/src/game/client/c_beamspotlight.cpp index ceeb7d70d..16842e2de 100644 --- a/src/game/client/c_beamspotlight.cpp +++ b/src/game/client/c_beamspotlight.cpp @@ -337,9 +337,9 @@ void C_BeamSpotLight::ComputeRenderInfo() return; // Deal with the environment light - if ( !m_pDynamicLight || (m_pDynamicLight->key != index) ) + if ( !m_pDynamicLight || (m_pDynamicLight->key != m_index) ) { - m_pDynamicLight = effects->CL_AllocDlight( index ); + m_pDynamicLight = effects->CL_AllocDlight( m_index ); assert (m_pDynamicLight); } diff --git a/src/game/client/c_dynamiclight.cpp b/src/game/client/c_dynamiclight.cpp index 323abe961..df13d1fa0 100644 --- a/src/game/client/c_dynamiclight.cpp +++ b/src/game/client/c_dynamiclight.cpp @@ -134,14 +134,14 @@ void C_DynamicLight::ClientThink(void) if ( (m_Flags & DLIGHT_NO_MODEL_ILLUMINATION) == 0 ) { // Deal with the model light - if ( !m_pDynamicLight || (m_pDynamicLight->key != index) ) + if ( !m_pDynamicLight || (m_pDynamicLight->key != m_index) ) { #if DLIGHT_NO_WORLD_USES_ELIGHT m_pDynamicLight = ShouldBeElight() != 0 - ? effects->CL_AllocElight( index ) - : effects->CL_AllocDlight( index ); + ? effects->CL_AllocElight( m_index ) + : effects->CL_AllocDlight( m_index ); #else - m_pDynamicLight = effects->CL_AllocDlight( index ); + m_pDynamicLight = effects->CL_AllocDlight( m_index ); #endif Assert (m_pDynamicLight); m_pDynamicLight->minlight = 0; @@ -181,9 +181,9 @@ void C_DynamicLight::ClientThink(void) { // Raycast to where the endpoint goes // Deal with the environment light - if ( !m_pSpotlightEnd || (m_pSpotlightEnd->key != -index) ) + if ( !m_pSpotlightEnd || (m_pSpotlightEnd->key != -m_index) ) { - m_pSpotlightEnd = effects->CL_AllocDlight( -index ); + m_pSpotlightEnd = effects->CL_AllocDlight( -m_index ); Assert (m_pSpotlightEnd); } diff --git a/src/game/client/c_entityflame.cpp b/src/game/client/c_entityflame.cpp index 19f389649..763b4e60a 100644 --- a/src/game/client/c_entityflame.cpp +++ b/src/game/client/c_entityflame.cpp @@ -131,7 +131,7 @@ bool C_EntityFlame::Simulate( void ) #ifdef HL2_EPISODIC if ( IsEffectActive(EF_BRIGHTLIGHT) || IsEffectActive(EF_DIMLIGHT) ) { - dlight_t *dl = effects->CL_AllocDlight( index ); + dlight_t *dl = effects->CL_AllocDlight( m_index ); dl->origin = GetAbsOrigin(); dl->origin[2] += 16; dl->color.r = 254; diff --git a/src/game/client/c_plasma.cpp b/src/game/client/c_plasma.cpp index 75223420c..2eced5d1a 100644 --- a/src/game/client/c_plasma.cpp +++ b/src/game/client/c_plasma.cpp @@ -342,7 +342,7 @@ void C_Plasma::Start( void ) m_entFlames[i].SetRenderColor( 255, 255, 255 ); m_entFlames[i].SetRenderAlpha( 255 ); m_entFlames[i].SetBrightness( 255 ); - m_entFlames[i].index = -1; + m_entFlames[i].m_index = -1; if ( i == 0 ) { @@ -364,7 +364,7 @@ void C_Plasma::Start( void ) m_entGlow.SetRenderColor( 255, 255, 255 ); m_entGlow.SetRenderAlpha( 255 ); m_entGlow.SetBrightness( 255 ); - m_entGlow.index = -1; + m_entGlow.m_index = -1; m_flGlowScale = m_flStartScale; diff --git a/src/game/client/c_recipientfilter.cpp b/src/game/client/c_recipientfilter.cpp index 0c29546b5..b42e2a5ca 100644 --- a/src/game/client/c_recipientfilter.cpp +++ b/src/game/client/c_recipientfilter.cpp @@ -95,7 +95,7 @@ void C_RecipientFilter::AddRecipient( C_BasePlayer *player ) if ( !player ) return; - int index = player->index; + int index = player->m_index; // If we're predicting and this is not the first time we've predicted this sound // then don't send it to the local player again. @@ -127,7 +127,7 @@ void C_RecipientFilter::RemoveRecipient( C_BasePlayer *player ) if ( !player ) return; - int index = player->index; + int index = player->m_index; // Remove it if it's in the list m_Recipients.FindAndRemove( index ); @@ -153,7 +153,7 @@ void C_RecipientFilter::AddPlayersFromBitMask( CPlayerBitVec& playerbits ) continue; // only add the local player on client side - if ( !playerbits[ pPlayer->index ] ) + if ( !playerbits[ pPlayer->m_index ] ) continue; AddRecipient( pPlayer ); diff --git a/src/game/client/c_spotlight_end.cpp b/src/game/client/c_spotlight_end.cpp index b9007df57..279c606fe 100644 --- a/src/game/client/c_spotlight_end.cpp +++ b/src/game/client/c_spotlight_end.cpp @@ -111,9 +111,9 @@ void C_SpotlightEnd::ClientThink(void) return; // Deal with the environment light - if ( !m_pDynamicLight || (m_pDynamicLight->key != index) ) + if ( !m_pDynamicLight || (m_pDynamicLight->key != m_index) ) { - m_pDynamicLight = effects->CL_AllocDlight( index ); + m_pDynamicLight = effects->CL_AllocDlight( m_index ); assert (m_pDynamicLight); } @@ -128,9 +128,9 @@ void C_SpotlightEnd::ClientThink(void) VectorCopy (m_vSpotlightDir, m_pDynamicLight->m_Direction); // Deal with the model light - if ( !m_pModelLight || (m_pModelLight->key != -index) ) + if ( !m_pModelLight || (m_pModelLight->key != -m_index) ) { - m_pModelLight = effects->CL_AllocDlight( -index ); + m_pModelLight = effects->CL_AllocDlight( -m_index ); assert (m_pModelLight); } diff --git a/src/game/client/c_te_legacytempents.cpp b/src/game/client/c_te_legacytempents.cpp index df509582a..87598bd24 100644 --- a/src/game/client/c_te_legacytempents.cpp +++ b/src/game/client/c_te_legacytempents.cpp @@ -105,7 +105,7 @@ void C_LocalTempEntity::Prepare( model_t *pmodel, float time ) { Interp_SetupMappings( GetVarMapping() ); - index = -1; + m_index = -1; Clear(); // Use these to set per-frame and termination conditions / actions @@ -168,7 +168,7 @@ int C_LocalTempEntity::DrawStudioModel( int flags ) flags, this, MODEL_INSTANCE_INVALID, - index, + m_index, GetModel(), GetAbsOrigin(), GetAbsAngles(), @@ -948,7 +948,7 @@ int BreakModelDrawHelper( C_LocalTempEntity *entity, int flags ) sInfo.flags = flags; sInfo.pRenderable = entity; sInfo.instance = MODEL_INSTANCE_INVALID; - sInfo.entity_index = entity->index; + sInfo.entity_index = entity->m_index; sInfo.pModel = entity->GetModel(); sInfo.origin = entity->GetRenderOrigin(); sInfo.angles = entity->GetRenderAngles(); @@ -2189,7 +2189,7 @@ int CTempEnts::AddVisibleTempEntity( C_LocalTempEntity *pEntity ) //if ( engine->IsBoxInViewCluster( mins, maxs ) ) { // Temporary entities have no corresponding element in cl_entitylist - pEntity->index = -1; + pEntity->m_index = -1; // Add to list pEntity->AddToLeafSystem( false ); diff --git a/src/game/client/c_team.cpp b/src/game/client/c_team.cpp index 65395496b..38f5d8139 100644 --- a/src/game/client/c_team.cpp +++ b/src/game/client/c_team.cpp @@ -186,7 +186,7 @@ C_Team *GetLocalTeam( void ) if ( !player ) return NULL; - return GetPlayersTeam( player->index ); + return GetPlayersTeam( player->m_index ); } //----------------------------------------------------------------------------- @@ -253,4 +253,4 @@ bool ArePlayersOnSameTeam( int iPlayerIndex1, int iPlayerIndex2 ) int GetNumberOfTeams( void ) { return g_Teams.Count(); -} \ No newline at end of file +} diff --git a/src/game/client/hl2/fx_hl2_tracers.cpp b/src/game/client/hl2/fx_hl2_tracers.cpp index 306c154f2..79fef3805 100644 --- a/src/game/client/hl2/fx_hl2_tracers.cpp +++ b/src/game/client/hl2/fx_hl2_tracers.cpp @@ -269,7 +269,7 @@ void AR2TracerCallback( const CEffectData &data ) bool bWhiz = (data.m_fFlags & TRACER_FLAG_WHIZ); int iEntIndex = data.entindex(); - if ( iEntIndex && iEntIndex == player->index ) + if ( iEntIndex && iEntIndex == player->m_index ) { Vector foo = data.m_vStart; QAngle vangles; diff --git a/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp b/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp index 6b8996825..5f0492044 100644 --- a/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp +++ b/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp @@ -381,7 +381,7 @@ void C_ASW_AOEGrenade_Projectile::ClientThink( void ) { if ( !m_pDLight ) { - m_pDLight = effects->CL_AllocDlight( index ); + m_pDLight = effects->CL_AllocDlight( m_index ); Color rgbaGrenadeColor = GetGrenadeColor(); diff --git a/src/game/client/swarm/c_asw_dynamic_light.cpp b/src/game/client/swarm/c_asw_dynamic_light.cpp index 9abbcb3ed..5d2941b51 100644 --- a/src/game/client/swarm/c_asw_dynamic_light.cpp +++ b/src/game/client/swarm/c_asw_dynamic_light.cpp @@ -46,9 +46,9 @@ void C_ASW_DynamicLight::ClientThink( void ) { if ( ( m_Flags & ( DLIGHT_NO_WORLD_ILLUMINATION | DLIGHT_NO_MODEL_ILLUMINATION ) ) != ( DLIGHT_NO_WORLD_ILLUMINATION | DLIGHT_NO_MODEL_ILLUMINATION ) ) { - if ( !m_pDynamicLight || m_pDynamicLight->key != ASW_LIGHT_INDEX_FIRES + index ) + if ( !m_pDynamicLight || m_pDynamicLight->key != ASW_LIGHT_INDEX_FIRES + m_index ) { - m_pDynamicLight = effects->CL_AllocDlight( ASW_LIGHT_INDEX_FIRES + index ); + m_pDynamicLight = effects->CL_AllocDlight( ASW_LIGHT_INDEX_FIRES + m_index ); } m_pDynamicLight->color.b = GetRenderColorB(); m_pDynamicLight->color.g = GetRenderColorG(); diff --git a/src/game/client/swarm/c_asw_flamer_projectile.cpp b/src/game/client/swarm/c_asw_flamer_projectile.cpp index c1deed7cc..11d109a53 100644 --- a/src/game/client/swarm/c_asw_flamer_projectile.cpp +++ b/src/game/client/swarm/c_asw_flamer_projectile.cpp @@ -36,7 +36,7 @@ C_ASW_Flamer_Projectile::~C_ASW_Flamer_Projectile() void C_ASW_Flamer_Projectile::CreateLight() { - m_pDynamicLight = effects->CL_AllocDlight( index ); + m_pDynamicLight = effects->CL_AllocDlight( m_index ); m_pDynamicLight->origin = GetAbsOrigin(); m_pDynamicLight->radius = 61.6 * asw_flamer_light_scale.GetFloat(); m_pDynamicLight->decay = 0 / 0.05f; @@ -74,4 +74,4 @@ void C_ASW_Flamer_Projectile::OnDataChanged(DataUpdateType_t updateType) SetNextClientThink(CLIENT_THINK_ALWAYS); } BaseClass::OnDataChanged(updateType); -} \ No newline at end of file +} diff --git a/src/game/client/swarm/c_asw_flare_projectile.cpp b/src/game/client/swarm/c_asw_flare_projectile.cpp index 62661f37f..f75707dd5 100644 --- a/src/game/client/swarm/c_asw_flare_projectile.cpp +++ b/src/game/client/swarm/c_asw_flare_projectile.cpp @@ -178,7 +178,7 @@ void C_ASW_Flare_Projectile::ClientThink( void ) } if (!m_pDLight) { - m_pDLight = effects->CL_AllocDlight( index ); + m_pDLight = effects->CL_AllocDlight( m_index ); m_pDLight->color.r = asw_flare_r.GetInt(); m_pDLight->color.g = asw_flare_g.GetInt(); m_pDLight->color.b = asw_flare_b.GetInt(); diff --git a/src/game/client/swarm/c_asw_marine.cpp b/src/game/client/swarm/c_asw_marine.cpp index 4e9b69c6d..698f3fdc7 100644 --- a/src/game/client/swarm/c_asw_marine.cpp +++ b/src/game/client/swarm/c_asw_marine.cpp @@ -1128,7 +1128,7 @@ void C_ASW_Marine::ProcessMuzzleFlashEvent() // If we have an attachment, then stick a light on it. if ( bFoundAttachment ) { - dlight_t *el = effects->CL_AllocDlight( LIGHT_INDEX_MUZZLEFLASH + index ); + dlight_t *el = effects->CL_AllocDlight( LIGHT_INDEX_MUZZLEFLASH + m_index ); el->origin = vector; el->radius = 70; el->decay = el->radius / 0.05f; @@ -1537,7 +1537,7 @@ void C_ASW_Marine::UpdateFlashlight() if ( !m_pFlashlight ) { // Turned on the headlight; create it. - m_pFlashlight = new CFlashlightEffect(index); + m_pFlashlight = new CFlashlightEffect(m_index); if (!m_pFlashlight) return; @@ -1547,9 +1547,9 @@ void C_ASW_Marine::UpdateFlashlight() //#ifdef ASW_FLASHLIGHT_DLIGHT if (rd_flashlight_dlight_enable.GetBool()) { - if (!m_pFlashlightDLight || (m_pFlashlightDLight->key != index)) + if (!m_pFlashlightDLight || (m_pFlashlightDLight->key != m_index)) { - m_pFlashlightDLight = effects->CL_AllocDlight(index); + m_pFlashlightDLight = effects->CL_AllocDlight(m_index); } } //#endif diff --git a/src/game/client/swarm/c_asw_mesh_emitter_entity.cpp b/src/game/client/swarm/c_asw_mesh_emitter_entity.cpp index 0e614889e..5cbc1d355 100644 --- a/src/game/client/swarm/c_asw_mesh_emitter_entity.cpp +++ b/src/game/client/swarm/c_asw_mesh_emitter_entity.cpp @@ -211,7 +211,7 @@ int C_ASW_Mesh_Emitter::InternalDrawModel( int flags, const RenderableInstance_t sInfo.flags = flags; sInfo.pRenderable = this; sInfo.instance = GetModelInstance(); - sInfo.entity_index = index; + sInfo.entity_index = m_index; sInfo.pModel = GetModel(); sInfo.origin = GetRenderOrigin(); sInfo.angles = GetRenderAngles(); @@ -272,7 +272,7 @@ int C_ASW_Mesh_Emitter::DrawParticle(Vector &vecPos) sInfo.flags = STUDIO_RENDER; sInfo.pRenderable = this; sInfo.instance = GetModelInstance(); - sInfo.entity_index = index; + sInfo.entity_index = m_index; sInfo.pModel = GetModel(); sInfo.origin = vecPos; sInfo.angles = QAngle(0,0,0); @@ -293,4 +293,4 @@ void C_ASW_Mesh_Emitter::GetRenderBounds( Vector& theMins, Vector& theMaxs ) return; } BaseClass::GetRenderBounds(theMins, theMaxs); -} \ No newline at end of file +} diff --git a/src/game/client/swarm/c_asw_player.cpp b/src/game/client/swarm/c_asw_player.cpp index 072a54471..d638feaf2 100644 --- a/src/game/client/swarm/c_asw_player.cpp +++ b/src/game/client/swarm/c_asw_player.cpp @@ -2704,7 +2704,7 @@ void C_ASW_Player::UpdateLocalMarineGlow() { if ( !m_pLocalMarineGlow ) { - m_pLocalMarineGlow = effects->CL_AllocDlight( index ); + m_pLocalMarineGlow = effects->CL_AllocDlight( m_index ); } if ( m_pLocalMarineGlow ) diff --git a/src/game/client/swarm/c_asw_weapon.cpp b/src/game/client/swarm/c_asw_weapon.cpp index 9d28f6bf6..302e47385 100644 --- a/src/game/client/swarm/c_asw_weapon.cpp +++ b/src/game/client/swarm/c_asw_weapon.cpp @@ -445,7 +445,7 @@ void C_ASW_Weapon::ProcessMuzzleFlashEvent() if ( GetAttachment( GetMuzzleAttachment(), vAttachment, dummyAngles ) ) { // Make an elight - dlight_t *el = effects->CL_AllocDlight( LIGHT_INDEX_MUZZLEFLASH + index ); + dlight_t *el = effects->CL_AllocDlight( LIGHT_INDEX_MUZZLEFLASH + m_index ); el->origin = vAttachment; el->radius = random->RandomFloat( asw_muzzle_light_radius_min.GetFloat(), asw_muzzle_light_radius_max.GetFloat() ); el->decay = el->radius / 0.05f; diff --git a/src/game/client/swarm/clientmode_asw.cpp b/src/game/client/swarm/clientmode_asw.cpp index 9d5b794c4..4e2f5907e 100644 --- a/src/game/client/swarm/clientmode_asw.cpp +++ b/src/game/client/swarm/clientmode_asw.cpp @@ -806,7 +806,7 @@ void ClientModeASW::FireGameEvent( IGameEvent *event ) for ( C_BaseEntity *pEntity = ClientEntityList().FirstBaseEntity(); pEntity; pEntity = ClientEntityList().NextBaseEntity( pEntity ) ) { - if ( pEntity->index != -1 ) + if ( pEntity->m_index != -1 ) continue; if ( C_ClientRagdoll *pRagdoll = dynamic_cast( pEntity ) ) diff --git a/src/game/shared/predictioncopy_helpers.cpp b/src/game/shared/predictioncopy_helpers.cpp index db2c7b2d4..7e112f77f 100644 --- a/src/game/shared/predictioncopy_helpers.cpp +++ b/src/game/shared/predictioncopy_helpers.cpp @@ -186,7 +186,7 @@ void CValueChangeTracker::SetupTracking( C_BaseEntity *ent, char const *pchField datamap_t *dmap = ent->GetPredDescMap(); if ( !dmap ) { - Msg( "No prediction datamap_t for entity %d/%s\n", ent->index, ent->GetClassname() ); + Msg( "No prediction datamap_t for entity %d/%s\n", ent->m_index, ent->GetClassname() ); return; } @@ -195,7 +195,7 @@ void CValueChangeTracker::SetupTracking( C_BaseEntity *ent, char const *pchField m_pTrackField = CPredictionCopy::FindFlatFieldByName( pchFieldName, dmap ); if ( !m_pTrackField ) { - Msg( "No field '%s' in datamap_t for entity %d/%s\n", pchFieldName, ent->index, ent->GetClassname() ); + Msg( "No field '%s' in datamap_t for entity %d/%s\n", pchFieldName, ent->m_index, ent->GetClassname() ); return; } @@ -252,4 +252,4 @@ CON_COMMAND_F( cl_pred_track, " : Track changes to entity g_pChangeTracker->SetupTracking( ent, args[2] ); } -#endif // NO_ENTITY_PREDICTION \ No newline at end of file +#endif // NO_ENTITY_PREDICTION diff --git a/src/game/shared/swarm/asw_deathmatch_mode.cpp b/src/game/shared/swarm/asw_deathmatch_mode.cpp index 2f0970275..d61159a98 100644 --- a/src/game/shared/swarm/asw_deathmatch_mode.cpp +++ b/src/game/shared/swarm/asw_deathmatch_mode.cpp @@ -1193,7 +1193,7 @@ int CASW_Deathmatch_Mode::GetFragCount( CASW_Marine_Resource *pMR ) #ifdef GAME_DLL return pPlayer->FragCount(); #else - return g_PR->GetPlayerScore( pPlayer->index ); + return g_PR->GetPlayerScore( pPlayer->m_index ); #endif } return 0; @@ -1211,7 +1211,7 @@ int CASW_Deathmatch_Mode::GetDeathCount( CASW_Marine_Resource *pMR ) #ifdef GAME_DLL return pPlayer->DeathCount(); #else - return g_PR->GetDeaths( pPlayer->index ); + return g_PR->GetDeaths( pPlayer->m_index ); #endif } return 0; diff --git a/src/game/shared/swarm/asw_weapon_revive_tool_shared.cpp b/src/game/shared/swarm/asw_weapon_revive_tool_shared.cpp index 8f587e762..3249c41d7 100644 --- a/src/game/shared/swarm/asw_weapon_revive_tool_shared.cpp +++ b/src/game/shared/swarm/asw_weapon_revive_tool_shared.cpp @@ -313,7 +313,7 @@ void CASW_Revive_Tombstone::ClientThink() if ( bShouldHologramsBeActive && rd_revive_tombstone_dlight.GetBool() ) { - m_pLightGlow = effects->CL_AllocDlight( index ); + m_pLightGlow = effects->CL_AllocDlight( m_index ); m_pLightGlow->origin = GetAbsOrigin() + Vector( 0, 0, m_bIsReviving ? rd_revive_tombstone_dlight_active_z_offset.GetFloat() : rd_revive_tombstone_dlight_z_offset.GetFloat() ); Color lightColor; switch ( iProfileSkinMinusOne ) From a8a22dbd097dff28759ccff0d717fe847f2a1599 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 21:21:16 +0200 Subject: [PATCH 16/30] refactor(client): rename view -> g_view maybe missed some outcommented --- src/game/client/C_WaterLODControl.cpp | 4 +-- src/game/client/WaterLODMaterialProxy.cpp | 2 +- src/game/client/c_baseplayer.cpp | 8 ++--- src/game/client/c_baseviewmodel.cpp | 4 +-- src/game/client/c_effects.cpp | 2 +- src/game/client/c_env_screenoverlay.cpp | 6 ++-- src/game/client/cdll_client_int.cpp | 32 +++++++++---------- src/game/client/clientleafsystem.cpp | 2 +- src/game/client/clientshadowmgr.cpp | 2 +- src/game/client/glow_overlay.cpp | 4 +-- src/game/client/in_joystick.cpp | 4 +-- src/game/client/in_main.cpp | 4 +-- src/game/client/in_mouse.cpp | 4 +-- src/game/client/iviewrender.h | 2 +- src/game/client/particlemgr.cpp | 2 +- src/game/client/swarm/asw_room_thumbnails.cpp | 4 +-- src/game/client/toolframework_client.cpp | 2 +- src/game/client/view.cpp | 4 +-- src/game/client/view_scene.h | 4 +-- src/game/client/viewdebug.cpp | 10 +++--- src/game/client/viewpostprocess.cpp | 2 +- src/game/client/viewrender.cpp | 20 ++++++------ src/game/client/viewrender.h | 2 +- src/game/shared/baseplayer_shared.cpp | 2 +- 24 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/game/client/C_WaterLODControl.cpp b/src/game/client/C_WaterLODControl.cpp index f77e7fd29..b97b2341f 100644 --- a/src/game/client/C_WaterLODControl.cpp +++ b/src/game/client/C_WaterLODControl.cpp @@ -46,8 +46,8 @@ END_RECV_TABLE() //------------------------------------------------------------------------------ void C_WaterLODControl::OnDataChanged(DataUpdateType_t updateType) { - view->SetCheapWaterStartDistance( m_flCheapWaterStartDistance ); - view->SetCheapWaterEndDistance( m_flCheapWaterEndDistance ); + g_view->SetCheapWaterStartDistance( m_flCheapWaterStartDistance ); + g_view->SetCheapWaterEndDistance( m_flCheapWaterEndDistance ); } //------------------------------------------------------------------------------ diff --git a/src/game/client/WaterLODMaterialProxy.cpp b/src/game/client/WaterLODMaterialProxy.cpp index c15fb3fb0..ef7e27cb9 100644 --- a/src/game/client/WaterLODMaterialProxy.cpp +++ b/src/game/client/WaterLODMaterialProxy.cpp @@ -62,7 +62,7 @@ void CWaterLODMaterialProxy::OnBind( void *pC_BaseEntity ) return; } float start, end; - view->GetWaterLODParams( start, end ); + g_view->GetWaterLODParams( start, end ); m_pCheapWaterStartDistanceVar->SetFloatValue( start ); m_pCheapWaterEndDistanceVar->SetFloatValue( end ); } diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index eed616924..3b5aead95 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -826,7 +826,7 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType ) gameeventmanager->FireEventClientSide( pEvent ); } - view->FreezeFrame(0); + g_view->FreezeFrame(0); ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" ); pVar->Revert(); @@ -1640,7 +1640,7 @@ void C_BasePlayer::CalcFreezeCamView( Vector& eyeOrigin, QAngle& eyeAngles, floa } m_bSentFreezeFrame = true; - view->FreezeFrame( spec_freeze_time.GetFloat() ); + g_view->FreezeFrame( spec_freeze_time.GetFloat() ); } } @@ -2003,8 +2003,8 @@ void C_BasePlayer::GetToolRecordingState( KeyValues *msg ) static CameraRecordingState_t state; state.m_flFOV = GetFOV(); - float flZNear = view->GetZNear(); - float flZFar = view->GetZFar(); + float flZNear = g_view->GetZNear(); + float flZFar = g_view->GetZFar(); CalcView( state.m_vecEyePosition, state.m_vecEyeAngles, flZNear, flZFar, state.m_flFOV ); state.m_bThirdPerson = !engine->IsPaused() && ::input->CAM_IsThirdPerson(); diff --git a/src/game/client/c_baseviewmodel.cpp b/src/game/client/c_baseviewmodel.cpp index 6e4c0786c..4a3cd07af 100644 --- a/src/game/client/c_baseviewmodel.cpp +++ b/src/game/client/c_baseviewmodel.cpp @@ -54,7 +54,7 @@ void FormatViewModelAttachment( C_BasePlayer *pPlayer, Vector &vOrigin, bool bIn Assert( nSlot != -1 ); // Presumably, SetUpView has been called so we know our FOV and render origin. - const CViewSetup *pViewSetup = view->GetPlayerViewSetup( nSlot ); + const CViewSetup *pViewSetup = g_view->GetPlayerViewSetup( nSlot ); float worldx = tan( pViewSetup->fov * M_PI/360.0 ); float viewx = tan( pViewSetup->fovViewmodel * M_PI/360.0 ); @@ -215,7 +215,7 @@ void C_BaseViewModel::ApplyBoneMatrixTransform( matrix3x4_t& transform ) // We could get MATERIAL_VIEW here, but this is called sometimes before the renderer // has set that matrix. Luckily, this is called AFTER the CViewSetup has been initialized. - const CViewSetup *pSetup = view->GetPlayerViewSetup(); + const CViewSetup *pSetup = g_view->GetPlayerViewSetup(); AngleMatrix( pSetup->angles, pSetup->origin, viewMatrixInverse ); MatrixInvert( viewMatrixInverse, viewMatrix ); diff --git a/src/game/client/c_effects.cpp b/src/game/client/c_effects.cpp index c5a10491f..3ee8f73cb 100644 --- a/src/game/client/c_effects.cpp +++ b/src/game/client/c_effects.cpp @@ -517,7 +517,7 @@ void CClient_Precipitation::Render() if ( CurrentViewID() == VIEW_MONITOR ) return; - if ( view->GetDrawFlags() & (DF_RENDER_REFLECTION | DF_RENDER_REFRACTION) ) + if ( g_view->GetDrawFlags() & (DF_RENDER_REFLECTION | DF_RENDER_REFRACTION) ) return; if ( m_nPrecipType == PRECIPITATION_TYPE_ASH ) diff --git a/src/game/client/c_env_screenoverlay.cpp b/src/game/client/c_env_screenoverlay.cpp index 3be5c6f0a..b8d5544d2 100644 --- a/src/game/client/c_env_screenoverlay.cpp +++ b/src/game/client/c_env_screenoverlay.cpp @@ -87,7 +87,7 @@ void C_EnvScreenOverlay::PostDataUpdate( DataUpdateType_t updateType ) BaseClass::PostDataUpdate( updateType ); // If we have a start time now, start the overlays going - if ( m_bIsActive && m_flStartTime > 0 && view->GetScreenOverlayMaterial() == NULL ) + if ( m_bIsActive && m_flStartTime > 0 && g_view->GetScreenOverlayMaterial() == NULL ) { StartOverlays(); } @@ -121,7 +121,7 @@ void C_EnvScreenOverlay::StopOverlays( void ) if ( m_bWasActive && !m_bIsActive ) { - view->SetScreenOverlayMaterial( NULL ); + g_view->SetScreenOverlayMaterial( NULL ); } } @@ -173,7 +173,7 @@ void C_EnvScreenOverlay::StartCurrentOverlay( void ) IMaterial *pMaterial = materials->FindMaterial( m_iszOverlayNames[m_iCurrentOverlay], TEXTURE_GROUP_CLIENT_EFFECTS, false ); if ( !IsErrorMaterial( pMaterial ) ) { - view->SetScreenOverlayMaterial( pMaterial ); + g_view->SetScreenOverlayMaterial( pMaterial ); } else { diff --git a/src/game/client/cdll_client_int.cpp b/src/game/client/cdll_client_int.cpp index 09d91846d..b92ed03bc 100644 --- a/src/game/client/cdll_client_int.cpp +++ b/src/game/client/cdll_client_int.cpp @@ -1022,13 +1022,13 @@ bool InitGameSystems( CreateInterfaceFn appSystemFactory ) } // Each mod is required to implement this - view = GetViewRenderInstance(); - if ( !view ) + g_view = GetViewRenderInstance(); + if ( !g_view ) { Error( "GetViewRenderInstance() must be implemented by game." ); } - view->Init(); + g_view->Init(); for ( int hh = 0; hh < MAX_SPLITSCREEN_PLAYERS; ++hh ) { ACTIVE_SPLITSCREEN_PLAYER_GUARD_VGUI( hh ); @@ -1313,7 +1313,7 @@ void CHLClient::Shutdown( void ) input->Shutdown_All(); C_BaseTempEntity::ClearDynamicTempEnts(); TermSmokeFogOverlay(); - view->Shutdown(); + g_view->Shutdown(); g_pParticleSystemMgr->UncacheAllParticleSystems(); UncacheAllMaterials(); @@ -1602,7 +1602,7 @@ void CHLClient::View_Render( vrect_t *rect ) if ( rect->width == 0 || rect->height == 0 ) return; - view->Render( rect ); + g_view->Render( rect ); UpdatePerfStats(); } @@ -1612,7 +1612,7 @@ void CHLClient::View_Render( vrect_t *rect ) //----------------------------------------------------------------------------- bool CHLClient::GetPlayerView( CViewSetup &playerView ) { - playerView = *view->GetPlayerViewSetup(); + playerView = *g_view->GetPlayerViewSetup(); return true; } @@ -1782,9 +1782,9 @@ void ConfigureCurrentSystemLevel() } C_BaseEntity::UpdateVisibilityAllEntities(); - if ( view ) + if ( g_view ) { - view->InitFadeData(); + g_view->InitFadeData(); } } @@ -1823,7 +1823,7 @@ void CHLClient::LevelInitPreEntity( char const* pMapName ) C_BaseTempEntity::ClearDynamicTempEnts(); clienteffects->Flush(); - view->LevelInit(); + g_view->LevelInit(); tempents->LevelInit(); for ( int hh = 0; hh < MAX_SPLITSCREEN_PLAYERS; ++hh ) { @@ -1948,7 +1948,7 @@ void CHLClient::LevelShutdown( void ) // Now do the post-entity shutdown of all systems IGameSystem::LevelShutdownPostEntityAllSystems(); - view->LevelShutdown(); + g_view->LevelShutdown(); beams->ClearBeams(); ParticleMgr()->RemoveAllEffects(); @@ -2431,7 +2431,7 @@ void OnRenderStart() // This will place the player + the view models + all parent // entities at the correct abs position so that their attachment points // are at the correct location - view->OnRenderStart(); + g_view->OnRenderStart(); partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false ); // Process OnDataChanged events. @@ -2681,7 +2681,7 @@ void CHLClient::WriteSaveGameScreenshot( const char *pFilename ) { // Single player doesn't support split screen yet!!! ACTIVE_SPLITSCREEN_PLAYER_GUARD( 0 ); - view->WriteSaveGameScreenshot( pFilename ); + g_view->WriteSaveGameScreenshot( pFilename ); } // Given a list of "S(wavname) S(wavname2)" tokens, look up the localized text and emit @@ -2817,14 +2817,14 @@ bool CHLClient::CacheReplayRagdolls( const char* pFilename, int nStartTick ) // save game screenshot writing void CHLClient::WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height ) { - view->WriteSaveGameScreenshotOfSize( pFilename, width, height ); + g_view->WriteSaveGameScreenshotOfSize( pFilename, width, height ); } // See RenderViewInfo_t void CHLClient::RenderView( const CViewSetup &setup, int nClearFlags, int whatToDraw ) { VPROF("RenderView"); - view->RenderView( setup, setup, nClearFlags, whatToDraw ); + g_view->RenderView( setup, setup, nClearFlags, whatToDraw ); } bool CHLClient::ShouldHideLoadingPlaque( void ) @@ -3042,7 +3042,7 @@ bool CHLClient::SupportsRandomMaps() #endif } -extern IViewRender *view; +extern IViewRender *g_view; //----------------------------------------------------------------------------- // Purpose: interface from materialsystem to client, currently just for recording into tools @@ -3057,7 +3057,7 @@ class CClientMaterialSystem : public IClientMaterialSystem if ( !clienttools->IsInRecordingMode() ) return HTOOLHANDLE_INVALID; - C_BaseEntity *pEnt = view->GetCurrentlyDrawingEntity(); + C_BaseEntity *pEnt = g_view->GetCurrentlyDrawingEntity(); if ( !pEnt || !pEnt->IsToolRecording() ) return HTOOLHANDLE_INVALID; diff --git a/src/game/client/clientleafsystem.cpp b/src/game/client/clientleafsystem.cpp index 0afb9236c..d40fb6dcb 100644 --- a/src/game/client/clientleafsystem.cpp +++ b/src/game/client/clientleafsystem.cpp @@ -2223,7 +2223,7 @@ int CClientLeafSystem::ComputeTranslucency( int nFrameNumber, int nViewID, int n ComputeScreenFade( info, flMinLevelFadeArea, flMaxLevelFadeArea, nCount, pAlphaInfo ); float flMinViewFadeArea, flMaxViewFadeArea; - view->GetScreenFadeDistances( &flMinViewFadeArea, &flMaxViewFadeArea ); + g_view->GetScreenFadeDistances( &flMinViewFadeArea, &flMaxViewFadeArea ); ComputeScreenFade( info, flMinViewFadeArea, flMaxViewFadeArea, nCount, pAlphaInfo ); } diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 39e7dd9db..ea884f38a 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -5768,7 +5768,7 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup ) shadowView.m_bRenderFlashlightDepthTranslucents = flashlightState.m_bGlobalLight; // Render to the shadow depth texture with appropriate view - view->UpdateShadowDepthTexture( m_DummyColorTexture, shadowDepthTexture, shadowView ); + g_view->UpdateShadowDepthTexture( m_DummyColorTexture, shadowDepthTexture, shadowView ); // Associate the shadow depth texture and stencil bit with the flashlight for use during scene rendering shadowmgr->SetFlashlightDepthTexture( shadow.m_ShadowHandle, shadowDepthTexture, 0 ); diff --git a/src/game/client/glow_overlay.cpp b/src/game/client/glow_overlay.cpp index 274a29131..b12c757a5 100644 --- a/src/game/client/glow_overlay.cpp +++ b/src/game/client/glow_overlay.cpp @@ -201,7 +201,7 @@ void CGlowOverlay::UpdateGlowObstruction( const Vector &vToGlow, bool bCacheFull { if ( m_bInSky ) { - const CViewSetup *pViewSetup = view->GetViewSetup(); + const CViewSetup *pViewSetup = g_view->GetViewSetup(); Vector pos = CurrentViewOrigin() + m_vDirection * (pViewSetup->zFar * 0.999f); pixelvis_queryparams_t params; params.Init( pos, m_flProxyRadius, CalcGlowAspect() ); @@ -383,7 +383,7 @@ void CGlowOverlay::Draw( bool bCacheFullSceneState ) //Get our diagonal radius float radius = (vRight+vUp).Length(); - if ( R_CullSphere( view->GetFrustum(), 5, &vBasePt, radius ) ) + if ( R_CullSphere( g_view->GetFrustum(), 5, &vBasePt, radius ) ) continue; // Get our material (deferred default load) diff --git a/src/game/client/in_joystick.cpp b/src/game/client/in_joystick.cpp index 5a50a5f6c..f7b2197fa 100644 --- a/src/game/client/in_joystick.cpp +++ b/src/game/client/in_joystick.cpp @@ -1002,14 +1002,14 @@ void CInput::JoyStickTurn( CUserCmd *cmd, float &yaw, float &pitch, float framet } viewangles[PITCH] += angle; cmd->mousedy = angle; - view->StopPitchDrift(); + g_view->StopPitchDrift(); if ( pitch == 0.f && lookspring.GetFloat() == 0.f ) { // no pitch movement // disable pitch return-to-center unless requested by user // *** this code can be removed when the lookspring bug is fixed // *** the bug always has the lookspring feature on - view->StopPitchDrift(); + g_view->StopPitchDrift(); } } diff --git a/src/game/client/in_main.cpp b/src/game/client/in_main.cpp index b504dcdfd..4f8a62c98 100644 --- a/src/game/client/in_main.cpp +++ b/src/game/client/in_main.cpp @@ -807,7 +807,7 @@ void CInput::AdjustPitch( int nSlot, float speed, QAngle& viewangles ) if ( in_klook.GetPerUser( nSlot ).state & 1 ) { - view->StopPitchDrift (); + g_view->StopPitchDrift (); viewangles[PITCH] -= speed*cl_pitchspeed.GetFloat() * KeyState (&in_forward); viewangles[PITCH] += speed*cl_pitchspeed.GetFloat() * KeyState (&in_back); } @@ -820,7 +820,7 @@ void CInput::AdjustPitch( int nSlot, float speed, QAngle& viewangles ) if ( up || down ) { - view->StopPitchDrift (); + g_view->StopPitchDrift (); } } } diff --git a/src/game/client/in_mouse.cpp b/src/game/client/in_mouse.cpp index 25294a6ee..98a1a539e 100644 --- a/src/game/client/in_mouse.cpp +++ b/src/game/client/in_mouse.cpp @@ -613,7 +613,7 @@ void CInput::MouseMove( int nSlot, CUserCmd *cmd ) CheckMouseAcclerationVars(); // Don't drift pitch at all while mouselooking. - view->StopPitchDrift (); + g_view->StopPitchDrift (); //jjb - this disables normal mouse control if the user is trying to // move the camera, or if the mouse cursor is visible @@ -728,4 +728,4 @@ void CInput::ClearStates (void) GetPerUser().m_flAccumulatedMouseXMovement = 0; GetPerUser().m_flAccumulatedMouseYMovement = 0; } -} \ No newline at end of file +} diff --git a/src/game/client/iviewrender.h b/src/game/client/iviewrender.h index 2d19e0f49..c60208fb9 100644 --- a/src/game/client/iviewrender.h +++ b/src/game/client/iviewrender.h @@ -146,7 +146,7 @@ abstract_class IViewRender virtual void InitFadeData( void ) = 0; }; -extern IViewRender *view; +extern IViewRender *g_view; extern IViewRender *GetViewRenderInstance(); diff --git a/src/game/client/particlemgr.cpp b/src/game/client/particlemgr.cpp index 56ecce6dd..1bbeceed8 100644 --- a/src/game/client/particlemgr.cpp +++ b/src/game/client/particlemgr.cpp @@ -1657,7 +1657,7 @@ bool CParticleMgr::EarlyRetireParticleSystems( int nCount, CNewParticleEffect ** VMatrix worldToScreen[ MAX_SPLITSCREEN_PLAYERS ]; FOR_EACH_VALID_SPLITSCREEN_PLAYER( hh ) { - pViewSetup[ hh ] = view->GetPlayerViewSetup( hh ); + pViewSetup[ hh ] = g_view->GetPlayerViewSetup( hh ); if ( pViewSetup[ hh ]->width == 0 || pViewSetup[ hh ]->height == 0 ) return false; } diff --git a/src/game/client/swarm/asw_room_thumbnails.cpp b/src/game/client/swarm/asw_room_thumbnails.cpp index 3874bfd12..77e7d096a 100644 --- a/src/game/client/swarm/asw_room_thumbnails.cpp +++ b/src/game/client/swarm/asw_room_thumbnails.cpp @@ -66,7 +66,7 @@ static void TakeRoomThumbnailSnapshot( CRoomThumbnail *pRoom ) CViewSetup setup; SetupThumbnailView( setup, pRoom ); - view->RenderView( setup, setup, VIEW_CLEAR_COLOR | VIEW_CLEAR_DEPTH | VIEW_CLEAR_FULL_TARGET, 0 ); + g_view->RenderView( setup, setup, VIEW_CLEAR_COLOR | VIEW_CLEAR_DEPTH | VIEW_CLEAR_FULL_TARGET, 0 ); unsigned char *pImage = ( unsigned char * )malloc( setup.width * 3 * setup.height ); @@ -149,4 +149,4 @@ CON_COMMAND( asw_buildroomthumbnails, "Outputs room thumbnail TGAs for all rooms thumbnails.PurgeAndDeleteElements(); pKV->deleteThis(); } -#endif // DEDICATED \ No newline at end of file +#endif // DEDICATED diff --git a/src/game/client/toolframework_client.cpp b/src/game/client/toolframework_client.cpp index f98dc75e6..d115581a3 100644 --- a/src/game/client/toolframework_client.cpp +++ b/src/game/client/toolframework_client.cpp @@ -17,7 +17,7 @@ #include "tier0/memdbgon.h" -extern IViewRender *view; +extern IViewRender *g_view; class CToolFrameworkClient : public CBaseGameSystemPerFrame { diff --git a/src/game/client/view.cpp b/src/game/client/view.cpp index 22b11002e..5a9ced97b 100644 --- a/src/game/client/view.cpp +++ b/src/game/client/view.cpp @@ -91,7 +91,7 @@ extern ConVar sensitivity; ConVar zoom_sensitivity_ratio( "zoom_sensitivity_ratio", "1.0", 0, "Additional mouse sensitivity scale factor applied when FOV is zoomed in." ); // Each MOD implements GetViewRenderInstance() and provides either a default object or a subclassed object!!! -IViewRender *view = NULL; // set in cldll_client_init.cpp if no mod creates their own +IViewRender *g_view = NULL; // set in cldll_client_init.cpp if no mod creates their own #if _DEBUG bool g_bRenderingCameraView = false; @@ -267,7 +267,7 @@ bool R_CullSphere( //----------------------------------------------------------------------------- static void StartPitchDrift( void ) { - view->StartPitchDrift(); + g_view->StartPitchDrift(); } static ConCommand centerview( "centerview", StartPitchDrift ); diff --git a/src/game/client/view_scene.h b/src/game/client/view_scene.h index df21e7f0b..c65d86dc6 100644 --- a/src/game/client/view_scene.h +++ b/src/game/client/view_scene.h @@ -142,7 +142,7 @@ inline void UpdateFrontBufferTexturesForMaterial( IMaterial *pMaterial, bool bFo } else if( pMaterial->NeedsFullFrameBufferTexture() ) { - const CViewSetup *pView = view->GetViewSetup(); + const CViewSetup *pView = g_view->GetViewSetup(); UpdateScreenEffectTexture( 0, pView->x, pView->y, pView->width, pView->height ); } } @@ -151,7 +151,7 @@ inline void UpdateScreenEffectTexture( void ) { Assert( !DrawingShadowDepthView() ); - const CViewSetup *pViewSetup = view->GetViewSetup(); + const CViewSetup *pViewSetup = g_view->GetViewSetup(); UpdateScreenEffectTexture( 0, pViewSetup->x, pViewSetup->y, pViewSetup->width, pViewSetup->height); } diff --git a/src/game/client/viewdebug.cpp b/src/game/client/viewdebug.cpp index aa1c0d9f4..e487717b8 100644 --- a/src/game/client/viewdebug.cpp +++ b/src/game/client/viewdebug.cpp @@ -563,7 +563,7 @@ void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view ) // Draw debugging lightmaps if ( mat_showlightmappage.GetInt() != -1 ) { - CLightmapDebugView clientView( assert_cast( ::view ) ); + CLightmapDebugView clientView( assert_cast( ::g_view ) ); clientView.Setup( view ); clientView.Draw(); } @@ -632,24 +632,24 @@ CON_COMMAND_F( r_screenoverlay, "Draw specified material as an overlay", FCVAR_C { if ( !Q_stricmp( "off", args[1] ) ) { - view->SetScreenOverlayMaterial( NULL ); + g_view->SetScreenOverlayMaterial( NULL ); } else { IMaterial *pMaterial = materials->FindMaterial( args[1], TEXTURE_GROUP_OTHER, false ); if ( !IsErrorMaterial( pMaterial ) ) { - view->SetScreenOverlayMaterial( pMaterial ); + g_view->SetScreenOverlayMaterial( pMaterial ); } else { - view->SetScreenOverlayMaterial( NULL ); + g_view->SetScreenOverlayMaterial( NULL ); } } } else { - IMaterial *pMaterial = view->GetScreenOverlayMaterial(); + IMaterial *pMaterial = g_view->GetScreenOverlayMaterial(); Warning( "r_screenoverlay: %s\n", pMaterial ? pMaterial->GetName() : "off" ); } } diff --git a/src/game/client/viewpostprocess.cpp b/src/game/client/viewpostprocess.cpp index c63e4ea1a..09095c534 100644 --- a/src/game/client/viewpostprocess.cpp +++ b/src/game/client/viewpostprocess.cpp @@ -2545,7 +2545,7 @@ static float GetFarBlurRadius() bool IsDepthOfFieldEnabled() { - const CViewSetup *pViewSetup = view->GetViewSetup(); + const CViewSetup *pViewSetup = g_view->GetViewSetup(); if ( !pViewSetup ) return false; diff --git a/src/game/client/viewrender.cpp b/src/game/client/viewrender.cpp index 4b919d865..801115256 100644 --- a/src/game/client/viewrender.cpp +++ b/src/game/client/viewrender.cpp @@ -78,7 +78,7 @@ static void testfreezeframe_f( void ) { - view->FreezeFrame( 3.0 ); + g_view->FreezeFrame( 3.0 ); } static ConCommand test_freezeframe( "test_freezeframe", testfreezeframe_f, "Test the freeze frame code.", FCVAR_CHEAT ); @@ -233,12 +233,12 @@ CON_COMMAND( r_cheapwaterstart, "" ) if( args.ArgC() == 2 ) { float dist = atof( args[ 1 ] ); - view->SetCheapWaterStartDistance( dist ); + g_view->SetCheapWaterStartDistance( dist ); } else { float start, end; - view->GetWaterLODParams( start, end ); + g_view->GetWaterLODParams( start, end ); Warning( "r_cheapwaterstart: %f\n", start ); } } @@ -248,12 +248,12 @@ CON_COMMAND( r_cheapwaterend, "" ) if( args.ArgC() == 2 ) { float dist = atof( args[ 1 ] ); - view->SetCheapWaterEndDistance( dist ); + g_view->SetCheapWaterEndDistance( dist ); } else { float start, end; - view->GetWaterLODParams( start, end ); + g_view->GetWaterLODParams( start, end ); Warning( "r_cheapwaterend: %f\n", end ); } } @@ -904,7 +904,7 @@ void SetupCurrentView( const Vector &vecOrigin, const QAngle &angles, view_id_t // Cache off fade distances float flScreenFadeMinSize, flScreenFadeMaxSize; - view->GetScreenFadeDistances( &flScreenFadeMinSize, &flScreenFadeMaxSize ); + g_view->GetScreenFadeDistances( &flScreenFadeMinSize, &flScreenFadeMaxSize ); modelinfo->SetViewScreenFadeRange( flScreenFadeMinSize, flScreenFadeMaxSize ); CMatRenderContextPtr pRenderContext( materials ); @@ -4012,7 +4012,7 @@ static inline bool BlurTest( IClientRenderable *pRenderable, int drawFlags, bool if( pClientEntity->IsBlurred() ) { - const CViewSetup *pViewSetup = view->GetViewSetup(); + const CViewSetup *pViewSetup = g_view->GetViewSetup(); if( pViewSetup ) { BlurEntity( pRenderable, bPreDraw, drawFlags, instance, *pViewSetup, pViewSetup->x, pViewSetup->y, pViewSetup->width, pViewSetup->height ); @@ -4028,16 +4028,16 @@ static inline bool BlurTest( IClientRenderable *pRenderable, int drawFlags, bool //----------------------------------------------------------------------------- static inline void DrawRenderableEntity( IClientRenderable* pEnt, int flags, const RenderableInstance_t& instance ) { - Assert( view->GetCurrentlyDrawingEntity() == NULL ); + Assert( g_view->GetCurrentlyDrawingEntity() == NULL ); - view->SetCurrentlyDrawingEntity( pEnt->GetIClientUnknown() && pEnt->GetIClientUnknown()->GetClientRenderable() ? pEnt->GetIClientUnknown()->GetBaseEntity() : NULL ); + g_view->SetCurrentlyDrawingEntity( pEnt->GetIClientUnknown() && pEnt->GetIClientUnknown()->GetClientRenderable() ? pEnt->GetIClientUnknown()->GetBaseEntity() : NULL ); //bool bBlockNormalDraw = BlurTest( pEnt, flags, true, instance ); //if( !bBlockNormalDraw ) pEnt->DrawModel( flags, instance ); //BlurTest( pEnt, flags, false, instance ); - view->SetCurrentlyDrawingEntity( NULL ); + g_view->SetCurrentlyDrawingEntity( NULL ); } diff --git a/src/game/client/viewrender.h b/src/game/client/viewrender.h index 236863ff4..c0460e3b6 100644 --- a/src/game/client/viewrender.h +++ b/src/game/client/viewrender.h @@ -324,7 +324,7 @@ class CViewRender : public IViewRender virtual void OnRenderStart(); void DriftPitch (void); - static CViewRender * GetMainView() { return assert_cast( view ); } + static CViewRender * GetMainView() { return assert_cast( g_view ); } void AddViewToScene( CRendering3dView *pView ) { m_SimpleExecutor.AddView( pView ); } diff --git a/src/game/shared/baseplayer_shared.cpp b/src/game/shared/baseplayer_shared.cpp index f5c1e573f..01276329e 100644 --- a/src/game/shared/baseplayer_shared.cpp +++ b/src/game/shared/baseplayer_shared.cpp @@ -1541,7 +1541,7 @@ void CBasePlayer::CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& f if ( !prediction->InPrediction() ) { // FIXME: Move into prediction - view->DriftPitch(); + g_view->DriftPitch(); } #endif From 03dedfa96c69da02d59a48d0423a73b18914bebf Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 21:44:43 +0200 Subject: [PATCH 17/30] refactor(client): rename model -> m_model maybe missed some outcommented --- src/game/client/c_baseentity.cpp | 52 ++++++++++++++++---------------- src/game/client/c_baseentity.h | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/game/client/c_baseentity.cpp b/src/game/client/c_baseentity.cpp index 3209ca692..f3ff6fe20 100644 --- a/src/game/client/c_baseentity.cpp +++ b/src/game/client/c_baseentity.cpp @@ -1145,7 +1145,7 @@ void C_BaseEntity::Clear( void ) m_pClientAlphaProperty = static_cast< CClientAlphaProperty * >( g_pClientAlphaPropertyMgr->CreateClientAlphaProperty( this ) ); SetLocalOrigin( vec3_origin ); SetLocalAngles( vec3_angle ); - model = NULL; + m_model = NULL; m_vecAbsOrigin.Init(); m_angAbsRotation.Init(); m_vecVelocity.Init(); @@ -1488,11 +1488,11 @@ void C_BaseEntity::SetDistanceFade( float flMinDist, float flMaxDist ) void C_BaseEntity::SetGlobalFadeScale( float flFadeScale ) { m_flFadeScale = flFadeScale; - int modelType = modelinfo->GetModelType( model ); + int modelType = modelinfo->GetModelType( m_model ); if ( modelType == mod_studio ) { MDLCACHE_CRITICAL_SECTION(); - MDLHandle_t hStudioHdr = modelinfo->GetCacheHandle( model ); + MDLHandle_t hStudioHdr = modelinfo->GetCacheHandle( m_model ); if ( hStudioHdr != MDLHANDLE_INVALID ) { const studiohdr_t *pStudioHdr = mdlcache->LockStudioHdr( hStudioHdr ); @@ -1703,7 +1703,7 @@ bool C_BaseEntity::ShouldDraw() return false; } - return (model != 0) && !IsEffectActive(EF_NODRAW) && (m_index != 0); + return (m_model != 0) && !IsEffectActive(EF_NODRAW) && (m_index != 0); } bool C_BaseEntity::TestCollision( const Ray_t& ray, unsigned int mask, trace_t& trace ) @@ -1760,7 +1760,7 @@ ShadowType_t C_BaseEntity::ShadowCastType() if (IsEffectActive(EF_NODRAW | EF_NOSHADOW)) return SHADOWS_NONE; - int modelType = modelinfo->GetModelType( model ); + int modelType = modelinfo->GetModelType( m_model ); return (modelType == mod_studio) ? SHADOWS_RENDER_TO_TEXTURE : SHADOWS_NONE; } @@ -1839,7 +1839,7 @@ bool C_BaseEntity::ShouldReceiveProjectedTextures( int flags ) if ( IsEffectActive( EF_NORECEIVESHADOW ) ) return false; - if (modelinfo->GetModelType( model ) == mod_studio) + if (modelinfo->GetModelType( m_model ) == mod_studio) return false; return true; @@ -1935,7 +1935,7 @@ IPVSNotify* C_BaseEntity::GetPVSNotifyInterface() //----------------------------------------------------------------------------- void C_BaseEntity::GetRenderBounds( Vector& theMins, Vector& theMaxs ) { - int nModelType = modelinfo->GetModelType( model ); + int nModelType = modelinfo->GetModelType( m_model ); if (nModelType == mod_studio || nModelType == mod_brush) { modelinfo->GetModelRenderBounds( GetModel(), theMins, theMaxs ); @@ -2050,7 +2050,7 @@ const QAngle& C_BaseEntity::GetNetworkAngles() const //----------------------------------------------------------------------------- const model_t *C_BaseEntity::GetModel( void ) const { - return model; + return m_model; } @@ -2077,10 +2077,10 @@ void C_BaseEntity::SetModelIndex( int index ) void C_BaseEntity::SetModelPointer( const model_t *pModel ) { - if ( pModel != model ) + if ( pModel != m_model ) { DestroyModelInstance(); - model = pModel; + m_model = pModel; OnNewModel(); UpdateVisibility(); } @@ -2118,7 +2118,7 @@ RenderableTranslucencyType_t C_BaseEntity::ComputeTranslucencyType() { if ( m_bIsBlurred ) return RENDERABLE_IS_TRANSLUCENT; - return modelinfo->ComputeTranslucencyType( model, GetSkin(), GetBody() ); + return modelinfo->ComputeTranslucencyType( m_model, GetSkin(), GetBody() ); } @@ -2266,15 +2266,15 @@ int C_BaseEntity::DrawBrushModel( bool bSort, bool bShadowDepth ) { VPROF_BUDGET( "C_BaseEntity::DrawBrushModel", VPROF_BUDGETGROUP_BRUSHMODEL_RENDERING ); // Identity brushes are drawn in view->DrawWorld as an optimization - Assert ( modelinfo->GetModelType( model ) == mod_brush ); + Assert ( modelinfo->GetModelType( m_model ) == mod_brush ); if ( bShadowDepth ) { - render->DrawBrushModelShadowDepth( this, (model_t *)model, GetAbsOrigin(), GetAbsAngles(), bSort ); + render->DrawBrushModelShadowDepth( this, (model_t *)m_model, GetAbsOrigin(), GetAbsAngles(), bSort ); } else { - render->DrawBrushModel( this, (model_t *)model, GetAbsOrigin(), GetAbsAngles(), bSort ); + render->DrawBrushModel( this, (model_t *)m_model, GetAbsOrigin(), GetAbsAngles(), bSort ); } return 1; @@ -2290,12 +2290,12 @@ int C_BaseEntity::DrawModel( int flags, const RenderableInstance_t &instance ) return 0; int drawn = 0; - if ( !model ) + if ( !m_model ) { return drawn; } - int modelType = modelinfo->GetModelType( model ); + int modelType = modelinfo->GetModelType( m_model ); switch ( modelType ) { case mod_brush: @@ -2305,7 +2305,7 @@ int C_BaseEntity::DrawModel( int flags, const RenderableInstance_t &instance ) case mod_studio: // All studio models must be derived from C_BaseAnimating. Issue warning. Warning( "ERROR: Can't draw studio model %s because %s is not derived from C_BaseAnimating\n", - modelinfo->GetModelName( model ), GetClientClass()->m_pNetworkName ? GetClientClass()->m_pNetworkName : "unknown" ); + modelinfo->GetModelName( m_model ), GetClientClass()->m_pNetworkName ? GetClientClass()->m_pNetworkName : "unknown" ); break; case mod_sprite: //drawn = DrawSprite(); @@ -3261,9 +3261,9 @@ bool C_BaseEntity::Teleported( void ) //----------------------------------------------------------------------------- bool C_BaseEntity::IsSubModel( void ) { - if ( model && - modelinfo->GetModelType( model ) == mod_brush && - modelinfo->GetModelName( model )[0] == '*' ) + if ( m_model && + modelinfo->GetModelType( m_model ) == mod_brush && + modelinfo->GetModelName( m_model )[0] == '*' ) { return true; } @@ -3641,14 +3641,14 @@ void C_BaseEntity::GetColorModulation( float* color ) //----------------------------------------------------------------------------- CollideType_t C_BaseEntity::GetCollideType( void ) { - if ( !m_nModelIndex || !model ) + if ( !m_nModelIndex || !m_model ) return ENTITY_SHOULD_NOT_COLLIDE; if ( !IsSolid( ) ) return ENTITY_SHOULD_NOT_COLLIDE; // If the model is a bsp or studio (i.e. it can collide with the player - if ( ( modelinfo->GetModelType( model ) != mod_brush ) && ( modelinfo->GetModelType( model ) != mod_studio ) ) + if ( ( modelinfo->GetModelType( m_model ) != mod_brush ) && ( modelinfo->GetModelType( m_model ) != mod_studio ) ) return ENTITY_SHOULD_NOT_COLLIDE; // Don't get stuck on point sized entities ( world doesn't count ) @@ -3667,7 +3667,7 @@ CollideType_t C_BaseEntity::GetCollideType( void ) //----------------------------------------------------------------------------- bool C_BaseEntity::IsBrushModel() const { - int modelType = modelinfo->GetModelType( model ); + int modelType = modelinfo->GetModelType( m_model ); return (modelType == mod_brush); } @@ -3739,7 +3739,7 @@ void C_BaseEntity::AddBrushModelDecal( const Ray_t& ray, const Vector& decalCent } effects->DecalShoot( decalIndex, m_index, - model, GetAbsOrigin(), GetAbsAngles(), decalCenter, NULL, 0, &vecNormal ); + m_model, GetAbsOrigin(), GetAbsAngles(), decalCenter, NULL, 0, &vecNormal ); } @@ -3756,7 +3756,7 @@ void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd, // Bloat a little bit so we get the intersection ray.m_Delta *= 1.1f; - int modelType = modelinfo->GetModelType( model ); + int modelType = modelinfo->GetModelType( m_model ); switch ( modelType ) { case mod_studio: @@ -3780,7 +3780,7 @@ void C_BaseEntity::AddDecal( const Vector& rayStart, const Vector& rayEnd, void C_BaseEntity::RemoveAllDecals( void ) { // For now, we only handle removing decals from studiomodels - if ( modelinfo->GetModelType( model ) == mod_studio ) + if ( modelinfo->GetModelType( m_model ) == mod_studio ) { CreateModelInstance(); modelrender->RemoveAllDecals( m_ModelInstance ); diff --git a/src/game/client/c_baseentity.h b/src/game/client/c_baseentity.h index 43d4c5022..b1f9adcb2 100644 --- a/src/game/client/c_baseentity.h +++ b/src/game/client/c_baseentity.h @@ -1395,7 +1395,7 @@ class C_BaseEntity : public IClientEntity private: // Model for rendering - const model_t *model; + const model_t *m_model; CNetworkColor32( m_clrRender ); public: From 52f59ab3954319178f879ca27bc0abe0957f72eb Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:57:20 +0200 Subject: [PATCH 18/30] refactor(client): rename flags -> m_flags maybe missed some outcommented --- src/game/client/c_te_legacytempents.cpp | 114 ++++++++++++------------ src/game/client/tempent.h | 4 +- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/game/client/c_te_legacytempents.cpp b/src/game/client/c_te_legacytempents.cpp index 87598bd24..bb7b6671f 100644 --- a/src/game/client/c_te_legacytempents.cpp +++ b/src/game/client/c_te_legacytempents.cpp @@ -109,7 +109,7 @@ void C_LocalTempEntity::Prepare( model_t *pmodel, float time ) Clear(); // Use these to set per-frame and termination conditions / actions - flags = FTENT_NONE; + m_flags = FTENT_NONE; die = time + 0.75; SetModelPointer( pmodel ); SetRenderMode( kRenderNormal ); @@ -192,7 +192,7 @@ int C_LocalTempEntity::DrawModel( int flags, const RenderableInstance_t &instanc return drawn; } - if ( this->flags & FTENT_BEOCCLUDED ) + if ( this->m_flags & FTENT_BEOCCLUDED ) { int nSlot = GET_ACTIVE_SPLITSCREEN_SLOT(); // Check normal @@ -249,7 +249,7 @@ bool C_LocalTempEntity::IsActive( void ) if ( life < 0 ) { - if ( flags & FTENT_FADEOUT ) + if ( m_flags & FTENT_FADEOUT ) { int alpha; if (GetRenderMode() == kRenderNormal) @@ -274,7 +274,7 @@ bool C_LocalTempEntity::IsActive( void ) } // Never die tempents only die when their die is cleared - if ( flags & FTENT_NEVERDIE ) + if ( m_flags & FTENT_NEVERDIE ) { active = (die != 0); } @@ -295,14 +295,14 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) m_vecTempEntVelocity = m_vecTempEntVelocity + ( m_vecTempEntAcceleration * frametime ); - if ( flags & FTENT_PLYRATTACHMENT ) + if ( m_flags & FTENT_PLYRATTACHMENT ) { if ( IClientEntity *pClient = cl_entitylist->GetClientEntity( clientIndex ) ) { SetLocalOrigin( pClient->GetAbsOrigin() + tentOffset ); } } - else if ( flags & FTENT_SINEWAVE ) + else if ( m_flags & FTENT_SINEWAVE ) { x += m_vecTempEntVelocity[0] * frametime; y += m_vecTempEntVelocity[1] * frametime; @@ -312,7 +312,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) y + sin( m_vecTempEntVelocity[2] + fastFreq + 0.7 ) * (8*m_flSpriteScale), GetLocalOriginDim( Z_INDEX ) + m_vecTempEntVelocity[2] * frametime ) ); } - else if ( flags & FTENT_SPIRAL ) + else if ( m_flags & FTENT_SPIRAL ) { float s, c; SinCos( m_vecTempEntVelocity[2] + fastFreq, &s, &c ); @@ -327,14 +327,14 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) SetLocalOrigin( GetLocalOrigin() + m_vecTempEntVelocity * frametime ); } - if ( flags & FTENT_SPRANIMATE ) + if ( m_flags & FTENT_SPRANIMATE ) { m_flFrame += frametime * m_flFrameRate; if ( m_flFrame >= m_flFrameMax ) { m_flFrame = m_flFrame - (int)(m_flFrame); - if ( !(flags & FTENT_SPRANIMATELOOP) ) + if ( !(m_flags & FTENT_SPRANIMATELOOP) ) { // this animating sprite isn't set to loop, so destroy it. die = 0.0f; @@ -342,7 +342,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) } } } - else if ( flags & FTENT_SPRCYCLE ) + else if ( m_flags & FTENT_SPRCYCLE ) { m_flFrame += frametime * 10; if ( m_flFrame >= m_flFrameMax ) @@ -351,17 +351,17 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) } } - if ( flags & FTENT_SMOKEGROWANDFADE ) + if ( m_flags & FTENT_SMOKEGROWANDFADE ) { m_flSpriteScale += frametime * 0.5f; //m_clrRender.a -= frametime * 1500; } - if ( flags & FTENT_ROTATE ) + if ( m_flags & FTENT_ROTATE ) { SetLocalAngles( GetLocalAngles() + m_vecTempEntAngVelocity * frametime ); } - else if ( flags & FTENT_ALIGNTOMOTION ) + else if ( m_flags & FTENT_ALIGNTOMOTION ) { if ( m_vecTempEntVelocity.Length() > 0.0f ) { @@ -371,7 +371,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) } } - if ( flags & (FTENT_COLLIDEALL | FTENT_COLLIDEWORLD) ) + if ( m_flags & (FTENT_COLLIDEALL | FTENT_COLLIDEWORLD) ) { Vector traceNormal; traceNormal.Init(); @@ -379,11 +379,11 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) trace_t trace; - if ( flags & FTENT_COLLIDEALL ) + if ( m_flags & FTENT_COLLIDEALL ) { Vector vPrevOrigin = m_vecPrevLocalOrigin; - if ( cl_fasttempentcollision.GetInt() > 0 && flags & FTENT_USEFASTCOLLISIONS ) + if ( cl_fasttempentcollision.GetInt() > 0 && m_flags & FTENT_USEFASTCOLLISIONS ) { if ( m_iLastCollisionFrame + cl_fasttempentcollision.GetInt() > gpGlobals->framecount ) { @@ -405,7 +405,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) { // If the FTENT_COLLISIONGROUP flag is set, use the entity's collision group int collisionGroup = COLLISION_GROUP_NONE; - if ( flags & FTENT_COLLISIONGROUP ) + if ( m_flags & FTENT_COLLISIONGROUP ) { collisionGroup = GetCollisionGroup(); } @@ -426,7 +426,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) m_vLastCollisionOrigin = trace.endpos; } } - else if ( flags & FTENT_COLLIDEWORLD ) + else if ( m_flags & FTENT_COLLIDEWORLD ) { CTraceFilterWorldOnly traceFilter; UTIL_TraceLine( m_vecPrevLocalOrigin, GetLocalOrigin(), MASK_SOLID, &traceFilter, &trace ); @@ -444,7 +444,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) // Damp velocity damp = bounceFactor; - if ( flags & (FTENT_GRAVITY|FTENT_SLOWGRAVITY) ) + if ( m_flags & (FTENT_GRAVITY|FTENT_SLOWGRAVITY) ) { damp *= 0.5; if ( traceNormal[2] > 0.9 ) // Hit floor? @@ -452,17 +452,17 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) if ( m_vecTempEntVelocity[2] <= 0 && m_vecTempEntVelocity[2] >= gravity*3 ) { damp = 0; // Stop - flags &= ~(FTENT_ROTATE|FTENT_GRAVITY|FTENT_SLOWGRAVITY|FTENT_COLLIDEWORLD|FTENT_SMOKETRAIL); + m_flags &= ~(FTENT_ROTATE|FTENT_GRAVITY|FTENT_SLOWGRAVITY|FTENT_COLLIDEWORLD|FTENT_SMOKETRAIL); SetLocalAnglesDim( X_INDEX, 0 ); SetLocalAnglesDim( Z_INDEX, 0 ); } } } - if ( flags & (FTENT_CHANGERENDERONCOLLIDE) ) + if ( m_flags & (FTENT_CHANGERENDERONCOLLIDE) ) { OnTranslucencyTypeChanged(); - flags &= ~FTENT_CHANGERENDERONCOLLIDE; + m_flags &= ~FTENT_CHANGERENDERONCOLLIDE; } if (hitSound) @@ -500,20 +500,20 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) } // Check for a collision and stop the particle system. - if ( flags & FTENT_CLIENTSIDEPARTICLES ) + if ( m_flags & FTENT_CLIENTSIDEPARTICLES ) { // Stop the emission of particles on collision - removed from the ClientEntityList on removal from the tempent pool. ParticleProp()->StopEmission(); m_bParticleCollision = true; } - if (flags & FTENT_COLLIDEKILL) + if (m_flags & FTENT_COLLIDEKILL) { // die on impact - flags &= ~FTENT_FADEOUT; + m_flags &= ~FTENT_FADEOUT; die = gpGlobals->curtime; } - else if ( flags & FTENT_ATTACHTOTARGET) + else if ( m_flags & FTENT_ATTACHTOTARGET) { // If we've hit the world, just stop moving if ( trace.DidHitWorld() && !( trace.surface.flags & SURF_SKY ) ) @@ -522,12 +522,12 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) m_vecTempEntAcceleration = vec3_origin; // Remove movement flags so we don't keep tracing - flags &= ~(FTENT_COLLIDEALL | FTENT_COLLIDEWORLD); + m_flags &= ~(FTENT_COLLIDEALL | FTENT_COLLIDEWORLD); } else { // Couldn't attach to this entity. Die. - flags &= ~FTENT_FADEOUT; + m_flags &= ~FTENT_FADEOUT; die = gpGlobals->curtime; } } @@ -552,7 +552,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) } - if ( (flags & FTENT_FLICKER) && framenumber == m_nFlickerFrame ) + if ( (m_flags & FTENT_FLICKER) && framenumber == m_nFlickerFrame ) { dlight_t *dl = effects->CL_AllocDlight (LIGHT_INDEX_TE_DYNAMIC); VectorCopy (GetLocalOrigin(), dl->origin); @@ -563,7 +563,7 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) dl->die = gpGlobals->curtime + 0.01; } - if ( flags & FTENT_SMOKETRAIL ) + if ( m_flags & FTENT_SMOKETRAIL ) { Assert( !"FIXME: Rework smoketrail to be client side\n" ); } @@ -571,13 +571,13 @@ bool C_LocalTempEntity::Frame( float frametime, int framenumber ) // add gravity if we didn't collide in this frame if ( traceFraction == 1 ) { - if ( flags & FTENT_GRAVITY ) + if ( m_flags & FTENT_GRAVITY ) m_vecTempEntVelocity[2] += gravity; - else if ( flags & FTENT_SLOWGRAVITY ) + else if ( m_flags & FTENT_SLOWGRAVITY ) m_vecTempEntVelocity[2] += gravitySlow; } - if ( flags & FTENT_WINDBLOWN ) + if ( m_flags & FTENT_WINDBLOWN ) { Vector vecWind; GetWindspeedAtTime( gpGlobals->curtime, vecWind ); @@ -616,7 +616,7 @@ void C_LocalTempEntity::AddParticleEffect( const char *pszParticleEffect ) return; // Check to see that we don't already have a particle effect. - if ( ( flags & FTENT_CLIENTSIDEPARTICLES ) != 0 ) + if ( ( m_flags & FTENT_CLIENTSIDEPARTICLES ) != 0 ) return; // Add the entity to the ClientEntityList and create the particle system. @@ -624,7 +624,7 @@ void C_LocalTempEntity::AddParticleEffect( const char *pszParticleEffect ) ParticleProp()->Create( pszParticleEffect, PATTACH_ABSORIGIN_FOLLOW ); // Set the particle flag on the temp entity and save the name of the particle effect. - flags |= FTENT_CLIENTSIDEPARTICLES; + m_flags |= FTENT_CLIENTSIDEPARTICLES; SetParticleEffect( pszParticleEffect ); } @@ -808,7 +808,7 @@ void CTempEnts::FizzEffect( C_BaseEntity *pent, int modelIndex, int density, int if (!pTemp) return; - pTemp->flags |= FTENT_SINEWAVE; + pTemp->m_flags |= FTENT_SINEWAVE; pTemp->x = origin[0]; pTemp->y = origin[1]; @@ -859,7 +859,7 @@ void CTempEnts::Bubbles( const Vector &mins, const Vector &maxs, float height, i if (!pTemp) return; - pTemp->flags |= FTENT_SINEWAVE; + pTemp->m_flags |= FTENT_SINEWAVE; pTemp->x = origin[0]; pTemp->y = origin[1]; @@ -913,7 +913,7 @@ void CTempEnts::BubbleTrail( const Vector &start, const Vector &end, float flWat if (!pTemp) return; - pTemp->flags |= FTENT_SINEWAVE; + pTemp->m_flags |= FTENT_SINEWAVE; pTemp->x = origin[0]; pTemp->y = origin[1]; @@ -1037,11 +1037,11 @@ void CTempEnts::BreakModel( const Vector &pos, const QAngle &angles, const Vecto pTemp->SetBody( random->RandomInt(0,frameCount-1) ); } - pTemp->flags |= FTENT_COLLIDEWORLD | FTENT_FADEOUT | FTENT_SLOWGRAVITY; + pTemp->m_flags |= FTENT_COLLIDEWORLD | FTENT_FADEOUT | FTENT_SLOWGRAVITY; if ( random->RandomInt(0,255) < 200 ) { - pTemp->flags |= FTENT_ROTATE; + pTemp->m_flags |= FTENT_ROTATE; pTemp->m_vecTempEntAngVelocity[0] = random->RandomFloat(-256,255); pTemp->m_vecTempEntAngVelocity[1] = random->RandomFloat(-256,255); pTemp->m_vecTempEntAngVelocity[2] = random->RandomFloat(-256,255); @@ -1049,7 +1049,7 @@ void CTempEnts::BreakModel( const Vector &pos, const QAngle &angles, const Vecto if ( (random->RandomInt(0,255) < 100 ) && (flags & BREAK_SMOKE) ) { - pTemp->flags |= FTENT_SMOKETRAIL; + pTemp->m_flags |= FTENT_SMOKETRAIL; } if ((flags & BREAK_GLASS) || (flags & BREAK_TRANS)) @@ -1172,7 +1172,7 @@ C_LocalTempEntity *CTempEnts::ClientProjectile( const Vector& vecOrigin, const V pTemp->SetAbsAngles( angles ); pTemp->SetAbsOrigin( vecOrigin ); pTemp->die = gpGlobals->curtime + lifetime; - pTemp->flags = FTENT_COLLIDEALL | FTENT_ATTACHTOTARGET | FTENT_ALIGNTOMOTION; + pTemp->m_flags = FTENT_COLLIDEALL | FTENT_ATTACHTOTARGET | FTENT_ALIGNTOMOTION; pTemp->clientIndex = ( pOwner != NULL ) ? pOwner->entindex() : 0; pTemp->SetOwnerEntity( pOwner ); pTemp->SetImpactEffect( pszImpactEffect ); @@ -1183,7 +1183,7 @@ C_LocalTempEntity *CTempEnts::ClientProjectile( const Vector& vecOrigin, const V pTemp->ParticleProp()->Create( pszParticleEffect, PATTACH_ABSORIGIN_FOLLOW ); // Set the particle flag on the temp entity and save the name of the particle effect. - pTemp->flags |= FTENT_CLIENTSIDEPARTICLES; + pTemp->m_flags |= FTENT_CLIENTSIDEPARTICLES; pTemp->SetParticleEffect( pszParticleEffect ); } return pTemp; @@ -1234,7 +1234,7 @@ C_LocalTempEntity *CTempEnts::TempSprite( const Vector &pos, const Vector &dir, pTemp->SetRenderColor( 255, 255, 255 ); pTemp->SetRenderAlpha( a * 255 ); - pTemp->flags |= flags; + pTemp->m_flags |= flags; pTemp->SetVelocity( dir ); pTemp->SetLocalOrigin( pos ); @@ -1298,7 +1298,7 @@ void CTempEnts::Sprite_Spray( const Vector &pos, const Vector &dir, int modelInd pTemp->SetRenderFX( kRenderFxNoDissipation ); //pTemp->scale = random->RandomFloat( 0.1, 0.25 ); pTemp->m_flSpriteScale = 0.5; - pTemp->flags |= FTENT_FADEOUT | FTENT_SLOWGRAVITY; + pTemp->m_flags |= FTENT_FADEOUT | FTENT_SLOWGRAVITY; pTemp->fadeSpeed = 2.0; // make the spittle fly the direction indicated, but mix in some noise. @@ -1360,7 +1360,7 @@ void CTempEnts::Sprite_Trail( const Vector &vecStart, const Vector &vecEnd, int if (!pTemp) return; - pTemp->flags |= FTENT_COLLIDEWORLD | FTENT_SPRCYCLE | FTENT_FADEOUT | FTENT_SLOWGRAVITY; + pTemp->m_flags |= FTENT_COLLIDEWORLD | FTENT_SPRCYCLE | FTENT_FADEOUT | FTENT_SLOWGRAVITY; Vector vecVel = vecDir * flSpeed; vecVel.x += random->RandomInt( -127,128 ) * flAmplitude; @@ -1436,14 +1436,14 @@ void CTempEnts::AttachTentToPlayer( int client, int modelIndex, float zoffset, f pTemp->tentOffset[ 1 ] = 0; pTemp->tentOffset[ 2 ] = zoffset; pTemp->die = gpGlobals->curtime + life; - pTemp->flags |= FTENT_PLYRATTACHMENT | FTENT_PERSIST; + pTemp->m_flags |= FTENT_PLYRATTACHMENT | FTENT_PERSIST; // is the model a sprite? if ( modelinfo->GetModelType( pTemp->GetModel() ) == mod_sprite ) { frameCount = modelinfo->GetModelFrameCount( pModel ); pTemp->m_flFrameMax = frameCount - 1; - pTemp->flags |= FTENT_SPRANIMATE | FTENT_SPRANIMATELOOP; + pTemp->m_flags |= FTENT_SPRANIMATE | FTENT_SPRANIMATELOOP; pTemp->m_flFrameRate = 10; } else @@ -1470,7 +1470,7 @@ void CTempEnts::KillAttachedTents( int client ) { C_LocalTempEntity *pTemp = m_TempEnts[ i ]; - if ( pTemp->flags & FTENT_PLYRATTACHMENT ) + if ( pTemp->m_flags & FTENT_PLYRATTACHMENT ) { // this TENT is player attached. // if it is attached to this client, set it to die instantly. @@ -1504,7 +1504,7 @@ void CTempEnts::RicochetSprite( const Vector &pos, model_t *pmodel, float durati pTemp->SetRenderAlpha( 200 ); pTemp->tempent_renderamt = 200; pTemp->m_flSpriteScale = scale; - pTemp->flags = FTENT_FADEOUT; + pTemp->m_flags = FTENT_FADEOUT; pTemp->SetVelocity( vec3_origin ); @@ -1541,7 +1541,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int pTemp->SetRenderMode( kRenderTransTexture ); pTemp->SetRenderFX( kRenderFxNone ); pTemp->m_flSpriteScale = random->RandomFloat( size / 25, size / 35); - pTemp->flags = FTENT_SPRANIMATE; + pTemp->m_flags = FTENT_SPRANIMATE; pTemp->SetRenderColor( r, g, b ); pTemp->SetRenderAlpha( a ); @@ -1592,7 +1592,7 @@ C_LocalTempEntity *CTempEnts::DefaultSprite( const Vector &pos, int spriteIndex, pTemp->m_flFrameMax = frameCount - 1; pTemp->m_flSpriteScale = 1.0; - pTemp->flags |= FTENT_SPRANIMATE; + pTemp->m_flags |= FTENT_SPRANIMATE; if ( framerate == 0 ) framerate = 10; @@ -1622,7 +1622,7 @@ void CTempEnts::Sprite_Smoke( C_LocalTempEntity *pTemp, float scale ) pTemp->SetRenderAlpha( 255 ); pTemp->SetLocalOriginDim( Z_INDEX, pTemp->GetLocalOriginDim( Z_INDEX ) + 20 ); pTemp->m_flSpriteScale = scale; - pTemp->flags = FTENT_WINDBLOWN; + pTemp->m_flags = FTENT_WINDBLOWN; } @@ -1641,7 +1641,7 @@ C_LocalTempEntity * CTempEnts::SpawnTempModel( model_t *pModel, const Vector &ve pTemp->SetAbsAngles( vecAngles ); pTemp->SetBody( 0 ); - pTemp->flags |= iFlags; + pTemp->m_flags |= iFlags; pTemp->m_vecTempEntAngVelocity[0] = random->RandomFloat(-255,255); pTemp->m_vecTempEntAngVelocity[1] = random->RandomFloat(-255,255); pTemp->m_vecTempEntAngVelocity[2] = random->RandomFloat(-255,255); @@ -1943,7 +1943,7 @@ void CTempEnts::TempEntFree( int index ) pTemp->RemoveFromLeafSystem(); // Remove the tempent from the ClientEntityList before removing it from the pool. - if ( ( pTemp->flags & FTENT_CLIENTSIDEPARTICLES ) ) + if ( ( pTemp->m_flags & FTENT_CLIENTSIDEPARTICLES ) ) { // Stop the particle emission if this hasn't happened already - collision or system timing out on its own. if ( !pTemp->m_bParticleCollision ) @@ -2252,12 +2252,12 @@ void CTempEnts::Update(void) // Cull to PVS (not frustum cull, just PVS) if ( !AddVisibleTempEntity( current ) ) { - if ( !( current->flags & FTENT_PERSIST ) ) + if ( !( current->m_flags & FTENT_PERSIST ) ) { // If we can't draw it this frame, just dump it. current->die = gpGlobals->curtime; // Don't fade out, just die - current->flags &= ~FTENT_FADEOUT; + current->m_flags &= ~FTENT_FADEOUT; TempEntFree( i ); } diff --git a/src/game/client/tempent.h b/src/game/client/tempent.h index f9a4e7511..b6893b317 100644 --- a/src/game/client/tempent.h +++ b/src/game/client/tempent.h @@ -93,7 +93,7 @@ class C_LocalTempEntity : public C_BaseAnimating, public C_SpriteRenderer pfnDrawHelper m_pfnDrawHelper; public: - int flags; + int m_flags; float die; float m_flFrameMax; float x; @@ -142,4 +142,4 @@ class C_LocalTempEntity : public C_BaseAnimating, public C_SpriteRenderer }; -#endif // TEMPENTITY_H \ No newline at end of file +#endif // TEMPENTITY_H From 30d85ecf36c7abe8f980b9fa89117f751fe0ccba Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 19:10:55 +0200 Subject: [PATCH 19/30] refactor(client): misc minor renames and changes to appease compiler inline getstat move dir and angles inside rename overshadowed i -> j move int i inside for rename te -> tempEntity inline effects rename observerTarget inline bVisible specify ParticleEffect and ControlPoint variables rename idx rename iBuffAttachment rename outer i remove unused var tPos rename p -> p2 move int declare into for rename info -> infoNew fix i -> t fix i -> j rename i -> idx rename pMaterialWf rename msg -> kvMsg move white and blue remove duplicate fDelay rename buf ->pathBuf remove duplicate nNumHistogramBuckets rename textTall -> smallTextTall rename kv -> kvActive add scope for player helper rename matrix -> matrix2 rename i -> tail renames in bWireframe rename msg -> kvMsg rename pButton -> phButton rename pProfile -> pProfilePref rename uvScale -> uvScale2 inline GetModelType rename pEntry -> pEntry2 rename nNumShadows -> nNumBlobbyShadows rename angle -> angle_yaw/angle_pitch rename input -> x_input rename w/h -> text_w/text_h rename iRenderCache -> tail remove unused GetBounds add ifndef INFESTED_DLL for hudCloseCaption definition remove duplicated definition of fBracketTime --- src/game/client/c_baseanimating.cpp | 62 +++++++++---------- src/game/client/c_baseflex.cpp | 3 +- src/game/client/c_baseplayer.cpp | 15 +++-- src/game/client/c_basetempentity.cpp | 34 +++++----- src/game/client/c_env_projectedtexture.cpp | 5 +- src/game/client/c_particle_smokegrenade.cpp | 14 ++--- src/game/client/c_rope.cpp | 12 ++-- src/game/client/c_sceneentity.cpp | 12 ++-- src/game/client/c_smoke_trail.cpp | 56 ++++++++--------- src/game/client/c_smokestack.cpp | 3 +- src/game/client/c_te_bloodstream.cpp | 16 ++--- src/game/client/c_te_legacytempents.cpp | 3 +- src/game/client/clientleafsystem.cpp | 19 +++--- src/game/client/clientshadowmgr.cpp | 18 +++--- src/game/client/detailobjectsystem.cpp | 12 ++-- src/game/client/fx.cpp | 10 +-- src/game/client/game_controls/MapOverview.cpp | 10 +-- .../client/game_controls/SpectatorGUI.cpp | 6 +- src/game/client/glow_overlay.cpp | 42 ++++++------- src/game/client/hud.cpp | 12 ++-- src/game/client/hud_closecaption.cpp | 2 + src/game/client/hud_lcd.cpp | 6 +- src/game/client/in_joystick.cpp | 40 ++++++------ src/game/client/particlemgr.cpp | 4 +- .../swarm/c_asw_aoegrenade_projectile.cpp | 4 +- .../client/swarm/c_asw_generic_emitter.cpp | 12 ++-- .../swarm/vgui/asw_vgui_hack_wire_tile.cpp | 3 - .../swarm/vgui/asw_vgui_info_message.cpp | 25 ++++---- src/game/client/swarm/vgui/campaignpanel.cpp | 15 +++-- .../swarm/vgui/missioncompletestatsline.cpp | 11 ++-- .../swarm/vgui/missioncompletestatsline.h | 2 +- src/game/client/swarm/vgui/nb_lobby_row.cpp | 6 +- .../swarm/vgui/nb_select_marine_entry.cpp | 6 +- src/game/client/vgui_netgraphpanel.cpp | 26 ++++---- src/game/client/viewpostprocess.cpp | 13 ++-- src/game/shared/achievementmgr.cpp | 6 +- src/public/sentence.cpp | 4 +- 37 files changed, 267 insertions(+), 282 deletions(-) diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 54870b6bb..a2cd63450 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -1204,43 +1204,43 @@ void C_BaseAnimating::ParseModelEffects( KeyValues *modelKeyValues ) for ( KeyValues *pSingleEffect = pkvAllParticleEffects->GetFirstSubKey(); pSingleEffect; pSingleEffect = pSingleEffect->GetNextKey() ) { const char *pszParticleEffect = pSingleEffect->GetString( "name", "" ); - const char *pszAttachment = pSingleEffect->GetString( "attachment_point", "" ); - const char *pszAttachType = pSingleEffect->GetString( "attachment_type", "" ); - const char *pszAttachOffset = pSingleEffect->GetString( "attachment_offset", "" ); + const char *pszPEAttachment = pSingleEffect->GetString( "attachment_point", "" ); + const char *pszPEAttachType = pSingleEffect->GetString( "attachment_type", "" ); + const char *pszPEAttachOffset = pSingleEffect->GetString( "attachment_offset", "" ); // Convert attach type - int iAttachType = GetAttachTypeFromString( pszAttachType ); - if ( iAttachType == -1 ) + int iPEAttachType = GetAttachTypeFromString( pszPEAttachType ); + if ( iPEAttachType == -1 ) { - Warning("Invalid attach type specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' with attach type of '%s'\n", GetModelName(), pszParticleEffect, pszAttachType ); + Warning("Invalid attach type specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' with attach type of '%s'\n", GetModelName(), pszParticleEffect, pszPEAttachType ); return; } // Convert attachment point - int iAttachment = atoi(pszAttachment); + int iAttachment = atoi(pszPEAttachment); // See if we can find any attachment points matching the name - if ( pszAttachment[0] != '0' && iAttachment == 0 ) + if ( pszPEAttachment[0] != '0' && iAttachment == 0 ) { - iAttachment = LookupAttachment( pszAttachment ); + iAttachment = LookupAttachment( pszPEAttachment ); if ( iAttachment == -1 ) { - Warning("Failed to find attachment point specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' on attachment named '%s'\n", GetModelName(), pszParticleEffect, pszAttachment ); + Warning("Failed to find attachment point specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' on attachment named '%s'\n", GetModelName(), pszParticleEffect, pszPEAttachment ); return; } } - Vector vecOffset = vec3_origin; + Vector vecOffsetPE = vec3_origin; - if ( pszAttachOffset ) + if ( pszPEAttachOffset ) { float flVec[3]; - UTIL_StringToVector( flVec, pszAttachOffset ); - vecOffset = Vector( flVec[0], flVec[1], flVec[2] ); + UTIL_StringToVector( flVec, pszPEAttachOffset ); + vecOffsetPE = Vector( flVec[0], flVec[1], flVec[2] ); } CUtlReference hModelEffect; // Spawn the particle effectw - hModelEffect = ParticleProp()->Create( pszParticleEffect, (ParticleAttachment_t)iAttachType, iAttachment, vecOffset ); + hModelEffect = ParticleProp()->Create( pszParticleEffect, (ParticleAttachment_t)iPEAttachType, iAttachment, vecOffsetPE ); KeyValues *pkvAllControlPoints = pSingleEffect->FindKey("ControlPoints"); if ( pkvAllControlPoints ) @@ -1249,37 +1249,37 @@ void C_BaseAnimating::ParseModelEffects( KeyValues *modelKeyValues ) for ( KeyValues *pSingleCP = pkvAllControlPoints->GetFirstSubKey(); pSingleCP; pSingleCP = pSingleCP->GetNextKey() ) { const char *pszControlPoint = pSingleCP->GetString( "cp_number", "" ); - const char *pszAttachment = pSingleCP->GetString( "attachment_point", "" ); - const char *pszAttachType = pSingleCP->GetString( "attachment_type", "" ); - const char *pszAttachOffset = pSingleCP->GetString( "attachment_offset", "" ); + const char *pszCPAttachment = pSingleCP->GetString( "attachment_point", "" ); + const char *pszCPAttachType = pSingleCP->GetString( "attachment_type", "" ); + const char *pszCPAttachOffset = pSingleCP->GetString( "attachment_offset", "" ); // Convert control point int iControlPoint = atoi(pszControlPoint); // Convert attach type - int iAttachType = GetAttachTypeFromString( pszAttachType ); - if ( iAttachType == -1 ) + int iCPAttachType = GetAttachTypeFromString( pszCPAttachType ); + if ( iCPAttachType == -1 ) { - Warning("Invalid attach type specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' with attach type of '%s'\n", GetModelName(), pszParticleEffect, pszAttachType ); + Warning("Invalid attach type specified for particle effect in model '%s' keyvalues section. Trying to spawn effect '%s' with attach type of '%s'\n", GetModelName(), pszParticleEffect, pszCPAttachType ); return; } - Vector vecOffset = vec3_origin; + Vector vecOffsetCP = vec3_origin; - if ( pszAttachOffset ) + if ( pszCPAttachOffset ) { float flVec[3]; - UTIL_StringToVector( flVec, pszAttachOffset ); - vecOffset = Vector( flVec[0], flVec[1], flVec[2] ); + UTIL_StringToVector( flVec, pszCPAttachOffset ); + vecOffsetCP = Vector( flVec[0], flVec[1], flVec[2] ); } // Add the control point if we already have the effect if ( hModelEffect ) { - if ( iAttachType == PATTACH_WORLDORIGIN ) - ParticleProp()->AddControlPoint( hModelEffect, iControlPoint, NULL, (ParticleAttachment_t)iAttachType, NULL, vecOffset ); + if ( iCPAttachType == PATTACH_WORLDORIGIN ) + ParticleProp()->AddControlPoint( hModelEffect, iControlPoint, NULL, (ParticleAttachment_t)iCPAttachType, NULL, vecOffsetCP ); else - ParticleProp()->AddControlPoint( hModelEffect, iControlPoint, this, (ParticleAttachment_t)iAttachType, pszAttachment, vecOffset ); + ParticleProp()->AddControlPoint( hModelEffect, iControlPoint, this, (ParticleAttachment_t)iCPAttachType, pszCPAttachment, vecOffsetCP ); } } @@ -3403,9 +3403,9 @@ void C_BaseAnimating::DoInternalDrawModel( ClientModelRenderInfo_t *pInfo, DrawM if ( VPhysicsGetObject() ) { static color32 debugColorPhys = {255,0,0,0}; - matrix3x4_t matrix; - VPhysicsGetObject()->GetPositionMatrix( &matrix ); - engine->DebugDrawPhysCollide( pCollide->solids[0], NULL, matrix, debugColorPhys ); + matrix3x4_t matrix2; + VPhysicsGetObject()->GetPositionMatrix( &matrix2 ); + engine->DebugDrawPhysCollide( pCollide->solids[0], NULL, matrix2, debugColorPhys ); } } } diff --git a/src/game/client/c_baseflex.cpp b/src/game/client/c_baseflex.cpp index 02dcdfa14..cb7c2791b 100644 --- a/src/game/client/c_baseflex.cpp +++ b/src/game/client/c_baseflex.cpp @@ -478,8 +478,7 @@ class CFlexSceneFileManager : CAutoGameSystem Q_FixSlashes( szFilename ); // See if it's already loaded - int i; - for ( i = 0; i < m_FileList.Count(); i++ ) + for ( int i = 0; i < m_FileList.Count(); i++ ) { CFlexSceneFile *file = m_FileList[ i ]; if ( file && !V_stricmp( file->filename, szFilename ) ) diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index 3b5aead95..4f9a08922 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -457,8 +457,7 @@ void C_BasePlayer::Spawn( void ) ClearFlags(); AddFlag( FL_CLIENT ); - int effects = GetEffects() & EF_NOSHADOW; - SetEffects( effects ); + SetEffects( GetEffects() & EF_NOSHADOW ); m_iFOV = 0; // init field of view. @@ -1526,17 +1525,17 @@ void C_BasePlayer::CalcChaseCamView(Vector& eyeOrigin, QAngle& eyeAngles, float& void C_BasePlayer::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov) { - C_BaseEntity *target = GetObserverTarget(); - - if ( !target ) + C_BaseEntity *observerTarget = GetObserverTarget(); + + if ( !observerTarget ) { - target = this; + observerTarget = this; } m_flObserverChaseDistance = 0.0; - eyeOrigin = target->EyePosition(); - eyeAngles = target->EyeAngles(); + eyeOrigin = observerTarget->EyePosition(); + eyeAngles = observerTarget->EyeAngles(); if ( spec_track.GetInt() > 0 ) { diff --git a/src/game/client/c_basetempentity.cpp b/src/game/client/c_basetempentity.cpp index 754f9cf3f..076b3df7b 100644 --- a/src/game/client/c_basetempentity.cpp +++ b/src/game/client/c_basetempentity.cpp @@ -92,11 +92,11 @@ void C_BaseTempEntity::Precache( void ) //----------------------------------------------------------------------------- void C_BaseTempEntity::PrecacheTempEnts( void ) { - C_BaseTempEntity *te = GetList(); - while ( te ) + C_BaseTempEntity *tempEntity = GetList(); + while ( tempEntity ) { - te->Precache(); - te = te->GetNext(); + tempEntity->Precache(); + tempEntity = tempEntity->GetNext(); } } @@ -106,12 +106,12 @@ void C_BaseTempEntity::PrecacheTempEnts( void ) void C_BaseTempEntity::ClearDynamicTempEnts( void ) { C_BaseTempEntity *next; - C_BaseTempEntity *te = s_pDynamicEntities; - while ( te ) + C_BaseTempEntity *tempEntity = s_pDynamicEntities; + while ( tempEntity ) { - next = te->GetNextDynamic(); - delete te; - te = next; + next = tempEntity->GetNextDynamic(); + delete tempEntity; + tempEntity = next; } s_pDynamicEntities = NULL; @@ -123,20 +123,20 @@ void C_BaseTempEntity::ClearDynamicTempEnts( void ) void C_BaseTempEntity::CheckDynamicTempEnts( void ) { C_BaseTempEntity *next, *newlist = NULL; - C_BaseTempEntity *te = s_pDynamicEntities; - while ( te ) + C_BaseTempEntity *tempEntity = s_pDynamicEntities; + while ( tempEntity ) { - next = te->GetNextDynamic(); - if ( te->ShouldDestroy() ) + next = tempEntity->GetNextDynamic(); + if ( tempEntity->ShouldDestroy() ) { - delete te; + delete tempEntity; } else { - te->m_pNextDynamic = newlist; - newlist = te; + tempEntity->m_pNextDynamic = newlist; + newlist = tempEntity; } - te = next; + tempEntity = next; } s_pDynamicEntities = newlist; diff --git a/src/game/client/c_env_projectedtexture.cpp b/src/game/client/c_env_projectedtexture.cpp index 6c158bab4..3abf0ba78 100644 --- a/src/game/client/c_env_projectedtexture.cpp +++ b/src/game/client/c_env_projectedtexture.cpp @@ -312,9 +312,8 @@ void C_EnvProjectedTexture::UpdateLight( void ) NDebugOverlay::Box( vec3_origin, mins, maxs, 0, 255, 0, 100, 0.0f ); #endif - - bool bVisible = IsBBoxVisible( mins, maxs ); - if (!bVisible) + + if ( !IsBBoxVisible( mins, maxs ) ) { // Spotlight's extents aren't in view if ( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE ) diff --git a/src/game/client/c_particle_smokegrenade.cpp b/src/game/client/c_particle_smokegrenade.cpp index 7aa9f2b92..0e5ead326 100644 --- a/src/game/client/c_particle_smokegrenade.cpp +++ b/src/game/client/c_particle_smokegrenade.cpp @@ -909,12 +909,12 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg ) int nId = AllocateToolParticleEffectId(); - KeyValues *msg = new KeyValues( "OldParticleSystem_Create" ); - msg->SetString( "name", "C_ParticleSmokeGrenade" ); - msg->SetInt( "id", nId ); - msg->SetFloat( "time", gpGlobals->curtime ); + KeyValues *kvMsg = new KeyValues( "OldParticleSystem_Create" ); + kvMsg->SetString( "name", "C_ParticleSmokeGrenade" ); + kvMsg->SetInt( "id", nId ); + kvMsg->SetFloat( "time", gpGlobals->curtime ); - KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true ); + KeyValues *pEmitter = kvMsg->FindKey( "DmeSpriteEmitter", true ); pEmitter->SetInt( "count", NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION ); pEmitter->SetFloat( "duration", 0 ); pEmitter->SetString( "material", "particle/particle_smokegrenade1" ); @@ -991,8 +991,8 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg ) pSmokeGrenadeUpdater->SetFloat( "radiusExpandTime", SMOKESPHERE_EXPAND_TIME ); pSmokeGrenadeUpdater->SetFloat( "cutoffFraction", 0.7f ); - ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); - msg->deleteThis(); + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, kvMsg ); + kvMsg->deleteThis(); } } diff --git a/src/game/client/c_rope.cpp b/src/game/client/c_rope.cpp index 0995e32e2..f02d1941f 100644 --- a/src/game/client/c_rope.cpp +++ b/src/game/client/c_rope.cpp @@ -234,9 +234,9 @@ void CRopeManager::AddToRenderCache( C_RopeKeyframe *pRope ) // If we didn't find one, then allocate the mofo. if ( iRenderCache == nRenderCacheCount ) { - int iRenderCache = m_aRenderCache.AddToTail(); - m_aRenderCache[iRenderCache].m_pSolidMaterial = pRope->GetSolidMaterial(); - m_aRenderCache[iRenderCache].m_nCacheCount = 0; + int tail = m_aRenderCache.AddToTail(); + m_aRenderCache[tail].m_pSolidMaterial = pRope->GetSolidMaterial(); + m_aRenderCache[tail].m_nCacheCount = 0; } if ( m_aRenderCache[iRenderCache].m_nCacheCount >= MAX_ROPE_RENDERCACHE ) @@ -1618,10 +1618,10 @@ bool C_RopeKeyframe::CalculateEndPointAttachment( C_BaseEntity *pEnt, int iAttac if ( !pModel ) return false; - int iAttachment = pModel->LookupAttachment( "buff_attach" ); + int iBuffAttachment = pModel->LookupAttachment( "buff_attach" ); if ( pAngles ) - return pModel->GetAttachment( iAttachment, vPos, *pAngles ); - return pModel->GetAttachment( iAttachment, vPos ); + return pModel->GetAttachment( iBuffAttachment, vPos, *pAngles ); + return pModel->GetAttachment( iBuffAttachment, vPos ); } } diff --git a/src/game/client/c_sceneentity.cpp b/src/game/client/c_sceneentity.cpp index 4b33908da..9973410f4 100644 --- a/src/game/client/c_sceneentity.cpp +++ b/src/game/client/c_sceneentity.cpp @@ -1145,11 +1145,11 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene ) { // Now look up the animblock mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence ); - for ( int i = 0 ; i < seqdesc.groupsize[ 0 ] ; ++i ) + for ( int j = 0 ; j < seqdesc.groupsize[ 0 ] ; ++j ) { - for ( int j = 0; j < seqdesc.groupsize[ 1 ]; ++j ) + for ( int k = 0; k < seqdesc.groupsize[ 1 ]; ++k ) { - int iAnimation = seqdesc.anim( i, j ); + int iAnimation = seqdesc.anim( j, k ); int iBaseAnimation = pStudioHdr->iRelativeAnim( iSequence, iAnimation ); mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( iBaseAnimation ); @@ -1168,14 +1168,14 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene ) ++nResident; if ( nSpew > 1 ) { - Msg( "%s:%s[%i:%i] was resident\n", pStudioHdr->pszName(), animdesc.pszName(), i, j ); + Msg( "%s:%s[%i:%i] was resident\n", pStudioHdr->pszName(), animdesc.pszName(), j, k ); } } else { if ( nSpew != 0 ) { - Msg( "%s:%s[%i:%i] async load\n", pStudioHdr->pszName(), animdesc.pszName(), i, j ); + Msg( "%s:%s[%i:%i] async load\n", pStudioHdr->pszName(), animdesc.pszName(), j, k ); } } } @@ -1193,4 +1193,4 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene ) return; Msg( "%d of %d animations resident\n", nResident, nChecked ); -} \ No newline at end of file +} diff --git a/src/game/client/c_smoke_trail.cpp b/src/game/client/c_smoke_trail.cpp index 5968155ea..4d25e68e3 100644 --- a/src/game/client/c_smoke_trail.cpp +++ b/src/game/client/c_smoke_trail.cpp @@ -396,12 +396,12 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg ) { int nId = m_pSmokeEmitter->AllocateToolParticleEffectId(); - KeyValues *msg = new KeyValues( "OldParticleSystem_Create" ); - msg->SetString( "name", "C_SmokeTrail" ); - msg->SetInt( "id", nId ); - msg->SetFloat( "time", gpGlobals->curtime ); + KeyValues *kvMsg = new KeyValues( "OldParticleSystem_Create" ); + kvMsg->SetString( "name", "C_SmokeTrail" ); + kvMsg->SetInt( "id", nId ); + kvMsg->SetFloat( "time", gpGlobals->curtime ); - KeyValues *pRandomEmitter = msg->FindKey( "DmeRandomEmitter", true ); + KeyValues *pRandomEmitter = kvMsg->FindKey( "DmeRandomEmitter", true ); pRandomEmitter->SetInt( "count", m_SpawnRate ); // particles per second, when duration is < 0 pRandomEmitter->SetFloat( "duration", -1 ); pRandomEmitter->SetInt( "active", bEmitterActive ); @@ -486,18 +486,18 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg ) pEmitter2->SetString( "material", "particle/particle_noisesphere" ); pEmitterParent2->AddSubKey( pEmitter2 ); - ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); - msg->deleteThis(); + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, kvMsg ); + kvMsg->deleteThis(); } else { - KeyValues *msg = new KeyValues( "OldParticleSystem_ActivateEmitter" ); - msg->SetInt( "id", m_pSmokeEmitter->GetToolParticleEffectId() ); - msg->SetInt( "emitter", 0 ); - msg->SetInt( "active", bEmitterActive ); - msg->SetFloat( "time", gpGlobals->curtime ); - ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); - msg->deleteThis(); + KeyValues *kvMsg = new KeyValues( "OldParticleSystem_ActivateEmitter" ); + kvMsg->SetInt( "id", m_pSmokeEmitter->GetToolParticleEffectId() ); + kvMsg->SetInt( "emitter", 0 ); + kvMsg->SetInt( "active", bEmitterActive ); + kvMsg->SetFloat( "time", gpGlobals->curtime ); + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, kvMsg ); + kvMsg->deleteThis(); } } @@ -1880,12 +1880,12 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg ) { int nId = m_pDustEmitter->AllocateToolParticleEffectId(); - KeyValues *msg = new KeyValues( "OldParticleSystem_Create" ); - msg->SetString( "name", "C_DustTrail" ); - msg->SetInt( "id", nId ); - msg->SetFloat( "time", gpGlobals->curtime ); + KeyValues *kvMsg = new KeyValues( "OldParticleSystem_Create" ); + kvMsg->SetString( "name", "C_DustTrail" ); + kvMsg->SetInt( "id", nId ); + kvMsg->SetFloat( "time", gpGlobals->curtime ); - KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true ); + KeyValues *pEmitter = kvMsg->FindKey( "DmeSpriteEmitter", true ); pEmitter->SetString( "material", "particle/smokesprites_0001" ); pEmitter->SetInt( "count", m_SpawnRate ); // particles per second, when duration is < 0 pEmitter->SetFloat( "duration", -1 ); // FIXME @@ -1958,17 +1958,17 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg ) pUpdaters->FindKey( "DmeColorUpdater", true ); pUpdaters->FindKey( "DmeSizeUpdater", true ); - ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); - msg->deleteThis(); + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, kvMsg ); + kvMsg->deleteThis(); } else { - KeyValues *msg = new KeyValues( "OldParticleSystem_ActivateEmitter" ); - msg->SetInt( "id", m_pDustEmitter->GetToolParticleEffectId() ); - msg->SetInt( "emitter", 0 ); - msg->SetInt( "active", bEmitterActive ); - msg->SetFloat( "time", gpGlobals->curtime ); - ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); - msg->deleteThis(); + KeyValues *kvMsg = new KeyValues( "OldParticleSystem_ActivateEmitter" ); + kvMsg->SetInt( "id", m_pDustEmitter->GetToolParticleEffectId() ); + kvMsg->SetInt( "emitter", 0 ); + kvMsg->SetInt( "active", bEmitterActive ); + kvMsg->SetFloat( "time", gpGlobals->curtime ); + ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, kvMsg ); + kvMsg->deleteThis(); } } diff --git a/src/game/client/c_smokestack.cpp b/src/game/client/c_smokestack.cpp index 3244a411a..5e8370b0f 100644 --- a/src/game/client/c_smokestack.cpp +++ b/src/game/client/c_smokestack.cpp @@ -459,8 +459,7 @@ void C_SmokeStack::SimulateParticles( CParticleSimulateIterator *pIterator ) } else { - // Transform. - Vector tPos; + // Transform. if( m_bTwist ) { Vector vTwist( diff --git a/src/game/client/c_te_bloodstream.cpp b/src/game/client/c_te_bloodstream.cpp index 0bf825589..b16a53a29 100644 --- a/src/game/client/c_te_bloodstream.cpp +++ b/src/game/client/c_te_bloodstream.cpp @@ -173,18 +173,18 @@ void TE_BloodStream( IRecipientFilter& filter, float delay, // 'chunkier' appearance. for (count2 = 0; count2 < 2; count2++) { - StandardParticle_t *p = pRen->AddParticle(); - if(p) + StandardParticle_t *p2 = pRen->AddParticle(); + if(p2) { - pRen->SetParticleLifetime(p, 3); - p->SetColor(random->RandomFloat(0.7, 1.0), g, b); - p->SetAlpha(a); - p->m_Pos.Init( + pRen->SetParticleLifetime(p2, 3); + p2->SetColor(random->RandomFloat(0.7, 1.0), g, b); + p2->SetAlpha(a); + p2->m_Pos.Init( (*org)[0] + random->RandomFloat(-1,1), (*org)[1] + random->RandomFloat(-1,1), (*org)[2] + random->RandomFloat(-1,1)); - pRen->SetParticleType(p, pt_vox_slowgrav); + pRen->SetParticleType(p2, pt_vox_slowgrav); VectorCopy (dir, dirCopy); @@ -192,7 +192,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay, VectorScale (dirCopy, num, dirCopy);// randomize a bit - p->m_Velocity = dirCopy * speedCopy; + p2->m_Velocity = dirCopy * speedCopy; } } } diff --git a/src/game/client/c_te_legacytempents.cpp b/src/game/client/c_te_legacytempents.cpp index bb7b6671f..7515153b9 100644 --- a/src/game/client/c_te_legacytempents.cpp +++ b/src/game/client/c_te_legacytempents.cpp @@ -2797,7 +2797,6 @@ void CTempEnts::MuzzleFlash_Shotgun_NPC( ClientEntityHandle_t hEntity, int attac QAngle angles; Vector forward; - int i; // Setup the origin. Vector origin; @@ -2864,7 +2863,7 @@ void CTempEnts::MuzzleFlash_Shotgun_NPC( ClientEntityHandle_t hEntity, int attac int numEmbers = random->RandomInt( 4, 8 ); - for ( i = 0; i < numEmbers; i++ ) + for ( int i = 0; i < numEmbers; i++ ) { pTrailParticle = (TrailParticle *) pTrails->AddParticle( sizeof( TrailParticle ), g_Mat_SMG_Muzzleflash[0], origin ); diff --git a/src/game/client/clientleafsystem.cpp b/src/game/client/clientleafsystem.cpp index d40fb6dcb..4780d05b3 100644 --- a/src/game/client/clientleafsystem.cpp +++ b/src/game/client/clientleafsystem.cpp @@ -752,8 +752,7 @@ void CClientLeafSystem::CreateRenderableHandle( IClientRenderable* pRenderable, if ( nModelType == RENDERABLE_MODEL_UNKNOWN_TYPE ) { - int nType = modelinfo->GetModelType( pRenderable->GetModel() ); - switch( nType ) + switch( modelinfo->GetModelType( pRenderable->GetModel() ) ) { default: nModelType = RENDERABLE_MODEL_ENTITY; break; case mod_brush: nModelType = RENDERABLE_MODEL_BRUSH; break; @@ -1701,24 +1700,24 @@ void CClientLeafSystem::CollateViewModelRenderables( CViewModelRenderablesList * // That's why we need to test RENDER_GROUP_OPAQUE_ENTITY - it may have changed in ComputeFXBlend() if ( !bIsTransparent ) { - int i = opaqueList.AddToTail(); - CViewModelRenderablesList::CEntry *pEntry = &opaqueList[i]; + int tail = opaqueList.AddToTail(); + CViewModelRenderablesList::CEntry *pEntry = &opaqueList[tail]; pEntry->m_pRenderable = renderable.m_pRenderable; pEntry->m_InstanceData.m_nAlpha = 255; } else { - int i = translucentList.AddToTail(); - CViewModelRenderablesList::CEntry *pEntry = &translucentList[i]; + int tail = translucentList.AddToTail(); + CViewModelRenderablesList::CEntry *pEntry = &translucentList[tail]; pEntry->m_pRenderable = renderable.m_pRenderable; pEntry->m_InstanceData.m_nAlpha = nAlpha; if ( renderable.m_nTranslucencyType == RENDERABLE_IS_TWO_PASS ) { - int i = opaqueList.AddToTail(); - CViewModelRenderablesList::CEntry *pEntry = &opaqueList[i]; - pEntry->m_pRenderable = renderable.m_pRenderable; - pEntry->m_InstanceData.m_nAlpha = 255; + int tail2 = opaqueList.AddToTail(); + CViewModelRenderablesList::CEntry *pEntry2 = &opaqueList[tail2]; + pEntry2->m_pRenderable = renderable.m_pRenderable; + pEntry2->m_InstanceData.m_nAlpha = 255; } } } diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index ea884f38a..9e8993d9a 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -1451,7 +1451,6 @@ CClientShadowMgr::CClientShadowMgr() : //----------------------------------------------------------------------------- CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT ) { - Vector dir; if ( args.ArgC() == 1 ) { Vector dir = s_ClientShadowMgr.GetShadowDirection(); @@ -1461,6 +1460,7 @@ CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT ) if ( args.ArgC() == 4 ) { + Vector dir; dir.x = atof( args[1] ); dir.y = atof( args[2] ); dir.z = atof( args[3] ); @@ -1470,8 +1470,6 @@ CON_COMMAND_F( r_shadowdir, "Set shadow direction", FCVAR_CHEAT ) CON_COMMAND_F( r_shadowangles, "Set shadow angles", FCVAR_CHEAT ) { - Vector dir; - QAngle angles; if (args.ArgC() == 1) { Vector dir = s_ClientShadowMgr.GetShadowDirection(); @@ -1483,6 +1481,8 @@ CON_COMMAND_F( r_shadowangles, "Set shadow angles", FCVAR_CHEAT ) if (args.ArgC() == 4) { + Vector dir; + QAngle angles; angles.x = atof( args[1] ); angles.y = atof( args[2] ); angles.z = atof( args[3] ); @@ -4336,9 +4336,9 @@ void CClientShadowMgr::UpdateDirtyShadows() // Transparent shadows must remain dirty, since they were not re-projected int nCount = m_TransparentShadows.Count(); - for ( int i = 0; i < nCount; ++i ) + for ( int j = 0; j < nCount; ++j ) { - m_DirtyShadows.Insert( m_TransparentShadows[i] ); + m_DirtyShadows.Insert( m_TransparentShadows[j] ); } m_TransparentShadows.RemoveAll(); } @@ -4403,9 +4403,9 @@ void CClientShadowMgr::UpdateDirtyShadowsHalfRate() // Transparent shadows must remain dirty, since they were not re-projected int nCount = m_TransparentShadows.Count(); - for ( int i = 0; i < nCount; ++i ) + for ( int j = 0; j < nCount; ++j ) { - m_DirtyShadows.Insert( m_TransparentShadows[i] ); + m_DirtyShadows.Insert( m_TransparentShadows[j] ); } m_TransparentShadows.RemoveAll(); } @@ -6469,10 +6469,10 @@ void CClientShadowMgr::DrawDeferredShadows( const CViewSetup &view, int leafCoun pTextureVar->SetTextureValue( GetFullFrameDepthTexture() ); } - int nNumShadows = s_VisibleShadowList.GetVisibleBlobbyShadowCount(); + int nNumBlobbyShadows = s_VisibleShadowList.GetVisibleBlobbyShadowCount(); meshBuilder.Begin( pMesh, MATERIAL_TRIANGLES, nMaxShadowsPerBatch * ARRAYSIZE( pShadowBoundVerts ) / 4, nMaxShadowsPerBatch * ARRAYSIZE( pShadowBoundIndices ) ); - for ( int i = 0; i < nNumShadows; ++i ) + for ( int i = 0; i < nNumBlobbyShadows; ++i ) { const VisibleShadowInfo_t& vsi = s_VisibleShadowList.GetVisibleBlobbyShadow( i ); ClientShadow_t& shadow = m_Shadows[vsi.m_hShadow]; diff --git a/src/game/client/detailobjectsystem.cpp b/src/game/client/detailobjectsystem.cpp index ee5dbedcb..e7d5613d1 100644 --- a/src/game/client/detailobjectsystem.cpp +++ b/src/game/client/detailobjectsystem.cpp @@ -2922,12 +2922,12 @@ void CDetailObjectSystem::BuildRenderingData( DetailRenderableList_t &list, cons // FIXME: Should we return a center + radius so culling can happen? // right now, detail objects are not even frustum culled - int d = list.AddToTail(); - DetailRenderableInfo_t &info = list[d]; - info.m_pRenderable = &model; - info.m_InstanceData.m_nAlpha = nAlpha; - info.m_nRenderGroup = ( ( nAlpha != 255 ) || model.IsTranslucent() ) ? RENDER_GROUP_TRANSLUCENT : RENDER_GROUP_OPAQUE; - info.m_nLeafIndex = nListLeafIndex; + const int d = list.AddToTail(); + DetailRenderableInfo_t &infoNew = list[d]; + infoNew.m_pRenderable = &model; + infoNew.m_InstanceData.m_nAlpha = nAlpha; + infoNew.m_nRenderGroup = ( ( nAlpha != 255 ) || model.IsTranslucent() ) ? RENDER_GROUP_TRANSLUCENT : RENDER_GROUP_OPAQUE; + infoNew.m_nLeafIndex = nListLeafIndex; // FIXME: Inherently not threadsafe, not to mention not easily SIMDable // move this to happen in DrawModel() diff --git a/src/game/client/fx.cpp b/src/game/client/fx.cpp index 7ee0c1351..e69d254b0 100644 --- a/src/game/client/fx.cpp +++ b/src/game/client/fx.cpp @@ -510,9 +510,9 @@ CSmartPtr FX_Smoke( const Vector &origin, const Vector &velocity pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = flDietime; pParticle->m_vecVelocity = velocity; - for( int i = 0; i < 3; ++i ) + for( int j = 0; j < 3; ++j ) { - pParticle->m_uchColor[i] = pColor[i]; + pParticle->m_uchColor[j] = pColor[j]; } pParticle->m_uchStartAlpha = iAlpha; pParticle->m_uchEndAlpha = 0; @@ -663,10 +663,10 @@ class CSmokeEmitter : public CSimpleEmitter // Randomize the color a little int color[3][2]; - for( int i = 0; i < 3; ++i ) + for( int j = 0; j < 3; ++j ) { - color[i][0] = MAX( 0, m_SpurtColor[i] - 64 ); - color[i][1] = MIN( 255, m_SpurtColor[i] + 64 ); + color[j][0] = MAX( 0, m_SpurtColor[j] - 64 ); + color[j][1] = MIN( 255, m_SpurtColor[j] + 64 ); } pParticle->m_uchColor[0] = random->RandomInt( color[0][0], color[0][1] ); pParticle->m_uchColor[1] = random->RandomInt( color[1][0], color[1][1] ); diff --git a/src/game/client/game_controls/MapOverview.cpp b/src/game/client/game_controls/MapOverview.cpp index 45844a8fe..b05302005 100644 --- a/src/game/client/game_controls/MapOverview.cpp +++ b/src/game/client/game_controls/MapOverview.cpp @@ -575,15 +575,15 @@ void CMapOverview::DrawMapPlayerTrails() player->trail[0] = WorldToMap ( player->position ); - for ( int i=0; i<(MAX_TRAIL_LENGTH-1); i++) + for ( int j=0; j<(MAX_TRAIL_LENGTH-1); j++) { - if ( player->trail[i+1].x == 0 && player->trail[i+1].y == 0 ) + if ( player->trail[j+1].x == 0 && player->trail[j+1].y == 0 ) break; - Vector2D pos1 = MapToPanel( player->trail[i] ); - Vector2D pos2 = MapToPanel( player->trail[i+1] ); + Vector2D pos1 = MapToPanel( player->trail[j] ); + Vector2D pos2 = MapToPanel( player->trail[j+1] ); - int intensity = 255 - float(255.0f * i) / MAX_TRAIL_LENGTH; + int intensity = 255 - float(255.0f * j) / MAX_TRAIL_LENGTH; Vector2D dist = pos1 - pos2; diff --git a/src/game/client/game_controls/SpectatorGUI.cpp b/src/game/client/game_controls/SpectatorGUI.cpp index 9b067c95e..de80a6b29 100644 --- a/src/game/client/game_controls/SpectatorGUI.cpp +++ b/src/game/client/game_controls/SpectatorGUI.cpp @@ -226,10 +226,10 @@ void CSpectatorMenu::FireGameEvent( IGameEvent * event ) const char *selectedPlayerName = gr->GetPlayerName( playernum ); const char *currentPlayerName = ""; - KeyValues *kv = m_pPlayerList->GetActiveItemUserData(); - if ( kv ) + KeyValues *kvActive = m_pPlayerList->GetActiveItemUserData(); + if ( kvActive ) { - currentPlayerName = kv->GetString( "player" ); + currentPlayerName = kvActive->GetString( "player" ); } if ( !FStrEq( currentPlayerName, selectedPlayerName ) ) { diff --git a/src/game/client/glow_overlay.cpp b/src/game/client/glow_overlay.cpp index b12c757a5..4dc49266f 100644 --- a/src/game/client/glow_overlay.cpp +++ b/src/game/client/glow_overlay.cpp @@ -440,34 +440,34 @@ void CGlowOverlay::Draw( bool bCacheFullSceneState ) pRenderContext->Bind( pWireframeMaterial ); // Draw the sprite. - IMesh *pMesh = pRenderContext->GetDynamicMesh( false, 0, 0, pWireframeMaterial ); + IMesh *pMeshWf = pRenderContext->GetDynamicMesh( false, 0, 0, pWireframeMaterial ); - CMeshBuilder builder; - builder.Begin( pMesh, MATERIAL_QUADS, 1 ); + CMeshBuilder builderWf; + builderWf.Begin( pMeshWf, MATERIAL_QUADS, 1 ); - Vector vPt; + Vector vPtWf; - vPt = vBasePt - vRight + vUp; - builder.Position3fv( vPt.Base() ); - builder.Color3f( 1.0f, 0.0f, 0.0f ); - builder.AdvanceVertex(); + vPtWf = vBasePt - vRight + vUp; + builderWf.Position3fv( vPtWf.Base() ); + builderWf.Color3f( 1.0f, 0.0f, 0.0f ); + builderWf.AdvanceVertex(); - vPt = vBasePt + vRight + vUp; - builder.Position3fv( vPt.Base() ); - builder.Color3f( 1.0f, 0.0f, 0.0f ); - builder.AdvanceVertex(); + vPtWf = vBasePt + vRight + vUp; + builderWf.Position3fv( vPtWf.Base() ); + builderWf.Color3f( 1.0f, 0.0f, 0.0f ); + builderWf.AdvanceVertex(); - vPt = vBasePt + vRight - vUp; - builder.Position3fv( vPt.Base() ); - builder.Color3f( 1.0f, 0.0f, 0.0f ); - builder.AdvanceVertex(); + vPtWf = vBasePt + vRight - vUp; + builderWf.Position3fv( vPtWf.Base() ); + builderWf.Color3f( 1.0f, 0.0f, 0.0f ); + builderWf.AdvanceVertex(); - vPt = vBasePt - vRight - vUp; - builder.Position3fv( vPt.Base() ); - builder.Color3f( 1.0f, 0.0f, 0.0f ); - builder.AdvanceVertex(); + vPtWf = vBasePt - vRight - vUp; + builderWf.Position3fv( vPtWf.Base() ); + builderWf.Color3f( 1.0f, 0.0f, 0.0f ); + builderWf.AdvanceVertex(); - builder.End( false, true ); + builderWf.End( false, true ); } } } diff --git a/src/game/client/hud.cpp b/src/game/client/hud.cpp index 92a528247..317778c5a 100644 --- a/src/game/client/hud.cpp +++ b/src/game/client/hud.cpp @@ -875,11 +875,11 @@ bool CHud::LockRenderGroup( int iGroupIndex, CHudElement *pLocker /* = NULL */ ) if ( !DoesRenderGroupExist(iGroupIndex) ) return false; - int i = m_RenderGroups.Find( iGroupIndex ); + int idx = m_RenderGroups.Find( iGroupIndex ); - Assert( m_RenderGroups.IsValidIndex(i) ); + Assert( m_RenderGroups.IsValidIndex(idx) ); - CHudRenderGroup *group = m_RenderGroups.Element(i); + CHudRenderGroup *group = m_RenderGroups.Element(idx); Assert( group ); @@ -924,11 +924,11 @@ bool CHud::UnlockRenderGroup( int iGroupIndex, CHudElement *pLocker /* = NULL */ if ( !DoesRenderGroupExist(iGroupIndex) ) return false; - int i = m_RenderGroups.Find( iGroupIndex ); + int idx = m_RenderGroups.Find( iGroupIndex ); - Assert( m_RenderGroups.IsValidIndex(i) ); + Assert( m_RenderGroups.IsValidIndex(idx) ); - CHudRenderGroup *group = m_RenderGroups.Element(i); + CHudRenderGroup *group = m_RenderGroups.Element(idx); if ( group ) { diff --git a/src/game/client/hud_closecaption.cpp b/src/game/client/hud_closecaption.cpp index 3fa9cb647..76c18e24c 100644 --- a/src/game/client/hud_closecaption.cpp +++ b/src/game/client/hud_closecaption.cpp @@ -2883,7 +2883,9 @@ void OnCaptionLanguageChanged( IConVar *pConVar, const char *pOldString, float f char uilanguage[ 64 ]; engine->GetUILanguage( uilanguage, sizeof( uilanguage ) ); +#ifndef INFESTED_DLL CHudCloseCaption *hudCloseCaption = GET_FULLSCREEN_HUDELEMENT( CHudCloseCaption ); +#endif // If it's not the default, load the language on top of the user's default language if ( Q_strlen( var.GetString() ) > 0 && Q_stricmp( var.GetString(), uilanguage ) ) diff --git a/src/game/client/hud_lcd.cpp b/src/game/client/hud_lcd.cpp index 4dad0371e..359c43a9f 100644 --- a/src/game/client/hud_lcd.cpp +++ b/src/game/client/hud_lcd.cpp @@ -1072,8 +1072,10 @@ void CLCD::DumpPlayer() Msg( "(localplayer)\n\n" ); - CDescribeData helper( (const byte *)player ); - helper.DumpDescription( player->GetPredDescMap() ); + { + CDescribeData helper( (const byte *)player ); + helper.DumpDescription( player->GetPredDescMap() ); + } Msg( "(localteam)\n\n" ); diff --git a/src/game/client/in_joystick.cpp b/src/game/client/in_joystick.cpp index f7b2197fa..4a3bcee2d 100644 --- a/src/game/client/in_joystick.cpp +++ b/src/game/client/in_joystick.cpp @@ -350,7 +350,7 @@ ConVar joy_virtual_peg("joy_virtual_peg", "0"); static float ResponseCurveLookDefault( int nSlot, float x, int axis, float otherAxis, float dist, float frametime ) { envelope_t &envelope = controlEnvelope[ MAX( nSlot, 0 ) ]; - float input = x; + float x_input = x; bool bStickIsPhysicallyPegged = ( dist >= joy_pegged.GetFloat() ); @@ -418,11 +418,11 @@ static float ResponseCurveLookDefault( int nSlot, float x, int axis, float other x = joy_lowmap.GetFloat() * factor; } - x *= AutoAimDampening( input, axis, dist ); + x *= AutoAimDampening( x_input, axis, dist ); if( axis == YAW && x > 0.0f && joy_display_input.GetBool() ) { - Msg("In:%f Out:%f Frametime:%f\n", input, x, frametime ); + Msg("In:%f Out:%f Frametime:%f\n", x_input, x, frametime ); } if( negative ) @@ -438,7 +438,7 @@ static float ResponseCurveLookAccelerated( int nSlot, float x, int axis, float o { envelope_t &envelope = controlEnvelope[ MAX( nSlot, 0 ) ]; - float input = x; + float x_input = x; float flJoyDist = ( sqrt(x*x + otherAxis * otherAxis) ); bool bIsPegged = ( flJoyDist>= joy_pegged.GetFloat() ); @@ -487,11 +487,11 @@ static float ResponseCurveLookAccelerated( int nSlot, float x, int axis, float o x = joy_lowmap.GetFloat() + (delta * envelope.envelopeScale[axis]); } - x *= AutoAimDampening( input, axis, dist ); + x *= AutoAimDampening( x_input, axis, dist ); - if( axis == YAW && input != 0.0f && joy_display_input.GetBool() ) + if( axis == YAW && x_input != 0.0f && joy_display_input.GetBool() ) { - Msg("In:%f Out:%f Frametime:%f\n", input, x, frametime ); + Msg("In:%f Out:%f Frametime:%f\n", x_input, x, frametime ); } if( negative ) @@ -927,7 +927,7 @@ void CInput::JoyStickTurn( CUserCmd *cmd, float &yaw, float &pitch, float framet float aspeed = lookFrametime * GetHud().GetFOVSensitivityAdjust(); // apply turn control - float angle = 0.f; + float angle_yaw = 0.f; if ( user.m_flSpinFrameTime ) { @@ -943,25 +943,25 @@ void CInput::JoyStickTurn( CUserCmd *cmd, float &yaw, float &pitch, float framet { user.m_flSpinFrameTime -= delta; } - angle = user.m_flSpinRate * delta; + angle_yaw = user.m_flSpinRate * delta; } else if ( bVariableFrametime || frametime != gpGlobals->frametime ) { if ( bAbsoluteYaw ) { float fAxisValue = ResponseCurveLook( nSlot, joy_response_look.GetInt(), yaw, YAW, pitch, dist, lookFrametime ); - angle = fAxisValue * s_joy_yawsensitivity.GetFloat( nSlot ) * aspeed * cl_yawspeed.GetFloat(); + angle_yaw = fAxisValue * s_joy_yawsensitivity.GetFloat( nSlot ) * aspeed * cl_yawspeed.GetFloat(); } else { - angle = yaw * s_joy_yawsensitivity.GetFloat( nSlot ) * aspeed * 180.0; + angle_yaw = yaw * s_joy_yawsensitivity.GetFloat( nSlot ) * aspeed * 180.0; } } - if ( angle ) + if ( angle_yaw ) { // track angular direction - user.m_flLastYawAngle = angle; + user.m_flLastYawAngle = angle_yaw; } C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer( nSlot ); @@ -981,27 +981,27 @@ void CInput::JoyStickTurn( CUserCmd *cmd, float &yaw, float &pitch, float framet } } - viewangles[YAW] += angle; - cmd->mousedx = angle; + viewangles[YAW] += angle_yaw; + cmd->mousedx = angle_yaw; // apply look control if ( in_jlook.GetPerUser( nSlot ).state & 1 ) { - float angle = 0; + float angle_pitch = 0; if ( bVariableFrametime || frametime != gpGlobals->frametime ) { if ( bAbsolutePitch ) { float fAxisValue = ResponseCurveLook( nSlot, joy_response_look.GetInt(), pitch, PITCH, yaw, dist, lookFrametime ); - angle = fAxisValue * s_joy_pitchsensitivity.GetFloat( nSlot ) * aspeed * cl_pitchspeed.GetFloat(); + angle_pitch = fAxisValue * s_joy_pitchsensitivity.GetFloat( nSlot ) * aspeed * cl_pitchspeed.GetFloat(); } else { - angle = pitch * s_joy_pitchsensitivity.GetFloat( nSlot ) * aspeed * 180.0; + angle_pitch = pitch * s_joy_pitchsensitivity.GetFloat( nSlot ) * aspeed * 180.0; } } - viewangles[PITCH] += angle; - cmd->mousedy = angle; + viewangles[PITCH] += angle_pitch; + cmd->mousedy = angle_pitch; g_view->StopPitchDrift(); if ( pitch == 0.f && lookspring.GetFloat() == 0.f ) { diff --git a/src/game/client/particlemgr.cpp b/src/game/client/particlemgr.cpp index 1bbeceed8..f08374233 100644 --- a/src/game/client/particlemgr.cpp +++ b/src/game/client/particlemgr.cpp @@ -270,8 +270,8 @@ inline void CParticleEffectBinding::StartDrawMaterialParticles( // Setup the ParticleDraw and bind the material. if( bWireframe ) { - IMaterial *pMaterial = m_pParticleMgr->m_pMaterialSystem->FindMaterial( "debug/debugparticlewireframe", TEXTURE_GROUP_OTHER ); - pRenderContext->Bind( pMaterial, NULL ); + IMaterial *pMaterialWf = m_pParticleMgr->m_pMaterialSystem->FindMaterial( "debug/debugparticlewireframe", TEXTURE_GROUP_OTHER ); + pRenderContext->Bind( pMaterialWf, NULL ); } else { diff --git a/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp b/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp index 5f0492044..e117c3fe9 100644 --- a/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp +++ b/src/game/client/swarm/c_asw_aoegrenade_projectile.cpp @@ -195,9 +195,9 @@ void C_ASW_AOEGrenade_Projectile::UpdateTargetAOEEffects( void ) } // Now add any new targets - for ( int i = 0; i < m_hAOETargets.Count(); i++ ) + for ( int t = 0; t < m_hAOETargets.Count(); t++ ) { - C_BaseEntity *pTarget = m_hAOETargets[i].Get(); + C_BaseEntity *pTarget = m_hAOETargets[t].Get(); // Loops through the aoe targets, and make sure we have an effect for each of them if ( pTarget ) diff --git a/src/game/client/swarm/c_asw_generic_emitter.cpp b/src/game/client/swarm/c_asw_generic_emitter.cpp index 074c83ef8..25d561fe2 100644 --- a/src/game/client/swarm/c_asw_generic_emitter.cpp +++ b/src/game/client/swarm/c_asw_generic_emitter.cpp @@ -988,8 +988,8 @@ void CASWGenericEmitter::SetDieTime(float fTime) // load our emitter settings from a particular template void CASWGenericEmitter::UseTemplate(const char* templatename, bool bReset, bool bLoadFromCache) { - char buf[MAX_PATH]; - Q_snprintf(buf, sizeof(buf), "resource/particletemplates/%s.ptm", templatename); + char pathBuf[MAX_PATH]; + Q_snprintf(pathBuf, sizeof(pathBuf), "resource/particletemplates/%s.ptm", templatename); KeyValues* kv = NULL; if (bLoadFromCache) @@ -1000,10 +1000,10 @@ void CASWGenericEmitter::UseTemplate(const char* templatename, bool bReset, bool kv = new KeyValues("UncachedParticleEmitter"); if (kv) { - if (!kv->LoadFromFile(filesystem, buf, "GAME")) + if (!kv->LoadFromFile(filesystem, pathBuf, "GAME")) { kv->deleteThis(); - DevMsg(1, "C_ASW_Emitter::UseTemplate: couldn't load file: %s\n", buf); + DevMsg(1, "C_ASW_Emitter::UseTemplate: couldn't load file: %s\n", pathBuf); return; } } @@ -1014,7 +1014,7 @@ void CASWGenericEmitter::UseTemplate(const char* templatename, bool bReset, bool // couldn't find the template if ( !kv ) { - DevMsg( 1, "Couldn't load emitter template from cache. %s\n", buf ); + DevMsg( 1, "Couldn't load emitter template from cache. %s\n", pathBuf ); return; } @@ -1335,4 +1335,4 @@ void asw_list_cached_emitters_f() g_ASWGenericEmitterCache.ListCachedEmitters(); } -static ConCommand asw_list_cached_emitters("asw_list_cached_emitters", asw_list_cached_emitters_f, "Lists all emitter templates currently loaded", FCVAR_CHEAT); \ No newline at end of file +static ConCommand asw_list_cached_emitters("asw_list_cached_emitters", asw_list_cached_emitters_f, "Lists all emitter templates currently loaded", FCVAR_CHEAT); diff --git a/src/game/client/swarm/vgui/asw_vgui_hack_wire_tile.cpp b/src/game/client/swarm/vgui/asw_vgui_hack_wire_tile.cpp index 530242a0e..085ee3366 100644 --- a/src/game/client/swarm/vgui/asw_vgui_hack_wire_tile.cpp +++ b/src/game/client/swarm/vgui/asw_vgui_hack_wire_tile.cpp @@ -451,9 +451,6 @@ void CASW_VGUI_Hack_Wire_Tile::Paint() { BaseClass::Paint(); - int x,y,w,t; - GetBounds(x,y,w,t); - if (!m_hHack.Get()) return; diff --git a/src/game/client/swarm/vgui/asw_vgui_info_message.cpp b/src/game/client/swarm/vgui/asw_vgui_info_message.cpp index e2cebef28..03f9ee7bf 100644 --- a/src/game/client/swarm/vgui/asw_vgui_info_message.cpp +++ b/src/game/client/swarm/vgui/asw_vgui_info_message.cpp @@ -74,9 +74,9 @@ CASW_VGUI_Info_Message::CASW_VGUI_Info_Message( vgui::Panel *pParent, const char { m_pLogButton = new ImageButton( this, "LogButton", "#asw_message_log" ); m_pLogButton->AddActionSignalTarget( this ); - KeyValues *msg = new KeyValues( "Command" ); - msg->SetString( "command", "MessageLog" ); - m_pLogButton->SetCommand( msg ); + KeyValues *kvMsg = new KeyValues( "Command" ); + kvMsg->SetString( "command", "MessageLog" ); + m_pLogButton->SetCommand( kvMsg ); } else { @@ -218,15 +218,15 @@ void CASW_VGUI_Info_Message::PerformLayout() { int linew = GetWide()- (ScreenWidth() * TEXT_BORDER_X * 2); m_pLine[i]->SetWide(linew); - int w, h; - m_pLine[i]->GetTextImage()->GetContentSize(w, h); - m_pLine[i]->SetTall(h); - //Msg("setting line %d to %d %d\n", i, linew, h); + int text_w, text_h; + m_pLine[i]->GetTextImage()->GetContentSize(text_w, text_h); + m_pLine[i]->SetTall(text_h); + //Msg("setting line %d to %d %d\n", i, linew, text_h); int posx = ScreenWidth() * TEXT_BORDER_X; int posy = panel_y; //Msg(" and pos %d %d\n", posx, posy); m_pLine[i]->SetPos(posx, posy); - panel_y += h + ScreenHeight() * 0.015f; + panel_y += text_h + ScreenHeight() * 0.015f; } } @@ -287,12 +287,13 @@ void CASW_VGUI_Info_Message::ApplySchemeSettings(vgui::IScheme *pScheme) m_pLine[i]->SetFgColor(Color(255,255,255,255)); } + Color white(255,255,255,255); + Color blue(19,20,40, 255); + m_pOkayButton->SetAlpha(255); m_pOkayButton->SetPaintBackgroundEnabled(true); m_pOkayButton->SetContentAlignment(vgui::Label::a_center); m_pOkayButton->SetBorders("TitleButtonBorder", "TitleButtonBorder"); - Color white(255,255,255,255); - Color blue(19,20,40, 255); m_pOkayButton->SetColors(white, white, white, white, blue); m_pOkayButton->SetPaintBackgroundType(2); @@ -302,8 +303,6 @@ void CASW_VGUI_Info_Message::ApplySchemeSettings(vgui::IScheme *pScheme) m_pLogButton->SetPaintBackgroundEnabled(true); m_pLogButton->SetContentAlignment(vgui::Label::a_center); m_pLogButton->SetBorders("TitleButtonBorder", "TitleButtonBorder"); - Color white(255,255,255,255); - Color blue(19,20,40, 255); m_pLogButton->SetColors(white, white, white, white, blue); m_pLogButton->SetPaintBackgroundType(2); } @@ -674,4 +673,4 @@ void __MsgFunc_ASWStopInfoMessageSound( bf_read &msg ) { StopInfoMessageSound(); } -USER_MESSAGE_REGISTER( ASWStopInfoMessageSound ); \ No newline at end of file +USER_MESSAGE_REGISTER( ASWStopInfoMessageSound ); diff --git a/src/game/client/swarm/vgui/campaignpanel.cpp b/src/game/client/swarm/vgui/campaignpanel.cpp index b17610506..06e91127d 100644 --- a/src/game/client/swarm/vgui/campaignpanel.cpp +++ b/src/game/client/swarm/vgui/campaignpanel.cpp @@ -700,7 +700,7 @@ void CampaignPanel::SetStage( int i ) int bracketx, brackety, bracketw, brackett; float fFadeTime = 0.1f; float fMediumFadeTime = 0.5f; - float fBracketTime = 0.4f; + const float fBracketTime = 0.4f; float fInitialMapLabelDelay = 2.5f; float fMapLabelInterval = 0.05f; GetMapBounds( iMapX, iMapY, iMapW, iMapT ); @@ -726,13 +726,13 @@ void CampaignPanel::SetStage( int i ) vgui::GetAnimationController()->RunAnimationCommand( m_pGalaxyEdges, "alpha", 128, 0, fMediumFadeTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); // fade in all the galactic map labels - for ( int i = 0; i < ASW_NUM_CAMPAIGN_LABELS; i++ ) + for ( int j = 0; j < ASW_NUM_CAMPAIGN_LABELS; j++ ) { - float fLabelDelay = fInitialMapLabelDelay + ( i * fMapLabelInterval ); - vgui::GetAnimationController()->RunAnimationCommand( m_pMapLabels[i], "alpha", 255, fLabelDelay, fMediumFadeTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); + float fLabelDelay = fInitialMapLabelDelay + ( j * fMapLabelInterval ); + vgui::GetAnimationController()->RunAnimationCommand( m_pMapLabels[j], "alpha", 255, fLabelDelay, fMediumFadeTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); - m_pMapLabels[i]->SizeToContents(); - m_pMapLabels[i]->SetSize( m_pMapLabels[i]->GetWide() + 6, m_pMapLabels[i]->GetTall() + 2 ); + m_pMapLabels[j]->SizeToContents(); + m_pMapLabels[j]->SetSize( m_pMapLabels[j]->GetWide() + 6, m_pMapLabels[j]->GetTall() + 2 ); } // update right side messages vgui::GetAnimationController()->RunAnimationCommand( m_pMissionDetails, "alpha", 255, 0, 0.3f, vgui::AnimationController::INTERPOLATOR_LINEAR ); @@ -777,7 +777,6 @@ void CampaignPanel::SetStage( int i ) { //Msg("CMP_BRACKETING_CONSTELLATION\n"); vgui::GetAnimationController()->RunAnimationCommand( m_pBracket, "alpha", 255, 0, fFadeTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); - float fBracketTime = 0.4f; GetConstellationBracket( bracketx, brackety, bracketw, brackett ); vgui::GetAnimationController()->RunAnimationCommand( m_pBracket, "xpos", bracketx, 0, fBracketTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); vgui::GetAnimationController()->RunAnimationCommand( m_pBracket, "ypos", brackety, 0, fBracketTime, vgui::AnimationController::INTERPOLATOR_LINEAR ); @@ -1303,4 +1302,4 @@ void CampaignPanel::OnTick() return; } m_pCommanderList->SetVisible( true ); -} \ No newline at end of file +} diff --git a/src/game/client/swarm/vgui/missioncompletestatsline.cpp b/src/game/client/swarm/vgui/missioncompletestatsline.cpp index 003e8760a..14cc93083 100644 --- a/src/game/client/swarm/vgui/missioncompletestatsline.cpp +++ b/src/game/client/swarm/vgui/missioncompletestatsline.cpp @@ -229,7 +229,7 @@ void MissionCompleteStatsLine::InitFrom(C_ASW_Debrief_Stats *pDebriefStats) int iHighestDamage = pDebriefStats->GetHighestDamageTaken(); int iHighestShotsFired = pDebriefStats->GetHighestShotsFired(); - float fDelay = 1.0f; // roughly how many seconds we want it to take for the bars to fill + const float fDelay = 1.0f; // roughly how many seconds we want it to take for the bars to fill float fKillRate = float(iHighestKills) / fDelay; float fAccRate = fHighestAccuracy / fDelay; float fFFRate = float(iHighestFF) / fDelay; @@ -310,7 +310,6 @@ void MissionCompleteStatsLine::InitFrom(C_ASW_Debrief_Stats *pDebriefStats) m_pBarIcons[6]->SetVisible(true); int iHighestSkillPointsAwarded = pDebriefStats->GetHighestSkillPointsAwarded(); - float fDelay = 1.0f; // roughly how many seconds we want it to take for the bars to fill float fSkillPointsRate = float(iHighestSkillPointsAwarded) / fDelay; m_pStats[6]->Init(0, pDebriefStats->GetSkillPointsAwarded(m_iMarineIndex), fSkillPointsRate, true, false); m_pStats[6]->AddMinMax( 0, iHighestSkillPointsAwarded ); @@ -347,11 +346,11 @@ void MissionCompleteStatsLine::ShowStats() m_pMedalArea->StartShowingMedals(gpGlobals->curtime + fProp * 0.9f + 5.0f); } -void MissionCompleteStatsLine::SetMarineIndex(int i) +void MissionCompleteStatsLine::SetMarineIndex( int idx ) { - if (m_iMarineIndex != i) + if ( m_iMarineIndex != idx ) { - m_iMarineIndex = i; + m_iMarineIndex = idx; UpdateLabels(); @@ -503,4 +502,4 @@ void MissionCompletePlayerStatsLine::SetPlayerIndex(int i) { m_iPlayerIndex = i; UpdateLabels(); -} \ No newline at end of file +} diff --git a/src/game/client/swarm/vgui/missioncompletestatsline.h b/src/game/client/swarm/vgui/missioncompletestatsline.h index ae642620a..571fc3ebb 100644 --- a/src/game/client/swarm/vgui/missioncompletestatsline.h +++ b/src/game/client/swarm/vgui/missioncompletestatsline.h @@ -31,7 +31,7 @@ class MissionCompleteStatsLine : public vgui::Panel virtual void PerformLayout(); void ApplySchemeSettings( vgui::IScheme *scheme ); void UpdateLabels(); - void SetMarineIndex(int i); + void SetMarineIndex( int idx ); void InitFrom(C_ASW_Debrief_Stats* pStats); void ShowStats(); diff --git a/src/game/client/swarm/vgui/nb_lobby_row.cpp b/src/game/client/swarm/vgui/nb_lobby_row.cpp index d7940278b..7d8d97f35 100644 --- a/src/game/client/swarm/vgui/nb_lobby_row.cpp +++ b/src/game/client/swarm/vgui/nb_lobby_row.cpp @@ -207,10 +207,10 @@ void CNB_Lobby_Row::UpdateDetails() lightblue.b = 192; lightblue.a = 255; - BaseModHybridButton *pButton = m_pNameDropdown->GetButton(); - if ( pButton ) + BaseModHybridButton *phButton = m_pNameDropdown->GetButton(); + if ( phButton ) { - pButton->SetText( Briefing()->GetMarineOrPlayerName( m_nLobbySlot ) ); + phButton->SetText( Briefing()->GetMarineOrPlayerName( m_nLobbySlot ) ); } m_pNameDropdown->SetVisible( true ); diff --git a/src/game/client/swarm/vgui/nb_select_marine_entry.cpp b/src/game/client/swarm/vgui/nb_select_marine_entry.cpp index cb29ee91a..505eefcd6 100644 --- a/src/game/client/swarm/vgui/nb_select_marine_entry.cpp +++ b/src/game/client/swarm/vgui/nb_select_marine_entry.cpp @@ -106,8 +106,8 @@ void CNB_Select_Marine_Entry::OnThink() } else { - CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfile( m_nPreferredLobbySlot ); - if ( !pProfile || pProfile->m_ProfileIndex != m_nProfileIndex ) + CASW_Marine_Profile *pProfilePref = Briefing()->GetMarineProfile( m_nPreferredLobbySlot ); + if ( !pProfilePref || pProfilePref->m_ProfileIndex != m_nProfileIndex ) { bEnabled = false; } @@ -138,4 +138,4 @@ void CNB_Select_Marine_Entry::OnCommand( const char *command ) } } BaseClass::OnCommand( command ); -} \ No newline at end of file +} diff --git a/src/game/client/vgui_netgraphpanel.cpp b/src/game/client/vgui_netgraphpanel.cpp index b2d8c2de5..3512470a3 100644 --- a/src/game/client/vgui_netgraphpanel.cpp +++ b/src/game/client/vgui_netgraphpanel.cpp @@ -866,9 +866,9 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban // Draw legend if ( graphvalue >= 3 && graphvalue < 5 ) { - int textTall = g_pMatSystemSurface->GetFontTall( m_hFontSmall ); + int smallTextTall = g_pMatSystemSurface->GetFontTall( m_hFontSmall ); - y = saveY - textTall - 5; + y = saveY - smallTextTall - 5; int cw, ch; g_pMatSystemSurface->GetTextSize( m_hFontSmall, L"otherplayersWWW", cw, ch ); if ( x - cw < 0 ) @@ -881,27 +881,27 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban } g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 255, 255, "localplayer" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 255, 0, 255, "otherplayers" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 255, 0, 0, 255, "entities" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 255, 255, 0, 255, "sounds" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 255, 255, 255, "events" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 255, 0, 255, 255, "tempents" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 128, 128, 0, 255, "usermessages" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 128, 128, 255, "entmessages" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 128, 0, 0, 255, "stringcmds" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 128, 0, 255, "stringtables" ); - y -= textTall; + y -= smallTextTall; g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 128, 255, "voice" ); - y -= textTall; + y -= smallTextTall; } } diff --git a/src/game/client/viewpostprocess.cpp b/src/game/client/viewpostprocess.cpp index 09095c534..af70b2170 100644 --- a/src/game/client/viewpostprocess.cpp +++ b/src/game/client/viewpostprocess.cpp @@ -326,9 +326,8 @@ void CTonemapSystem::IssueAndReceiveBucketQueries() int nQueriesIssuedThisFrame = 0; m_nCurrentQueryFrame++; - int nNumHistogramBuckets = NUM_HISTOGRAM_BUCKETS; - if ( mat_tonemap_algorithm.GetInt() == 1 ) - nNumHistogramBuckets = NUM_HISTOGRAM_BUCKETS_NEW; + const int nNumHistogramBuckets = mat_tonemap_algorithm.GetInt() == 1 ? + NUM_HISTOGRAM_BUCKETS_NEW : NUM_HISTOGRAM_BUCKETS; for ( int i = 0; i < nNumHistogramBuckets; i++ ) { @@ -362,10 +361,6 @@ void CTonemapSystem::IssueAndReceiveBucketQueries() // Now, issue queries for the oldest finished queries we have while ( nQueriesIssuedThisFrame < MAX_QUERIES_PER_FRAME ) { - int nNumHistogramBuckets = NUM_HISTOGRAM_BUCKETS; - if ( mat_tonemap_algorithm.GetInt() == 1 ) - nNumHistogramBuckets = NUM_HISTOGRAM_BUCKETS_NEW; - int nOldestSoFar = -1; for ( int i = 0; i < nNumHistogramBuckets; i++ ) { @@ -1913,9 +1908,9 @@ void DoEnginePostProcessing( int x, int y, int w, int h, bool bFlashlightIsOn, b partialViewportPostDestRect.height -= 0.50f*fullViewportPostDestRect.height; // This math interprets texel coords as being at corner pixel centers (*not* at corner vertices): - Vector2D uvScale( 1.0f - ( (w / 2) / (float)(w - 1) ), + Vector2D uvScale2( 1.0f - ( (w / 2) / (float)(w - 1) ), 1.0f - ( (h / 2) / (float)(h - 1) ) ); - CenterScaleQuadUVs( partialViewportPostSrcCorners, uvScale ); + CenterScaleQuadUVs( partialViewportPostSrcCorners, uvScale2 ); } // Temporary hack... Color correction was crashing on the first frame diff --git a/src/game/shared/achievementmgr.cpp b/src/game/shared/achievementmgr.cpp index 0bd23ad03..02d7cbaa4 100644 --- a/src/game/shared/achievementmgr.cpp +++ b/src/game/shared/achievementmgr.cpp @@ -1605,8 +1605,7 @@ void CAchievementMgr::Steam_OnUserStatsReceived( UserStatsReceived_t *pUserStats int iValue; char pszProgressName[1024]; Q_snprintf( pszProgressName, 1024, "%s_STAT", pAchievement->GetName() ); - bool bRet = SteamUserStats()->GetStat( pszProgressName, &iValue ); - if ( bRet ) + if ( SteamUserStats()->GetStat( pszProgressName, &iValue ) ) { pAchievement->SetCount( iValue ); } @@ -1618,8 +1617,7 @@ void CAchievementMgr::Steam_OnUserStatsReceived( UserStatsReceived_t *pUserStats if ( pAchievement->HasComponents() ) { Q_snprintf( pszProgressName, 1024, "%s_COMP", pAchievement->GetName() ); - bool bRet = SteamUserStats()->GetStat( pszProgressName, &iValue ); - if ( bRet ) + if ( SteamUserStats()->GetStat( pszProgressName, &iValue ) ) { pAchievement->SetComponentBits( iValue ); } diff --git a/src/public/sentence.cpp b/src/public/sentence.cpp index eedbd672f..1c59c1ffe 100644 --- a/src/public/sentence.cpp +++ b/src/public/sentence.cpp @@ -1373,9 +1373,9 @@ void CSentence::Append( float starttime, const CSentence& src ) // Offset times int c = newWord->m_Phonemes.Count(); - for ( int i = 0; i < c; ++i ) + for ( int j = 0; j < c; ++j ) { - CPhonemeTag *tag = newWord->m_Phonemes[ i ]; + CPhonemeTag *tag = newWord->m_Phonemes[ j ]; tag->AddStartTime( starttime ); tag->AddEndTime( starttime ); } From b8867e110b75f07ac306a5cb51eb03d6e39331ac Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:59:55 +0200 Subject: [PATCH 20/30] rename entry -> repeatEntry --- src/game/client/hud_closecaption.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/client/hud_closecaption.cpp b/src/game/client/hud_closecaption.cpp index 76c18e24c..03071c2bb 100644 --- a/src/game/client/hud_closecaption.cpp +++ b/src/game/client/hud_closecaption.cpp @@ -2600,26 +2600,26 @@ void CHudCloseCaption::_ProcessCaption( const wchar_t *caption, unsigned int has } else { - CaptionRepeat &entry = m_CloseCaptionRepeats[ idx ]; + CaptionRepeat &repeatEntry = m_CloseCaptionRepeats[ idx ]; // Interval of 0.0 means just don't double emit on same tick # - if ( entry.m_flInterval <= 0.0f ) + if ( repeatEntry.m_flInterval <= 0.0f ) { - if ( gpGlobals->tickcount <= entry.m_nLastEmitTick ) + if ( gpGlobals->tickcount <= repeatEntry.m_nLastEmitTick ) { return; } } else if ( hasnorepeat ) { - if ( gpGlobals->curtime < ( entry.m_flLastEmitTime + entry.m_flInterval ) ) + if ( gpGlobals->curtime < ( repeatEntry.m_flLastEmitTime + repeatEntry.m_flInterval ) ) { return; } } - entry.m_flLastEmitTime = gpGlobals->curtime; - entry.m_nLastEmitTick = gpGlobals->tickcount; + repeatEntry.m_flLastEmitTime = gpGlobals->curtime; + repeatEntry.m_nLastEmitTick = gpGlobals->tickcount; } Process( caption, duration, fromplayer, direct ); From 4ccc70ee5dc2002738f5c534de31c0e637c12023 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Wed, 3 Jun 2026 17:04:14 +0200 Subject: [PATCH 21/30] rename target -> targetI --- src/game/client/hl2/c_strider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/client/hl2/c_strider.cpp b/src/game/client/hl2/c_strider.cpp index 0664940a0..e6c28fd79 100644 --- a/src/game/client/hl2/c_strider.cpp +++ b/src/game/client/hl2/c_strider.cpp @@ -130,8 +130,8 @@ class C_Strider : public C_ASW_Inhabitable_NPC for ( int i = 0; i < NUM_STRIDER_IK_TARGETS; i++ ) { - CIKTarget &target = m_pIk->m_target[i]; - target.SetPos( m_vecIKTarget[i] ); + CIKTarget &targetI = m_pIk->m_target[i]; + targetI.SetPos( m_vecIKTarget[i] ); #if 0 debugoverlay->AddBoxOverlay( m_vecIKTarget[i], Vector( -2, -2, -2 ), Vector( 2, 2, 2), QAngle( 0, 0, 0 ), (int)255*m_pIk->m_target[i].est.latched, 0, 0, 0, 0 ); #endif From 311b828e849973b428366c76a680ebda6162cbd5 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 21:55:55 +0200 Subject: [PATCH 22/30] rename entry -> repeatEntry --- src/game/client/hud_closecaption.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/client/hud_closecaption.cpp b/src/game/client/hud_closecaption.cpp index 03071c2bb..07fee7b85 100644 --- a/src/game/client/hud_closecaption.cpp +++ b/src/game/client/hud_closecaption.cpp @@ -2549,14 +2549,14 @@ void CHudCloseCaption::ProcessSentenceCaptionStream( const char *tokenstream ) } else { - CaptionRepeat &entry = m_CloseCaptionRepeats[ idx ]; - if ( gpGlobals->curtime < ( entry.m_flLastEmitTime + entry.m_flInterval ) ) + CaptionRepeat &repeatEntry = m_CloseCaptionRepeats[ idx ]; + if ( gpGlobals->curtime < ( repeatEntry.m_flLastEmitTime + repeatEntry.m_flInterval ) ) { return; } - entry.m_flLastEmitTime = gpGlobals->curtime; - entry.m_nLastEmitTick = gpGlobals->tickcount; + repeatEntry.m_flLastEmitTime = gpGlobals->curtime; + repeatEntry.m_nLastEmitTick = gpGlobals->tickcount; } } From 243e42d8257a58b70e95c87f3fc139cefba8bab4 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Wed, 3 Jun 2026 17:12:54 +0200 Subject: [PATCH 23/30] rename p1234 -> vP1232 --- src/game/client/c_rope.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/client/c_rope.cpp b/src/game/client/c_rope.cpp index f02d1941f..fa3c1e17b 100644 --- a/src/game/client/c_rope.cpp +++ b/src/game/client/c_rope.cpp @@ -1506,12 +1506,12 @@ struct catmull_t }; // bake out the terms of the catmull rom spline -void Catmull_Rom_Spline_Matrix( const Vector &p1, const Vector &p2, const Vector &p3, const Vector &p4, catmull_t &output ) +void Catmull_Rom_Spline_Matrix( const Vector &vP1, const Vector &vP2, const Vector &vP3, const Vector &vP4, catmull_t &output ) { - output.t3 = 0.5f * ((-1*p1) + (3*p2) + (-3*p3) + p4); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ] - output.t2 = 0.5f * ((2*p1) + (-5*p2) + (4*p3) - p4); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ] - output.t = 0.5f * ((-1*p1) + p3); // 0.5 t * [ (-1*p1) + p3 ] - output.c = p2; // p2 + output.t3 = 0.5f * ((-1*vP1) + (3*vP2) + (-3*vP3) + vP4); // 0.5 t^3 * [ (-1*p1) + ( 3*p2) + (-3*p3) + p4 ] + output.t2 = 0.5f * ((2*vP1) + (-5*vP2) + (4*vP3) - vP4); // 0.5 t^2 * [ ( 2*p1) + (-5*p2) + ( 4*p3) - p4 ] + output.t = 0.5f * ((-1*vP1) + vP3); // 0.5 t * [ (-1*p1) + p3 ] + output.c = vP2; // p2 } // evaluate one point on the spline, t is a vector of (t, t^2, t^3) From 670a2801f124ba0c8dc972e05b48976ea16aefbf Mon Sep 17 00:00:00 2001 From: SuperCake Date: Wed, 3 Jun 2026 16:49:47 +0200 Subject: [PATCH 24/30] remove new tmp variables --- src/game/client/c_smoke_trail.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/client/c_smoke_trail.cpp b/src/game/client/c_smoke_trail.cpp index 4d25e68e3..ddd6adbc2 100644 --- a/src/game/client/c_smoke_trail.cpp +++ b/src/game/client/c_smoke_trail.cpp @@ -770,8 +770,6 @@ void C_RocketTrail::Update( float fTimeDelta ) if ( m_bDamaged ) { - SimpleParticle *pParticle; - Vector offset; Vector offsetColor; CSmartPtr pEmitter = CEmberEffect::Create("C_RocketTrail::damaged"); From 68e98fd384eb10767f0c077900b7d70702911afd Mon Sep 17 00:00:00 2001 From: SuperCake Date: Mon, 1 Jun 2026 23:28:37 +0200 Subject: [PATCH 25/30] remove new tmp buffer wzValue --- src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp b/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp index 67d5af446..3d4ff3ab1 100644 --- a/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp +++ b/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp @@ -79,7 +79,6 @@ void Holdout_Hud_Wave_Panel::OnThink() m_pCountdownTimeLabel->SetVisible( true ); m_pCountdownLabel->SetVisible( true ); - wchar_t wzValue[15]; V_snwprintf( wzValue, ARRAYSIZE( wzValue ), L"%d", (int) flTimeLeft ); m_pCountdownTimeLabel->SetText( wzValue ); @@ -93,4 +92,4 @@ void Holdout_Hud_Wave_Panel::ApplySchemeSettings( vgui::IScheme *pScheme ) BaseClass::ApplySchemeSettings( pScheme ); LoadControlSettings( "resource/UI/HoldoutHudWavePanel.res" ); -} \ No newline at end of file +} From 462ff62ef059c2f58422bccd671233bf57fa4090 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:50:09 +0200 Subject: [PATCH 26/30] remove unused variable offset --- src/game/client/c_smoke_trail.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/client/c_smoke_trail.cpp b/src/game/client/c_smoke_trail.cpp index ddd6adbc2..d2cd61d9e 100644 --- a/src/game/client/c_smoke_trail.cpp +++ b/src/game/client/c_smoke_trail.cpp @@ -1488,8 +1488,6 @@ void C_FireTrail::Update( float fTimeDelta ) CSmartPtr pSimple = CSimpleEmitter::Create( "FireTrail" ); pSimple->SetSortOrigin( GetAbsOrigin() ); - - Vector offset; #define STARTSIZE 8 #define ENDSIZE 16 From 5b38a2c961cc8b654dfc1edabaae2025fbf239bd Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 20:38:39 +0200 Subject: [PATCH 27/30] remove second reference shadow --- src/game/client/clientshadowmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 9e8993d9a..8d33c4de9 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -4695,7 +4695,7 @@ void CClientShadowMgr::UpdateProjectedTextureInternal( ClientShadowHandle_t hand VPROF_BUDGET( "CClientShadowMgr::UpdateProjectedTextureInternal", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING ); Assert( ( shadow.m_Flags & SHADOW_FLAGS_SHADOW ) == 0 ); - ClientShadow_t& shadow = m_Shadows[handle]; + // ClientShadow_t& shadow = m_Shadows[handle]; shadowmgr->EnableShadow( shadow.m_ShadowHandle, true ); From 767aafa32b1605864ba34fe5c385d627df04bcca Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 15:21:34 +0200 Subject: [PATCH 28/30] remove second local player check --- src/game/client/swarm/vgui/missioncompletepanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/client/swarm/vgui/missioncompletepanel.cpp b/src/game/client/swarm/vgui/missioncompletepanel.cpp index 88e844eed..d12794abc 100644 --- a/src/game/client/swarm/vgui/missioncompletepanel.cpp +++ b/src/game/client/swarm/vgui/missioncompletepanel.cpp @@ -649,8 +649,8 @@ void MissionCompletePanel::OnCommand( const char *command ) { if ( m_bSuccess && m_bLastMission && !m_bCreditsSeen ) { - C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); - if ( pPlayer ) + // C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); + // if ( pPlayer ) { m_pStatsPanel->m_pDebrief->m_pPara[0]->SetVisible( false ); m_pStatsPanel->m_pDebrief->m_pPara[1]->SetVisible( false ); From c5dd9fd62dfb270e17ebe8b9027af976a72f3c72 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sun, 7 Jun 2026 00:47:33 +0200 Subject: [PATCH 29/30] remove second local base player check --- src/game/client/viewrender.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/game/client/viewrender.cpp b/src/game/client/viewrender.cpp index 801115256..a5297f2cd 100644 --- a/src/game/client/viewrender.cpp +++ b/src/game/client/viewrender.cpp @@ -1848,11 +1848,7 @@ static void GetSkyboxFogColor( float *pColor, bool ignoreOverride, bool ignoreHD { fogparams_t *pFogParams = NULL; - C_BasePlayer *pbp = C_BasePlayer::GetLocalPlayer(); - if (pbp) - { - pFogParams = pbp->GetFogParams(); - } + pFogParams = pbp->GetFogParams(); if (GetFogEnable(pFogParams)) { From a3fae8f5693abff3292a6181587a06bba16afbf0 Mon Sep 17 00:00:00 2001 From: SuperCake Date: Sat, 6 Jun 2026 21:44:48 +0200 Subject: [PATCH 30/30] remove second pointer pRenderContext --- src/game/client/viewrender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/viewrender.cpp b/src/game/client/viewrender.cpp index a5297f2cd..2365dfcd7 100644 --- a/src/game/client/viewrender.cpp +++ b/src/game/client/viewrender.cpp @@ -1271,7 +1271,7 @@ void CViewRender::DrawUnderwaterOverlay( void ) UpdateRefractTexture( x, y, w, h, true ); // Now draw the entire screen using the material... - CMatRenderContextPtr pRenderContext( materials ); + // CMatRenderContextPtr pRenderContext( materials ); ITexture *pTexture = GetPowerOfTwoFrameBufferTexture( ); int sw = pTexture->GetActualWidth(); int sh = pTexture->GetActualHeight();