//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSDKPlayerAnimState::Update( float eyeYaw, float eyePitch ) { // Profile the animation update. VPROF( "CMultiPlayerAnimState::Update" ); // Clear animation overlays because we're about to completely reconstruct them. ClearAnimationLayers(); // Some mods don't want to update the player's animation state if they're dead and ragdolled. if ( !ShouldUpdateAnimState() ) { ClearAnimationState(); return; } // Get the SDK player. CSDKPlayer *pSDKPlayer = GetSDKPlayer(); if ( !pSDKPlayer ) return; // Get the studio header for the player. CStudioHdr *pStudioHdr = pSDKPlayer->GetModelPtr(); if ( !pStudioHdr ) return; // Check to see if we should be updating the animation state - dead, ragdolled? if ( !ShouldUpdateAnimState() ) { ClearAnimationState(); return; } // Store the eye angles. m_flEyeYaw = AngleNormalize( eyeYaw ); m_flEyePitch = AngleNormalize( eyePitch ); // Compute the player sequences. ComputeSequences( pStudioHdr ); if ( SetupPoseParameters( pStudioHdr ) ) { // Pose parameter - what direction are the player's legs running in. ComputePoseParam_MoveYaw( pStudioHdr ); // Pose parameter - Torso aiming (up/down). ComputePoseParam_AimPitch( pStudioHdr ); // Pose parameter - Torso aiming (rotation). ComputePoseParam_AimYaw( pStudioHdr ); } #ifdef CLIENT_DLL if ( C_BasePlayer::ShouldDrawLocalPlayer() ) { m_pSDKPlayer->SetPlaybackRate( 1.0f ); } #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CHL2MPPlayerAnimState::Update( float eyeYaw, float eyePitch ) { // Profile the animation update. VPROF( "CHL2MPPlayerAnimState::Update" ); // Get the HL2MP player. CHL2MP_Player *pHL2MPPlayer = GetHL2MPPlayer(); if ( !pHL2MPPlayer ) return; // Get the studio header for the player. CStudioHdr *pStudioHdr = pHL2MPPlayer->GetModelPtr(); if ( !pStudioHdr ) return; // Check to see if we should be updating the animation state - dead, ragdolled? if ( !ShouldUpdateAnimState() ) { ClearAnimationState(); return; } // Store the eye angles. m_flEyeYaw = AngleNormalize( eyeYaw ); m_flEyePitch = AngleNormalize( eyePitch ); // Compute the player sequences. ComputeSequences( pStudioHdr ); if ( SetupPoseParameters( pStudioHdr ) ) { // Pose parameter - what direction are the player's legs running in. ComputePoseParam_MoveYaw( pStudioHdr ); // Pose parameter - Torso aiming (up/down). ComputePoseParam_AimPitch( pStudioHdr ); // Pose parameter - Torso aiming (rotation). ComputePoseParam_AimYaw( pStudioHdr ); } #ifdef CLIENT_DLL if ( C_BasePlayer::ShouldDrawLocalPlayer() ) { m_pHL2MPPlayer->SetPlaybackRate( 1.0f ); } #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPlayerAnimState::Update( float eyeYaw, float eyePitch ) { // Store these. All the calculations are based on them. m_flEyeYaw = eyeYaw; m_flEyePitch = eyePitch; // Start out facing the entity towards the eye direction. m_angRender[YAW] = m_flEyeYaw; m_angRender[PITCH] = m_angRender[ROLL] = 0; ComputePoseParam_MoveYaw(); ComputePoseParam_BodyPitch(); ComputePoseParam_BodyYaw(); ComputePlaybackRate(); }
void CBasePlayerAnimState::Update( float eyeYaw, float eyePitch ) { VPROF( "CBasePlayerAnimState::Update" ); // Clear animation overlays because we're about to completely reconstruct them. ClearAnimationLayers(); // Some mods don't want to update the player's animation state if they're dead and ragdolled. if ( !ShouldUpdateAnimState() ) { ClearAnimationState(); return; } CStudioHdr *pStudioHdr = GetOuter()->GetModelPtr(); // Store these. All the calculations are based on them. m_flEyeYaw = AngleNormalize( eyeYaw ); m_flEyePitch = AngleNormalize( eyePitch ); // Compute sequences for all the layers. ComputeSequences( pStudioHdr ); // Compute all the pose params. ComputePoseParam_BodyPitch( pStudioHdr ); // Look up/down. ComputePoseParam_BodyYaw(); // Torso rotation. ComputePoseParam_MoveYaw( pStudioHdr ); // What direction his legs are running in. ComputePlaybackRate(); #ifdef CLIENT_DLL if ( cl_showanimstate.GetInt() == m_pOuter->entindex() ) { DebugShowAnimStateFull( 5 ); } else if ( cl_showanimstate.GetInt() == -2 ) { C_BasePlayer *targetPlayer = C_BasePlayer::GetLocalPlayer(); if( targetPlayer && ( targetPlayer->GetObserverMode() == OBS_MODE_IN_EYE || targetPlayer->GetObserverMode() == OBS_MODE_CHASE ) ) { C_BaseEntity *target = targetPlayer->GetObserverTarget(); if( target && target->IsPlayer() ) { targetPlayer = ToBasePlayer( target ); } } if ( m_pOuter == targetPlayer ) { DebugShowAnimStateFull( 6 ); } } #else if ( sv_showanimstate.GetInt() == m_pOuter->entindex() ) { DebugShowAnimState( 20 ); } #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSDKPlayerAnimState::Update( float eyeYaw, float eyePitch, float flCharacterYaw, float flCharacterPitch ) { // Profile the animation update. VPROF( "CMultiPlayerAnimState::Update" ); // Get the SDK player. CSDKPlayer *pSDKPlayer = GetSDKPlayer(); if ( !pSDKPlayer ) return; // Get the studio header for the player. CStudioHdr *pStudioHdr = pSDKPlayer->GetModelPtr(); if ( !pStudioHdr ) return; // Check to see if we should be updating the animation state - dead, ragdolled? if ( !ShouldUpdateAnimState() ) { ClearAnimationState(); return; } // Store the eye angles. m_flEyeYaw = AngleNormalize( eyeYaw ); m_flEyePitch = AngleNormalize( eyePitch ); float flRampSpeed = 20; if (pSDKPlayer->GetActiveSDKWeapon() && pSDKPlayer->GetActiveSDKWeapon()->HasAimInSpeedPenalty()) flRampSpeed = 50; float flApproachSpeed = gpGlobals->frametime * pSDKPlayer->GetSlowMoMultiplier() * RemapVal(m_pSDKPlayer->m_Shared.GetAimIn(), 0, 1, 10, flRampSpeed); float flYawDifference = AngleNormalize( flCharacterYaw - m_flCharacterEyeYaw ); float flYawApproachSpeed = flYawDifference * flApproachSpeed; if (fabs(flYawApproachSpeed) < fabs(flYawDifference)) m_flCharacterEyeYaw += flYawApproachSpeed; else m_flCharacterEyeYaw = flCharacterYaw; float flPitchDifference = AngleNormalize( flCharacterPitch - m_flCharacterEyePitch ); float flPitchApproachSpeed = flPitchDifference * flApproachSpeed; if (fabs(flPitchApproachSpeed) < fabs(flPitchDifference)) m_flCharacterEyePitch += flPitchApproachSpeed; else m_flCharacterEyePitch = flCharacterPitch; // Compute the player sequences. ComputeSequences( pStudioHdr ); if ( SetupPoseParameters( pStudioHdr ) ) { // Pose parameter - what direction are the player's legs running in. ComputePoseParam_MoveYaw( pStudioHdr ); ComputePoseParam_StuntYaw( pStudioHdr ); // Pose parameter - Torso aiming (up/down). ComputePoseParam_AimPitch( pStudioHdr ); // Pose parameter - Torso aiming (rotation). ComputePoseParam_AimYaw( pStudioHdr ); } #ifdef CLIENT_DLL if ( C_BasePlayer::ShouldDrawLocalPlayer() ) { m_pSDKPlayer->SetPlaybackRate( 1.0f ); } #endif }