//----------------------------------------------------------------------------- // Purpose: // Input : actDesired - // Output : Activity //----------------------------------------------------------------------------- Activity CSDKPlayerAnimState::TranslateActivity( Activity actDesired ) { Activity translateActivity = BaseClass::TranslateActivity( actDesired ); if ( GetSDKPlayer()->GetActiveWeapon() ) { translateActivity = GetSDKPlayer()->GetActiveWeapon()->ActivityOverride( translateActivity, false ); } return translateActivity; }
bool CSDKPlayerAnimState::HandleJumping( Activity &idealActivity ) { if ( m_bJumping ) { if ( m_bFirstJumpFrame ) { m_bFirstJumpFrame = false; RestartMainSequence(); // Reset the animation. } // Don't check if he's on the ground for a sec.. sometimes the client still has the // on-ground flag set right when the message comes in. if ( gpGlobals->curtime - m_flJumpStartTime > 0.2f ) { if ( GetBasePlayer()->GetFlags() & FL_ONGROUND ) { m_bJumping = false; //GetSDKPlayer()->m_Shared.m_ePlayerAnimEvent = PLAYERANIMEVENT_NONE; RestartMainSequence(); // Reset the animation. GetSDKPlayer()->m_Shared.m_bWasJumping = true; } } } return m_bJumping; }
//----------------------------------------------------------------------------- // 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 }
void CSDKPlayerShared::ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs ) { Vector org = GetSDKPlayer()->GetAbsOrigin(); static Vector vecMin(-32, -32, 0 ); static Vector vecMax(32, 32, 72 ); VectorAdd( vecMin, org, *pVecWorldMins ); VectorAdd( vecMax, org, *pVecWorldMaxs ); }
//----------------------------------------------------------------------------- // Purpose: // Input : event - //----------------------------------------------------------------------------- void CSDKPlayerAnimState::DoAnimationEvent( PlayerAnimEvent_t event, int nData ) { Activity iGestureActivity = ACT_INVALID; switch( event ) { case PLAYERANIMEVENT_ATTACK_PRIMARY: { // Weapon primary fire. if ( m_pSDKPlayer->m_Shared.IsProne() || m_pSDKPlayer->m_Shared.IsDiveSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK_PRONE ); else if ( m_pSDKPlayer->m_Shared.IsSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK_SLIDE ); else if ( m_pSDKPlayer->m_Shared.IsRolling() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK_ROLL ); else if ( m_pSDKPlayer->m_Shared.IsDiving() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK_DIVE ); else if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK_CROUCH ); else RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_PRIMARYATTACK ); iGestureActivity = ACT_VM_PRIMARYATTACK; break; } case PLAYERANIMEVENT_VOICE_COMMAND_GESTURE: { if ( !IsGestureSlotActive( GESTURE_SLOT_ATTACK_AND_RELOAD ) ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, (Activity)nData ); } iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_ATTACK_SECONDARY: { // Weapon secondary fire. if ( m_pSDKPlayer->m_Shared.IsProne() || m_pSDKPlayer->m_Shared.IsDiveSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL_PRONE ); else if ( m_pSDKPlayer->m_Shared.IsSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL_SLIDE ); else if ( m_pSDKPlayer->m_Shared.IsRolling() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL_ROLL ); else if ( m_pSDKPlayer->m_Shared.IsDiving() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL_DIVE ); else if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL_CROUCH ); else RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_BRAWL ); iGestureActivity = ACT_VM_PRIMARYATTACK; break; } case PLAYERANIMEVENT_ATTACK_PRE: { if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) { // Weapon pre-fire. Used for minigun windup, sniper aiming start, etc in crouch. iGestureActivity = ACT_MP_ATTACK_CROUCH_PREFIRE; } else { // Weapon pre-fire. Used for minigun windup, sniper aiming start, etc. iGestureActivity = ACT_MP_ATTACK_STAND_PREFIRE; } RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, iGestureActivity, false ); iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_ATTACK_POST: { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_STAND_POSTFIRE ); iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_RELOAD: { // Weapon reload. /*//We only have standing reload-- it blends into other states if ( m_pSDKPlayer->m_Shared.IsProne() || m_pSDKPlayer->m_Shared.IsDiveSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_PRONE ); else if ( m_pSDKPlayer->m_Shared.IsSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_SLIDE ); else if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_CROUCH ); else*/ RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD ); iGestureActivity = ACT_VM_RELOAD; //Make view reload if it isn't already break; } case PLAYERANIMEVENT_RELOAD_LOOP: { // Weapon reload. /*//We only have standing reload-- it blends into other states if ( m_pSDKPlayer->m_Shared.IsProne() || m_pSDKPlayer->m_Shared.IsDiveSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_LOOP_PRONE ); else if ( m_pSDKPlayer->m_Shared.IsSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_LOOP_SLIDE ); else if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_LOOP_CROUCH ); else*/ RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_LOOP ); iGestureActivity = ACT_INVALID; //TODO: fix break; } case PLAYERANIMEVENT_RELOAD_END: { // Weapon reload. if ( m_pSDKPlayer->m_Shared.IsProne() || m_pSDKPlayer->m_Shared.IsDiveSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_END_PRONE ); else if ( m_pSDKPlayer->m_Shared.IsSliding() ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_END_SLIDE ); else if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_END_CROUCH ); else RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_RELOAD_END ); iGestureActivity = ACT_INVALID; //TODO: fix break; } #if defined ( SDK_USE_PRONE ) case PLAYERANIMEVENT_STAND_TO_PRONE: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; //m_iProneActivity = ACT_MP_STAND_TO_PRONE; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no stand->prone so just idle. } break; case PLAYERANIMEVENT_CROUCH_TO_PRONE: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; //m_iProneActivity = ACT_MP_CROUCH_TO_PRONE; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no crouch->prone so just idle. } break; case PLAYERANIMEVENT_PRONE_TO_STAND: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; m_iProneActivity = ACT_DA_PRONE_TO_STAND; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no prone->stand so just idle. } break; case PLAYERANIMEVENT_PRONE_TO_CROUCH: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; //m_iProneActivity = ACT_MP_PRONE_TO_CROUCH; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no prone->crouch so just idle. } break; #endif case PLAYERANIMEVENT_DRAW: { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_DA_DRAW ); iGestureActivity = ACT_VM_DRAW; break; } case PLAYERANIMEVENT_DIVE: { m_bDiveStart = true; m_bDiveStartFirstFrame = true; m_iDiveActivity = ACT_DA_DIVE; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; } break; case PLAYERANIMEVENT_DIVE_TO_ROLL: { m_bRollTransition = true; m_bRollTransitionFirstFrame = true; m_iRollActivity = ACT_DA_DIVEROLL; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no stand->slide so just idle. } break; case PLAYERANIMEVENT_STAND_TO_SLIDE: { m_bSlideTransition = true; m_bSlideTransitionFirstFrame = true; m_iSlideActivity = ACT_DA_SLIDESTART; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no stand->slide so just idle. } break; case PLAYERANIMEVENT_STAND_TO_ROLL: { m_bRollTransition = true; m_bRollTransitionFirstFrame = true; m_iRollActivity = ACT_DA_ROLL; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no stand->slide so just idle. } break; case PLAYERANIMEVENT_STAND_TO_VAULT: m_bRollTransition = true; m_bRollTransitionFirstFrame = true; m_iRollActivity = ACT_DA_ROLL; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; break; case PLAYERANIMEVENT_STAND_TO_WALLRUN: m_bRollTransition = true; m_bRollTransitionFirstFrame = true; m_iRollActivity = ACT_DA_ROLL; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; break; case PLAYERANIMEVENT_WALLFLIP: RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; break; case PLAYERANIMEVENT_WALLCLIMB: RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; break; case PLAYERANIMEVENT_JUMP: { // Jump. m_bJumping = true; m_bFirstJumpFrame = true; m_flJumpStartTime = m_pSDKPlayer->GetCurrentTime(); RestartMainSequence(); break; } case PLAYERANIMEVENT_CANCEL: { ResetGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD ); break; } default: { BaseClass::DoAnimationEvent( event, nData ); break; } } #ifdef CLIENT_DLL // Make the weapon play the animation as well if ( iGestureActivity != ACT_INVALID && GetSDKPlayer() != CSDKPlayer::GetLocalSDKPlayer()) { CBaseCombatWeapon *pWeapon = GetSDKPlayer()->GetActiveWeapon(); if ( pWeapon ) { //pWeapon->EnsureCorrectRenderingModel(); pWeapon->SendWeaponAnim( iGestureActivity ); // Force animation events! //pWeapon->ResetEventsParity(); // reset event parity so the animation events will occur on the weapon. pWeapon->DoAnimationEvents( pWeapon->GetModelPtr() ); } } #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 }
//----------------------------------------------------------------------------- // Purpose: // Input : event - //----------------------------------------------------------------------------- void CSDKPlayerAnimState::DoAnimationEvent( PlayerAnimEvent_t event, int nData ) { Activity iGestureActivity = ACT_INVALID; switch( event ) { case PLAYERANIMEVENT_ATTACK_PRIMARY: { // Weapon primary fire. #if defined ( SDK_USE_PRONE ) if ( m_pSDKPlayer->m_Shared.IsProne() ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_PRONE_PRIMARYFIRE ); } else #endif //SDK_USE_PRONE if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ); } else { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_STAND_PRIMARYFIRE ); } iGestureActivity = ACT_VM_PRIMARYATTACK; break; } case PLAYERANIMEVENT_VOICE_COMMAND_GESTURE: { if ( !IsGestureSlotActive( GESTURE_SLOT_ATTACK_AND_RELOAD ) ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, (Activity)nData ); } iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_ATTACK_SECONDARY: { // Weapon secondary fire. #if defined ( SDK_USE_PRONE ) if ( m_pSDKPlayer->m_Shared.IsProne() ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_PRONE_SECONDARYFIRE ); } else #endif //SDK_USE_PRONE if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_CROUCH_SECONDARYFIRE ); } else { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_STAND_SECONDARYFIRE ); } iGestureActivity = ACT_VM_PRIMARYATTACK; break; } case PLAYERANIMEVENT_ATTACK_PRE: { if ( m_pSDKPlayer->GetFlags() & FL_DUCKING ) { // Weapon pre-fire. Used for minigun windup, sniper aiming start, etc in crouch. iGestureActivity = ACT_MP_ATTACK_CROUCH_PREFIRE; } else { // Weapon pre-fire. Used for minigun windup, sniper aiming start, etc. iGestureActivity = ACT_MP_ATTACK_STAND_PREFIRE; } RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, iGestureActivity, false ); iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_ATTACK_POST: { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_ATTACK_STAND_POSTFIRE ); iGestureActivity = ACT_VM_IDLE; //TODO? break; } case PLAYERANIMEVENT_RELOAD: { // Weapon reload. #if defined ( SDK_USE_PRONE ) if ( m_pSDKPlayer->m_Shared.IsProne() ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_PRONE ); } else #endif //SDK_USE_PRONE if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_CROUCH ); } else { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_STAND ); } iGestureActivity = ACT_VM_RELOAD; //Make view reload if it isn't already break; } case PLAYERANIMEVENT_RELOAD_LOOP: { // Weapon reload. #if defined ( SDK_USE_PRONE ) if ( m_pSDKPlayer->m_Shared.IsProne() ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_PRONE_LOOP ); } else #endif //SDK_USE_PRONE if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_CROUCH_LOOP ); } else { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_STAND_LOOP ); } iGestureActivity = ACT_INVALID; //TODO: fix break; } case PLAYERANIMEVENT_RELOAD_END: { // Weapon reload. #if defined ( SDK_USE_PRONE ) if ( m_pSDKPlayer->m_Shared.IsProne() ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_PRONE_END ); } else #endif //SDK_USE_PRONE if ( GetBasePlayer()->GetFlags() & FL_DUCKING ) { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_CROUCH_END ); } else { RestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MP_RELOAD_STAND_END ); } iGestureActivity = ACT_INVALID; //TODO: fix break; } #if defined ( SDK_USE_PRONE ) case PLAYERANIMEVENT_STAND_TO_PRONE: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; m_iProneActivity = ACT_MP_STAND_TO_PRONE; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no stand->prone so just idle. } break; case PLAYERANIMEVENT_CROUCH_TO_PRONE: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; m_iProneActivity = ACT_MP_CROUCH_TO_PRONE; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no crouch->prone so just idle. } break; case PLAYERANIMEVENT_PRONE_TO_STAND: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; m_iProneActivity = ACT_MP_PRONE_TO_STAND; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no prone->stand so just idle. } break; case PLAYERANIMEVENT_PRONE_TO_CROUCH: { m_bProneTransition = true; m_bProneTransitionFirstFrame = true; m_iProneActivity = ACT_MP_PRONE_TO_CROUCH; RestartMainSequence(); iGestureActivity = ACT_VM_IDLE; //Clear for weapon, we have no prone->crouch so just idle. } break; #endif default: { BaseClass::DoAnimationEvent( event, nData ); break; } } #ifdef CLIENT_DLL // Make the weapon play the animation as well if ( iGestureActivity != ACT_INVALID && GetSDKPlayer() != CSDKPlayer::GetLocalSDKPlayer()) { CBaseCombatWeapon *pWeapon = GetSDKPlayer()->GetActiveWeapon(); if ( pWeapon ) { pWeapon->EnsureCorrectRenderingModel(); pWeapon->SendWeaponAnim( iGestureActivity ); // Force animation events! // pWeapon->ResetEventsParity(); // reset event parity so the animation events will occur on the weapon. pWeapon->DoAnimationEvents( pWeapon->GetModelPtr() ); } } #endif }
//----------------------------------------------------------------------------- // Purpose: // Input : event - //----------------------------------------------------------------------------- void CSDKPlayerAnimState::DoAnimationEvent(PlayerAnimEvent_t event) { bool resetShotCharging = false; switch(event) { case PLAYERANIMEVENT_BLANK: { GetSDKPlayer()->ResetShotCharging(); return; // This is a dummy event, so don't do anything and return early } case PLAYERANIMEVENT_NONE: { resetShotCharging = true; //GetSDKPlayer()->RemoveFlag(FL_FREECAM | FL_KEEPER_SIDEWAYS_DIVING | FL_SLIDING); break; } case PLAYERANIMEVENT_CANCEL: { resetShotCharging = true; //GetSDKPlayer()->RemoveFlag(FL_FREECAM | FL_KEEPER_SIDEWAYS_DIVING | FL_SLIDING); ClearAnimationState(); break; } case PLAYERANIMEVENT_KICK: case PLAYERANIMEVENT_PASS: case PLAYERANIMEVENT_PASS_STATIONARY: case PLAYERANIMEVENT_VOLLEY: case PLAYERANIMEVENT_HEELKICK: case PLAYERANIMEVENT_HEADER: case PLAYERANIMEVENT_HEADER_STATIONARY: case PLAYERANIMEVENT_THROWIN: case PLAYERANIMEVENT_THROW: case PLAYERANIMEVENT_KEEPER_HANDS_THROW: case PLAYERANIMEVENT_KEEPER_HANDS_KICK: case PLAYERANIMEVENT_KEEPER_HANDS_PUNCH: case PLAYERANIMEVENT_DIVINGHEADER: { resetShotCharging = true; } case PLAYERANIMEVENT_SLIDE: case PLAYERANIMEVENT_TACKLED_FORWARD: case PLAYERANIMEVENT_TACKLED_BACKWARD: case PLAYERANIMEVENT_KEEPER_DIVE_LEFT: case PLAYERANIMEVENT_KEEPER_DIVE_RIGHT: case PLAYERANIMEVENT_KEEPER_DIVE_FORWARD: case PLAYERANIMEVENT_KEEPER_DIVE_BACKWARD: case PLAYERANIMEVENT_LIFT_UP: case PLAYERANIMEVENT_BALL_ROLL_LEFT: case PLAYERANIMEVENT_BALL_ROLL_RIGHT: case PLAYERANIMEVENT_FAKE_SHOT: case PLAYERANIMEVENT_RAINBOW_FLICK: case PLAYERANIMEVENT_BICYCLE_KICK: { // HACKHACK: Side effects? //if (GetSDKPlayer()->m_Shared.GetAnimEvent() == PLAYERANIMEVENT_SLIDE) //{ // return; //} m_flPrimaryActionSequenceCycle = 0; m_iPrimaryActionSequence = CalcPrimaryActionSequence( event ); m_bIsPrimaryActionSequenceActive = m_iPrimaryActionSequence != -1; break; } case PLAYERANIMEVENT_JUMP: case PLAYERANIMEVENT_KEEPER_JUMP: { // Play the jump animation. if (!m_bJumping) { m_bJumping = true; m_bFirstJumpFrame = true; m_flJumpStartTime = gpGlobals->curtime; } break; } case PLAYERANIMEVENT_CARRY: { m_iSecondaryActionSequence = CalcSecondaryActionSequence(); //add keeper carry as layer if ( m_iSecondaryActionSequence != -1 ) { m_bIsSecondaryActionSequenceActive = true; m_flSecondaryActionSequenceCycle = 0; m_bCarryHold = true; } break; } case PLAYERANIMEVENT_CARRY_END: { //GetSDKPlayer()->RemoveFlag(FL_FREECAM); m_iSecondaryActionSequence = CalcSecondaryActionSequence(); if ( m_iSecondaryActionSequence != -1 ) { m_bIsSecondaryActionSequenceActive = true; m_flSecondaryActionSequenceCycle = 1.1f; m_bCarryHold = false; } break; } } if (resetShotCharging) GetSDKPlayer()->ResetShotCharging(); switch (event) { case PLAYERANIMEVENT_DIVINGHEADER: case PLAYERANIMEVENT_TACKLED_FORWARD: case PLAYERANIMEVENT_TACKLED_BACKWARD: GetSDKPlayer()->AddFlag(FL_FREECAM); break; case PLAYERANIMEVENT_CARRY: case PLAYERANIMEVENT_SLIDE: case PLAYERANIMEVENT_KEEPER_DIVE_LEFT: case PLAYERANIMEVENT_KEEPER_DIVE_RIGHT: case PLAYERANIMEVENT_KEEPER_DIVE_FORWARD: case PLAYERANIMEVENT_KEEPER_DIVE_BACKWARD: break; default: GetSDKPlayer()->RemoveFlag(FL_FREECAM); break; } if (event != PLAYERANIMEVENT_CARRY && event != PLAYERANIMEVENT_CARRY_END) { GetSDKPlayer()->m_Shared.SetAnimEvent(event); } //GetSDKPlayer()->RemoveFlag(FL_KEEPER_SIDEWAYS_DIVING | FL_SLIDING); //switch(event) //{ //case PLAYERANIMEVENT_KEEPER_DIVE_LEFT: //case PLAYERANIMEVENT_KEEPER_DIVE_RIGHT: // //TODO: Uncomment once the getting stuck problem is fixed // //GetSDKPlayer()->AddFlag(FL_KEEPER_SIDEWAYS_DIVING); // break; //case PLAYERANIMEVENT_KEEPER_DIVE_FORWARD: //case PLAYERANIMEVENT_KEEPER_DIVE_BACKWARD: //case PLAYERANIMEVENT_SLIDE: // //TODO: Uncomment once the getting stuck problem is fixed // //GetSDKPlayer()->AddFlag(FL_SLIDING); // break; //} //GetSDKPlayer()->m_Shared.SetAnimEvent(event); }
int CSDKPlayerAnimState::SelectWeightedSequence( Activity activity ) { return GetSDKPlayer()->SelectWeightedSequence( activity ); }