summaryrefslogtreecommitdiff
path: root/game/server/tf/tf_passtime_ball.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/tf_passtime_ball.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tf/tf_passtime_ball.h')
-rw-r--r--game/server/tf/tf_passtime_ball.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/game/server/tf/tf_passtime_ball.h b/game/server/tf/tf_passtime_ball.h
new file mode 100644
index 0000000..6ad9f5c
--- /dev/null
+++ b/game/server/tf/tf_passtime_ball.h
@@ -0,0 +1,129 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef TF_PASSTIME_BALL_H
+#define TF_PASSTIME_BALL_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "passtime_ballcontroller_playerseek.h"
+#include "predictable_entity.h"
+#include "util_shared.h"
+#include "baseanimating.h"
+#include "utllinkedlist.h"
+
+class CSpriteTrail;
+class CBallPlayerToucher;
+//-----------------------------------------------------------------------------
+class CPasstimeBall : public CBaseAnimating
+{
+public:
+ DECLARE_CLASS( CPasstimeBall, CBaseAnimating );
+ DECLARE_NETWORKCLASS();
+ CPasstimeBall();
+ ~CPasstimeBall();
+
+ virtual void Spawn() OVERRIDE;
+ virtual void Precache() OVERRIDE;
+ virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent ) OVERRIDE;
+ virtual int OnTakeDamage( const CTakeDamageInfo &info ) OVERRIDE;
+ virtual unsigned int PhysicsSolidMaskForEntity() const OVERRIDE;
+ virtual void ChangeTeam( int iTeamNum ) OVERRIDE;
+ virtual bool IsDeflectable() OVERRIDE;
+ virtual void Deflected( CBaseEntity *pDeflectedBy, Vector& vecDir ) OVERRIDE;
+ virtual bool ShouldCollide( int collisionGroup, int contentsMask ) const OVERRIDE;
+ virtual int UpdateTransmitState() OVERRIDE;
+
+ CTFPlayer *GetCarrier() const;
+ CTFPlayer *GetPrevCarrier() const;
+ CTFPlayer *GetThrower() const;
+ int GetCollisionCount() const;
+ int GetCarryDuration() const;
+
+ void ResetTrail();
+ void HideTrail();
+
+ void MoveTo( const Vector &pos, const Vector &vel );
+ void MoveToSpawner( const Vector &pos );
+
+ void SetStateOutOfPlay();
+ void SetStateFree();
+ void SetStateCarried( CTFPlayer *pCarrier );
+ bool BOutOfPlay() const;
+
+ static CPasstimeBall *Create( Vector position, QAngle angles );
+
+ void SetHomingTarget( CTFPlayer *pPlayer );
+ CTFPlayer *GetHomingTarget() const;
+ float GetAirtimeSec() const;
+ float GetAirtimeDistance() const;
+
+ void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd );
+ void FinishLagCompensation( CBasePlayer *player );
+
+private:
+ friend class CBallPlayerToucher;
+ void OnTouch( CBaseEntity *pOther );
+ void DefaultThink();
+ void TouchPlayer( CTFPlayer *pPlayer );
+ void BlockReflect( CTFPlayer *pPlayer, const Vector& origin, const Vector& ballvel );
+ void BlockDamage( CTFPlayer *pPlayer, const Vector& ballvel );
+ bool BIgnorePlayer( CTFPlayer *pPlayer );
+ void OnCollision();
+ void UpdateLagCompensationHistory();
+ void SetThrower( CTFPlayer *pPlayer );
+ void OnBecomeNotCarried();
+ void SetIdleRespawnTime();
+ void DisableIdleRespawnTime();
+ bool BShouldPanicRespawn() const;
+ bool CreateModelCollider();
+ void CreateSphereCollider();
+
+ enum EState
+ {
+ STATE_OUT_OF_PLAY,
+ STATE_FREE,
+ STATE_CARRIED
+ };
+
+ EState m_eState;
+ CHandle<CTFPlayer> m_hThrower;
+ EHANDLE m_hBlocker;
+ CSpriteTrail *m_pTrail;
+ bool m_bTrailActive;
+ bool m_bLeftOwner;
+ CSoundPatch *m_pHumLoop;
+ CSoundPatch *m_pBeepLoop;
+ CBaseEntity *m_pPlayerToucher;
+ CPasstimeBallControllerPlayerSeek m_playerSeek;
+ bool m_bTouchedSinceSpawn;
+ float m_flLastCollisionTime;
+ float m_flAirtimeDistance;
+ Vector m_vecPrevOrigin; // note: C_BaseEntity has m_vecOldOrigin in client code only
+ float m_flLastTeamChangeTime; // for stats
+ float m_flBeginCarryTime;
+ float m_flIdleRespawnTime;
+
+ struct LagRecord
+ {
+ float flSimulationTime;
+ Vector vecOrigin;
+ };
+
+ CUtlFixedLinkedList<LagRecord> m_lagCompensationHistory;
+ LagRecord m_lagCompensationRestore;
+ bool m_bLagCompensationNeedsRestore;
+ float m_flLagCompensationTeleportDistanceSqr;
+
+ CNetworkVar( int, m_iCollisionCount );
+ CNetworkHandle( CTFPlayer, m_hHomingTarget );
+ CNetworkHandle( CTFPlayer, m_hCarrier );
+ CNetworkHandle( CTFPlayer, m_hPrevCarrier );
+};
+
+#endif // TF_PASSTIME_BALL_H