1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 12:06:07 +08:00

Sync with latest source-sdk-2013.

This commit is contained in:
Nicholas Hastings
2014-10-30 12:30:57 -04:00
parent 6abc7fddca
commit aa5841f220
407 changed files with 6784 additions and 10498 deletions

View File

@ -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] );
}
}

View File

@ -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;