Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/game/server/tf/tf_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
#include "tf_revive.h"
#include "tf_logic_halloween_2014.h"
#include "tf_logic_player_destruction.h"
#include "tf_weapon_rocketpack.h"
#include "tf_weapon_slap.h"
#include "func_croc.h"
#include "tf_weapon_bonesaw.h"
Expand Down Expand Up @@ -1453,35 +1452,6 @@ void CTFPlayer::TFPlayerThink()
else
{
m_iLeftGroundHealth = -1;
if ( GetFlags() & FL_ONGROUND )
{
// Airborne conditions end on ground contact
m_Shared.RemoveCond( TF_COND_KNOCKED_INTO_AIR );
m_Shared.RemoveCond( TF_COND_AIR_CURRENT );

if ( m_Shared.InCond( TF_COND_ROCKETPACK ) )
{
// Make sure we're still not dealing with launch, where it's possible
// to hit your head and fall to the ground before the second stage.
CTFWeaponBase *pRocketPack = Weapon_OwnsThisID( TF_WEAPON_ROCKETPACK );
if ( pRocketPack )
{
if ( gpGlobals->curtime > ( static_cast< CTFRocketPack* >( pRocketPack )->GetRefireTime() ) )
{
EmitSound( "Weapon_RocketPack.BoostersShutdown" );
EmitSound( "Weapon_RocketPack.Land" );
m_Shared.RemoveCond( TF_COND_ROCKETPACK );

IGameEvent *pEvent = gameeventmanager->CreateEvent( "rocketpack_landed" );
if ( pEvent )
{
pEvent->SetInt( "userid", GetUserID() );
gameeventmanager->FireEvent( pEvent );
}
}
}
}
}

if ( m_iBlastJumpState )
{
Expand Down
79 changes: 73 additions & 6 deletions src/game/shared/tf/tf_player_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "tf_mapinfo.h"
#include "tf_dropped_weapon.h"
#include "tf_weapon_passtime_gun.h"
#include "tf_weapon_rocketpack.h"
#include <functional>

// Client specific.
Expand Down Expand Up @@ -471,7 +472,10 @@ BEGIN_PREDICTION_DATA_NO_BASE( CTFPlayerShared )
DEFINE_PRED_FIELD( m_bHasPasstimeBall, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_FIELD( m_bIsTargetedForPasstimePass, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE ), // does this belong here?
DEFINE_PRED_FIELD( m_askForBallTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_FIELD( m_flHolsterAnimTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_ARRAY( m_flItemChargeMeter, FIELD_FLOAT, LAST_LOADOUT_SLOT_WITH_CHARGE_METER, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_FIELD( m_iStunIndex, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
DEFINE_PRED_FIELD( m_bScattergunJump, FIELD_BOOLEAN, 0 ),
END_PREDICTION_DATA()

// Server specific.
Expand Down Expand Up @@ -1005,7 +1009,6 @@ void CTFPlayerShared::Spawn( void )
SetRevengeCrits( 0 );

m_PlayerStuns.RemoveAll();
m_iStunIndex = -1;

m_iPasstimeThrowAnimState = PASSTIME_THROW_ANIM_NONE;
m_bHasPasstimeBall = false;
Expand All @@ -1014,6 +1017,7 @@ void CTFPlayerShared::Spawn( void )
#else
m_bSyncingConditions = false;
#endif
m_iStunIndex = -1;
m_bKingRuneBuffActive = false;

// Reset our assist here incase something happens before we get killed
Expand Down Expand Up @@ -3090,9 +3094,48 @@ void CTFPlayerShared::ConditionThink( void )

VehicleThink();

if ( m_pOuter->GetFlags() & FL_ONGROUND && InCond( TF_COND_PARACHUTE_ACTIVE ) )
if ( m_pOuter->GetFlags() & FL_ONGROUND )
{
RemoveCond( TF_COND_PARACHUTE_ACTIVE );
// Airborne conditions end on ground contact
RemoveCond( TF_COND_KNOCKED_INTO_AIR );
RemoveCond( TF_COND_AIR_CURRENT );

if ( InCond( TF_COND_PARACHUTE_ACTIVE ) )
{
RemoveCond( TF_COND_PARACHUTE_ACTIVE );
}

if ( InCond( TF_COND_ROCKETPACK ) )
{
// Make sure we're still not dealing with launch, where it's possible
// to hit your head and fall to the ground before the second stage.
CTFWeaponBase *pRocketPack = m_pOuter->Weapon_OwnsThisID( TF_WEAPON_ROCKETPACK );
if ( pRocketPack )
{
if ( gpGlobals->curtime > ( static_cast< CTFRocketPack* >( pRocketPack )->GetRefireTime() ) )
{
#ifdef CLIENT_DLL
if ( prediction->IsFirstTimePredicted() )
#endif
{
CPASAttenuationFilter filter( m_pOuter );
filter.UsePredictionRules();
m_pOuter->EmitSound( filter, m_pOuter->entindex(), "Weapon_RocketPack.BoostersShutdown" );
m_pOuter->EmitSound( filter, m_pOuter->entindex(), "Weapon_RocketPack.Land" );
}
RemoveCond( TF_COND_ROCKETPACK );

#ifdef GAME_DLL
IGameEvent *pEvent = gameeventmanager->CreateEvent( "rocketpack_landed" );
if ( pEvent )
{
pEvent->SetInt( "userid", m_pOuter->GetUserID() );
gameeventmanager->FireEvent( pEvent );
}
#endif
}
}
}
}

// See if we should be pulsing our radius heal
Expand Down Expand Up @@ -7301,6 +7344,8 @@ void CTFPlayerShared::OnRemoveStunned( void )
m_iStunFlags = 0;
m_hStunner = NULL;

m_iStunIndex = -1;

#ifdef CLIENT_DLL
if ( m_pOuter->m_pStunnedEffect )
{
Expand All @@ -7310,7 +7355,6 @@ void CTFPlayerShared::OnRemoveStunned( void )
m_pOuter->m_pStunnedEffect = NULL;
}
#else
m_iStunIndex = -1;
m_PlayerStuns.RemoveAll();
#endif

Expand Down Expand Up @@ -9624,15 +9668,16 @@ bool CTFPlayerShared::AddToSpyCloakMeter( float val, bool bForce )

#endif

#ifdef GAME_DLL
//-----------------------------------------------------------------------------
// Purpose: Stun & Snare Application
//-----------------------------------------------------------------------------
void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iStunFlags, CTFPlayer* pAttacker )
{
#ifdef GAME_DLL
// Insanity prevention
if ( ( m_PlayerStuns.Count() + 1 ) >= 250 )
return;
#endif

if ( InCond( TF_COND_PHASE ) || InCond( TF_COND_PASSTIME_INTERCEPTION ) )
return;
Expand All @@ -9643,11 +9688,13 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
if ( InCond( TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED ) && !InCond( TF_COND_MVM_BOT_STUN_RADIOWAVE ) )
return;

#ifdef GAME_DLL
if ( pAttacker && TFGameRules() && TFGameRules()->IsTruceActive() && pAttacker->IsTruceValidForEnt() )
{
if ( ( pAttacker->GetTeamNumber() == TF_TEAM_RED ) || ( pAttacker->GetTeamNumber() == TF_TEAM_BLUE ) )
return;
}
#endif

float flRemapAmount = RemapValClamped( flReductionAmount, 0.0, 1.0, 0, 255 );

Expand All @@ -9674,10 +9721,13 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
}
else if ( GetActiveStunInfo() )
{
#ifdef GAME_DLL
// Something yanked our TF_COND_STUNNED in an unexpected way
if ( !HushAsserts() )
Assert( !"Something yanked out TF_COND_STUNNED." );
m_PlayerStuns.RemoveAll();
#endif
m_iStunIndex = -1;
return;
}

Expand All @@ -9699,7 +9749,16 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
// This can happen when stuns use TF_STUN_CONTROLS or TF_STUN_LOSER_STATE.
float flOldStun = GetActiveStunInfo() ? GetActiveStunInfo()->flStunAmount : 0.f;

#ifdef GAME_DLL
m_iStunIndex = m_PlayerStuns.AddToTail( stunEvent );
#else
m_iStunIndex = 0;

if ( prediction->IsFirstTimePredicted() )
{
m_ActiveStunInfo = stunEvent;
}
#endif

if ( flOldStun > flRemapAmount )
{
Expand All @@ -9709,10 +9768,18 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
else
{
// Done for now
#ifdef GAME_DLL
m_PlayerStuns.AddToTail( stunEvent );
#else
if ( prediction->IsFirstTimePredicted() )
{
m_ActiveStunInfo = stunEvent;
}
#endif
return;
}

#ifdef GAME_DLL
// Add in extra time when TF_STUN_CONTROLS
if ( GetActiveStunInfo()->iStunFlags & TF_STUN_CONTROLS )
{
Expand Down Expand Up @@ -9766,10 +9833,10 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
m_pOuter->ClearExpression();
m_pOuter->ClearWeaponFireScene();
}
#endif

AddCond( TF_COND_STUNNED, -1.f, pAttacker );
}
#endif // GAME_DLL

//-----------------------------------------------------------------------------
// Purpose: Returns the intensity of the current stun effect, if we have the type of stun indicated.
Expand Down
2 changes: 0 additions & 2 deletions src/game/shared/tf/tf_player_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,7 @@ class CTFPlayerShared : public CGameEventListener

// Stuns
stun_struct_t *GetActiveStunInfo( void ) const;
#ifdef GAME_DLL
void StunPlayer( float flTime, float flReductionAmount, int iStunFlags = TF_STUN_MOVEMENT, CTFPlayer* pAttacker = NULL );
#endif // GAME_DLL
float GetAmountStunned( int iStunFlags );
bool IsLoserStateStunned( void ) const;
bool IsControlStunned( void );
Expand Down
Loading