mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 06:07:56 +03:00
Added new player animation types and applied more player animations to SP HL2 weapons
This commit is contained in:
parent
6755a4d3f6
commit
41d799bbdf
@ -394,6 +394,10 @@ void CHLSelectFireMachineGun::SecondaryAttack( void )
|
||||
{
|
||||
m_iSecondaryAttacks++;
|
||||
gamestats->Event_WeaponFired( pOwner, false, GetClassname() );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_ATTACK2 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,6 +621,10 @@ BEGIN_ENT_SCRIPTDESC( CHL2_Player, CBasePlayer, "The HL2 player entity." )
|
||||
DEFINE_SCRIPTFUNC( RemoveCustomSuitDevice, "Removes a custom suit device ID. (1-3)" )
|
||||
DEFINE_SCRIPTFUNC( IsCustomSuitDeviceActive, "Checks if a custom suit device is active." )
|
||||
|
||||
#ifdef SP_ANIM_STATE
|
||||
DEFINE_SCRIPTFUNC( AddAnimStateLayer, "Adds a custom sequence index as a misc. layer for the singleplayer anim state, wtih parameters for blending in/out, setting the playback rate, holding the animation at the end, and only playing when the player is still." )
|
||||
#endif
|
||||
|
||||
END_SCRIPTDESC();
|
||||
#endif
|
||||
|
||||
@ -1389,6 +1393,14 @@ void CHL2_Player::SetAnimation( PLAYER_ANIM playerAnim )
|
||||
|
||||
m_pPlayerAnimState->SetPlayerAnimation( playerAnim );
|
||||
}
|
||||
|
||||
void CHL2_Player::AddAnimStateLayer( int iSequence, float flBlendIn, float flBlendOut, float flPlaybackRate, bool bHoldAtEnd, bool bOnlyWhenStill )
|
||||
{
|
||||
if (!hl2_use_sp_animstate.GetBool())
|
||||
return;
|
||||
|
||||
m_pPlayerAnimState->AddMiscSequence( iSequence, flBlendIn, flBlendOut, flPlaybackRate, bHoldAtEnd, bOnlyWhenStill );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -134,6 +134,8 @@ public:
|
||||
|
||||
#ifdef SP_ANIM_STATE
|
||||
void SetAnimation( PLAYER_ANIM playerAnim );
|
||||
|
||||
void AddAnimStateLayer( int iSequence, float flBlendIn = 0.0f, float flBlendOut = 0.0f, float flPlaybackRate = 1.0f, bool bHoldAtEnd = false, bool bOnlyWhenStill = false );
|
||||
#endif
|
||||
|
||||
virtual const char *GetOverrideStepSound( const char *pszBaseStepSoundName );
|
||||
|
@ -369,6 +369,9 @@ void CWeaponAR2::SecondaryAttack( void )
|
||||
if( pPlayer )
|
||||
{
|
||||
pPlayer->RumbleEffect(RUMBLE_AR2_ALT_FIRE, 0, RUMBLE_FLAG_RESTART );
|
||||
#ifdef MAPBASE
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK2 );
|
||||
#endif
|
||||
}
|
||||
|
||||
SendWeaponAnim( ACT_VM_FIDGET );
|
||||
|
@ -448,7 +448,7 @@ void CWeaponFrag::LobGrenade( CBasePlayer *pPlayer )
|
||||
WeaponSound( WPN_DOUBLE );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK2 );
|
||||
#endif
|
||||
|
||||
m_bRedraw = true;
|
||||
@ -496,7 +496,7 @@ void CWeaponFrag::RollGrenade( CBasePlayer *pPlayer )
|
||||
WeaponSound( SPECIAL1 );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK2 );
|
||||
#endif
|
||||
|
||||
m_bRedraw = true;
|
||||
|
@ -1818,6 +1818,11 @@ void CWeaponPhysCannon::PuntNonVPhysics( CBaseEntity *pEntity, const Vector &for
|
||||
|
||||
PrimaryFireEffect();
|
||||
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
|
||||
#ifdef MAPBASE
|
||||
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
if (pPlayer)
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
m_nChangeState = ELEMENT_STATE_CLOSED;
|
||||
m_flElementDebounce = gpGlobals->curtime + 0.5f;
|
||||
@ -1968,6 +1973,10 @@ void CWeaponPhysCannon::PuntVPhysics( CBaseEntity *pEntity, const Vector &vecFor
|
||||
PrimaryFireEffect();
|
||||
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
m_nChangeState = ELEMENT_STATE_CLOSED;
|
||||
m_flElementDebounce = gpGlobals->curtime + 0.5f;
|
||||
m_flCheckSuppressTime = gpGlobals->curtime + 0.25f;
|
||||
@ -2086,6 +2095,10 @@ void CWeaponPhysCannon::PuntRagdoll( CBaseEntity *pEntity, const Vector &vecForw
|
||||
PrimaryFireEffect();
|
||||
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
m_nChangeState = ELEMENT_STATE_CLOSED;
|
||||
m_flElementDebounce = gpGlobals->curtime + 0.5f;
|
||||
m_flCheckSuppressTime = gpGlobals->curtime + 0.25f;
|
||||
@ -2191,6 +2204,9 @@ void CWeaponPhysCannon::PrimaryAttack( void )
|
||||
|
||||
PrimaryFireEffect();
|
||||
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1664,6 +1664,10 @@ void CWeaponRPG::PrimaryAttack( void )
|
||||
|
||||
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
|
||||
WeaponSound( SINGLE );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
pOwner->RumbleEffect( RUMBLE_SHOTGUN_SINGLE, 0, RUMBLE_FLAG_RESTART );
|
||||
|
||||
|
@ -612,7 +612,11 @@ void CWeaponShotgun::SecondaryAttack( void )
|
||||
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
|
||||
|
||||
// player "shoot" animation
|
||||
#ifdef MAPBASE
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK2 );
|
||||
#else
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
// Don't fire again until fire animation has completed
|
||||
#ifdef MAPBASE
|
||||
|
@ -469,7 +469,11 @@ void CWeaponSMG1::SecondaryAttack( void )
|
||||
CSoundEnt::InsertSound( SOUND_COMBAT, GetAbsOrigin(), 1000, 0.2, GetOwner(), SOUNDENT_CHANNEL_WEAPON );
|
||||
|
||||
// player "shoot" animation
|
||||
#ifdef MAPBASE
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK2 );
|
||||
#else
|
||||
pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
#endif
|
||||
|
||||
// Decrease ammo
|
||||
pPlayer->RemoveAmmo( 1, m_iSecondaryAmmoType );
|
||||
|
@ -1581,6 +1581,10 @@ bool CBaseCombatWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i
|
||||
|
||||
SetViewModel();
|
||||
SendWeaponAnim( iActivity );
|
||||
|
||||
#ifdef MAPBASE
|
||||
pOwner->SetAnimation( PLAYER_UNHOLSTER );
|
||||
#endif
|
||||
|
||||
pOwner->SetNextAttack( gpGlobals->curtime + SequenceDuration() );
|
||||
}
|
||||
@ -1652,6 +1656,11 @@ bool CBaseCombatWeapon::Holster( CBaseCombatWeapon *pSwitchingTo )
|
||||
if (pOwner)
|
||||
{
|
||||
pOwner->SetNextAttack( gpGlobals->curtime + flSequenceDuration );
|
||||
|
||||
#ifdef MAPBASE
|
||||
if (pOwner->IsPlayer())
|
||||
static_cast<CBasePlayer*>(pOwner)->SetAnimation( PLAYER_HOLSTER );
|
||||
#endif
|
||||
}
|
||||
|
||||
// If we don't have a holster anim, hide immediately to avoid timing issues
|
||||
|
@ -146,6 +146,16 @@ void CSinglePlayerAnimState::SetPlayerAnimation( PLAYER_ANIM playerAnim )
|
||||
m_bFiring = m_iFireSequence != -1;
|
||||
m_flFireCycle = 0;
|
||||
}
|
||||
else if ( playerAnim == PLAYER_ATTACK2 )
|
||||
{
|
||||
#ifdef EXPANDED_HL2DM_ACTIVITIES
|
||||
m_iFireSequence = SelectWeightedSequence( TranslateActivity( ACT_HL2MP_GESTURE_RANGE_ATTACK2 ) );
|
||||
#else
|
||||
m_iFireSequence = SelectWeightedSequence( TranslateActivity( ACT_HL2MP_GESTURE_RANGE_ATTACK ) );
|
||||
#endif
|
||||
m_bFiring = m_iFireSequence != -1;
|
||||
m_flFireCycle = 0;
|
||||
}
|
||||
else if ( playerAnim == PLAYER_JUMP )
|
||||
{
|
||||
// Play the jump animation.
|
||||
@ -168,6 +178,22 @@ void CSinglePlayerAnimState::SetPlayerAnimation( PLAYER_ANIM playerAnim )
|
||||
m_flReloadCycle = 0;
|
||||
}
|
||||
}
|
||||
else if ( playerAnim == PLAYER_UNHOLSTER || playerAnim == PLAYER_HOLSTER )
|
||||
{
|
||||
m_iWeaponSwitchSequence = SelectWeightedSequence( TranslateActivity( playerAnim == PLAYER_UNHOLSTER ? ACT_ARM : ACT_DISARM ) );
|
||||
if (m_iWeaponSwitchSequence != -1)
|
||||
{
|
||||
// clear other events that might be playing in our layer
|
||||
m_bPlayingMisc = false;
|
||||
m_bReloading = false;
|
||||
|
||||
m_bWeaponSwitching = true;
|
||||
m_flWeaponSwitchCycle = 0;
|
||||
m_flMiscBlendOut = 0.1f;
|
||||
m_flMiscBlendIn = 0.1f;
|
||||
m_bMiscNoOverride = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -226,6 +252,26 @@ void CSinglePlayerAnimState::ComputeSequences( CStudioHdr *pStudioHdr )
|
||||
ComputeWeaponSwitchSequence();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CSinglePlayerAnimState::AddMiscSequence( int iSequence, float flBlendIn, float flBlendOut, float flPlaybackRate, bool bHoldAtEnd, bool bOnlyWhenStill )
|
||||
{
|
||||
Assert( iSequence != -1 );
|
||||
|
||||
m_iMiscSequence = iSequence;
|
||||
m_flMiscBlendIn = flBlendIn;
|
||||
m_flMiscBlendOut = flBlendOut;
|
||||
|
||||
m_bPlayingMisc = true;
|
||||
m_bMiscHoldAtEnd = bHoldAtEnd;
|
||||
m_bReloading = false;
|
||||
m_flMiscCycle = 0;
|
||||
m_bMiscOnlyWhenStill = bOnlyWhenStill;
|
||||
m_bMiscNoOverride = true;
|
||||
m_fMiscPlaybackRate = flPlaybackRate;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -386,9 +432,7 @@ void CSinglePlayerAnimState::ComputeWeaponSwitchSequence()
|
||||
// does misc gestures if we're not firing
|
||||
void CSinglePlayerAnimState::ComputeMiscSequence()
|
||||
{
|
||||
bool bHoldAtEnd = false;
|
||||
|
||||
UpdateLayerSequenceGeneric( RELOADSEQUENCE_LAYER, m_bPlayingMisc, m_flMiscCycle, m_iMiscSequence, bHoldAtEnd, m_flMiscBlendIn, m_flMiscBlendOut, m_bMiscOnlyWhenStill, m_fMiscPlaybackRate );
|
||||
UpdateLayerSequenceGeneric( RELOADSEQUENCE_LAYER, m_bPlayingMisc, m_flMiscCycle, m_iMiscSequence, m_bMiscHoldAtEnd, m_flMiscBlendIn, m_flMiscBlendOut, m_bMiscOnlyWhenStill, m_fMiscPlaybackRate );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
|
||||
void ComputeSequences( CStudioHdr *pStudioHdr );
|
||||
|
||||
void AddMiscSequence( int iSequence, float flBlendIn = 0.0f, float flBlendOut = 0.0f, float flPlaybackRate = 1.0f, bool bHoldAtEnd = false, bool bOnlyWhenStill = false );
|
||||
|
||||
void ClearAnimationState();
|
||||
void ClearAnimationLayers();
|
||||
|
||||
@ -91,7 +93,7 @@ private:
|
||||
bool m_bPlayingMisc;
|
||||
float m_flMiscCycle, m_flMiscBlendOut, m_flMiscBlendIn;
|
||||
int m_iMiscSequence;
|
||||
bool m_bMiscOnlyWhenStill;
|
||||
bool m_bMiscOnlyWhenStill, m_bMiscHoldAtEnd;
|
||||
bool m_bMiscNoOverride;
|
||||
float m_fMiscPlaybackRate;
|
||||
bool m_bMiscCycleRewound;
|
||||
|
@ -366,6 +366,14 @@ enum PLAYER_ANIM
|
||||
PLAYER_RELOAD,
|
||||
PLAYER_START_AIMING,
|
||||
PLAYER_LEAVE_AIMING,
|
||||
|
||||
#ifdef MAPBASE
|
||||
// New player animations from Mapbase
|
||||
PLAYER_ATTACK2,
|
||||
PLAYER_ATTACK3,
|
||||
PLAYER_UNHOLSTER,
|
||||
PLAYER_HOLSTER,
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef HL2_DLL
|
||||
|
Loading…
x
Reference in New Issue
Block a user