/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ #ifndef WEAPONS_H #define WEAPONS_H #include "effects.h" class CBasePlayer; extern int gmsgWeapPickup; void DeactivateSatchels( CBasePlayer *pOwner ); // Contact Grenade / Timed grenade / Satchel Charge class CGrenade : public CBaseMonster { public: void Spawn( void ); typedef enum { SATCHEL_DETONATE = 0, SATCHEL_RELEASE } SATCHELCODE; static CGrenade *ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ); static CGrenade *ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ); static CGrenade *ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ); static void UseSatchelCharges( entvars_t *pevOwner, SATCHELCODE code ); void Explode( Vector vecSrc, Vector vecAim ); void Explode( TraceResult *pTrace, int bitsDamageType ); void EXPORT Smoke( void ); void EXPORT BounceTouch( CBaseEntity *pOther ); void EXPORT SlideTouch( CBaseEntity *pOther ); void EXPORT ExplodeTouch( CBaseEntity *pOther ); void EXPORT DangerSoundThink( void ); void EXPORT PreDetonate( void ); void EXPORT Detonate( void ); void EXPORT DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void EXPORT TumbleThink( void ); virtual void BounceSound( void ); virtual int BloodColor( void ) { return DONT_BLEED; } virtual void Killed( entvars_t *pevAttacker, int iGib ); BOOL m_fRegisteredSound;// whether or not this grenade has issued its DANGER sound to the world sound list yet. }; // constant items #define ITEM_HEALTHKIT 1 #define ITEM_ANTIDOTE 2 #define ITEM_SECURITY 3 #define ITEM_BATTERY 4 #define WEAPON_NONE 0 #define WEAPON_CROWBAR 1 #define WEAPON_GLOCK 2 #define WEAPON_PYTHON 3 #define WEAPON_MP5 4 #define WEAPON_CHAINGUN 5 #define WEAPON_CROSSBOW 6 #define WEAPON_SHOTGUN 7 #define WEAPON_RPG 8 #define WEAPON_GAUSS 9 #define WEAPON_EGON 10 #define WEAPON_HORNETGUN 11 #define WEAPON_HANDGRENADE 12 #define WEAPON_TRIPMINE 13 #define WEAPON_SATCHEL 14 #define WEAPON_SNARK 15 #define WEAPON_DISPLACER 16 #define WEAPON_EAGLE 17 #define WEAPON_GRAPPLE 18 #define WEAPON_KNIFE 19 #define WEAPON_M249 20 #define WEAPON_PENGUIN 21 #define WEAPON_PIPEWRENCH 22 #define WEAPON_SHOCKRIFLE 23 #define WEAPON_SNIPERRIFLE 24 #define WEAPON_SPORELAUNCHER 25 #define WEAPON_ALLWEAPONS (~(1<absmin = pev->origin + Vector(-16, -16, -5); pev->absmax = pev->origin + Vector(16, 16, 28); } void PrimaryAttack( void ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void WeaponIdle( void ); virtual BOOL UseDecrement( void ) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usTripFire; }; class CSqueak : public CBasePlayerWeapon { public: void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 5; } int GetItemInfo(ItemInfo *p); void PrimaryAttack( void ); void SecondaryAttack( void ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void WeaponIdle( void ); int m_fJustThrown; virtual BOOL UseDecrement( void ) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usSnarkFire; }; // // // class CDisplacer : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 5; } int GetItemInfo(ItemInfo *p); int AddToPlayer(CBasePlayer *pPlayer); void PrimaryAttack(void); void SecondaryAttack(void); BOOL Deploy(void); void Holster(int skiplocal = 0); void WeaponIdle(void); void ItemPreFrame(void); void ItemPostFrame( void ); BOOL PlayEmptySound(void); virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } int m_iFireState; int m_iFireMode; CBaseEntity* m_hTargetEarth; CBaseEntity* m_hTargetXen; BOOL HasAmmo(void); void UseAmmo(int count); BOOL CanFireDisplacer() const; enum DISPLACER_FIRESTATE { FIRESTATE_NONE = 0, FIRESTATE_SPINUP, FIRESTATE_SPIN, FIRESTATE_FIRE }; enum DISPLACER_FIREMODE { FIREMODE_NONE = 0, FIREMODE_FORWARD, FIREMODE_BACKWARD }; enum DISPLACER_EFFECT { EFFECT_NONE = 0, EFFECT_CORE }; private: void ClearSpin( void ); void SpinUp(int iFireMode); void Spin( void ); void Fire( BOOL fIsPrimary ); void Teleport( void ); void Displace( void ); void UpdateEffects( void ); BOOL ShouldUpdateEffects( void ) const; private: unsigned short m_usDisplacer; }; class CEagle : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save( CSave &save ); int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 2; } int GetItemInfo( ItemInfo *p ); void PrimaryAttack( void ); void SecondaryAttack( void ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void Reload( void ); void WeaponIdle( void ); void UpdateSpot( void ); CLaserSpot *m_pEagleLaser; int m_fEagleLaserActive; virtual BOOL UseDecrement( void ) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: int m_iShell; unsigned short m_usEagle; }; class CGrappleTonguetip; class CGrapple : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 1; } int GetItemInfo(ItemInfo *p); void PrimaryAttack(void); BOOL Deploy(void); void Holster(int skiplocal = 0); void WeaponIdle(void); void ItemPostFrame(void); virtual BOOL ShouldWeaponIdle(void) { return TRUE; } virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } void Fire(void); void FireWait(void); void FireReach(void); void FireTravel(void); void FireRelease(void); void Fire2(void); void OnTongueTipHitSurface( const Vector& vecTarget ); void OnTongueTipHitEntity( CBaseEntity* pEntity ); void StartPull( void ); void StopPull( void ); void Pull( void ); BOOL IsTongueColliding( const Vector& vecShootOrigin, const Vector& vecTipPos ); void CheckFireEligibility( void ); BOOL CheckTargetProximity( void ); void CreateTongueTip( void ); void DestroyTongueTip( void ); void UpdateTongueTip( void ); void CreateBeam( CBaseEntity* pTongueTip ); void DestroyBeam( void ); void UpdateBeam( void ); void StartPullSound( void ); void UpdatePullSound( void ); void ResetPullSound( void ); BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted); enum GRAPPLE_FIRESTATE { FIRESTATE_NONE = 0, FIRESTATE_FIRE, FIRESTATE_FIRE2, FIRESTATE_WAIT, FIRESTATE_REACH, FIRESTATE_TRAVEL, FIRESTATE_RELEASE, }; int m_iFirestate; int m_iHitFlags; BOOL m_fTipHit; CGrappleTonguetip* m_pTongueTip; CBeam* m_pBeam; float m_flNextPullSoundTime; BOOL m_fPlayPullSound; private: }; class CKnife : public CBasePlayerWeapon { public: void Spawn(void); void Precache(void); int iItemSlot(void) { return 1; } void EXPORT SwingAgain(void); void EXPORT Smack(void); int GetItemInfo(ItemInfo *p); void PrimaryAttack(void); int Swing(int fFirst); BOOL Deploy(void); void Holster(int skiplocal = 0); int m_iSwing; TraceResult m_trHit; virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usKnife; }; class CM249 : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 6; } int GetItemInfo(ItemInfo *p); int AddToPlayer(CBasePlayer *pPlayer); void PrimaryAttack(void); BOOL Deploy(void); void Reload(void); void WeaponIdle(void); virtual BOOL ShouldWeaponIdle(void) { return TRUE; } float m_flNextAnimTime; int m_iShell; virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } void ReloadStart( void ); void ReloadInsert( void ); enum M249_RELOAD_STATE { RELOAD_STATE_NONE = 0, RELOAD_STATE_OPEN, RELOAD_STATE_FILL }; int m_iReloadState; private: unsigned short m_usM249; }; class CPenguin : public CBasePlayerWeapon { public: void Spawn(void); void Precache(void); int iItemSlot(void) { return 5; } int GetItemInfo(ItemInfo *p); void PrimaryAttack(void); void SecondaryAttack(void); BOOL Deploy(void); void Holster(int skiplocal = 0); void WeaponIdle(void); int m_fJustThrown; virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usPenguinFire; }; class CPipeWrench : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 1; } void EXPORT SwingAgain(void); void EXPORT Smack(void); int GetItemInfo(ItemInfo *p); void PrimaryAttack(void); void SecondaryAttack(void); void ItemPostFrame(void); virtual BOOL ShouldWeaponIdle(void) { return FALSE; }; int Swing(int fFirst, BOOL fIsPrimary); BOOL Deploy(void); void Holster(int skiplocal = 0); int m_iSwing; TraceResult m_trHit; virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usPWrench; void EXPORT WindUp(void); void EXPORT WindLoop(void); void EXPORT SwingAgain2(void); BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted); enum PWRENCH_FIRESTATE { FIRESTATE_NONE = 0, FIRESTATE_WINDUP, FIRESTATE_WINDLOOP, FIRESTATE_BIGHIT }; int m_iFirestate; float m_flHoldStartTime; }; class CShockrifle : public CHgun { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 7; } int GetItemInfo(ItemInfo *p); int AddToPlayer(CBasePlayer *pPlayer); void PrimaryAttack(void); void SecondaryAttack(void); BOOL Deploy(void); void Holster(int skiplocal = 0); void Reload(void); void WeaponIdle(void); void ItemPostFrame(void);; int m_fShouldUpdateEffects; int m_flBeamLifeTime; void UpdateEffects(); virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } private: unsigned short m_usShockFire; }; class CSniperrifle : public CBasePlayerWeapon { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn(void); void Precache(void); int iItemSlot(void) { return 6; } int GetItemInfo(ItemInfo *p); int AddToPlayer(CBasePlayer *pPlayer); void PrimaryAttack(void); void SecondaryAttack(void); BOOL Deploy(void); void Holster(int skiplocal = 0); void Reload(void); void WeaponIdle(void); void ItemPostFrame(void); BOOL ShouldWeaponIdle(void) { return TRUE; }; BOOL m_fInZoom;// don't save this. virtual BOOL UseDecrement(void) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } BOOL m_fNeedAjustBolt; int m_iBoltState; enum SNIPER_BOLTSTATE { BOLTSTATE_FINE = 0, BOLTSTATE_ADJUST, BOLTSTATE_ADJUSTING, }; private: unsigned short m_usSniper; }; class CSporelauncher : public CShotgun { public: #ifndef CLIENT_DLL int Save(CSave &save); int Restore(CRestore &restore); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn( void ); void Precache( void ); int iItemSlot() { return 7; } int GetItemInfo( ItemInfo *p ); int AddToPlayer( CBasePlayer *pPlayer ); void PrimaryAttack( void ); void SecondaryAttack( void ); BOOL Deploy(); void Reload( void ); void WeaponIdle( void ); virtual BOOL UseDecrement( void ) { #if defined( CLIENT_WEAPONS ) return TRUE; #else return FALSE; #endif } int m_iSquidSpitSprite; private: unsigned short m_usSporeFire; }; #endif // WEAPONS_H