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/gib.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/gib.h')
| -rw-r--r-- | game/server/gib.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/game/server/gib.h b/game/server/gib.h new file mode 100644 index 0000000..57d5630 --- /dev/null +++ b/game/server/gib.h @@ -0,0 +1,115 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A gib is a chunk of a body, or a piece of wood/metal/rocks/etc. +// +// $Workfile: $ +// $Date: $ +// $NoKeywords: $ +//=============================================================================// + +#ifndef GIB_H +#define GIB_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "baseanimating.h" +#include "player_pickup.h" +#include "Sprite.h" + +extern CBaseEntity *CreateRagGib( const char *szModel, const Vector &vecOrigin, const QAngle &vecAngles, const Vector &vecForce, float flFadeTime = 0.0, bool bShouldIgnite = false ); + +#define GERMAN_GIB_COUNT 4 +#define HUMAN_GIB_COUNT 6 +#define ALIEN_GIB_COUNT 4 + +enum GibType_e +{ + GIB_HUMAN, + GIB_ALIEN, +}; + +class CGib : public CBaseAnimating, + public CDefaultPlayerPickupVPhysics +{ +public: + DECLARE_CLASS( CGib, CBaseAnimating ); + + void Spawn( const char *szGibModel ); + void Spawn( const char *szGibModel, float flLifetime ); + + void InitGib( CBaseEntity *pVictim, float fMaxVelocity, float fMinVelocity ); + void BounceGibTouch ( CBaseEntity *pOther ); + void StickyGibTouch ( CBaseEntity *pOther ); + void WaitTillLand( void ); + void DieThink( void ); + void LimitVelocity( void ); + virtual bool SUB_AllowedToFade( void ); + + void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); + + virtual int ObjectCaps( void ) { return (BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE | FCAP_IMPULSE_USE; } + static void SpawnHeadGib( CBaseEntity *pVictim ); + static void SpawnRandomGibs( CBaseEntity *pVictim, int cGibs, GibType_e eGibType ); + static void SpawnStickyGibs( CBaseEntity *pVictim, Vector vecOrigin, int cGibs ); + static void SpawnSpecificGibs( CBaseEntity *pVictim, int nNumGibs, float fMaxVelocity, float fMinVelocity, const char* cModelName, float flLifetime = 25); + + void SetPhysicsAttacker( CBasePlayer *pEntity, float flTime ); + virtual void OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason ); + virtual void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t reason ); + virtual CBasePlayer *HasPhysicsAttacker( float dt ); + + void SetSprite( CBaseEntity *pSprite ) + { + m_hSprite = pSprite; + } + + CBaseEntity *GetSprite( void ) + { + return m_hSprite.Get(); + } + + void SetFlame( CBaseEntity *pFlame ) + { + m_hFlame = pFlame; + } + + CBaseEntity *GetFlame( void ) + { + return m_hFlame.Get(); + } + + DECLARE_DATADESC(); + + +public: + void SetBloodColor( int nBloodColor ); + + int m_cBloodDecals; + int m_material; + float m_lifeTime; + bool m_bForceRemove; + + CHandle<CBasePlayer> m_hPhysicsAttacker; + float m_flLastPhysicsInfluenceTime; + +private: + // A little piece of duplicated code + void AdjustVelocityBasedOnHealth( int nHealth, Vector &vecVelocity ); + int m_bloodColor; + + EHANDLE m_hSprite; + EHANDLE m_hFlame; +}; + +class CRagGib : public CBaseAnimating +{ +public: + DECLARE_CLASS( CRagGib, CBaseAnimating ); + + void Spawn( const char *szModel, const Vector &vecOrigin, const Vector &vecForce, float flFadeTime ); +}; + + +#endif //GIB_H |