/*** * * 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. * ****/ #pragma once #if !defined(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_ALLWEAPONS (~(1<nextthink = gpGlobals->time + time; } }; class CRpg : public CBasePlayerWeapon { public: #if !CLIENT_DLL int Save( CSave &save ); int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; #endif void Spawn( void ); void Precache( void ); void Reload( void ); int iItemSlot( void ) { return 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); BOOL Deploy( void ); BOOL CanHolster( void ); void Holster( int skiplocal = 0 ); void PrimaryAttack( void ); void SecondaryAttack( void ); void WeaponIdle( void ); void UpdateSpot( void ); BOOL ShouldWeaponIdle( void ) { return TRUE; }; CLaserSpot *m_pSpot; int m_fSpotActive; int m_cActiveRockets;// how many missiles in flight from this launcher right now? virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } private: unsigned short m_usRpg; }; class CRpgRocket : public CGrenade { public: int Save( CSave &save ); int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; void Spawn( void ); void Precache( void ); void EXPORT FollowThink( void ); void EXPORT IgniteThink( void ); void EXPORT RocketTouch( CBaseEntity *pOther ); static CRpgRocket *CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CRpg *pLauncher ); int m_iTrail; float m_flIgniteTime; EHANDLE m_hLauncher; // handle back to the launcher that fired me. }; class CGauss : public CBasePlayerWeapon { public: #if !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 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void PrimaryAttack( void ); void SecondaryAttack( void ); void WeaponIdle( void ); void StartFire( void ); void Fire( Vector vecOrigSrc, Vector vecDirShooting, float flDamage ); float GetFullChargeTime( void ); int m_iBalls; int m_iGlow; int m_iBeam; int m_iSoundState; // don't save this // was this weapon just fired primary or secondary? // we need to know so we can pick the right set of effects. BOOL m_fPrimaryFire; virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } private: unsigned short m_usGaussFire; unsigned short m_usGaussSpin; }; class CEgon : public CBasePlayerWeapon { public: #if !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 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void UpdateEffect( const Vector &startPoint, const Vector &endPoint, float timeBlend ); void CreateEffect ( void ); void DestroyEffect ( void ); void EndAttack( void ); void Attack( void ); void PrimaryAttack( void ); void WeaponIdle( void ); float m_flAmmoUseTime;// since we use < 1 point of ammo per update, we subtract ammo on a timer. float GetPulseInterval( void ); float GetDischargeInterval( void ); void Fire( const Vector &vecOrigSrc, const Vector &vecDir ); BOOL HasAmmo( void ); void UseAmmo( int count ); enum EGON_FIREMODE { FIRE_NARROW, FIRE_WIDE}; CBeam *m_pBeam; CBeam *m_pNoise; CSprite *m_pSprite; virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } unsigned short m_usEgonStop; private: #if !CLIENT_DLL float m_shootTime; #endif EGON_FIREMODE m_fireMode; float m_shakeTime; BOOL m_deployed; unsigned short m_usEgonFire; }; class CHgun : public CBasePlayerWeapon { public: #if !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 4; } int GetItemInfo(ItemInfo *p); int AddToPlayer( CBasePlayer *pPlayer ); void PrimaryAttack( void ); void SecondaryAttack( void ); BOOL Deploy( void ); BOOL IsUseable( void ); void Holster( int skiplocal = 0 ); void Reload( void ); void WeaponIdle( void ); float m_flNextAnimTime; float m_flRechargeTime; int m_iFirePhase; virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } private: unsigned short m_usHornetFire; }; class CHandGrenade : public CBasePlayerWeapon { public: void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 5; } int GetItemInfo(ItemInfo *p); void PrimaryAttack( void ); BOOL Deploy( void ); BOOL CanHolster( void ); void Holster( int skiplocal = 0 ); void WeaponIdle( void ); virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } }; class CSatchel : public CBasePlayerWeapon { public: #if !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 ); int AddDuplicate( CBasePlayerItem *pOriginal ); BOOL CanDeploy( void ); BOOL Deploy( void ); BOOL IsUseable( void ); void Holster( int skiplocal = 0 ); void WeaponIdle( void ); void Throw( void ); virtual BOOL UseDecrement( void ) { #if CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } }; class CTripmine : public CBasePlayerWeapon { public: void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 5; } int GetItemInfo(ItemInfo *p); void SetObjectCollisionBox( void ) { //!!!BUGBUG - fix the model! pev->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 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 CLIENT_WEAPONS return TRUE; #else return FALSE; #endif } private: unsigned short m_usSnarkFire; }; #endif // WEAPONS_H