Skip to content

Commit

Permalink
Networked IsRampsliding so that rampslide sparks work for other players
Browse files Browse the repository at this point in the history
 * The tracing is done server-side; this has the downside of not being able to use the trace data client-side to check the material/angle/etc of the surface
  • Loading branch information
squeek502 committed Dec 8, 2014
1 parent 153222b commit 7c78f2e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
9 changes: 9 additions & 0 deletions cl_dll/ff/c_ff_player.cpp
Expand Up @@ -856,6 +856,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_FFPlayer, DT_FFPlayer, CFFPlayer )
RecvPropBool( RECVINFO( m_bConcussed ) ),
RecvPropBool( RECVINFO( m_bTranqed ) ),
RecvPropBool( RECVINFO( m_bSliding ) ),
RecvPropBool( RECVINFO( m_bIsRampsliding ) ),
RecvPropEHandle( RECVINFO( m_hActiveSlowfield ) ),
RecvPropBool( RECVINFO( m_bInfected ) ),
RecvPropBool( RECVINFO( m_bImmune ) ),
Expand Down Expand Up @@ -1263,6 +1264,8 @@ C_FFPlayer::C_FFPlayer() :
m_flSlidingTime = 0;
m_bSliding = false;

m_bIsRampsliding = false;

m_flSpeedModifier = 1.0f;

m_iHallucinationIndex = 0;
Expand Down Expand Up @@ -2454,6 +2457,12 @@ void C_FFPlayer::ClientThink( void )
// Hopefully when the particles die the ::Create()
// stuff gets removed automagically?

if (IsRampsliding())
{
Vector vecDir = -GetAbsVelocity() / (GetAbsVelocity().LengthSqr() / 1000.0f);
g_pEffects->Sparks(GetFeetOrigin() + Vector(random->RandomFloat(-8, 8), random->RandomFloat(-8, 8), 0), 1, 1, &vecDir);
}

// Update infection emitters
if( IsAlive() && IsInfected() && !IsImmune() && !IsDormant() )
{
Expand Down
7 changes: 7 additions & 0 deletions cl_dll/ff/c_ff_player.h
Expand Up @@ -25,6 +25,7 @@
#include "ff_buildableobjects_shared.h"
#include "ff_radiotagdata.h"
#include "model_types.h"
#include "IEffects.h"

class C_FFBuildableObject;
class C_FFDetpack;
Expand Down Expand Up @@ -530,6 +531,12 @@ class C_FFPlayer : public C_BasePlayer, public IFFPlayerAnimStateHelpers
// ----------------------------------
// *** SQUEEK

public:
bool IsRampsliding( void ) const { return m_bIsRampsliding; }
void SetRampsliding( bool bIsRampsliding ) { m_bIsRampsliding = bIsRampsliding; }
protected:
bool m_bIsRampsliding;

// ----------------------------------
// Cloak stuff
public:
Expand Down
3 changes: 3 additions & 0 deletions dlls/ff/ff_player.cpp
Expand Up @@ -437,6 +437,7 @@ IMPLEMENT_SERVERCLASS_ST( CFFPlayer, DT_FFPlayer )
SendPropBool( SENDINFO( m_bConcussed ) ),
SendPropBool( SENDINFO( m_bTranqed ) ),
SendPropBool( SENDINFO( m_bSliding ) ),
SendPropBool( SENDINFO( m_bIsRampsliding ) ),
SendPropEHandle( SENDINFO( m_hActiveSlowfield ) ),
SendPropBool( SENDINFO( m_bInfected ) ),
SendPropBool( SENDINFO( m_bImmune ) ),
Expand Down Expand Up @@ -575,6 +576,8 @@ CFFPlayer::CFFPlayer()
m_flSlidingTime = 0; // Not sliding on creation
m_bSliding = false;

m_bIsRampsliding = false;

m_bGassed = false;
m_hGasser = NULL;
m_flNextGas = 0;
Expand Down
6 changes: 6 additions & 0 deletions dlls/ff/ff_player.h
Expand Up @@ -541,6 +541,12 @@ class CFFPlayer : public CBasePlayer, public IFFPlayerAnimStateHelpers
void StopSliding( void ); // stop the overpressure friction/acceleration effect
CNetworkVar( bool, m_bSliding );

public:
bool IsRampsliding( void ) const { return m_bIsRampsliding; }
void SetRampsliding( bool bIsRampsliding ) { m_bIsRampsliding = bIsRampsliding; }
protected:
CNetworkVar( bool, m_bIsRampsliding );

public:
bool IsInfected( void ) const { return m_bInfected; }
bool IsImmune( void ) const { return m_bImmune; }
Expand Down
11 changes: 3 additions & 8 deletions game_shared/ff/ff_gamemovement.cpp
Expand Up @@ -18,7 +18,6 @@
#include "in_buttons.h"
#include "movevars_shared.h"
#include "ff_mapguide.h"
#include "IEffects.h"

#define STOP_EPSILON 0.1
#define MAX_CLIP_PLANES 5
Expand Down Expand Up @@ -958,13 +957,9 @@ void CFFGameMovement::CheckVelocity( void )
CFFPlayer *pPlayer = ToFFPlayer( player );
if( !pPlayer )
return;
#ifdef CLIENT_DLL
if (IsRampSliding(pPlayer))
{
Vector vecDir = -mv->m_vecVelocity / (mv->m_vecVelocity.LengthSqr() / 1000.0f);
g_pEffects->Sparks(pPlayer->GetFeetOrigin() + Vector(random->RandomFloat(-8, 8), random->RandomFloat(-8, 8), 0), 1, 1, &vecDir);
}
#endif

pPlayer->SetRampsliding(IsRampSliding(pPlayer));

if( !pPlayer->IsCloaked() )
return;

Expand Down

0 comments on commit 7c78f2e

Please sign in to comment.