summaryrefslogtreecommitdiff
path: root/game/server/tf/passtime_ballcontroller.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/passtime_ballcontroller.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tf/passtime_ballcontroller.h')
-rw-r--r--game/server/tf/passtime_ballcontroller.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/game/server/tf/passtime_ballcontroller.h b/game/server/tf/passtime_ballcontroller.h
new file mode 100644
index 0000000..f6e44e9
--- /dev/null
+++ b/game/server/tf/passtime_ballcontroller.h
@@ -0,0 +1,64 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef PASSTIME_BALLCONTROLLER_H
+#define PASSTIME_BALLCONTROLLER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "util_shared.h"
+
+class CPasstimeBall;
+class CTFPlayer;
+struct gamevcollisionevent_t;
+
+//-----------------------------------------------------------------------------
+class CPasstimeBallController : public TAutoList< CPasstimeBallController >
+{
+public:
+ // ApplyTo returns the number of controllers that were applied.
+ // BallCollision happens from vphysics callbacks.
+ // BallPickedUp happens after player gets ball, but before ball
+ // is removed from world.
+ static int ApplyTo( CPasstimeBall *pBall );
+ static int DisableOn( const CPasstimeBall *pBall );
+ static void BallCollision( CPasstimeBall *pBall, int iCollisionIndex, gamevcollisionevent_t *pEvent );
+ static void BallPickedUp( CPasstimeBall *pBall, CTFPlayer *pCatcher );
+ static void BallDamaged( CPasstimeBall *pBall );
+ static void BallSpawned( CPasstimeBall *pBall );
+
+ explicit CPasstimeBallController( int priority );
+ virtual ~CPasstimeBallController() {}
+ void SetIsEnabled( bool is );
+ bool IsEnabled() const;
+ int GetPriority() const;
+
+protected:
+ virtual bool Apply( CPasstimeBall *pBall ) = 0;
+ virtual bool IsActive() const = 0;
+ virtual void OnBallCollision( CPasstimeBall *pBall, int iCollisionIndex, gamevcollisionevent_t *pEvent ) {}
+ virtual void OnBallPickedUp( CPasstimeBall *pBall, CTFPlayer *pCatcher ) {}
+ virtual void OnBallDamaged( CPasstimeBall *pBall ) {}
+ virtual void OnBallSpawned( CPasstimeBall *pBall ) {}
+ virtual void OnEnabled() {}
+ virtual void OnDisabled() {}
+
+private:
+ bool m_bEnabled;
+ int m_iPriority; // higher priority comes first, must be > INT_MIN
+
+ // noncopyable
+ CPasstimeBallController( const CPasstimeBallController & ) = delete;
+ CPasstimeBallController( CPasstimeBallController && ) = delete;
+ CPasstimeBallController &operator=( const CPasstimeBallController & ) = delete;
+ CPasstimeBallController &operator=( CPasstimeBallController && ) = delete;
+};
+
+#endif // PASSTIME_BALLCONTROLLER_H
+
+