aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/shared
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2014-05-15 13:59:18 -0700
committerJoe Ludwig <[email protected]>2014-05-15 13:59:18 -0700
commit53e78c503e6e9c7d15e2eefc480755fe37dd7077 (patch)
treec8cc106eb4c0a2b2b5d79f534f2facb0514f5f55 /mp/src/game/shared
parentAdded many shader source files (diff)
downloadsource-sdk-2013-53e78c503e6e9c7d15e2eefc480755fe37dd7077.tar.xz
source-sdk-2013-53e78c503e6e9c7d15e2eefc480755fe37dd7077.zip
General:
* Upgraded Steamworks SDK to v1.29 * Fixed mod compatibility problem with Multiplayer Base that was introduced in September. * In Hammer, while using the Vertex Tool, pressing CTRL+B will snap selected vertices to the grid. Virtual Reality: * Mods that support virtual reality now need to have a line in gameinfo.txt that says “supportsvr 1”. This indicates to gameui and engine that certain UI should be enabled. * VR-enabled mods will now start up in VR mode when launched from Steam’s VR mode. Windows: * Upgraded to Visual Studio 2013. If you need to build projects for VS 2010, add /2010 to your VPC command line. OSX: * Upgraded to XCode 5.
Diffstat (limited to 'mp/src/game/shared')
-rw-r--r--mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp64
-rw-r--r--mp/src/game/shared/Multiplayer/multiplayer_animstate.h1
-rw-r--r--mp/src/game/shared/base_playeranimstate.cpp2
-rw-r--r--mp/src/game/shared/baseachievement.cpp17
-rw-r--r--mp/src/game/shared/baseachievement.h3
-rw-r--r--mp/src/game/shared/multiplay_gamerules.cpp4
-rw-r--r--mp/src/game/shared/particle_parse.cpp2
-rw-r--r--mp/src/game/shared/particle_property.cpp37
8 files changed, 102 insertions, 28 deletions
diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp
index 975eec17..4d1ad4fe 100644
--- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp
+++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp
@@ -358,16 +358,21 @@ void CMultiPlayerAnimState::PlayFlinchGesture( Activity iActivity )
//-----------------------------------------------------------------------------
bool CMultiPlayerAnimState::InitGestureSlots( void )
{
- // Get the base player.
- CBasePlayer *pPlayer = GetBasePlayer();
- if( pPlayer )
+ // Setup the number of gesture slots.
+ m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT );
+
+ // Assign all of the the CAnimationLayer pointers to null early in case we bail.
+ for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture )
{
- // Set the number of animation overlays we will use.
- pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT );
+ m_aGestureSlots[iGesture].m_pAnimLayer = NULL;
}
- // Setup the number of gesture slots.
- m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT );
+ // Get the base player.
+ CBasePlayer *pPlayer = GetBasePlayer();
+
+ // Set the number of animation overlays we will use.
+ pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT );
+
for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture )
{
m_aGestureSlots[iGesture].m_pAnimLayer = pPlayer->GetAnimOverlay( iGesture );
@@ -409,6 +414,9 @@ void CMultiPlayerAnimState::ResetGestureSlot( int iGestureSlot )
// Sanity Check
Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT );
+ if ( !VerifyAnimLayerInSlot( iGestureSlot ) )
+ return;
+
GestureSlot_t *pGestureSlot = &m_aGestureSlots[iGestureSlot];
if ( pGestureSlot )
{
@@ -486,6 +494,36 @@ bool CMultiPlayerAnimState::IsGestureSlotActive( int iGestureSlot )
return m_aGestureSlots[iGestureSlot].m_bActive;
}
+
+//-----------------------------------------------------------------------------
+// Purpose: Track down a crash
+//-----------------------------------------------------------------------------
+bool CMultiPlayerAnimState::VerifyAnimLayerInSlot( int iGestureSlot )
+{
+ if ( iGestureSlot < 0 || iGestureSlot >= GESTURE_SLOT_COUNT )
+ {
+ return false;
+ }
+
+ if ( GetBasePlayer()->GetNumAnimOverlays() < iGestureSlot + 1 )
+ {
+ AssertMsg2( false, "Player %d doesn't have gesture slot %d any more.", GetBasePlayer()->entindex(), iGestureSlot );
+ Msg( "Player %d doesn't have gesture slot %d any more.\n", GetBasePlayer()->entindex(), iGestureSlot );
+ m_aGestureSlots[iGestureSlot].m_pAnimLayer = NULL;
+ return false;
+ }
+
+ CAnimationLayer *pExpected = GetBasePlayer()->GetAnimOverlay( iGestureSlot );
+ if ( m_aGestureSlots[iGestureSlot].m_pAnimLayer != pExpected )
+ {
+ AssertMsg3( false, "Gesture slot %d pointing to wrong address %p. Updating to new address %p.", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected );
+ Msg( "Gesture slot %d pointing to wrong address %p. Updating to new address %p.\n", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected );
+ m_aGestureSlots[iGestureSlot].m_pAnimLayer = pExpected;
+ }
+
+ return true;
+}
+
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@@ -509,6 +547,9 @@ void CMultiPlayerAnimState::RestartGesture( int iGestureSlot, Activity iGestureA
// Sanity Check
Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT );
+ if ( !VerifyAnimLayerInSlot( iGestureSlot ) )
+ return;
+
if ( !IsGestureSlotPlaying( iGestureSlot, iGestureActivity ) )
{
#ifdef CLIENT_DLL
@@ -549,6 +590,9 @@ void CMultiPlayerAnimState::AddToGestureSlot( int iGestureSlot, Activity iGestur
if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer )
return;
+ if ( !VerifyAnimLayerInSlot( iGestureSlot ) )
+ return;
+
// Get the sequence.
int iGestureSequence = pPlayer->SelectWeightedSequence( iGestureActivity );
if ( iGestureSequence <= 0 )
@@ -623,6 +667,9 @@ void CMultiPlayerAnimState::AddVCDSequenceToGestureSlot( int iGestureSlot, int i
if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer )
return;
+ if ( !VerifyAnimLayerInSlot( iGestureSlot ) )
+ return;
+
// Set the activity.
Activity iGestureActivity = ACT_MP_VCD;
@@ -1154,6 +1201,9 @@ void CMultiPlayerAnimState::ComputeGestureSequence( CStudioHdr *pStudioHdr )
if ( !m_aGestureSlots[iGesture].m_bActive )
continue;
+ if ( !VerifyAnimLayerInSlot( iGesture ) )
+ continue;
+
UpdateGestureLayer( pStudioHdr, &m_aGestureSlots[iGesture] );
}
}
diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h
index 5407e4bd..007533a1 100644
--- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h
+++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h
@@ -200,6 +200,7 @@ public:
void AddVCDSequenceToGestureSlot( int iGestureSlot, int iGestureSequence, float flCycle = 0.0f, bool bAutoKill = true );
CAnimationLayer* GetGestureSlotLayer( int iGestureSlot );
bool IsGestureSlotActive( int iGestureSlot );
+ bool VerifyAnimLayerInSlot( int iGestureSlot );
// Feet.
bool m_bForceAimYaw;
diff --git a/mp/src/game/shared/base_playeranimstate.cpp b/mp/src/game/shared/base_playeranimstate.cpp
index a25d773c..d90655ac 100644
--- a/mp/src/game/shared/base_playeranimstate.cpp
+++ b/mp/src/game/shared/base_playeranimstate.cpp
@@ -65,7 +65,7 @@ CBasePlayerAnimState::CBasePlayerAnimState()
m_flEyePitch = 0.0f;
m_bCurrentFeetYawInitialized = false;
m_flCurrentTorsoYaw = 0.0f;
- m_flCurrentTorsoYaw = TURN_NONE;
+ m_nTurningInPlace = TURN_NONE;
m_flMaxGroundSpeed = 0.0f;
m_flStoredCycle = 0.0f;
diff --git a/mp/src/game/shared/baseachievement.cpp b/mp/src/game/shared/baseachievement.cpp
index 494133c1..ebc5876e 100644
--- a/mp/src/game/shared/baseachievement.cpp
+++ b/mp/src/game/shared/baseachievement.cpp
@@ -427,13 +427,7 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber )
// new component, set the bit and increment the count
SetComponentBits( m_iComponentBits | iBitMask );
- Assert( m_iCount <= m_iGoal );
- if ( m_iCount == m_iGoal )
- {
- // all components found, award the achievement (and save state)
- AwardAchievement();
- }
- else
+ if ( m_iCount != m_iGoal )
{
// save our state at the next good opportunity
m_pAchievementMgr->SetDirty( true );
@@ -453,6 +447,15 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber )
Msg( "Component %d for achievement %s found, but already had that component\n", iBitNumber, GetName() );
}
}
+
+ // Check to see if we've achieved our goal even if the bit is already set
+ // (this fixes some older achievements that are stuck in the 9/9 state and could never be evaluated)
+ Assert( m_iCount <= m_iGoal );
+ if ( m_iCount == m_iGoal )
+ {
+ // all components found, award the achievement (and save state)
+ AwardAchievement();
+ }
}
//-----------------------------------------------------------------------------
diff --git a/mp/src/game/shared/baseachievement.h b/mp/src/game/shared/baseachievement.h
index 893055a3..2074f81d 100644
--- a/mp/src/game/shared/baseachievement.h
+++ b/mp/src/game/shared/baseachievement.h
@@ -105,6 +105,9 @@ public:
virtual void Think( void ) { return; }
+ const char *GetMapNameFilter( void ){ return m_pMapNameFilter; }
+ CAchievementMgr *GetAchievementMgr( void ){ return m_pAchievementMgr; }
+
protected:
virtual void FireGameEvent( IGameEvent *event );
virtual void FireGameEvent_Internal( IGameEvent *event ) {};
diff --git a/mp/src/game/shared/multiplay_gamerules.cpp b/mp/src/game/shared/multiplay_gamerules.cpp
index 07932e92..abecba9e 100644
--- a/mp/src/game/shared/multiplay_gamerules.cpp
+++ b/mp/src/game/shared/multiplay_gamerules.cpp
@@ -857,9 +857,9 @@ ConVarRef suitcharger( "sk_suitcharger" );
{
killer_weapon_name += 7;
}
- else if ( strncmp( killer_weapon_name, "NPC_", 8 ) == 0 )
+ else if ( strncmp( killer_weapon_name, "NPC_", 4 ) == 0 )
{
- killer_weapon_name += 8;
+ killer_weapon_name += 4;
}
else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 )
{
diff --git a/mp/src/game/shared/particle_parse.cpp b/mp/src/game/shared/particle_parse.cpp
index 9d3b4245..db15685d 100644
--- a/mp/src/game/shared/particle_parse.cpp
+++ b/mp/src/game/shared/particle_parse.cpp
@@ -309,7 +309,7 @@ void DispatchParticleEffect( const char *pszParticleName, ParticleAttachment_t i
if ( ( data.m_fFlags & PARTICLE_DISPATCH_FROM_ENTITY ) != 0 &&
( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW ) )
{
- CReliableBroadcastRecipientFilter filter;
+ CBroadcastRecipientFilter filter;
DispatchEffect( "ParticleEffect", data, filter );
}
else
diff --git a/mp/src/game/shared/particle_property.cpp b/mp/src/game/shared/particle_property.cpp
index 8ddc9784..c1c44a1a 100644
--- a/mp/src/game/shared/particle_property.cpp
+++ b/mp/src/game/shared/particle_property.cpp
@@ -200,8 +200,23 @@ void CParticleProperty::AddControlPoint( int iEffectIndex, int iPoint, C_BaseEnt
ParticleEffectList_t *pEffect = &m_ParticleEffects[iEffectIndex];
Assert( pEffect->pControlPoints.Count() < MAX_PARTICLE_CONTROL_POINTS );
- int iIndex = pEffect->pControlPoints.AddToTail();
- ParticleControlPoint_t *pNewPoint = &pEffect->pControlPoints[iIndex];
+ // If the control point is already used, override it
+ ParticleControlPoint_t *pNewPoint = NULL;
+ int iIndex = iPoint;
+ FOR_EACH_VEC( pEffect->pControlPoints, i )
+ {
+ if ( pEffect->pControlPoints[i].iControlPoint == iPoint )
+ {
+ pNewPoint = &pEffect->pControlPoints[i];
+ }
+ }
+
+ if ( !pNewPoint )
+ {
+ iIndex = pEffect->pControlPoints.AddToTail();
+ pNewPoint = &pEffect->pControlPoints[iIndex];
+ }
+
pNewPoint->iControlPoint = iPoint;
pNewPoint->hEntity = pEntity;
pNewPoint->iAttachType = iAttachType;
@@ -553,7 +568,7 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i
if ( pAnimating )
{
int bUseHeadOrigin = 0;
- CALL_ATTRIB_HOOK_INT_ON_OTHER( pPoint->hEntity.Get(), bUseHeadOrigin, particle_effect_use_head_origin );
+ CALL_ATTRIB_HOOK_INT_ON_OTHER( pAnimating, bUseHeadOrigin, particle_effect_use_head_origin );
if ( bUseHeadOrigin > 0 )
{
int iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "bip_head" );
@@ -565,15 +580,17 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i
iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "prp_hat" );
}
}
- if ( iBone >= 0 )
+ if ( iBone < 0 )
{
- bUsingHeadOrigin = true;
- const matrix3x4_t headBone = pAnimating->GetBone( iBone );
- MatrixVectors( headBone, &vecForward, &vecRight, &vecUp );
- MatrixPosition( headBone, vecOrigin );
-
- CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPoint->hEntity.Get(), flOffset, particle_effect_vertical_offset );
+ iBone = 0;
}
+
+ bUsingHeadOrigin = true;
+ const matrix3x4_t headBone = pAnimating->GetBone( iBone );
+ MatrixVectors( headBone, &vecForward, &vecRight, &vecUp );
+ MatrixPosition( headBone, vecOrigin );
+
+ CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pAnimating, flOffset, particle_effect_vertical_offset );
}
}
}