diff options
| author | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
|---|---|---|
| committer | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
| commit | 55ed12f8d1eb6887d348be03aee5573d44177ffb (patch) | |
| tree | 3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/game/client | |
| parent | * Added support for Visual C++ 2013 Express to VPC (diff) | |
| download | source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip | |
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/game/client')
31 files changed, 291 insertions, 139 deletions
diff --git a/mp/src/game/client/c_baseanimating.cpp b/mp/src/game/client/c_baseanimating.cpp index c41ff46b..75c9d7a8 100644 --- a/mp/src/game/client/c_baseanimating.cpp +++ b/mp/src/game/client/c_baseanimating.cpp @@ -3531,7 +3531,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer p = nexttoken( token, p, ' ' ); // Find the weapon type - if ( token ) + if ( token[0] ) { //TODO: Parse the type from a list instead if ( Q_stricmp( token, "COMBINE" ) == 0 ) @@ -3577,7 +3577,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer int attachmentIndex = -1; // Find the attachment name - if ( token ) + if ( token[0] ) { attachmentIndex = LookupAttachment( token ); @@ -3684,29 +3684,25 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int // Get the particle effect name const char *p = options; p = nexttoken(token, p, ' '); - if ( token ) - { - const char* mtoken = ModifyEventParticles( token ); - if ( !mtoken || mtoken[0] == '\0' ) - return; - Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) ); - } + + const char* mtoken = ModifyEventParticles( token ); + if ( !mtoken || mtoken[0] == '\0' ) + return; + Q_strncpy( szParticleEffect, mtoken, sizeof(szParticleEffect) ); // Get the attachment type p = nexttoken(token, p, ' '); - if ( token ) + + iAttachType = GetAttachTypeFromString( token ); + if ( iAttachType == -1 ) { - iAttachType = GetAttachTypeFromString( token ); - if ( iAttachType == -1 ) - { - Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token ); - return; - } + Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token ); + return; } // Get the attachment point index p = nexttoken(token, p, ' '); - if ( token ) + if ( token[0] ) { iAttachment = atoi(token); @@ -3902,26 +3898,19 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int case AE_CL_BODYGROUP_SET_VALUE: { - char szBodygroupName[256]; - int value = 0; - + int value; char token[256]; + char szBodygroupName[256]; const char *p = options; // Bodygroup Name p = nexttoken(token, p, ' '); - if ( token ) - { - Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) ); - } + Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) ); // Get the desired value p = nexttoken(token, p, ' '); - if ( token ) - { - value = atoi( token ); - } + value = token[0] ? atoi( token ) : 0; int index = FindBodygroupByName( szBodygroupName ); if ( index >= 0 ) @@ -3950,33 +3939,21 @@ void C_BaseAnimating::FireObsoleteEvent( const Vector& origin, const QAngle& ang // Obsolete. Use the AE_CL_CREATE_PARTICLE_EFFECT event instead, which uses the artist driven particle system & editor. case AE_CLIENT_EFFECT_ATTACH: { - int iAttachment = -1; - int iParam = 0; + int iAttachment; + int iParam; char token[128]; char effectFunc[128]; const char *p = options; p = nexttoken(token, p, ' '); - - if( token ) - { - Q_strncpy( effectFunc, token, sizeof(effectFunc) ); - } + Q_strncpy( effectFunc, token, sizeof(effectFunc) ); p = nexttoken(token, p, ' '); - - if( token ) - { - iAttachment = atoi(token); - } + iAttachment = token[0] ? atoi(token) : -1; p = nexttoken(token, p, ' '); - - if( token ) - { - iParam = atoi(token); - } + iParam = token[0] ? atoi(token) : 0; if ( iAttachment != -1 && m_Attachments.Count() >= iAttachment ) { @@ -5281,8 +5258,9 @@ float C_BaseAnimating::FrameAdvance( float flInterval ) // Stubs for weapon prediction void C_BaseAnimating::ResetSequenceInfo( void ) { - if (GetSequence() == -1) + if ( GetSequence() == -1 ) { + // This shouldn't happen. Setting m_nSequence blindly is a horrible coding practice. SetSequence( 0 ); } @@ -5294,7 +5272,7 @@ void C_BaseAnimating::ResetSequenceInfo( void ) CStudioHdr *pStudioHdr = GetModelPtr(); m_flGroundSpeed = GetSequenceGroundSpeed( pStudioHdr, GetSequence() ) * GetModelScale(); - m_bSequenceLoops = ((GetSequenceFlags( pStudioHdr, GetSequence() ) & STUDIO_LOOPING) != 0); + m_bSequenceLoops = ( ( GetSequenceFlags( pStudioHdr, GetSequence() ) & STUDIO_LOOPING ) != 0 ); // m_flAnimTime = gpGlobals->time; m_flPlaybackRate = 1.0; m_bSequenceFinished = false; @@ -5302,9 +5280,12 @@ void C_BaseAnimating::ResetSequenceInfo( void ) m_nNewSequenceParity = ( m_nNewSequenceParity + 1 ) & EF_PARITY_MASK; m_nResetEventsParity = ( m_nResetEventsParity + 1 ) & EF_PARITY_MASK; - + // FIXME: why is this called here? Nothing should have changed to make this nessesary - SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) ); + if ( pStudioHdr ) + { + SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) ); + } } //========================================================= diff --git a/mp/src/game/client/c_baseentity.cpp b/mp/src/game/client/c_baseentity.cpp index 8f40d7ef..25b089cd 100644 --- a/mp/src/game/client/c_baseentity.cpp +++ b/mp/src/game/client/c_baseentity.cpp @@ -571,7 +571,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar ) { Msg( "--------------------------------------------------\n" ); int i = pVar->GetHead(); - CApparentVelocity<Vector> apparent; + Vector v0(0, 0, 0); + CApparentVelocity<Vector> apparent(v0); float prevtime = 0.0f; while ( 1 ) { @@ -594,7 +595,8 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f Msg( "--------------------------------------------------\n" ); int i = pVar->GetHead(); - CApparentVelocity<Vector> apparent; + Vector v0(0, 0, 0); + CApparentVelocity<Vector> apparent(v0); float newtime = 999999.0f; Vector newVec( 0, 0, 0 ); bool bSpew = true; @@ -662,7 +664,7 @@ void SpewInterpolatedVar( CInterpolatedVar< float > *pVar ) { Msg( "--------------------------------------------------\n" ); int i = pVar->GetHead(); - CApparentVelocity<float> apparent; + CApparentVelocity<float> apparent(0.0f); while ( 1 ) { float changetime; @@ -684,7 +686,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float flMax = -1e23; int i = pVar->GetHead(); - CApparentVelocity<Vector> apparent; + Vector v0(0, 0, 0); + CApparentVelocity<Vector> apparent(v0); while ( 1 ) { float changetime; @@ -892,6 +895,8 @@ C_BaseEntity::C_BaseEntity() : m_iv_angRotation( "C_BaseEntity::m_iv_angRotation" ), m_iv_vecVelocity( "C_BaseEntity::m_iv_vecVelocity" ) { + m_pAttributes = NULL; + AddVar( &m_vecOrigin, &m_iv_vecOrigin, LATCH_SIMULATION_VAR ); AddVar( &m_angRotation, &m_iv_angRotation, LATCH_SIMULATION_VAR ); // Removing this until we figure out why velocity introduces view hitching. @@ -1299,19 +1304,6 @@ bool C_BaseEntity::VPhysicsIsFlesh( void ) return false; } -//----------------------------------------------------------------------------- -// Returns the health fraction -//----------------------------------------------------------------------------- -float C_BaseEntity::HealthFraction() const -{ - if (GetMaxHealth() == 0) - return 1.0f; - - float flFraction = (float)GetHealth() / (float)GetMaxHealth(); - flFraction = clamp( flFraction, 0.0f, 1.0f ); - return flFraction; -} - //----------------------------------------------------------------------------- // Purpose: Retrieves the coordinate frame for this entity. @@ -2625,6 +2617,25 @@ void C_BaseEntity::PostDataUpdate( DataUpdateType_t updateType ) } //----------------------------------------------------------------------------- +// Purpose: Latch simulation values when the entity has not changed +//----------------------------------------------------------------------------- +void C_BaseEntity::OnDataUnchangedInPVS() +{ + Interp_RestoreToLastNetworked( GetVarMapping() ); + + // For non-predicted and non-client only ents, we need to latch network values into the interpolation histories + if ( !GetPredictable() && !IsClientCreated() ) + { + OnLatchInterpolatedVariables( LATCH_SIMULATION_VAR ); + } + + Assert( m_hNetworkMoveParent.Get() || !m_hNetworkMoveParent.IsValid() ); + HierarchySetParent(m_hNetworkMoveParent); + + MarkMessageReceived(); +} + +//----------------------------------------------------------------------------- // Purpose: // Input : *context - //----------------------------------------------------------------------------- @@ -3741,7 +3752,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd case mod_brush: { - color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() }; + color32 cColor32 = { (byte)cColor.r(), (byte)cColor.g(), (byte)cColor.b(), (byte)cColor.a() }; effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 ); } break; @@ -6309,6 +6320,9 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry ) if ( FStrEq( pszModel, "models/props_lakeside_event/bomb_temp_hat.mdl" ) ) return true; + + if ( FStrEq( pszModel, "models/props_moonbase/powersupply_flag.mdl" ) ) + return true; } // Any entity that's not an item parented to a player is invalid. diff --git a/mp/src/game/client/c_baseentity.h b/mp/src/game/client/c_baseentity.h index c62b732f..f062760d 100644 --- a/mp/src/game/client/c_baseentity.h +++ b/mp/src/game/client/c_baseentity.h @@ -58,6 +58,7 @@ class C_BaseCombatCharacter; class CEntityMapData; class ConVar; class CDmgAccumulator; +class IHasAttributes; struct CSoundParameters; @@ -335,6 +336,7 @@ public: // save out interpolated values virtual void PreDataUpdate( DataUpdateType_t updateType ); virtual void PostDataUpdate( DataUpdateType_t updateType ); + virtual void OnDataUnchangedInPVS(); virtual void ValidateModelIndex( void ); @@ -516,6 +518,7 @@ public: // Used when the collision prop is told to ask game code for the world-space surrounding box virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs ); + virtual float GetHealthBarHeightOffset() const { return 0.f; } // Returns the entity-to-world transform matrix3x4_t &EntityToWorldTransform(); @@ -686,7 +689,7 @@ public: virtual bool ShouldDraw(); inline bool IsVisible() const { return m_hRender != INVALID_CLIENT_RENDER_HANDLE; } - void UpdateVisibility(); + virtual void UpdateVisibility(); // Returns true if the entity changes its position every frame on the server but it doesn't // set animtime. In that case, the client returns true here so it copies the server time to @@ -743,7 +746,8 @@ public: virtual void SetHealth(int iHealth) {} virtual int GetHealth() const { return 0; } virtual int GetMaxHealth() const { return 1; } - virtual bool IsVisibleToTargetID( void ) { return false; } + virtual bool IsVisibleToTargetID( void ) const { return false; } + virtual bool IsHealthBarVisible( void ) const { return false; } // Returns the health fraction float HealthFraction() const; @@ -1172,7 +1176,17 @@ public: // Sets the origin + angles to match the last position received void MoveToLastReceivedPosition( bool force = false ); + // Return the IHasAttributes interface for this base entity. Removes the need for: + // dynamic_cast< IHasAttributes * >( pEntity ); + // Which is remarkably slow. + // GetAttribInterface( CBaseEntity *pEntity ) in attribute_manager.h uses + // this function, tests for NULL, and Asserts m_pAttributes == dynamic_cast. + inline IHasAttributes *GetHasAttributesInterfacePtr() const { return m_pAttributes; } + protected: + // NOTE: m_pAttributes needs to be set in the leaf class constructor. + IHasAttributes *m_pAttributes; + // Only meant to be called from subclasses void DestroyModelInstance(); diff --git a/mp/src/game/client/c_baseflex.cpp b/mp/src/game/client/c_baseflex.cpp index 6146b2dd..7e6c4bfc 100644 --- a/mp/src/game/client/c_baseflex.cpp +++ b/mp/src/game/client/c_baseflex.cpp @@ -562,11 +562,11 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr ) m_iEyeUpdown = FindFlexController( "eyes_updown" ); m_iEyeRightleft = FindFlexController( "eyes_rightleft" ); - if ( m_iEyeUpdown != -1 ) + if ( m_iEyeUpdown != LocalFlexController_t(-1) ) { pStudioHdr->pFlexcontroller( m_iEyeUpdown )->localToGlobal = AddGlobalFlexController( "eyes_updown" ); } - if ( m_iEyeRightleft != -1 ) + if ( m_iEyeRightleft != LocalFlexController_t(-1) ) { pStudioHdr->pFlexcontroller( m_iEyeRightleft )->localToGlobal = AddGlobalFlexController( "eyes_rightleft" ); } @@ -594,13 +594,13 @@ Vector C_BaseFlex::SetViewTarget( CStudioHdr *pStudioHdr ) // calculate animated eye deflection Vector eyeDeflect; QAngle eyeAng( 0, 0, 0 ); - if ( m_iEyeUpdown != -1 ) + if ( m_iEyeUpdown != LocalFlexController_t(-1) ) { mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeUpdown ); eyeAng.x = g_flexweight[ pflex->localToGlobal ]; } - if ( m_iEyeRightleft != -1 ) + if ( m_iEyeRightleft != LocalFlexController_t(-1) ) { mstudioflexcontroller_t *pflex = pStudioHdr->pFlexcontroller( m_iEyeRightleft ); eyeAng.y = g_flexweight[ pflex->localToGlobal ]; @@ -1057,7 +1057,7 @@ void C_BaseFlex::GetToolRecordingState( KeyValues *msg ) Vector viewtarget = m_viewtarget; // Use the unfiltered value // HACK HACK: Unmap eyes right/left amounts - if (m_iEyeUpdown != -1 && m_iEyeRightleft != -1) + if (m_iEyeUpdown != LocalFlexController_t(-1) && m_iEyeRightleft != LocalFlexController_t(-1)) { mstudioflexcontroller_t *flexupdown = hdr->pFlexcontroller( m_iEyeUpdown ); mstudioflexcontroller_t *flexrightleft = hdr->pFlexcontroller( m_iEyeRightleft ); diff --git a/mp/src/game/client/c_basetempentity.h b/mp/src/game/client/c_basetempentity.h index d462461c..2f3740ea 100644 --- a/mp/src/game/client/c_basetempentity.h +++ b/mp/src/game/client/c_basetempentity.h @@ -55,6 +55,7 @@ public: virtual void NotifyShouldTransmit( ShouldTransmitState_t state ); virtual void PreDataUpdate( DataUpdateType_t updateType ); virtual void PostDataUpdate( DataUpdateType_t updateType ); + virtual void OnDataUnchangedInPVS( void ) { } virtual void OnPreDataChanged( DataUpdateType_t updateType ); virtual void OnDataChanged( DataUpdateType_t updateType ); virtual void SetDormant( bool bDormant ); diff --git a/mp/src/game/client/c_baseviewmodel.cpp b/mp/src/game/client/c_baseviewmodel.cpp index 98132bc9..8ae21f63 100644 --- a/mp/src/game/client/c_baseviewmodel.cpp +++ b/mp/src/game/client/c_baseviewmodel.cpp @@ -192,7 +192,7 @@ bool C_BaseViewModel::Interpolate( float currentTime ) } -inline bool C_BaseViewModel::ShouldFlipViewModel() +bool C_BaseViewModel::ShouldFlipViewModel() { #ifdef CSTRIKE_DLL // If cl_righthand is set, then we want them all right-handed. diff --git a/mp/src/game/client/c_entitydissolve.cpp b/mp/src/game/client/c_entitydissolve.cpp index 0c8dadc2..f61e2ac0 100644 --- a/mp/src/game/client/c_entitydissolve.cpp +++ b/mp/src/game/client/c_entitydissolve.cpp @@ -575,7 +575,10 @@ void C_EntityDissolve::ClientThink( void ) #ifdef TF_CLIENT_DLL else { - pEnt->Release(); + // Hide the ragdoll -- don't actually delete it or else things get unhappy when + // we get a message from the server telling us to delete it + pEnt->AddEffects( EF_NODRAW ); + pEnt->ParticleProp()->StopEmission(); } #endif } diff --git a/mp/src/game/client/c_particle_system.cpp b/mp/src/game/client/c_particle_system.cpp index 57f3c375..e0aee808 100644 --- a/mp/src/game/client/c_particle_system.cpp +++ b/mp/src/game/client/c_particle_system.cpp @@ -198,12 +198,19 @@ void ParticleEffectCallback( const CEffectData &data ) pEnt->ParticleProp()->StopEmission(); } - pEffect = pEnt->ParticleProp()->Create( pszName, (ParticleAttachment_t)data.m_nDamageType, data.m_nAttachmentIndex ); + Vector vOffset = vec3_origin; + ParticleAttachment_t iAttachType = (ParticleAttachment_t)data.m_nDamageType; + if ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW ) + { + vOffset = data.m_vStart; + } + + pEffect = pEnt->ParticleProp()->Create( pszName, iAttachType, data.m_nAttachmentIndex, vOffset ); AssertMsg2( pEffect.IsValid() && pEffect->IsValid(), "%s could not create particle effect %s", C_BaseEntity::Instance( data.m_hEntity )->GetDebugName(), pszName ); if ( pEffect.IsValid() && pEffect->IsValid() ) { - if ( (ParticleAttachment_t)data.m_nDamageType == PATTACH_CUSTOMORIGIN ) + if ( iAttachType == PATTACH_CUSTOMORIGIN ) { pEffect->SetSortOrigin( data.m_vOrigin ); pEffect->SetControlPoint( 0, data.m_vOrigin ); diff --git a/mp/src/game/client/c_rope.cpp b/mp/src/game/client/c_rope.cpp index 605f4750..9f11fc5d 100644 --- a/mp/src/game/client/c_rope.cpp +++ b/mp/src/game/client/c_rope.cpp @@ -193,7 +193,7 @@ public: if( pReturn == NULL ) { int iMaxSize = m_QueuedRopeMemory[m_nCurrentStack].GetMaxSize(); - Warning( "Overflowed rope queued rendering memory stack. Needed %d, have %d/%d\n", bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize ); + Warning( "Overflowed rope queued rendering memory stack. Needed %llu, have %d/%d\n", (uint64)bytes, iMaxSize - m_QueuedRopeMemory[m_nCurrentStack].GetUsed(), iMaxSize ); pReturn = malloc( bytes ); m_DeleteOnSwitch[m_nCurrentStack].AddToTail( pReturn ); } diff --git a/mp/src/game/client/c_sceneentity.cpp b/mp/src/game/client/c_sceneentity.cpp index b44b59fd..baf2770e 100644 --- a/mp/src/game/client/c_sceneentity.cpp +++ b/mp/src/game/client/c_sceneentity.cpp @@ -214,11 +214,11 @@ void C_SceneEntity::SetupClientOnlyScene( const char *pszFilename, C_BaseFlex *p V_strcpy( szFilename, szSceneHWM ); } - Assert( szFilename && szFilename[ 0 ] ); - if ( szFilename && szFilename[ 0 ] ) + Assert( szFilename[ 0 ] ); + if ( szFilename[ 0 ] ) { LoadSceneFromFile( szFilename ); - + if (!CommandLine()->FindParm("-hushasserts")) { Assert( m_pScene ); @@ -335,8 +335,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType ) if ( updateType == DATA_UPDATE_CREATED ) { - Assert( szFilename && szFilename[ 0 ] ); - if ( szFilename && szFilename[ 0 ] ) + Assert( szFilename[ 0 ] ); + if ( szFilename[ 0 ] ) { LoadSceneFromFile( szFilename ); @@ -373,6 +373,8 @@ void C_SceneEntity::PostDataUpdate( DataUpdateType_t updateType ) SetNextClientThink( CLIENT_THINK_ALWAYS ); } + + m_bWasPlaying = !m_bIsPlayingBack; // force it to be "changed" } // Playback state changed... diff --git a/mp/src/game/client/c_te_legacytempents.cpp b/mp/src/game/client/c_te_legacytempents.cpp index 3c8adf68..14f6d0e8 100644 --- a/mp/src/game/client/c_te_legacytempents.cpp +++ b/mp/src/game/client/c_te_legacytempents.cpp @@ -1539,7 +1539,7 @@ void CTempEnts::BloodSprite( const Vector &org, int r, int g, int b, int a, int { C_LocalTempEntity *pTemp; int frameCount = modelinfo->GetModelFrameCount( model ); - color32 impactcolor = { r, g, b, a }; + color32 impactcolor = { (byte)r, (byte)g, (byte)b, (byte)a }; //Large, single blood sprite is a high-priority tent if ( ( pTemp = TempEntAllocHigh( org, model ) ) != NULL ) diff --git a/mp/src/game/client/c_team_train_watcher.cpp b/mp/src/game/client/c_team_train_watcher.cpp index da3fa880..e58aafb1 100644 --- a/mp/src/game/client/c_team_train_watcher.cpp +++ b/mp/src/game/client/c_team_train_watcher.cpp @@ -163,18 +163,13 @@ void C_TeamTrainWatcher::OnDataChanged( DataUpdateType_t updateType ) int nNumHills = ObjectiveResource()->GetNumNodeHillData( GetTeamNumber() ); if ( nNumHills > 0 ) { - float flStart, flEnd; + float flStart = 0, flEnd = 0; for ( int i = 0 ; i < nNumHills ; i++ ) { ObjectiveResource()->GetHillData( GetTeamNumber(), i, flStart, flEnd ); - if ( m_flTotalProgress >= flStart && m_flTotalProgress<= flEnd ) - { - ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, true ); - } - else - { - ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, false ); - } + + bool state = ( m_flTotalProgress >= flStart && m_flTotalProgress <= flEnd ); + ObjectiveResource()->SetTrainOnHill( GetTeamNumber(), i, state ); } } } diff --git a/mp/src/game/client/client_base.vpc b/mp/src/game/client/client_base.vpc index 52dceb7e..309ffb8c 100644 --- a/mp/src/game/client/client_base.vpc +++ b/mp/src/game/client/client_base.vpc @@ -53,9 +53,8 @@ $Configuration { $AdditionalIncludeDirectories ".\;$BASE;$SRCDIR\vgui2\include;$SRCDIR\vgui2\controls;$SRCDIR\game\shared;.\game_controls;$SRCDIR\thirdparty\sixensesdk\include" $PreprocessorDefinitions "$BASE;NO_STRING_T;CLIENT_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead" - $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;fopen=dont_use_fopen" [$WIN32] - $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;" [$OSXALL] - $PreprocessorDefinitions "$BASE;ENABLE_CHROMEHTMLWINDOW;USE_WEBM_FOR_REPLAY;" [$LINUXALL] + $PreprocessorDefinitions "$BASE;fopen=dont_use_fopen" [$WIN32] + $PreprocessorDefinitions "$BASE;USE_WEBM_FOR_REPLAY;" [$LINUXALL] $PreprocessorDefinitions "$BASE;CURL_STATICLIB" [$WIN32 && $BUILD_REPLAY] $Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)" $Create/UsePCHThroughFile "cbase.h" diff --git a/mp/src/game/client/client_virtualreality.cpp b/mp/src/game/client/client_virtualreality.cpp index fb6e4417..472fa6c1 100644 --- a/mp/src/game/client/client_virtualreality.cpp +++ b/mp/src/game/client/client_virtualreality.cpp @@ -213,6 +213,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj ) Assert ( proj.m[3][2] == -1.0f ); Assert ( proj.m[3][3] == 0.0f ); + /* // The math here: // A view-space vector (x,y,z,1) is transformed by the projection matrix // / xscale 0 xoffset 0 \ @@ -227,6 +228,7 @@ void CalcFovFromProjection ( float *pFov, const VMatrix &proj ) // = xscale*(x/z) + xoffset (I flipped the signs of both sides) // => (+-1 - xoffset)/xscale = x/z // ...and x/z is tan(theta), and theta is the half-FOV. + */ float fov_px = 2.0f * RAD2DEG ( atanf ( fabsf ( ( 1.0f - xoffset ) / xscale ) ) ); float fov_nx = 2.0f * RAD2DEG ( atanf ( fabsf ( ( -1.0f - xoffset ) / xscale ) ) ); @@ -261,8 +263,6 @@ CClientVirtualReality::CClientVirtualReality() m_rtLastMotionSample = 0; m_bMotionUpdated = false; - m_bForceVRMode = false; - #if defined( USE_SDL ) m_nNonVRSDLDisplayIndex = 0; #endif @@ -1367,7 +1367,7 @@ void CClientVirtualReality::Activate() return; // These checks don't apply if we're in VR mode because Steam said so. - if ( !m_bForceVRMode ) + if ( !ShouldForceVRActive() ) { // see if VR mode is even enabled if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) @@ -1441,7 +1441,7 @@ void CClientVirtualReality::Activate() vgui::ivgui()->SetVRMode( true ); // we can skip this extra mode change if we've always been in VR mode - if ( !m_bForceVRMode ) + if ( !ShouldForceVRActive() ) { VRRect_t rect; if ( g_pSourceVR->GetDisplayBounds( &rect ) ) @@ -1510,10 +1510,7 @@ void CClientVirtualReality::Deactivate() // Called when startup is complete void CClientVirtualReality::StartupComplete() { - if ( g_pSourceVR ) - m_bForceVRMode = g_pSourceVR->ShouldForceVRMode(); - - if ( vr_activate_default.GetBool( ) || m_bForceVRMode ) + if ( vr_activate_default.GetBool() || ShouldForceVRActive() ) Activate(); } diff --git a/mp/src/game/client/client_virtualreality.h b/mp/src/game/client/client_virtualreality.h index 3a8c9469..9aadfeb3 100644 --- a/mp/src/game/client/client_virtualreality.h +++ b/mp/src/game/client/client_virtualreality.h @@ -147,7 +147,6 @@ private: int m_iAlignTorsoAndViewToWeaponCountdown; bool m_bMotionUpdated; - bool m_bForceVRMode; RTime32 m_rtLastMotionSample; diff --git a/mp/src/game/client/cliententitylist.cpp b/mp/src/game/client/cliententitylist.cpp index 294d4ff1..2f983e62 100644 --- a/mp/src/game/client/cliententitylist.cpp +++ b/mp/src/game/client/cliententitylist.cpp @@ -354,6 +354,67 @@ void CClientEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle ) } +#if defined( STAGING_ONLY ) + +// Defined in tier1 / interface.cpp for Windows and native for POSIX platforms. +extern "C" int backtrace( void **buffer, int size ); + +static struct +{ + int entnum; + float time; + C_BaseEntity *pBaseEntity; + void *backtrace_addrs[ 16 ]; +} g_RemoveEntityBacktraces[ 1024 ]; +static uint32 g_RemoveEntityBacktracesIndex = 0; + +static void OnRemoveEntityBacktraceHook( int entnum, C_BaseEntity *pBaseEntity ) +{ + int index = g_RemoveEntityBacktracesIndex++; + if ( g_RemoveEntityBacktracesIndex >= ARRAYSIZE( g_RemoveEntityBacktraces ) ) + g_RemoveEntityBacktracesIndex = 0; + + g_RemoveEntityBacktraces[ index ].entnum = entnum; + g_RemoveEntityBacktraces[ index ].time = gpGlobals->curtime; + g_RemoveEntityBacktraces[ index ].pBaseEntity = pBaseEntity; + + memset( g_RemoveEntityBacktraces[ index ].backtrace_addrs, 0, sizeof( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) ); + backtrace( g_RemoveEntityBacktraces[ index ].backtrace_addrs, ARRAYSIZE( g_RemoveEntityBacktraces[ index ].backtrace_addrs ) ); +} + +// Should help us track down CL_PreserveExistingEntity Host_Error() issues: +// 1. Set cl_removeentity_backtrace_capture to 1. +// 2. When error hits, run "cl_removeentity_backtrace_dump [entnum]". +// 3. In debugger, track down what functions the spewed addresses refer to. +static ConVar cl_removeentity_backtrace_capture( "cl_removeentity_backtrace_capture", "0", 0, + "For debugging. Capture backtraces for CClientEntityList::OnRemoveEntity calls." ); + +CON_COMMAND( cl_removeentity_backtrace_dump, "Dump backtraces for client OnRemoveEntity calls." ) +{ + if ( !cl_removeentity_backtrace_capture.GetBool() ) + { + Msg( "cl_removeentity_backtrace_dump error: cl_removeentity_backtrace_capture not enabled. Backtraces not captured.\n" ); + return; + } + + int entnum = ( args.ArgC() >= 2 ) ? atoi( args[ 1 ] ) : -1; + + for ( int i = 0; i < ARRAYSIZE( g_RemoveEntityBacktraces ); i++ ) + { + if ( g_RemoveEntityBacktraces[ i ].time && + ( entnum == -1 || g_RemoveEntityBacktraces[ i ].entnum == entnum ) ) + { + Msg( "%d: time:%.2f pBaseEntity:%p\n", g_RemoveEntityBacktraces[i].entnum, + g_RemoveEntityBacktraces[ i ].time, g_RemoveEntityBacktraces[ i ].pBaseEntity ); + for ( int j = 0; j < ARRAYSIZE( g_RemoveEntityBacktraces[ i ].backtrace_addrs ); j++ ) + { + Msg( " %p\n", g_RemoveEntityBacktraces[ i ].backtrace_addrs[ j ] ); + } + } + } +} + +#endif // STAGING_ONLY void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle ) { @@ -380,6 +441,13 @@ void CClientEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle C_BaseEntity *pBaseEntity = pUnknown->GetBaseEntity(); +#if defined( STAGING_ONLY ) + if ( cl_removeentity_backtrace_capture.GetBool() ) + { + OnRemoveEntityBacktraceHook( entnum, pBaseEntity ); + } +#endif // STAGING_ONLY + if ( pBaseEntity ) { if ( pBaseEntity->ObjectCaps() & FCAP_SAVE_NON_NETWORKABLE ) @@ -502,4 +570,4 @@ C_BaseEntity* C_BaseEntityIterator::Next() } return NULL; -}
\ No newline at end of file +} diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index 5d10db6c..68bc89cb 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -470,8 +470,17 @@ bool ClientModeShared::ShouldDrawEntity(C_BaseEntity *pEnt) return true; } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- bool ClientModeShared::ShouldDrawParticles( ) { +#ifdef TF_CLIENT_DLL + C_TFPlayer *pTFPlayer = C_TFPlayer::GetLocalTFPlayer(); + if ( pTFPlayer && !pTFPlayer->ShouldPlayerDrawParticles() ) + return false; +#endif // TF_CLIENT_DLL + return true; } diff --git a/mp/src/game/client/game_controls/baseviewport.cpp b/mp/src/game/client/game_controls/baseviewport.cpp index 0b99ef63..f239cde8 100644 --- a/mp/src/game/client/game_controls/baseviewport.cpp +++ b/mp/src/game/client/game_controls/baseviewport.cpp @@ -229,12 +229,11 @@ void CBaseViewport::CreateDefaultPanels( void ) AddNewPanel( CreatePanelByName( PANEL_SCOREBOARD ), "PANEL_SCOREBOARD" ); AddNewPanel( CreatePanelByName( PANEL_INFO ), "PANEL_INFO" ); AddNewPanel( CreatePanelByName( PANEL_SPECGUI ), "PANEL_SPECGUI" ); +#if !defined( TF_CLIENT_DLL ) AddNewPanel( CreatePanelByName( PANEL_SPECMENU ), "PANEL_SPECMENU" ); AddNewPanel( CreatePanelByName( PANEL_NAV_PROGRESS ), "PANEL_NAV_PROGRESS" ); - // AddNewPanel( CreatePanelByName( PANEL_TEAM ), "PANEL_TEAM" ); - // AddNewPanel( CreatePanelByName( PANEL_CLASS ), "PANEL_CLASS" ); - // AddNewPanel( CreatePanelByName( PANEL_BUY ), "PANEL_BUY" ); -#endif +#endif // !TF_CLIENT_DLL +#endif // !_XBOX } void CBaseViewport::UpdateAllPanels( void ) diff --git a/mp/src/game/client/game_controls/teammenu.cpp b/mp/src/game/client/game_controls/teammenu.cpp index c242c936..6b98afd7 100644 --- a/mp/src/game/client/game_controls/teammenu.cpp +++ b/mp/src/game/client/game_controls/teammenu.cpp @@ -190,6 +190,7 @@ void CTeamMenu::LoadMapPage( const char *mapName ) char mapRES[ MAX_PATH ]; char uilanguage[ 64 ]; + uilanguage[0] = 0; engine->GetUILanguage( uilanguage, sizeof( uilanguage ) ); Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_%s.html", mapName, uilanguage ); diff --git a/mp/src/game/client/game_controls/vguitextwindow.cpp b/mp/src/game/client/game_controls/vguitextwindow.cpp index 5cdc2532..3c641859 100644 --- a/mp/src/game/client/game_controls/vguitextwindow.cpp +++ b/mp/src/game/client/game_controls/vguitextwindow.cpp @@ -102,11 +102,7 @@ CTextWindow::CTextWindow(IViewPort *pViewPort) : Frame(NULL, PANEL_INFO ) SetTitleBarVisible( false ); m_pTextMessage = new TextEntry( this, "TextMessage" ); -#if defined( ENABLE_CHROMEHTMLWINDOW ) m_pHTMLMessage = new CMOTDHTML( this,"HTMLMessage" ); -#else - m_pHTMLMessage = NULL; -#endif m_pTitleLabel = new Label( this, "MessageTitle", "Message Title" ); m_pOK = new Button(this, "ok", "#PropertyDialog_OK"); @@ -165,7 +161,6 @@ void CTextWindow::ShowText( const char *text ) void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable ) { -#if defined( ENABLE_CHROMEHTMLWINDOW ) #ifdef _DEBUG Msg( "CTextWindow::ShowURL( %s )\n", URL ); #endif @@ -196,8 +191,6 @@ void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable ) m_pHTMLMessage->SetVisible( true ); m_pHTMLMessage->OpenURL( URL, NULL ); m_bShownURL = true; - -#endif } void CTextWindow::ShowIndex( const char *entry ) @@ -286,9 +279,8 @@ void CTextWindow::Update( void ) m_pTitleLabel->SetText( m_szTitle ); -#if defined( ENABLE_CHROMEHTMLWINDOW ) - m_pHTMLMessage->SetVisible( false ); -#endif + if ( m_pHTMLMessage ) + m_pHTMLMessage->SetVisible( false ); m_pTextMessage->SetVisible( false ); if ( m_nContentType == TYPE_INDEX ) @@ -427,13 +419,11 @@ void CTextWindow::ShowPanel( bool bShow ) SetVisible( false ); SetMouseInputEnabled( false ); -#if defined( ENABLE_CHROMEHTMLWINDOW ) - if ( m_bUnloadOnDismissal && m_bShownURL ) + if ( m_bUnloadOnDismissal && m_bShownURL && m_pHTMLMessage ) { m_pHTMLMessage->OpenURL( "about:blank", NULL ); m_bShownURL = false; } -#endif } } diff --git a/mp/src/game/client/hl2/hud_damageindicator.cpp b/mp/src/game/client/hl2/hud_damageindicator.cpp index 48dd9b62..9de538a0 100644 --- a/mp/src/game/client/hl2/hud_damageindicator.cpp +++ b/mp/src/game/client/hl2/hud_damageindicator.cpp @@ -178,7 +178,7 @@ void CHudDamageIndicator::DrawDamageIndicator(int side) int x1 = m_flDmgX; int x2 = m_flDmgX + m_flDmgWide; - int y[4] = { m_flDmgY, m_flDmgY + insetY, m_flDmgY + m_flDmgTall1 - insetY, m_flDmgY + m_flDmgTall1 }; + int y[4] = { (int)m_flDmgY, (int)(m_flDmgY + insetY), (int)(m_flDmgY + m_flDmgTall1 - insetY), (int)(m_flDmgY + m_flDmgTall1) }; int alpha[4] = { 0.0f, 1.0f, 1.0f, 0.0f }; // see if we're high damage diff --git a/mp/src/game/client/hud_basechat.h b/mp/src/game/client/hud_basechat.h index 90de8fbf..cf5c3f1f 100644 --- a/mp/src/game/client/hud_basechat.h +++ b/mp/src/game/client/hud_basechat.h @@ -241,7 +241,7 @@ public: void MsgFunc_TextMsg(const char *pszName, int iSize, void *pbuf); virtual void Printf( int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... ); - virtual void ChatPrintf( int iPlayerIndex, int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... ); + virtual void ChatPrintf( int iPlayerIndex, int iFilter, PRINTF_FORMAT_STRING const char *fmt, ... ) FMTFUNCTION( 4, 5 ); virtual void StartMessageMode( int iMessageModeType ); virtual void StopMessageMode( void ); diff --git a/mp/src/game/client/hud_basedeathnotice.cpp b/mp/src/game/client/hud_basedeathnotice.cpp index d732bd05..c7499ac6 100644 --- a/mp/src/game/client/hud_basedeathnotice.cpp +++ b/mp/src/game/client/hud_basedeathnotice.cpp @@ -65,6 +65,7 @@ void CHudBaseDeathNotice::Init( void ) ListenForGameEvent( "teamplay_point_captured" ); ListenForGameEvent( "teamplay_capture_blocked" ); ListenForGameEvent( "teamplay_flag_event" ); + ListenForGameEvent( "rd_robot_killed" ); } //----------------------------------------------------------------------------- diff --git a/mp/src/game/client/hud_closecaption.cpp b/mp/src/game/client/hud_closecaption.cpp index f72b9fc1..c1a1fa29 100644 --- a/mp/src/game/client/hud_closecaption.cpp +++ b/mp/src/game/client/hud_closecaption.cpp @@ -844,6 +844,7 @@ CHudCloseCaption::CHudCloseCaption( const char *pElementName ) HOOK_HUD_MESSAGE( CHudCloseCaption, CloseCaption ); char uilanguage[ 64 ]; + uilanguage[0] = 0; engine->GetUILanguage( uilanguage, sizeof( uilanguage ) ); if ( !Q_stricmp( uilanguage, "english" ) ) @@ -2752,6 +2753,7 @@ void OnCaptionLanguageChanged( IConVar *pConVar, const char *pOldString, float f } char uilanguage[ 64 ]; + uilanguage[0] = 0; engine->GetUILanguage( uilanguage, sizeof( uilanguage ) ); CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption ); diff --git a/mp/src/game/client/hud_vote.cpp b/mp/src/game/client/hud_vote.cpp index 659669a0..64d3e76e 100644 --- a/mp/src/game/client/hud_vote.cpp +++ b/mp/src/game/client/hud_vote.cpp @@ -983,6 +983,12 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg ) char szTime[256]; wchar_t wszTime[256]; + bool bMinutes = ( nTime > 65 ); + if ( bMinutes ) + { + nTime /= 60; + } + const char *pszTimeString = ( bMinutes ) ? ( ( nTime < 2 ) ? "#GameUI_vote_failed_recently_min" : "#GameUI_vote_failed_recently_mins" ) : "#GameUI_vote_failed_recently"; Q_snprintf( szTime, sizeof ( szTime), "%i", nTime ); g_pVGuiLocalize->ConvertANSIToUnicode( szTime, wszTime, sizeof( wszTime ) ); @@ -1021,8 +1027,8 @@ void CHudVote::MsgFunc_CallVoteFailed( bf_read &msg ) m_pCallVoteFailed->SetControlString( "FailedReason", "#GameUI_vote_failed_map_name_required" ); break; - case VOTE_FAILED_FAILED_RECENTLY: - g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof(wszHeaderString), g_pVGuiLocalize->Find( "#GameUI_vote_failed_recently" ), 1, wszTime ); + case VOTE_FAILED_ON_COOLDOWN: + g_pVGuiLocalize->ConstructString( wszHeaderString, sizeof( wszHeaderString ), g_pVGuiLocalize->Find( pszTimeString ), 1, wszTime ); pwszHeaderString = wszHeaderString; m_pCallVoteFailed->SetDialogVariable( "FailedReason", pwszHeaderString ); break; diff --git a/mp/src/game/client/particlemgr.cpp b/mp/src/game/client/particlemgr.cpp index d62c6e73..f79d17a6 100644 --- a/mp/src/game/client/particlemgr.cpp +++ b/mp/src/game/client/particlemgr.cpp @@ -97,8 +97,8 @@ CParticleSubTextureGroup::~CParticleSubTextureGroup() CParticleSubTexture::CParticleSubTexture() { - m_tCoordMins[0] = m_tCoordMins[0] = 0; - m_tCoordMaxs[0] = m_tCoordMaxs[0] = 1; + m_tCoordMins[0] = m_tCoordMins[1] = 0; + m_tCoordMaxs[0] = m_tCoordMaxs[1] = 1; m_pGroup = &m_DefaultGroup; m_pMaterial = NULL; diff --git a/mp/src/game/client/replay/vgui/replayperformanceeditor.cpp b/mp/src/game/client/replay/vgui/replayperformanceeditor.cpp index 99178f6e..be274ccb 100644 --- a/mp/src/game/client/replay/vgui/replayperformanceeditor.cpp +++ b/mp/src/game/client/replay/vgui/replayperformanceeditor.cpp @@ -576,7 +576,7 @@ public: BaseClass::PerformLayout(); int nWidth = XRES( 140 ); - int nMargins[2] = { XRES( 5 ), YRES( 5 ) }; + int nMargins[2] = { (int)XRES( 5 ), (int)YRES( 5 ) }; int nVBuf = YRES( 0 ); int nLastY = -1; int nY = nMargins[1]; @@ -1969,7 +1969,7 @@ void CReplayPerformanceEditorPanel::PerformLayout() dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "RedLabel" ) ), dynamic_cast< CExLabel * >( m_pPlayerCellsPanel->FindChildByName( "BlueLabel" ) ) }; - int nMargins[2] = { XRES( 5 ), YRES( 2 ) }; + int nMargins[2] = { (int)XRES( 5 ), (int)YRES( 2 ) }; for ( int i = 0; i < 2; ++i ) { pRedBlueLabels[i]->SizeToContents(); diff --git a/mp/src/game/client/vgui_fpspanel.cpp b/mp/src/game/client/vgui_fpspanel.cpp index aec28add..a1e88875 100644 --- a/mp/src/game/client/vgui_fpspanel.cpp +++ b/mp/src/game/client/vgui_fpspanel.cpp @@ -18,6 +18,7 @@ #include "filesystem.h" #include "../common/xbox/xboxstubs.h" #include "steam/steam_api.h" +#include "tier0/cpumonitoring.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -209,6 +210,28 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] ) } //----------------------------------------------------------------------------- +// Purpose: Set the color appropriately based on the CPU's frequency percentage +//----------------------------------------------------------------------------- +void GetCPUColor( float cpuPercentage, unsigned char ucColor[3] ) +{ + // These colors are for poor CPU performance + ucColor[0] = 255; ucColor[1] = 0; ucColor[2] = 0; + + if ( cpuPercentage >= kCPUMonitoringWarning1 ) + { + // Excellent CPU performance + ucColor[0] = 10; + ucColor[1] = 200; + } + else if ( cpuPercentage >= kCPUMonitoringWarning2 ) + { + // Medium CPU performance + ucColor[0] = 220; + ucColor[1] = 220; + } +} + +//----------------------------------------------------------------------------- // Purpose: // Input : //----------------------------------------------------------------------------- @@ -272,6 +295,17 @@ void CFPSPanel::Paint() GetFPSColor( nFps, ucColor ); g_pMatSystemSurface->DrawColoredText( m_hFont, x, 2, ucColor[0], ucColor[1], ucColor[2], 255, "%3i fps on %s", nFps, engine->GetLevelName() ); } + + const CPUFrequencyResults frequency = GetCPUFrequencyResults(); + double currentTime = Plat_FloatTime(); + const double displayTime = 5.0f; // Display frequency results for this long. + if ( frequency.m_GHz > 0 && frequency.m_timeStamp + displayTime > currentTime ) + { + int lineHeight = vgui::surface()->GetFontTall( m_hFont ); + // Optionally print out the CPU frequency monitoring data. + GetCPUColor( frequency.m_percentage, ucColor ); + g_pMatSystemSurface->DrawColoredText( m_hFont, x, lineHeight + 2, ucColor[0], ucColor[1], ucColor[2], 255, "CPU frequency percent: %3.1f%% Min percent: %3.1f%%", frequency.m_percentage, frequency.m_lowestPercentage ); + } } } m_lastRealTime = gpGlobals->realtime; diff --git a/mp/src/game/client/vgui_netgraphpanel.cpp b/mp/src/game/client/vgui_netgraphpanel.cpp index d3837c03..0f601438 100644 --- a/mp/src/game/client/vgui_netgraphpanel.cpp +++ b/mp/src/game/client/vgui_netgraphpanel.cpp @@ -20,6 +20,7 @@ #include <vgui/IScheme.h> #include <vgui/ILocalize.h> #include "tier0/vprof.h" +#include "tier0/cpumonitoring.h" #include "cdll_bounded_cvars.h" #include "materialsystem/imaterialsystem.h" @@ -761,7 +762,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban Q_snprintf( sz, sizeof( sz ), "lerp: %5.1f ms", GetClientInterpAmount() * 1000.0f ); - int interpcolor[ 3 ] = { GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE }; + int interpcolor[ 3 ] = { (int)GRAPH_RED, (int)GRAPH_GREEN, (int)GRAPH_BLUE }; float flInterp = GetClientInterpAmount(); if ( flInterp > 0.001f ) { @@ -817,7 +818,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban { Q_snprintf( sz, sizeof( sz ), "sv : %5.1f var: %4.2f msec", m_flServerFramerate, m_flServerFramerateStdDeviation * 1000.0f ); - int servercolor[ 3 ] = { GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE }; + int servercolor[ 3 ] = { (int)GRAPH_RED, (int)GRAPH_GREEN, (int)GRAPH_BLUE }; if ( m_flServerFramerate < 10.0f ) { @@ -876,6 +877,35 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 128, 255, "voice" ); y -= textTall; } + else + { + const CPUFrequencyResults frequency = GetCPUFrequencyResults(); + double currentTime = Plat_FloatTime(); + const double displayTime = 5.0f; // Display frequency results for this long. + if ( frequency.m_GHz > 0 && frequency.m_timeStamp + displayTime > currentTime ) + { + // Optionally print out the CPU frequency monitoring data. + uint8 cpuColor[4] = { (uint8)GRAPH_RED, (uint8)GRAPH_GREEN, (uint8)GRAPH_BLUE, 255 }; + + if ( frequency.m_percentage < kCPUMonitoringWarning2 ) + { + cpuColor[0] = 255; + cpuColor[1] = 31; + cpuColor[2] = 31; + } + else if ( frequency.m_percentage < kCPUMonitoringWarning1 ) + { + cpuColor[0] = 255; + cpuColor[1] = 125; + cpuColor[2] = 31; + } + // Experimental fading out as data becomes stale. Probably too distracting. + //float age = currentTime - frequency.m_timeStamp; + //cpuColor.a *= ( displayTime - age ) / displayTime; + g_pMatSystemSurface->DrawColoredText( font, x, y, cpuColor[0], cpuColor[1], cpuColor[2], cpuColor[3], + "CPU freq: %3.1f%% Min: %3.1f%%", frequency.m_percentage, frequency.m_lowestPercentage ); + } + } } //----------------------------------------------------------------------------- diff --git a/mp/src/game/client/vgui_schemevisualizer.cpp b/mp/src/game/client/vgui_schemevisualizer.cpp index 12070f29..b2a6f774 100644 --- a/mp/src/game/client/vgui_schemevisualizer.cpp +++ b/mp/src/game/client/vgui_schemevisualizer.cpp @@ -177,7 +177,7 @@ void CSchemeVisualizer::AddBordersToList() void CSchemeVisualizer::AddFontsToList() { #ifdef POSIX - const char strOAccent[] = { 0xc3, 0x93, 0x00 }; // UTF-8 for U+00D3 (LATIN CAPITAL LETTER O WITH ACUTE) + const char strOAccent[] = { (char)0xc3, (char)0x93, 0x00 }; // UTF-8 for U+00D3 (LATIN CAPITAL LETTER O WITH ACUTE) #else const uint8 strOAccent[] = { 0xd3, 0x00 }; #endif diff --git a/mp/src/game/client/viewrender.cpp b/mp/src/game/client/viewrender.cpp index a629071b..67a8307c 100644 --- a/mp/src/game/client/viewrender.cpp +++ b/mp/src/game/client/viewrender.cpp @@ -1435,8 +1435,8 @@ static void GetFogColorTransition( fogparams_t *pFogParams, float *pColorPrimary { float flPercent = 1.0f - (( pFogParams->lerptime - gpGlobals->curtime ) / pFogParams->duration ); - float flPrimaryColorLerp[3] = { pFogParams->colorPrimaryLerpTo.GetR(), pFogParams->colorPrimaryLerpTo.GetG(), pFogParams->colorPrimaryLerpTo.GetB() }; - float flSecondaryColorLerp[3] = { pFogParams->colorSecondaryLerpTo.GetR(), pFogParams->colorSecondaryLerpTo.GetG(), pFogParams->colorSecondaryLerpTo.GetB() }; + float flPrimaryColorLerp[3] = { (float)pFogParams->colorPrimaryLerpTo.GetR(), (float)pFogParams->colorPrimaryLerpTo.GetG(), (float)pFogParams->colorPrimaryLerpTo.GetB() }; + float flSecondaryColorLerp[3] = { (float)pFogParams->colorSecondaryLerpTo.GetR(), (float)pFogParams->colorSecondaryLerpTo.GetG(), (float)pFogParams->colorSecondaryLerpTo.GetB() }; CheckAndTransitionColor( flPercent, pColorPrimary, flPrimaryColorLerp ); CheckAndTransitionColor( flPercent, pColorSecondary, flSecondaryColorLerp ); @@ -1459,8 +1459,8 @@ static void GetFogColor( fogparams_t *pFogParams, float *pColor ) } else { - float flPrimaryColor[3] = { pFogParams->colorPrimary.GetR(), pFogParams->colorPrimary.GetG(), pFogParams->colorPrimary.GetB() }; - float flSecondaryColor[3] = { pFogParams->colorSecondary.GetR(), pFogParams->colorSecondary.GetG(), pFogParams->colorSecondary.GetB() }; + float flPrimaryColor[3] = { (float)pFogParams->colorPrimary.GetR(), (float)pFogParams->colorPrimary.GetG(), (float)pFogParams->colorPrimary.GetB() }; + float flSecondaryColor[3] = { (float)pFogParams->colorSecondary.GetR(), (float)pFogParams->colorSecondary.GetG(), (float)pFogParams->colorSecondary.GetB() }; GetFogColorTransition( pFogParams, flPrimaryColor, flSecondaryColor ); |