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/tf/entity_ammopack.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf/entity_ammopack.h')
| -rw-r--r-- | game/server/tf/entity_ammopack.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/game/server/tf/entity_ammopack.h b/game/server/tf/entity_ammopack.h new file mode 100644 index 0000000..6af74a3 --- /dev/null +++ b/game/server/tf/entity_ammopack.h @@ -0,0 +1,125 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: CTF AmmoPack. +// +//=============================================================================// +#ifndef ENTITY_AMMOPACK_H +#define ENTITY_AMMOPACK_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "tf_powerup.h" +#include "tf_gamerules.h" + +#define TF_AMMOPACK_SMALL_BDAY "models/items/ammopack_small_bday.mdl" +#define TF_AMMOPACK_MEDIUM_BDAY "models/items/ammopack_medium_bday.mdl" +#define TF_AMMOPACK_LARGE_BDAY "models/items/ammopack_large_bday.mdl" + +//============================================================================= +// +// CTF AmmoPack class. +// + +class CAmmoPack : public CTFPowerup +{ +public: + DECLARE_CLASS( CAmmoPack, CTFPowerup ); + + void Spawn( void ); + virtual void Precache( void ); + bool MyTouch( CBasePlayer *pPlayer ); + + powerupsize_t GetPowerupSize( void ) { return POWERUP_FULL; } + virtual const char *GetAmmoPackName( void ) { return "ammopack_large"; } + + virtual void UpdateModelIndexOverrides( void ) + { + if ( modelinfo ) + { + SetModelIndexOverride( VISION_MODE_NONE, modelinfo->GetModelIndex( GetPowerupModel() ) ); + SetModelIndexOverride( VISION_MODE_PYRO, modelinfo->GetModelIndex( TF_AMMOPACK_LARGE_BDAY ) ); + } + } + + virtual const char *GetDefaultPowerupModel( void ) + { + if ( TFGameRules() && TFGameRules()->IsHolidayActive( kHoliday_TFBirthday ) ) + { + return TF_AMMOPACK_LARGE_BDAY; + } + + return "models/items/ammopack_large.mdl"; + } +}; + +class CAmmoPackSmall : public CAmmoPack +{ +public: + DECLARE_CLASS( CAmmoPackSmall, CAmmoPack ); + powerupsize_t GetPowerupSize( void ) { return POWERUP_SMALL; } + virtual const char *GetAmmoPackName( void ) { return "ammopack_small"; } + + virtual void Precache( void ) + { + PrecacheModel( TF_AMMOPACK_SMALL_BDAY ); // always precache this for PyroVision + BaseClass::Precache(); + } + + virtual void UpdateModelIndexOverrides( void ) + { + if ( modelinfo ) + { + SetModelIndexOverride( VISION_MODE_NONE, modelinfo->GetModelIndex( GetPowerupModel() ) ); + SetModelIndexOverride( VISION_MODE_PYRO, modelinfo->GetModelIndex( TF_AMMOPACK_SMALL_BDAY ) ); + } + } + + virtual const char *GetDefaultPowerupModel( void ) + { + if ( TFGameRules() && TFGameRules()->IsHolidayActive( kHoliday_TFBirthday ) ) + { + return TF_AMMOPACK_SMALL_BDAY; + } + + return "models/items/ammopack_small.mdl"; + } +}; + +class CAmmoPackMedium : public CAmmoPack +{ +public: + DECLARE_CLASS( CAmmoPackMedium, CAmmoPack ); + powerupsize_t GetPowerupSize( void ) { return POWERUP_MEDIUM; } + virtual const char *GetAmmoPackName( void ) { return "ammopack_medium"; } + + virtual void Precache( void ) + { + PrecacheModel( TF_AMMOPACK_MEDIUM_BDAY ); // always precache this for PyroVision + BaseClass::Precache(); + } + + virtual void UpdateModelIndexOverrides( void ) + { + if ( modelinfo ) + { + SetModelIndexOverride( VISION_MODE_NONE, modelinfo->GetModelIndex( GetPowerupModel() ) ); + SetModelIndexOverride( VISION_MODE_PYRO, modelinfo->GetModelIndex( TF_AMMOPACK_MEDIUM_BDAY ) ); + } + } + + virtual const char *GetDefaultPowerupModel( void ) + { + if ( TFGameRules() && TFGameRules()->IsHolidayActive( kHoliday_TFBirthday ) ) + { + return TF_AMMOPACK_MEDIUM_BDAY; + } + + return "models/items/ammopack_medium.mdl"; + } +}; + +#endif // ENTITY_AMMOPACK_H + + |