diff --git a/src/common/language.cpp b/src/common/language.cpp index f1378e47f..f610ff558 100644 --- a/src/common/language.cpp +++ b/src/common/language.cpp @@ -14,9 +14,9 @@ struct Language_t { - char *m_pchName; - char *m_pchShortName; - char *m_pchVGUILocalizationName; + const char *m_pchName; + const char *m_pchShortName; + const char *m_pchVGUILocalizationName; ELanguage m_ELanguage; }; diff --git a/src/common/xbox/xboxstubs.h b/src/common/xbox/xboxstubs.h index 8c6ffa57c..c63576977 100644 --- a/src/common/xbox/xboxstubs.h +++ b/src/common/xbox/xboxstubs.h @@ -108,7 +108,7 @@ typedef unsigned __int64 ULONGLONG; typedef int32 COLORREF; #endif -#ifndef INVALID_HANDLE_VALUE +#if !defined( _WIN32 ) && !defined( INVALID_HANDLE_VALUE ) #define INVALID_HANDLE_VALUE ((HANDLE)-1) #endif diff --git a/src/fgdlib/gamedata.cpp b/src/fgdlib/gamedata.cpp index 81f522ba4..279cbc535 100644 --- a/src/fgdlib/gamedata.cpp +++ b/src/fgdlib/gamedata.cpp @@ -87,7 +87,7 @@ static bool DoGetToken(TokenReader &tr, char **ppszStore, int nSize, trtoken_t t // We didn't get the expected token type but no expected // string was specified. // - char *pszTokenName; + const char *pszTokenName; switch (ttexpecting) { case IDENT: diff --git a/src/fgdlib/gdvar.cpp b/src/fgdlib/gdvar.cpp index 4a0511a5e..5e69c55af 100644 --- a/src/fgdlib/gdvar.cpp +++ b/src/fgdlib/gdvar.cpp @@ -14,7 +14,7 @@ typedef struct { GDIV_TYPE eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. trtoken_t eStoreAs; // How this type is stored (STRING, INTEGER, etc). } TypeMap_t; @@ -64,7 +64,7 @@ static TypeMap_t TypeMap[] = }; -char *GDinputvariable::m_pszEmpty = ""; +const char *GDinputvariable::m_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/fgdlib/inputoutput.cpp b/src/fgdlib/inputoutput.cpp index 6c0d65f17..742cb182a 100644 --- a/src/fgdlib/inputoutput.cpp +++ b/src/fgdlib/inputoutput.cpp @@ -15,11 +15,11 @@ typedef struct { InputOutputType_t eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. } TypeMap_t; -char *CClassInputOutputBase::g_pszEmpty = ""; +const char *CClassInputOutputBase::g_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/fgdlib/wckeyvalues.cpp b/src/fgdlib/wckeyvalues.cpp index 0ee4ba836..46bc8f2e2 100644 --- a/src/fgdlib/wckeyvalues.cpp +++ b/src/fgdlib/wckeyvalues.cpp @@ -139,8 +139,8 @@ WCKeyValuesT::~WCKeyValuesT(void) template const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const { - int i = FindByKeyName( pszKey ); - if ( i == GetInvalidIndex() ) + int i = this->FindByKeyName( pszKey ); + if ( i == this->GetInvalidIndex() ) { return NULL; } @@ -149,7 +149,7 @@ const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const if(piIndex) piIndex[0] = i; - return m_KeyValues[i].szValue; + return this->m_KeyValues[i].szValue; } } @@ -233,8 +233,8 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) StripEdgeWhiteSpace(szTmpKey); StripEdgeWhiteSpace(szTmpValue); - int i = FindByKeyName( szTmpKey ); - if ( i == GetInvalidIndex() ) + int i = this->FindByKeyName( szTmpKey ); + if ( i == this->GetInvalidIndex() ) { if ( pszValue ) { @@ -244,21 +244,21 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) MDkeyvalue newkv; Q_strncpy( newkv.szKey, szTmpKey, sizeof( newkv.szKey ) ); Q_strncpy( newkv.szValue, szTmpValue, sizeof( newkv.szValue ) ); - InsertKeyValue( newkv ); + this->InsertKeyValue( newkv ); } } else { if (pszValue != NULL) { - V_strncpy(m_KeyValues[i].szValue, szTmpValue, sizeof(m_KeyValues[i].szValue)); + V_strncpy(this->m_KeyValues[i].szValue, szTmpValue, sizeof(this->m_KeyValues[i].szValue)); } // // If we are setting to a NULL value, delete the key. // else { - RemoveKeyAt( i ); + this->RemoveKeyAt( i ); } } } @@ -270,7 +270,7 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) template void WCKeyValuesT::RemoveAll(void) { - m_KeyValues.RemoveAll(); + this->m_KeyValues.RemoveAll(); } diff --git a/src/game/client/beamdraw.cpp b/src/game/client/beamdraw.cpp index 006eacd34..80ad44cf1 100644 --- a/src/game/client/beamdraw.cpp +++ b/src/game/client/beamdraw.cpp @@ -832,8 +832,8 @@ void DrawSplineSegs( int noise_divisions, float *prgNoise, } else if ( flags & FBEAM_SHADEOUT ) { - float fadeFraction = fadeLength/length; - brightness = 1.0 - (fraction/fadeFraction); + float flFadeFraction = fadeLength/length; + brightness = 1.0 - (fraction/flFadeFraction); if (brightness < 0) { brightness = 0; diff --git a/src/game/client/bone_merge_cache.cpp b/src/game/client/bone_merge_cache.cpp index 8b7b49809..5d29388b6 100644 --- a/src/game/client/bone_merge_cache.cpp +++ b/src/game/client/bone_merge_cache.cpp @@ -96,7 +96,7 @@ void CBoneMergeCache::UpdateCache() m_pFollowHdr->pBone( parentBoneIndex )->pszName(), m_pFollowHdr->pszName() ); static CUtlSymbolTableMT s_FollowerWarnings; - if ( UTL_INVAL_SYMBOL == s_FollowerWarnings.Find( sz ) ) + if ( !s_FollowerWarnings.Find( sz ).IsValid() ) { s_FollowerWarnings.AddString( sz ); Warning( "%s", sz ); diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 52f195b3b..ef6ca4a92 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -367,7 +367,7 @@ void C_ClientRagdoll::OnRestore( void ) RagdollMoved(); } -void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "C_ClientRagdoll::ImpactTrace" ); @@ -2501,15 +2501,15 @@ void C_BaseAnimating::CalculateIKLocks( float currentTime ) partition->SuppressLists( curSuppressed, true ); } -bool C_BaseAnimating::GetPoseParameterRange( int index, float &minValue, float &maxValue ) +bool C_BaseAnimating::GetPoseParameterRange( int iIndex, float &minValue, float &maxValue ) { CStudioHdr *pStudioHdr = GetModelPtr(); if (pStudioHdr) { - if (index >= 0 && index < pStudioHdr->GetNumPoseParameters()) + if (iIndex >= 0 && iIndex < pStudioHdr->GetNumPoseParameters()) { - const mstudioposeparamdesc_t &pose = pStudioHdr->pPoseParameter( index ); + const mstudioposeparamdesc_t &pose = pStudioHdr->pPoseParameter( iIndex ); minValue = pose.start; maxValue = pose.end; return true; @@ -2532,9 +2532,9 @@ void C_BaseAnimating::ControlMouth( CStudioHdr *pstudiohdr ) if ( !pstudiohdr ) return; - int index = LookupPoseParameter( pstudiohdr, LIPSYNC_POSEPARAM_NAME ); + int iIndex = LookupPoseParameter( pstudiohdr, LIPSYNC_POSEPARAM_NAME ); - if ( index != -1 ) + if ( iIndex != -1 ) { float value = GetMouth()->mouthopen / 64.0; @@ -2544,15 +2544,15 @@ void C_BaseAnimating::ControlMouth( CStudioHdr *pstudiohdr ) value = 1.0; float start, end; - GetPoseParameterRange( index, start, end ); + GetPoseParameterRange( iIndex, start, end ); value = (1.0 - value) * start + value * end; //Adrian - Set the pose parameter value. //It has to be called "mouth". - SetPoseParameter( pstudiohdr, index, value ); + SetPoseParameter( pstudiohdr, iIndex, value ); // Reset interpolation here since the client is controlling this rather than the server... - m_iv_flPoseParameter.SetHistoryValuesForItem( index, raw ); + m_iv_flPoseParameter.SetHistoryValuesForItem( iIndex, raw ); } } @@ -4256,20 +4256,20 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int case AE_CL_ENABLE_BODYGROUP: { - int index = FindBodygroupByName( options ); - if ( index >= 0 ) + int iIndex = FindBodygroupByName( options ); + if ( iIndex >= 0 ) { - SetBodygroup( index, 1 ); + SetBodygroup( iIndex, 1 ); } } break; case AE_CL_DISABLE_BODYGROUP: { - int index = FindBodygroupByName( options ); - if ( index >= 0 ) + int iIndex = FindBodygroupByName( options ); + if ( iIndex >= 0 ) { - SetBodygroup( index, 0 ); + SetBodygroup( iIndex, 0 ); } } break; @@ -4299,10 +4299,10 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int value = atoi( token ); } - int index = FindBodygroupByName( szBodygroupName ); - if ( index >= 0 ) + int iIndex = FindBodygroupByName( szBodygroupName ); + if ( iIndex >= 0 ) { - SetBodygroup( index, value ); + SetBodygroup( iIndex, value ); } } break; @@ -4963,8 +4963,8 @@ C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy() TermRopes(); - const model_t *model = GetModel(); - const char *pModelName = modelinfo->GetModelName( model ); + const model_t *pModel = GetModel(); + const char *pModelName = modelinfo->GetModelName( pModel ); if ( pRagdoll->InitializeAsClientEntity( pModelName, false ) == false ) { diff --git a/src/game/client/c_baseanimating.h b/src/game/client/c_baseanimating.h index d82ae85f9..e57eb556b 100644 --- a/src/game/client/c_baseanimating.h +++ b/src/game/client/c_baseanimating.h @@ -81,7 +81,7 @@ class CAttachmentData QAngle m_angRotation; Vector m_vOriginVelocity; int m_nLastFramecount : 31; - int m_bAnglesComputed : 1; + unsigned int m_bAnglesComputed : 1; }; @@ -685,7 +685,7 @@ class C_ClientRagdoll : public C_BaseAnimating, public IPVSNotify virtual void Release( void ); virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); void ClientThink( void ); void ReleaseRagdoll( void ) { m_bReleaseRagdoll = true; } bool ShouldSavePhysics( void ) { return true; } diff --git a/src/game/client/c_baseanimatingoverlay.cpp b/src/game/client/c_baseanimatingoverlay.cpp index 53282adaa..bade2f160 100644 --- a/src/game/client/c_baseanimatingoverlay.cpp +++ b/src/game/client/c_baseanimatingoverlay.cpp @@ -352,7 +352,7 @@ void C_BaseAnimatingOverlay::CheckForLayerChanges( CStudioHdr *hdr, float curren int i; for (i = 0; i < m_iv_AnimOverlay.Count(); i++) { - CDisableRangeChecks disableRangeChecks; + CDisableRangeChecks disableRangeChecks2; int iHead, iPrev1, iPrev2; m_iv_AnimOverlay[i].GetInterpolationInfo( currentTime, &iHead, &iPrev1, &iPrev2 ); diff --git a/src/game/client/c_baseentity.cpp b/src/game/client/c_baseentity.cpp index f2816dce3..30f5cbef9 100644 --- a/src/game/client/c_baseentity.cpp +++ b/src/game/client/c_baseentity.cpp @@ -406,7 +406,7 @@ void C_BaseEntity::RecvProxy_CellOrigin( const CRecvProxyData *pData, void *pStr if ( pEnt->ShouldRegenerateOriginFromCellBits() ) { - register int const cellwidth = pEnt->m_cellwidth; // Load it into a register + int const cellwidth = pEnt->m_cellwidth; // Load it into a register vecNetworkOrigin->x = CoordFromCell( cellwidth, pEnt->m_cellX, pData->m_Value.m_Vector[0] ); vecNetworkOrigin->y = CoordFromCell( cellwidth, pEnt->m_cellY, pData->m_Value.m_Vector[1] ); vecNetworkOrigin->z = CoordFromCell( cellwidth, pEnt->m_cellZ, pData->m_Value.m_Vector[2] ); @@ -424,7 +424,7 @@ void C_BaseEntity::RecvProxy_CellOriginXY( const CRecvProxyData *pData, void *pS pEnt->m_vecCellOrigin.x = pData->m_Value.m_Vector[0]; pEnt->m_vecCellOrigin.y = pData->m_Value.m_Vector[1]; - register int const cellwidth = pEnt->m_cellwidth; // Load it into a register + int const cellwidth = pEnt->m_cellwidth; // Load it into a register if ( pEnt->ShouldRegenerateOriginFromCellBits() ) { @@ -443,7 +443,7 @@ void C_BaseEntity::RecvProxy_CellOriginZ( const CRecvProxyData *pData, void *pSt pEnt->m_vecCellOrigin.z = pData->m_Value.m_Float; - register int const cellwidth = pEnt->m_cellwidth; // Load it into a register + int const cellwidth = pEnt->m_cellwidth; // Load it into a register if ( pEnt->ShouldRegenerateOriginFromCellBits() ) { @@ -2068,9 +2068,9 @@ int C_BaseEntity::GetModelIndex( void ) const // Purpose: // Input : index - //----------------------------------------------------------------------------- -void C_BaseEntity::SetModelIndex( int index ) +void C_BaseEntity::SetModelIndex( int iIndex ) { - m_nModelIndex = index; + m_nModelIndex = iIndex; const model_t *pModel = modelinfo->GetModel( m_nModelIndex ); SetModelPointer( pModel ); } diff --git a/src/game/client/c_baseentity.h b/src/game/client/c_baseentity.h index 64e477210..b305a404e 100644 --- a/src/game/client/c_baseentity.h +++ b/src/game/client/c_baseentity.h @@ -630,7 +630,7 @@ class C_BaseEntity : public IClientEntity // ID Target handling virtual bool IsValidIDTarget( void ) { return false; } - virtual char *GetIDString( void ) { return ""; }; + virtual const char *GetIDString( void ) { return ""; }; // See CSoundEmitterSystem void EmitSound( const char *soundname, float soundtime = 0.0f, float *duration = NULL ); // Override for doing the general case of CPASAttenuationFilter( this ), and EmitSound( filter, entindex(), etc. ); @@ -899,7 +899,7 @@ class C_BaseEntity : public IClientEntity virtual char const * DamageDecal( int bitsDamageType, int gameMaterial ); virtual void DecalTrace( trace_t *pTrace, char const *decalName ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool ShouldPredict( void ) { return false; }; // interface function pointers @@ -1255,7 +1255,7 @@ class C_BaseEntity : public IClientEntity #ifdef _DEBUG void FunctionCheck( void *pFunction, const char *name ); - ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name ) { //COMPILE_TIME_ASSERT( sizeof(func) == 4 ); m_pfnTouch = func; diff --git a/src/game/client/c_baseflex.cpp b/src/game/client/c_baseflex.cpp index cb7c2791b..7376beb0d 100644 --- a/src/game/client/c_baseflex.cpp +++ b/src/game/client/c_baseflex.cpp @@ -1384,7 +1384,7 @@ int C_BaseFlex::g_numflexcontrollers; char * C_BaseFlex::g_flexcontroller[MAXSTUDIOFLEXCTRL*4]; float C_BaseFlex::s_pGlobalFlexWeight[MAXSTUDIOFLEXCTRL*4]; -int C_BaseFlex::AddGlobalFlexController( char *szName ) +int C_BaseFlex::AddGlobalFlexController( const char *szName ) { int i; for (i = 0; i < g_numflexcontrollers; i++) @@ -1677,15 +1677,15 @@ bool C_BaseFlex::CheckSceneEventCompletion( CSceneEventInfo *info, float current return true; } -void C_BaseFlex::SetFlexWeight( LocalFlexController_t index, float value ) +void C_BaseFlex::SetFlexWeight( LocalFlexController_t iIndex, float value ) { - if (index >= 0 && index < GetNumFlexControllers()) + if (iIndex >= 0 && iIndex < GetNumFlexControllers()) { CStudioHdr *pstudiohdr = GetModelPtr( ); if (! pstudiohdr) return; - mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index ); + mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( iIndex ); if (pflexcontroller->max != pflexcontroller->min) { @@ -1694,26 +1694,26 @@ void C_BaseFlex::SetFlexWeight( LocalFlexController_t index, float value ) } Assert( IsFinite( value ) ); - m_flexWeight[ index ] = value; + m_flexWeight[ iIndex ] = value; } } -float C_BaseFlex::GetFlexWeight( LocalFlexController_t index ) +float C_BaseFlex::GetFlexWeight( LocalFlexController_t iIndex ) { - if (index >= 0 && index < GetNumFlexControllers()) + if (iIndex >= 0 && iIndex < GetNumFlexControllers()) { CStudioHdr *pstudiohdr = GetModelPtr( ); if (! pstudiohdr) return 0; - mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( index ); + mstudioflexcontroller_t *pflexcontroller = pstudiohdr->pFlexcontroller( iIndex ); if (pflexcontroller->max != pflexcontroller->min) { - return m_flexWeight[index] * (pflexcontroller->max - pflexcontroller->min) + pflexcontroller->min; + return m_flexWeight[iIndex] * (pflexcontroller->max - pflexcontroller->min) + pflexcontroller->min; } - return m_flexWeight[index]; + return m_flexWeight[iIndex]; } return 0.0; } @@ -1882,8 +1882,8 @@ int C_BaseFlex::FlexControllerLocalToGlobal( const flexsettinghdr_t *pSettinghdr FS_LocalToGlobal_t& result = m_LocalToGlobal[ idx ]; // Validate lookup Assert( result.m_nCount != 0 && key < result.m_nCount ); - int index = result.m_Mapping[ key ]; - return index; + int iIndex = result.m_Mapping[ key ]; + return iIndex; } //----------------------------------------------------------------------------- @@ -1924,11 +1924,11 @@ void C_BaseFlex::AddFlexSetting( float *pGlobalFlexWeight, const char *expr, flo { // Translate to local flex controller // this is translating from the settings's local index to the models local index - int index = FlexControllerLocalToGlobal( pSettinghdr, pWeights->key ); + int iIndex = FlexControllerLocalToGlobal( pSettinghdr, pWeights->key ); // blend scaled weighting in to total float s = clamp( scale * pWeights->influence, 0.0f, 1.0f ); - pGlobalFlexWeight[index] = pGlobalFlexWeight[index] * (1.0f - s) + pWeights->weight * s; + pGlobalFlexWeight[iIndex] = pGlobalFlexWeight[iIndex] * (1.0f - s) + pWeights->weight * s; } } diff --git a/src/game/client/c_baseflex.h b/src/game/client/c_baseflex.h index 4fe3d7dcf..3bc34a577 100644 --- a/src/game/client/c_baseflex.h +++ b/src/game/client/c_baseflex.h @@ -92,7 +92,7 @@ class C_BaseFlex : public C_BaseAnimatingOverlay int m_blinktoggle; - static int AddGlobalFlexController( char *szName ); + static int AddGlobalFlexController( const char *szName ); static char const *GetGlobalFlexControllerName( int idx ); // bah, this should be unified with all prev/current stuff. diff --git a/src/game/client/c_baselesson.cpp b/src/game/client/c_baselesson.cpp index ffeed5dc9..184dc14a3 100644 --- a/src/game/client/c_baselesson.cpp +++ b/src/game/client/c_baselesson.cpp @@ -1695,7 +1695,7 @@ void CScriptedIconLesson::InitElementsFromKeys( CUtlVector< LessonElement_t > *p pchToken = strtok( szSubKeyName, " " ); _fieldtypes paramType = LessonParamTypeFromString( pchToken ); - char *pchParam = ""; + char *pchParam = (char *)""; if ( paramType != FIELD_VOID ) { diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index c76c879a3..c3df28871 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -2071,11 +2071,11 @@ bool C_BasePlayer::Simulate() // Purpose: // Output : CBaseViewModel //----------------------------------------------------------------------------- -C_BaseViewModel *C_BasePlayer::GetViewModel( int index /*= 0*/ ) +C_BaseViewModel *C_BasePlayer::GetViewModel( int iIndex /*= 0*/ ) { - Assert( index >= 0 && index < MAX_VIEWMODELS ); + Assert( iIndex >= 0 && iIndex < MAX_VIEWMODELS ); - C_BaseViewModel *vm = m_hViewModel[ index ]; + C_BaseViewModel *vm = m_hViewModel[ iIndex ]; if ( GetObserverMode() == OBS_MODE_IN_EYE ) { @@ -2084,7 +2084,7 @@ C_BaseViewModel *C_BasePlayer::GetViewModel( int index /*= 0*/ ) // get the targets viewmodel unless the target is an observer itself if ( target && target != this && !target->IsObserver() ) { - vm = target->GetViewModel( index ); + vm = target->GetViewModel( iIndex ); } } @@ -2170,7 +2170,7 @@ void C_BasePlayer::PlayPlayerJingle() } // Stuff for prediction -void C_BasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeat) +void C_BasePlayer::SetSuitUpdate(const char *name, int fgroup, int iNoRepeat) { // FIXME: Do something here? } @@ -2493,7 +2493,7 @@ void C_BasePlayer::RecvProxy_NonLocalCellOriginXY( const CRecvProxyData *pData, player->m_vecCellOrigin.x = pData->m_Value.m_Vector[0]; player->m_vecCellOrigin.y = pData->m_Value.m_Vector[1]; - register int const cellwidth = player->m_cellwidth; // Load it into a register + int const cellwidth = player->m_cellwidth; // Load it into a register ((float*)pOut)[0] = CoordFromCell( cellwidth, player->m_cellX, pData->m_Value.m_Vector[0] ); ((float*)pOut)[1] = CoordFromCell( cellwidth, player->m_cellY, pData->m_Value.m_Vector[1] ); } @@ -2504,7 +2504,7 @@ void C_BasePlayer::RecvProxy_NonLocalCellOriginZ( const CRecvProxyData *pData, v player->m_vecCellOrigin.z = pData->m_Value.m_Float; - register int const cellwidth = player->m_cellwidth; // Load it into a register + int const cellwidth = player->m_cellwidth; // Load it into a register *((float*)pOut) = CoordFromCell( cellwidth, player->m_cellZ, pData->m_Value.m_Float ); } diff --git a/src/game/client/c_baseplayer.h b/src/game/client/c_baseplayer.h index 3d4cec161..1208edb23 100644 --- a/src/game/client/c_baseplayer.h +++ b/src/game/client/c_baseplayer.h @@ -126,7 +126,7 @@ class C_BasePlayer : public C_BaseCombatCharacter virtual void Weapon_DropPrimary( void ) {} virtual Vector GetAutoaimVector( float flScale ); - void SetSuitUpdate(char *name, int fgroup, int iNoRepeat); + void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat); // Input handling virtual bool CreateMove( float flInputSampleTime, CUserCmd *pCmd ); diff --git a/src/game/client/c_effects.cpp b/src/game/client/c_effects.cpp index c5a10491f..0f32b4f6a 100644 --- a/src/game/client/c_effects.cpp +++ b/src/game/client/c_effects.cpp @@ -986,7 +986,7 @@ void CClient_Precipitation::CreateParticlePrecip( void ) { FOR_EACH_VALID_SPLITSCREEN_PLAYER( hh ) { - if ( m_pParticlePrecipOuter[hh] != NULL ) + if ( m_pParticlePrecipOuter[hh].IsValid() ) { DestroyInnerParticlePrecip( hh ); DestroyOuterParticlePrecip( hh ); @@ -1106,7 +1106,7 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl //debugoverlay->AddBoxOverlay(vOffsetPosFar, Vector( -5, -5, -5 ), Vector( 5, 5, 5 ), QAngle( 0, 0, 0 ), 0, 0, 255, 32, 0.2f ); // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipInnerNear[nSlot] != NULL && m_pParticlePrecipInnerFar[nSlot] != NULL && m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() && m_pParticlePrecipInnerFar[nSlot].IsValid() && m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipInnerNear[nSlot]->SetControlPoint( 1, vOffsetPosNear ); @@ -1124,12 +1124,12 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl if ( !bInside && SubFloat( FindLowestSIMD3( Result.HitDistance ), 0 ) >= m_flParticleInnerDist ) { // Kill the inner rain if it's previously been in use - if ( m_pParticlePrecipInnerNear[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() ) { DestroyInnerParticlePrecip( nSlot ); } // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipOuter[nSlot]->SetControlPoint( 3, vDensity ); @@ -1142,7 +1142,7 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl else //We're close enough to use the near effect. { // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipInnerNear[nSlot] != NULL && m_pParticlePrecipInnerFar[nSlot] != NULL && m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() && m_pParticlePrecipInnerFar[nSlot].IsValid() && m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipInnerNear[nSlot]->SetControlPoint( 1, vOffsetPosNear ); @@ -1274,12 +1274,12 @@ void CClient_Precipitation::InitializeParticlePrecip( void ) void CClient_Precipitation::DestroyInnerParticlePrecip( int nSlot ) { - if ( m_pParticlePrecipInnerFar[nSlot] != NULL ) + if ( m_pParticlePrecipInnerFar[nSlot].IsValid() ) { m_pParticlePrecipInnerFar[nSlot]->StopEmission(); m_pParticlePrecipInnerFar[nSlot] = NULL; } - if ( m_pParticlePrecipInnerNear[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() ) { m_pParticlePrecipInnerNear[nSlot]->StopEmission(); m_pParticlePrecipInnerNear[nSlot] = NULL; @@ -1288,7 +1288,7 @@ void CClient_Precipitation::DestroyInnerParticlePrecip( int nSlot ) void CClient_Precipitation::DestroyOuterParticlePrecip( int nSlot ) { - if ( m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->StopEmission(); m_pParticlePrecipOuter[nSlot] = NULL; @@ -2020,7 +2020,7 @@ class CSnowFallManager : public C_BaseEntity void CreateSnowFallParticle( const Vector &vecParticleSpawn, int iBBox, C_BasePlayer *pLocalPlayer ); int StandingInSnowVolume( Vector &vecPoint ); - void FindSnowVolumes( Vector &vecCenter, float flRadius, Vector &vecEyePos, Vector &vecForward ); + void FindSnowVolumes( Vector &vecCenter, float flRadius, const Vector &vecEyePos, Vector &vecForward ); void UpdateBounds( const Vector &vecSnowMin, const Vector &vecSnowMax ); @@ -2225,7 +2225,7 @@ int CSnowFallManager::StandingInSnowVolume( Vector &vecPoint ) // Input : &vecCenter - // flRadius - //----------------------------------------------------------------------------- -void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, Vector &vecEyePos, Vector &vecForward ) +void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, const Vector &vecEyePos, Vector &vecForward ) { // Reset. m_nActiveSnowCount = 0; @@ -2280,11 +2280,11 @@ void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, Vecto { for ( iSnow = 0; iSnow < m_nActiveSnowCount; ++iSnow ) { - Vector vecCenter, vecMin, vecMax; - vecCenter = ( m_aSnow[iSnow].m_vecMin, m_aSnow[iSnow].m_vecMax ) * 0.5; - vecMin = m_aSnow[iSnow].m_vecMin - vecCenter; - vecMax = m_aSnow[iSnow].m_vecMax - vecCenter; - debugoverlay->AddBoxOverlay( vecCenter, vecMin, vecMax, QAngle( 0, 0, 0 ), 200, 0, 0, 25, r_SnowDebugBox.GetFloat() ); + Vector vecCenter2, vecMin, vecMax; + vecCenter2 = ( m_aSnow[iSnow].m_vecMin, m_aSnow[iSnow].m_vecMax ) * 0.5; + vecMin = m_aSnow[iSnow].m_vecMin - vecCenter2; + vecMax = m_aSnow[iSnow].m_vecMax - vecCenter2; + debugoverlay->AddBoxOverlay( vecCenter2, vecMin, vecMax, QAngle( 0, 0, 0 ), 200, 0, 0, 25, r_SnowDebugBox.GetFloat() ); } } #endif diff --git a/src/game/client/c_effects.h b/src/game/client/c_effects.h index 9c42d7023..7a35dd680 100644 --- a/src/game/client/c_effects.h +++ b/src/game/client/c_effects.h @@ -192,9 +192,9 @@ class CClient_Precipitation : public C_BaseEntity AshSplit_t m_Ash[ MAX_SPLITSCREEN_PLAYERS ]; float m_flParticleInnerDist; //The distance at which to start drawing the inner system - char *m_pParticleInnerNearDef; //Name of the first inner system - char *m_pParticleInnerFarDef; //Name of the second inner system - char *m_pParticleOuterDef; //Name of the outer system + const char *m_pParticleInnerNearDef; //Name of the first inner system + const char *m_pParticleInnerFarDef; //Name of the second inner system + const char *m_pParticleOuterDef; //Name of the outer system HPARTICLEFFECT m_pParticlePrecipInnerNear[ MAX_SPLITSCREEN_PLAYERS ]; HPARTICLEFFECT m_pParticlePrecipInnerFar[ MAX_SPLITSCREEN_PLAYERS ]; HPARTICLEFFECT m_pParticlePrecipOuter[ MAX_SPLITSCREEN_PLAYERS ]; diff --git a/src/game/client/c_entitydissolve.cpp b/src/game/client/c_entitydissolve.cpp index 3e4d2b3cc..14ce32561 100644 --- a/src/game/client/c_entitydissolve.cpp +++ b/src/game/client/c_entitydissolve.cpp @@ -235,11 +235,11 @@ void C_EntityDissolve::BuildTeslaEffect( mstudiobbox_t *pHitBox, const matrix3x4 // Move it towards the camera Vector vecFlash = tr.endpos; - Vector vecForward; - AngleVectors( MainViewAngles(nSlot), &vecForward ); - vecFlash -= (vecForward * 8); + Vector vecFwd; + AngleVectors( MainViewAngles(nSlot), &vecFwd ); + vecFlash -= (vecFwd * 8); - g_pEffects->EnergySplash( vecFlash, -vecForward, false ); + g_pEffects->EnergySplash( vecFlash, -vecFwd, false ); // End glow CSmartPtr pSimple = CSimpleEmitter::Create( "dust" ); diff --git a/src/game/client/c_func_smokevolume.cpp b/src/game/client/c_func_smokevolume.cpp index de15f1a51..67b516e22 100644 --- a/src/game/client/c_func_smokevolume.cpp +++ b/src/game/client/c_func_smokevolume.cpp @@ -95,14 +95,14 @@ class C_FuncSmokeVolume : public C_BaseParticleEntity, public IPrototypeAppEffec return &m_pSmokeParticleInfos[GetSmokeParticleIndex(x,y,z)]; } - inline void GetParticleInfoXYZ(int index, int &x, int &y, int &z) + inline void GetParticleInfoXYZ(int iIndex, int &x, int &y, int &z) { - Assert( index >= 0 && index < m_xCount * m_yCount * m_zCount ); - z = index / (m_xCount*m_yCount); + Assert( iIndex >= 0 && iIndex < m_xCount * m_yCount * m_zCount ); + z = iIndex / (m_xCount*m_yCount); int zIndex = z*m_xCount*m_yCount; - y = (index - zIndex) / m_xCount; + y = (iIndex - zIndex) / m_xCount; int yIndex = y*m_xCount; - x = index - zIndex - yIndex; + x = iIndex - zIndex - yIndex; Assert( IsValidXYZCoords( x, y, z ) ); } @@ -119,10 +119,10 @@ class C_FuncSmokeVolume : public C_BaseParticleEntity, public IPrototypeAppEffec z * m_SpacingRadius * 2 + m_SpacingRadius ); } - inline Vector GetSmokeParticlePosIndex(int index) + inline Vector GetSmokeParticlePosIndex(int iIndex) { int x, y, z; - GetParticleInfoXYZ(index, x, y, z); + GetParticleInfoXYZ(iIndex, x, y, z); return GetSmokeParticlePos(x, y, z); } @@ -601,8 +601,8 @@ void C_FuncSmokeVolume::FillVolume() #ifdef _DEBUG int testX, testY, testZ; - int index = GetSmokeParticleIndex(x,y,z); - GetParticleInfoXYZ(index, testX, testY, testZ); + int iIndex = GetSmokeParticleIndex(x,y,z); + GetParticleInfoXYZ(iIndex, testX, testY, testZ); assert(testX == x && testY == y && testZ == z); #endif diff --git a/src/game/client/c_particle_smokegrenade.cpp b/src/game/client/c_particle_smokegrenade.cpp index 0e5ead326..698dc6107 100644 --- a/src/game/client/c_particle_smokegrenade.cpp +++ b/src/game/client/c_particle_smokegrenade.cpp @@ -123,13 +123,13 @@ class C_ParticleSmokeGrenade : public C_BaseParticleEntity, public IPrototypeApp inline int GetSmokeParticleIndex(int x, int y, int z) {return z*m_xCount*m_yCount+y*m_yCount+x;} inline SmokeParticleInfo* GetSmokeParticleInfo(int x, int y, int z) {return &m_SmokeParticleInfos[GetSmokeParticleIndex(x,y,z)];} - inline void GetParticleInfoXYZ(int index, int &x, int &y, int &z) + inline void GetParticleInfoXYZ(int iIndex, int &x, int &y, int &z) { - z = index / (m_xCount*m_yCount); + z = iIndex / (m_xCount*m_yCount); int zIndex = z*m_xCount*m_yCount; - y = (index - zIndex) / m_yCount; + y = (iIndex - zIndex) / m_yCount; int yIndex = y*m_yCount; - x = index - zIndex - yIndex; + x = iIndex - zIndex - yIndex; } inline bool IsValidXYZCoords(int x, int y, int z) @@ -145,10 +145,10 @@ class C_ParticleSmokeGrenade : public C_BaseParticleEntity, public IPrototypeApp ((float)z / (m_zCount-1)) * m_SpacingRadius * 2 - m_SpacingRadius); } - inline Vector GetSmokeParticlePosIndex(int index) + inline Vector GetSmokeParticlePosIndex(int iIndex) { int x, y, z; - GetParticleInfoXYZ(index, x, y, z); + GetParticleInfoXYZ(iIndex, x, y, z); return GetSmokeParticlePos(x, y, z); } @@ -841,8 +841,8 @@ void C_ParticleSmokeGrenade::FillVolume() #ifdef _DEBUG int testX, testY, testZ; - int index = GetSmokeParticleIndex(x,y,z); - GetParticleInfoXYZ(index, testX, testY, testZ); + int iIndex = GetSmokeParticleIndex(x,y,z); + GetParticleInfoXYZ(iIndex, testX, testY, testZ); assert(testX == x && testY == y && testZ == z); #endif diff --git a/src/game/client/c_plasma.cpp b/src/game/client/c_plasma.cpp index 75223420c..d60122259 100644 --- a/src/game/client/c_plasma.cpp +++ b/src/game/client/c_plasma.cpp @@ -475,10 +475,10 @@ void C_Plasma::Update( void ) C_BaseEntity *ent = cl_entitylist->GetEnt( 0 ); if ( ent ) { - int index = decalsystem->GetDecalIndexForName( "PlasmaGlowFade" ); - if ( index >= 0 ) + int iIndex = decalsystem->GetDecalIndexForName( "PlasmaGlowFade" ); + if ( iIndex >= 0 ) { - effects->DecalShoot( index, 0, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), GetAbsOrigin(), 0, 0 ); + effects->DecalShoot( iIndex, 0, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), GetAbsOrigin(), 0, 0 ); } } } diff --git a/src/game/client/c_playerresource.cpp b/src/game/client/c_playerresource.cpp index 412e67e66..700c51402 100644 --- a/src/game/client/c_playerresource.cpp +++ b/src/game/client/c_playerresource.cpp @@ -282,9 +282,9 @@ int C_PlayerResource::GetTeam(int iIndex ) } } -const char * C_PlayerResource::GetTeamName(int index) +const char * C_PlayerResource::GetTeamName(int iIndex) { - C_Team *team = GetGlobalTeam( index ); + C_Team *team = GetGlobalTeam( iIndex ); if ( !team ) return "Unknown"; @@ -292,9 +292,9 @@ const char * C_PlayerResource::GetTeamName(int index) return team->Get_Name(); } -int C_PlayerResource::GetTeamScore(int index) +int C_PlayerResource::GetTeamScore(int iIndex) { - C_Team *team = GetGlobalTeam( index ); + C_Team *team = GetGlobalTeam( iIndex ); if ( !team ) return 0; @@ -302,30 +302,30 @@ int C_PlayerResource::GetTeamScore(int index) return team->Get_Score(); } -int C_PlayerResource::GetFrags(int index ) +int C_PlayerResource::GetFrags(int iIndex ) { return 666; } -bool C_PlayerResource::IsLocalPlayer(int index) +bool C_PlayerResource::IsLocalPlayer(int iIndex) { C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer(); if ( !pPlayer ) return false; - return ( index == pPlayer->entindex() ); + return ( iIndex == pPlayer->entindex() ); } -bool C_PlayerResource::IsHLTV(int index) +bool C_PlayerResource::IsHLTV(int iIndex) { - if ( !IsConnected( index ) ) + if ( !IsConnected( iIndex ) ) return false; player_info_t sPlayerInfo; - if ( engine->GetPlayerInfo( index, &sPlayerInfo ) ) + if ( engine->GetPlayerInfo( iIndex, &sPlayerInfo ) ) { return sPlayerInfo.ishltv; } @@ -333,14 +333,14 @@ bool C_PlayerResource::IsHLTV(int index) return false; } -bool C_PlayerResource::IsReplay(int index) +bool C_PlayerResource::IsReplay(int iIndex) { - if ( !IsConnected( index ) ) + if ( !IsConnected( iIndex ) ) return false; player_info_t sPlayerInfo; - if ( engine->GetPlayerInfo( index, &sPlayerInfo ) ) + if ( engine->GetPlayerInfo( iIndex, &sPlayerInfo ) ) { return sPlayerInfo.isreplay; } @@ -421,9 +421,9 @@ int C_PlayerResource::GetHealth( int iIndex ) return m_iHealth[iIndex]; } -const Color &C_PlayerResource::GetTeamColor(int index ) +const Color &C_PlayerResource::GetTeamColor(int iIndex ) { - if ( index < 0 || index >= MAX_TEAMS ) + if ( iIndex < 0 || iIndex >= MAX_TEAMS ) { Assert( false ); static Color blah; @@ -431,7 +431,7 @@ const Color &C_PlayerResource::GetTeamColor(int index ) } else { - return m_Colors[index]; + return m_Colors[iIndex]; } } diff --git a/src/game/client/c_smokestack.cpp b/src/game/client/c_smokestack.cpp index 5e8370b0f..88545b5fa 100644 --- a/src/game/client/c_smokestack.cpp +++ b/src/game/client/c_smokestack.cpp @@ -363,7 +363,7 @@ void C_SmokeStack::Update(float fTimeDelta) // Setup the twist matrix. float flTwist = (m_flTwist * (M_PI_F * 2.f) / 360.0f) * Helper_GetFrameTime(); - if( m_bTwist = !!flTwist ) + if( ( m_bTwist = !!flTwist ) ) { m_TwistMat[0][0] = cos(flTwist); m_TwistMat[0][1] = sin(flTwist); diff --git a/src/game/client/c_soundscape.cpp b/src/game/client/c_soundscape.cpp index 67c7b5232..0802ec513 100644 --- a/src/game/client/c_soundscape.cpp +++ b/src/game/client/c_soundscape.cpp @@ -1189,7 +1189,7 @@ void C_SoundscapeSystem::ProcessPlayRandom( KeyValues *pPlayRandom, const subsou { interval_t atten = ReadInterval( pKey->GetString() ); sound.soundlevel.start = ATTN_TO_SNDLVL( atten.start ); - sound.soundlevel.range = ATTN_TO_SNDLVL( atten.start + atten.range ) - sound.soundlevel.start; + sound.soundlevel.range = (float)ATTN_TO_SNDLVL( atten.start + atten.range ) - sound.soundlevel.start; } else if ( !Q_strcasecmp( pKey->GetName(), "soundlevel" ) ) { diff --git a/src/game/client/c_spatialentity.h b/src/game/client/c_spatialentity.h index 1657d56b0..a54220045 100644 --- a/src/game/client/c_spatialentity.h +++ b/src/game/client/c_spatialentity.h @@ -133,7 +133,7 @@ template float C_SpatialEntityTemplate::m_ForcedInfluence; template <> -void C_SpatialEntityTemplate::ResetAccumulation( void ) +inline void C_SpatialEntityTemplate::ResetAccumulation( void ) { m_AccumulatedValue.Init(); m_ForcedValue.Init(); diff --git a/src/game/client/c_te.cpp b/src/game/client/c_te.cpp index c07438c73..b6c4a3feb 100644 --- a/src/game/client/c_te.cpp +++ b/src/game/client/c_te.cpp @@ -499,11 +499,11 @@ class C_TempEntsSystem : public ITempEntsSystem } } virtual void PhysicsProp( IRecipientFilter& filter, float delay, int modelindex, int skin, - const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int effects ) + const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int nEffects ) { if ( !SuppressTE( filter ) ) { - TE_PhysicsProp( filter, delay, modelindex, skin, pos, angles, vel, flags, effects ); + TE_PhysicsProp( filter, delay, modelindex, skin, pos, angles, vel, flags, nEffects ); } } virtual void ClientProjectile( IRecipientFilter& filter, float delay, diff --git a/src/game/client/c_te_legacytempents.cpp b/src/game/client/c_te_legacytempents.cpp index dc8c6d015..d6c1e1ee3 100644 --- a/src/game/client/c_te_legacytempents.cpp +++ b/src/game/client/c_te_legacytempents.cpp @@ -145,7 +145,7 @@ void C_LocalTempEntity::SetAcceleration( const Vector &vecVelocity ) // Purpose: // Output : int //----------------------------------------------------------------------------- -int C_LocalTempEntity::DrawStudioModel( int flags ) +int C_LocalTempEntity::DrawStudioModel( int nFlags ) { VPROF_BUDGET( "C_LocalTempEntity::DrawStudioModel", VPROF_BUDGETGROUP_MODEL_RENDERING ); int drawn = 0; @@ -160,12 +160,12 @@ int C_LocalTempEntity::DrawStudioModel( int flags ) if ( m_pfnDrawHelper ) { - drawn = ( *m_pfnDrawHelper )( this, flags ); + drawn = ( *m_pfnDrawHelper )( this, nFlags ); } else { drawn = modelrender->DrawModel( - flags, + nFlags, this, MODEL_INSTANCE_INVALID, index, @@ -183,7 +183,7 @@ int C_LocalTempEntity::DrawStudioModel( int flags ) // Purpose: // Input : flags - //----------------------------------------------------------------------------- -int C_LocalTempEntity::DrawModel( int flags, const RenderableInstance_t &instance ) +int C_LocalTempEntity::DrawModel( int nFlags, const RenderableInstance_t &instance ) { int drawn = 0; @@ -228,7 +228,7 @@ int C_LocalTempEntity::DrawModel( int flags, const RenderableInstance_t &instanc ); break; case mod_studio: - drawn = DrawStudioModel( flags ); + drawn = DrawStudioModel( nFlags ); break; default: break; @@ -1079,7 +1079,7 @@ void CTempEnts::BreakModel( const Vector &pos, const QAngle &angles, const Vecto } } -void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int effects ) +void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int nEffects ) { C_PhysPropClientside *pEntity = C_PhysPropClientside::CreateNew(); @@ -1099,7 +1099,7 @@ void CTempEnts::PhysicsProp( int modelindex, int skin, const Vector& pos, const pEntity->SetAbsOrigin( pos ); pEntity->SetAbsAngles( angles ); pEntity->SetPhysicsMode( PHYSICS_MULTIPLAYER_CLIENTSIDE ); - pEntity->SetEffects( effects ); + pEntity->SetEffects( nEffects ); if ( flags & 1 ) { diff --git a/src/game/client/c_te_physicsprop.cpp b/src/game/client/c_te_physicsprop.cpp index 9c018e50d..7a2be37f0 100644 --- a/src/game/client/c_te_physicsprop.cpp +++ b/src/game/client/c_te_physicsprop.cpp @@ -123,10 +123,10 @@ static inline void RecordPhysicsProp( const Vector& start, const QAngle &angles, // Purpose: //----------------------------------------------------------------------------- void TE_PhysicsProp( IRecipientFilter& filter, float delay, - int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int effects ) + int modelindex, int skin, const Vector& pos, const QAngle &angles, const Vector& vel, int flags, int nEffects ) { - tempents->PhysicsProp( modelindex, skin, pos, angles, vel, flags, effects ); - RecordPhysicsProp( pos, angles, vel, modelindex, flags, skin, effects ); + tempents->PhysicsProp( modelindex, skin, pos, angles, vel, flags, nEffects ); + RecordPhysicsProp( pos, angles, vel, modelindex, flags, skin, nEffects ); } //----------------------------------------------------------------------------- diff --git a/src/game/client/c_testtraceline.cpp b/src/game/client/c_testtraceline.cpp index 550a22eca..47154f625 100644 --- a/src/game/client/c_testtraceline.cpp +++ b/src/game/client/c_testtraceline.cpp @@ -70,13 +70,13 @@ void C_TestTraceline::DrawCube( Vector& center, unsigned char* pColor ) Vector facePoints[8]; Vector bmins, bmaxs; - bmins[0] = center[0] - CUBE_SIZE; - bmins[1] = center[1] - CUBE_SIZE; - bmins[2] = center[2] - CUBE_SIZE; + bmins[0] = center[0] - (float)CUBE_SIZE; + bmins[1] = center[1] - (float)CUBE_SIZE; + bmins[2] = center[2] - (float)CUBE_SIZE; - bmaxs[0] = center[0] + CUBE_SIZE; - bmaxs[1] = center[1] + CUBE_SIZE; - bmaxs[2] = center[2] + CUBE_SIZE; + bmaxs[0] = center[0] + (float)CUBE_SIZE; + bmaxs[1] = center[1] + (float)CUBE_SIZE; + bmaxs[2] = center[2] + (float)CUBE_SIZE; facePoints[0][0] = bmins[0]; facePoints[0][1] = bmins[1]; diff --git a/src/game/client/c_tracer.cpp b/src/game/client/c_tracer.cpp index 772c84a40..225e4a13a 100644 --- a/src/game/client/c_tracer.cpp +++ b/src/game/client/c_tracer.cpp @@ -89,7 +89,7 @@ bool Tracer_ComputeVerts( const Vector &start, const Vector &delta, float width, } -void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, float width, float* color, float startV, float endV ) +void Tracer_Draw( CMeshBuilder *pMeshBuilder, const Vector& start, const Vector& delta, float width, float* color, float startV, float endV ) { // Clip the tracer Vector verts[4]; @@ -143,7 +143,7 @@ void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, floa //----------------------------------------------------------------------------- // draw a tracer. //----------------------------------------------------------------------------- -void Tracer_Draw( ParticleDraw* pDraw, Vector& start, Vector& delta, float width, float* color, float startV, float endV ) +void Tracer_Draw( ParticleDraw* pDraw, const Vector& start, const Vector& delta, float width, float* color, float startV, float endV ) { if( !pDraw->GetMeshBuilder() ) return; diff --git a/src/game/client/c_tracer.h b/src/game/client/c_tracer.h index 48deb6b5f..80eeba1ec 100644 --- a/src/game/client/c_tracer.h +++ b/src/game/client/c_tracer.h @@ -23,10 +23,10 @@ class CMeshBuilder; // [in] float : The tracer width (CAMERA space) // [in] float* : r, g, b, a (0 - 1) //----------------------------------------------------------------------------- -void Tracer_Draw( ParticleDraw* pDraw, Vector& start, Vector& delta, +void Tracer_Draw( ParticleDraw* pDraw, const Vector& start, const Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); -void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); +void Tracer_Draw( CMeshBuilder *pMeshBuilder, const Vector& start, const Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); //----------------------------------------------------------------------------- diff --git a/src/game/client/cdll_client_int.h b/src/game/client/cdll_client_int.h index eae300bbc..991e96237 100644 --- a/src/game/client/cdll_client_int.h +++ b/src/game/client/cdll_client_int.h @@ -56,10 +56,10 @@ class IAvi; class IBik; class IReplayHistoryManager; class ISoundEmitterSystemBase; -enum CPULevel_t; -enum GPULevel_t; -enum MemLevel_t; -enum GPUMemLevel_t; +enum CPULevel_t : int; +enum GPULevel_t : int; +enum MemLevel_t : int; +enum GPUMemLevel_t : int; extern IVModelRender *modelrender; extern IVEngineClient *engine; diff --git a/src/game/client/cdll_util.cpp b/src/game/client/cdll_util.cpp index b42b26ba3..7893a5b5c 100644 --- a/src/game/client/cdll_util.cpp +++ b/src/game/client/cdll_util.cpp @@ -348,7 +348,7 @@ void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, i // Input : // Output : //------------------------------------------------------------------------------ -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { C_BaseEntity *pEntity = pTrace->m_pEnt; diff --git a/src/game/client/cdll_util.h b/src/game/client/cdll_util.h index d67b53a40..cf22083bf 100644 --- a/src/game/client/cdll_util.h +++ b/src/game/client/cdll_util.h @@ -60,7 +60,7 @@ int UTIL_ComputeStringWidth( vgui::HFont& font, const wchar_t *str ); float UTIL_AngleDiff( float destAngle, float srcAngle ); void UTIL_Bubbles( const Vector& mins, const Vector& maxs, int count ); void UTIL_Smoke( const Vector &origin, const float scale, const float framerate ); -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); int UTIL_PrecacheDecal( const char *name, bool preload = false ); void UTIL_EmitAmbientSound( C_BaseEntity *entity, const Vector &vecOrigin, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch ); void UTIL_SetOrigin( C_BaseEntity *entity, const Vector &vecOrigin ); diff --git a/src/game/client/clientmode_shared.cpp b/src/game/client/clientmode_shared.cpp index e563c3172..ecb5a61ab 100644 --- a/src/game/client/clientmode_shared.cpp +++ b/src/game/client/clientmode_shared.cpp @@ -1124,7 +1124,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) } } - if ( team == 0 && GetLocalTeam() > 0 ) + if ( team == 0 && GetLocalTeam() != NULL ) { bValidTeam = false; } diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 31134b7e4..26c17e50b 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -290,12 +290,12 @@ void CTextureAllocator::InitRenderTargets( void ) { #if !defined( _X360 ) // don't need depth buffer for shadows - m_TexturePage.InitRenderTarget( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, "_rt_Shadows" ); + m_TexturePage.InitRenderTarget( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, (char *)"_rt_Shadows" ); #else // unfortunate explicit management required for this render target // 32bpp edram is only largest shadow fragment, but resolved to actual shadow atlas // because full-res 1024x1024 shadow buffer is too large for EDRAM - m_TexturePage.InitRenderTargetTexture( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, "_rt_Shadows" ); + m_TexturePage.InitRenderTargetTexture( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, (char *)"_rt_Shadows" ); #ifdef RTT_TEXTURE_SIZE_640 // use 4x multisampling for smoother shadows @@ -1055,7 +1055,7 @@ class CClientShadowMgr : public IClientShadowMgr // Initialize, shutdown render-to-texture shadows void InitDepthTextureShadows(); void ShutdownDepthTextureShadows(); - friend static void RDMaxDepthTextureShadowsChanged( IConVar *, const char *, float ); + friend void RDMaxDepthTextureShadowsChanged( IConVar *, const char *, float ); // Initialize, shutdown render-to-texture shadows void InitRenderToTextureShadows(); @@ -1173,7 +1173,7 @@ class CClientShadowMgr : public IClientShadowMgr static CClientShadowMgr s_ClientShadowMgr; IClientShadowMgr* g_pClientShadowMgr = &s_ClientShadowMgr; -static void RDMaxDepthTextureShadowsChanged( IConVar *var, const char *pOldValue, float flOldValue ) +void RDMaxDepthTextureShadowsChanged( IConVar *var, const char *pOldValue, float flOldValue ) { const char *pNewValue = ConVarRef{ var }.GetString(); DevMsg( "RE-INITIALIZING SHADOW DEPTH TEXTURES! (%s changed from %s to %s)\n", var->GetName(), pOldValue, pNewValue ); @@ -1667,10 +1667,10 @@ void CClientShadowMgr::InitDepthTextureShadows() #if defined( _X360 ) // For the 360, we'll be rendering depth directly into the dummy depth and Resolve()ing to the depth texture. // only need the dummy surface, don't care about color results - m_DummyColorTexture.InitRenderTargetTexture( 1, 1, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, "_rt_ShadowDummy" ); + m_DummyColorTexture.InitRenderTargetTexture( 1, 1, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, (char *)"_rt_ShadowDummy" ); m_DummyColorTexture.InitRenderTargetSurface( m_nDepthTextureResolution, m_nDepthTextureResolution, IMAGE_FORMAT_BGR565, false ); #else - m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" ); + m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, (char *)"_rt_ShadowDummy" ); #endif // Create some number of depth-stencil textures @@ -2420,7 +2420,7 @@ ClientShadowHandle_t CClientShadowMgr::CreateFlashlight( const FlashlightState_t // We don't really need a model entity handle for a projective light source, so use an invalid one. static ClientEntityHandle_t invalidHandle = INVALID_CLIENTENTITY_HANDLE; - int shadowFlags = SHADOW_FLAGS_FLASHLIGHT | SHADOW_FLAGS_LIGHT_WORLD; + int shadowFlags = ( int )SHADOW_FLAGS_FLASHLIGHT | ( int )SHADOW_FLAGS_LIGHT_WORLD; if( lightState.m_bEnableShadows && r_flashlightdepthtexture.GetBool() ) { shadowFlags |= SHADOW_FLAGS_USE_DEPTH_TEXTURE; @@ -2437,7 +2437,7 @@ ClientShadowHandle_t CClientShadowMgr::CreateShadow( ClientEntityHandle_t entity { // We don't really need a model entity handle for a projective light source, so use an invalid one. flags &= ~SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK; - flags |= SHADOW_FLAGS_SHADOW | SHADOW_FLAGS_TEXTURE_DIRTY; + flags |= ( int )SHADOW_FLAGS_SHADOW | ( int )SHADOW_FLAGS_TEXTURE_DIRTY; ClientShadowHandle_t shadowHandle = CreateProjectedTexture( entity, nEntIndex, flags, pSplitScreenBits ); IClientRenderable *pRenderable = ClientEntityList().GetClientRenderableFromHandle( entity ); @@ -4695,9 +4695,9 @@ 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& shadow2 = m_Shadows[handle]; - shadowmgr->EnableShadow( shadow.m_ShadowHandle, true ); + shadowmgr->EnableShadow( shadow2.m_ShadowHandle, true ); // FIXME: What's the difference between brush and model shadows for light projectors? Answer: nothing. UpdateBrushShadow( NULL, handle ); @@ -5762,8 +5762,8 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup ) } // Set depth bias factors specific to this flashlight - CMatRenderContextPtr pRenderContext( materials ); - pRenderContext->SetShadowDepthBiasFactors( flashlightState.m_flShadowSlopeScaleDepthBias, flashlightState.m_flShadowDepthBias ); + CMatRenderContextPtr pRenderCtx( materials ); + pRenderCtx->SetShadowDepthBiasFactors( flashlightState.m_flShadowSlopeScaleDepthBias, flashlightState.m_flShadowDepthBias ); shadowView.m_bRenderFlashlightDepthTranslucents = flashlightState.m_bGlobalLight; @@ -5787,7 +5787,7 @@ static void SetupBonesOnBaseAnimating( C_BaseAnimating *&pBaseAnimating ) } -void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &view, int leafCount, WorldListLeafData_t* pLeafList ) +void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &viewSetup, int leafCount, WorldListLeafData_t* pLeafList ) { ASSERT_LOCAL_PLAYER_RESOLVABLE(); int nSlot = GET_ACTIVE_SPLITSCREEN_SLOT(); @@ -5799,7 +5799,7 @@ void CClientShadowMgr::ComputeShadowTextures( const CViewSetup &view, int leafCo MDLCACHE_CRITICAL_SECTION(); // First grab all shadow textures we may want to render - int nCount = s_VisibleShadowList.FindShadows( &view, leafCount, pLeafList ); + int nCount = s_VisibleShadowList.FindShadows( &viewSetup, leafCount, pLeafList ); if ( nCount == 0 ) return; @@ -6308,7 +6308,7 @@ void CClientShadowMgr::ComputeFalloffInfo( const ClientShadow_t& shadow, Vector* pShadowFalloffParams->z = 1.0f/255.0f * shadow.m_FalloffBias; } -void CClientShadowMgr::DrawDeferredShadows( const CViewSetup &view, int leafCount, WorldListLeafData_t* pLeafList ) +void CClientShadowMgr::DrawDeferredShadows( const CViewSetup &viewSetup, int leafCount, WorldListLeafData_t* pLeafList ) { VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_RENDERING ); diff --git a/src/game/client/clientsideeffects_test.cpp b/src/game/client/clientsideeffects_test.cpp index e615fb14d..009be6537 100644 --- a/src/game/client/clientsideeffects_test.cpp +++ b/src/game/client/clientsideeffects_test.cpp @@ -281,7 +281,7 @@ void FX_TracerSound( const Vector &start, const Vector &end, int iTracerType ) CLocalPlayerFilter filter; enginesound->EmitSound( filter, SOUND_FROM_WORLD, CHAN_STATIC, params.soundname, - params.volume, SNDLVL_TO_ATTN(params.soundlevel), 0, params.pitch, &start, &shotDir, false); + params.volume, SNDLVL_TO_ATTN(params.soundlevel), 0, params.pitch, &start, &shotDir, NULL, false); } // FIXME: This has a bad behavior when both bullet + strider shots are whizzing by at the same time diff --git a/src/game/client/entity_client_tools.cpp b/src/game/client/entity_client_tools.cpp index 80e5dca64..5225655ae 100644 --- a/src/game/client/entity_client_tools.cpp +++ b/src/game/client/entity_client_tools.cpp @@ -887,9 +887,10 @@ void CClientTools::ReloadParticleDefintions( const char *pFileName, const void * ////////////// // Find any systems that depend on any system in the buffer // slow, but necessary if we want live reloads to work - and doesn't happen too often + CUtlBuffer bufConfig( pBufData, nLen, CUtlBuffer::READ_ONLY ); CUtlVector systemNamesToReload; - g_pParticleSystemMgr->GetParticleSystemsInBuffer( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), &systemNamesToReload ); + g_pParticleSystemMgr->GetParticleSystemsInBuffer( bufConfig, &systemNamesToReload ); CUtlVector toReplaceEffects; CUtlVector toReplaceNames; @@ -929,7 +930,8 @@ void CClientTools::ReloadParticleDefintions( const char *pFileName, const void * ////////////// // Load the data and stomp the old definitions - g_pParticleSystemMgr->ReadParticleConfigFile( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), true ); + CUtlBuffer bufLoadConfig( pBufData, nLen, CUtlBuffer::READ_ONLY ); + g_pParticleSystemMgr->ReadParticleConfigFile( bufLoadConfig, true ); ////////////// // Now replace all of the systems with their new versions diff --git a/src/game/client/fx.cpp b/src/game/client/fx.cpp index e69d254b0..cd28918c9 100644 --- a/src/game/client/fx.cpp +++ b/src/game/client/fx.cpp @@ -1078,11 +1078,11 @@ void FX_Tesla( const CTeslaInfo &teslaInfo ) int nSlot = GET_ACTIVE_SPLITSCREEN_SLOT(); // Move it towards the camera Vector vecFlash = tr.endpos; - Vector vecForward; - AngleVectors( MainViewAngles(nSlot), &vecForward ); - vecFlash -= (vecForward * 8); + Vector vecFwd; + AngleVectors( MainViewAngles(nSlot), &vecFwd ); + vecFlash -= (vecFwd * 8); - g_pEffects->EnergySplash( vecFlash, -vecForward, false ); + g_pEffects->EnergySplash( vecFlash, -vecFwd, false ); // End glow CSmartPtr pSimple = CSimpleEmitter::Create( "dust" ); diff --git a/src/game/client/fx.h b/src/game/client/fx.h index 50ec90ccd..5b763ff03 100644 --- a/src/game/client/fx.h +++ b/src/game/client/fx.h @@ -56,7 +56,7 @@ void FX_BugBlood( Vector &pos, Vector &dir, Vector &vWorldMins, Vector &vWorldMa void FX_Blood( Vector &pos, Vector &dir, float r, float g, float b, float a ); void FX_CreateImpactDust( Vector &origin, Vector &normal ); void FX_EnergySplash( const Vector &pos, const Vector &normal, int nFlags = FX_ENERGYSPLASH_DEFAULT ); -void FX_MicroExplosion( Vector &position, Vector &normal ); +void FX_MicroExplosion( const Vector &position, const Vector &normal ); void FX_Explosion( Vector& origin, Vector& normal, char materialType ); void FX_ConcussiveExplosion( Vector& origin, Vector& normal ); void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale ); @@ -84,7 +84,7 @@ class CTeslaInfo Vector m_vPos; QAngle m_vAngles; int m_nEntIndex; - char *m_pszSpriteName; + const char *m_pszSpriteName; float m_flBeamWidth; int m_nBeams; Vector m_vColor; diff --git a/src/game/client/fx_sparks.cpp b/src/game/client/fx_sparks.cpp index 3102606bc..bf33bc8d3 100644 --- a/src/game/client/fx_sparks.cpp +++ b/src/game/client/fx_sparks.cpp @@ -950,7 +950,7 @@ void FX_EnergySplash( const Vector &pos, const Vector &normal, int nFlags ) #define MICRO_EXPLOSION_GRAVITY 0.0f #define MICRO_EXPLOSION_DAMPEN 0.4f -void FX_MicroExplosion( Vector &position, Vector &normal ) +void FX_MicroExplosion( const Vector &position, const Vector &normal ) { VPROF_BUDGET( "FX_MicroExplosion", VPROF_BUDGETGROUP_PARTICLE_RENDERING ); Vector offset = position + ( normal * 2.0f ); diff --git a/src/game/client/game_controls/SpectatorGUI.cpp b/src/game/client/game_controls/SpectatorGUI.cpp index de80a6b29..707ae84f7 100644 --- a/src/game/client/game_controls/SpectatorGUI.cpp +++ b/src/game/client/game_controls/SpectatorGUI.cpp @@ -52,7 +52,7 @@ ConVar spec_scoreboard( "spec_scoreboard", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE CSpectatorGUI *g_pSpectatorGUI = NULL; -static char *s_SpectatorModes[] = { "#Spec_Mode0", "#Spec_Mode1", "#Spec_Mode2", "#Spec_Mode3", "#Spec_Mode4", "#Spec_Mode5", "" }; +static const char *s_SpectatorModes[] = { "#Spec_Mode0", "#Spec_Mode1", "#Spec_Mode2", "#Spec_Mode3", "#Spec_Mode4", "#Spec_Mode5", "" }; using namespace vgui; diff --git a/src/game/client/game_controls/baseviewport.cpp b/src/game/client/game_controls/baseviewport.cpp index 278a0c0f3..0508aadbc 100644 --- a/src/game/client/game_controls/baseviewport.cpp +++ b/src/game/client/game_controls/baseviewport.cpp @@ -856,9 +856,9 @@ void CBaseViewport::LoadHudLayout( void ) { AddSubKeyNamed( pConditions, "if_split_screen_active" ); - ConVarRef ss_verticalsplit( "ss_verticalsplit" ); + ConVarRef ssVerticalSplitRef( "ss_verticalsplit" ); - if ( ss_verticalsplit.IsValid() && ss_verticalsplit.GetBool() ) + if ( ssVerticalSplitRef.IsValid() && ssVerticalSplitRef.GetBool() ) { AddSubKeyNamed( pConditions, "if_split_screen_vertical" ); diff --git a/src/game/client/hud.cpp b/src/game/client/hud.cpp index 317778c5a..221028bbe 100644 --- a/src/game/client/hud.cpp +++ b/src/game/client/hud.cpp @@ -35,7 +35,7 @@ static CClassMemoryPool< CHudTexture > g_HudTextureMemoryPool( 128 ); //----------------------------------------------------------------------------- // Purpose: Parses the weapon txt files to get the sprites needed. //----------------------------------------------------------------------------- -void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, char *szFilenameWithoutExtension, const unsigned char *pICEKey ) +void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, const char *szFilenameWithoutExtension, const unsigned char *pICEKey ) { KeyValues *pTemp, *pTextureSection; diff --git a/src/game/client/hud.h b/src/game/client/hud.h index f70db252f..a6612ccd8 100644 --- a/src/game/client/hud.h +++ b/src/game/client/hud.h @@ -251,7 +251,7 @@ CHudIcons &HudIcons(); //----------------------------------------------------------------------------- extern vgui::HFont g_hFontTrebuchet24; -void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, char *szFilenameWithoutExtension, const unsigned char *pICEKey ); +void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, const char *szFilenameWithoutExtension, const unsigned char *pICEKey ); void GetHudSize( int& w, int &h ); diff --git a/src/game/client/hud_closecaption.cpp b/src/game/client/hud_closecaption.cpp index 07fee7b85..11d06c9d5 100644 --- a/src/game/client/hud_closecaption.cpp +++ b/src/game/client/hud_closecaption.cpp @@ -2004,7 +2004,7 @@ static bool CaptionTrace( const char *token ) static CUtlSymbolTable s_MissingCloseCaptions; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_MissingCloseCaptions.Find( token ) ) + if ( !s_MissingCloseCaptions.Find( token ).IsValid() ) { s_MissingCloseCaptions.AddString( token ); return true; diff --git a/src/game/client/hud_lcd.cpp b/src/game/client/hud_lcd.cpp index 359c43a9f..b676d0402 100644 --- a/src/game/client/hud_lcd.cpp +++ b/src/game/client/hud_lcd.cpp @@ -528,15 +528,15 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD { CLCDItem *newItem = NULL; - CLCDItem *item = ag->m_Definition[ r ]; - switch ( item->m_Type ) + CLCDItem *pItem = ag->m_Definition[ r ]; + switch ( pItem->m_Type ) { default: break; case LCDITEM_TEXT: { - CLCDItemText *text = static_cast< CLCDItemText * >( item ); + CLCDItemText *text = static_cast< CLCDItemText * >( pItem ); CUtlString s; s = text->m_OriginalText; Replace( s, prefix, s1 ); @@ -551,7 +551,7 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD // text->m_OriginalText = s; - CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( item->m_Type ) ); + CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( pItem->m_Type ) ); *copy = *text; copy->m_bActive = true; copy->m_OriginalText = s; @@ -564,8 +564,8 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD break; case LCDITEM_ICON: { - CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( item ); - CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( item->m_Type ) ); + CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( pItem ); + CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( pItem->m_Type ) ); *copy = *icon; copy->m_bActive = true; copy->Create( m_lcd ); diff --git a/src/game/client/particlemgr.cpp b/src/game/client/particlemgr.cpp index 88fd55485..90773713a 100644 --- a/src/game/client/particlemgr.cpp +++ b/src/game/client/particlemgr.cpp @@ -1540,7 +1540,7 @@ static void ProcessNonDrawingSystem( CParticleCollection *&pNonDrawingEffect ) int CParticleMgr::ComputeParticleDefScreenArea( int nInfoCount, RetireInfo_t *pInfo, float *pTotalArea, CParticleSystemDefinition* pDef, - const CViewSetup& view, const VMatrix &worldToPixels, float flFocalDist ) + const CViewSetup& viewSetup, const VMatrix &worldToPixels, float flFocalDist ) { int nCollection = 0; float flCullCost = pDef->GetCullFillCost(); @@ -1549,7 +1549,7 @@ int CParticleMgr::ComputeParticleDefScreenArea( int nInfoCount, RetireInfo_t *pI *pTotalArea = 0.0f; #ifdef DBGFLAG_ASSERT - float flMaxPixels = view.width * view.height; + float flMaxPixels = viewSetup.width * viewSetup.height; #endif CParticleCollection *pCollection = pDef->FirstCollection(); @@ -1571,22 +1571,22 @@ int CParticleMgr::ComputeParticleDefScreenArea( int nInfoCount, RetireInfo_t *pI vecCenter = pCollection->GetControlPointAtCurrentTime( pDef->GetCullControlPoint() ); Vector3DMultiplyPositionProjective( worldToPixels, vecCenter, vecScreenCenter ); - float lSqr = vecCenter.DistToSqr( view.origin ); + float lSqr = vecCenter.DistToSqr( viewSetup.origin ); float flProjRadius = ( lSqr > flCullRadiusSqr ) ? 0.5f * flFocalDist * flCullRadius / sqrt( lSqr - flCullRadiusSqr ) : 1.0f; - flProjRadius *= view.width; + flProjRadius *= viewSetup.width; - float flMinX = MAX( view.x, vecScreenCenter.x - flProjRadius ); - float flMaxX = MIN( view.x + view.width, vecScreenCenter.x + flProjRadius ); + float flMinX = MAX( viewSetup.x, vecScreenCenter.x - flProjRadius ); + float flMaxX = MIN( viewSetup.x + viewSetup.width, vecScreenCenter.x + flProjRadius ); - float flMinY = MAX( view.y, vecScreenCenter.y - flProjRadius ); - float flMaxY = MIN( view.y + view.height, vecScreenCenter.y + flProjRadius ); + float flMinY = MAX( viewSetup.y, vecScreenCenter.y - flProjRadius ); + float flMaxY = MIN( viewSetup.y + viewSetup.height, vecScreenCenter.y + flProjRadius ); // Clamp the min/max values to the screen so that particles particle systems outside of the view don't cause early retirement. - flMinX = clamp( flMinX, view.x, view.width ); - flMaxX = clamp( flMaxX, view.x, view.width ); - flMinY = clamp( flMinY, view.y, view.height ); - flMaxY = clamp( flMaxY, view.y, view.height ); + flMinX = clamp( flMinX, viewSetup.x, viewSetup.width ); + flMaxX = clamp( flMaxX, viewSetup.x, viewSetup.width ); + flMinY = clamp( flMinY, viewSetup.y, viewSetup.height ); + flMaxY = clamp( flMaxY, viewSetup.y, viewSetup.height ); float flArea = ( flMaxX - flMinX ) * ( flMaxY - flMinY ); Assert( flArea <= flMaxPixels ); diff --git a/src/game/client/physpropclientside.cpp b/src/game/client/physpropclientside.cpp index 67fc50aaf..4a367a9fc 100644 --- a/src/game/client/physpropclientside.cpp +++ b/src/game/client/physpropclientside.cpp @@ -509,7 +509,7 @@ void C_PhysPropClientside::Clone( Vector &velocity ) } } -void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "C_PhysPropClientside::ImpactTrace" ); IPhysicsObject *pPhysicsObject = VPhysicsGetObject(); diff --git a/src/game/client/physpropclientside.h b/src/game/client/physpropclientside.h index 070a3913b..919c69d5f 100644 --- a/src/game/client/physpropclientside.h +++ b/src/game/client/physpropclientside.h @@ -30,7 +30,7 @@ class C_PhysPropClientside : public C_BreakableProp, public IBreakableWithPropDa virtual CollideType_t GetCollideType( void ) { return ENTITY_SHOULD_RESPOND; } virtual void StartTouch( C_BaseEntity *pOther ); virtual void HitSurface( C_BaseEntity *pOther ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool IsClientCreated( void ) const { return true; } virtual int GetMultiplayerPhysicsMode() { return m_iPhysicsMode; } virtual float GetMass(); diff --git a/src/game/client/ragdoll.cpp b/src/game/client/ragdoll.cpp index 9b290b3d7..4c74761ea 100644 --- a/src/game/client/ragdoll.cpp +++ b/src/game/client/ragdoll.cpp @@ -628,20 +628,20 @@ void C_ServerRagdoll::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quater int i; for ( i = 0; i < m_elementCount; i++ ) { - int index = m_boneIndex[i]; - if ( index >= 0 ) + int iIndex = m_boneIndex[i]; + if ( iIndex >= 0 ) { - if ( hdr->boneFlags(index) & boneMask ) + if ( hdr->boneFlags(iIndex) & boneMask ) { - boneSimulated[index] = true; - matrix3x4_t &matrix = GetBoneForWrite( index ); + boneSimulated[iIndex] = true; + matrix3x4_t &matrix = GetBoneForWrite( iIndex ); if ( m_flBlendWeightCurrent != 0.0f && pSeqDesc && // FIXME: this bone access is illegal - pSeqDesc->weight( index ) != 0.0f ) + pSeqDesc->weight( iIndex ) != 0.0f ) { // Use the animated bone position instead - boneSimulated[index] = false; + boneSimulated[iIndex] = false; } else { @@ -737,8 +737,8 @@ class C_ServerRagdollAttached : public C_ServerRagdoll if ( GetMoveParent() ) { // HACKHACK: Force the attached bone to be set up - int index = m_boneIndex[m_ragdollAttachedObjectIndex]; - int boneFlags = GetModelPtr()->boneFlags(index); + int iIndex = m_boneIndex[m_ragdollAttachedObjectIndex]; + int boneFlags = GetModelPtr()->boneFlags(iIndex); if ( !(boneFlags & boneMask) ) { // BUGBUG: The attached bone is required and this call is going to skip it, so force it @@ -779,8 +779,8 @@ class C_ServerRagdollAttached : public C_ServerRagdoll if ( parent ) { - int index = m_boneIndex[m_ragdollAttachedObjectIndex]; - const matrix3x4_t &matrix = GetBone( index ); + int iIndex = m_boneIndex[m_ragdollAttachedObjectIndex]; + const matrix3x4_t &matrix = GetBone( iIndex ); Vector ragOrigin; VectorTransform( m_attachmentPointRagdollSpace, matrix, ragOrigin ); offset = worldOrigin - ragOrigin; @@ -794,11 +794,11 @@ class C_ServerRagdollAttached : public C_ServerRagdoll if ( !( hdr->boneFlags( i ) & boneMask ) ) continue; - Vector pos; + Vector vecPos; matrix3x4_t &matrix = GetBoneForWrite( i ); - MatrixGetColumn( matrix, 3, pos ); - pos += offset; - MatrixSetColumn( pos, 3, matrix ); + MatrixGetColumn( matrix, 3, vecPos ); + vecPos += offset; + MatrixSetColumn( vecPos, 3, matrix ); } } void OnDataChanged( DataUpdateType_t updateType ); diff --git a/src/game/client/recvproxy.cpp b/src/game/client/recvproxy.cpp index 8bde844ca..89fad41df 100644 --- a/src/game/client/recvproxy.cpp +++ b/src/game/client/recvproxy.cpp @@ -24,7 +24,7 @@ void RecvProxy_ShortSubOne( const CRecvProxyData *pData, void *pStruct, void *pO *pInt = pData->m_Value.m_Int - 1; } -RecvProp RecvPropIntWithMinusOneFlag( char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) +RecvProp RecvPropIntWithMinusOneFlag( const char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) { return RecvPropInt( pVarName, offset, sizeofVar, 0, proxyFn ); } @@ -60,7 +60,7 @@ void RecvProxy_IntToEHandle( const CRecvProxyData *pData, void *pStruct, void *p } RecvProp RecvPropEHandle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) @@ -70,7 +70,7 @@ RecvProp RecvPropEHandle( RecvProp RecvPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -136,7 +136,7 @@ static void RecvProxy_Time( const CRecvProxyData *pData, void *pStruct, void *pO // Output : RecvProp //----------------------------------------------------------------------------- RecvProp RecvPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar/*=SIZEOF_IGNORE*/ ) { @@ -171,7 +171,7 @@ static void RecvProxy_IntToPredictableId( const CRecvProxyData *pData, void *pSt // Output : RecvProp //----------------------------------------------------------------------------- RecvProp RecvPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar/*=SIZEOF_IGNORE*/ ) { diff --git a/src/game/client/recvproxy.h b/src/game/client/recvproxy.h index 9a4899001..67ea02bb4 100644 --- a/src/game/client/recvproxy.h +++ b/src/game/client/recvproxy.h @@ -24,30 +24,30 @@ void RecvProxy_ShortSubOne( const CRecvProxyData *pData, void *pStruct, void *pO void RecvProxy_InterpolationAmountChanged( const CRecvProxyData *pData, void *pStruct, void *pOut ); RecvProp RecvPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #if !defined( NO_ENTITY_PREDICTION ) && defined( USE_PREDICTABLEID ) RecvProp RecvPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #endif RecvProp RecvPropEHandle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, RecvVarProxyFn proxyFn=RecvProxy_IntToEHandle ); RecvProp RecvPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ); RecvProp RecvPropIntWithMinusOneFlag( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, RecvVarProxyFn proxyFn=RecvProxy_IntSubOne ); diff --git a/src/game/client/swarm/c_asw_door.cpp b/src/game/client/swarm/c_asw_door.cpp index 504f3f4e1..caab9d6e7 100644 --- a/src/game/client/swarm/c_asw_door.cpp +++ b/src/game/client/swarm/c_asw_door.cpp @@ -280,7 +280,7 @@ void C_ASW_Door::OnDataChanged( DataUpdateType_t type ) } } -void C_ASW_Door::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ASW_Door::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { Assert( pTrace->m_pEnt ); diff --git a/src/game/client/swarm/c_asw_door.h b/src/game/client/swarm/c_asw_door.h index 359ae9387..2e08fb9fc 100644 --- a/src/game/client/swarm/c_asw_door.h +++ b/src/game/client/swarm/c_asw_door.h @@ -23,7 +23,7 @@ class C_ASW_Door : public C_BasePropDoor virtual void OnDataChanged( DataUpdateType_t type ); Class_T Classify( void ) { return (Class_T) CLASS_ASW_DOOR; } - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); Vector GetWeldFacingPoint( C_BaseEntity* pOther ); // the point a marine should look to weld this door Vector GetSparkNormal( C_BaseEntity* pOther ); // the angle sparks should shoot out when welding diff --git a/src/game/client/swarm/c_asw_marine.cpp b/src/game/client/swarm/c_asw_marine.cpp index 4e9b69c6d..22bd170bb 100644 --- a/src/game/client/swarm/c_asw_marine.cpp +++ b/src/game/client/swarm/c_asw_marine.cpp @@ -2536,7 +2536,7 @@ void C_ASW_Marine::RemoveBackpack() } } -void C_ASW_Marine::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ASW_Marine::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { // do nothing // effects re handled in TraceAttack in the shared file diff --git a/src/game/client/swarm/c_asw_marine.h b/src/game/client/swarm/c_asw_marine.h index 6940104c2..259b0a7bb 100644 --- a/src/game/client/swarm/c_asw_marine.h +++ b/src/game/client/swarm/c_asw_marine.h @@ -94,7 +94,7 @@ class C_ASW_Marine : public C_ASW_VPhysics_NPC, public IASWPlayerAnimStateHelper // ammo int GetAllAmmoCount( void ); int GetTotalAmmoCount(int iAmmoIndex); - int GetTotalAmmoCount(char *szName); + int GetTotalAmmoCount(const char *szName); int GetWeaponAmmoCount(int iAmmoIndex); int GetWeaponAmmoCount(char *szName); int GetNumberOfWeaponsUsingAmmo(int iAmmoType); @@ -271,7 +271,7 @@ class C_ASW_Marine : public C_ASW_VPhysics_NPC, public IASWPlayerAnimStateHelper virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ); CNetworkVar(float, m_fInfestedTime); // how many seconds of infestation we have left CNetworkVar(float, m_fInfestedStartTime); // when the marine first got infested - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual C_ClientRagdoll* CreateClientRagdoll( bool bRestoring = false ); virtual C_BaseAnimating* BecomeRagdollOnClient(); virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); diff --git a/src/game/client/swarm/c_asw_steamstats.cpp b/src/game/client/swarm/c_asw_steamstats.cpp index 164753290..b888bc004 100644 --- a/src/game/client/swarm/c_asw_steamstats.cpp +++ b/src/game/client/swarm/c_asw_steamstats.cpp @@ -1214,7 +1214,7 @@ bool DifficultyStats_t::FetchDifficultyStats( CSteamID playerSteamID, int iDiffi return false; bool bOK = true; - char* szDifficulty = NULL; + const char* szDifficulty = NULL; switch( iDifficulty ) { @@ -1273,7 +1273,7 @@ void DifficultyStats_t::PrepStatsForSend( CASW_Player *pPlayer ) m_fGamesSuccessPercent = m_iGamesSuccess / (float)m_iGamesTotal * 100.0f; } } - char* szDifficulty = NULL; + const char* szDifficulty = NULL; int iDifficulty = ASWGameRules()->GetSkillLevel(); switch( iDifficulty ) diff --git a/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp b/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp index 83d8b38c7..4be15290d 100644 --- a/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp +++ b/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp @@ -143,6 +143,8 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) while ( pszFilename ) { char mapname[256]; + const char *str; + char *ext; // FindFirst ignores the pszPathID, so check it here // TODO: this doesn't find maps in fallback dirs @@ -154,7 +156,7 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) // remove the text 'maps/' and '.bsp' from the file name to get the map name - const char *str = Q_strstr( pszFilename, "maps" ); + str = Q_strstr( pszFilename, "maps" ); if ( str ) { Q_strncpy( mapname, str + 5, sizeof(mapname) - 1 ); // maps + \\ = 5 @@ -163,7 +165,7 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) { Q_strncpy( mapname, pszFilename, sizeof(mapname) - 1 ); } - char *ext = Q_strstr( mapname, ".bsp" ); + ext = Q_strstr( mapname, ".bsp" ); if ( ext ) { *ext = 0; diff --git a/src/game/client/swarm/gameui/cvarslider.cpp b/src/game/client/swarm/gameui/cvarslider.cpp index 60c334700..459edb2fb 100644 --- a/src/game/client/swarm/gameui/cvarslider.cpp +++ b/src/game/client/swarm/gameui/cvarslider.cpp @@ -262,10 +262,10 @@ void CCvarSlider::Reset() m_iLastSliderValue = m_iStartValue; return; } - float m_fStartValue = var.GetFloat(); - m_fCurrentValue = m_fStartValue; + float flStartValue = var.GetFloat(); + m_fCurrentValue = flStartValue; - int value = (int)( CVARSLIDER_SCALE_FACTOR * m_fStartValue ); + int value = (int)( CVARSLIDER_SCALE_FACTOR * flStartValue ); SetValue( value ); m_iStartValue = GetValue(); diff --git a/src/game/client/swarm/gameui/optionssubkeyboard.cpp b/src/game/client/swarm/gameui/optionssubkeyboard.cpp index 05d705dfe..9247ea126 100644 --- a/src/game/client/swarm/gameui/optionssubkeyboard.cpp +++ b/src/game/client/swarm/gameui/optionssubkeyboard.cpp @@ -197,7 +197,7 @@ static char *UTIL_CopyString( const char *in ) return out; } -char *UTIL_va(char *format, ...) +char *UTIL_va(const char *format, ...) { va_list argptr; static char string[4][1024]; diff --git a/src/game/client/swarm/gameui/optionssubmultiplayer.cpp b/src/game/client/swarm/gameui/optionssubmultiplayer.cpp index 3e49179a2..e3da0ef8a 100644 --- a/src/game/client/swarm/gameui/optionssubmultiplayer.cpp +++ b/src/game/client/swarm/gameui/optionssubmultiplayer.cpp @@ -76,7 +76,7 @@ void UpdateLogoWAD( void *hdib, int r, int g, int b ); struct ColorItem_t { - char *name; + const char *name; int r, g, b; }; @@ -1739,9 +1739,9 @@ ConversionErrorType COptionsSubMultiplayer::ConvertTGAToVTF(const char *tgaPath) char *vtfParams[4]; // the 0th entry is skipped cause normally thats the program name. - vtfParams[0] = ""; - vtfParams[1] = "-quiet"; - vtfParams[2] = "-dontusegamedir"; + vtfParams[0] = (char *)""; + vtfParams[1] = (char *)"-quiet"; + vtfParams[2] = (char *)"-dontusegamedir"; vtfParams[3] = (char *)tgaPath; // call vtex to do the conversion. diff --git a/src/game/client/swarm/gameui/optionssubvideo.cpp b/src/game/client/swarm/gameui/optionssubvideo.cpp index 45a7a2798..f7d1cc096 100644 --- a/src/game/client/swarm/gameui/optionssubvideo.cpp +++ b/src/game/client/swarm/gameui/optionssubvideo.cpp @@ -1047,8 +1047,8 @@ void COptionsSubVideo::PrepareResolutionList() int selectedItemID = -1; for (int i = 0; i < count; i++, plist++) { - char sz[ 256 ]; - GetResolutionName( plist, sz, sizeof( sz ) ); + char szValue[ 256 ]; + GetResolutionName( plist, szValue, sizeof( szValue ) ); // don't show modes bigger than the desktop for windowed mode if ( bWindowed && (plist->width > desktopWidth || plist->height > desktopHeight) ) @@ -1065,7 +1065,7 @@ void COptionsSubVideo::PrepareResolutionList() // filter the list for those matching the current aspect if ( iAspectMode == m_pAspectRatio->GetActiveItem() ) { - itemID = m_pMode->AddItem( sz, NULL); + itemID = m_pMode->AddItem( szValue, NULL); } // try and find the best match for the resolution to be selected @@ -1090,9 +1090,9 @@ void COptionsSubVideo::PrepareResolutionList() } else { - char sz[256]; - sprintf( sz, "%d x %d", config.m_VideoMode.m_Width, config.m_VideoMode.m_Height ); - m_pMode->SetText( sz ); + char szValue[256]; + sprintf( szValue, "%d x %d", config.m_VideoMode.m_Width, config.m_VideoMode.m_Height ); + m_pMode->SetText( szValue ); } } diff --git a/src/game/client/swarm/gameui/scriptobject.cpp b/src/game/client/swarm/gameui/scriptobject.cpp index 173c31de7..b85df4644 100644 --- a/src/game/client/swarm/gameui/scriptobject.cpp +++ b/src/game/client/swarm/gameui/scriptobject.cpp @@ -860,7 +860,7 @@ bool CDescription::ReadFromBuffer( const char **pBuffer ) return true; } -bool CDescription::InitFromFile( char *pszFileName ) +bool CDescription::InitFromFile( const char *pszFileName ) { // Load file into memory diff --git a/src/game/client/swarm/gameui/scriptobject.h b/src/game/client/swarm/gameui/scriptobject.h index ad9977d25..7ea977a71 100644 --- a/src/game/client/swarm/gameui/scriptobject.h +++ b/src/game/client/swarm/gameui/scriptobject.h @@ -90,7 +90,7 @@ abstract_class CDescription virtual ~CDescription(); bool ReadFromBuffer( const char **pBuffer ); - bool InitFromFile( char *pszFileName ); + bool InitFromFile( const char *pszFileName ); void TransferCurrentValues( const char *pszConfigFile ); void AddObject( CScriptObject *pItem ); diff --git a/src/game/client/swarm/gameui/swarm/vaddons.cpp b/src/game/client/swarm/gameui/swarm/vaddons.cpp index 62aa2df01..0c412ce07 100644 --- a/src/game/client/swarm/gameui/swarm/vaddons.cpp +++ b/src/game/client/swarm/gameui/swarm/vaddons.cpp @@ -505,7 +505,7 @@ void Addons::Activate() m_GplAddons->RemoveAllPanelItems(); m_addonInfoList.RemoveAll(); - m_pAddonList ? m_pAddonList->deleteThis() : NULL; + if ( m_pAddonList ) { m_pAddonList->deleteThis(); } // // Get the list of addons @@ -1205,9 +1205,9 @@ Addons::ConversionErrorType Addons::ConvertTGAToVTF( const char *tgaPath ) char *vtfParams[4]; // the 0th entry is skipped cause normally thats the program name. - vtfParams[0] = ""; - vtfParams[1] = "-quiet"; - vtfParams[2] = "-dontusegamedir"; + vtfParams[0] = (char *)""; + vtfParams[1] = (char *)"-quiet"; + vtfParams[2] = (char *)"-dontusegamedir"; vtfParams[3] = ( char * )tgaPath; // call vtex to do the conversion. diff --git a/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp b/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp index dd3790edf..b9e68da8a 100644 --- a/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp +++ b/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp @@ -45,7 +45,7 @@ void Demo_DisableButton( Button *pButton ) pHybridButton->SetEnabled( false ); char szTooltip[512]; - wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_DemoVersion" ); + const wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_DemoVersion" ); if ( !wUnicode ) wUnicode = L""; @@ -64,7 +64,7 @@ void Dlc1_DisableButton( Button *pButton ) pHybridButton->SetEnabled( false ); char szTooltip[512]; - wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_DLC1_NotInstalled" ); + const wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_DLC1_NotInstalled" ); if ( !wUnicode ) wUnicode = L""; diff --git a/src/game/client/swarm/gameui/swarm/vmainmenu.cpp b/src/game/client/swarm/gameui/swarm/vmainmenu.cpp index 789786d58..f1b9d8829 100644 --- a/src/game/client/swarm/gameui/swarm/vmainmenu.cpp +++ b/src/game/client/swarm/gameui/swarm/vmainmenu.cpp @@ -2048,6 +2048,7 @@ void MainMenu::OnHoIAFTop10ScoresDownloaded( LeaderboardScoresDownloaded_t *pPar { bool bOK = SteamUserStats()->GetDownloadedLeaderboardEntry( pParam->m_hSteamLeaderboardEntries, i, &s_HoIAFLeaderboardEntryCache[i], reinterpret_cast< int32 * >( &s_HoIAFLeaderboardDetailsCache[i] ), sizeof( s_HoIAFLeaderboardDetailsCache[i] ) / sizeof( int32 ) ); Assert( bOK ); + ( void )bOK; Assert( s_HoIAFLeaderboardEntryCache[i].m_cDetails == sizeof( s_HoIAFLeaderboardDetailsCache[i] ) / sizeof( int32 ) ); m_pTopLeaderboardEntries[i]->SetFromEntry( s_HoIAFLeaderboardEntryCache[i], s_HoIAFLeaderboardDetailsCache[i] ); diff --git a/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp b/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp index 03a5617ac..9008d78bc 100644 --- a/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp +++ b/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp @@ -520,7 +520,7 @@ void Multiplayer::OnCommand(const char *command) } else { - char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) ); + const char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) ); char rootFilename[MAX_PATH]; Q_snprintf( rootFilename, sizeof(rootFilename), MULTIPLAYER_SPRAY_FOLDER "%s%s.vtf", pchCustomPath, m_nSpraypaint[ iLogo ].m_szFilename ); diff --git a/src/game/client/swarm/rd_collections_crafting.cpp b/src/game/client/swarm/rd_collections_crafting.cpp index 953c6da4e..1af965b6f 100644 --- a/src/game/client/swarm/rd_collections_crafting.cpp +++ b/src/game/client/swarm/rd_collections_crafting.cpp @@ -288,11 +288,6 @@ void CRD_Crafting_Item_Grid::PerformLayout() m_Items[i]->SetPos( col * eachWide, row * eachTall + yOffset ); - int up = col + ( row - 1 ) * perRow; - int down = col + ( row + 1 ) * perRow; - int left = col == 0 ? -1 : col - 1 + row * perRow; - int right = col == perRow - 1 ? -1 : col + 1 + row * perRow; - // TODO: set up navigation } } diff --git a/src/game/client/swarm/rd_steam_input.cpp b/src/game/client/swarm/rd_steam_input.cpp index 692b05f73..1518128d1 100644 --- a/src/game/client/swarm/rd_steam_input.cpp +++ b/src/game/client/swarm/rd_steam_input.cpp @@ -184,7 +184,7 @@ void CRD_Steam_Input::Update( float frametime ) // Check for text input focus even if we're not using Steam Input. static vgui::DHANDLE s_hTextEntryFocus; vgui::TextEntry *pTextEntry = dynamic_cast< vgui::TextEntry * >( vgui::ipanel()->GetPanel( vgui::input()->GetFocus(), vgui::GetControlsModuleName() ) ); - if ( s_hTextEntryFocus != pTextEntry ) + if ( s_hTextEntryFocus.Get() != pTextEntry ) { s_hTextEntryFocus = pTextEntry; diff --git a/src/game/client/swarm/vgui/asw_hud_minimap.cpp b/src/game/client/swarm/vgui/asw_hud_minimap.cpp index f9c99a5d9..67dc189f5 100644 --- a/src/game/client/swarm/vgui/asw_hud_minimap.cpp +++ b/src/game/client/swarm/vgui/asw_hud_minimap.cpp @@ -710,7 +710,7 @@ void CASWHudMinimap::Init() for ( int i = 0; i < ASW_MAX_MAP_VERTICAL_SECTIONS; i++ ) { m_nMapTextureID[i] = -1; - m_flMapMinZ[i] = HUGE_VAL; + m_flMapMinZ[i] = std::numeric_limits< float >::infinity(); } m_bHasOverview = false; m_szLastLevelName.Clear(); @@ -1805,11 +1805,11 @@ void CASWHudMinimap::SetMap( const char *levelname ) } m_nMapTextureID[i] = -1; - m_flMapMinZ[i] = HUGE_VAL; + m_flMapMinZ[i] = std::numeric_limits< float >::infinity(); } m_nMapTextureID[0] = surface()->CreateNewTextureID(); - m_flMapMinZ[0] = -HUGE_VAL; + m_flMapMinZ[0] = -std::numeric_limits< float >::infinity(); const RD_Mission_t *pOverview = ReactiveDropMissions::GetMission( levelname ); if ( !pOverview ) @@ -1875,7 +1875,7 @@ void CASWHudMinimap::SetMap( const char *levelname ) m_nMapTextureID[j] = m_nMapTextureID[j - 1]; } - m_flMapMinZ[iMinIndex + 1] = MIN( iMinIndex + 2 < ASW_MAX_MAP_VERTICAL_SECTIONS ? m_flMapMinZ[iMinIndex + 2] : HUGE_VAL, flMax ); + m_flMapMinZ[iMinIndex + 1] = MIN( iMinIndex + 2 < ASW_MAX_MAP_VERTICAL_SECTIONS ? m_flMapMinZ[iMinIndex + 2] : std::numeric_limits< float >::infinity(), flMax ); } else if ( iMinIndex > 0 && iBlankIndex != iMinIndex && iBlankIndex + 1 < ASW_MAX_MAP_VERTICAL_SECTIONS && m_flMapMinZ[iMinIndex + 1] > flMax ) { diff --git a/src/game/client/swarm/vgui/asw_vgui_computer_frame.cpp b/src/game/client/swarm/vgui/asw_vgui_computer_frame.cpp index c6d4fdf1f..edb82ca98 100644 --- a/src/game/client/swarm/vgui/asw_vgui_computer_frame.cpp +++ b/src/game/client/swarm/vgui/asw_vgui_computer_frame.cpp @@ -180,7 +180,7 @@ void CASW_VGUI_Computer_Frame::RecordComputerContents() COMPILE_TIME_ASSERT( COMPUTER_LOCKED_MAIL_2 + 1 == COMPUTER_LOCKED_MAIL_3 ); COMPILE_TIME_ASSERT( COMPUTER_LOCKED_MAIL_3 + 1 == COMPUTER_LOCKED_MAIL_4 ); - int iLockedEntries = ( pArea->m_iLockedScreens >> COMPUTER_LOCKED_MAIL_1 ) & ( 1 << 4 - 1 ); + int iLockedEntries = ( pArea->m_iLockedScreens >> COMPUTER_LOCKED_MAIL_1 ) & ( 1 << ( 4 - 1 ) ); if ( pArea->IsPDA() ) SwarmopediaRecordSeenContent( "PDA", pArea->m_MailFile.Get(), pArea->GetAbsOrigin(), pMR->GetProfileIndex(), pArea->m_PDAName.Get(), iLockedEntries ); diff --git a/src/game/client/swarm/vgui/campaignpanel.cpp b/src/game/client/swarm/vgui/campaignpanel.cpp index 06e91127d..be5a431f7 100644 --- a/src/game/client/swarm/vgui/campaignpanel.cpp +++ b/src/game/client/swarm/vgui/campaignpanel.cpp @@ -446,13 +446,13 @@ void CampaignPanel::OnThink() int x, y; m_pCurrentLocationImage->GetPos( x, y ); // location of red arrows - C_ASW_Campaign_Save *pSave = pGameResource->GetCampaignSave(); - if ( pSave ) + C_ASW_Campaign_Save *pCampaignSave = pGameResource->GetCampaignSave(); + if ( pCampaignSave ) { // check if there's a timer on - if ( pSave->m_fVoteEndTime != 0 ) + if ( pCampaignSave->m_fVoteEndTime != 0 ) { - int iTimeLeft = pSave->m_fVoteEndTime - gpGlobals->curtime; + int iTimeLeft = pCampaignSave->m_fVoteEndTime - gpGlobals->curtime; if ( iTimeLeft > 0 ) { char buffer[8]; @@ -472,7 +472,7 @@ void CampaignPanel::OnThink() } if ( GetCampaignInfo() ) { - const RD_Campaign_Mission_t *pMission = GetCampaignInfo()->GetMission( pSave->m_iCurrentPosition ); + const RD_Campaign_Mission_t *pMission = GetCampaignInfo()->GetMission( pCampaignSave->m_iCurrentPosition ); if ( pMission ) { int iMapX, iMapY, iMapW, iMapT; @@ -554,12 +554,12 @@ void CampaignPanel::OnThink() if ( !pMission ) return; - CASW_Campaign_Save *pSave = ASWGameRules()->GetCampaignSave(); - if ( !pSave ) + CASW_Campaign_Save *pCampaignSave = ASWGameRules()->GetCampaignSave(); + if ( !pCampaignSave ) return; // if mission is already completed, just show it as a grey label - bool bComplete = ( pSave->m_MissionComplete[i] != 0 ) || i <= 0; + bool bComplete = ( pCampaignSave->m_MissionComplete[i] != 0 ) || i <= 0; if ( !bComplete ) m_pMouseOverGlowLabel->SetVisible( true ); 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..2402575a5 100644 --- a/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp +++ b/src/game/client/swarm/vgui/holdout_hud_wave_panel.cpp @@ -79,10 +79,10 @@ 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 ); + wchar_t wzValue2[15]; + V_snwprintf( wzValue2, ARRAYSIZE( wzValue2 ), L"%d", (int) flTimeLeft ); - m_pCountdownTimeLabel->SetText( wzValue ); + m_pCountdownTimeLabel->SetText( wzValue2 ); } UpdateWaveProgressBar(); diff --git a/src/game/client/swarm/vgui/nb_skill_panel.h b/src/game/client/swarm/vgui/nb_skill_panel.h index fbeb1dda7..038a4809f 100644 --- a/src/game/client/swarm/vgui/nb_skill_panel.h +++ b/src/game/client/swarm/vgui/nb_skill_panel.h @@ -16,7 +16,7 @@ class StatsBar; // == MANAGED_CLASS_DECLARATIONS_END == class CBitmapButton; class BriefingTooltip; -enum ASW_Skill; +enum ASW_Skill : int; class CNB_Skill_Panel : public vgui::EditablePanel { diff --git a/src/game/client/swarm/vgui/objectivepanel.cpp b/src/game/client/swarm/vgui/objectivepanel.cpp index 51b7bb0fc..4371c7a9f 100644 --- a/src/game/client/swarm/vgui/objectivepanel.cpp +++ b/src/game/client/swarm/vgui/objectivepanel.cpp @@ -16,7 +16,7 @@ ObjectivePanel::ObjectivePanel(Panel *parent, const char *name) : Panel(parent, m_ObjectiveImagePanel->SetShouldScaleImage(true); // create the blank objective text - note, label isn't actually a child of this class! - wchar_t *text = L""; + const wchar_t *text = L""; m_ObjectiveLabel = new vgui::WrappedLabel(this, "ObjectivePanelLabel", text); m_ObjectiveLabel->SetContentAlignment(vgui::Label::a_northwest); diff --git a/src/game/client/swarm/vgui/objectivetitlepanel.cpp b/src/game/client/swarm/vgui/objectivetitlepanel.cpp index 1a9947f01..ceefcaabf 100644 --- a/src/game/client/swarm/vgui/objectivetitlepanel.cpp +++ b/src/game/client/swarm/vgui/objectivetitlepanel.cpp @@ -31,7 +31,7 @@ ObjectiveTitlePanel::ObjectiveTitlePanel( Panel *parent, const char *name ) : Pa m_ObjectiveImagePanel->SetMouseInputEnabled( false ); // create the blank objective text - note, label isn't actually a child of this class! - wchar_t *text = L""; + const wchar_t *text = L""; m_ObjectiveLabel = new vgui::Label( this, "ObjectiveTitlePanelLabel", text ); m_ObjectiveLabel->SetContentAlignment( vgui::Label::a_northwest ); m_ObjectiveLabel->SetMouseInputEnabled( false ); @@ -137,13 +137,13 @@ void ObjectiveTitlePanel::UpdateElements() pTitle = m_hObjective->GetObjectiveTitle(); else { - char buffer[8]; - Q_snprintf( buffer, sizeof( buffer ), "%d", m_Index ); + char pBuffer[8]; + Q_snprintf( pBuffer, sizeof( pBuffer ), "%d", m_Index ); wchar_t wnumber[8]; - g_pVGuiLocalize->ConvertANSIToUnicode( buffer, wnumber, sizeof( wnumber ) ); + g_pVGuiLocalize->ConvertANSIToUnicode( pBuffer, wnumber, sizeof( wnumber ) ); - wchar_t *pLocal = g_pVGuiLocalize->Find( "#asw_objective_titlef" ); + const wchar_t *pLocal = g_pVGuiLocalize->Find( "#asw_objective_titlef" ); if ( !pLocal ) pLocal = L""; g_pVGuiLocalize->ConstructString( buffer2, sizeof( buffer2 ), diff --git a/src/game/client/swarm/vgui/tabbedgriddetails.cpp b/src/game/client/swarm/vgui/tabbedgriddetails.cpp index 1d0681f7b..49f353929 100644 --- a/src/game/client/swarm/vgui/tabbedgriddetails.cpp +++ b/src/game/client/swarm/vgui/tabbedgriddetails.cpp @@ -313,15 +313,15 @@ void TabbedGridDetails::ShowFullScreen() { if ( g_hBriefingFrame ) { - SetParent( g_hBriefingFrame ); + SetParent( g_hBriefingFrame.Get() ); } else if ( GetClientModeASW()->m_hCampaignFrame ) { - SetParent( GetClientModeASW()->m_hCampaignFrame ); + SetParent( GetClientModeASW()->m_hCampaignFrame.Get() ); } else if ( GetClientModeASW()->m_hMissionCompleteFrame ) { - SetParent( GetClientModeASW()->m_hMissionCompleteFrame ); + SetParent( GetClientModeASW()->m_hMissionCompleteFrame.Get() ); } else if ( engine->IsConnected() ) { @@ -938,7 +938,7 @@ void TGD_Grid::DisplayEntry( TGD_Entry *pEntry ) m_pParent->m_pHighlight->SetVisible( true ); m_pParent->m_pLabelHighlight->SetVisible( true ); - if ( m_pParent->m_pParent->m_hCurrentTab != m_pParent ) + if ( m_pParent->m_pParent->m_hCurrentTab.Get() != m_pParent ) { m_pParent->m_pParent->m_hCurrentTab = m_pParent; if ( m_pParent->m_pParent->m_pLastTabConVar ) diff --git a/src/game/client/swarm_sdk_client.vcxproj b/src/game/client/swarm_sdk_client.vcxproj index a770959e8..ac5ab5d3f 100644 --- a/src/game/client/swarm_sdk_client.vcxproj +++ b/src/game/client/swarm_sdk_client.vcxproj @@ -1,4 +1,4 @@ - + @@ -129,6 +129,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -240,6 +241,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -351,6 +353,7 @@ exit /b 0 true true false + stdcpp20 true diff --git a/src/game/client/text_message.cpp b/src/game/client/text_message.cpp index 27672b859..b7bf6c5c9 100644 --- a/src/game/client/text_message.cpp +++ b/src/game/client/text_message.cpp @@ -121,7 +121,7 @@ char *CHudTextMessage::BufferedLocaliseTextString( const char *msg ) char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) { if ( !msg ) - return ""; + return (char *)""; // '#' character indicates this is a reference to a string in titles.txt, and not the string itself if ( msg[0] == '#' ) diff --git a/src/game/client/vgui_fpspanel.cpp b/src/game/client/vgui_fpspanel.cpp index 1a5dc4f0d..eaa6e69d5 100644 --- a/src/game/client/vgui_fpspanel.cpp +++ b/src/game/client/vgui_fpspanel.cpp @@ -289,7 +289,7 @@ void CFPSPanel::Paint() flPeakTime = m_pServerTimes[j]; } } - flTotalTime /= SERVER_TIME_HISTORY; + flTotalTime /= (float)SERVER_TIME_HISTORY; unsigned char ucColor[3]; int nFps = static_cast( 1.0f / ( flServerTime * 0.001f ) ); diff --git a/src/game/client/videoservices/video_material.cpp b/src/game/client/videoservices/video_material.cpp index b31f2a92d..5463359af 100644 --- a/src/game/client/videoservices/video_material.cpp +++ b/src/game/client/videoservices/video_material.cpp @@ -309,7 +309,6 @@ void CVideoMaterial::CreateVideoMaterial( const char *pMaterialName ) const int tex_flags = TEXTUREFLAGS_PROCEDURAL | TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_SINGLECOPY; -#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ); m_textureWidth = ALIGN_VALUE( m_videoWidth, 8 ); m_textureHeight = ALIGN_VALUE( m_videoHeight, 8 ); diff --git a/src/game/client/view.cpp b/src/game/client/view.cpp index 22b11002e..62b78e8a1 100644 --- a/src/game/client/view.cpp +++ b/src/game/client/view.cpp @@ -544,8 +544,8 @@ void CViewRender::OnRenderStart() m_bAllowViewAccess = true; FOR_EACH_VALID_SPLITSCREEN_PLAYER( iSlot ) { - const CViewSetup &view = GetView( iSlot ); - FrustumCache()->Add( &view, iSlot ); + const CViewSetup &viewSetup = GetView( iSlot ); + FrustumCache()->Add( &viewSetup, iSlot ); } FrustumCache()->SetUpdated(); m_bAllowViewAccess = false; @@ -639,17 +639,17 @@ void CViewRender::SetUpView() // Initialize view structure with default values float farZ = GetZFar(); - CViewSetup &view = GetView(); + CViewSetup &viewSetup = GetView(); - view.zFar = farZ; - view.zFarViewmodel = farZ; + viewSetup.zFar = farZ; + viewSetup.zFarViewmodel = farZ; // UNDONE: Make this farther out? // closest point of approach seems to be view center to top of crouched box - view.zNear = GetZNear(); - view.zNearViewmodel = 1; - view.fov = default_fov.GetFloat(); + viewSetup.zNear = GetZNear(); + viewSetup.zNearViewmodel = 1; + viewSetup.fov = default_fov.GetFloat(); - view.m_bOrtho = false; + viewSetup.m_bOrtho = false; // Enable spatial partition access to edicts partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false ); @@ -665,12 +665,12 @@ void CViewRender::SetUpView() if ( g_bEngineIsHLTV ) { - HLTVCamera()->CalcView( view.origin, view.angles, view.fov ); + HLTVCamera()->CalcView( viewSetup.origin, viewSetup.angles, viewSetup.fov ); } #if defined( REPLAY_ENABLED ) else if ( engine->IsReplay() ) { - ReplayCamera()->CalcView( view.origin, view.angles, view.fov ); + ReplayCamera()->CalcView( viewSetup.origin, viewSetup.angles, viewSetup.fov ); } #endif else @@ -679,7 +679,7 @@ void CViewRender::SetUpView() // FIXME: What happens when there's no player? if (pPlayer) { - pPlayer->CalcView( view.origin, view.angles, view.zNear, view.zFar, view.fov ); + pPlayer->CalcView( viewSetup.origin, viewSetup.angles, viewSetup.zNear, viewSetup.zFar, viewSetup.fov ); #ifdef INFESTED_DLL if ( !asw_allow_detach.GetBool() ) @@ -690,11 +690,11 @@ void CViewRender::SetUpView() C_ASW_Player *pOtherPlayer = pSpectating->GetCommander(); if ( pSpectating->IsInhabited() && pOtherPlayer && pOtherPlayer->GetASWControls() != ASWC_TOPDOWN ) { - view.angles = pOtherPlayer->EyeAngles(); + viewSetup.angles = pOtherPlayer->EyeAngles(); } else if ( pASWPlayer->GetASWControls() != ASWC_TOPDOWN ) { - view.angles = pSpectating->EyeAngles(); + viewSetup.angles = pSpectating->EyeAngles(); } } } @@ -708,17 +708,17 @@ void CViewRender::SetUpView() C_BaseEntity *ve = cl_entitylist->GetEnt( viewentity ); if ( ve ) { - VectorCopy( ve->GetAbsOrigin(), view.origin ); - VectorCopy( ve->GetAbsAngles(), view.angles ); + VectorCopy( ve->GetAbsOrigin(), viewSetup.origin ); + VectorCopy( ve->GetAbsAngles(), viewSetup.angles ); } } - pPlayer->CalcViewModelView( view.origin, view.angles ); + pPlayer->CalcViewModelView( viewSetup.origin, viewSetup.angles ); // Is this the proper place for this code? if ( cl_camera_follow_bone_index.GetInt() >= -1 && input->CAM_IsThirdPerson() ) { - VectorCopy( g_cameraFollowPos, view.origin ); + VectorCopy( g_cameraFollowPos, viewSetup.origin ); } } @@ -728,19 +728,19 @@ void CViewRender::SetUpView() } // give the toolsystem a chance to override the view - ToolFramework_SetupEngineView( view.origin, view.angles, view.fov ); + ToolFramework_SetupEngineView( viewSetup.origin, viewSetup.angles, viewSetup.fov ); if ( engine->IsPlayingDemo() ) { if ( cl_demoviewoverride.GetFloat() > 0.0f ) { // Retreive view angles from engine ( could have been set in IN_AdjustAngles above ) - CalcDemoViewOverride( view.origin, view.angles ); + CalcDemoViewOverride( viewSetup.origin, viewSetup.angles ); } else { - s_DemoView = view.origin; - s_DemoAngle = view.angles; + s_DemoView = viewSetup.origin; + s_DemoAngle = viewSetup.angles; } } @@ -748,37 +748,37 @@ void CViewRender::SetUpView() partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true ); //Find the offset our current FOV is from the default value - float flFOVOffset = default_fov.GetFloat() - view.fov; + float flFOVOffset = default_fov.GetFloat() - viewSetup.fov; //Adjust the viewmodel's FOV to move with any FOV offsets on the viewer's end - view.fovViewmodel = GetClientMode()->GetViewModelFOV() - flFOVOffset; + viewSetup.fovViewmodel = GetClientMode()->GetViewModelFOV() - flFOVOffset; // Compute the world->main camera transform - ComputeCameraVariables( view.origin, view.angles, + ComputeCameraVariables( viewSetup.origin, viewSetup.angles, &g_vecVForward[ nSlot ], &g_vecVRight[ nSlot ], &g_vecVUp[ nSlot ], &g_matCamInverse[ nSlot ] ); // set up the hearing origin... AudioState_t audioState; - audioState.m_Origin = view.origin; - audioState.m_Angles = view.angles; - audioState.m_bIsUnderwater = pPlayer && pPlayer->AudioStateIsUnderwater( view.origin ); + audioState.m_Origin = viewSetup.origin; + audioState.m_Angles = viewSetup.angles; + audioState.m_bIsUnderwater = pPlayer && pPlayer->AudioStateIsUnderwater( viewSetup.origin ); ToolFramework_SetupAudioState( audioState ); - view.origin = audioState.m_Origin; - view.angles = audioState.m_Angles; + viewSetup.origin = audioState.m_Origin; + viewSetup.angles = audioState.m_Angles; GetClientMode()->OverrideAudioState( &audioState ); engine->SetAudioState( audioState ); g_vecPrevRenderOrigin[ nSlot ] = g_vecRenderOrigin[ nSlot ]; g_vecPrevRenderAngles[ nSlot ] = g_vecRenderAngles[ nSlot ]; - g_vecRenderOrigin[ nSlot ] = view.origin; - g_vecRenderAngles[ nSlot ] = view.angles; + g_vecRenderOrigin[ nSlot ] = viewSetup.origin; + g_vecRenderAngles[ nSlot ] = viewSetup.angles; #ifdef DBGFLAG_ASSERT - s_DbgSetupOrigin[ nSlot ] = view.origin; - s_DbgSetupAngles[ nSlot ] = view.angles; + s_DbgSetupOrigin[ nSlot ] = viewSetup.origin; + s_DbgSetupAngles[ nSlot ] = viewSetup.angles; #endif m_bAllowViewAccess = false; @@ -941,35 +941,35 @@ void CViewRender::Render( vrect_t *rect ) { ACTIVE_SPLITSCREEN_PLAYER_GUARD_VGUI( hh ); - CViewSetup &view = GetView( hh ); + CViewSetup &viewSetup = GetView( hh ); - float engineAspectRatio = engine->GetScreenAspectRatio( view.width, view.height ); + float engineAspectRatio = engine->GetScreenAspectRatio( viewSetup.width, viewSetup.height ); - Assert( s_DbgSetupOrigin[ hh ] == view.origin ); - Assert( s_DbgSetupAngles[ hh ] == view.angles ); + Assert( s_DbgSetupOrigin[ hh ] == viewSetup.origin ); + Assert( s_DbgSetupAngles[ hh ] == viewSetup.angles ); // Using this API gives us a chance to "inset" the 3d views as needed for splitscreen int insetX, insetY; - VGui_GetEngineRenderBounds( hh, view.x, view.y, view.width, view.height, insetX, insetY ); + VGui_GetEngineRenderBounds( hh, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height, insetX, insetY ); float aspectRatio = engineAspectRatio * 0.75f; // / (4/3) - view.fov = ScaleFOVByWidthRatio( view.fov, aspectRatio ); - view.fovViewmodel = ScaleFOVByWidthRatio( view.fovViewmodel, aspectRatio ); + viewSetup.fov = ScaleFOVByWidthRatio( viewSetup.fov, aspectRatio ); + viewSetup.fovViewmodel = ScaleFOVByWidthRatio( viewSetup.fovViewmodel, aspectRatio ); // Let the client mode hook stuff. - GetClientMode()->PreRender( &view ); - GetClientMode()->AdjustEngineViewport( view.x, view.y, view.width, view.height ); + GetClientMode()->PreRender( &viewSetup ); + GetClientMode()->AdjustEngineViewport( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); - view.width *= flViewportScale; - view.height *= flViewportScale; + viewSetup.width *= flViewportScale; + viewSetup.height *= flViewportScale; if ( IsX360() ) { // view must be compliant to resolve restrictions - view.width = AlignValue( view.width, GPU_RESOLVE_ALIGNMENT ); - view.height = AlignValue( view.height, GPU_RESOLVE_ALIGNMENT ); + viewSetup.width = AlignValue( viewSetup.width, GPU_RESOLVE_ALIGNMENT ); + viewSetup.height = AlignValue( viewSetup.height, GPU_RESOLVE_ALIGNMENT ); } - view.m_flAspectRatio = ( engineAspectRatio > 0.0f ) ? engineAspectRatio : ( (float)view.width / (float)view.height ); + viewSetup.m_flAspectRatio = ( engineAspectRatio > 0.0f ) ? engineAspectRatio : ( (float)viewSetup.width / (float)viewSetup.height ); int nClearFlags = VIEW_CLEAR_DEPTH | VIEW_CLEAR_STENCIL; @@ -1005,7 +1005,7 @@ void CViewRender::Render( vrect_t *rect ) drawViewModel = false; } - render->SetMainView( view.origin, view.angles ); + render->SetMainView( viewSetup.origin, viewSetup.angles ); int flags = (pPlayer == NULL) ? 0 : RENDERVIEW_DRAWHUD; if ( drawViewModel ) @@ -1020,7 +1020,7 @@ void CViewRender::Render( vrect_t *rect ) { CViewSetup hudViewSetup; VGui_GetHudBounds( hh, hudViewSetup.x, hudViewSetup.y, hudViewSetup.width, hudViewSetup.height ); - RenderView( view, hudViewSetup, nClearFlags, flags ); + RenderView( viewSetup, hudViewSetup, nClearFlags, flags ); } GetClientMode()->PostRender(); diff --git a/src/game/client/view_beams.cpp b/src/game/client/view_beams.cpp index 2305713b8..fa218daef 100644 --- a/src/game/client/view_beams.cpp +++ b/src/game/client/view_beams.cpp @@ -422,7 +422,7 @@ bool Beam_t::ShouldDraw( void ) extern bool g_bRenderingScreenshot; extern ConVar r_drawviewmodel; -int Beam_t::DrawModel( int flags, const RenderableInstance_t &instance ) +int Beam_t::DrawModel( int nFlags, const RenderableInstance_t &instance ) { diff --git a/src/game/client/viewdebug.cpp b/src/game/client/viewdebug.cpp index aa1c0d9f4..d2d078e30 100644 --- a/src/game/client/viewdebug.cpp +++ b/src/game/client/viewdebug.cpp @@ -519,7 +519,7 @@ static void OverlayColorRamp( bool bHalfSpace ) //----------------------------------------------------------------------------- // Draws all the debugging info //----------------------------------------------------------------------------- -void CDebugViewRender::Draw3DDebuggingInfo( const CViewSetup &view ) +void CDebugViewRender::Draw3DDebuggingInfo( const CViewSetup &viewSetup ) { VPROF("CViewRender::Draw3DDebuggingInfo"); @@ -537,7 +537,7 @@ void CDebugViewRender::Draw3DDebuggingInfo( const CViewSetup &view ) //----------------------------------------------------------------------------- // Draws all the debugging info //----------------------------------------------------------------------------- -void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view ) +void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &viewSetup ) { // HDRFIXME: Assert NULL rendertarget if ( mat_yuv.GetInt() ) @@ -546,7 +546,7 @@ void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view ) pMaterial = materials->FindMaterial( "debug/yuv", TEXTURE_GROUP_OTHER, true ); if( !IsErrorMaterial( pMaterial ) ) { - DrawScreenEffectMaterial( pMaterial, view.x, view.y, view.width, view.height ); + DrawScreenEffectMaterial( pMaterial, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); } } @@ -556,7 +556,7 @@ void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view ) pMaterial = materials->FindMaterial( "debug/hsv", TEXTURE_GROUP_OTHER, true ); if( !IsErrorMaterial( pMaterial ) ) { - DrawScreenEffectMaterial( pMaterial, view.x, view.y, view.width, view.height ); + DrawScreenEffectMaterial( pMaterial, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); } } @@ -564,7 +564,7 @@ void CDebugViewRender::Draw2DDebuggingInfo( const CViewSetup &view ) if ( mat_showlightmappage.GetInt() != -1 ) { CLightmapDebugView clientView( assert_cast( ::view ) ); - clientView.Setup( view ); + clientView.Setup( viewSetup ); clientView.Draw(); } diff --git a/src/game/client/viewpostprocess.cpp b/src/game/client/viewpostprocess.cpp index ed1302850..7aa7bf73c 100644 --- a/src/game/client/viewpostprocess.cpp +++ b/src/game/client/viewpostprocess.cpp @@ -2093,19 +2093,19 @@ struct MotionBlurHistory_t float m_flNoRotationalMotionBlurUntil; }; -void DoImageSpaceMotionBlur( const CViewSetup &view ) +void DoImageSpaceMotionBlur( const CViewSetup &viewSetup ) { - if ( ( !mat_motion_blur_enabled.GetInt() ) || ( view.m_nMotionBlurMode == MOTION_BLUR_DISABLE ) ) + if ( ( !mat_motion_blur_enabled.GetInt() ) || ( viewSetup.m_nMotionBlurMode == MOTION_BLUR_DISABLE ) ) { return; } - int x = view.x; - int y = view.y; - int w = view.width; - int h = view.height; + int x = viewSetup.x; + int y = viewSetup.y; + int w = viewSetup.width; + int h = viewSetup.height; - bool bSFMBlur = ( view.m_nMotionBlurMode == MOTION_BLUR_SFM ); + bool bSFMBlur = ( viewSetup.m_nMotionBlurMode == MOTION_BLUR_SFM ); //======================================================================================================// // Get these convars here to make it easier to remove them later and to default each client differently // @@ -2142,20 +2142,20 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) history.m_flLastTimeUpdate = 0.0f; // Don't care about these, but zero them out history.m_flNoRotationalMotionBlurUntil = 0.0f; // - flTimeElapsed = view.m_flShutterTime; + flTimeElapsed = viewSetup.m_flShutterTime; - history.m_vPreviousPositon[0] = view.m_vShutterOpenPosition.x; // - history.m_vPreviousPositon[1] = view.m_vShutterOpenPosition.y; // Slam "previous" values to shutter open values - history.m_vPreviousPositon[2] = view.m_vShutterOpenPosition.z; // - AngleMatrix( view.m_shutterOpenAngles, history.m_mPreviousFrameBasisVectors );// + history.m_vPreviousPositon[0] = viewSetup.m_vShutterOpenPosition.x; // + history.m_vPreviousPositon[1] = viewSetup.m_vShutterOpenPosition.y; // Slam "previous" values to shutter open values + history.m_vPreviousPositon[2] = viewSetup.m_vShutterOpenPosition.z; // + AngleMatrix( viewSetup.m_shutterOpenAngles, history.m_mPreviousFrameBasisVectors );// - history.m_flPreviousPitch = view.m_shutterOpenAngles[PITCH]; // Get "previous" pitch & wrap to +-180 + history.m_flPreviousPitch = viewSetup.m_shutterOpenAngles[PITCH]; // Get "previous" pitch & wrap to +-180 while ( history.m_flPreviousPitch > 180.0f ) history.m_flPreviousPitch -= 360.0f; while ( history.m_flPreviousPitch < -180.0f ) history.m_flPreviousPitch += 360.0f; - history.m_flPreviousYaw = view.m_shutterOpenAngles[YAW]; // Get "previous" yaw & wrap to +-180 + history.m_flPreviousYaw = viewSetup.m_shutterOpenAngles[YAW]; // Get "previous" yaw & wrap to +-180 while ( history.m_flPreviousYaw > 180.0f ) history.m_flPreviousYaw -= 360.0f; while ( history.m_flPreviousYaw < -180.0f ) @@ -2170,9 +2170,9 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) //===================================// // Get current pitch & wrap to +-180 // //===================================// - float flCurrentPitch = view.angles[PITCH]; + float flCurrentPitch = viewSetup.angles[PITCH]; if ( bSFMBlur ) - flCurrentPitch = view.m_shutterCloseAngles[PITCH]; + flCurrentPitch = viewSetup.m_shutterCloseAngles[PITCH]; while ( flCurrentPitch > 180.0f ) flCurrentPitch -= 360.0f; while ( flCurrentPitch < -180.0f ) @@ -2181,9 +2181,9 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) //=================================// // Get current yaw & wrap to +-180 // //=================================// - float flCurrentYaw = view.angles[YAW]; + float flCurrentYaw = viewSetup.angles[YAW]; if ( bSFMBlur ) - flCurrentYaw = view.m_shutterCloseAngles[YAW]; + flCurrentYaw = viewSetup.m_shutterCloseAngles[YAW]; while ( flCurrentYaw > 180.0f ) flCurrentYaw -= 360.0f; while ( flCurrentYaw < -180.0f ) @@ -2202,11 +2202,11 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) if ( bSFMBlur ) { - AngleMatrix( view.m_shutterCloseAngles, mCurrentBasisVectors ); + AngleMatrix( viewSetup.m_shutterCloseAngles, mCurrentBasisVectors ); } else { - AngleMatrix( view.angles, mCurrentBasisVectors ); + AngleMatrix( viewSetup.angles, mCurrentBasisVectors ); } @@ -2217,13 +2217,13 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) //===========================================================================// // Get current position (shutter close time when SFM is driving motion blur) // //===========================================================================// - Vector vCurrentPosition = view.origin; + Vector vCurrentPosition = viewSetup.origin; if ( bSFMBlur ) { - vCurrentPosition[0] = view.m_vShutterClosePosition.x; - vCurrentPosition[1] = view.m_vShutterClosePosition.y; - vCurrentPosition[2] = view.m_vShutterClosePosition.z; + vCurrentPosition[0] = viewSetup.m_vShutterClosePosition.x; + vCurrentPosition[1] = viewSetup.m_vShutterClosePosition.y; + vCurrentPosition[2] = viewSetup.m_vShutterClosePosition.z; } //===============================================================// @@ -2270,8 +2270,8 @@ void DoImageSpaceMotionBlur( const CViewSetup &view ) // Normal update path // //====================// // Compute horizontal and vertical fov - float flHorizontalFov = view.fov; - float flVerticalFov = ( view.m_flAspectRatio <= 0.0f ) ? ( view.fov ) : ( view.fov / view.m_flAspectRatio ); + float flHorizontalFov = viewSetup.fov; + float flVerticalFov = ( viewSetup.m_flAspectRatio <= 0.0f ) ? ( viewSetup.fov ) : ( viewSetup.fov / viewSetup.m_flAspectRatio ); //engine->Con_NPrintf( 2, "Horizontal Fov: %6.2f Vertical Fov: %6.2f", flHorizontalFov, flVerticalFov ); //=====================// @@ -2606,7 +2606,7 @@ static inline bool SetMaterialVarInt( IMaterial* pMat, const char* pVarName, int return bFound; } -void DoDepthOfField( const CViewSetup &view ) +void DoDepthOfField( const CViewSetup &viewSetup ) { if ( !IsDepthOfFieldEnabled() ) { @@ -2614,7 +2614,7 @@ void DoDepthOfField( const CViewSetup &view ) } // Copy from backbuffer to _rt_FullFrameFB - UpdateScreenEffectTexture( 0, view.x, view.y, view.width, view.height, false ); // Do we need to check if we already did this? + UpdateScreenEffectTexture( 0, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height, false ); // Do we need to check if we already did this? CMatRenderContextPtr pRenderContext( materials ); @@ -2681,19 +2681,19 @@ void DoDepthOfField( const CViewSetup &view ) if ( pMatDOF == NULL ) return; - SetMaterialVarFloat( pMatDOF, "$nearPlane", view.zNear ); - SetMaterialVarFloat( pMatDOF, "$farPlane", view.zFar ); + SetMaterialVarFloat( pMatDOF, "$nearPlane", viewSetup.zNear ); + SetMaterialVarFloat( pMatDOF, "$farPlane", viewSetup.zFar ); // Only SFM drives this bool at the moment... - if ( view.m_bDoDepthOfField ) + if ( viewSetup.m_bDoDepthOfField ) { - SetMaterialVarFloat( pMatDOF, "$nearBlurDepth", view.m_flNearBlurDepth ); - SetMaterialVarFloat( pMatDOF, "$nearFocusDepth", view.m_flNearFocusDepth ); - SetMaterialVarFloat( pMatDOF, "$farFocusDepth", view.m_flFarFocusDepth ); - SetMaterialVarFloat( pMatDOF, "$farBlurDepth", view.m_flFarBlurDepth ); - SetMaterialVarFloat( pMatDOF, "$nearBlurRadius", view.m_flNearBlurRadius ); - SetMaterialVarFloat( pMatDOF, "$farBlurRadius", view.m_flFarBlurRadius ); - SetMaterialVarInt( pMatDOF, "$quality", view.m_nDoFQuality ); + SetMaterialVarFloat( pMatDOF, "$nearBlurDepth", viewSetup.m_flNearBlurDepth ); + SetMaterialVarFloat( pMatDOF, "$nearFocusDepth", viewSetup.m_flNearFocusDepth ); + SetMaterialVarFloat( pMatDOF, "$farFocusDepth", viewSetup.m_flFarFocusDepth ); + SetMaterialVarFloat( pMatDOF, "$farBlurDepth", viewSetup.m_flFarBlurDepth ); + SetMaterialVarFloat( pMatDOF, "$nearBlurRadius", viewSetup.m_flNearBlurRadius ); + SetMaterialVarFloat( pMatDOF, "$farBlurRadius", viewSetup.m_flFarBlurRadius ); + SetMaterialVarInt( pMatDOF, "$quality", viewSetup.m_nDoFQuality ); } else // pull from convars/globals { @@ -2809,7 +2809,7 @@ ConVar cl_blurDebug( "cl_blurDebug", "0" ); ConVar cl_blurTapSize( "cl_blurTapSize", "0.5" ); ConVar cl_blurPasses( "cl_blurPasses", "1" ); -void BlurEntity( IClientRenderable *pRenderable, bool bPreDraw, int drawFlags, const RenderableInstance_t &instance, const CViewSetup &view, int x, int y, int w, int h ) +void BlurEntity( IClientRenderable *pRenderable, bool bPreDraw, int drawFlags, const RenderableInstance_t &instance, const CViewSetup &viewSetup, int x, int y, int w, int h ) { ITexture *pFullFrameFB = materials->FindTexture( "_rt_FullFrameFB", TEXTURE_GROUP_RENDER_TARGET ); ITexture *dest_rt[2]; diff --git a/src/game/client/viewrender.cpp b/src/game/client/viewrender.cpp index 3f62ae5df..74d9ef33b 100644 --- a/src/game/client/viewrender.cpp +++ b/src/game/client/viewrender.cpp @@ -1065,7 +1065,7 @@ void CViewRender::DrawRenderablesInList( CViewModelRenderablesList::RenderGroups // Purpose: Actually draw the view model // Input : drawViewModel - //----------------------------------------------------------------------------- -void CViewRender::DrawViewModels( const CViewSetup &view, bool drawViewmodel ) +void CViewRender::DrawViewModels( const CViewSetup &viewSetup, bool drawViewmodel ) { VPROF( "CViewRender::DrawViewModel" ); @@ -1090,11 +1090,11 @@ void CViewRender::DrawViewModels( const CViewSetup &view, bool drawViewmodel ) pRenderContext->MatrixMode( MATERIAL_PROJECTION ); pRenderContext->PushMatrix(); - CViewSetup viewModelSetup( view ); - viewModelSetup.zNear = view.zNearViewmodel; - viewModelSetup.zFar = view.zFarViewmodel; - viewModelSetup.fov = view.fovViewmodel; - viewModelSetup.m_flAspectRatio = engine->GetScreenAspectRatio( view.width, view.height ); + CViewSetup viewModelSetup( viewSetup ); + viewModelSetup.zNear = viewSetup.zNearViewmodel; + viewModelSetup.zFar = viewSetup.zFarViewmodel; + viewModelSetup.fov = viewSetup.fovViewmodel; + viewModelSetup.m_flAspectRatio = engine->GetScreenAspectRatio( viewSetup.width, viewSetup.height ); render->Push3DView( viewModelSetup, 0, NULL, GetFrustum() ); @@ -1271,11 +1271,11 @@ void CViewRender::DrawUnderwaterOverlay( void ) UpdateRefractTexture( x, y, w, h, true ); // Now draw the entire screen using the material... - CMatRenderContextPtr pRenderContext( materials ); + CMatRenderContextPtr pRenderCtx( materials ); ITexture *pTexture = GetPowerOfTwoFrameBufferTexture( ); int sw = pTexture->GetActualWidth(); int sh = pTexture->GetActualHeight(); - pRenderContext->DrawScreenSpaceRectangle( pOverlayMat, x, y, w, h, + pRenderCtx->DrawScreenSpaceRectangle( pOverlayMat, x, y, w, h, 0, 0, sw-1, sh-1, sw, sh ); } else @@ -1408,7 +1408,7 @@ static class CReactiveDropSkyboxFogHack : public CAutoGameSystem //----------------------------------------------------------------------------- // Purpose: Renders world and all entities, etc. //----------------------------------------------------------------------------- -void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxVisible, const CViewSetup &view, +void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxVisible, const CViewSetup &viewSetup, int nClearFlags, view_id_t viewID, bool bDrawViewModel, int baseDrawFlags, ViewCustomVisibility_t *pCustomVisibility ) { VPROF( "CViewRender::ViewDrawScene" ); @@ -1420,23 +1420,23 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV g_pClientShadowMgr->PreRender(); // Shadowed flashlights supported on ps_2_b and up... - if ( ( viewID == VIEW_MAIN ) && ( !view.m_bDrawWorldNormal ) ) + if ( ( viewID == VIEW_MAIN ) && ( !viewSetup.m_bDrawWorldNormal ) ) { // On the 360, we call this even when we don't have shadow depth textures enabled, so that // the flashlight state gets set up properly - g_pClientShadowMgr->ComputeShadowDepthTextures( view ); + g_pClientShadowMgr->ComputeShadowDepthTextures( viewSetup ); } m_BaseDrawFlags = baseDrawFlags; - SetupCurrentView( view.origin, view.angles, viewID, view.m_bDrawWorldNormal, view.m_bCullFrontFaces ); + SetupCurrentView( viewSetup.origin, viewSetup.angles, viewID, viewSetup.m_bDrawWorldNormal, viewSetup.m_bCullFrontFaces ); // Invoke pre-render methods IGameSystem::PreRenderAllSystems(); // Start view unsigned int visFlags; - SetupVis( view, visFlags, pCustomVisibility ); + SetupVis( viewSetup, visFlags, pCustomVisibility ); if ( !bDrew3dSkybox && ( nSkyboxVisible == SKYBOX_NOT_VISIBLE ) && ( visFlags & IVRenderView::VIEW_SETUP_VIS_EX_RETURN_FLAGS_USES_RADIAL_VIS ) ) @@ -1475,7 +1475,7 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV ParticleMgr()->IncrementFrameCode(); - DrawWorldAndEntities( drawSkybox, view, nClearFlags, pCustomVisibility ); + DrawWorldAndEntities( drawSkybox, viewSetup, nClearFlags, pCustomVisibility ); // Disable fog for the rest of the stuff DisableFog(); @@ -1485,13 +1485,13 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV // Here are the overlays... - if ( !view.m_bDrawWorldNormal ) + if ( !viewSetup.m_bDrawWorldNormal ) { - CGlowOverlay::DrawOverlays( view.m_bCacheFullSceneState ); + CGlowOverlay::DrawOverlays( viewSetup.m_bCacheFullSceneState ); } // issue the pixel visibility tests - if ( IsMainView( CurrentViewID() ) && !view.m_bDrawWorldNormal ) + if ( IsMainView( CurrentViewID() ) && !viewSetup.m_bDrawWorldNormal ) { PixelVisibility_EndCurrentView(); } @@ -1501,9 +1501,9 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV // Draw volumetrics for shadowed flashlights - if ( r_flashlightvolumetrics.GetBool() && (viewID != VIEW_SHADOW_DEPTH_TEXTURE) && !view.m_bDrawWorldNormal ) + if ( r_flashlightvolumetrics.GetBool() && (viewID != VIEW_SHADOW_DEPTH_TEXTURE) && !viewSetup.m_bDrawWorldNormal ) { - g_pClientShadowMgr->DrawVolumetrics( view ); + g_pClientShadowMgr->DrawVolumetrics( viewSetup ); } @@ -1511,7 +1511,7 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV engine->Sound_ExtraUpdate(); // Debugging info goes over the top - CDebugViewRender::Draw3DDebuggingInfo( view ); + CDebugViewRender::Draw3DDebuggingInfo( viewSetup ); // Draw client side effects // NOTE: These are not sorted against the rest of the frame @@ -1526,7 +1526,7 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV FinishCurrentView(); // Free shadow depth textures for use in future view - if ( ( viewID == VIEW_MAIN ) && ( !view.m_bDrawWorldNormal ) ) + if ( ( viewID == VIEW_MAIN ) && ( !viewSetup.m_bDrawWorldNormal ) ) { g_pClientShadowMgr->UnlockAllShadowDepthTextures(); } @@ -1535,7 +1535,7 @@ void CViewRender::ViewDrawScene( bool bDrew3dSkybox, SkyboxVisibility_t nSkyboxV CMatRenderContextPtr pRenderContext( materials ); pRenderContext->SetIntRenderingParameter( INT_RENDERPARM_ENABLE_FIXED_LIGHTING, 0 ); - if ( view.m_bCullFrontFaces ) + if ( viewSetup.m_bCullFrontFaces ) { pRenderContext->FlipCulling( false ); } @@ -2012,7 +2012,7 @@ void CViewRender::DisableFog( void ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CViewRender::SetupVis( const CViewSetup& view, unsigned int &visFlags, ViewCustomVisibility_t *pCustomVisibility ) +void CViewRender::SetupVis( const CViewSetup& viewSetup, unsigned int &visFlags, ViewCustomVisibility_t *pCustomVisibility ) { VPROF( "CViewRender::SetupVis" ); @@ -2024,7 +2024,7 @@ void CViewRender::SetupVis( const CViewSetup& view, unsigned int &visFlags, View else { // Use render origin as vis origin by default - render->ViewSetupVisEx( ShouldForceNoVis(), 1, &view.origin, visFlags ); + render->ViewSetupVisEx( ShouldForceNoVis(), 1, &viewSetup.origin, visFlags ); } } @@ -2100,7 +2100,7 @@ void CViewRender::DrawLetterBoxRectangles( int nSlot, const CUtlVector< vrect_t | | ----------------------------------------- */ -void CViewRender::GetLetterBoxRectangles( int nSlot, const CViewSetup &view, CUtlVector< vrect_t >& vecLetterBoxRectangles ) +void CViewRender::GetLetterBoxRectangles( int nSlot, const CViewSetup &viewSetup, CUtlVector< vrect_t >& vecLetterBoxRectangles ) { // This uses the full screen size, not the hud or 3d inset size int x, y, w, h; @@ -2111,29 +2111,29 @@ void CViewRender::GetLetterBoxRectangles( int nSlot, const CViewSetup &view, CUt vrect_t r; - int vbottom = view.y + view.height; - int vright = view.x + view.width; + int vbottom = viewSetup.y + viewSetup.height; + int vright = viewSetup.x + viewSetup.width; // HACK: Adding in one extra pixel of slop at the border with the inset here... // Need rect # 1? - if ( view.x != x ) + if ( viewSetup.x != x ) { r.x = x; r.y = y; - r.width = view.x + 1; + r.width = viewSetup.x + 1; r.height = h; vecLetterBoxRectangles.AddToTail( r ); } // Need rect # 2? - if ( view.y != y ) + if ( viewSetup.y != y ) { - r.x = view.x; + r.x = viewSetup.x; r.y = y; - r.width = view.width; - r.height = view.y + 1; + r.width = viewSetup.width; + r.height = viewSetup.y + 1; vecLetterBoxRectangles.AddToTail( r ); } @@ -2141,9 +2141,9 @@ void CViewRender::GetLetterBoxRectangles( int nSlot, const CViewSetup &view, CUt // Need rect # 3? if ( bottom != vbottom ) { - r.x = view.x; + r.x = viewSetup.x; r.y = vbottom - 1; - r.width = view.width; + r.width = viewSetup.width; r.height = bottom - vbottom + 1; vecLetterBoxRectangles.AddToTail( r ); @@ -2164,7 +2164,7 @@ void CViewRender::GetLetterBoxRectangles( int nSlot, const CViewSetup &view, CUt //----------------------------------------------------------------------------- // Sets up, cleans up the main 3D view //----------------------------------------------------------------------------- -void CViewRender::SetupMain3DView( int nSlot, const CViewSetup &view, const CViewSetup &hudViewSetup, int &nClearFlags, ITexture *pRenderTarget ) +void CViewRender::SetupMain3DView( int nSlot, const CViewSetup &viewSetup, const CViewSetup &hudViewSetup, int &nClearFlags, ITexture *pRenderTarget ) { // FIXME: I really want these fields removed from CViewSetup // and passed in as independent flags @@ -2179,7 +2179,7 @@ void CViewRender::SetupMain3DView( int nSlot, const CViewSetup &view, const CVie // See if this view needs borders CUtlVector< vrect_t > letterbox; - GetLetterBoxRectangles( nSlot, view, letterbox ); + GetLetterBoxRectangles( nSlot, viewSetup, letterbox ); if ( letterbox.Count() ) { CViewSetup letterBoxViewSetup; @@ -2198,21 +2198,21 @@ void CViewRender::SetupMain3DView( int nSlot, const CViewSetup &view, const CVie if( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_FLOAT ) { // Indicates that the render target is already HDR - if ( view.m_bHDRTarget ) + if ( viewSetup.m_bHDRTarget ) { - render->Push3DView( view, nClearFlags, pRenderTarget, GetFrustum() ); + render->Push3DView( viewSetup, nClearFlags, pRenderTarget, GetFrustum() ); } else { CMatRenderContextPtr pRenderContext( materials ); pRenderContext->SetIntRenderingParameter( INT_RENDERPARM_BACK_BUFFER_INDEX, BACK_BUFFER_INDEX_HDR ); pRenderContext.SafeRelease(); // don't want to hold for long periods in case in a locking active share thread mode - render->Push3DView( view, nClearFlags, NULL, GetFrustum() ); + render->Push3DView( viewSetup, nClearFlags, NULL, GetFrustum() ); } } else { - render->Push3DView( view, nClearFlags, NULL, GetFrustum() ); + render->Push3DView( viewSetup, nClearFlags, NULL, GetFrustum() ); } // If we didn't clear the depth here, we'll need to clear it later @@ -2224,7 +2224,7 @@ void CViewRender::SetupMain3DView( int nSlot, const CViewSetup &view, const CVie } } -void CViewRender::CleanupMain3DView( const CViewSetup &view ) +void CViewRender::CleanupMain3DView( const CViewSetup &viewSetup ) { // Make sure we reset from the HDR rendertarget back to the main backbuffer if( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_FLOAT ) @@ -2241,13 +2241,13 @@ void CViewRender::CleanupMain3DView( const CViewSetup &view ) //----------------------------------------------------------------------------- // Queues up an overlay rendering //----------------------------------------------------------------------------- -void CViewRender::QueueOverlayRenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) +void CViewRender::QueueOverlayRenderView( const CViewSetup &viewSetup, int nClearFlags, int whatToDraw ) { // Can't have 2 in a single scene Assert( !m_bDrawOverlay ); m_bDrawOverlay = true; - m_OverlayViewSetup = view; + m_OverlayViewSetup = viewSetup; m_OverlayClearFlags = nClearFlags; m_OverlayDrawFlags = whatToDraw; } @@ -2279,15 +2279,15 @@ void CViewRender::FreezeFrame( float flFreezeTime ) } } -void PositionHudPanels( CUtlVector< vgui::VPANEL > &list, const CViewSetup &view ) +void PositionHudPanels( CUtlVector< vgui::VPANEL > &list, const CViewSetup &viewSetup ) { for ( int i = 0; i < list.Count(); ++i ) { vgui::VPANEL root = list[ i ]; if ( root != 0 ) { - vgui::ipanel()->SetPos( root, view.x, view.y ); - vgui::ipanel()->SetSize( root, view.width, view.height ); + vgui::ipanel()->SetPos( root, viewSetup.x, viewSetup.y ); + vgui::ipanel()->SetSize( root, viewSetup.width, viewSetup.height ); } } } @@ -2299,14 +2299,14 @@ void PositionHudPanels( CUtlVector< vgui::VPANEL > &list, const CViewSetup &view // whatToDraw - //----------------------------------------------------------------------------- // This renders the entire 3D view. -void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw ) +void CViewRender::RenderView( const CViewSetup &viewSetup, const CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw ) { m_UnderWaterOverlayMaterial.Shutdown(); // underwater view will set ASSERT_LOCAL_PLAYER_RESOLVABLE(); int slot = GET_ACTIVE_SPLITSCREEN_SLOT(); - m_CurrentView = view; + m_CurrentView = viewSetup; if ( building_cubemaps.GetBool() ) m_CurrentView.fov = RAD2DEG( 2.0f * atanf( 64.0f / ( 64 - 0.5f ) ) ); @@ -2337,7 +2337,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS if ( !m_FreezeParams[ slot ].m_bTakeFreezeFrame && m_FreezeParams[ slot ].m_flFreezeFrameUntil > gpGlobals->curtime ) { CRefPtr pFreezeFrameView = new CFreezeFrameView( this ); - pFreezeFrameView->Setup( view ); + pFreezeFrameView->Setup( viewSetup ); AddViewToScene( pFreezeFrameView ); g_bRenderingView = true; @@ -2351,7 +2351,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS if ( cl_drawmonitors.GetBool() && ( ( whatToDraw & RENDERVIEW_SUPPRESSMONITORRENDERING ) == 0 ) ) { - DrawMonitors( view ); + DrawMonitors( viewSetup ); } #endif @@ -2359,7 +2359,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS g_bRenderingView = true; - RenderPreScene( view ); + RenderPreScene( viewSetup ); // Must be first render->SceneBegin(); @@ -2370,7 +2370,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS UpdateMaterialSystemTonemapScalar(); // clear happens here probably - SetupMain3DView( slot, view, hudViewSetup, nClearFlags, saveRenderTarget ); + SetupMain3DView( slot, viewSetup, hudViewSetup, nClearFlags, saveRenderTarget ); g_pClientShadowMgr->UpdateSplitscreenLocalPlayerShadowSkip(); @@ -2378,7 +2378,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS SkyboxVisibility_t nSkyboxVisible = SKYBOX_NOT_VISIBLE; // Don't bother with the skybox if we're drawing an ND buffer for the SFM - if ( !view.m_bDrawWorldNormal ) + if ( !viewSetup.m_bDrawWorldNormal ) { // if the 3d skybox world is drawn, then don't draw the normal skybox if ( true ) // For pix event @@ -2391,7 +2391,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS #endif CSkyboxView *pSkyView = new CSkyboxView( this ); - if ( ( bDrew3dSkybox = pSkyView->Setup( view, &nClearFlags, &nSkyboxVisible ) ) != false ) + if ( ( bDrew3dSkybox = pSkyView->Setup( viewSetup, &nClearFlags, &nSkyboxVisible ) ) != false ) { AddViewToScene( pSkyView ); } @@ -2403,13 +2403,13 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS if ( ( nClearFlags & VIEW_CLEAR_COLOR ) == 0 ) { MDLCACHE_CRITICAL_SECTION(); - if ( enginetrace->GetPointContents( view.origin ) == CONTENTS_SOLID ) + if ( enginetrace->GetPointContents( viewSetup.origin ) == CONTENTS_SOLID ) { nClearFlags |= VIEW_CLEAR_COLOR; } } - PreViewDrawScene( view ); + PreViewDrawScene( viewSetup ); // Render world and all entities, particles, etc. if( !g_pIntroData ) @@ -2420,7 +2420,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS PIXEVENT( pRenderContext, "ViewDrawScene()" ); } #endif - ViewDrawScene( bDrew3dSkybox, nSkyboxVisible, view, nClearFlags, VIEW_MAIN, whatToDraw & RENDERVIEW_DRAWVIEWMODEL ); + ViewDrawScene( bDrew3dSkybox, nSkyboxVisible, viewSetup, nClearFlags, VIEW_MAIN, whatToDraw & RENDERVIEW_DRAWVIEWMODEL ); } else { @@ -2430,13 +2430,13 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS PIXEVENT( pRenderContext, "ViewDrawScene_Intro()" ); } #endif - ViewDrawScene_Intro( view, nClearFlags, *g_pIntroData ); + ViewDrawScene_Intro( viewSetup, nClearFlags, *g_pIntroData ); } // We can still use the 'current view' stuff set up in ViewDrawScene AllowCurrentViewAccess( true ); - PostViewDrawScene( view ); + PostViewDrawScene( viewSetup ); engine->DrawPortals(); @@ -2466,17 +2466,17 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS pRenderContext.GetFrom( materials ); { PIXEVENT( pRenderContext, "DoDepthOfField()" ); - DoDepthOfField( view ); + DoDepthOfField( viewSetup ); } pRenderContext.SafeRelease(); } - if ( ( view.m_nMotionBlurMode != MOTION_BLUR_DISABLE ) && ( mat_motion_blur_enabled.GetInt() ) ) + if ( ( viewSetup.m_nMotionBlurMode != MOTION_BLUR_DISABLE ) && ( mat_motion_blur_enabled.GetInt() ) ) { pRenderContext.GetFrom( materials ); { PIXEVENT( pRenderContext, "DoImageSpaceMotionBlur()" ); - DoImageSpaceMotionBlur( view ); + DoImageSpaceMotionBlur( viewSetup ); } pRenderContext.SafeRelease(); } @@ -2491,7 +2491,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS #endif // Now actually draw the viewmodel - DrawViewModels( view, whatToDraw & RENDERVIEW_DRAWVIEWMODEL ); + DrawViewModels( viewSetup, whatToDraw & RENDERVIEW_DRAWVIEWMODEL ); DrawUnderwaterOverlay(); @@ -2517,7 +2517,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS DrawSmokeFogOverlay(); // Overlay screen fade on entire screen - PerformScreenOverlay( view.x, view.y, view.width, view.height ); + PerformScreenOverlay( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); // Prevent sound stutter if going slow engine->Sound_ExtraUpdate(); @@ -2529,7 +2529,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS pRenderContext.SafeRelease(); } - if ( !building_cubemaps.GetBool() && view.m_bDoBloomAndToneMapping ) + if ( !building_cubemaps.GetBool() && viewSetup.m_bDoBloomAndToneMapping ) { pRenderContext.GetFrom( materials ); { @@ -2552,7 +2552,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS { bFlashlightIsOn = pLocal->IsEffectActive( EF_DIMLIGHT ); } - DoEnginePostProcessing( view.x, view.y, view.width, view.height, bFlashlightIsOn ); + DoEnginePostProcessing( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height, bFlashlightIsOn ); } pRenderContext.SafeRelease(); } @@ -2562,10 +2562,10 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS if ( IsPC() ) { // Grab the pre-color corrected frame for editing purposes - engine->GrabPreColorCorrectedFrame( view.x, view.y, view.width, view.height ); + engine->GrabPreColorCorrectedFrame( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); } - PerformScreenSpaceEffects( view.x, view.y, view.width, view.height ); + PerformScreenSpaceEffects( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); #if defined( _X360 ) @@ -2576,9 +2576,9 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS } #endif - GetClientMode()->DoPostScreenSpaceEffects( &view ); + GetClientMode()->DoPostScreenSpaceEffects( &viewSetup ); - CleanupMain3DView( view ); + CleanupMain3DView( viewSetup ); if ( m_FreezeParams[ slot ].m_bTakeFreezeFrame ) { @@ -2618,8 +2618,8 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS // Clear a row of pixels at the edge of the viewport if it isn't at the edge of the screen if ( VGui_IsSplitScreen() ) { - CMatRenderContextPtr pRenderContext( materials ); - pRenderContext->PushRenderTargetAndViewport(); + CMatRenderContextPtr pRenderCtx( materials ); + pRenderCtx->PushRenderTargetAndViewport(); int nScreenWidth, nScreenHeight; g_pMaterialSystem->GetBackBufferDimensions( nScreenWidth, nScreenHeight ); @@ -2627,36 +2627,36 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS // NOTE: view.height is off by 1 on the PC in a release build, but debug is correct! I'm leaving this here to help track this down later. // engine->Con_NPrintf( 25 + hh, "view( %d, %d, %d, %d ) GetBackBufferDimensions( %d, %d )\n", view.x, view.y, view.width, view.height, nScreenWidth, nScreenHeight ); - if ( view.x != 0 ) // if left of viewport isn't at 0 + if ( viewSetup.x != 0 ) // if left of viewport isn't at 0 { - pRenderContext->Viewport( view.x, view.y, 1, view.height ); - pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, false ); + pRenderCtx->Viewport( viewSetup.x, viewSetup.y, 1, viewSetup.height ); + pRenderCtx->ClearColor3ub( 0, 0, 0 ); + pRenderCtx->ClearBuffers( true, false ); } - if ( ( view.x + view.width ) != nScreenWidth ) // if right of viewport isn't at edge of screen + if ( ( viewSetup.x + viewSetup.width ) != nScreenWidth ) // if right of viewport isn't at edge of screen { - pRenderContext->Viewport( view.x + view.width - 1, view.y, 1, view.height ); - pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, false ); + pRenderCtx->Viewport( viewSetup.x + viewSetup.width - 1, viewSetup.y, 1, viewSetup.height ); + pRenderCtx->ClearColor3ub( 0, 0, 0 ); + pRenderCtx->ClearBuffers( true, false ); } - if ( view.y != 0 ) // if top of viewport isn't at 0 + if ( viewSetup.y != 0 ) // if top of viewport isn't at 0 { - pRenderContext->Viewport( view.x, view.y, view.width, 1 ); - pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, false ); + pRenderCtx->Viewport( viewSetup.x, viewSetup.y, viewSetup.width, 1 ); + pRenderCtx->ClearColor3ub( 0, 0, 0 ); + pRenderCtx->ClearBuffers( true, false ); } - if ( ( view.y + view.height ) != nScreenHeight ) // if bottom of viewport isn't at edge of screen + if ( ( viewSetup.y + viewSetup.height ) != nScreenHeight ) // if bottom of viewport isn't at edge of screen { - pRenderContext->Viewport( view.x, view.y + view.height - 1, view.width, 1 ); - pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, false ); + pRenderCtx->Viewport( viewSetup.x, viewSetup.y + viewSetup.height - 1, viewSetup.width, 1 ); + pRenderCtx->ClearColor3ub( 0, 0, 0 ); + pRenderCtx->ClearBuffers( true, false ); } - pRenderContext->PopRenderTargetAndViewport(); - pRenderContext->Release(); + pRenderCtx->PopRenderTargetAndViewport(); + pRenderCtx->Release(); } // Draw the 2D graphics @@ -2728,7 +2728,7 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS g_WorldListCache.Flush(); - m_CurrentView = view; + m_CurrentView = viewSetup; } @@ -2736,14 +2736,14 @@ void CViewRender::RenderView( const CViewSetup &view, const CViewSetup &hudViewS //----------------------------------------------------------------------------- // Purpose: Renders extra 2D effects in derived classes while the 2D view is on the stack //----------------------------------------------------------------------------- -void CViewRender::Render2DEffectsPreHUD( const CViewSetup &view ) +void CViewRender::Render2DEffectsPreHUD( const CViewSetup &viewSetup ) { } //----------------------------------------------------------------------------- // Purpose: Renders extra 2D effects in derived classes while the 2D view is on the stack //----------------------------------------------------------------------------- -void CViewRender::Render2DEffectsPostHUD( const CViewSetup &view ) +void CViewRender::Render2DEffectsPostHUD( const CViewSetup &viewSetup ) { } @@ -3064,7 +3064,7 @@ void CViewRender::GetWaterLODParams( float &flCheapWaterStartDistance, float &fl // Input : &view - // &introData - //----------------------------------------------------------------------------- -void CViewRender::ViewDrawScene_Intro( const CViewSetup &view, int nClearFlags, const IntroData_t &introData ) +void CViewRender::ViewDrawScene_Intro( const CViewSetup &viewSetup, int nClearFlags, const IntroData_t &introData ) { VPROF( "CViewRender::ViewDrawScene" ); @@ -3091,12 +3091,12 @@ void CViewRender::ViewDrawScene_Intro( const CViewSetup &view, int nClearFlags, if( introData.m_bDrawPrimary ) { - CViewSetup playerView( view ); + CViewSetup playerView( viewSetup ); playerView.origin = introData.m_vecCameraView; playerView.angles = introData.m_vecCameraViewAngles; if ( introData.m_playerViewFOV ) { - playerView.fov = ScaleFOVByWidthRatio( introData.m_playerViewFOV, engine->GetScreenAspectRatio( view.width, view.height ) / ( 4.0f / 3.0f ) ); + playerView.fov = ScaleFOVByWidthRatio( introData.m_playerViewFOV, engine->GetScreenAspectRatio( viewSetup.width, viewSetup.height ) / ( 4.0f / 3.0f ) ); } g_pClientShadowMgr->PreRender(); @@ -3130,33 +3130,33 @@ void CViewRender::ViewDrawScene_Intro( const CViewSetup &view, int nClearFlags, pRenderContext->ClearBuffers( true, true ); } Rect_t actualRect; - UpdateScreenEffectTexture( 0, view.x, view.y, view.width, view.height, false, &actualRect ); + UpdateScreenEffectTexture( 0, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height, false, &actualRect ); g_pClientShadowMgr->PreRender(); // Shadowed flashlights supported on ps_2_b and up... if ( r_flashlightdepthtexture.GetBool() ) { - g_pClientShadowMgr->ComputeShadowDepthTextures( view ); + g_pClientShadowMgr->ComputeShadowDepthTextures( viewSetup ); } // ----------------------------------------------------------------------- // Draw the secondary scene and copy it to the second framebuffer texture // ----------------------------------------------------------------------- - SetupCurrentView( view.origin, view.angles, VIEW_INTRO_CAMERA ); + SetupCurrentView( viewSetup.origin, viewSetup.angles, VIEW_INTRO_CAMERA ); // Invoke pre-render methods IGameSystem::PreRenderAllSystems(); // Start view, clear frame/z buffer if necessary - SetupVis( view, visFlags ); + SetupVis( viewSetup, visFlags ); // Clear alpha to 255 so that masking with the vortigaunts (0) works properly. pRenderContext->ClearColor4ub( 0, 0, 0, 255 ); - DrawWorldAndEntities( true /* drawSkybox */, view, VIEW_CLEAR_COLOR | VIEW_CLEAR_DEPTH ); + DrawWorldAndEntities( true /* drawSkybox */, viewSetup, VIEW_CLEAR_COLOR | VIEW_CLEAR_DEPTH ); - UpdateScreenEffectTexture( 1, view.x, view.y, view.width, view.height ); + UpdateScreenEffectTexture( 1, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); // ----------------------------------------------------------------------- // Draw quads on the screen for each screenspace pass. @@ -3197,7 +3197,7 @@ void CViewRender::ViewDrawScene_Intro( const CViewSetup &view, int nClearFlags, // Draw a quad for this pass. ITexture *pTexture = GetFullFrameFrameBufferTexture( 0 ); - pRenderContext->DrawScreenSpaceRectangle( pOverlayMaterial, view.x, view.y, view.width, view.height, + pRenderContext->DrawScreenSpaceRectangle( pOverlayMaterial, viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height, actualRect.x, actualRect.y, actualRect.x+actualRect.width-1, actualRect.y+actualRect.height-1, pTexture->GetActualWidth(), pTexture->GetActualHeight() ); } @@ -3216,19 +3216,19 @@ void CViewRender::ViewDrawScene_Intro( const CViewSetup &view, int nClearFlags, DisableFog(); // Here are the overlays... - CGlowOverlay::DrawOverlays( view.m_bCacheFullSceneState ); + CGlowOverlay::DrawOverlays( viewSetup.m_bCacheFullSceneState ); // issue the pixel visibility tests PixelVisibility_EndCurrentView(); // And here are the screen-space effects - PerformScreenSpaceEffects( view.x, view.y, view.width, view.height ); + PerformScreenSpaceEffects( viewSetup.x, viewSetup.y, viewSetup.width, viewSetup.height ); // Make sure sound doesn't stutter engine->Sound_ExtraUpdate(); // Debugging info goes over the top - CDebugViewRender::Draw3DDebuggingInfo( view ); + CDebugViewRender::Draw3DDebuggingInfo( viewSetup ); // Let the particle manager simulate things that haven't been simulated. ParticleMgr()->PostRender(); @@ -5069,9 +5069,9 @@ void CSkyboxView::DrawInternal( view_id_t iSkyBoxViewID, bool bInvokePreAndPostR //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- -bool CSkyboxView::Setup( const CViewSetup &view, int *pClearFlags, SkyboxVisibility_t *pSkyboxVisible ) +bool CSkyboxView::Setup( const CViewSetup &viewSetup, int *pClearFlags, SkyboxVisibility_t *pSkyboxVisible ) { - BaseClass::Setup( view ); + BaseClass::Setup( viewSetup ); // The skybox might not be visible from here *pSkyboxVisible = ComputeSkyboxVisibility(); @@ -5558,9 +5558,9 @@ void CBaseWorldView::DrawExecute( float waterHeight, view_id_t viewID, float wat //----------------------------------------------------------------------------- // Draws the scene when there's no water or only cheap water //----------------------------------------------------------------------------- -void CSimpleWorldView::Setup( const CViewSetup &view, int nClearFlags, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t &waterInfo, ViewCustomVisibility_t *pCustomVisibility ) +void CSimpleWorldView::Setup( const CViewSetup &viewSetup, int nClearFlags, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t &waterInfo, ViewCustomVisibility_t *pCustomVisibility ) { - BaseClass::Setup( view ); + BaseClass::Setup( viewSetup ); m_ClearFlags = nClearFlags; m_DrawFlags = DF_DRAW_ENTITITES; @@ -5708,9 +5708,9 @@ void CBaseWaterView::CSoftwareIntersectionView::Draw() //----------------------------------------------------------------------------- // Draws the scene when the view point is above the level of the water //----------------------------------------------------------------------------- -void CAboveWaterView::Setup( const CViewSetup &view, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t& waterInfo ) +void CAboveWaterView::Setup( const CViewSetup &viewSetup, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t& waterInfo ) { - BaseClass::Setup( view ); + BaseClass::Setup( viewSetup ); m_bSoftwareUserClipPlane = g_pMaterialSystemHardwareConfig->UseFastClipping(); @@ -5946,9 +5946,9 @@ void CAboveWaterView::CIntersectionView::Draw() //----------------------------------------------------------------------------- // Draws the scene when the view point is under the level of the water //----------------------------------------------------------------------------- -void CUnderWaterView::Setup( const CViewSetup &view, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t& waterInfo ) +void CUnderWaterView::Setup( const CViewSetup &viewSetup, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t& waterInfo ) { - BaseClass::Setup( view ); + BaseClass::Setup( viewSetup ); m_bSoftwareUserClipPlane = g_pMaterialSystemHardwareConfig->UseFastClipping(); @@ -6091,10 +6091,10 @@ void CUnderWaterView::CRefractionView::Draw() //----------------------------------------------------------------------------- // Draws the scene when the view contains reflective glass //----------------------------------------------------------------------------- -void CReflectiveGlassView::Setup( const CViewSetup &view, int nClearFlags, bool bDrawSkybox, +void CReflectiveGlassView::Setup( const CViewSetup &viewSetup, int nClearFlags, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t &waterInfo, const cplane_t &reflectionPlane ) { - BaseClass::Setup( view, nClearFlags, bDrawSkybox, fogInfo, waterInfo, NULL ); + BaseClass::Setup( viewSetup, nClearFlags, bDrawSkybox, fogInfo, waterInfo, NULL ); m_ReflectionPlane = reflectionPlane; } @@ -6172,10 +6172,10 @@ void CReflectiveGlassView::Draw() //----------------------------------------------------------------------------- // Draws the scene when the view contains reflective glass //----------------------------------------------------------------------------- -void CRefractiveGlassView::Setup( const CViewSetup &view, int nClearFlags, bool bDrawSkybox, +void CRefractiveGlassView::Setup( const CViewSetup &viewSetup, int nClearFlags, bool bDrawSkybox, const VisibleFogVolumeInfo_t &fogInfo, const WaterRenderInfo_t &waterInfo, const cplane_t &reflectionPlane ) { - BaseClass::Setup( view, nClearFlags, bDrawSkybox, fogInfo, waterInfo, NULL ); + BaseClass::Setup( viewSetup, nClearFlags, bDrawSkybox, fogInfo, waterInfo, NULL ); m_ReflectionPlane = reflectionPlane; } diff --git a/src/game/missionchooser/layout_system/tilegen_class_factories.h b/src/game/missionchooser/layout_system/tilegen_class_factories.h index 91d965d60..502cbc16d 100644 --- a/src/game/missionchooser/layout_system/tilegen_class_factories.h +++ b/src/game/missionchooser/layout_system/tilegen_class_factories.h @@ -64,22 +64,22 @@ ITilegenExpression< const char * > *ReadLiteralStringValue( KeyValues *pKeyValue // Class factory specializations to handle parsing literal values... -ITilegenExpression< int > *ITilegenClassFactory< ITilegenExpression< int > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< int > *ITilegenClassFactory< ITilegenExpression< int > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralIntValue( pKeyValues ); } -ITilegenExpression< bool > *ITilegenClassFactory< ITilegenExpression< bool > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< bool > *ITilegenClassFactory< ITilegenExpression< bool > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralBoolValue( pKeyValues ); } -ITilegenExpression< float > *ITilegenClassFactory< ITilegenExpression< float > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< float > *ITilegenClassFactory< ITilegenExpression< float > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralFloatValue( pKeyValues ); } -ITilegenExpression< char const * > *ITilegenClassFactory< ITilegenExpression< char const * > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< char const * > *ITilegenClassFactory< ITilegenExpression< char const * > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralStringValue( pKeyValues ); } diff --git a/src/game/missionchooser/layout_system/tilegen_expressions.h b/src/game/missionchooser/layout_system/tilegen_expressions.h index 71add7d7f..c38ca2740 100644 --- a/src/game/missionchooser/layout_system/tilegen_expressions.h +++ b/src/game/missionchooser/layout_system/tilegen_expressions.h @@ -78,8 +78,8 @@ class CTilegenExpression_Binary : public ITilegenExpression< TReturn > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { bool bSuccess = true; - bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param0", GetTypeName(), &m_pExpression[0] ); - bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param1", GetTypeName(), &m_pExpression[1] ); + bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param0", this->GetTypeName(), &m_pExpression[0] ); + bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param1", this->GetTypeName(), &m_pExpression[1] ); return bSuccess; } @@ -244,7 +244,7 @@ class CTilegenExpression_Unary : public ITilegenExpression< TReturn > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { - return CreateExpressionFromKeyValuesBlock( pKeyValues, "param", GetTypeName(), &m_pExpression ); + return CreateExpressionFromKeyValuesBlock( pKeyValues, "param", this->GetTypeName(), &m_pExpression ); } virtual TReturn Evaluate( CFreeVariableMap *pContext ) { return DirectEvaluate( pContext, m_pExpression->Evaluate( pContext ) ); } @@ -651,7 +651,7 @@ class CTilegenExpression_Variable : public ITilegenExpression< TValue > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { - if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "variable", GetTypeName(), &m_pVariableNameExpression ) ) + if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "variable", this->GetTypeName(), &m_pVariableNameExpression ) ) { Log_Warning( LOG_TilegenLayoutSystem, "No variable specified for CTilegenExpression_Variable in key values.\n" ); return false; @@ -751,19 +751,19 @@ class CTilegenExpression_MapReduce : public ITilegenExpression< TMapOutput > if ( pRangeExpressionKV != NULL ) { - if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "range_expression", GetTypeName(), &m_pInputRangeExpression ) ) + if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "range_expression", this->GetTypeName(), &m_pInputRangeExpression ) ) return false; } else if ( pRangeKV != NULL) { - if ( !CreateRangeFromKeyValuesBlock( pKeyValues, "range", GetTypeName(), &m_pInputRange ) ) + if ( !CreateRangeFromKeyValuesBlock( pKeyValues, "range", this->GetTypeName(), &m_pInputRange ) ) return false; } } if ( m_pMapFunction == NULL ) { - if ( !CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "map", GetTypeName(), &m_pMapFunction ) ) + if ( !CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "map", this->GetTypeName(), &m_pMapFunction ) ) return false; } @@ -771,7 +771,7 @@ class CTilegenExpression_MapReduce : public ITilegenExpression< TMapOutput > { ITilegenExpression< TMapOutput > *pReduceFunction = NULL; // Create an empty instance of the binary function since we will never call Evaluate on it (just DirectEvaluate) - CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "reduce", GetTypeName(), &pReduceFunction, false, true ); + CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "reduce", this->GetTypeName(), &pReduceFunction, false, true ); m_pReduceFunction = static_cast< CTilegenExpression_Multi< TMapOutput > * >( pReduceFunction ); } @@ -855,7 +855,7 @@ class CTilegenExpression_CountRange : public CTilegenExpression_MapReduce< int, { public: CTilegenExpression_CountRange( ITilegenRange< TInput > *pRange = NULL ) : - CTilegenExpression_MapReduce( pRange, new CTilegenExpression_LiteralInt( 1 ), new CTilegenExpression_Add(), "$$unused" ) + CTilegenExpression_MapReduce< int, TInput >( pRange, new CTilegenExpression_LiteralInt( 1 ), new CTilegenExpression_Add(), "$$unused" ) { } }; diff --git a/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj b/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj index ff5fc5140..aa6f81375 100644 --- a/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj +++ b/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj @@ -1,4 +1,4 @@ - + @@ -124,6 +124,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -231,6 +232,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -338,6 +340,7 @@ exit /b 0 26495;26812 true false + stdcpp20 true true diff --git a/src/game/server/CommentarySystem.cpp b/src/game/server/CommentarySystem.cpp index 3339a2277..8c796c9da 100644 --- a/src/game/server/CommentarySystem.cpp +++ b/src/game/server/CommentarySystem.cpp @@ -1102,7 +1102,7 @@ bool IsListeningToCommentary( void ) void CPointCommentaryNode::Spawn( void ) { // No model specified? - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/extras/info_speech.mdl"; diff --git a/src/game/server/ai_basenpc.cpp b/src/game/server/ai_basenpc.cpp index 66f5cf568..12108622e 100644 --- a/src/game/server/ai_basenpc.cpp +++ b/src/game/server/ai_basenpc.cpp @@ -1189,7 +1189,7 @@ void CAI_BaseNPC::DecalTrace( trace_t *pTrace, char const *decalName ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { if ( m_fNoDamageDecal ) { diff --git a/src/game/server/ai_basenpc.h b/src/game/server/ai_basenpc.h index 5b2fd6915..d31a0a175 100644 --- a/src/game/server/ai_basenpc.h +++ b/src/game/server/ai_basenpc.h @@ -1826,7 +1826,7 @@ class CAI_BaseNPC : public CBaseCombatCharacter, virtual float GetHitgroupDamageMultiplier( int iHitGroup, const CTakeDamageInfo &info ); void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); void DecalTrace( trace_t *pTrace, char const *decalName ); - void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool PlayerInSpread( const Vector &sourcePos, const Vector &targetPos, float flSpread, float maxDistOffCenter, bool ignoreHatedPlayers = true ); CBaseEntity * PlayerInRange( const Vector &vecLocation, float flDist ); bool PointInSpread( CBaseCombatCharacter *pCheckEntity, const Vector &sourcePos, const Vector &targetPos, const Vector &testPoint, float flSpread, float maxDistOffCenter ); @@ -2449,7 +2449,7 @@ typedef CHandle AIHANDLE; #define DEFINE_SCHEDULE( id, text ) \ scheduleIds.PushBack( #id, id ); \ - char * g_psz##id = \ + const char * g_psz##id = \ "\n Schedule" \ "\n " #id \ text \ diff --git a/src/game/server/ai_behavior_lead.cpp b/src/game/server/ai_behavior_lead.cpp index c3813b44a..c67b0b974 100644 --- a/src/game/server/ai_behavior_lead.cpp +++ b/src/game/server/ai_behavior_lead.cpp @@ -991,7 +991,7 @@ void CAI_LeadBehavior::RunTask( const Task_t *pTask ) //------------------------------------- -bool CAI_LeadBehavior::Speak( AIConcept_t concept ) +bool CAI_LeadBehavior::Speak( AIConcept_t conceptName ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( !pExpresser ) @@ -1002,7 +1002,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) return false; // If we haven't said the start speech, don't nag - bool bNag = ( FStrEq(concept,TLK_LEAD_COMINGBACK) || FStrEq(concept, TLK_LEAD_CATCHUP) || FStrEq(concept, TLK_LEAD_RETRIEVE) ); + bool bNag = ( FStrEq(conceptName,TLK_LEAD_COMINGBACK) || FStrEq(conceptName, TLK_LEAD_CATCHUP) || FStrEq(conceptName, TLK_LEAD_RETRIEVE) ); if ( !m_hasspokenstart && bNag ) return false; @@ -1013,7 +1013,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) // We ignore nag timers for this, because the response rules will control refire rates. CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly ) - return pAlly->SpeakIfAllowed( concept, GetConceptModifiers( concept ) ); + return pAlly->SpeakIfAllowed( conceptName, GetConceptModifiers( conceptName ) ); } // Don't spam Nags @@ -1026,7 +1026,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) } } - if ( pExpresser->Speak( concept, GetConceptModifiers( concept ) ) ) + if ( pExpresser->Speak( conceptName, GetConceptModifiers( conceptName ) ) ) { m_flSpeakNextNagTime = gpGlobals->curtime + LEAD_NAG_TIME; return true; diff --git a/src/game/server/ai_behavior_lead.h b/src/game/server/ai_behavior_lead.h index 7e7a49125..8a945eb19 100644 --- a/src/game/server/ai_behavior_lead.h +++ b/src/game/server/ai_behavior_lead.h @@ -184,7 +184,7 @@ class CAI_LeadBehavior : public CAI_SimpleBehavior bool GetClosestPointOnRoute( const Vector &targetPos, Vector *pVecClosestPoint ); bool PlayerIsAheadOfMe( bool bForce = false ); - bool Speak( AIConcept_t concept ); + bool Speak( AIConcept_t conceptName ); bool IsSpeaking(); // -------------------------------- diff --git a/src/game/server/ai_behavior_passenger.cpp b/src/game/server/ai_behavior_passenger.cpp index f8f4d62d2..0a68eb8a4 100644 --- a/src/game/server/ai_behavior_passenger.cpp +++ b/src/game/server/ai_behavior_passenger.cpp @@ -1560,12 +1560,12 @@ void CAI_PassengerBehavior::SetTransitionSequence( int nSequence ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t concept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) +bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) { // FIXME: Store this cast off? CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly != NULL ) - return pAlly->SpeakIfAllowed( concept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); + return pAlly->SpeakIfAllowed( conceptName, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); return false; } diff --git a/src/game/server/ai_behavior_passenger.h b/src/game/server/ai_behavior_passenger.h index 2a83e0e8a..010816542 100644 --- a/src/game/server/ai_behavior_passenger.h +++ b/src/game/server/ai_behavior_passenger.h @@ -149,7 +149,7 @@ class CAI_PassengerBehavior : public CAI_SimpleBehavior virtual int SelectTransitionSchedule( void ); - bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + bool SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); bool CanExitVehicle( void ); void SetTransitionSequence( int nSequence ); diff --git a/src/game/server/ai_expresserfollowup.cpp b/src/game/server/ai_expresserfollowup.cpp index 3d98f4080..8f4ea918d 100644 --- a/src/game/server/ai_expresserfollowup.cpp +++ b/src/game/server/ai_expresserfollowup.cpp @@ -102,9 +102,9 @@ static void DispatchComeback( CAI_ExpresserWithFollowup *pExpress, CBaseEntity * // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - AI_Response *result = SpeakFindResponse( concept, modifiers ); + AI_Response *result = SpeakFindResponse( conceptName, modifiers ); if ( !result ) { return false; @@ -151,14 +151,14 @@ static CBaseEntity *AscertainSpeechSubjectFromContext( AI_Response *response, AI } // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &conceptName, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) { if ( Q_stricmp(szTarget, "self") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, conceptName.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "subject") == 0 ) { @@ -170,7 +170,7 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo } else if ( Q_stricmp(szTarget, "any") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, conceptName.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "all") == 0 ) { @@ -189,20 +189,20 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &conceptName, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) { const char * RESTRICT szTarget = followup->followup_target; const CResponseQueue::CFollowupTargetSpec_t INVALID; // default: invalid result if ( szTarget == NULL ) return INVALID; else - return ResolveFollowupTargetToEntity( concept, criteria, szTarget, response ); + return ResolveFollowupTargetToEntity( conceptName, criteria, szTarget, response ); } ConVar chet_debug_idle( "chet_debug_idle", "0", FCVAR_NONE, "If set one, many debug prints to help track down the TLK_IDLE issue. Set two for super verbose info" ); // extern ConVar chet_debug_idle; -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -210,12 +210,12 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifie return false; } - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, conceptName, modifiers); GetOuter()->ModifyOrAppendDerivedCriteria(criteria); AI_Response result; - if ( !FindResponse( result, concept, &criteria ) ) + if ( !FindResponse( result, conceptName, &criteria ) ) { if (chet_debug_idle.GetBool()) { @@ -238,10 +238,10 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifie } } - SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); + SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)conceptName, gpGlobals->curtime ); // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, &criteria, filter ); + bool spoke = SpeakDispatchResponse( conceptName, &result, &criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -273,16 +273,16 @@ static float GetSpeechDurationForResponse( const AI_Response * RESTRICT response // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) +bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) { // This gives the chance for the other bot to respond. - if ( !concept.GetSpeaker().IsValid() ) + if ( !conceptName.GetSpeaker().IsValid() ) { - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); } bool bInterrupted = IsSpeaking(); - bool bSuc = CAI_Expresser::SpeakDispatchResponse( concept, response, criteria, filter ); + bool bSuc = CAI_Expresser::SpeakDispatchResponse( conceptName, response, criteria, filter ); if (!bSuc) { return false; @@ -320,7 +320,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ if ( fTimeToLastSpeech > 0 ) { DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), fTimeToLastSpeech + followup->followup_delay, GetOuter() ); } else // error @@ -328,11 +328,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // old way, copied from "else" below m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -346,14 +346,14 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // In this case we do not need to postpone the followup; we just throw it directly // into the queue. DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), -followup->followup_delay, GetOuter() ); } else if ( response->GetType() == ResponseRules::RESPONSE_PRINT ) { // zero-duration responses dispatch immediately via the queue (must be the queue bec. // the m_pPostponedFollowup will never trigger) DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), followup->followup_delay, GetOuter() ); } else @@ -363,11 +363,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // 5.13.08 egr m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -381,7 +381,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // for "this many seconds after the beginning of the line" rather than "this may seconds after the end // of the line", eg to create a THEN rule when two characters talk over each other. // It's static to avoid accidental use of the postponed followup/target members. -void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &concept, +void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &conceptName, const char * RESTRICT criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, @@ -394,7 +394,7 @@ void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t criteria.AppendCriteria( "From", STRING( pOuter->GetEntityName() ) ); criteria.Merge( criteriaStr ); - g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, target, pOuter ); + g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, gpGlobals->curtime + delay, target, pOuter ); } //----------------------------------------------------------------------------- @@ -450,8 +450,8 @@ void CC_RR_ForceConcept_f( const CCommand &args ) criteria.Merge( criteriastring ); } - AIConcept_t concept( args[2] ); - QueueSpeak( concept, ResolveFollowupTargetToEntity( concept, criteria, args[1] ), criteria ); + AIConcept_t conceptName( args[2] ); + QueueSpeak( conceptName, ResolveFollowupTargetToEntity( conceptName, criteria, args[1] ), criteria ); } diff --git a/src/game/server/ai_network.cpp b/src/game/server/ai_network.cpp index fe37e7e39..9025c3f47 100644 --- a/src/game/server/ai_network.cpp +++ b/src/game/server/ai_network.cpp @@ -292,7 +292,7 @@ int CAI_Network::NearestNodeToPoint( CAI_BaseNPC *pNPC, const Vector &vecOrigin, if ( cachedNode != NO_NODE && ( !pFilter || pFilter->IsValid( m_pAInode[cachedNode] ) ) ) { - m_NearestCache[cachePos].expiration = gpGlobals->curtime + NEARNODE_CACHE_LIFE; + m_NearestCache[cachePos].expiration = gpGlobals->curtime + (float)NEARNODE_CACHE_LIFE; return cachedNode; } } @@ -522,7 +522,7 @@ void CAI_Network::SetCachedNearestNode(const Vector &checkPos, int nodeID, Hull_ m_NearestCache[m_iNearestCacheNext].vTestPosition = checkPos; m_NearestCache[m_iNearestCacheNext].node = nodeID; m_NearestCache[m_iNearestCacheNext].hull = nHull; - m_NearestCache[m_iNearestCacheNext].expiration = gpGlobals->curtime + NEARNODE_CACHE_LIFE; + m_NearestCache[m_iNearestCacheNext].expiration = gpGlobals->curtime + (float)NEARNODE_CACHE_LIFE; m_iNearestCacheNext--; if ( m_iNearestCacheNext < 0 ) diff --git a/src/game/server/ai_pathfinder.cpp b/src/game/server/ai_pathfinder.cpp index 98b5b3eff..9ca56f89c 100644 --- a/src/game/server/ai_pathfinder.cpp +++ b/src/game/server/ai_pathfinder.cpp @@ -1812,7 +1812,7 @@ class CPathfindNearestNodeFilter : public INearestNodeFilter m_bAvoidObstacles( bAvoidObstacles ), m_pRoute( NULL ) { - COMPILE_TIME_ASSERT( bits_BUILD_GROUND == bits_CAP_MOVE_GROUND && bits_BUILD_FLY == bits_CAP_MOVE_FLY && bits_BUILD_JUMP == bits_CAP_MOVE_JUMP && bits_BUILD_CLIMB == bits_CAP_MOVE_CLIMB && bits_BUILD_CRAWL == bits_CAP_MOVE_CRAWL ); + COMPILE_TIME_ASSERT( ( int )bits_BUILD_GROUND == bits_CAP_MOVE_GROUND && ( int )bits_BUILD_FLY == bits_CAP_MOVE_FLY && ( int )bits_BUILD_JUMP == bits_CAP_MOVE_JUMP && ( int )bits_BUILD_CLIMB == bits_CAP_MOVE_CLIMB && ( int )bits_BUILD_CRAWL == bits_CAP_MOVE_CRAWL ); } bool IsValid( CAI_Node *pNode ) diff --git a/src/game/server/ai_playerally.cpp b/src/game/server/ai_playerally.cpp index 521a42800..4a27274cd 100644 --- a/src/game/server/ai_playerally.cpp +++ b/src/game/server/ai_playerally.cpp @@ -145,7 +145,7 @@ class CConceptInfoMap : public CUtlMap { { for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) { - Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] ); + Insert( g_ConceptInfos[i].conceptName, &g_ConceptInfos[i] ); } } }; @@ -164,7 +164,7 @@ class CConceptInfoMap : public CUtlMap { for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) { - Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] ); + Insert( g_ConceptInfos[i].conceptName, &g_ConceptInfos[i] ); } } }; @@ -189,7 +189,7 @@ void CAI_AllySpeechManager::Spawn() { Assert( g_ConceptInfoMap.Count() != 0 ); for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) - m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].conceptName ), CSimpleSimTimer() ); } void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) @@ -197,14 +197,14 @@ void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) Assert( g_ConceptInfoMap.Count() != 0 ); Assert( m_ConceptTimers.Count() != 0 ); - if ( g_ConceptInfoMap.Find( conceptInfo.concept ) == g_ConceptInfoMap.InvalidIndex() ) + if ( g_ConceptInfoMap.Find( conceptInfo.conceptName ) == g_ConceptInfoMap.InvalidIndex() ) { - g_ConceptInfoMap.Insert( conceptInfo.concept, new ConceptInfo_t( conceptInfo ) ); + g_ConceptInfoMap.Insert( conceptInfo.conceptName, new ConceptInfo_t( conceptInfo ) ); } - if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.concept) ) == m_ConceptTimers.InvalidIndex() ) + if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.conceptName) ) == m_ConceptTimers.InvalidIndex() ) { - m_ConceptTimers.Insert( AllocPooledString( conceptInfo.concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( conceptInfo.conceptName ), CSimpleSimTimer() ); } } @@ -213,16 +213,16 @@ ConceptCategoryInfo_t *CAI_AllySpeechManager::GetConceptCategoryInfo( ConceptCat return &g_ConceptCategoryInfos[category]; } -ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t concept ) +ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t conceptName ) { - int iResult = g_ConceptInfoMap.Find( concept ); + int iResult = g_ConceptInfoMap.Find( conceptName ); return ( iResult != g_ConceptInfoMap.InvalidIndex() ) ? g_ConceptInfoMap[iResult] : NULL; } -void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ) +void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t conceptName, AI_Response *response ) { - ConceptInfo_t * pConceptInfo = GetConceptInfo( concept ); + ConceptInfo_t * pConceptInfo = GetConceptInfo( conceptName ); ConceptCategory_t category = ( pConceptInfo ) ? pConceptInfo->category : SPEECH_IDLE; ConceptCategoryInfo_t * pCategoryInfo = GetConceptCategoryInfo( category ); @@ -241,7 +241,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce pPlayerAlly->FVisible( pTalker ) ) { // Tell this guy he's already said the concept to the player, too. - pTalker->GetExpresser()->SetSpokeConcept( concept, NULL, false ); + pTalker->GetExpresser()->SetSpokeConcept( conceptName, NULL, false ); } } } @@ -272,7 +272,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce if ( pConceptInfo && pConceptInfo->minConceptDelay != -1 ) { Assert( pConceptInfo->maxConceptDelay != -1 ); - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(conceptName) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) m_ConceptTimers[iConceptTimer].Set( pConceptInfo->minConceptDelay, pConceptInfo->minConceptDelay ); } @@ -292,9 +292,9 @@ bool CAI_AllySpeechManager::CategoryDelayExpired( ConceptCategory_t category ) return m_ConceptCategoryTimers[category].Expired(); } -bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t concept ) +bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t conceptName ) { - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(conceptName) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) return m_ConceptTimers[iConceptTimer].Expired(); return true; @@ -575,7 +575,7 @@ void CAI_PlayerAlly::PrescheduleThink( void ) if ( SelectNonCombatSpeech( &selection ) ) { SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response ); m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 ); } else @@ -613,16 +613,16 @@ int CAI_PlayerAlly::SelectSchedule( void ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) +bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t conceptName, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) { - if ( IsAllowedToSpeak( concept ) ) + if ( IsAllowedToSpeak( conceptName ) ) { AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, pszModifiers); + GatherCriteria(&criteria, conceptName, pszModifiers); - if ( FindResponse(pSelection->response, concept, &criteria) ) + if ( FindResponse(pSelection->response, conceptName, &criteria) ) { - pSelection->Set(concept, pTarget); + pSelection->Set(conceptName, pTarget); return true; } @@ -640,11 +640,11 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse ) +void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t conceptName, AI_Response *pResponse ) { m_PendingResponse = *pResponse; // pResponse->Release(); - m_PendingConcept = concept; + m_PendingConcept = conceptName; m_TimePendingSet = gpGlobals->curtime; } @@ -725,7 +725,7 @@ bool CAI_PlayerAlly::SelectInterjection() if ( SelectIdleSpeech( &selection ) ) { SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response, NULL ); return true; } } @@ -770,14 +770,14 @@ bool CAI_PlayerAlly::SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelect //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ) { #ifdef HL2_EPISODIC CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( conceptName ); if ( pConceptInfo && (pConceptInfo->flags & AICF_QUESTION) && GetSpeechTarget() ) { - bool bSaidHelloToNPC = !Q_strcmp(concept, "TLK_HELLO_NPC"); + bool bSaidHelloToNPC = !Q_strcmp(conceptName, "TLK_HELLO_NPC"); float duration = GetExpresser()->GetSemaphoreAvailableTime(this) - gpGlobals->curtime; @@ -785,11 +785,11 @@ void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response { if ( bSaidHelloToNPC ) { - Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept.GetStringConcept() ); + Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), conceptName.GetStringConcept() ); } else { - Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept.GetStringConcept() ); + Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), conceptName.GetStringConcept() ); } NDebugOverlay::HorzArrow( GetAbsOrigin(), GetSpeechTarget()->GetAbsOrigin(), 8, 0, 255, 0, 64, true, duration ); } @@ -926,7 +926,7 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN Assert( !selection.response.IsEmpty() ); SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response, NULL ); // Prevent idle speech for a while DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() ); @@ -978,7 +978,7 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule() { Assert( !selection.response.IsEmpty() ); SetSpeechTarget( selection.hSpeechTarget ); - SetPendingSpeech( selection.concept.c_str(), &selection.response ); + SetPendingSpeech( selection.conceptName.c_str(), &selection.response ); } } @@ -1556,10 +1556,10 @@ bool CAI_PlayerAlly::IsOkToSpeakInResponseToPlayer( void ) //----------------------------------------------------------------------------- // Purpose: Return true if I should speak based on the chance & the speech filter's modifier //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) +bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t conceptName, int iChance ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( conceptName ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( GetSpeechFilter() ) @@ -1585,10 +1585,10 @@ bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer ) +bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t conceptName, bool bRespondingToPlayer ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( conceptName ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( !IsOkToSpeak( category, bRespondingToPlayer ) ) @@ -1596,19 +1596,19 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl if ( GetSpeechFilter() && GetSpeechFilter()->NeverSayHello() ) { - if ( CompareConcepts( concept, TLK_HELLO ) ) + if ( CompareConcepts( conceptName, TLK_HELLO ) ) return false; - if ( CompareConcepts( concept, TLK_HELLO_NPC ) ) + if ( CompareConcepts( conceptName, TLK_HELLO_NPC ) ) return false; } - if ( !pSpeechManager->ConceptDelayExpired( concept ) ) + if ( !pSpeechManager->ConceptDelayExpired( conceptName ) ) return false; - if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( concept ) ) + if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( conceptName ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( conceptName ) ) return false; return true; @@ -1616,11 +1616,11 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) +bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) { - if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) + if ( IsAllowedToSpeak( conceptName, bRespondingToPlayer ) ) { - return Speak( concept, modifiers, pszOutResponseChosen, bufsize ); + return Speak( conceptName, modifiers, pszOutResponseChosen, bufsize ); } return false; } @@ -1647,10 +1647,10 @@ void CAI_PlayerAlly::ModifyOrAppendCriteria( AI_CriteriaSet& set ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ) { CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - pSpeechManager->OnSpokeConcept( this, concept, response ); + pSpeechManager->OnSpokeConcept( this, conceptName, response ); if( response != NULL && (response->GetParams()->flags & AI_ResponseParams::RG_WEAPONDELAY) ) { diff --git a/src/game/server/ai_playerally.h b/src/game/server/ai_playerally.h index 2ab897a21..dc6028486 100644 --- a/src/game/server/ai_playerally.h +++ b/src/game/server/ai_playerally.h @@ -175,7 +175,7 @@ enum AIConceptFlags_t struct ConceptInfo_t { - AIConcept_t concept; + AIConcept_t conceptName; ConceptCategory_t category; float minGlobalCategoryDelay; float maxGlobalCategoryDelay; @@ -199,12 +199,12 @@ class CAI_AllySpeechManager : public CLogicalEntity void AddCustomConcept( const ConceptInfo_t &conceptInfo ); ConceptCategoryInfo_t *GetConceptCategoryInfo( ConceptCategory_t category ); - ConceptInfo_t *GetConceptInfo( AIConcept_t concept ); - void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ); + ConceptInfo_t *GetConceptInfo( AIConcept_t conceptName ); + void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t conceptName, AI_Response *response ); void SetCategoryDelay( ConceptCategory_t category, float minDelay, float maxDelay = 0.0 ); bool CategoryDelayExpired( ConceptCategory_t category ); - bool ConceptDelayExpired( AIConcept_t concept ); + bool ConceptDelayExpired( AIConcept_t conceptName ); private: @@ -249,7 +249,7 @@ struct AISpeechSelection_t void Set( AIConcept_t newConcept, AI_Response &nuResponse, CBaseEntity *pTarget = NULL ) { response = nuResponse; - concept = newConcept; + conceptName = newConcept; hSpeechTarget = pTarget; } @@ -257,11 +257,11 @@ struct AISpeechSelection_t void Set( AIConcept_t newConcept, CBaseEntity *pTarget ) { Assert( !response.IsEmpty() ); - concept = newConcept; + conceptName = newConcept; hSpeechTarget = pTarget; } - std::string concept; + std::string conceptName; AI_Response response; EHANDLE hSpeechTarget; }; @@ -341,14 +341,14 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- virtual bool SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelection ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ); + virtual void PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ); bool SelectQuestionFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection ); bool SelectAnswerFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection, bool bRespondingToHello ); //--------------------------------- - bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); - void SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse ); + bool SelectSpeechResponse( AIConcept_t conceptName, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); + void SetPendingSpeech( AIConcept_t conceptName, AI_Response *pResponse ); void ClearPendingSpeech(); bool HasPendingSpeech() { return !m_PendingConcept.empty(); } @@ -371,9 +371,9 @@ class CAI_PlayerAlly : public CAI_BaseActor bool IsOkToCombatSpeak( void ); virtual bool IsOkToSpeakInResponseToPlayer( void ); - bool ShouldSpeakRandom( AIConcept_t concept, int iChance ); - bool IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer = false ); - virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + bool ShouldSpeakRandom( AIConcept_t conceptName, int iChance ); + bool IsAllowedToSpeak( AIConcept_t conceptName, bool bRespondingToPlayer = false ); + virtual bool SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); //--------------------------------- @@ -387,7 +387,7 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- - void OnSpokeConcept( AIConcept_t concept, AI_Response *response ); + void OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ); void OnStartSpeaking(); // Inputs diff --git a/src/game/server/ai_speech.cpp b/src/game/server/ai_speech.cpp index 94172ae8e..452290cff 100644 --- a/src/game/server/ai_speech.cpp +++ b/src/game/server/ai_speech.cpp @@ -350,8 +350,8 @@ void CAI_Expresser::TestAllResponses() responses[i].GetResponse( response, sizeof( response ) ); Msg( "Response: %s\n", response ); - AIConcept_t concept; - SpeakDispatchResponse( concept, &responses[i], NULL ); + AIConcept_t conceptName; + SpeakDispatchResponse( conceptName, &responses[i], NULL ); } } } @@ -385,10 +385,10 @@ static void ModifyOrAppendGlobalCriteria( AI_CriteriaSet * RESTRICT outputSet ) } -void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &concept, const char * RESTRICT modifiers ) +void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &conceptName, const char * RESTRICT modifiers ) { // Always include the concept name - outputSet->AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + outputSet->AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); #if 1 outputSet->Merge( modifiers ); @@ -438,7 +438,7 @@ void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const A // Output : AI_Response //----------------------------------------------------------------------------- // AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ ) -bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria ) +bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { VPROF("CAI_Expresser::FindResponse"); IResponseSystem *rs = GetOuter()->GetResponseSystem(); @@ -457,7 +457,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept #if 0 // this is the old technique, where we always gathered criteria in this function AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -495,7 +495,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept AI_CriteriaSet localCriteriaSet; // put it on the stack so we don't deal with new/delete if (criteria == NULL) { - GatherCriteria( &localCriteriaSet, concept, NULL ); + GatherCriteria( &localCriteriaSet, conceptName, NULL ); criteria = &localCriteriaSet; } #endif @@ -526,11 +526,11 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept char response[ 256 ]; outResponse.GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)conceptName, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)conceptName ); } } } @@ -564,7 +564,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept // NULL - // Output : bool : true on success, false on fail //----------------------------------------------------------------------------- -AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t &concept, AI_CriteriaSet *criteria ) +AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { Assert(response); @@ -578,7 +578,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t #if 0 AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -638,11 +638,11 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, conceptName, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, conceptName ); } } } @@ -669,7 +669,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) { char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); @@ -680,14 +680,14 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re soundlevel_t soundlevel = result->GetSoundLevel(); - if ( IsSpeaking() && concept[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) + if ( IsSpeaking() && conceptName[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) { const char *entityName = STRING( GetOuter()->GetEntityName() ); if ( GetOuter()->IsPlayer() ) { entityName = ToBasePlayer( GetOuter() )->GetPlayerName(); } - DevMsg( 2, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + DevMsg( 2, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)conceptName ); // Tracker 15911: Can break the game if we stop an imported map placed lcs here, so only // cancel actor out of instanced scripted scenes. ywb @@ -696,7 +696,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re if ( IsRunningScriptedScene( GetOuter() ) ) { - DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)conceptName ); return false; } } @@ -769,7 +769,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re { Vector vPrintPos; GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos ); - NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)concept, response ), true, 1.5 ); + NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)conceptName, response ), true, 1.5 ); } if ( result->IsApplyContextToWorld() ) @@ -784,7 +784,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re { GetOuter()->AddContext( result->GetContext() ); } - SetSpokeConcept( concept, result ); + SetSpokeConcept( conceptName, result ); } else { @@ -893,13 +893,13 @@ float CAI_Expresser::GetResponseDuration( AI_Response *result ) // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, conceptName, modifiers); - return Speak( concept, &criteria, pszOutResponseChosen, bufsize, filter ); + return Speak( conceptName, &criteria, pszOutResponseChosen, bufsize, filter ); } @@ -907,7 +907,7 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL* //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) +bool CAI_Expresser::Speak( AIConcept_t &conceptName, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -917,15 +917,15 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT crite GetOuter()->ModifyOrAppendDerivedCriteria(*criteria); AI_Response result; - if ( !FindResponse( result, concept, criteria ) ) + if ( !FindResponse( result, conceptName, criteria ) ) { return false; } - SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); + SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)conceptName, gpGlobals->curtime ); // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, criteria, filter ); + bool spoke = SpeakDispatchResponse( conceptName, &result, criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -1109,10 +1109,10 @@ bool CAI_Expresser::CanSpeakAfterMyself() } //------------------------------------- -bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept ) +bool CAI_Expresser::CanSpeakConcept( AIConcept_t conceptName ) { // Not in history? - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( conceptName ); if ( iter == m_ConceptHistories.InvalidIndex() ) { return true; @@ -1141,16 +1141,16 @@ bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept ) //------------------------------------- -bool CAI_Expresser::SpokeConcept( AIConcept_t concept ) +bool CAI_Expresser::SpokeConcept( AIConcept_t conceptName ) { - return GetTimeSpokeConcept( concept ) != -1.f; + return GetTimeSpokeConcept( conceptName ) != -1.f; } //------------------------------------- -float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept ) +float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t conceptName ) { - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( conceptName ); if ( iter == m_ConceptHistories.InvalidIndex() ) return -1; @@ -1160,14 +1160,14 @@ float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept ) //------------------------------------- -void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback ) +void CAI_Expresser::SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback ) { - int idx = m_ConceptHistories.Find( concept ); + int idx = m_ConceptHistories.Find( conceptName ); if ( idx == m_ConceptHistories.InvalidIndex() ) { ConceptHistory_t h; h.timeSpoken = gpGlobals->curtime; - idx = m_ConceptHistories.Insert( concept, h ); + idx = m_ConceptHistories.Insert( conceptName, h ); } ConceptHistory_t *slot = &m_ConceptHistories[ idx ]; @@ -1180,14 +1180,14 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response, } if ( bCallback ) - GetSink()->OnSpokeConcept( concept, response ); + GetSink()->OnSpokeConcept( conceptName, response ); } //------------------------------------- -void CAI_Expresser::ClearSpokeConcept( AIConcept_t concept ) +void CAI_Expresser::ClearSpokeConcept( AIConcept_t conceptName ) { - m_ConceptHistories.Remove( concept ); + m_ConceptHistories.Remove( conceptName ); } //------------------------------------- diff --git a/src/game/server/ai_speech.h b/src/game/server/ai_speech.h index e05fe30d1..712342071 100644 --- a/src/game/server/ai_speech.h +++ b/src/game/server/ai_speech.h @@ -123,7 +123,7 @@ inline bool CompareConcepts( AIConcept_t c1, AIConcept_t c2 ) class CAI_ExpresserSink { public: - virtual void OnSpokeConcept( AIConcept_t concept, AI_Response *response ) {}; + virtual void OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ) {}; virtual void OnStartSpeaking() {} virtual bool UseSemaphore() { return true; } }; @@ -162,20 +162,20 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - bool Speak( AIConcept_t &concept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t &conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t &conceptName, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); // Given modifiers (which are colon-delimited strings), fill out a criteria set including this // character's contexts and the ones in the modifier. This lets us hang on to them after a call // to SpeakFindResponse. - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &conceptName, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps // AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); // AI_Response *SpeakFindResponse( AIConcept_t &concept, AI_CriteriaSet *criteria ); // Find the appropriate response for the given concept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *modifiers = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + bool FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *modifiers = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); float GetResponseDuration( AI_Response *response ); virtual int SpeakRawSentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -198,11 +198,11 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool CanSpeakConcept( AIConcept_t concept ); - bool SpokeConcept( AIConcept_t concept ); - float GetTimeSpokeConcept( AIConcept_t concept ); // returns -1 if never - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ); - void ClearSpokeConcept( AIConcept_t concept ); + bool CanSpeakConcept( AIConcept_t conceptName ); + bool SpokeConcept( AIConcept_t conceptName ); + float GetTimeSpokeConcept( AIConcept_t conceptName ); // returns -1 if never + void SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback = true ); + void ClearSpokeConcept( AIConcept_t conceptName ); // -------------------------------- @@ -290,21 +290,21 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink public: virtual void NoteSpeaking( float duration, float delay ); - virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t conceptName, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &conceptName, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps // AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); // AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria ); // AI_Response *SpeakFindResponse( AIConcept_t concept ); // Find the appropriate response for the given concept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria = NULL ); + bool FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria = NULL ); - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria = NULL ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; } + bool SpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response, AI_CriteriaSet *criteria = NULL ); + virtual void PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ) { return; } float GetResponseDuration( AI_Response *response ); float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); } @@ -313,9 +313,9 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink bool CanSpeak() { return this->GetExpresser()->CanSpeak(); } bool CanSpeakAfterMyself() { return this->GetExpresser()->CanSpeakAfterMyself(); } - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( concept, response, bCallback ); } - float GetTimeSpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->GetTimeSpokeConcept( concept ); } - bool SpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->SpokeConcept( concept ); } + void SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( conceptName, response, bCallback ); } + float GetTimeSpokeConcept( AIConcept_t conceptName ) { return this->GetExpresser()->GetTimeSpokeConcept( conceptName ); } + bool SpokeConcept( AIConcept_t conceptName ) { return this->GetExpresser()->SpokeConcept( conceptName ); } protected: int PlaySentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -337,24 +337,24 @@ inline void CAI_ExpresserHost::NoteSpeaking( float duration, float del //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); - return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return this->GetExpresser()->Speak( conceptName, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t conceptName, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); CAI_Expresser * const RESTRICT pExpresser = this->GetExpresser(); - concept.SetSpeaker(this); + conceptName.SetSpeaker(this); // add in any local criteria to the one passed on the command line. - pExpresser->GatherCriteria( pCriteria, concept, NULL ); + pExpresser->GatherCriteria( pCriteria, conceptName, NULL ); // call the "I have aleady gathered criteria" version of Expresser::Speak - return pExpresser->Speak( concept, pCriteria, pszOutResponseChosen, bufsize, filter ); + return pExpresser->Speak( conceptName, pCriteria, pszOutResponseChosen, bufsize, filter ); } @@ -398,9 +398,9 @@ inline ResponseRules::IResponseSystem *CAI_ExpresserHost::GetResponseS //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &concept, const char *modifiers ) +inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &conceptName, const char *modifiers ) { - return this->GetExpresser()->GatherCriteria( outputCriteria, concept, modifiers ); + return this->GetExpresser()->GatherCriteria( outputCriteria, conceptName, modifiers ); } @@ -408,9 +408,9 @@ inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputC //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName, const char *modifiers /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, modifiers ); + return this->GetExpresser()->SpeakFindResponse( conceptName, modifiers ); } #endif @@ -418,9 +418,9 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName, AI_CriteriaSet *criteria /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, criteria ); + return this->GetExpresser()->SpeakFindResponse( conceptName, criteria ); } @@ -429,11 +429,11 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t // class that generates a one off. //----------------------------------------------------------------------------- template -inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept ) +inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName ) { AI_CriteriaSet criteria; - GatherCriteria( &criteria, concept, NULL ); - return this->GetExpresser()->SpeakFindResponse( concept, &criteria ); + GatherCriteria( &criteria, conceptName, NULL ); + return this->GetExpresser()->SpeakFindResponse( conceptName, &criteria ); } #endif @@ -441,20 +441,20 @@ inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { - return this->GetExpresser()->FindResponse( outResponse, concept, criteria ); + return this->GetExpresser()->FindResponse( outResponse, conceptName, criteria ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response, AI_CriteriaSet *criteria ) { - if ( this->GetExpresser()->SpeakDispatchResponse( concept, response, criteria ) ) + if ( this->GetExpresser()->SpeakDispatchResponse( conceptName, response, criteria ) ) { - PostSpeakDispatchResponse( concept, response ); + PostSpeakDispatchResponse( conceptName, response ); return true; } @@ -491,7 +491,7 @@ inline void CAI_ExpresserHost::DispatchResponse( const char *conceptNa template class CAI_ExpresserHostWithData : public CAI_ExpresserHost { - DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost ); + DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost ); public: CAI_ExpresserHostWithData( ) : m_pExpresser(NULL) {}; @@ -507,11 +507,11 @@ class CAI_ExpresserHostWithData : public CAI_ExpresserHost protected: EXPRESSER_TYPE *CreateExpresser( void ) { - AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", GetDebugName() ); + AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", this->GetDebugName() ); m_pExpresser = new EXPRESSER_TYPE(this); if ( !m_pExpresser) { - AssertMsg1( false, "Creating an expresser failed in %s\n", GetDebugName() ); + AssertMsg1( false, "Creating an expresser failed in %s\n", this->GetDebugName() ); return NULL; } @@ -601,15 +601,15 @@ class CAI_ExpresserWithFollowup : public CAI_Expresser CAI_ExpresserWithFollowup( CBaseFlex *pOuter = NULL ) : CAI_Expresser(pOuter), m_pPostponedFollowup(NULL) {}; - virtual bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t &conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); virtual void SpeakDispatchFollowup( AI_ResponseFollowup &followup ); virtual void OnSpeechFinished(); typedef CAI_Expresser BaseClass; protected: - static void DispatchFollowupThroughQueue( const AIConcept_t &concept, + static void DispatchFollowupThroughQueue( const AIConcept_t &conceptName, const char *criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, diff --git a/src/game/server/ai_speechqueue.cpp b/src/game/server/ai_speechqueue.cpp index 342f879e4..3fd9e73fc 100644 --- a/src/game/server/ai_speechqueue.cpp +++ b/src/game/server/ai_speechqueue.cpp @@ -28,7 +28,7 @@ CResponseQueue::CResponseQueue( int queueSize ) : m_Queue(queueSize), m_Expresse {}; /// Add a deferred response. -void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Add( const AIConcept_t &conceptName, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, @@ -38,12 +38,12 @@ void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch // Add a response. AssertMsg( m_Queue.Count() < AI_RESPONSE_QUEUE_SIZE, "AI Response queue overfilled." ); QueueType_t::IndexLocalType_t idx = m_Queue.AddToTail(); - m_Queue[idx].Init( concept, contexts, time, targetspec, pIssuer ); + m_Queue[idx].Init( conceptName, contexts, time, targetspec, pIssuer ); } /// Remove a deferred response matching the concept and issuer. -void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Remove( const AIConcept_t &conceptName, ///< concept to dispatch CBaseEntity * const RESTRICT pIssuer ///< the entity issuing the response, if one exists. ) RESTRICT { @@ -54,7 +54,7 @@ void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispat CDeferredResponse &response = m_Queue[idx]; QueueType_t::IndexLocalType_t previdx = idx; // advance the index immediately because we may be deleting the "current" element idx = m_Queue.Next(idx); // is now the next index - if ( CompareConcepts( response.m_concept, concept ) && // if concepts match and + if ( CompareConcepts( response.m_concept, conceptName ) && // if concepts match and ( !pIssuer || ( response.m_hIssuer.Get() == pIssuer ) ) // issuer is null, or matches the one in the response ) { diff --git a/src/game/server/ai_speechqueue.h b/src/game/server/ai_speechqueue.h index 15101b70b..55a7174b5 100644 --- a/src/game/server/ai_speechqueue.h +++ b/src/game/server/ai_speechqueue.h @@ -73,7 +73,7 @@ class CResponseQueue */ CFollowupTargetSpec_t m_Target; - inline void Init( const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); + inline void Init( const AIConcept_t &conceptName, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); inline bool IsQuashed() { return !m_Target.IsValid(); } void Quash(); ///< make this response invalid. }; @@ -85,7 +85,7 @@ class CResponseQueue CResponseQueue( int queueSize ); /// Add a deferred response. - void Add( const AIConcept_t &concept, ///< concept to dispatch + void Add( const AIConcept_t &conceptName, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, ///< the contexts that come with it (may be NULL) float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, /// All information necessary to target this response @@ -93,7 +93,7 @@ class CResponseQueue ); /// Remove all deferred responses matching the concept and issuer. - void Remove( const AIConcept_t &concept, ///< concept to dispatch + void Remove( const AIConcept_t &conceptName, ///< concept to dispatch CBaseEntity * const pIssuer = NULL ///< the entity issuing the response, if one exists. ); @@ -140,9 +140,9 @@ class CResponseQueue CUtlVector m_ExpresserTargets; // a list of legitimate expresser targets }; -inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) +inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &conceptName, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) { - m_concept = concept; + m_concept = conceptName; m_fDispatchTime = dtime; /* m_iTargetType = targetType; @@ -205,32 +205,32 @@ extern CResponseQueueManager g_ResponseQueueManager; // Handy global helper funcs /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, NULL, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( conceptName, NULL, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const EHANDLE &target, ///< which entity shall speak float delay, ///< how far in the future to speak const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, + return g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, gpGlobals->curtime + delay, CResponseQueue::CFollowupTargetSpec_t(target), pIssuer ); } diff --git a/src/game/server/ai_utils.h b/src/game/server/ai_utils.h index ea2059e31..be6a7288e 100644 --- a/src/game/server/ai_utils.h +++ b/src/game/server/ai_utils.h @@ -76,7 +76,7 @@ class CAI_MoveMonitor bool IsMarkSet() { - return ( m_flMarkTolerance != NO_MARK ); + return ( m_flMarkTolerance != (float)NO_MARK ); } bool TargetMoved( const Vector &v ) diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index c8aef63c8..1145cfc5b 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -450,7 +450,7 @@ void CBaseEntity::SendProxy_CellOrigin( const SendProp *pProp, const void *pStru cell[2] = entity->m_cellZ; } - register int const cellwidth = entity->m_cellwidth; // Load it into a register + int const cellwidth = entity->m_cellwidth; // Load it into a register Assert( cell[0] == CellFromCoord( cellwidth, v->x ) ); Assert( cell[1] == CellFromCoord( cellwidth, v->y ) ); @@ -487,7 +487,7 @@ void CBaseEntity::SendProxy_CellOriginXY( const SendProp *pProp, const void *pSt cell[1] = entity->m_cellY; } - register int const cellwidth = entity->m_cellwidth; // Load it into a register + int const cellwidth = entity->m_cellwidth; // Load it into a register Assert( cell[0] == CellFromCoord( cellwidth, v->x ) ); Assert( cell[1] == CellFromCoord( cellwidth, v->y ) ); @@ -518,7 +518,7 @@ void CBaseEntity::SendProxy_CellOriginZ( const SendProp *pProp, const void *pStr cell[2] = entity->m_cellZ; } - register int const cellwidth = entity->m_cellwidth; // Load it into a register + int const cellwidth = entity->m_cellwidth; // Load it into a register Assert( cell[2] == CellFromCoord( cellwidth, v->z ) ); @@ -1387,7 +1387,7 @@ int CBaseEntity::DrawDebugTextOverlays(void) EntityText( offset, tempstr, 0 ); offset++; - register int const cellwidth = m_cellwidth; // Load it into a register + int const cellwidth = m_cellwidth; // Load it into a register Vector cellOrigin; cellOrigin.x = CellInCoord( cellwidth, m_cellX, m_vecOrigin->x ); cellOrigin.y = CellInCoord( cellwidth, m_cellY, m_vecOrigin->y ); @@ -5325,7 +5325,7 @@ void CBaseEntity::PrecacheSoundHelper( const char *pName ) return; } - if ( UTL_INVAL_SYMBOL == g_ModelSoundsSymbolHelper.Find( pName ) ) + if ( !g_ModelSoundsSymbolHelper.Find( pName ).IsValid() ) { g_ModelSoundsSymbolHelper.AddString( pName ); @@ -6943,7 +6943,7 @@ void CBaseEntity::SetCellBits( int cellbits ) //----------------------------------------------------------------------------- void CBaseEntity::UpdateCell() { - register int const cellwidth = m_cellwidth; // Load it into a register + int const cellwidth = m_cellwidth; // Load it into a register m_cellX = CellFromCoord( cellwidth, m_vecOrigin.GetX() ); m_cellY = CellFromCoord( cellwidth, m_vecOrigin.GetY() ); @@ -7923,7 +7923,7 @@ void CBaseEntity::ComputeStepSimulationNetwork( StepSimulationData *step ) } // Calculate the cell of this origin - register int const cellwidth = m_cellwidth; // Load it into a register + int const cellwidth = m_cellwidth; // Load it into a register step->m_networkCell[0] = CellFromCoord( cellwidth, step->m_vecNetworkOrigin[0] ); step->m_networkCell[1] = CellFromCoord( cellwidth, step->m_vecNetworkOrigin[1] ); step->m_networkCell[2] = CellFromCoord( cellwidth, step->m_vecNetworkOrigin[2] ); diff --git a/src/game/server/baseentity.h b/src/game/server/baseentity.h index b2b14bdaf..1c73919e7 100644 --- a/src/game/server/baseentity.h +++ b/src/game/server/baseentity.h @@ -893,7 +893,7 @@ class CBaseEntity : public IServerEntity bool IsWorld() const { extern CWorld *g_WorldEntity; return (void *)this == (void *)g_WorldEntity; } virtual char const *DamageDecal( int bitsDamageType, int gameMaterial ); virtual void DecalTrace( trace_t *pTrace, char const *decalName ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); void AddPoints( int score, bool bAllowNegativeScore ); void AddPointsToTeam( int score, bool bAllowNegativeScore ); @@ -1052,7 +1052,7 @@ class CBaseEntity : public IServerEntity #ifdef _DEBUG void FunctionCheck( void *pFunction, const char *name ); - ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); @@ -1063,7 +1063,7 @@ class CBaseEntity : public IServerEntity FunctionCheck( *(reinterpret_cast(&m_pfnTouch)), name ); return func; } - USEPTR UseSet( USEPTR func, char *name ) + USEPTR UseSet( USEPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); @@ -1074,7 +1074,7 @@ class CBaseEntity : public IServerEntity FunctionCheck( *(reinterpret_cast(&m_pfnUse)), name ); return func; } - ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); diff --git a/src/game/server/baseflex.cpp b/src/game/server/baseflex.cpp index 8eb299442..45c5300bf 100644 --- a/src/game/server/baseflex.cpp +++ b/src/game/server/baseflex.cpp @@ -2583,7 +2583,7 @@ void CFlexCycler::Think( void ) for ( LocalFlexController_t i = LocalFlexController_t(0); i < GetNumFlexControllers(); i++ ) { // Throw a differently offset sine wave on all of the flex controllers - float fFlexTime = i * (1.0f / (float)GetNumFlexControllers()) + gpGlobals->curtime; + float fFlexTime = (float)i * (1.0f / (float)GetNumFlexControllers()) + gpGlobals->curtime; m_flextarget[i] = sinf( fFlexTime ) * 0.5f + 0.5f; SetFlexWeight( i, m_flextarget[i] ); } @@ -2594,30 +2594,30 @@ void CFlexCycler::Think( void ) char szTemp[32]; Q_strncpy( szExpression, pszExpression ,sizeof(szExpression)); - char *pszExpression = szExpression; + char *pszExpr = szExpression; - while (*pszExpression != '\0') + while (*pszExpr != '\0') { - if (*pszExpression == '+') - *pszExpression = ' '; + if (*pszExpr == '+') + *pszExpr = ' '; - pszExpression++; + pszExpr++; } - pszExpression = szExpression; + pszExpr = szExpression; - while (*pszExpression) + while (*pszExpr) { - if (*pszExpression != ' ') + if (*pszExpr != ' ') { - if (*pszExpression == '-') + if (*pszExpr == '-') { for (LocalFlexController_t i = LocalFlexController_t(0); i < GetNumFlexControllers(); i++) { m_flextarget[i] = 0; } } - else if (*pszExpression == '?') + else if (*pszExpr == '?') { for (LocalFlexController_t i = LocalFlexController_t(0); i < GetNumFlexControllers(); i++) { @@ -2628,7 +2628,7 @@ void CFlexCycler::Think( void ) } else { - if (sscanf( pszExpression, "%31s", szTemp ) == 1) + if (sscanf( pszExpr, "%31s", szTemp ) == 1) { m_flexnum = LookupFlex( szTemp ); @@ -2637,17 +2637,17 @@ void CFlexCycler::Think( void ) m_flextarget[m_flexnum] = 1.0; // SetFlexTarget( m_flexnum ); } - pszExpression += strlen( szTemp ) - 1; + pszExpr += strlen( szTemp ) - 1; } } } - pszExpression++; + pszExpr++; } } else if (m_flextime < gpGlobals->curtime) { // m_flextime = gpGlobals->curtime + 1.0; // RandomFloat( 0.1, 0.5 ); - m_flextime = gpGlobals->curtime + random->RandomFloat( 0.3, 0.5 ) * (30.0 / GetNumFlexControllers()); + m_flextime = gpGlobals->curtime + random->RandomFloat( 0.3, 0.5 ) * (30.0 / (float)GetNumFlexControllers()); m_flexnum = (LocalFlexController_t)random->RandomInt( 0, GetNumFlexControllers() - 1 ); // m_flexnum = (pflex->num + 1) % r_psubmodel->numflexes; diff --git a/src/game/server/basemultiplayerplayer.cpp b/src/game/server/basemultiplayerplayer.cpp index 709965454..569f59250 100644 --- a/src/game/server/basemultiplayerplayer.cpp +++ b/src/game/server/basemultiplayerplayer.cpp @@ -71,13 +71,13 @@ void CBaseMultiplayerPlayer::ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, SpeechPriorityType priority, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) +bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t conceptName, SpeechPriorityType priority, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) { if ( !IsAlive() ) return false; //if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) - return Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return Speak( conceptName, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- @@ -86,8 +86,8 @@ bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, SpeechPriority void CBaseMultiplayerPlayer::SpeakConcept( AI_Response &outResponse, int iConcept ) { m_iCurrentConcept = iConcept; - AIConcept_t concept( g_pszMPConcepts[iConcept] ); - FindResponse( outResponse, concept ); + AIConcept_t conceptName( g_pszMPConcepts[iConcept] ); + FindResponse( outResponse, conceptName ); } diff --git a/src/game/server/basemultiplayerplayer.h b/src/game/server/basemultiplayerplayer.h index 37ee8adad..1d1802e00 100644 --- a/src/game/server/basemultiplayerplayer.h +++ b/src/game/server/basemultiplayerplayer.h @@ -33,7 +33,7 @@ class CBaseMultiplayerPlayer : public CAI_ExpresserHost virtual void PostConstructor( const char *szClassname ); virtual void ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet ); - virtual bool SpeakIfAllowed( AIConcept_t concept, SpeechPriorityType priority, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakIfAllowed( AIConcept_t conceptName, SpeechPriorityType priority, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); void SpeakConcept( AI_Response &outresponse, int iConcept ); virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); diff --git a/src/game/server/buttons.cpp b/src/game/server/buttons.cpp index e70968ac5..f3c29711e 100644 --- a/src/game/server/buttons.cpp +++ b/src/game/server/buttons.cpp @@ -804,7 +804,7 @@ int CBaseButton::DrawDebugTextOverlays() if (m_debugOverlays & OVERLAY_TEXT_BIT) { - static char *pszStates[] = + static const char *pszStates[] = { "Pressed", "Unpressed", diff --git a/src/game/server/cbase.cpp b/src/game/server/cbase.cpp index aceeb7e87..449715da9 100644 --- a/src/game/server/cbase.cpp +++ b/src/game/server/cbase.cpp @@ -534,7 +534,7 @@ void CBaseEntityOutput::DeleteAllElements( void ) m_ActionList = NULL; while (pNext) { - register CEventAction *strikeThis = pNext; + CEventAction *strikeThis = pNext; pNext = pNext->m_pNext; delete strikeThis; } diff --git a/src/game/server/env_effectsscript.cpp b/src/game/server/env_effectsscript.cpp index face56870..dd37b2dfd 100644 --- a/src/game/server/env_effectsscript.cpp +++ b/src/game/server/env_effectsscript.cpp @@ -386,20 +386,20 @@ void CEnvEffectsScript::ParseScriptFile( void ) memset( name, 0, 256 ); - unsigned char *buffer = (unsigned char *)UTIL_LoadFileForMe( pScriptName, &length ); - if ( length <= 0 || !buffer ) + unsigned char *pBuffer = (unsigned char *)UTIL_LoadFileForMe( pScriptName, &length ); + if ( length <= 0 || !pBuffer ) { DevMsg( 1, "CEnvEffectsScript: failed to load %s\n", pScriptName ); return; } - currenttoken = (const char *)buffer; - LoadFromBuffer( pScriptName, (const char *)buffer ); + currenttoken = (const char *)pBuffer; + LoadFromBuffer( pScriptName, (const char *)pBuffer ); - UTIL_FreeFile( buffer ); + UTIL_FreeFile( pBuffer ); } -void CEnvEffectsScript::LoadFromBuffer( const char *scriptfile, const char *buffer ) +void CEnvEffectsScript::LoadFromBuffer( const char *scriptfile, const char *pBuffer ) { while ( 1 ) { diff --git a/src/game/server/episodic/npc_hunter.cpp b/src/game/server/episodic/npc_hunter.cpp index c5006db48..e7d6de6c7 100644 --- a/src/game/server/episodic/npc_hunter.cpp +++ b/src/game/server/episodic/npc_hunter.cpp @@ -5659,10 +5659,10 @@ int CNPC_Hunter::OnTakeDamage_Alive( const CTakeDamageInfo &info ) } else { - CBaseEntity *pInflictor = info.GetInflictor(); + CBaseEntity *pInflictor2 = info.GetInflictor(); if ( ( info.GetDamageType() & DMG_VEHICLE ) || - ( pInflictor && pInflictor->GetServerVehicle() && - ( ( bHitByUnoccupiedCar = ( dynamic_cast(pInflictor) && static_cast(pInflictor)->GetDriver() == NULL ) ) == false ) ) ) + ( pInflictor2 && pInflictor2->GetServerVehicle() && + ( ( bHitByUnoccupiedCar = ( dynamic_cast(pInflictor2) && static_cast(pInflictor2)->GetDriver() == NULL ) ) == false ) ) ) { // Adjust the damage from vehicles. flDamage *= sk_hunter_vehicle_damage_scale.GetFloat(); @@ -5670,11 +5670,11 @@ int CNPC_Hunter::OnTakeDamage_Alive( const CTakeDamageInfo &info ) // Apply a force to jostle the vehicle that hit us. // Pick a force direction based on which side we're on relative to the vehicle's motion. - Vector vecVelDir = pInflictor->GetSmoothedVelocity(); + Vector vecVelDir = pInflictor2->GetSmoothedVelocity(); if ( vecVelDir.Length() >= hunter_jostle_car_min_speed.GetFloat() ) { EmitSound( "NPC_Hunter.HitByVehicle" ); - m_hHitByVehicle = pInflictor; + m_hHitByVehicle = pInflictor2; SetContextThink( &CNPC_Hunter::JostleVehicleThink, gpGlobals->curtime, HUNTER_JOSTLE_VEHICLE_THINK ); } } @@ -6464,7 +6464,7 @@ const char *CNPC_Hunter::SelectRandomExpressionForState( NPC_STATE state ) if ( !hunter_random_expressions.GetBool() ) return NULL; - char *szExpressions[4] = + const char *szExpressions[4] = { "scenes/npc/hunter/hunter_scan.vcd", "scenes/npc/hunter/hunter_eyeclose.vcd", diff --git a/src/game/server/func_break.cpp b/src/game/server/func_break.cpp index 7af9742ed..39c434812 100644 --- a/src/game/server/func_break.cpp +++ b/src/game/server/func_break.cpp @@ -435,7 +435,7 @@ void CBreakable::DamageSound( void ) { int pitch; float fvol; - char *soundname = NULL; + const char *soundname = NULL; int material = m_Material; if (random->RandomInt(0,2)) diff --git a/src/game/server/gameinterface.cpp b/src/game/server/gameinterface.cpp index 08a4bc373..b621c764a 100644 --- a/src/game/server/gameinterface.cpp +++ b/src/game/server/gameinterface.cpp @@ -1725,8 +1725,8 @@ void CServerGameDLL::PreSave( CSaveRestoreData *s ) // This little hack lets me marry BSP names to messages in titles.txt typedef struct { - char *pBSPName; - char *pTitleName; + const char *pBSPName; + const char *pTitleName; } TITLECOMMENT; // this list gets searched for the first partial match, so some are out of order diff --git a/src/game/server/genericactor.cpp b/src/game/server/genericactor.cpp index 025cb51f6..13a16cf6f 100644 --- a/src/game/server/genericactor.cpp +++ b/src/game/server/genericactor.cpp @@ -334,30 +334,30 @@ void CFlextalkActor::ProcessSceneEvents( void ) char szTemp[32]; Q_strncpy( szExpression, pszExpression ,sizeof(szExpression)); - char *pszExpression = szExpression; + char *pszExpr = szExpression; - while (*pszExpression != '\0') + while (*pszExpr != '\0') { - if (*pszExpression == '+') - *pszExpression = ' '; + if (*pszExpr == '+') + *pszExpr = ' '; - pszExpression++; + pszExpr++; } - pszExpression = szExpression; + pszExpr = szExpression; - while (*pszExpression) + while (*pszExpr) { - if (*pszExpression != ' ') + if (*pszExpr != ' ') { - if (*pszExpression == '-') + if (*pszExpr == '-') { for (LocalFlexController_t i = LocalFlexController_t(0); i < GetNumFlexControllers(); i++) { m_flextarget[i] = 0; } } - else if (*pszExpression == '?') + else if (*pszExpr == '?') { for (LocalFlexController_t i = LocalFlexController_t(0); i < GetNumFlexControllers(); i++) { @@ -368,7 +368,7 @@ void CFlextalkActor::ProcessSceneEvents( void ) } else { - if (sscanf( pszExpression, "%31s", szTemp ) == 1) + if (sscanf( pszExpr, "%31s", szTemp ) == 1) { m_flexnum = LookupFlex( szTemp ); @@ -377,16 +377,16 @@ void CFlextalkActor::ProcessSceneEvents( void ) m_flextarget[m_flexnum] = 1.0; // SetFlexTarget( m_flexnum ); } - pszExpression += strlen( szTemp ) - 1; + pszExpr += strlen( szTemp ) - 1; } } } - pszExpression++; + pszExpr++; } } else if (m_flextime < gpGlobals->curtime) { - m_flextime = gpGlobals->curtime + random->RandomFloat( 0.3, 0.5 ) * (30.0 / GetNumFlexControllers()); + m_flextime = gpGlobals->curtime + random->RandomFloat( 0.3, 0.5 ) * (30.0 / (float)GetNumFlexControllers()); m_flexnum = (LocalFlexController_t)random->RandomInt( 0, GetNumFlexControllers() - 1 ); if (m_flextarget[m_flexnum] == 1) diff --git a/src/game/server/global_event_log.cpp b/src/game/server/global_event_log.cpp index 7a078b5a5..205a2dac7 100644 --- a/src/game/server/global_event_log.cpp +++ b/src/game/server/global_event_log.cpp @@ -64,7 +64,7 @@ void CGlobalEventLine::Clear( ) bool CGlobalEventLine::SetStaticText( const char *pszValue ) { - if ( m_ValueSymbol != UTL_INVAL_SYMBOL && m_ValueSymbol == EventSymbols.Find( pszValue ) ) + if ( m_ValueSymbol.IsValid() && m_ValueSymbol == EventSymbols.Find( pszValue ) ) { return false; } diff --git a/src/game/server/globalstate.cpp b/src/game/server/globalstate.cpp index ec6b96428..60395fd1d 100644 --- a/src/game/server/globalstate.cpp +++ b/src/game/server/globalstate.cpp @@ -235,7 +235,7 @@ CON_COMMAND_F(dump_globals, "Dump all global entities/states", FCVAR_CHEAT) //#ifdef _DEBUG void CGlobalState::DumpGlobals( void ) { - static char *estates[] = { "Off", "On", "Dead" }; + static const char *estates[] = { "Off", "On", "Dead" }; Msg( "-- Globals --\n" ); for ( int i = 0; i < m_list.Count(); i++ ) diff --git a/src/game/server/hl2/ai_behavior_actbusy.cpp b/src/game/server/hl2/ai_behavior_actbusy.cpp index 8fb3fb1e8..d479b9cd1 100644 --- a/src/game/server/hl2/ai_behavior_actbusy.cpp +++ b/src/game/server/hl2/ai_behavior_actbusy.cpp @@ -1649,12 +1649,12 @@ void CAI_ActBusyBehavior::PlaySoundForActBusy( busyanimparts_t AnimPart ) CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( pExpresser ) { - AIConcept_t concept(STRING(pBusyAnim->iszSounds[AnimPart])); + AIConcept_t conceptName(STRING(pBusyAnim->iszSounds[AnimPart])); // Must be able to speak the concept - if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( concept ) ) + if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( conceptName ) ) { - pExpresser->Speak( concept ); + pExpresser->Speak( conceptName ); } } } diff --git a/src/game/server/hl2/npc_attackchopper.cpp b/src/game/server/hl2/npc_attackchopper.cpp index 2499a0c00..b976e9335 100644 --- a/src/game/server/hl2/npc_attackchopper.cpp +++ b/src/game/server/hl2/npc_attackchopper.cpp @@ -3743,7 +3743,6 @@ void CNPC_AttackHelicopter::Event_Killed( const CTakeDamageInfo &info ) SetDesiredPosition( pCrashPoint->GetAbsOrigin() ); // Start the failing engine sound - CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); controller.SoundDestroy( m_pRotorSound ); CPASAttenuationFilter filter( this ); diff --git a/src/game/server/hl2/npc_basescanner.h b/src/game/server/hl2/npc_basescanner.h index b3f10d703..94bf8322f 100644 --- a/src/game/server/hl2/npc_basescanner.h +++ b/src/game/server/hl2/npc_basescanner.h @@ -97,7 +97,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot void DeathSound( const CTakeDamageInfo &info ); void AlertSound( void ); void PainSound( const CTakeDamageInfo &info ); - virtual char *GetScannerSoundPrefix( void ) { return ""; } + virtual const char *GetScannerSoundPrefix( void ) { return ""; } void ScannerEmitSound( const char *pszSoundName ); int MeleeAttack1Conditions ( float flDot, float flDist ); @@ -121,7 +121,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot void InputSetDistanceOverride( inputdata_t &inputdata ); protected: - virtual char *GetEngineSound( void ) { return NULL; } + virtual const char *GetEngineSound( void ) { return NULL; } void PlayFlySound(void); void SetBanking( float flInterval ); diff --git a/src/game/server/hl2/npc_bullseye.cpp b/src/game/server/hl2/npc_bullseye.cpp index e5aa58f72..abe99f8a9 100644 --- a/src/game/server/hl2/npc_bullseye.cpp +++ b/src/game/server/hl2/npc_bullseye.cpp @@ -278,7 +278,7 @@ void CNPC_Bullseye::DecalTrace( trace_t *pOldTrace, char const *decalName ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CNPC_Bullseye::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CNPC_Bullseye::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { // Get direction of original trace Vector vTraceDir = pTrace->endpos - pTrace->startpos; diff --git a/src/game/server/hl2/npc_bullseye.h b/src/game/server/hl2/npc_bullseye.h index f897bac4c..39a5edb93 100644 --- a/src/game/server/hl2/npc_bullseye.h +++ b/src/game/server/hl2/npc_bullseye.h @@ -34,7 +34,7 @@ class CNPC_Bullseye : public CAI_BaseNPC Class_T Classify( void ); void Event_Killed( const CTakeDamageInfo &info ); void DecalTrace( trace_t *pTrace, char const *decalName ); - void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); bool IsLightDamage( const CTakeDamageInfo &info ); void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); int OnTakeDamage( const CTakeDamageInfo &info ); diff --git a/src/game/server/hl2/npc_citizen17.h b/src/game/server/hl2/npc_citizen17.h index 838ef0763..6a58dedb2 100644 --- a/src/game/server/hl2/npc_citizen17.h +++ b/src/game/server/hl2/npc_citizen17.h @@ -194,7 +194,7 @@ class CNPC_Citizen : public CNPC_PlayerCompanion void SetSquad( CAI_Squad *pSquad ); void AddInsignia(); void RemoveInsignia(); - bool SpeakCommandResponse( AIConcept_t concept, const char *modifiers = NULL ); + bool SpeakCommandResponse( AIConcept_t conceptName, const char *modifiers = NULL ); //--------------------------------- // Scanner interaction diff --git a/src/game/server/hl2/npc_scanner.cpp b/src/game/server/hl2/npc_scanner.cpp index b8b07abc2..eb3e1dd7a 100644 --- a/src/game/server/hl2/npc_scanner.cpp +++ b/src/game/server/hl2/npc_scanner.cpp @@ -507,7 +507,7 @@ void CNPC_CScanner::HandleAnimEvent( animevent_t *pEvent ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetEngineSound( void ) +const char *CNPC_CScanner::GetEngineSound( void ) { if( m_bIsClawScanner ) return "NPC_SScanner.FlyLoop"; @@ -2259,7 +2259,7 @@ void CNPC_CScanner::StartTask( const Task_t *pTask ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetScannerSoundPrefix( void ) +const char *CNPC_CScanner::GetScannerSoundPrefix( void ) { if( m_bIsClawScanner ) return "NPC_SScanner"; diff --git a/src/game/server/hl2/npc_scanner.h b/src/game/server/hl2/npc_scanner.h index ed49277b9..8b47793b4 100644 --- a/src/game/server/hl2/npc_scanner.h +++ b/src/game/server/hl2/npc_scanner.h @@ -49,7 +49,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Precache(void); void RunTask( const Task_t *pTask ); int SelectSchedule(void); - virtual char *GetScannerSoundPrefix( void ); + virtual const char *GetScannerSoundPrefix( void ); void Spawn(void); void Activate(); void StartTask( const Task_t *pTask ); @@ -74,7 +74,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Event_Killed( const CTakeDamageInfo &info ); - char *GetEngineSound( void ); + const char *GetEngineSound( void ); virtual float MinGroundDist(void); virtual void AdjustScannerVelocity( void ); diff --git a/src/game/server/hl2/npc_strider.cpp b/src/game/server/hl2/npc_strider.cpp index 8e9e0df2b..fff784132 100644 --- a/src/game/server/hl2/npc_strider.cpp +++ b/src/game/server/hl2/npc_strider.cpp @@ -1790,7 +1790,7 @@ void CNPC_Strider::RunTask( const Task_t *pTask ) break; case TASK_PLAY_SEQUENCE: - if( m_bFastCrouch && pTask->flTaskData == ACT_CROUCH ) + if( m_bFastCrouch && pTask->flTaskData == (float)ACT_CROUCH ) { SetPlaybackRate( 10.0f ); if( IsSequenceFinished() ) diff --git a/src/game/server/hltvdirector.h b/src/game/server/hltvdirector.h index 25f1dbd93..deb1b5fb4 100644 --- a/src/game/server/hltvdirector.h +++ b/src/game/server/hltvdirector.h @@ -67,7 +67,7 @@ class CHLTVDirector : public CGameEventListener, public CBaseGameSystemPerFrame, virtual void Shutdown(); virtual void FrameUpdatePostEntityThink(); virtual void LevelInitPostEntity(); - virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } + virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } bool SetCameraMan( int iPlayerIndex ); int GetCameraMan() { return m_iCameraManIndex; } diff --git a/src/game/server/logicentities.cpp b/src/game/server/logicentities.cpp index 8426efa8c..7ad133890 100644 --- a/src/game/server/logicentities.cpp +++ b/src/game/server/logicentities.cpp @@ -1303,9 +1303,9 @@ void CMultiSource::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE if ( IsTriggered( pActivator ) ) { DevMsg( 2, "Multisource %s enabled (%d inputs)\n", GetDebugName(), m_iTotal ); - USE_TYPE useType = USE_TOGGLE; + USE_TYPE useType2 = USE_TOGGLE; if ( m_globalstate != NULL_STRING ) - useType = USE_ON; + useType2 = USE_ON; m_OnTrigger.FireOutput(pActivator, this); } diff --git a/src/game/server/nav_generate.cpp b/src/game/server/nav_generate.cpp index d55cc001d..c6fd729b2 100644 --- a/src/game/server/nav_generate.cpp +++ b/src/game/server/nav_generate.cpp @@ -759,10 +759,10 @@ void CNavMesh::RaiseAreasWithInternalObstacles() // yes, this edge is blocked iEdgesBlocked++; // keep track of obstacle height and start and end distance for this edge - float obstacleZ = nodeFrom->GetPosition()->z + obstacleHeight; - if ( obstacleZ > obstacleZThisDir[iEdge] ) + float flObstacleZ = nodeFrom->GetPosition()->z + obstacleHeight; + if ( flObstacleZ > obstacleZThisDir[iEdge] ) { - obstacleZThisDir[iEdge] = obstacleZ; + obstacleZThisDir[iEdge] = flObstacleZ; } obstacleStartDistThisDir = MIN( nodeFrom->m_obstacleStartDist[dir], obstacleStartDistThisDir ); obstacleEndDistThisDir = MAX( nodeFrom->m_obstacleEndDist[dir], obstacleEndDistThisDir ); @@ -987,8 +987,8 @@ bool CNavMesh::CreateObstacleTopAreaIfNecessary( CNavArea *area, CNavArea *areaO if ( areaOther->Contains( *nodeTowardOtherArea->GetPosition() ) ) { float z = areaOther->GetZ( nodeTowardOtherArea->GetPosition()->x, nodeTowardOtherArea->GetPosition()->y ); - float deltaZ = fabs( nodeTowardOtherArea->GetPosition()->z - z ); - if ( deltaZ < 2.0f ) + float flDeltaZ = fabs( nodeTowardOtherArea->GetPosition()->z - z ); + if ( flDeltaZ < 2.0f ) { bInOtherArea = true; } @@ -1596,7 +1596,7 @@ static bool testStitchConnection( CNavArea *source, CNavArea *target, const Vect else { // test going up ClimbUpHeight - bool success = false; + bool bSuccess = false; for ( float height = StepHeight; height <= ClimbUpHeight; height += 1.0f ) { trace_t tr; @@ -1623,7 +1623,7 @@ static bool testStitchConnection( CNavArea *source, CNavArea *target, const Vect break; } - success = true; + bSuccess = true; break; } } @@ -3087,7 +3087,7 @@ bool CNavMesh::TestArea( CNavNode *node, int width, int height ) const Vector *nw = node->GetPosition(); vertNode = node; - for( int y=0; yGetConnectedNode( SOUTH ); } @@ -3101,7 +3101,7 @@ bool CNavMesh::TestArea( CNavNode *node, int width, int height ) const Vector *ne = horizNode->GetPosition(); vertNode = horizNode; - for( int y=0; yGetConnectedNode( SOUTH ); } diff --git a/src/game/server/netpropmanager.cpp b/src/game/server/netpropmanager.cpp index a9fe9982c..6ba2c3462 100644 --- a/src/game/server/netpropmanager.cpp +++ b/src/game/server/netpropmanager.cpp @@ -17,7 +17,7 @@ extern void SendProxy_StringT_To_String( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID ); -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; extern ISaveRestoreOps* ActivityDataOps(); //----------------------------------------------------------------------------- diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 18f1c6eee..eb2c382df 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -4242,7 +4242,7 @@ void CBasePlayer::CheckSuitUpdate() // seconds, then we won't repeat playback of this word or sentence // for at least that number of seconds. -void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) +void CBasePlayer::SetSuitUpdate(const char *name, int fgroup, int iNoRepeatTime) { int i; int isentence; diff --git a/src/game/server/player.h b/src/game/server/player.h index 608fa2620..cbe648f3c 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -583,7 +583,7 @@ class CBasePlayer : public CBaseCombatCharacter virtual float GetHeldObjectMass( IPhysicsObject *pHeldObject ); void CheckSuitUpdate(); - void SetSuitUpdate(char *name, int fgroup, int iNoRepeat); + void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat); virtual void UpdateGeigerCounter( void ); void CheckTimeBasedDamage( void ); diff --git a/src/game/server/replaydirector.h b/src/game/server/replaydirector.h index 09ead00e5..bb68616c4 100644 --- a/src/game/server/replaydirector.h +++ b/src/game/server/replaydirector.h @@ -67,7 +67,7 @@ class CReplayDirector : public CGameEventListener, public CBaseGameSystemPerFram virtual void Shutdown(); virtual void FrameUpdatePostEntityThink(); virtual void LevelInitPostEntity(); - virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } + virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } bool SetCameraMan( int iPlayerIndex ); int GetCameraMan() { return m_iCameraManIndex; } diff --git a/src/game/server/sceneentity.cpp b/src/game/server/sceneentity.cpp index 46f724e60..a534e1949 100644 --- a/src/game/server/sceneentity.cpp +++ b/src/game/server/sceneentity.cpp @@ -2282,16 +2282,16 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata ) char modifiers[ 512 ]; Q_snprintf( modifiers, sizeof( modifiers ), "scene:%s", STRING( GetEntityName() ) ); - AIConcept_t concept(inputdata.value.String()); + AIConcept_t conceptName(inputdata.value.String()); for ( int i = 0; i < c; i++ ) { CAI_BaseActor *npc = candidates[ i ]; Assert( npc ); AI_CriteriaSet set; - npc->GatherCriteria( &set, concept, modifiers ); + npc->GatherCriteria( &set, conceptName, modifiers ); AI_Response response; - if ( !npc->FindResponse( response, concept, &set ) ) + if ( !npc->FindResponse( response, conceptName, &set ) ) continue; float duration = npc->GetResponseDuration( &response ); @@ -3453,7 +3453,7 @@ void MissingSceneWarning( char const *scenename ) static CUtlSymbolTable missing; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == missing.Find( scenename ) ) + if ( !missing.Find( scenename ).IsValid() ) { missing.AddString( scenename ); @@ -4755,7 +4755,7 @@ END_DATADESC() int SceneNameAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ) { // chop the command off the begining of the string - char *commandName = "scene_playvcd"; + const char *commandName = "scene_playvcd"; int numMatches = 0; partial += Q_strlen( commandName ) + 1; int partialLength = Q_strlen( partial ); diff --git a/src/game/server/sendproxy.cpp b/src/game/server/sendproxy.cpp index 3f9d2eb2b..98bc42078 100644 --- a/src/game/server/sendproxy.cpp +++ b/src/game/server/sendproxy.cpp @@ -51,7 +51,7 @@ void SendProxy_ShortAddOne( const SendProp *pProp, const void *pStruct, const vo } SendProp SendPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -61,7 +61,7 @@ SendProp SendPropBool( SendProp SendPropEHandle( - char *pVarName, + const char *pVarName, int offset, int flags, int sizeofVar, @@ -70,7 +70,7 @@ SendProp SendPropEHandle( return SendPropInt( pVarName, offset, sizeofVar, NUM_NETWORKED_EHANDLE_BITS, SPROP_UNSIGNED|flags, proxyFn ); } -SendProp SendPropIntWithMinusOneFlag( char *pVarName, int offset, int sizeofVar, int nBits, SendVarProxyFn proxyFn ) +SendProp SendPropIntWithMinusOneFlag( const char *pVarName, int offset, int sizeofVar, int nBits, SendVarProxyFn proxyFn ) { return SendPropInt( pVarName, offset, sizeofVar, nBits, SPROP_UNSIGNED, proxyFn ); } @@ -129,7 +129,7 @@ static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const vo // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -171,7 +171,7 @@ static void SendProxy_PredictableIdToInt( const SendProp *pProp, const void *pSt // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -187,7 +187,7 @@ void SendProxy_StringT_To_String( const SendProp *pProp, const void *pStruct, co } -SendProp SendPropStringT( char *pVarName, int offset, int sizeofVar ) +SendProp SendPropStringT( const char *pVarName, int offset, int sizeofVar ) { // Make sure it's the right type. Assert( sizeofVar == sizeof( string_t ) ); diff --git a/src/game/server/sendproxy.h b/src/game/server/sendproxy.h index 60bfb3ad0..beff8f739 100644 --- a/src/game/server/sendproxy.h +++ b/src/game/server/sendproxy.h @@ -20,31 +20,31 @@ void SendProxy_IntAddOne( const SendProp *pProp, const void *pStruct, const void void SendProxy_ShortAddOne( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID ); SendProp SendPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ); SendProp SendPropEHandle( - char *pVarName, + const char *pVarName, int offset, int flags = 0, int sizeofVar=SIZEOF_IGNORE, SendVarProxyFn proxyFn=SendProxy_EHandleToInt ); SendProp SendPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #if !defined( NO_ENTITY_PREDICTION ) && defined( USE_PREDICTABLEID ) SendProp SendPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #endif SendProp SendPropIntWithMinusOneFlag( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int bits=-1, @@ -52,7 +52,7 @@ SendProp SendPropIntWithMinusOneFlag( // Send a string_t as a string property. -SendProp SendPropStringT( char *pVarName, int offset, int sizeofVar ); +SendProp SendPropStringT( const char *pVarName, int offset, int sizeofVar ); //----------------------------------------------------------------------------- // Purpose: Proxy that only sends data to team members diff --git a/src/game/server/skyboxswapper.cpp b/src/game/server/skyboxswapper.cpp index 4caac47d1..df400e5e5 100644 --- a/src/game/server/skyboxswapper.cpp +++ b/src/game/server/skyboxswapper.cpp @@ -57,7 +57,7 @@ void CSkyboxSwapper::Precache( void ) } char name[ MAX_PATH ]; - char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; + const char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; for ( int i = 0; i < 6; i++ ) { Q_snprintf( name, sizeof( name ), "skybox/%s%s", m_iszSkyboxName.ToCStr(), skyboxsuffix[i] ); diff --git a/src/game/server/swarm/asw_ai_behavior_charge.cpp b/src/game/server/swarm/asw_ai_behavior_charge.cpp index 79c638857..27c11dfd9 100644 --- a/src/game/server/swarm/asw_ai_behavior_charge.cpp +++ b/src/game/server/swarm/asw_ai_behavior_charge.cpp @@ -255,7 +255,7 @@ void CAI_ASW_ChargeBehavior::StartTask( const Task_t *pTask ) MovementActivity = ACT_RUN_AGITATED; } - if ( m_IsCrouched != UTL_INVAL_SYMBOL ) + if ( m_IsCrouched.IsValid() ) { if ( GetBehaviorParam( m_IsCrouched ) != 0 ) { diff --git a/src/game/server/swarm/asw_ai_behavior_melee.cpp b/src/game/server/swarm/asw_ai_behavior_melee.cpp index 0c730e2af..c9042f0ed 100644 --- a/src/game/server/swarm/asw_ai_behavior_melee.cpp +++ b/src/game/server/swarm/asw_ai_behavior_melee.cpp @@ -371,7 +371,7 @@ void CAI_ASW_MeleeBehavior::HullAttack( float flDistance, float flDamage, float { SetBehaviorParam( m_StatusParm, 1 ); // Play a random attack hit sound - if ( AttackHitSound != UTL_INVAL_SYMBOL ) + if ( AttackHitSound.IsValid() ) { GetOuter()->EmitSound( GetSymbolText( AttackHitSound ) ); } diff --git a/src/game/server/swarm/asw_alien.h b/src/game/server/swarm/asw_alien.h index 058199bce..d5e87fd00 100644 --- a/src/game/server/swarm/asw_alien.h +++ b/src/game/server/swarm/asw_alien.h @@ -19,7 +19,7 @@ class TakeDamageInfo; class CASW_Spawner; class CAI_ASW_FlinchBehavior; class CAI_ASW_Behavior; -enum BehaviorEvent_t; +enum BehaviorEvent_t : int; // Keep track of recent damage events for use in asw_ai_behavior_combat_stun.cpp static const int ASW_NUM_RECENT_DAMAGE = 8; diff --git a/src/game/server/swarm/asw_broadcast_camera.cpp b/src/game/server/swarm/asw_broadcast_camera.cpp index ebd972927..ac595644b 100644 --- a/src/game/server/swarm/asw_broadcast_camera.cpp +++ b/src/game/server/swarm/asw_broadcast_camera.cpp @@ -526,7 +526,7 @@ void CASW_Broadcast_Camera::Move() // Subtract movement from the previous frame //m_moveDistance -= m_flSpeed * gpGlobals->frametime; - m_moveDistance -= VectorNormalize(GetAbsOrigin() - m_vecLastPos); + m_moveDistance -= VectorLength( GetAbsOrigin() - m_vecLastPos ); // Have we moved enough to reach the target? if ( m_moveDistance <= 0 ) diff --git a/src/game/server/swarm/asw_drone_advanced.cpp b/src/game/server/swarm/asw_drone_advanced.cpp index 4c33332a7..cbfef16f2 100644 --- a/src/game/server/swarm/asw_drone_advanced.cpp +++ b/src/game/server/swarm/asw_drone_advanced.cpp @@ -954,7 +954,7 @@ void CASW_Drone_Advanced::StartTouch( CBaseEntity *pOther ) } } -void CASW_Drone_Advanced::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Drone_Advanced::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_drone_advanced.h b/src/game/server/swarm/asw_drone_advanced.h index be1632965..959da165c 100644 --- a/src/game/server/swarm/asw_drone_advanced.h +++ b/src/game/server/swarm/asw_drone_advanced.h @@ -28,7 +28,7 @@ class CASW_Drone_Advanced : public CASW_Alien_Jumper virtual int MeleeAttack1Conditions( float flDot, float flDist ); virtual int MeleeAttack2Conditions( float flDot, float flDist ); - void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); virtual bool MovementCost( int moveType, const Vector &vecStart, const Vector &vecEnd, float *pCost ); diff --git a/src/game/server/swarm/asw_env_explosion.cpp b/src/game/server/swarm/asw_env_explosion.cpp index c0a24c0df..1bb8e019f 100644 --- a/src/game/server/swarm/asw_env_explosion.cpp +++ b/src/game/server/swarm/asw_env_explosion.cpp @@ -243,7 +243,7 @@ void ASWExplosionCreate( const Vector ¢er, const QAngle &angles, CASWEnvExplosion *pExplosion = (CASWEnvExplosion*)CBaseEntity::Create( "asw_env_explosion", center, angles, pOwner ); Q_snprintf( buf,sizeof(buf), "%3d", magnitude ); - char *szKeyName = "iDamage"; + const char *szKeyName = "iDamage"; char *szValue = buf; pExplosion->KeyValue( szKeyName, szValue ); diff --git a/src/game/server/swarm/asw_extinguisher_projectile.cpp b/src/game/server/swarm/asw_extinguisher_projectile.cpp index a6ff9e005..31b176155 100644 --- a/src/game/server/swarm/asw_extinguisher_projectile.cpp +++ b/src/game/server/swarm/asw_extinguisher_projectile.cpp @@ -282,7 +282,7 @@ void CASW_Extinguisher_Projectile::PhysicsSimulate() return; // slow down the projectile's velocity - SetAbsVelocity( GetAbsVelocity() * ( 1 - gpGlobals->frametime * ASW_EXTINGUISHER_PROJECTILE_ACCN / CASW_Weapon_Flamer::EXTINGUISHER_PROJECTILE_AIR_VELOCITY ) ); + SetAbsVelocity( GetAbsVelocity() * ( 1 - gpGlobals->frametime * ASW_EXTINGUISHER_PROJECTILE_ACCN / (float)CASW_Weapon_Flamer::EXTINGUISHER_PROJECTILE_AIR_VELOCITY ) ); if ( asw_flamer_debug.GetBool() ) { diff --git a/src/game/server/swarm/asw_inhabitable_npc.cpp b/src/game/server/swarm/asw_inhabitable_npc.cpp index ababf278c..0f88b1a5b 100644 --- a/src/game/server/swarm/asw_inhabitable_npc.cpp +++ b/src/game/server/swarm/asw_inhabitable_npc.cpp @@ -698,9 +698,6 @@ int CASW_Inhabitable_NPC::OnTakeDamage_Alive( const CTakeDamageInfo &info ) } else { - CASW_Burning *pBurning = NULL; - CBaseEntity *pInflictor = info.GetInflictor(); - if ( ( info.GetDamageType() & DMG_DIRECT ) && ( IsFrozen() || IsOnFire() ) ) { bool bIsMelee = ( newInfo.GetDamageType() & DMG_SLASH ) || ( newInfo.GetDamageType() & DMG_CLUB ); diff --git a/src/game/server/swarm/asw_marine.cpp b/src/game/server/swarm/asw_marine.cpp index c8f1668d5..18fd0c34e 100644 --- a/src/game/server/swarm/asw_marine.cpp +++ b/src/game/server/swarm/asw_marine.cpp @@ -3644,8 +3644,8 @@ void CASW_Marine::Script_Speak( const char *pszConcept, float delay, const char criteria.Merge( pszCriteria ); } - AIConcept_t concept( pszConcept ); - QueueSpeak( concept, this, delay, criteria ); + AIConcept_t conceptName( pszConcept ); + QueueSpeak( conceptName, this, delay, criteria ); } void CASW_Marine::SetMarineRolls( bool bRolls ) diff --git a/src/game/server/swarm/asw_marine.h b/src/game/server/swarm/asw_marine.h index 7170f955b..a3c4214e1 100644 --- a/src/game/server/swarm/asw_marine.h +++ b/src/game/server/swarm/asw_marine.h @@ -513,7 +513,7 @@ class CASW_Marine : public CASW_VPhysics_NPC, public IASWPlayerAnimStateHelpers, virtual void TookAmmoPickup( CBaseEntity* pAmmoPickup ); int GetAllAmmoCount( void ); int GetTotalAmmoCount(int iAmmoIndex); - int GetTotalAmmoCount(char *szName); + int GetTotalAmmoCount(const char *szName); int GetWeaponAmmoCount(int iAmmoIndex); int GetWeaponAmmoCount(char *szName); void ThrowAmmo(int iInventorySlot, int iTargetMarine, int iAmmoType); // throwing ammo from the ammo bag diff --git a/src/game/server/swarm/asw_marine_resource.cpp b/src/game/server/swarm/asw_marine_resource.cpp index 37be8e442..2e657f792 100644 --- a/src/game/server/swarm/asw_marine_resource.cpp +++ b/src/game/server/swarm/asw_marine_resource.cpp @@ -119,8 +119,8 @@ IMPLEMENT_SERVERCLASS_ST( CASW_Marine_Resource, DT_ASW_Marine_Resource ) SendPropEHandle( SENDINFO( m_OriginalCommander ) ), SendPropEHandle( SENDINFO( m_Commander ) ), SendPropIntWithMinusOneFlag( SENDINFO( m_iCommanderIndex ), NumBitsForCount( ABSOLUTE_PLAYER_LIMIT + 1 ) ), - SendPropArray( SendPropIntWithMinusOneFlag( SENDINFO_ARRAY( m_iWeaponsInSlots ), NumBitsForCount( MAX( ASW_NUM_EQUIP_REGULAR, ASW_NUM_EQUIP_EXTRA ) + 1 ) ), m_iWeaponsInSlots ), - SendPropArray( SendPropIntWithMinusOneFlag( SENDINFO_ARRAY( m_iInitialWeaponsInSlots ), NumBitsForCount( MAX( ASW_NUM_EQUIP_REGULAR, ASW_NUM_EQUIP_EXTRA ) + 1 ) ), m_iInitialWeaponsInSlots ), + SendPropArray( SendPropIntWithMinusOneFlag( SENDINFO_ARRAY( m_iWeaponsInSlots ), NumBitsForCount( MAX( ( int )ASW_NUM_EQUIP_REGULAR, ( int )ASW_NUM_EQUIP_EXTRA ) + 1 ) ), m_iWeaponsInSlots ), + SendPropArray( SendPropIntWithMinusOneFlag( SENDINFO_ARRAY( m_iInitialWeaponsInSlots ), NumBitsForCount( MAX( ( int )ASW_NUM_EQUIP_REGULAR, ( int )ASW_NUM_EQUIP_EXTRA ) + 1 ) ), m_iInitialWeaponsInSlots ), SendPropBool( SENDINFO( m_bInfested ) ), SendPropBool( SENDINFO( m_bInhabited ) ), SendPropInt( SENDINFO( m_iServerFiring ), 2, SPROP_UNSIGNED ), diff --git a/src/game/server/swarm/asw_marine_schedule.cpp b/src/game/server/swarm/asw_marine_schedule.cpp index b6543b1ce..60d23eb21 100644 --- a/src/game/server/swarm/asw_marine_schedule.cpp +++ b/src/game/server/swarm/asw_marine_schedule.cpp @@ -870,7 +870,7 @@ int CASW_Marine::SelectTakeAmmoSchedule() } } - EHANDLE hAmmo = ( m_hTakeAmmo.Get() ? m_hTakeAmmo : ( m_hTakeAmmoDrop.Get() ? m_hTakeAmmoDrop : NULL ) ); + EHANDLE hAmmo = m_hTakeAmmo.Get() ? EHANDLE( m_hTakeAmmo ) : ( m_hTakeAmmoDrop.Get() ? EHANDLE( m_hTakeAmmoDrop ) : EHANDLE() ); if ( hAmmo != NULL ) { diff --git a/src/game/server/swarm/asw_player.h b/src/game/server/swarm/asw_player.h index fc8aa428e..30f0582d3 100644 --- a/src/game/server/swarm/asw_player.h +++ b/src/game/server/swarm/asw_player.h @@ -14,6 +14,7 @@ #include "asw_info_message_shared.h" #include "basemultiplayerplayer.h" #include "rd_inventory_shared.h" +#include "rd_inventory_command.h" #include "info_player_start.h" class CASW_Inhabitable_NPC; diff --git a/src/game/server/swarm/asw_sentry_top.cpp b/src/game/server/swarm/asw_sentry_top.cpp index 290a88c2d..e59a1cda9 100644 --- a/src/game/server/swarm/asw_sentry_top.cpp +++ b/src/game/server/swarm/asw_sentry_top.cpp @@ -536,7 +536,7 @@ void CASW_Sentry_Top::CheckFiring() float flDist = fabs( m_fGoalYaw - m_fCurrentYaw ); flDist = fsel( flDist - 180, 360 - flDist, flDist ); - if ( ( flDist < ASW_SENTRY_FIRE_ANGLE_THRESHOLD ) || ( HasHysteresis() && !m_hEnemy ) ) + if ( ( flDist < (float)ASW_SENTRY_FIRE_ANGLE_THRESHOLD ) || ( HasHysteresis() && !m_hEnemy ) ) { Fire(); } diff --git a/src/game/server/swarm/asw_sentry_top_cannon.cpp b/src/game/server/swarm/asw_sentry_top_cannon.cpp index 4c139ce02..f38b12213 100644 --- a/src/game/server/swarm/asw_sentry_top_cannon.cpp +++ b/src/game/server/swarm/asw_sentry_top_cannon.cpp @@ -189,7 +189,7 @@ CAI_BaseNPC *CASW_Sentry_Top_Cannon::SelectOptimalEnemy() // the angle between my current yaw and what's needed to hit the target float flSwivelNeeded = fabs( UTIL_AngleDiff( // i wish we weren't storing euler angles UTIL_VecToYaw( vMeToTarget ), m_fDeployYaw ) ); - flSwivelNeeded /= ASW_SENTRY_ANGLE; // normalize to 0..2 + flSwivelNeeded /= (float)ASW_SENTRY_ANGLE; // normalize to 0..2 float fBigness = 0.0f; diff --git a/src/game/server/swarm/asw_sentry_top_icer.cpp b/src/game/server/swarm/asw_sentry_top_icer.cpp index a5804ab01..1f5c3f694 100644 --- a/src/game/server/swarm/asw_sentry_top_icer.cpp +++ b/src/game/server/swarm/asw_sentry_top_icer.cpp @@ -206,7 +206,7 @@ CAI_BaseNPC * CASW_Sentry_Top_Icer::SelectOptimalEnemy() // the angle between my current yaw and what's needed to hit the target float flSwivelNeeded = fabs( UTIL_AngleDiff( // i wish we weren't storing euler angles UTIL_VecToYaw( vMeToTarget ) , m_fDeployYaw ) ); - flSwivelNeeded /= ASW_SENTRY_ANGLE; // normalize to 0..2 + flSwivelNeeded /= (float)ASW_SENTRY_ANGLE; // normalize to 0..2 float flFreezeNeeded = 1 - pCandidate->GetFrozenAmount(); diff --git a/src/game/server/swarm/asw_shieldbug.cpp b/src/game/server/swarm/asw_shieldbug.cpp index b9b12457f..e5def0eeb 100644 --- a/src/game/server/swarm/asw_shieldbug.cpp +++ b/src/game/server/swarm/asw_shieldbug.cpp @@ -657,7 +657,7 @@ int CASW_Shieldbug::MeleeAttack1Conditions( float flDot, float flDist ) return COND_CAN_MELEE_ATTACK1; } -void CASW_Shieldbug::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Shieldbug::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_shieldbug.h b/src/game/server/swarm/asw_shieldbug.h index 8e51a074b..154c166d1 100644 --- a/src/game/server/swarm/asw_shieldbug.h +++ b/src/game/server/swarm/asw_shieldbug.h @@ -29,7 +29,7 @@ class CASW_Shieldbug : public CASW_Alien_Shover, public IShieldbugAutoList float GetSequenceGroundSpeed( int iSequence ); int MeleeAttack1Conditions( float flDot, float flDist ); int MeleeAttack2Conditions ( float flDot, float flDist ); - void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); float MaxYawSpeed( void ); void HandleAnimEvent( animevent_t *pEvent ); Class_T Classify( void ) { return (Class_T) CLASS_ASW_SHIELDBUG; } diff --git a/src/game/server/swarm/asw_simple_alien.cpp b/src/game/server/swarm/asw_simple_alien.cpp index 1b2fbe7fe..15d769bb1 100644 --- a/src/game/server/swarm/asw_simple_alien.cpp +++ b/src/game/server/swarm/asw_simple_alien.cpp @@ -274,7 +274,7 @@ void CASW_Simple_Alien::SetState( int iNewState ) // Movement // ========================================= -void CASW_Simple_Alien::SetMoveTarget( Vector &vecTarget ) +void CASW_Simple_Alien::SetMoveTarget( const Vector &vecTarget ) { m_vecMoveTarget = vecTarget; m_hMoveTarget = NULL; @@ -684,7 +684,7 @@ bool CASW_Simple_Alien::ShouldAttack() return ( dist < 100.0f ); } -void CASW_Simple_Alien::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Simple_Alien::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_simple_alien.h b/src/game/server/swarm/asw_simple_alien.h index 56ce60a37..3c25016ac 100644 --- a/src/game/server/swarm/asw_simple_alien.h +++ b/src/game/server/swarm/asw_simple_alien.h @@ -46,7 +46,7 @@ class CASW_Simple_Alien : public CBaseAnimating, public IASW_Spawnable_NPC // movement virtual Vector PickRandomDestination(float dist, Vector bias); - virtual void SetMoveTarget(Vector &vecTarget); + virtual void SetMoveTarget(const Vector &vecTarget); virtual float GetIdealSpeed() const; virtual float GetYawSpeed() const; virtual float GetIdealYaw(); @@ -71,7 +71,7 @@ class CASW_Simple_Alien : public CBaseAnimating, public IASW_Spawnable_NPC int m_iState; // attacking - virtual void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + virtual void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); virtual CBaseEntity *CheckTraceHullAttack( float flDist, const Vector &mins, const Vector &maxs, int iDamage, int iDmgType, float forceScale = 1.0f, bool bDamageAnyNPC = false ); virtual CBaseEntity *CheckTraceHullAttack( const Vector &vStart, const Vector &vEnd, const Vector &mins, const Vector &maxs, int iDamage, int iDmgType, float flForceScale = 1.0f, bool bDamageAnyNPC = false ); virtual void ReachedEndOfSequence(); diff --git a/src/game/server/swarm_sdk_server.vcxproj b/src/game/server/swarm_sdk_server.vcxproj index 1afdd6902..bbfe704b0 100644 --- a/src/game/server/swarm_sdk_server.vcxproj +++ b/src/game/server/swarm_sdk_server.vcxproj @@ -1,4 +1,4 @@ - + @@ -125,6 +125,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -234,6 +235,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -341,6 +343,7 @@ exit /b 0 26495;26812 true false + stdcpp20 true true diff --git a/src/game/server/textstatsmgr.cpp b/src/game/server/textstatsmgr.cpp index b51fa2646..cb16727c4 100644 --- a/src/game/server/textstatsmgr.cpp +++ b/src/game/server/textstatsmgr.cpp @@ -58,7 +58,7 @@ char *CTextStatsMgr::GetStatsFilename( void ) return m_szStatFilename; } -void CTextStatsMgr::SetStatsFilename( char *sFilename ) +void CTextStatsMgr::SetStatsFilename( const char *sFilename ) { Assert( sFilename && sFilename[0] ); diff --git a/src/game/server/textstatsmgr.h b/src/game/server/textstatsmgr.h index ce2178196..2033ff60c 100644 --- a/src/game/server/textstatsmgr.h +++ b/src/game/server/textstatsmgr.h @@ -34,7 +34,7 @@ class CTextStatsMgr char *GetStatsFilename( void ); // Set the filename to write stats to, if none is specified when writing - void SetStatsFilename( char *sFilename ); + void SetStatsFilename( const char *sFilename ); private: char m_szStatFilename[ MAX_PATH ]; diff --git a/src/game/server/util.cpp b/src/game/server/util.cpp index cb621525f..49116eb44 100644 --- a/src/game/server/util.cpp +++ b/src/game/server/util.cpp @@ -1474,7 +1474,7 @@ Vector UTIL_RandomBloodVector( void ) // Input : // Output : //------------------------------------------------------------------------------ -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { CBaseEntity *pEntity = pTrace->m_pEnt; @@ -1853,7 +1853,7 @@ void UTIL_PrecacheOther( const char *szClassname, const char *modelName ) // UTIL_LogPrintf - Prints a logged message to console. // Preceded by LOG: ( timestamp ) < message > //========================================================= -void UTIL_LogPrintf( char *fmt, ... ) +void UTIL_LogPrintf( const char *fmt, ... ) { if ( !g_bIsLogging ) return; diff --git a/src/game/server/util.h b/src/game/server/util.h index 5b9b2bd59..5cf3dfe31 100644 --- a/src/game/server/util.h +++ b/src/game/server/util.h @@ -328,7 +328,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color void UTIL_BloodSpray( const Vector &pos, const Vector &dir, int color, int amount, int flags ); void UTIL_BloodSprayPrecache(); Vector UTIL_RandomBloodVector( void ); -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); void UTIL_PlayerDecalTrace( trace_t *pTrace, int playernum ); void UTIL_Smoke( const Vector &origin, const float scale, const float framerate ); void UTIL_AxisStringToPointDir( Vector &start, Vector &dir, const char *pString ); @@ -450,7 +450,7 @@ void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage ); // Writes message to console with timestamp and FragLog header. -void UTIL_LogPrintf( char *fmt, ... ); +void UTIL_LogPrintf( const char *fmt, ... ); // Sorta like FInViewCone, but for nonNPCs. float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir ); diff --git a/src/game/server/vehicle_baseserver.cpp b/src/game/server/vehicle_baseserver.cpp index fe33291fa..ad03763eb 100644 --- a/src/game/server/vehicle_baseserver.cpp +++ b/src/game/server/vehicle_baseserver.cpp @@ -2591,7 +2591,7 @@ vehiclesound g_iSoundsToStopOnExit[] = VS_ENGINE2_STOP, }; -char *vehiclesound_parsenames[VS_NUM_SOUNDS] = +const char *vehiclesound_parsenames[VS_NUM_SOUNDS] = { "skid_lowfriction", "skid_normalfriction", diff --git a/src/game/server/vehicle_sounds.h b/src/game/server/vehicle_sounds.h index fc8beac9a..d5472d7c9 100644 --- a/src/game/server/vehicle_sounds.h +++ b/src/game/server/vehicle_sounds.h @@ -30,7 +30,7 @@ enum vehiclesound VS_NUM_SOUNDS, }; -extern char *vehiclesound_parsenames[VS_NUM_SOUNDS]; +extern const char *vehiclesound_parsenames[VS_NUM_SOUNDS]; // This is a list of vehiclesounds to automatically stop when the vehicle's driver exits the vehicle #define NUM_SOUNDS_TO_STOP_ON_EXIT 4 diff --git a/src/game/server/vscript_server.cpp b/src/game/server/vscript_server.cpp index a013a3553..e97bad0d8 100644 --- a/src/game/server/vscript_server.cpp +++ b/src/game/server/vscript_server.cpp @@ -47,7 +47,7 @@ extern ScriptClassDesc_t * GetScriptDesc( CBaseEntity * ); #endif // VMPROFILE static ConVar sv_mapspawn_nut_exec( "sv_mapspawn_nut_exec", "0", FCVAR_NONE, "If set to 1, server will execute scripts/vscripts/mapspawn.nut file" ); -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; constexpr int CLAMP_COLOR(int value) { diff --git a/src/game/shared/SoundEmitterSystem.cpp b/src/game/shared/SoundEmitterSystem.cpp index 265851fd8..67defffd3 100644 --- a/src/game/shared/SoundEmitterSystem.cpp +++ b/src/game/shared/SoundEmitterSystem.cpp @@ -154,7 +154,7 @@ void WaveTrace( char const *wavname, char const *funcname ) static CUtlSymbolTable s_WaveTrace; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_WaveTrace.Find( wavname ) ) + if ( !s_WaveTrace.Find( wavname ).IsValid() ) { DevMsg( "%s directly referenced wave %s (should use game_sounds.txt system instead)\n", funcname, wavname ); @@ -244,7 +244,7 @@ class CSoundEmitterSystem : public CBaseGameSystem return; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL != m_PrecachedScriptSounds.Find( soundname ) ) + if ( m_PrecachedScriptSounds.Find( soundname ).IsValid() ) return; if (m_hPrecacheLogFile == FILESYSTEM_INVALID_HANDLE) @@ -512,7 +512,7 @@ class CSoundEmitterSystem : public CBaseGameSystem static CUtlSymbolTable s_PrecacheScriptSoundFailures; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_PrecacheScriptSoundFailures.Find( soundname ) ) + if ( !s_PrecacheScriptSoundFailures.Find( soundname ).IsValid() ) { Warning( "PrecacheScriptSound '%s' failed, no such sound script entry\n", soundname ); s_PrecacheScriptSoundFailures.AddString( soundname ); diff --git a/src/game/shared/Sprite.cpp b/src/game/shared/Sprite.cpp index 482996637..839720d29 100644 --- a/src/game/shared/Sprite.cpp +++ b/src/game/shared/Sprite.cpp @@ -279,9 +279,9 @@ void CSprite::ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pV //----------------------------------------------------------------------------- void CSprite::SetModel( const char *szModelName ) { - int index = modelinfo->GetModelIndex( szModelName ); - const model_t *model = modelinfo->GetModel( index ); - if ( model && modelinfo->GetModelType( model ) != mod_sprite ) + int iIndex = modelinfo->GetModelIndex( szModelName ); + const model_t *pModel = modelinfo->GetModel( iIndex ); + if ( pModel && modelinfo->GetModelType( pModel ) != mod_sprite ) { Msg( "Setting CSprite to non-sprite model %s\n", szModelName?szModelName:"NULL" ); } diff --git a/src/game/shared/basecombatweapon_shared.cpp b/src/game/shared/basecombatweapon_shared.cpp index a627435d1..cc4ccd5b8 100644 --- a/src/game/shared/basecombatweapon_shared.cpp +++ b/src/game/shared/basecombatweapon_shared.cpp @@ -1066,10 +1066,10 @@ int CBaseCombatWeapon::UpdateClientData( CBasePlayer *pPlayer ) // Purpose: // Input : index - //----------------------------------------------------------------------------- -void CBaseCombatWeapon::SetViewModelIndex( int index ) +void CBaseCombatWeapon::SetViewModelIndex( int iIndex ) { - Assert( index >= 0 && index < MAX_VIEWMODELS ); - m_nViewModelIndex = index; + Assert( iIndex >= 0 && iIndex < MAX_VIEWMODELS ); + m_nViewModelIndex = iIndex; } //----------------------------------------------------------------------------- @@ -1968,7 +1968,7 @@ void CBaseCombatWeapon::AddViewKick( void ) //----------------------------------------------------------------------------- // Purpose: Get the string to print death notices with //----------------------------------------------------------------------------- -char *CBaseCombatWeapon::GetDeathNoticeName( void ) +const char *CBaseCombatWeapon::GetDeathNoticeName( void ) { #if !defined( CLIENT_DLL ) return (char*)STRING( m_iszName ); diff --git a/src/game/shared/basecombatweapon_shared.h b/src/game/shared/basecombatweapon_shared.h index b47cc1f6f..ad9ba51e1 100644 --- a/src/game/shared/basecombatweapon_shared.h +++ b/src/game/shared/basecombatweapon_shared.h @@ -283,7 +283,7 @@ class CBaseCombatWeapon : public BASECOMBATWEAPON_DERIVED_FROM virtual void AddViewKick( void ); // Add in the view kick for the weapon - virtual char *GetDeathNoticeName( void ); // Get the string to print death notices with + virtual const char *GetDeathNoticeName( void ); // Get the string to print death notices with CBaseCombatCharacter *GetOwner() const; void SetOwner( CBaseCombatCharacter *owner ); diff --git a/src/game/shared/baseentity_shared.cpp b/src/game/shared/baseentity_shared.cpp index de8191571..9f655de57 100644 --- a/src/game/shared/baseentity_shared.cpp +++ b/src/game/shared/baseentity_shared.cpp @@ -727,21 +727,21 @@ void CBaseEntity::SetPredictionRandomSeed( const CUserCmd *cmd ) //------------------------------------------------------------------------------ void CBaseEntity::DecalTrace( trace_t *pTrace, char const *decalName ) { - int index = decalsystem->GetDecalIndexForName( decalName ); - if ( index < 0 ) + int iIndex = decalsystem->GetDecalIndexForName( decalName ); + if ( iIndex < 0 ) return; Assert( pTrace->m_pEnt ); CBroadcastRecipientFilter filter; te->Decal( filter, 0.0, &pTrace->endpos, &pTrace->startpos, - pTrace->GetEntityIndex(), pTrace->hitbox, index ); + pTrace->GetEntityIndex(), pTrace->hitbox, iIndex ); } //----------------------------------------------------------------------------- // Purpose: Base handling for impacts against entities //----------------------------------------------------------------------------- -void CBaseEntity::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CBaseEntity::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "CBaseEntity::ImpactTrace" ); Assert( pTrace->m_pEnt ); @@ -1523,9 +1523,9 @@ bool CBaseEntity::IsBSPModel() const if ( GetSolid() == SOLID_BSP ) return true; - const model_t *model = modelinfo->GetModel( GetModelIndex() ); + const model_t *pModel = modelinfo->GetModel( GetModelIndex() ); - if ( GetSolid() == SOLID_VPHYSICS && modelinfo->GetModelType( model ) == mod_brush ) + if ( GetSolid() == SOLID_VPHYSICS && modelinfo->GetModelType( pModel ) == mod_brush ) return true; return false; diff --git a/src/game/shared/death_pose.cpp b/src/game/shared/death_pose.cpp index b4b637dde..4698158ce 100644 --- a/src/game/shared/death_pose.cpp +++ b/src/game/shared/death_pose.cpp @@ -38,7 +38,7 @@ void GetRagdollCurSequenceWithDeathPose( C_BaseAnimating *entity, matrix3x4a_t * entity->SetSequence( activity ); - entity->SetCycle( (float)frame / MAX_DEATHPOSE_FRAMES ); + entity->SetCycle( (float)frame / (float)MAX_DEATHPOSE_FRAMES ); entity->SetAbsOrigin( vAdjustedOrigin ); diff --git a/src/game/shared/func_ladder.cpp b/src/game/shared/func_ladder.cpp index 654511a38..b78e93875 100644 --- a/src/game/shared/func_ladder.cpp +++ b/src/game/shared/func_ladder.cpp @@ -326,11 +326,11 @@ int CFuncLadder::GetDismountCount() const // Input : index - // Output : CInfoLadderDismountHandle //----------------------------------------------------------------------------- -CInfoLadderDismount *CFuncLadder::GetDismount( int index ) +CInfoLadderDismount *CFuncLadder::GetDismount( int iIndex ) { - if ( index < 0 || index >= m_Dismounts.Count() ) + if ( iIndex < 0 || iIndex >= m_Dismounts.Count() ) return NULL; - return m_Dismounts[ index ]; + return m_Dismounts[ iIndex ]; } //----------------------------------------------------------------------------- diff --git a/src/game/shared/gamemovement.cpp b/src/game/shared/gamemovement.cpp index e61ee1cc4..4c4563c3c 100644 --- a/src/game/shared/gamemovement.cpp +++ b/src/game/shared/gamemovement.cpp @@ -604,7 +604,7 @@ void COM_Log( char *pszFile, char *fmt, ...) va_list argptr; char string[1024]; FileHandle_t fp; - char *pfilename; + const char *pfilename; if ( !pszFile ) { diff --git a/src/game/shared/props_shared.cpp b/src/game/shared/props_shared.cpp index 33eee92d7..597ec24c7 100644 --- a/src/game/shared/props_shared.cpp +++ b/src/game/shared/props_shared.cpp @@ -705,7 +705,7 @@ const char *GetMassEquivalent(float flMass) static struct { float flMass; - char *sz; + const char *sz; } masstext[] = { { 5e-6, "snowflake" }, diff --git a/src/game/shared/sharedvar.h b/src/game/shared/sharedvar.h index 5746388d2..2ba8b3e1b 100644 --- a/src/game/shared/sharedvar.h +++ b/src/game/shared/sharedvar.h @@ -40,7 +40,7 @@ { if ( iIn == INVALID_NETWORKED_EHANDLE_VALUE ) { - return INVALID_EHANDLE_INDEX; + return EHANDLE( INVALID_EHANDLE_INDEX ); } else { diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index 21a2021e8..c2ba839c0 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -3823,7 +3823,7 @@ CBaseStart* CAlienSwarm::GetMarineSpawnPoint(int nMarineProfile /* = -1 */) CBaseStart* pStartEntityCandidate = NULL; CBaseStart* pStartEntity = NULL; - while ( pStartEntity = assert_cast< CBaseStart* >( gEntList.FindEntityByClassname( pStartEntity, "info_player_start" ) ) ) + while ( ( pStartEntity = assert_cast< CBaseStart* >( gEntList.FindEntityByClassname( pStartEntity, "info_player_start" ) ) ) ) { if ( pStartEntity->m_bUsed ) continue; @@ -5908,7 +5908,7 @@ bool CAlienSwarm::ShouldCollide( int collisionGroup0, int collisionGroup1 ) } #define SHOULD_COLLIDE( group0, group1, should ) \ - ASSERT_INVARIANT( group0 <= group1 ); \ + ASSERT_INVARIANT( ( int )( group0 ) <= ( int )( group1 ) ); \ if ( collisionGroup0 == group0 && collisionGroup1 == group1 ) \ return should #define ALWAYS_COLLIDE( group, should ) \ @@ -6121,7 +6121,7 @@ bool CAlienSwarm::ShouldCollide( int collisionGroup0, int collisionGroup1 ) SHOULD_COLLIDE( ASW_COLLISION_GROUP_PARASITE, ASW_COLLISION_GROUP_PARASITE, false ); // weapons and NPCs don't collide - ASSERT_INVARIANT( COLLISION_GROUP_WEAPON <= HL2COLLISION_GROUP_FIRST_NPC && HL2COLLISION_GROUP_FIRST_NPC <= HL2COLLISION_GROUP_LAST_NPC ); + ASSERT_INVARIANT( ( int )COLLISION_GROUP_WEAPON <= ( int )HL2COLLISION_GROUP_FIRST_NPC && ( int )HL2COLLISION_GROUP_FIRST_NPC <= ( int )HL2COLLISION_GROUP_LAST_NPC ); if ( collisionGroup0 == COLLISION_GROUP_WEAPON && (collisionGroup1 >= HL2COLLISION_GROUP_FIRST_NPC && collisionGroup1 <= HL2COLLISION_GROUP_LAST_NPC ) ) return false; diff --git a/src/game/shared/swarm/asw_holo_sentry_shared.h b/src/game/shared/swarm/asw_holo_sentry_shared.h index 9c0519195..8bf6770ec 100644 --- a/src/game/shared/swarm/asw_holo_sentry_shared.h +++ b/src/game/shared/swarm/asw_holo_sentry_shared.h @@ -34,8 +34,8 @@ class CASW_Holo_Sentry : public CBaseEntity virtual void FireGameEvent( IGameEvent *event ); - void CASW_Holo_Sentry::InputEnable( inputdata_t &inputdata ); - void CASW_Holo_Sentry::InputDisable( inputdata_t &inputdata ); + void InputEnable( inputdata_t &inputdata ); + void InputDisable( inputdata_t &inputdata ); private: COutputEvent m_OnSentryPlaced; diff --git a/src/game/shared/swarm/asw_marine_shared.cpp b/src/game/shared/swarm/asw_marine_shared.cpp index 0a60b1ce1..828a047cd 100644 --- a/src/game/shared/swarm/asw_marine_shared.cpp +++ b/src/game/shared/swarm/asw_marine_shared.cpp @@ -467,7 +467,7 @@ int CASW_Marine::GetAllAmmoCount( void ) } // include ammo in weapons this marine is carrying -int CASW_Marine::GetTotalAmmoCount( char *szName ) +int CASW_Marine::GetTotalAmmoCount( const char *szName ) { return GetTotalAmmoCount( GetAmmoDef()->Index(szName) ); } diff --git a/src/game/shared/swarm/asw_marine_skills.h b/src/game/shared/swarm/asw_marine_skills.h index 9d2cf091a..7c73b5d1f 100644 --- a/src/game/shared/swarm/asw_marine_skills.h +++ b/src/game/shared/swarm/asw_marine_skills.h @@ -35,7 +35,7 @@ ENUM_ITEM( SPARE, "swarm/SkillButtons/Spare", "#asw_points", "#asw_points_desc", 99 ) // skills -enum ASW_Skill +enum ASW_Skill : int { ASW_MARINE_SKILL_INVALID = -1, diff --git a/src/game/shared/swarm/asw_mortarbug_shell_shared.h b/src/game/shared/swarm/asw_mortarbug_shell_shared.h index cf29c37f5..162415be9 100644 --- a/src/game/shared/swarm/asw_mortarbug_shell_shared.h +++ b/src/game/shared/swarm/asw_mortarbug_shell_shared.h @@ -36,7 +36,7 @@ class CASW_Mortarbug_Shell : public CBaseCombatCharacter virtual void SetFuseLength(float fSeconds); virtual void Detonate(); - static CASW_Mortarbug_Shell *CASW_Mortarbug_Shell::CreateShell( const Vector &vecOrigin, const Vector &vecForward, CBaseEntity *pOwner ); + static CASW_Mortarbug_Shell *CreateShell( const Vector &vecOrigin, const Vector &vecForward, CBaseEntity *pOwner ); bool m_bDoScreenShake; diff --git a/src/game/shared/swarm/asw_shareddefs.h b/src/game/shared/swarm/asw_shareddefs.h index ba16d6fe4..fa53ca949 100644 --- a/src/game/shared/swarm/asw_shareddefs.h +++ b/src/game/shared/swarm/asw_shareddefs.h @@ -477,7 +477,13 @@ class CASW_AlienVolley }; // For CLASSIFY -enum +// +// The entity classes of this mod continue the Class_T numbering (they start at +// LAST_SHARED_ENTITY_CLASS), but in C++ they are a separate enumeration while +// Classify() returns Class_T. Comparing the two is intentional and done all over +// the code base, and C++20 deprecates comparisons between two different +// enumeration types (C5054), so the comparison is spelled out once here. +enum ASW_Class_T { // Alien Swarm AI // Be sure to add appropriate checks in IsAlienClass() in asw_shareddefs.cpp @@ -657,6 +663,11 @@ enum LAST_ASW_ENTITY_CLASS, }; +inline bool operator==( Class_T lhs, ASW_Class_T rhs ) { return ( int )lhs == ( int )rhs; } +inline bool operator==( ASW_Class_T lhs, Class_T rhs ) { return ( int )lhs == ( int )rhs; } +inline bool operator!=( Class_T lhs, ASW_Class_T rhs ) { return ( int )lhs != ( int )rhs; } +inline bool operator!=( ASW_Class_T lhs, Class_T rhs ) { return ( int )lhs != ( int )rhs; } + // Alien Swarm specific hitgroups enum diff --git a/src/game/shared/swarm/asw_weapon_energy_shield_shared.cpp b/src/game/shared/swarm/asw_weapon_energy_shield_shared.cpp index 775b250f1..4ab593a0b 100644 --- a/src/game/shared/swarm/asw_weapon_energy_shield_shared.cpp +++ b/src/game/shared/swarm/asw_weapon_energy_shield_shared.cpp @@ -417,7 +417,7 @@ const Vector &CASW_Weapon_Energy_Shield::GetBulletSpread() VECTOR_CONE_20DEGREES, }; - return cones[clamp( m_iConsecutiveBurstPenalty, 0, NELEMS( cones ) - 1 )]; + return cones[clamp( m_iConsecutiveBurstPenalty, 0, (int)NELEMS( cones ) - 1 )]; } const char *CASW_Weapon_Energy_Shield::GetASWShootSound( int iIndex, int &iPitch ) diff --git a/src/game/shared/swarm/asw_weapon_healgrenade_shared.h b/src/game/shared/swarm/asw_weapon_healgrenade_shared.h index 52801fb49..658b03da5 100644 --- a/src/game/shared/swarm/asw_weapon_healgrenade_shared.h +++ b/src/game/shared/swarm/asw_weapon_healgrenade_shared.h @@ -29,7 +29,7 @@ class C_ASW_HealGrenade_Projectile : public C_ASW_AOEGrenade_Projectile virtual const char* GetStartSoundName( void ) { return "ASW_MedGrenade.StartBuff"; } virtual const char* GetActivateSoundName( void ) { return "ASW_MedGrenade.GrenadeActivate"; } virtual const char* GetPingEffectName( void ) { return "medgrenade_pulse"; } - virtual const char* GetArcEffectName( int index ) { return "medgrenade_attach_arc"; } + virtual const char* GetArcEffectName( int iIndex ) { return "medgrenade_attach_arc"; } virtual const char* GetArcAttachmentName( void ) { return "zipline"; } virtual bool ShouldSpawnSphere( void ) { return true; } virtual float GetSphereScale( void ) { return 0.9f; } diff --git a/src/game/shared/swarm/asw_weapon_sentry_shared.cpp b/src/game/shared/swarm/asw_weapon_sentry_shared.cpp index 40111b064..be9bb8852 100644 --- a/src/game/shared/swarm/asw_weapon_sentry_shared.cpp +++ b/src/game/shared/swarm/asw_weapon_sentry_shared.cpp @@ -166,11 +166,11 @@ void CASW_Weapon_Sentry::ClientThink( void ) bool bSentryActive = ( pMarine->GetActiveASWWeapon() == this ); if ( bSentryActive && m_flNextDeployCheckThink < gpGlobals->curtime ) { - CASW_Marine *pMarine = GetMarine(); - if (pMarine && pMarine->GetActiveASWWeapon() == this ) + CASW_Marine *pMarine2 = GetMarine(); + if (pMarine2 && pMarine2->GetActiveASWWeapon() == this ) { m_bDisplayValid = FindValidSentrySpot(); - pMarine->SetSentryBuildDisplayEnabled( m_bDisplayValid ); + pMarine2->SetSentryBuildDisplayEnabled( m_bDisplayValid ); } m_flNextDeployCheckThink = gpGlobals->curtime + 0.2; diff --git a/src/game/shared/swarm/rd_crafting_defs.h b/src/game/shared/swarm/rd_crafting_defs.h index 4f2ce2d9a..a53a5ec42 100644 --- a/src/game/shared/swarm/rd_crafting_defs.h +++ b/src/game/shared/swarm/rd_crafting_defs.h @@ -12,7 +12,7 @@ #define RD_MAX_CRAFTING_MATERIAL_SPAWN_LOCATIONS 5 #ifdef RD_7A_DROPS -enum RD_Crafting_Material_t +enum RD_Crafting_Material_t : int { RD_CRAFTING_MATERIAL_NONE, diff --git a/src/game/shared/swarm/rd_inventory_shared.cpp b/src/game/shared/swarm/rd_inventory_shared.cpp index 024507b23..d92bc7edc 100644 --- a/src/game/shared/swarm/rd_inventory_shared.cpp +++ b/src/game/shared/swarm/rd_inventory_shared.cpp @@ -1492,7 +1492,7 @@ static class CRD_Inventory_Manager final : public CAutoGameSystem, public CGameE const ReactiveDropInventory::ItemDef_t *pDef = ReactiveDropInventory::GetItemDef( g_RD_Crafting_Material_Info[eMaterial].m_iItemDef ); char szErrorCode[16]; V_snprintf( szErrorCode, sizeof( szErrorCode ), "%d", eResult ); - ClientPrint( NULL, ASW_HUD_PRINTTALKANDCONSOLE, "#rd_crafting_pickup_error", pDef ? pDef->Name : "?err?",szErrorCode, UTIL_RD_EResultToString( eResult ) ); + ClientPrint( NULL, ASW_HUD_PRINTTALKANDCONSOLE, "#rd_crafting_pickup_error", pDef ? (const char *)pDef->Name : "?err?",szErrorCode, UTIL_RD_EResultToString( eResult ) ); } #endif diff --git a/src/game/shared/swarm/rd_inventory_shared.h b/src/game/shared/swarm/rd_inventory_shared.h index 2425da71e..d3bb61edf 100644 --- a/src/game/shared/swarm/rd_inventory_shared.h +++ b/src/game/shared/swarm/rd_inventory_shared.h @@ -23,7 +23,7 @@ extern ConVar rd_briefing_item_details_color2; class CSteamItemIcon; vgui::IImage *GetSteamItemIcon( const char *szURL, bool bForceLoadRemote = false ); -enum RD_Crafting_Material_t; +enum RD_Crafting_Material_t : int; #endif class CASW_Player; diff --git a/src/game/shared/swarm/rd_lobby_utils.cpp b/src/game/shared/swarm/rd_lobby_utils.cpp index 206ec4835..31385fd13 100644 --- a/src/game/shared/swarm/rd_lobby_utils.cpp +++ b/src/game/shared/swarm/rd_lobby_utils.cpp @@ -236,7 +236,7 @@ void UTIL_RD_ReadLobbyScoreboard( CSteamID lobby, CUtlVectorSetValue( m_hControlTable, "look_x", flLookX / MAX_BUTTONSAMPLE ); g_pScriptVM->SetValue( m_hControlTable, "look_y", flLookY / MAX_BUTTONSAMPLE ); - g_pScriptVM->SetValue( m_hControlTable, "focus", m_iControllerFocusIndex == -1 ? SCRIPT_VARIANT_NULL : m_ButtonDefs[m_iControllerFocusIndex]->m_hThis ); + g_pScriptVM->SetValue( m_hControlTable, "focus", m_iControllerFocusIndex == -1 ? SCRIPT_VARIANT_NULL : ScriptVariant_t( m_ButtonDefs[m_iControllerFocusIndex]->m_hThis ) ); } void CRD_VGui_VScript::InitButtonPanels( vgui::Panel *pParent ) @@ -632,6 +632,7 @@ HSCRIPT CRD_VGui_VScript::CreateButton() { int j = m_ButtonPanels.AddToTail(); Assert( i == j ); + ( void )i; m_ButtonPanels[j] = new CRD_VGui_VScript_Button_Panel( m_hButtonPanelParent, "VScriptButtonPanel", pButton ); } diff --git a/src/game/shared/swarm/rd_workshop.cpp b/src/game/shared/swarm/rd_workshop.cpp index 56aba15d7..00e42ae2a 100644 --- a/src/game/shared/swarm/rd_workshop.cpp +++ b/src/game/shared/swarm/rd_workshop.cpp @@ -2957,7 +2957,7 @@ void CReactiveDropWorkshop::RemoveDuplicateTags() FOR_EACH_VEC_BACK( m_aszTags, i ) { - if ( existing.Find( m_aszTags[i] ) != UTL_INVAL_SYMBOL ) + if ( existing.Find( m_aszTags[i] ).IsValid() ) { delete m_aszTags[i]; m_aszTags.Remove( i ); @@ -3070,7 +3070,7 @@ void CReactiveDropWorkshop::SetWorkshopKeyValues( UGCUpdateHandle_t hUpdate ) } } -CON_COMMAND_F( ugc_create, "Usage: ugc_create \"C:\\Path\\to\\content.vpk\" \"C:\\Path\\to\\preview\\image.jpeg\" \"Title\" \"Description\" \"Tag1\" \"Tag2\" ...\nCampaign, Challenge, and Deathmatch will automatically be added as tags if applicable.", FCVAR_NOT_CONNECTED ) +CON_COMMAND_EXTERN_F( ugc_create, ugc_create, "Usage: ugc_create \"C:\\Path\\to\\content.vpk\" \"C:\\Path\\to\\preview\\image.jpeg\" \"Title\" \"Description\" \"Tag1\" \"Tag2\" ...\nCampaign, Challenge, and Deathmatch will automatically be added as tags if applicable.", FCVAR_NOT_CONNECTED ) { if ( !SteamUGC() ) { @@ -3104,7 +3104,7 @@ CON_COMMAND_F( ugc_create, "Usage: ugc_create \"C:\\Path\\to\\content.vpk\" \"C: g_ReactiveDropWorkshop.UploadWorkshopItem( args[1], args[2], args[3], args[4], tags ); } -CON_COMMAND_F( ugc_curated_create, "", FCVAR_HIDDEN | FCVAR_NOT_CONNECTED ) +CON_COMMAND_EXTERN_F( ugc_curated_create, ugc_curated_create, "", FCVAR_HIDDEN | FCVAR_NOT_CONNECTED ) { ISteamUGC *pUGC = SteamUGC(); if ( !pUGC ) @@ -3260,7 +3260,7 @@ bool CReactiveDropWorkshop::OpenWorkshopPageForFile( PublishedFileId_t nPublishe return false; } -CON_COMMAND_F( _ugc_update_progress, "", FCVAR_HIDDEN ) +CON_COMMAND_EXTERN_F( _ugc_update_progress, _ugc_update_progress, "", FCVAR_HIDDEN ) { if ( !SteamUGC() ) { @@ -3389,7 +3389,7 @@ void CReactiveDropWorkshop::UpdateWorkshopItemQueryResultCallback( SteamUGCQuery m_szUpdateChangeDescription.Purge(); } -CON_COMMAND_F( ugc_update, "Usage: ugc_update 826481632 \"C:\\Path\\to\\content.vpk\" \"C:\\Path\\to\\preview.jpg\" \"Description of changes line 1\" \"Description of changes line 2\" ...\n(the number should be the number in the address of your workshop item after http://steamcommunity.com/sharedfiles/filedetails/?id=)\nIf the preview image should not be updated, use \"\" instead of a path.", FCVAR_NOT_CONNECTED ) +CON_COMMAND_EXTERN_F( ugc_update, ugc_update, "Usage: ugc_update 826481632 \"C:\\Path\\to\\content.vpk\" \"C:\\Path\\to\\preview.jpg\" \"Description of changes line 1\" \"Description of changes line 2\" ...\n(the number should be the number in the address of your workshop item after http://steamcommunity.com/sharedfiles/filedetails/?id=)\nIf the preview image should not be updated, use \"\" instead of a path.", FCVAR_NOT_CONNECTED ) { if ( !SteamUGC() ) { @@ -3501,7 +3501,7 @@ void CReactiveDropWorkshop::SetWorkshopItemTags( PublishedFileId_t nFileID, cons m_UpdateWorkshopItemQueryResultCallback.Set( hAPICall, this, &CReactiveDropWorkshop::UpdateWorkshopItemQueryResultCallback ); } -CON_COMMAND_F( ugc_updatetags, "Usage: ugc_updatetags 826481632 \"Tag1\" \"Tag2\" ...\n(the number should be the number in the address of your workshop item after http://steamcommunity.com/sharedfiles/filedetails/?id=)\nSome tags are automatically determined from the contents of your addon and cannot be added or removed using this command.", FCVAR_NOT_CONNECTED ) +CON_COMMAND_EXTERN_F( ugc_updatetags, ugc_updatetags, "Usage: ugc_updatetags 826481632 \"Tag1\" \"Tag2\" ...\n(the number should be the number in the address of your workshop item after http://steamcommunity.com/sharedfiles/filedetails/?id=)\nSome tags are automatically determined from the contents of your addon and cannot be added or removed using this command.", FCVAR_NOT_CONNECTED ) { if ( !SteamUGC() ) { diff --git a/src/game/shared/swarm/rd_workshop.h b/src/game/shared/swarm/rd_workshop.h index 917286f32..2a6beb9a1 100644 --- a/src/game/shared/swarm/rd_workshop.h +++ b/src/game/shared/swarm/rd_workshop.h @@ -314,11 +314,11 @@ class CReactiveDropWorkshop : public CAutoGameSystem void UpdateWorkshopItemQueryResultCallback( SteamUGCQueryCompleted_t *pResult, bool bIOFailure ); CCallResult m_CreateItemResultCallbackCurated; void CreateItemResultCallbackCurated( CreateItemResult_t *pResult, bool bIOFailure ); - friend static void ugc_create(const CCommand & args); - friend static void ugc_curated_create(const CCommand & args); - friend static void ugc_update(const CCommand & args); - friend static void ugc_updatetags(const CCommand & args); - friend static void _ugc_update_progress(const CCommand & args); + friend void ugc_create(const CCommand & args); + friend void ugc_curated_create(const CCommand & args); + friend void ugc_update(const CCommand & args); + friend void ugc_updatetags(const CCommand & args); + friend void _ugc_update_progress(const CCommand & args); void CheckPublishedAddonConsistency(); friend class CFixWorkshopKeyValueNames; diff --git a/src/game/shared/usercmd.cpp b/src/game/shared/usercmd.cpp index d66e4be30..7d81f4b91 100644 --- a/src/game/shared/usercmd.cpp +++ b/src/game/shared/usercmd.cpp @@ -25,7 +25,7 @@ ConVar net_showusercmd( "net_showusercmd", "0", 0, "Show user command encoding" #endif //----------------------------------------------------------------------------- -static bool WriteUserCmdDeltaInt( bf_write *buf, char *what, int from, int to, int bits = 32 ) +static bool WriteUserCmdDeltaInt( bf_write *buf, const char *what, int from, int to, int bits = 32 ) { if ( from != to ) { @@ -40,7 +40,7 @@ static bool WriteUserCmdDeltaInt( bf_write *buf, char *what, int from, int to, i return false; } -static bool WriteUserCmdDeltaShort( bf_write *buf, char *what, int from, int to ) +static bool WriteUserCmdDeltaShort( bf_write *buf, const char *what, int from, int to ) { if ( from != to ) { @@ -55,7 +55,7 @@ static bool WriteUserCmdDeltaShort( bf_write *buf, char *what, int from, int to return false; } -static bool WriteUserCmdDeltaFloat( bf_write *buf, char *what, float from, float to ) +static bool WriteUserCmdDeltaFloat( bf_write *buf, const char *what, float from, float to ) { if ( from != to ) { @@ -70,7 +70,7 @@ static bool WriteUserCmdDeltaFloat( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaCoord( bf_write *buf, char *what, float from, float to ) +static bool WriteUserCmdDeltaCoord( bf_write *buf, const char *what, float from, float to ) { if ( from != to ) { @@ -85,7 +85,7 @@ static bool WriteUserCmdDeltaCoord( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaAngle( bf_write *buf, char *what, float from, float to, int bits ) +static bool WriteUserCmdDeltaAngle( bf_write *buf, const char *what, float from, float to, int bits ) { if ( from != to ) { @@ -100,7 +100,7 @@ static bool WriteUserCmdDeltaAngle( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaVec3Coord( bf_write *buf, char *what, const Vector &from, const Vector &to ) +static bool WriteUserCmdDeltaVec3Coord( bf_write *buf, const char *what, const Vector &from, const Vector &to ) { if ( from != to ) { diff --git a/src/game/shared/util_shared.cpp b/src/game/shared/util_shared.cpp index 2245979df..49a8593ac 100644 --- a/src/game/shared/util_shared.cpp +++ b/src/game/shared/util_shared.cpp @@ -1353,7 +1353,7 @@ char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *p { DevWarning( "Can't get key value '%s' from file '%s'.\n", pName, pFilename ); } - return ""; + return (char *)""; } int len = Q_strlen( pValue ) + 1; diff --git a/src/public/UtlCachedFileData.h b/src/public/UtlCachedFileData.h index c8e48a2e9..004c29139 100644 --- a/src/public/UtlCachedFileData.h +++ b/src/public/UtlCachedFileData.h @@ -670,6 +670,22 @@ bool CUtlCachedFileData::Init() return true; } +class CSortedCacheFile +{ +public: + FileNameHandle_t handle; + int index; + + bool Less( const CSortedCacheFile &file0, const CSortedCacheFile &file1, void * ) + { + char name0[ 512 ]; + char name1[ 512 ]; + g_pFullFileSystem->String( file0.handle, name0, sizeof( name0 ) ); + g_pFullFileSystem->String( file1.handle, name1, sizeof( name1 ) ); + return Q_stricmp( name0, name1 ) < 0 ? true : false; + } +}; + template void CUtlCachedFileData::Save() { @@ -962,21 +978,6 @@ void CUtlCachedFileData::ForceRecheckDiskInfo() } } -class CSortedCacheFile -{ -public: - FileNameHandle_t handle; - int index; - - bool Less( const CSortedCacheFile &file0, const CSortedCacheFile &file1, void * ) - { - char name0[ 512 ]; - char name1[ 512 ]; - g_pFullFileSystem->String( file0.handle, name0, sizeof( name0 ) ); - g_pFullFileSystem->String( file1.handle, name1, sizeof( name1 ) ); - return Q_stricmp( name0, name1 ) < 0 ? true : false; - } -}; // Iterates all entries and causes rebuild on any existing items which are out of date template diff --git a/src/public/VGuiMatSurface/IMatSystemSurface.h b/src/public/VGuiMatSurface/IMatSystemSurface.h index 59d654570..39ffac564 100644 --- a/src/public/VGuiMatSurface/IMatSystemSurface.h +++ b/src/public/VGuiMatSurface/IMatSystemSurface.h @@ -77,14 +77,14 @@ class IMatSystemSurface : public vgui::ISurface // Some drawing methods that cannot be accomplished under Win32 virtual void DrawColoredCircle( int centerx, int centery, float radius, int r, int g, int b, int a ) = 0; - virtual void DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, char *fmt, ... ) = 0; + virtual void DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, const char *fmt, ... ) = 0; // Draws text with current font at position and wordwrapped to the rect using color values specified - virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, char *fmt, ... ) = 0; - virtual void DrawTextHeight( vgui::HFont font, int w, int& h, char *fmt, ... ) = 0; + virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, const char *fmt, ... ) = 0; + virtual void DrawTextHeight( vgui::HFont font, int w, int& h, const char *fmt, ... ) = 0; // Returns the length of the text string in pixels - virtual int DrawTextLen( vgui::HFont font, char *fmt, ... ) = 0; + virtual int DrawTextLen( vgui::HFont font, const char *fmt, ... ) = 0; // Draws a panel in 3D space. Assumes view + projection are already set up // Also assumes the (x,y) coordinates of the panels are defined in 640xN coords diff --git a/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h b/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h index 9b8da47ad..e6773a955 100644 --- a/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h +++ b/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h @@ -56,14 +56,14 @@ namespace MatSystemSurfaceV5 // Some drawing methods that cannot be accomplished under Win32 virtual void DrawColoredCircle( int centerx, int centery, float radius, int r, int g, int b, int a ) = 0; - virtual int DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, char *fmt, ... ) = 0; + virtual int DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, const char *fmt, ... ) = 0; // Draws text with current font at position and wordwrapped to the rect using color values specified - virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, char *fmt, ... ) = 0; - virtual void DrawTextHeight( vgui::HFont font, int w, int& h, char *fmt, ... ) = 0; + virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, const char *fmt, ... ) = 0; + virtual void DrawTextHeight( vgui::HFont font, int w, int& h, const char *fmt, ... ) = 0; // Returns the length of the text string in pixels - virtual int DrawTextLen( vgui::HFont font, char *fmt, ... ) = 0; + virtual int DrawTextLen( vgui::HFont font, const char *fmt, ... ) = 0; // Draws a panel in 3D space. Assumes view + projection are already set up // Also assumes the (x,y) coordinates of the panels are defined in 640xN coords diff --git a/src/public/bitmap/imageformat.h b/src/public/bitmap/imageformat.h index 9f030ca0f..a0b61e61e 100644 --- a/src/public/bitmap/imageformat.h +++ b/src/public/bitmap/imageformat.h @@ -24,8 +24,13 @@ enum NormalDecodeMode_t // Forward declaration #ifdef _WIN32 -typedef enum _D3DFORMAT D3DFORMAT; -enum DXGI_FORMAT; +// C++20 requires an opaque enumeration declaration to name an underlying type. +// _D3DFORMAT is defined by the Direct3D headers as an unscoped enum whose values +// all fit in an int. DXGI_FORMAT is not used anywhere in this code base and the +// DXGI headers define it without an explicit underlying type, so it is no longer +// forward declared here. +enum _D3DFORMAT : int; +typedef _D3DFORMAT D3DFORMAT; #endif //----------------------------------------------------------------------------- diff --git a/src/public/bitvec.h b/src/public/bitvec.h index 28748b9ad..743c9c2ae 100644 --- a/src/public/bitvec.h +++ b/src/public/bitvec.h @@ -744,7 +744,7 @@ inline void CBitVecT::Xor(const CBitVecT &xorStr, CBitVecT *out) const template inline void CBitVecT::Not(CBitVecT *out) const { - ValidateOperand( *out ); + this->ValidateOperand( *out ); uint32 * pDest = out->Base(); const uint32 *pOperand = this->Base(); @@ -852,7 +852,7 @@ inline void CBitVecT::Copy( const CBitVecT &other, int nBits this->Resize( nBits ); - ValidateOperand( other ); + this->ValidateOperand( other ); Assert( &other != this ); memcpy( this->Base(), other.Base(), this->GetNumDWords() * sizeof( uint32 ) ); diff --git a/src/public/chunkfile.cpp b/src/public/chunkfile.cpp index 326bf0786..36161b076 100644 --- a/src/public/chunkfile.cpp +++ b/src/public/chunkfile.cpp @@ -151,7 +151,7 @@ ChunkHandler_t CChunkHandlerMap::GetHandler(const char *pszChunkName, void **ppD pNode = pNode->pNext; } - return(false); + return(NULL); } diff --git a/src/public/client_class.h b/src/public/client_class.h index 07296b37c..0f3985922 100644 --- a/src/public/client_class.h +++ b/src/public/client_class.h @@ -49,7 +49,7 @@ typedef IClientNetworkable* (*CreateEventFn)(); class ClientClass { public: - ClientClass( char *pNetworkName, CreateClientClassFn createFn, CreateEventFn createEventFn, RecvTable *pRecvTable ) + ClientClass( const char *pNetworkName, CreateClientClassFn createFn, CreateEventFn createEventFn, RecvTable *pRecvTable ) { m_pNetworkName = pNetworkName; m_pCreateFn = createFn; @@ -69,7 +69,7 @@ class ClientClass public: CreateClientClassFn m_pCreateFn; CreateEventFn m_pCreateEventFn; // Only called for event objects. - char *m_pNetworkName; + const char *m_pNetworkName; RecvTable *m_pRecvTable; ClientClass *m_pNext; int m_ClassID; // Managed by the engine. diff --git a/src/public/dt_recv.cpp b/src/public/dt_recv.cpp index d7c94dab7..9235712ed 100644 --- a/src/public/dt_recv.cpp +++ b/src/public/dt_recv.cpp @@ -14,7 +14,7 @@ #if !defined(_STATIC_LINKED) || defined(CLIENT_DLL) -char *s_ClientElementNames[MAX_ARRAY_ELEMENTS] = +const char *s_ClientElementNames[MAX_ARRAY_ELEMENTS] = { "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015", "016", "017", "018", "019", @@ -163,7 +163,7 @@ RecvTable::RecvTable() Construct( NULL, 0, NULL ); } -RecvTable::RecvTable(RecvProp *pProps, int nProps, char *pNetTableName) +RecvTable::RecvTable(RecvProp *pProps, int nProps, const char *pNetTableName) { Construct( pProps, nProps, pNetTableName ); } @@ -172,7 +172,7 @@ RecvTable::~RecvTable() { } -void RecvTable::Construct( RecvProp *pProps, int nProps, char *pNetTableName ) +void RecvTable::Construct( RecvProp *pProps, int nProps, const char *pNetTableName ) { m_pProps = pProps; m_nProps = nProps; @@ -188,7 +188,7 @@ void RecvTable::Construct( RecvProp *pProps, int nProps, char *pNetTableName ) // ---------------------------------------------------------------------- // RecvProp RecvPropFloat( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -214,7 +214,7 @@ RecvProp RecvPropFloat( } RecvProp RecvPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -240,7 +240,7 @@ RecvProp RecvPropVector( } RecvProp RecvPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -268,7 +268,7 @@ RecvProp RecvPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! RecvProp RecvPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags, @@ -295,7 +295,7 @@ RecvProp RecvPropQuaternion( #endif RecvProp RecvPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -340,7 +340,7 @@ RecvProp RecvPropInt( } RecvProp RecvPropString( - char *pVarName, + const char *pVarName, int offset, int bufferSize, int flags, @@ -360,7 +360,7 @@ RecvProp RecvPropString( } RecvProp RecvPropDataTable( - char *pVarName, + const char *pVarName, int offset, int flags, RecvTable *pTable, @@ -380,7 +380,7 @@ RecvProp RecvPropDataTable( } RecvProp RecvPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -419,7 +419,7 @@ RecvProp RecvPropArray3( RecvProp InternalRecvPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthRecvProxyFn proxy ) { diff --git a/src/public/dt_recv.h b/src/public/dt_recv.h index 783889820..c5e8efd4a 100644 --- a/src/public/dt_recv.h +++ b/src/public/dt_recv.h @@ -135,7 +135,7 @@ class RecvProp public: - char *m_pVarName; + const char *m_pVarName; SendPropType m_RecvType; int m_Flags; int m_StringBufferSize; @@ -174,10 +174,10 @@ class RecvTable typedef RecvProp PropType; RecvTable(); - RecvTable( RecvProp *pProps, int nProps, char *pNetTableName ); + RecvTable( RecvProp *pProps, int nProps, const char *pNetTableName ); ~RecvTable(); - void Construct( RecvProp *pProps, int nProps, char *pNetTableName ); + void Construct( RecvProp *pProps, int nProps, const char *pNetTableName ); int GetNumProps(); RecvProp* GetProp( int i ); @@ -203,7 +203,7 @@ class RecvTable // will have their own decoders that include props for all their children). CRecvDecoder *m_pDecoder; - char *m_pNetTableName; // The name matched between client and server. + const char *m_pNetTableName; // The name matched between client and server. private: @@ -270,7 +270,7 @@ inline bool RecvTable::IsInMainList() const template <> int ClientClassInit(tableName::ignored *) \ { \ typedef className currentRecvDTClass; \ - char *pRecvTableName = #tableName; \ + const char *pRecvTableName = #tableName; \ RecvTable &RecvTable = tableName::g_RecvTable; \ static RecvProp RecvProps[] = { \ RecvPropInt("should_never_see_this", 0, sizeof(int)), // It adds a dummy property at the start so you can define "empty" SendTables. @@ -313,7 +313,7 @@ void DataTableRecvProxy_PointerDataTable(const RecvProp *pProp, void **pOut, voi RecvProp RecvPropFloat( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -321,7 +321,7 @@ RecvProp RecvPropFloat( ); RecvProp RecvPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -329,7 +329,7 @@ RecvProp RecvPropVector( ); RecvProp RecvPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -342,7 +342,7 @@ RecvProp RecvPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! RecvProp RecvPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -351,7 +351,7 @@ RecvProp RecvPropQuaternion( #endif RecvProp RecvPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -359,7 +359,7 @@ RecvProp RecvPropInt( ); RecvProp RecvPropString( - char *pVarName, + const char *pVarName, int offset, int bufferSize, int flags=0, @@ -367,7 +367,7 @@ RecvProp RecvPropString( ); RecvProp RecvPropDataTable( - char *pVarName, + const char *pVarName, int offset, int flags, RecvTable *pTable, @@ -375,7 +375,7 @@ RecvProp RecvPropDataTable( ); RecvProp RecvPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -389,7 +389,7 @@ RecvProp RecvPropArray3( RecvProp InternalRecvPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthRecvProxyFn proxy ); diff --git a/src/public/dt_send.cpp b/src/public/dt_send.cpp index da0ad10c3..ec5ed9624 100644 --- a/src/public/dt_send.cpp +++ b/src/public/dt_send.cpp @@ -27,7 +27,7 @@ void SendProxy_UInt16ToInt32( const SendProp *pProp, const void *pStruct, const void SendProxy_UInt32ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); void SendProxy_UInt64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); -char *s_ElementNames[MAX_ARRAY_ELEMENTS] = +const char *s_ElementNames[MAX_ARRAY_ELEMENTS] = { "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015", "016", "017", "018", "019", @@ -340,7 +340,7 @@ float AssignRangeMultiplier( int nBits, double range ) SendProp SendPropFloat( - char *pVarName, + const char *pVarName, // Variable name. int offset, // Offset into container structure. int sizeofVar, @@ -395,7 +395,7 @@ SendProp SendPropFloat( } SendProp SendPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -433,7 +433,7 @@ SendProp SendPropVector( } SendProp SendPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -472,7 +472,7 @@ SendProp SendPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! SendProp SendPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -511,7 +511,7 @@ SendProp SendPropQuaternion( #endif SendProp SendPropAngle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -561,7 +561,7 @@ SendProp SendPropAngle( SendProp SendPropQAngles( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -611,7 +611,7 @@ SendProp SendPropQAngles( } SendProp SendPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -684,7 +684,7 @@ SendProp SendPropInt( } SendProp SendPropString( - char *pVarName, + const char *pVarName, int offset, int bufferLen, int flags, @@ -707,7 +707,7 @@ SendProp SendPropString( } SendProp SendPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -754,7 +754,7 @@ SendProp SendPropArray3( } SendProp SendPropDataTable( - char *pVarName, + const char *pVarName, int offset, SendTable *pTable, SendTableProxyFn varProxy, @@ -788,7 +788,7 @@ SendProp SendPropDataTable( SendProp InternalSendPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthSendProxyFn arrayLengthFn, byte priority ) @@ -810,8 +810,8 @@ SendProp InternalSendPropArray( SendProp SendPropExclude( - char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). - char *pPropName // Name of the property to exclude. + const char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). + const char *pPropName // Name of the property to exclude. ) { SendProp ret; @@ -884,7 +884,7 @@ SendTable::SendTable() } -SendTable::SendTable(SendProp *pProps, int nProps, char *pNetTableName) +SendTable::SendTable(SendProp *pProps, int nProps, const char *pNetTableName) { Construct( pProps, nProps, pNetTableName ); } @@ -896,7 +896,7 @@ SendTable::~SendTable() } -void SendTable::Construct( SendProp *pProps, int nProps, char *pNetTableName ) +void SendTable::Construct( SendProp *pProps, int nProps, const char *pNetTableName ) { m_pProps = pProps; m_nProps = nProps; diff --git a/src/public/dt_send.h b/src/public/dt_send.h index 2570e53b8..4cd44c8d1 100644 --- a/src/public/dt_send.h +++ b/src/public/dt_send.h @@ -194,7 +194,7 @@ class SendProp // If it's one of the numbered "000", "001", etc properties in an array, then // these can be used to get its array property name for debugging. const char* GetParentArrayPropName() const; - void SetParentArrayPropName( char *pArrayPropName ); + void SetParentArrayPropName( const char *pArrayPropName ); const char* GetName() const; @@ -249,10 +249,10 @@ class SendProp int m_nElements; // Number of elements in the array (or 1 if it's not an array). int m_ElementStride; // Pointer distance between array elements. - char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from. - char *m_pParentArrayPropName; + const char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from. + const char *m_pParentArrayPropName; - char *m_pVarName; + const char *m_pVarName; float m_fHighLowMul; byte m_priority; @@ -327,7 +327,7 @@ inline const char* SendProp::GetParentArrayPropName() const return m_pParentArrayPropName; } -inline void SendProp::SetParentArrayPropName( char *pArrayPropName ) +inline void SendProp::SetParentArrayPropName( const char *pArrayPropName ) { Assert( !m_pParentArrayPropName ); m_pParentArrayPropName = pArrayPropName; @@ -442,10 +442,10 @@ class SendTable typedef SendProp PropType; SendTable(); - SendTable( SendProp *pProps, int nProps, char *pNetTableName ); + SendTable( SendProp *pProps, int nProps, const char *pNetTableName ); ~SendTable(); - void Construct( SendProp *pProps, int nProps, char *pNetTableName ); + void Construct( SendProp *pProps, int nProps, const char *pNetTableName ); const char* GetName() const; @@ -468,7 +468,7 @@ class SendTable SendProp *m_pProps; int m_nProps; - char *m_pNetTableName; // The name matched between client and server. + const char *m_pNetTableName; // The name matched between client and server. // The engine hooks the SendTable here. CSendTablePrecalc *m_pPrecalc; @@ -565,7 +565,7 @@ inline void SendTable::SetHasPropsEncodedAgainstTickcount( bool bState ) template <> int ServerClassInit(tableName::ignored *) \ { \ typedef className currentSendDTClass; \ - static char *g_pSendTableName = #tableName; \ + static const char *g_pSendTableName = #tableName; \ SendTable &sendTable = tableName::g_SendTable; \ static SendProp g_SendProps[] = { \ SendPropInt("should_never_see_this", 0, sizeof(int)), // It adds a dummy property at the start so you can define "empty" SendTables. @@ -636,7 +636,7 @@ void* SendProxy_DataTablePtrToDataTable( const SendProp *pProp, const void *pStr // Use these functions to setup your data tables. // ------------------------------------------------------------------------ // SendProp SendPropFloat( - char *pVarName, // Variable name. + const char *pVarName, // Variable name. int offset, // Offset into container structure. int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits to use when encoding. @@ -648,7 +648,7 @@ SendProp SendPropFloat( ); SendProp SendPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -660,7 +660,7 @@ SendProp SendPropVector( ); SendProp SendPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -673,7 +673,7 @@ SendProp SendPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! SendProp SendPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -686,7 +686,7 @@ SendProp SendPropQuaternion( #endif SendProp SendPropAngle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, @@ -696,7 +696,7 @@ SendProp SendPropAngle( ); SendProp SendPropQAngles( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, @@ -706,7 +706,7 @@ SendProp SendPropQAngles( ); SendProp SendPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by SENDINFO macro. int nBits=-1, // Set to -1 to automatically pick (max) number of bits based on size of element. @@ -717,11 +717,11 @@ SendProp SendPropInt( inline SendProp SendPropModelIndex( const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ) { - return SendPropInt( (char *)pVarName, offset, sizeofVar, SP_MODEL_INDEX_BITS, 0 ); + return SendPropInt( pVarName, offset, sizeofVar, SP_MODEL_INDEX_BITS, 0 ); } SendProp SendPropString( - char *pVarName, + const char *pVarName, int offset, int bufferLen, int flags=0, @@ -731,7 +731,7 @@ SendProp SendPropString( // The data table encoder looks at DVariant::m_pData. SendProp SendPropDataTable( - char *pVarName, + const char *pVarName, int offset, SendTable *pTable, SendTableProxyFn varProxy=SendProxy_DataTableToDataTable, @@ -739,7 +739,7 @@ SendProp SendPropDataTable( ); SendProp SendPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -783,7 +783,7 @@ SendProp SendPropArray3( SendProp InternalSendPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthSendProxyFn proxy, byte priority = SENDPROP_DEFAULT_PRIORITY ); @@ -835,8 +835,8 @@ SendProp InternalSendPropArray( // Use these to create properties that exclude other properties. This is useful if you want to use most of // a base class's datatable data, but you want to override some of its variables. SendProp SendPropExclude( - char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). - char *pPropName // Name of the property to exclude. + const char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). + const char *pPropName // Name of the property to exclude. ); diff --git a/src/public/dt_utlvector_recv.cpp b/src/public/dt_utlvector_recv.cpp index 2ecc2487f..5fbf6bfd7 100644 --- a/src/public/dt_utlvector_recv.cpp +++ b/src/public/dt_utlvector_recv.cpp @@ -11,7 +11,7 @@ #include "tier0/memdbgon.h" -extern char *s_ClientElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ClientElementNames[MAX_ARRAY_ELEMENTS]; class CRecvPropExtra_UtlVector @@ -78,7 +78,7 @@ void DataTableRecvProxy_LengthProxy( const RecvProp *pProp, void **pOut, void *p RecvProp RecvPropUtlVector( - char *pVarName, // Use RECVINFO_UTLVECTOR to generate these 4. + const char *pVarName, // Use RECVINFO_UTLVECTOR to generate these 4. int offset, // Used to generate pData in the function specified in varProxy. int sizeofVar, // The size of each element in the utlvector. ResizeUtlVectorFn fn, diff --git a/src/public/dt_utlvector_recv.h b/src/public/dt_utlvector_recv.h index 5252466b4..f9b226190 100644 --- a/src/public/dt_utlvector_recv.h +++ b/src/public/dt_utlvector_recv.h @@ -45,7 +45,7 @@ // RecvPropUtlVector( RECVINFO_UTLVECTOR( m_FloatArray ), 16, RecvPropFloat(NULL,0,0) ) // RecvProp RecvPropUtlVector( - char *pVarName, // Use RECVINFO_UTLVECTOR to generate these first 5 parameters. + const char *pVarName, // Use RECVINFO_UTLVECTOR to generate these first 5 parameters. int offset, int sizeofVar, ResizeUtlVectorFn fn, diff --git a/src/public/dt_utlvector_send.cpp b/src/public/dt_utlvector_send.cpp index 47fe9f4ca..d3e57cbb3 100644 --- a/src/public/dt_utlvector_send.cpp +++ b/src/public/dt_utlvector_send.cpp @@ -11,7 +11,7 @@ #include "tier0/memdbgon.h" -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; // This gets associated with SendProps inside a utlvector and stores extra data needed to make it work. class CSendPropExtra_UtlVector @@ -134,7 +134,7 @@ void* SendProxy_LengthTable( const SendProp *pProp, const void *pStructBase, con // Note: you have to be DILIGENT about calling NetworkStateChanged whenever an element in your CUtlVector changes // since CUtlVector doesn't do this automatically. SendProp SendPropUtlVector( - char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4. + const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4. int offset, // Used to generate pData in the function specified in varProxy. int sizeofVar, // The size of each element in the utlvector. EnsureCapacityFn ensureFn, // This is the value returned for elements out of the array's current range. diff --git a/src/public/dt_utlvector_send.h b/src/public/dt_utlvector_send.h index 9094039c1..d561d70bc 100644 --- a/src/public/dt_utlvector_send.h +++ b/src/public/dt_utlvector_send.h @@ -43,7 +43,7 @@ // ) // SendProp SendPropUtlVector( - char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters. + const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters. int offset, int sizeofVar, EnsureCapacityFn ensureFn, diff --git a/src/public/fgdlib/gamedata.h b/src/public/fgdlib/gamedata.h index 816d6886b..30ef17b5a 100644 --- a/src/public/fgdlib/gamedata.h +++ b/src/public/fgdlib/gamedata.h @@ -21,7 +21,7 @@ class MDkeyvalue; class GameData; class KeyValues; -enum TEXTUREFORMAT; +enum TEXTUREFORMAT : int; typedef void (*GameDataMessageFunc_t)(int level, _Printf_format_string_ const char *fmt, ...); diff --git a/src/public/fgdlib/gdvar.h b/src/public/fgdlib/gdvar.h index 80a0df464..8c2fcb4b8 100644 --- a/src/public/fgdlib/gdvar.h +++ b/src/public/fgdlib/gdvar.h @@ -137,7 +137,7 @@ class GDinputvariable // for choices/flags: CUtlVector m_Items; - static char *m_pszEmpty; + static const char *m_pszEmpty; char m_szName[MAX_IDENT]; char m_szLongName[MAX_STRING]; diff --git a/src/public/fgdlib/inputoutput.h b/src/public/fgdlib/inputoutput.h index bd9a358d9..143236c48 100644 --- a/src/public/fgdlib/inputoutput.h +++ b/src/public/fgdlib/inputoutput.h @@ -54,7 +54,7 @@ class CClassInputOutputBase protected: - static char *g_pszEmpty; + static const char *g_pszEmpty; char m_szName[MAX_IO_NAME_LEN]; InputOutputType_t m_eType; diff --git a/src/public/fgdlib/wckeyvalues.h b/src/public/fgdlib/wckeyvalues.h index 63d117719..1ad6fde53 100644 --- a/src/public/fgdlib/wckeyvalues.h +++ b/src/public/fgdlib/wckeyvalues.h @@ -188,7 +188,7 @@ typedef WCKeyValuesT WCKeyValuesVector; template inline const char *WCKeyValuesT::GetKey(int nIndex) const { - return(m_KeyValues.Element(nIndex).szKey); + return(this->m_KeyValues.Element(nIndex).szKey); } @@ -200,7 +200,7 @@ inline const char *WCKeyValuesT::GetKey(int nIndex) const template inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) { - return(m_KeyValues.Element(nIndex)); + return(this->m_KeyValues.Element(nIndex)); } @@ -212,7 +212,7 @@ inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) template inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const { - return(m_KeyValues.Element(nIndex)); + return(this->m_KeyValues.Element(nIndex)); } @@ -223,7 +223,7 @@ inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const template inline const char *WCKeyValuesT::GetValue(int nIndex) const { - return(m_KeyValues.Element(nIndex).szValue); + return(this->m_KeyValues.Element(nIndex).szValue); } diff --git a/src/public/keyframe/keyframe.cpp b/src/public/keyframe/keyframe.cpp index cbb529abf..3689330e1 100644 --- a/src/public/keyframe/keyframe.cpp +++ b/src/public/keyframe/keyframe.cpp @@ -94,9 +94,9 @@ float TimeModifierFunc_TimeSquared( float time ) TimeModifier_t g_TimeModifiers[] = { - { "Linear", TimeModifierFunc_Linear }, - { "Accel/Deaccel (cosine)", TimeModifierFunc_Cosine }, - { "Accel (time*time)", TimeModifierFunc_TimeSquared }, + { (char *)"Linear", TimeModifierFunc_Linear }, + { (char *)"Accel/Deaccel (cosine)", TimeModifierFunc_Cosine }, + { (char *)"Accel (time*time)", TimeModifierFunc_TimeSquared }, }; int Motion_GetNumberOfTimeModifiers( void ) @@ -173,7 +173,7 @@ void CPositionInterpolator_Linear::Release() void CPositionInterpolator_Linear::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Linear"; + *outName = (char *)"Linear"; *outMinKeyReq = 0; *outMaxKeyReq = 1; } @@ -220,7 +220,7 @@ void CPositionInterpolator_CatmullRom::Release() void CPositionInterpolator_CatmullRom::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Catmull-Rom Spline"; + *outName = (char *)"Catmull-Rom Spline"; *outMinKeyReq = -1; *outMaxKeyReq = 2; } @@ -321,7 +321,7 @@ void CPositionInterpolator_Rope::Release() void CPositionInterpolator_Rope::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Rope"; + *outName = (char *)"Rope"; *outMinKeyReq = 0; *outMaxKeyReq = 1; } @@ -450,7 +450,7 @@ void RotationInterpolatorFunc_Linear( float time, Quaternion &outRot ) RotationInterpolator_t g_RotationInterpolators[] = { - { "Linear", RotationInterpolatorFunc_Linear, 0, 1 }, + { (char *)"Linear", RotationInterpolatorFunc_Linear, 0, 1 }, }; int Motion_GetNumberOfRotationInterpolators( void ) diff --git a/src/public/materialsystem/imesh.h b/src/public/materialsystem/imesh.h index ae0b2d438..95db164b0 100644 --- a/src/public/materialsystem/imesh.h +++ b/src/public/materialsystem/imesh.h @@ -78,7 +78,7 @@ enum WriteCombineOrdering_t MB_FIELD_COLOR, MB_FIELD_SPECULAR, MB_FIELD_TEXCOORD_FIRST, - MB_FIELD_TEXCOORD_LAST = MB_FIELD_TEXCOORD_FIRST + VERTEX_MAX_TEXTURE_COORDINATES - 1, + MB_FIELD_TEXCOORD_LAST = MB_FIELD_TEXCOORD_FIRST + ( int )VERTEX_MAX_TEXTURE_COORDINATES - 1, MB_FIELD_TANGENT_S, MB_FIELD_TANGENT_T, MB_FIELD_USERDATA, diff --git a/src/public/mathlib/mathlib.h b/src/public/mathlib/mathlib.h index 1895b09f3..e6d008b35 100644 --- a/src/public/mathlib/mathlib.h +++ b/src/public/mathlib/mathlib.h @@ -632,7 +632,17 @@ template FORCEINLINE T AVG(T a, T b) // // Returns a clamped value in the range [min, max]. // +#ifdef __cplusplus +// +// NOTE: clamp() is already provided as an inline template function by +// tier0/basetypes.h. Do NOT define a function-like macro with this name: +// since C++17 the standard library declares std::clamp() in , +// and a clamp() macro corrupts that declaration in every translation unit +// that includes an algorithm header. (This breaks C++20/VS2022 builds.) +// +#else #define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) +#endif inline float Sign( float x ) { diff --git a/src/public/networkvar.h b/src/public/networkvar.h index dc10988ca..35d1dde2f 100644 --- a/src/public/networkvar.h +++ b/src/public/networkvar.h @@ -382,7 +382,7 @@ class CNetworkColor32Base : public CNetworkVarBase< Type, Changer > const Type& operator=( const Type &val ) { - return Set( val ); + return base::Set( val ); } const Type& operator=( const CNetworkColor32Base &val ) diff --git a/src/public/particles/particles.h b/src/public/particles/particles.h index f2ddde7a7..62743d41f 100644 --- a/src/public/particles/particles.h +++ b/src/public/particles/particles.h @@ -1718,7 +1718,7 @@ class CParticleCollection // the camera objetc may be compared for equality against control point objects void Render( IMatRenderContext *pRenderContext, const Vector4D &vecDiffuseModulation, bool bTranslucentOnly = false, void *pCameraObject = NULL ); - bool IsValid( void ) const { return m_pDef != NULL; } + bool IsValid( void ) const { return m_pDef.IsValid(); } // this system and all children are valid bool IsFullyValid( void ) const; diff --git a/src/public/sentence.cpp b/src/public/sentence.cpp index 1c59c1ffe..1008afa5e 100644 --- a/src/public/sentence.cpp +++ b/src/public/sentence.cpp @@ -509,7 +509,7 @@ void CSentence::ParseWords( CUtlBuffer& buf ) // Parse phoneme int code; char phonemename[ 256 ]; - float start, end; + float iStart, iEnd; float volume; code = atoi( token ); @@ -517,9 +517,9 @@ void CSentence::ParseWords( CUtlBuffer& buf ) buf.GetString( token ); Q_strncpy( phonemename, token, sizeof( phonemename ) ); buf.GetString( token ); - start = atof( token ); + iStart = atof( token ); buf.GetString( token ); - end = atof( token ); + iEnd = atof( token ); buf.GetString( token ); volume = atof( token ); @@ -527,8 +527,8 @@ void CSentence::ParseWords( CUtlBuffer& buf ) Assert( pt ); pt->SetPhonemeCode( code ); pt->SetTag( phonemename ); - pt->SetStartTime( start ); - pt->SetEndTime( end ); + pt->SetStartTime( iStart ); + pt->SetEndTime( iEnd ); AddPhonemeTag( wt, pt ); } diff --git a/src/public/server_class.h b/src/public/server_class.h index 5e40d9ba7..0e3cd5d57 100644 --- a/src/public/server_class.h +++ b/src/public/server_class.h @@ -27,7 +27,7 @@ extern ServerClass *g_pServerClassHead; class ServerClass { public: - ServerClass( char *pNetworkName, SendTable *pTable ) + ServerClass( const char *pNetworkName, SendTable *pTable ) { m_pNetworkName = pNetworkName; m_pTable = pTable; @@ -71,7 +71,7 @@ class ServerClass public: - char *m_pNetworkName; + const char *m_pNetworkName; SendTable *m_pTable; ServerClass *m_pNext; int m_ClassID; // Managed by the engine. diff --git a/src/public/studio.cpp b/src/public/studio.cpp index 427c6d585..476fe4c2f 100644 --- a/src/public/studio.cpp +++ b/src/public/studio.cpp @@ -533,7 +533,7 @@ char *studiohdr_t::pszNodeName( int iNode ) Assert( pVModel ); if ( pVModel->m_node.Count() <= iNode-1 ) - return "Invalid node"; + return (char *)"Invalid node"; return pVModel->m_group[ pVModel->m_node[iNode-1].group ].GetStudioHdr()->pszLocalNodeName( pVModel->m_node[iNode-1].index ); } @@ -1163,7 +1163,7 @@ char *CStudioHdr::pszNodeName( int iNode ) } if ( m_pVModel->m_node.Count() <= iNode-1 ) - return "Invalid node"; + return (char *)"Invalid node"; const studiohdr_t *pStudioHdr = GroupStudioHdr( m_pVModel->m_node[iNode-1].group ); @@ -1906,7 +1906,7 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( const CStudioHdr * __re // Now, create starting indices for each activity. For an activity n, // the starting index is of course the sum of counts [0..n-1]. - register int sequenceCount = 0; + int sequenceCount = 0; int topActivity = 0; // this will store the highest seen activity number (used later to make an ad hoc map on the stack) for ( UtlHashHandle_t handle = m_ActToSeqHash.GetFirstHandle() ; m_ActToSeqHash.IsValidHandle(handle) ; diff --git a/src/public/tier0/basetypes.h b/src/public/tier0/basetypes.h index fb25e7416..ad82e651c 100644 --- a/src/public/tier0/basetypes.h +++ b/src/public/tier0/basetypes.h @@ -113,13 +113,13 @@ FORCEINLINE float fpmax( float a, float b ) #ifdef __cplusplus -template< class T, class Y > -inline T clamp( T const &val, Y const &minVal, Y const &maxVal ) +template< class T, class MIN, class MAX > +inline T clamp( T const &val, MIN const &minVal, MAX const &maxVal ) { if( val < minVal ) - return minVal; + return T( minVal ); else if( val > maxVal ) - return maxVal; + return T( maxVal ); else return val; } diff --git a/src/public/tier0/vprof.h b/src/public/tier0/vprof.h index d05f2fe90..262dfd3ed 100644 --- a/src/public/tier0/vprof.h +++ b/src/public/tier0/vprof.h @@ -147,28 +147,31 @@ #define VPROF_LEVEL 0 #endif -#define VPROF_0(name,group,assertAccounted,budgetFlags) CVProfScope VProf_(name, 0, group, assertAccounted, budgetFlags); +// The scope object needs a unique name per expansion: nesting a budget inside the +// braces of an enclosing budget is a common idiom in this code base and would +// otherwise shadow the outer scope object. +#define VPROF_0(name,group,assertAccounted,budgetFlags) CVProfScope UNIQUE_ID(name, 0, group, assertAccounted, budgetFlags); #if VPROF_LEVEL > 0 -#define VPROF_1(name,group,assertAccounted,budgetFlags) CVProfScope VProf_(name, 1, group, assertAccounted, budgetFlags); +#define VPROF_1(name,group,assertAccounted,budgetFlags) CVProfScope UNIQUE_ID(name, 1, group, assertAccounted, budgetFlags); #else #define VPROF_1(name,group,assertAccounted,budgetFlags) ((void)0) #endif #if VPROF_LEVEL > 1 -#define VPROF_2(name,group,assertAccounted,budgetFlags) CVProfScope VProf_(name, 2, group, assertAccounted, budgetFlags); +#define VPROF_2(name,group,assertAccounted,budgetFlags) CVProfScope UNIQUE_ID(name, 2, group, assertAccounted, budgetFlags); #else #define VPROF_2(name,group,assertAccounted,budgetFlags) ((void)0) #endif #if VPROF_LEVEL > 2 -#define VPROF_3(name,group,assertAccounted,budgetFlags) CVProfScope VProf_(name, 3, group, assertAccounted, budgetFlags); +#define VPROF_3(name,group,assertAccounted,budgetFlags) CVProfScope UNIQUE_ID(name, 3, group, assertAccounted, budgetFlags); #else #define VPROF_3(name,group,assertAccounted,budgetFlags) ((void)0) #endif #if VPROF_LEVEL > 3 -#define VPROF_4(name,group,assertAccounted,budgetFlags) CVProfScope VProf_(name, 4, group, assertAccounted, budgetFlags); +#define VPROF_4(name,group,assertAccounted,budgetFlags) CVProfScope UNIQUE_ID(name, 4, group, assertAccounted, budgetFlags); #else #define VPROF_4(name,group,assertAccounted,budgetFlags) ((void)0) #endif diff --git a/src/public/tier1/UtlSortVector.h b/src/public/tier1/UtlSortVector.h index 42c35958f..f00982538 100644 --- a/src/public/tier1/UtlSortVector.h +++ b/src/public/tier1/UtlSortVector.h @@ -177,7 +177,7 @@ void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUp ctx.m_pLessContext = m_pLessContext; ctx.m_pLessFunc = &less; - qsort_s( Base(), Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper, &ctx ); + qsort_s( this->Base(), this->Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper, &ctx ); } #else typedef int (__cdecl *QSortCompareFunc_t)( const void *, const void *); diff --git a/src/public/tier1/UtlStringMap.h b/src/public/tier1/UtlStringMap.h index 7176e1e4b..70ae414fb 100644 --- a/src/public/tier1/UtlStringMap.h +++ b/src/public/tier1/UtlStringMap.h @@ -47,7 +47,7 @@ class CUtlStringMap bool Defined( const char *pString ) const { - return m_SymbolTable.Find( pString ) != UTL_INVAL_SYMBOL; + return m_SymbolTable.Find( pString ).IsValid(); } UtlSymId_t Find( const char *pString ) const diff --git a/src/public/tier1/interpolatedvar.h b/src/public/tier1/interpolatedvar.h index 6f0e1be26..1cf2ed4a2 100644 --- a/src/public/tier1/interpolatedvar.h +++ b/src/public/tier1/interpolatedvar.h @@ -1537,7 +1537,7 @@ class CInterpolatedVarArray : public CInterpolatedVarArrayBase CInterpolatedVarArray( const char *pDebugName = "no debug name" ) : CInterpolatedVarArrayBase( pDebugName ) { - SetMaxCount( 0.0f, COUNT ); + this->SetMaxCount( 0.0f, COUNT ); } }; @@ -1553,7 +1553,7 @@ class CInterpolatedVar : public CInterpolatedVarArrayBase< Type, false > CInterpolatedVar( const char *pDebugName = NULL ) : CInterpolatedVarArrayBase< Type, false >(pDebugName) { - SetMaxCount( 0.0f, 1 ); + this->SetMaxCount( 0.0f, 1 ); } }; diff --git a/src/public/tier1/strtools.h b/src/public/tier1/strtools.h index 45f61b985..98bdf4858 100644 --- a/src/public/tier1/strtools.h +++ b/src/public/tier1/strtools.h @@ -10,6 +10,7 @@ #define TIER1_STRTOOLS_H #include "tier0/basetypes.h" +#include #ifdef _WIN32 #pragma once diff --git a/src/public/tier1/tokenset.h b/src/public/tier1/tokenset.h index b05e3464a..e382853fe 100644 --- a/src/public/tier1/tokenset.h +++ b/src/public/tier1/tokenset.h @@ -85,7 +85,7 @@ inline _T tokenset_t< _T >::GetTokenI( const char *s ) const } template -inline const char *tokenset_t< _T >::GetNameByToken( _T token ) const +inline const char *tokenset_t< _T >::GetNameByToken( _T nToken ) const { static const char *unknown = "__UNKNOWN__"; @@ -93,7 +93,7 @@ inline const char *tokenset_t< _T >::GetNameByToken( _T token ) const for ( c = this; c->name; ++c ) { - if ( c->token == token ) + if ( c->token == nToken ) { return c->name; } diff --git a/src/public/tier1/utllinkedlist.h b/src/public/tier1/utllinkedlist.h index 4c28e8423..fdf1120d8 100644 --- a/src/public/tier1/utllinkedlist.h +++ b/src/public/tier1/utllinkedlist.h @@ -198,7 +198,7 @@ class CUtlFixedLinkedList : public CUtlLinkedList< T, intp, true, intp, CUtlFixe return false; #ifdef _DEBUG // it's safe to skip this here, since the only way to get indices after m_LastAlloc is to use MaxElementIndex - if ( Memory().IsIdxAfter( i, this->m_LastAlloc ) ) + if ( this->Memory().IsIdxAfter( i, this->m_LastAlloc ) ) { Assert( 0 ); return false; // don't read values that have been allocated, but not constructed diff --git a/src/public/tier1/utlobjectreference.h b/src/public/tier1/utlobjectreference.h index b69598819..d96b4f17a 100644 --- a/src/public/tier1/utlobjectreference.h +++ b/src/public/tier1/utlobjectreference.h @@ -200,9 +200,9 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > public: void RemoveAll() { - for ( int i = 0; i < Count(); i++ ) + for ( int i = 0; i < this->Count(); i++ ) { - Element( i ).KillRef(); + this->Element( i ).KillRef(); } CUtlBlockVector::RemoveAll(); @@ -210,16 +210,16 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > void FastRemove( int elem ) { - Assert( IsValidIndex(elem) ); + Assert( this->IsValidIndex(elem) ); - if (m_Size > 0) + if (this->m_Size > 0) { - if ( elem != m_Size -1 ) + if ( elem != this->m_Size -1 ) { - Element(elem).Set( Element(m_Size-1).GetObject() ); + this->Element(elem).Set( this->Element(this->m_Size-1).GetObject() ); } - Destruct( &Element(m_Size-1) ); - --m_Size; + Destruct( &this->Element(this->m_Size-1) ); + --this->m_Size; } } @@ -236,17 +236,17 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > void Remove( int elem ) { - Assert( IsValidIndex(elem) ); + Assert( this->IsValidIndex(elem) ); - if (m_Size > 0) + if (this->m_Size > 0) { - for ( int i = elem; i < ( m_Size - 1 ); i++ ) + for ( int i = elem; i < ( this->m_Size - 1 ); i++ ) { - Element( i ).Set( Element( i + 1 ).GetObject() ); + this->Element( i ).Set( this->Element( i + 1 ).GetObject() ); } - Destruct( &Element(m_Size-1) ); - --m_Size; + Destruct( &this->Element(this->m_Size-1) ); + --this->m_Size; } } diff --git a/src/public/tier1/utlsoacontainer.h b/src/public/tier1/utlsoacontainer.h index 7d3cd8954..53efcfa65 100644 --- a/src/public/tier1/utlsoacontainer.h +++ b/src/public/tier1/utlsoacontainer.h @@ -447,11 +447,7 @@ template class CSOAAttributeReferenceBinaryOp CSOAAttributeReference m_opA; CSOAAttributeReference m_opB; - CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const & b ) - { - a.CopyTo( m_opA ); - b.CopyTo( m_opB ); - } + CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const & b ); }; @@ -508,8 +504,8 @@ template FORCEINLINE void CSOAAttributeReference::operato { m_pContainer->AssertDataType( m_nAttributeID, ATTRDATATYPE_FLOAT ); fltx4 *pOut = m_pContainer->RowPtr( m_nAttributeID, 0 ); - fltx4 *pInA = op.m_opA.m_pContainer->RowPtr( op.m_opA.m_nAttributeID, 0 ); - fltx4 *pInB = op.m_opB.m_pContainer->RowPtr( op.m_opB.m_nAttributeID, 0 ); + fltx4 *pInA = op.m_opA.m_pContainer->template RowPtr( op.m_opA.m_nAttributeID, 0 ); + fltx4 *pInB = op.m_opB.m_pContainer->template RowPtr( op.m_opB.m_nAttributeID, 0 ); size_t nRowToRowStride = m_pContainer->RowToRowStep( m_nAttributeID ) / sizeof( fltx4 ); int nRowCtr = m_pContainer->NumRows() * m_pContainer->NumSlices(); do @@ -531,6 +527,13 @@ FORCEINLINE void CSOAAttributeReference::CopyTo( CSOAAttributeReference &other ) other.m_nAttributeID = m_nAttributeID; } +template +CSOAAttributeReferenceBinaryOp::CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const &b ) +{ + a.CopyTo( m_opA ); + b.CopyTo( m_opB ); +} + FORCEINLINE CSOAAttributeReference CSOAContainer::operator[]( int nAttrIdx ) diff --git a/src/public/tier1/utlvector.h b/src/public/tier1/utlvector.h index 18074851c..a604f60a5 100644 --- a/src/public/tier1/utlvector.h +++ b/src/public/tier1/utlvector.h @@ -523,7 +523,7 @@ class CCopyableUtlVector : public CUtlVector< T, CUtlMemory > CCopyableUtlVector( T* pMemory, int numElements ) : BaseClass( pMemory, numElements ) {} CCopyableUtlVector( std::initializer_list init ) : BaseClass( init ) {} virtual ~CCopyableUtlVector() {} - CCopyableUtlVector( CCopyableUtlVector const& vec ) { CopyArray( vec.Base(), vec.Count() ); } + CCopyableUtlVector( CCopyableUtlVector const& vec ) { this->CopyArray( vec.Base(), vec.Count() ); } }; // TODO (Ilya): It seems like all the functions in CUtlVector are simple enough that they should be inlined. diff --git a/src/public/vgui_controls/Panel.h b/src/public/vgui_controls/Panel.h index e0c373d1d..dc19132af 100644 --- a/src/public/vgui_controls/Panel.h +++ b/src/public/vgui_controls/Panel.h @@ -26,6 +26,7 @@ #include "vgui_controls/PanelAnimationVar.h" #include "Color.h" #include "vstdlib/IKeyValuesSystem.h" +#include "tier1/KeyValues.h" #include "tier1/utlsymbol.h" #include "vgui_controls/BuildGroup.h" #include "dmxloader/dmxelement.h" diff --git a/src/public/vscript/ivscript.h b/src/public/vscript/ivscript.h index b9de5aeec..c1db90ccf 100644 --- a/src/public/vscript/ivscript.h +++ b/src/public/vscript/ivscript.h @@ -435,7 +435,7 @@ struct ScriptVariant_t { DevWarning( "No free conversion of string or vector script variant right now\n" ); // If want to support this, probably need to malloc string and require free on other side [3/24/2008 tom] - *pDest = ""; + *pDest = const_cast( "" ); return false; } @@ -996,9 +996,10 @@ class CScriptScopeT : public CDefScriptScopeBase bool FunctionExists( const char *pszFunction ) { + HSCRIPT hFunction = NULL; if ( GetVM() ) { - HSCRIPT hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); + hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); GetVM()->ReleaseFunction( hFunction ); } return ( hFunction != NULL ) ; diff --git a/src/responserules/runtime/response_system.cpp b/src/responserules/runtime/response_system.cpp index b9270aaa9..936263bb0 100644 --- a/src/responserules/runtime/response_system.cpp +++ b/src/responserules/runtime/response_system.cpp @@ -2634,8 +2634,8 @@ static void CC_RR_Debug_ResponseConcept_Exclude( const CCommand &args ) { Msg( "\t'%s' is not a known concept (adding it anyway)\n", args[i] ); } - CRR_Concept concept( args[i] ); - CResponseSystem::m_DebugExcludeList.AddToTail( concept ); + CRR_Concept conceptName( args[i] ); + CResponseSystem::m_DebugExcludeList.AddToTail( conceptName ); } } } diff --git a/src/responserules/runtime/response_types_internal.h b/src/responserules/runtime/response_types_internal.h index 2e46f3e01..a36905358 100644 --- a/src/responserules/runtime/response_types_internal.h +++ b/src/responserules/runtime/response_types_internal.h @@ -343,6 +343,8 @@ namespace ResponseRules }; #pragma pack(pop) +extern const char *ResponseCopyString( const char *in ); + template class CResponseDict : public CUtlMap {