Skip to content
Permalink
Browse files

Networked IsRampsliding so that rampslide sparks work for other players

 * 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 7c78f2ec755188c6b8423e7a86db5500a18ae522
Showing with 28 additions and 8 deletions.
  1. +9 −0 cl_dll/ff/c_ff_player.cpp
  2. +7 −0 cl_dll/ff/c_ff_player.h
  3. +3 −0 dlls/ff/ff_player.cpp
  4. +6 −0 dlls/ff/ff_player.h
  5. +3 −8 game_shared/ff/ff_gamemovement.cpp
@@ -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 ) ),
@@ -1263,6 +1264,8 @@ C_FFPlayer::C_FFPlayer() :
m_flSlidingTime = 0;
m_bSliding = false;

m_bIsRampsliding = false;

m_flSpeedModifier = 1.0f;

m_iHallucinationIndex = 0;
@@ -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() )
{
@@ -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;
@@ -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:
@@ -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 ) ),
@@ -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;
@@ -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; }
@@ -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
@@ -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;

0 comments on commit 7c78f2e

Please sign in to comment.
You can’t perform that action at this time.