diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf2/tf_walker_base.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf2/tf_walker_base.h')
| -rw-r--r-- | game/server/tf2/tf_walker_base.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/game/server/tf2/tf_walker_base.h b/game/server/tf2/tf_walker_base.h new file mode 100644 index 0000000..269606c --- /dev/null +++ b/game/server/tf2/tf_walker_base.h @@ -0,0 +1,115 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef TF_WALKER_BASE_H +#define TF_WALKER_BASE_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "basetfvehicle.h" + + +class CWalkerBase : public CBaseTFVehicle +{ +public: + DECLARE_CLASS( CWalkerBase, CBaseTFVehicle ); + DECLARE_SERVERCLASS(); + + +public: + CWalkerBase(); + + // Derived classes must call this from inside their Spawn() function. Their Spawn() function + // should NOT chain down to CWalkerBase. + void SpawnWalker( + const char *pModelName, + int objectType, + const Vector &vPlacementMins, + const Vector &vPlacementMaxs, + int iHealth, + int nMaxPassengers, + float flPlaybackSpeedBoost // Strider likes the animations played at 2x speed. + ); + + virtual void AdjustInitialBuildAngles(); + + // When it's in walk mode, it'll set a walk animation, process user input, set pose parameters, + // and move the entity around as it walks. + void EnableWalkMode( bool bEnable ); + + // This is called each frame to do thinking. Derived classes can hook this to do their own stuff each frame. + virtual void WalkerThink(); + + // Returns the new local origin to set based on the walker's movement. + // This usually just asks for the movement from the animation, but some walkers may + // want to generate the motion in code. + virtual Vector GetWalkerLocalMovement(); + + // See notes on m_vSteerVelocity below. + const Vector2D& GetSteerVelocity() const; + + void WalkerActivate( void ); + + // See m_flVelocityDecayRate. + void SetVelocityDecayRate( float flDecayRate ); + + // Walkers think 10x/second. + float GetTimeDelta() const; + +// CBaseEntity. +public: + virtual void Spawn(); + virtual void Activate(); + +// IVehicle overrides. +public: + virtual void SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move ); + + +// IServerVehicle overrides. +public: + virtual bool IsPassengerVisible( int nRole ); + + +// CBaseObject overrides. +public: + virtual bool StartBuilding( CBaseEntity *pBuilder ); + + +public: + + // This is a hack to prevent the strider from playing a lot of footstep sounds, until we figure out 9-way anim events + float m_flDontMakeSoundsUntil; + + // Last usercmd buttons. + int m_LastButtons; + QAngle m_vLastCmdViewAngles; + + +private: + + // This is the (local) velocity that the player's controls are saying the player wants to move in. + // Note that it is completely virtual - the speed that the walker moves at is gotten from the animations ground speed. + // It maps this velocity a 9-way blend for movement. +X = forward, +Y = left. + Vector2D m_vSteerVelocity; + + // Which pose parameters we use to make this guy walk around on X and Y. + int m_iMovePoseParamX; + int m_iMovePoseParamY; + + float m_flPlaybackSpeedBoost; + + bool m_bWalkMode; + + // This is a magic number that can be tweaked to make the velocity decay faster. + // Default: 80 + float m_flVelocityDecayRate; +}; + + +#endif // TF_WALKER_BASE_H |