halflife-thewastes-sdk/common/thewastes.h

1362 lines
34 KiB
C
Raw Normal View History

/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, 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
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __THEWASTES_H_
#define __THEWASTES_H_
/*
This header file contains our unique stuff about The Wastes.
Include this and the matching .cpp file in the dll you need.
*/
#include "tw_common.h"
class CWasteWeapon;
class CWasteAmmo;
// Damage Modifiers for various locations.
// Multiply these by the weapons base damage
// for easy damage calculation!
#define HEAD_DAMAGE 2
#define CHEST_DAMAGE 1
#define GUT_DAMAGE 1.1
#define ARM_DAMAGE 0.6
#define LEG_DAMAGE 0.65
/***
*
*
* Weapons / Ammo
*
*
***/
// Baseline damages... these are the damages as
// if you hit someone in the chest. extremeties
// and the head uses modifiers to get a slightly
// different value from this.
#define BERETTA_DMG_WHIP 15
#define COLT_DMG_WHIP 15
#define DEAGLE_DMG_WHIP 20
#define MOSSBERG_DMG_WHIP 25
#define BOLTRIFLE_DMG_WHIP 25
// Cant have more than 32(for now) :)
#define WEAPON_BERETTA 1
#define WEAPON_COLT 2
#define WEAPON_DEAGLE 3
#define WEAPON_RUGER 4
#define WEAPON_HANDCANNON 5
#define WEAPON_SAWEDOFF 6
#define WEAPON_MOSSBERG 7
#define WEAPON_WINCHESTER 8
#define WEAPON_SMG9 9
#define WEAPON_FNFAL 10
#define WEAPON_TOMMYGUN 11
#define WEAPON_JACKHAMMER 12
#define WEAPON_G11 13
#define WEAPON_BOLTRIFLE 14
#define WEAPON_STEN 15
#define WEAPON_MOLOTOVCOCKTAIL 16
#define WEAPON_FRAGGRENADE 17
#define WEAPON_PIPEBOMB 18
#define WEAPON_COMBATKNIFE 19
#define WEAPON_THROWINGKNIFE 20
#define WEAPON_BASEBALLBAT 21
#define WEAPON_SLEDGEHAMMER 22
#define WEAPON_KATANA 23
#define WEAPON_SPEAR 24
#define WEAPON_CATTLEPROD 25
#define WEAPON_AKIMBOBERETTAS 26
#define WEAPON_AKIMBOCOLTS 27
#define WEAPON_AKIMBODEAGLES 28
#define WEAPON_AKIMBOSAWEDOFFS 29
#define WEIGHT_BERETTA 10
#define WEIGHT_COLT 10
#define WEIGHT_DEAGLE 12
#define WEIGHT_RUGER 15
#define WEIGHT_HANDCANNON 20
#define WEIGHT_SAWEDOFF 22
#define WEIGHT_MOSSBERG 30
#define WEIGHT_WINCHESTER 30
#define WEIGHT_SMG9 20
#define WEIGHT_BOLTRIFLE 30
#define WEIGHT_STEN 22
#define WEIGHT_UNIQUE 35
#define WEIGHT_MOLOTOVCOCKTAIL 5
#define WEIGHT_FRAGGRENADE 5
#define WEIGHT_PIPEBOMB 5
#define WEIGHT_COMBATKNIFE 5
#define WEIGHT_THROWINGKNIFE 5
#define WEIGHT_BASEBALLBAT 5
#define WEIGHT_SLEDGEHAMMER 5
#define WEIGHT_KATANA 5
#define WEIGHT_SPEAR 5
#define WEIGHT_CATTLEPROD 10
// Weapon Death Messages.
// Format: %s(killer) %s(victim)
#define DEATH_BERETTA_1 "%s perforated %s with a Beretta 92FS"
#define DEATH_COLT_1 "%s punctured %s's stomach with a Colt Enforcer"
#define DEATH_DEAGLE_1 "%s ripped a hole in %s's chest with a .50AE slug"
#define DEATH_RUGER_1 "%s gave %s just desserts with a .454 Casull round"
#define DEATH_HANDCANNON_1 "%s drove a 5.6mm round into %s like a freight train"
#define DEATH_SAWEDOFF_1 "%s blew away %s. twice."
#define DEATH_MOSSBERG_1 "%s marries %s in hole-y matrimony"
#define DEATH_WINCHESTER_1 "%s singlehandedly destroyed %s's will to terminate"
#define DEATH_SMG9_1 "%s gave %s some heart burn"
#define DEATH_FNFAL_1 "%s made %s wonder, \"Where the hell did that bullet come from?\""
#define DEATH_TOMMYGUN_1 "%s made a wiseguy out of %s"
#define DEATH_JACKHAMMER_1 "%s turned %s into buckshot hamburger"
#define DEATH_G11_1 "%s gave %s some caseless loving"
#define DEATH_BOLTRIFLE_1 "%s pinpointed %s's internal organs and pulled the trigger"
#define DEATH_STEN_1 "%s showed %s that surrender is not an option"
#define DEATH_MOLOTOVCOCKTAIL_1 "%s made %s crispy on the outside and gooey on the inside"
#define DEATH_FRAGGRENADE_1 "%s turned %s into tiny little gibs"
#define DEATH_PIPEBOMB_1 "%s taught %s about homemade explosives"
#define DEATH_COMBATKNIFE_1 "%s gutted %s with his combat knife"
#define DEATH_THROWINGKNIFE_1 "%s stuck his throwing knife in %s's side"
#define DEATH_BASEBALLBAT_1 "%s smashed %s's face in with his bat"
#define DEATH_SLEDGEHAMMER_1 "%s went to work on %s's skull"
#define DEATH_KATANA_1 "%s sliced the belly of %s"
#define DEATH_SPEAR_1 "%s bludgeoned %s with his spear"
#define DEATH_CATTLEPROD_1 "%s roasted %s with 11 herbs and spices"
#define DEATH_AKIMBOBERETTAS_1 "%s John Woo'd %s with his akimbo berettas"
#define DEATH_AKIMBOCOLTS_1 "%s enforced his rules on %s with two colt enforcer rounds"
#define DEATH_AKIMBODEAGLES_1 "%s put a big hole in %s's body courtesy of two .50AE slugs"
#define DEATH_AKIMBOSAWEDOFFS_1 "%s gave %s double the pleasure from dual sawed off's"
#define DEATH_BLEED_1 "%s bled %s, real slow"
#define DEATH_BERETTA_2 "%s busts a cap on %s"
#define DEATH_COLT_2 "%s capped %s with a 10mm slug"
#define DEATH_DEAGLE_2 "%s drilled a 12.7mm diameter hole in %s's skull"
#define DEATH_RUGER_2 "%s schooled %s with a well placed Ruger shot"
#define DEATH_HANDCANNON_2 "%s made sure the last thing on %s's mind was a 5.56mm cartridge"
#define DEATH_SAWEDOFF_2 "%s's twin barrels leave %s twitching in the dust"
#define DEATH_MOSSBERG_2 "%s gives %s a buckshot enema"
#define DEATH_WINCHESTER_2 "%s aerated %s's chest with his Winchester"
#define DEATH_SMG9_2 "%s said to %s's corpse, \"Why yes, I guess it is whoring!\""
#define DEATH_FNFAL_2 "%s showed %s even the FN-FAL loves fun and games!"
#define DEATH_TOMMYGUN_2 "%s riddled %s, gangsta style"
#define DEATH_JACKHAMMER_2 "%s didn't want to kill %s so much as remove him from the known universe"
#define DEATH_G11_2 "%s found the G11 first. %s obviously didn't"
#define DEATH_BOLTRIFLE_2 "%s put down %s with a well placed rifle round"
#define DEATH_STEN_2 "%s gave %s a dishonorable discharge"
#define DEATH_MOLOTOVCOCKTAIL_2 "%s burned %s at the stake and pissed on the ashes"
#define DEATH_FRAGGRENADE_2 "%s taught %s the pin trick"
#define DEATH_PIPEBOMB_2 "%s instructs %s not to play with explosives"
#define DEATH_COMBATKNIFE_2 "%s sliced %s's neck"
#define DEATH_THROWINGKNIFE_2 "%s put a throwing knife between the eyes of %s"
#define DEATH_BASEBALLBAT_2 "%s hit a homerun with %s's body"
#define DEATH_SLEDGEHAMMER_2 "%s beat %s to a pulp with his sledge"
#define DEATH_KATANA_2 "%s showed %s what happens when you \'bring out the gimp\'"
#define DEATH_SPEAR_2 "%s shoved his hand carved spear blade into %s's gut"
#define DEATH_CATTLEPROD_2 "%s gave %s quite a shock"
#define DEATH_AKIMBOBERETTAS_2 "%s riddles %s with several 9mm rounds from two berettas"
#define DEATH_AKIMBOCOLTS_2 "%s put %s in his place using two colt enforcers"
#define DEATH_AKIMBODEAGLES_2 "%s gave %s a lobotomy using two desert eagles as scalpels"
#define DEATH_AKIMBOSAWEDOFFS_2 "%s made %s's insides his outsides using two sawed-off shotguns"
#define DEATH_BLEED_2 "%s opened up %s like a leaky faucet"
// Note, if the weapon can have an extra
// round in the chamber, account for this
// in this listing
#define CLIP_BERETTA 15
#define CLIP_COLT 12
#define CLIP_DEAGLE 7
#define CLIP_RUGER 5
#define CLIP_HANDCANNON 5
#define CLIP_SAWEDOFF 2
#define CLIP_MOSSBERG 8
#define CLIP_WINCHESTER 6
#define CLIP_SMG9 24
#define CLIP_FNFAL 20
#define CLIP_TOMMYGUN 50
#define CLIP_JACKHAMMER 10
#define CLIP_G11 45
#define CLIP_BOLTRIFLE 5
#define CLIP_STEN 30
#define GIVE_BERETTA CLIP_BERETTA*2
#define GIVE_COLT CLIP_COLT*2
#define GIVE_DEAGLE CLIP_DEAGLE*2
#define GIVE_RUGER CLIP_RUGER*2
#define GIVE_HANDCANNON CLIP_HANDCANNON*2
#define GIVE_BUCKSHOT 8*2
#define GIVE_SMG9 CLIP_SMG9*2
#define GIVE_FNFAL CLIP_FNFAL*2
#define GIVE_TOMMYGUN CLIP_TOMMYGUN*2
#define GIVE_JACKHAMMER CLIP_JACKHAMMER*2
#define GIVE_G11 CLIP_G11*2
#define GIVE_BOLTRIFLE CLIP_BOLTRIFLE*2
#define GIVE_STEN CLIP_STEN*2
#define GIVE_WINCHESTER CLIP_WINCHESTER*2
#define GIVE_JACKHAMMER CLIP_JACKHAMMER*2
#define AMMO_MAX_BERETTA 120
#define AMMO_MAX_COLT 96
#define AMMO_MAX_DEAGLE 56
#define AMMO_MAX_RUGER 25
#define AMMO_MAX_HANDCANNON 20
#define AMMO_MAX_BUCKSHOT 16
#define AMMO_MAX_SMG9 100
#define AMMO_MAX_FNFAL 80
#define AMMO_MAX_TOMMYGUN 150
#define AMMO_MAX_JACKHAMMER 30
#define AMMO_MAX_G11 135
#define AMMO_MAX_BOLTRIFLE 15
#define AMMO_MAX_STEN 90
#define AMMO_MAX_WINCHESTER 24
#define AMMO_MAX_JACKHAMMER 30
#define AMMO_MAX_MOLOTOVCOCKTAIL 5
#define AMMO_MAX_FRAGGRENADE 5
#define AMMO_MAX_PIPEBOMB 5
#define AMMO_MAX_THROWINGKNIFE 10
#define AMMO_MAX_SPEARS 5
#define AMMO_GIVE_BERETTA CLIP_BERETTA
#define AMMO_GIVE_COLT CLIP_COLT
#define AMMO_GIVE_DEAGLE CLIP_DEAGLE
#define AMMO_GIVE_RUGER CLIP_RUGER
#define AMMO_GIVE_HANDCANNON CLIP_HANDCANNON
#define AMMO_GIVE_BUCKSHOT 8
#define AMMO_GIVE_SMG9 CLIP_SMG9
#define AMMO_GIVE_FNFAL CLIP_FNFAL*2
#define AMMO_GIVE_TOMMYGUN CLIP_TOMMYGUN
#define AMMO_GIVE_JACKHAMMER CLIP_JACKHAMMER
#define AMMO_GIVE_G11 CLIP_G11
#define AMMO_GIVE_BOLTRIFLE CLIP_BOLTRIFLE
#define AMMO_GIVE_STEN CLIP_STEN
#define AMMO_GIVE_WINCHESTER CLIP_WINCHESTER
#define AMMO_GIVE_JACKHAMMER CLIP_JACKHAMMER
class CWasteWeapon : public CBasePlayerWeapon
{
public:
void Spawn();
void ItemPostFrame();
// Extend in child classes
virtual void SpecialMode();
virtual BOOL UseDecrement( void );
2023-09-06 00:35:50 +00:00
virtual const char *szGetDeathNoticeString(){ return ""; } // The death message to send to clients
virtual float flGetTiltedDamage(){ return 0; } // The weapon returns its own damage based on several variables, including state code
virtual int iGetWeight(); // How heavy is this weapon?
// Replication of member variables, if needed
virtual void PackWeapon(void *weapon_data){}
virtual void UnpackWeapon(void *weapon_data){}
// Used server side
virtual BOOL bLaserActive(){ return FALSE; }
};
class CWasteAmmo : public CBasePlayerAmmo
{
public:
};
/*************
Sidearms - included in both client and game dll, tw_sidearms.cpp
*************/
#define SIDEARM_SHOOT 0
#define SIDEARM_AIM 2
#define SIDEARM_JUMPPENALTY 1.2 // Accuracy infraction for jumping shooters.
#define SIDEARM_DUCKPENALTY 0.45 // Not really a penalty, increases accuracy if your duckin
#define SIDEARM_AIMPENALTY 1.75 // Modifier for accuracy and rate of fire if your aiming.
#define MOVING_AIMPENALTY 1.1
class CSidearm : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
void ItemPostFrame();
void PrimaryAttack();
void SecondaryAttack();
void SpecialMode();
virtual void SetState(int statenum);
virtual void PistolFire(float spread,float rof);
virtual void SwingWeapon();
void Reload();
void Holster( int skiplocal = 0 );
virtual int GetWhipDmg(){ return 0; }
BOOL Deploy();
BOOL PlayEmptySound();
void WeaponIdle();
void Drop();
// Replication
virtual void PackWeapon(void *weapon_data);
virtual void UnpackWeapon(void *weapon_data);
// Global Vars
unsigned short m_usFire1;
int m_iExtraRound; // If true allows for an extra ammo in the gun.
// damage values. these should vary from gun to gun.
int m_iBulletType;
int m_iClipSize;
float m_fAccuracy;
float m_fRateOfFire;
int m_iAllowFire; // Semi-Auto mode(detect input)
int m_iState; // Whip, Aim, or Shoot?
int m_iOldState;
2023-09-06 00:35:50 +00:00
virtual const char *GetAnimPlayer(){return ""; } // Used so the player knows what weapon animation to play.
virtual const char *GetModelV() { return ""; }
virtual const char *GetModelP() { return ""; }
virtual const char *GetModelW() { return ""; }
private:
// hacks to handle aim mode (animations)
BOOL m_bAimReload;
};
class CBeretta : public CSidearm
{
public:
void Spawn();
void Precache();
int iItemSlot( void ){ return 1; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void AttachToPlayer( CBasePlayer *pPlayer );
2023-09-06 00:35:50 +00:00
const char *GetAnimPlayer(){ return "onehanded"; }
const char *GetModelV(){ return "models/v_beretta.mdl"; }
const char *GetModelP(){ return "models/p_beretta.mdl"; }
const char *GetModelW(){ return "models/w_beretta.mdl"; }
2023-09-06 00:35:50 +00:00
const char *GetSoundEmpty(){ return "weapons/beretta_fire_empty.wav"; }
const char *GetSoundReload1(){ return "weapons/beretta_reload1.wav"; }
const char *GetSoundReload2(){ return "weapons/beretta_reload2.wav"; }
const char *GetSoundReloadNotEmpty(){ return "weapons/beretta_reload_not_empty.wav"; }
const char *GetSoundDraw1(){ return "weapons/beretta_draw.wav"; }
const char *GetSoundDraw2(){ return GetSoundDraw1(); }
int GetWhipDmg(){ return BERETTA_DMG_WHIP; }
};
class CBerettaAmmo : public CWasteAmmo
{
public:
void Spawn( void );
void Precache( void );
BOOL AddAmmo( CBaseEntity *pOther );
};
class CColt : public CSidearm
{
public:
void Spawn();
void Precache();
int iItemSlot( void ){ return 2; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
2023-09-06 00:35:50 +00:00
const char *GetAnimPlayer(){ return "onehanded"; }
const char *GetModelV(){ return "models/v_colt.mdl"; }
const char *GetModelP(){ return "models/p_colt.mdl"; }
const char *GetModelW(){ return "models/w_colt.mdl"; }
int GetWhipDmg(){ return COLT_DMG_WHIP; }
};
class CColtAmmo : public CWasteAmmo
{
public:
void Spawn( void );
void Precache( void );
BOOL AddAmmo(CBaseEntity *pOther);
};
class CDesertEagle : public CSidearm
{
public:
void Spawn();
void Precache();
int iItemSlot( void ){ return 3; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void SwingWeapon();
2023-09-06 00:35:50 +00:00
const char *GetAnimPlayer(){ return "onehanded"; }
const char *GetModelV(){ return "models/v_deagle.mdl"; }
const char *GetModelP(){ return "models/p_deagle.mdl"; }
const char *GetModelW(){ return "models/w_deagle.mdl"; }
int GetWhipDmg(){ return DEAGLE_DMG_WHIP; }
};
class CDesertEagleAmmo : public CWasteAmmo
{
public:
void Spawn( void );
void Precache( void );
BOOL AddAmmo(CBaseEntity *pOther);
};
// Accuracy and Rate of Fire modifications if a Ruger is zoomed in.
#define RUGER_AIMACC 2.50
#define RUGER_AIMROF 2.00
class CRuger : public CSidearm
{
public:
void Spawn();
void Precache();
int iItemSlot( void ){ return 4; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
void ItemPostFrame();
void PistolFire(float spread,float rof);
void SwingWeapon();
void SpecialMode();
void SecondaryAttack();
void Reload();
void WeaponIdle();
void Holster(int skiplocal = 0);
BOOL Deploy();
void SetState(int statenum);
2023-09-06 00:35:50 +00:00
const char *GetAnimPlayer(){ return "onehanded"; }
const char *GetModelV(){ return "models/v_ruger.mdl"; }
const char *GetModelP(){ return "models/p_ruger.mdl"; }
const char *GetModelW(){ return "models/w_ruger.mdl"; }
int GetWhipDmg(){ return 0; }
// vars
BOOL m_bInZoom;
BOOL m_bStartZoom;
private:
void ClientSway();
};
class CRugerAmmo : public CWasteAmmo
{
public:
void Spawn( void );
void Precache( void );
BOOL AddAmmo(CBaseEntity *pOther);
};
#define HANDCANNON_JUMPPENALTY 2.5 // Accuracy infraction for jumping shooters.
#define HANDCANNON_DUCKPENALTY 0.45 // Not really a penalty, increases accuracy if your duckin
#define HANDCANNON_LASERPENALTY 1.75 // Modifier for accuracy and rate of fire if your aiming.
// Granted this is a sidearm, however
// The code for it is much different.
// Code reuse here wouldnt be that smart
// methinks. :)
class CHandcannon : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 5; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
void PrimaryAttack();
void SecondaryAttack();
void ItemPostFrame();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
void WeaponIdle();
void Holster(int skiplocal = 0);
// Used server side
virtual BOOL bLaserActive();
private:
unsigned short m_usFire1;
// damage values. these should vary from gun to gun.
int m_iBulletType;
int m_iClipSize;
float m_fAccuracy;
float m_fRateOfFire;
int m_iAllowFire; // Semi-Auto mode(detect input)
BOOL m_bLaserVisible;
};
class CHandcannonAmmo : public CWasteAmmo
{
public:
void Spawn( void );
void Precache( void );
BOOL AddAmmo(CBaseEntity *pOther);
};
/*************
Shotguns - included in both client and game dll, tw_shotguns.cpp
*************/
class CShotgun : public CWasteWeapon // Pump shotgun
{
public:
int GetItemInfo(ItemInfo *p);
void ItemPostFrame();
void WeaponIdle();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
// vars
int m_iBulletType;
int m_iClipSize;
int m_iAllowFire;
int m_iState;
int m_iReloadState;
unsigned int m_usFire1;
};
class CShotgunAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
#define MOSSBERG_SHOTCOUNT 8
#define MOSSBERG_SPREAD 0.055
class CMossberg : public CShotgun
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 1; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
void WeaponIdle();
void Holster(int skiplocal = 0);
};
#define WINCHESTER_SPREAD 0.030
class CWinchester : public CShotgun
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 2; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
};
class CWinchesterAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CSawedOff : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
int iItemSlot(){ return 6; }
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void FireShotgun(int barrels);
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
void ItemPostFrame();
private:
// vars
int m_iBulletType;
int m_iClipSize;
int m_iAllowFire;
float m_flEjectShell;
unsigned int m_usFire1;
};
class CJackHammer : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
int iItemSlot(){ return 3; }
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
private:
int m_iClipSize;
unsigned int m_usFire1;
};
class CJackHammerAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
/*************
Automatic Weapons
*************/
class CAutomatic : public CWasteWeapon
{
public:
int GetItemInfo(ItemInfo *p);
void ItemPostFrame();
void Holster(int skiplocal = 0);
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
protected:
unsigned int m_usFire1;
int m_iBulletType;
int m_iClipSize;
int m_iState;
int m_iAllowFire;
float m_flAccuracy;
float m_flRateOfFire;
};
class CSmg9 : public CAutomatic
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 3; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void ItemPostFrame();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
void Holster(int skiplocal = 0);
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
// Used server side
virtual BOOL bLaserActive();
private:
BOOL m_bBurstFire;
BOOL m_bLaserVisible;
};
class CSmg9Ammo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CFnFal : public CAutomatic
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 1; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void SpecialMode();
void ItemPostFrame();
void Reload();
BOOL Deploy();
void Holster(int skiplocal = 0);
BOOL PlayEmptySound();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
private:
BOOL m_iAim; // Currently in aim mode
};
class CFnFalAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CTommyGun : public CAutomatic
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 2; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
};
class CTommyGunAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CG11 : public CAutomatic
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 4; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void SpecialMode();
void ItemPostFrame();
void ClientSway();
void Reload();
BOOL Deploy();
void Holster( int skiplocal = 0 );
BOOL PlayEmptySound();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
private:
int m_iWeaponState;
float m_flBurstAccuracy;
BOOL m_bThermal;
BOOL m_bActivateThermal; // Delay thermal activation
};
class CG11Ammo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CBoltRifle : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 4; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void SpecialMode();
void ClientSway();
void ItemPostFrame();
void Reload();
BOOL Deploy();
void Holster(int skiplocal = 0);
BOOL PlayEmptySound();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
private:
int m_iBulletType;
int m_iClipSize;
int m_iAllowFire;
int m_iState;
unsigned int m_usFire1;
BOOL m_bReZoom;
};
class CBoltRifleAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
class CSten : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 5; }
int GetItemInfo(ItemInfo *p);
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void ItemPostFrame();
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
BOOL PlayEmptySound();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
private:
int m_iClipSize;
int m_iBulletType;
int m_iState;
int m_iAllowFire;
unsigned int m_usFire1;
BOOL m_bOverheated;
};
class CStenAmmo : public CWasteAmmo
{
public:
void Spawn();
void Precache();
BOOL AddAmmo(CBaseEntity *pOther);
};
/*************
Explosives
*************/
class CMolotovCocktail : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 1; }
int GetItemInfo(ItemInfo *p);
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void AttachToPlayer(CBasePlayer *pPlayer);
int AddDuplicate(CBasePlayerItem *pItem);
float flGetTiltedDamage();
void PrimaryAttack();
void ItemPostFrame();
void ThrowMolotov();
BOOL Deploy();
BOOL CanHolster();
void Holster(int skiplocal = 0);
private:
float m_flStartAttack;
unsigned short m_usFire1;
BOOL m_bJustThrown;
};
class CTimedExplosiveWeapon : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo( ItemInfo *p );
float flGetTiltedDamage();
void ItemPostFrame();
void PrimaryAttack();
void SecondaryAttack();
virtual void ThrowExplosive(float flFuse);
BOOL CanHolster();
void Holster( int skiplocal = 0 );
float m_flStartAttack;
float m_flFuseTimer; // How long does the fuse last on this explosive?
float m_flDamage; // How much damage do our explosives dish out ?
float m_flResistance; // Air resistance
char *m_pszExplosiveModel; // What does our explosive look like ?
BOOL m_bFusePrimed; // TRUE if the bomb we are holding is ticking!
int m_iExplosiveType; // Explosive class to use
unsigned short m_usExplosive;
BOOL m_bJustThrown;
};
class CFragGrenade : public CTimedExplosiveWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 2; }
int GetItemInfo(ItemInfo *p);
void AttachToPlayer(CBasePlayer *pPlayer);
int AddDuplicate(CBasePlayerItem *pItem);
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void ItemPostFrame();
void ThrowExplosive(float flFuse);
BOOL Deploy();
};
class CPipebomb : public CTimedExplosiveWeapon
{
public:
void Spawn();
void Precache();
int iItemSlot(){ return 3; }
int GetItemInfo(ItemInfo *p);
void AttachToPlayer(CBasePlayer *pPlayer);
int AddDuplicate(CBasePlayerItem *pItem);
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
void ItemPostFrame();
void ThrowExplosive(float flFuse);
BOOL Deploy();
};
/*************
Melee Weapons
*************/
class CMeleeWeapon : public CWasteWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
float flGetAngleDamage(float flDamage,CBaseEntity *pEntity);
virtual CBaseEntity *SwingWeapon( float flKickback = 0.0f );
virtual void PlayHitSound();
BOOL PlayEmptySound();
2023-09-06 00:35:50 +00:00
virtual const char *pszGetViewModel() = 0;
virtual const char *pszGetPlayerModel() = 0;
virtual const char *pszGetWorldModel() = 0;
virtual int iGetDamageType() = 0;
virtual float flGetRange() = 0;
unsigned short m_usFire1;
};
class CThrowingWeapon : public CWasteWeapon
{
public:
void Precache();
int GetItemInfo(ItemInfo *p);
void AttachToPlayer(CBasePlayer *pPlayer);
int AddDuplicate(CBasePlayerItem *pItem);
void ItemPostFrame();
BOOL CanHolster();
void Holster( int skiplocal = 0 );
virtual void ThrowObject() = 0;
virtual int iGetMaxAmmo() = 0;
2023-09-06 00:35:50 +00:00
virtual const char *pszGetAmmoName() = 0;
float m_flStartAttack;
BOOL m_bJustThrown;
};
class CCombatKnife : public CMeleeWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 1; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
BOOL Deploy();
void WeaponIdle();
2023-09-06 00:35:50 +00:00
const char *pszGetViewModel(){ return "models/v_combatknife.mdl"; }
const char *pszGetPlayerModel(){ return "models/p_combatknife.mdl"; }
const char *pszGetWorldModel(){ return "models/w_combatknife.mdl"; }
int iGetDamageType(){ return DMG_CLUB|DMG_NEVERGIB; }
float flGetRange(){ return 32.0f; }
private:
BOOL m_bSecondaryAttack; // set for flGetTiltedDamage
};
class CBaseballBat : public CMeleeWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 3; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
BOOL Deploy();
void WeaponIdle();
2023-09-06 00:35:50 +00:00
const char *pszGetViewModel(){ return "models/v_baseballbat.mdl"; }
const char *pszGetPlayerModel(){ return "models/p_baseballbat.mdl"; }
const char *pszGetWorldModel(){ return "models/w_baseballbat.mdl"; }
int iGetDamageType(){ return DMG_CLUB|DMG_NEVERGIB; }
float flGetRange(){ return 48.0f; }
};
class CSledgeHammer : public CMeleeWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 4; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
BOOL Deploy();
void WeaponIdle();
2023-09-06 00:35:50 +00:00
const char *pszGetViewModel(){ return "models/v_sledge.mdl"; }
const char *pszGetPlayerModel(){ return "models/p_sledge.mdl"; }
const char *pszGetWorldModel(){ return "models/w_sledge.mdl"; }
int iGetDamageType(){ return DMG_CLUB; }
float flGetRange(){ return 48.0f; }
};
class CKatana : public CMeleeWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 5; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void SecondaryAttack();
BOOL Deploy();
void Holster(int skiplocal = 0);
void WeaponIdle();
2023-09-06 00:35:50 +00:00
const char *pszGetViewModel(){ return "models/v_katana.mdl"; }
const char *pszGetPlayerModel(){ return "models/p_katana.mdl"; }
const char *pszGetWorldModel(){ return "models/w_katana.mdl"; }
int iGetDamageType(){ return DMG_CLUB|DMG_NEVERGIB; }
float flGetRange();
// Replication
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
private:
int m_iState;
};
class CThrowingKnife : public CThrowingWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 2; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PrimaryAttack();
void ItemPostFrame();
void ThrowObject();
BOOL Deploy();
void WeaponIdle();
int iGetMaxAmmo(){ return AMMO_MAX_THROWINGKNIFE; }
2023-09-06 00:35:50 +00:00
const char *pszGetAmmoName(){ return "ThrowingKnives"; }
};
class CSpear : public CThrowingWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 6; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void SwingWeapon();
void ThrowObject();
void PrimaryAttack();
void SecondaryAttack();
void ItemPostFrame();
BOOL Deploy();
void WeaponIdle();
int iGetMaxAmmo(){ return AMMO_MAX_SPEARS; }
2023-09-06 00:35:50 +00:00
const char *pszGetAmmoName(){ return "Spears"; }
private:
unsigned short m_usFire1;
};
class CCattleProd : public CMeleeWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo(ItemInfo *p);
int iItemSlot(){ return 7; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void PlayHitSound();
void PrimaryAttack();
BOOL Deploy();
void WeaponIdle();
2023-09-06 00:35:50 +00:00
const char *pszGetViewModel(){ return "models/v_cattleprod.mdl"; }
const char *pszGetPlayerModel(){ return "models/p_cattleprod.mdl"; }
const char *pszGetWorldModel(){ return "models/w_cattleprod.mdl"; }
int iGetDamageType(){ return DMG_SHOCK|DMG_CLUB|DMG_NEVERGIB; }
float flGetRange();
};
/*************
Akimbo Weapons
*************/
class CAkimboWeapon : public CWasteWeapon
{
public:
void Spawn();
int GetItemInfo(ItemInfo *p);
void PackWeapon(void *weapon_data);
void UnpackWeapon(void *weapon_data);
void ItemPostFrame();
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL PlayEmptySound();
void WeaponIdle();
unsigned short m_usFire1;
int m_iBulletType;
int m_iClipSize;
float m_fAccuracy;
float m_fRateOfFire;
BOOL m_bSlowFire;
int m_iCurrentHand; // which hand is firing ?
};
class CAkimboBerettas : public CAkimboWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo( ItemInfo *p );
int iItemSlot(){ return 1; };
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
BOOL Deploy();
};
class CAkimboColts : public CAkimboWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo( ItemInfo *p );
int iItemSlot(){ return 2; };
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
BOOL Deploy();
};
class CAkimboDeagles : public CAkimboWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo( ItemInfo *p );
int iItemSlot(){ return 3; };
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
BOOL Deploy();
};
class CAkimboSawedOffs : public CAkimboWeapon
{
public:
void Spawn();
void Precache();
int GetItemInfo( ItemInfo *p );
int iItemSlot(){ return 4; }
float flGetTiltedDamage();
2023-09-06 00:35:50 +00:00
const char *szGetDeathNoticeString();
void ItemPostFrame();
void FireSawedOffs( int iShellsFired );
void PrimaryAttack();
void SecondaryAttack();
void Reload();
BOOL Deploy();
int m_iAllowFire;
};
/***
*
*
* Player - wasteplayer.cpp
*
*
***/
#define MODIFY_PLAYER_SPEED(pPlayer,fSpeed) pPlayer->pev->fuser1 = fSpeed
#define HALT_PLAYER(pPlayer,fPercent,fReductionFactor) pPlayer->pev->fuser3 = fReductionFactor; pPlayer->pev->fuser2 = fPercent
#define CRIPPLE_PLAYER(pPlayer,fPercent) HALT_PLAYER(pPlayer,fPercent,-0.3f)
/***
*
*
* Utility Code
*
*
***/
#ifdef CLIENT_DLL
// General event code
void CenterPrint(const char*); // Client side print to center
int GetLocalPlayerIndex(); // get local player index
extern int g_iClientLasersEnabled[32]; // Render client side laser dot
// Viewport
void V_SetSway(float scale);
void V_StopSway();
void V_DisableFade();
extern int ev_thermal; // Thermal Vision toggle
// Other
extern int g_runfuncs;
#else
// Server side only
extern int gmsgLaserInfo; // Used by some weapons with laser sites
#endif
void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity );
2023-09-06 00:35:50 +00:00
#endif