2019-05-29 16:06:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-04-19 16:34:08 +00:00
|
|
|
#include "WeaponType.h"
|
|
|
|
|
2020-06-15 22:38:26 +00:00
|
|
|
#define CAR_DRIVEBYAUTOAIMING_MAXDIST (2.5f)
|
2020-04-15 05:03:53 +00:00
|
|
|
#define DOOMAUTOAIMING_MAXDIST (9000.0f)
|
|
|
|
|
2019-07-23 14:39:30 +00:00
|
|
|
class CEntity;
|
2020-04-15 05:03:53 +00:00
|
|
|
class CPhysical;
|
2020-05-17 17:36:48 +00:00
|
|
|
class CVehicle;
|
|
|
|
class CPed;
|
2020-04-15 05:03:53 +00:00
|
|
|
struct CColPoint;
|
|
|
|
class CWeaponInfo;
|
2019-07-23 14:39:30 +00:00
|
|
|
|
2019-05-29 16:06:33 +00:00
|
|
|
class CWeapon
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
eWeaponType m_eWeaponType;
|
2019-06-20 11:22:44 +00:00
|
|
|
eWeaponState m_eWeaponState;
|
2020-05-16 12:07:09 +00:00
|
|
|
int32 m_nAmmoInClip;
|
|
|
|
int32 m_nAmmoTotal;
|
2019-07-01 19:46:44 +00:00
|
|
|
uint32 m_nTimer;
|
2019-05-29 16:06:33 +00:00
|
|
|
bool m_bAddRotOffset;
|
2020-08-27 16:52:43 +00:00
|
|
|
|
|
|
|
static bool bPhotographHasBeenTaken;
|
|
|
|
|
2019-06-30 21:50:40 +00:00
|
|
|
CWeapon() {
|
|
|
|
m_bAddRotOffset = false;
|
|
|
|
}
|
2020-05-31 15:05:49 +00:00
|
|
|
CWeapon(eWeaponType type, int32 ammo);
|
2020-04-15 05:03:53 +00:00
|
|
|
|
|
|
|
CWeaponInfo *GetInfo();
|
2019-06-30 21:50:40 +00:00
|
|
|
|
2020-04-15 05:03:53 +00:00
|
|
|
static void InitialiseWeapons(void);
|
|
|
|
static void ShutdownWeapons (void);
|
|
|
|
static void UpdateWeapons (void);
|
|
|
|
|
|
|
|
void Initialise(eWeaponType type, int32 ammo);
|
2020-05-15 14:30:25 +00:00
|
|
|
void Shutdown();
|
2020-04-15 05:03:53 +00:00
|
|
|
|
|
|
|
bool Fire (CEntity *shooter, CVector *fireSource);
|
2020-06-06 22:01:48 +00:00
|
|
|
bool FireFromCar (CVehicle *shooter, bool left, bool right);
|
2020-04-15 05:03:53 +00:00
|
|
|
bool FireMelee (CEntity *shooter, CVector &fireSource);
|
|
|
|
bool FireInstantHit(CEntity *shooter, CVector *fireSource);
|
|
|
|
|
2020-08-27 16:52:43 +00:00
|
|
|
static void AddGunFlashBigGuns(CVector start, CVector end);
|
2020-04-15 05:03:53 +00:00
|
|
|
void AddGunshell (CEntity *shooter, CVector const &source, CVector2D const &direction, float size);
|
|
|
|
void DoBulletImpact(CEntity *shooter, CEntity *victim, CVector *source, CVector *target, CColPoint *point, CVector2D ahead);
|
|
|
|
|
|
|
|
bool FireShotgun (CEntity *shooter, CVector *fireSource);
|
|
|
|
bool FireProjectile(CEntity *shooter, CVector *fireSource, float power);
|
|
|
|
|
|
|
|
static void GenerateFlameThrowerParticles(CVector pos, CVector dir);
|
|
|
|
|
|
|
|
bool FireAreaEffect (CEntity *shooter, CVector *fireSource);
|
2020-08-27 16:52:43 +00:00
|
|
|
bool LaserScopeDot (CVector *pOutPos, float *pOutSize);
|
2020-04-15 05:03:53 +00:00
|
|
|
bool FireSniper (CEntity *shooter);
|
2020-08-27 16:52:43 +00:00
|
|
|
bool TakePhotograph (CEntity *shooter);
|
2020-04-15 05:03:53 +00:00
|
|
|
bool FireM16_1stPerson (CEntity *shooter);
|
2020-06-06 22:01:48 +00:00
|
|
|
bool FireInstantHitFromCar(CVehicle *shooter, bool left, bool right);
|
2020-04-15 05:03:53 +00:00
|
|
|
|
2020-08-27 16:52:43 +00:00
|
|
|
static void DoDoomAiming (CEntity *shooter, CVector *source, CVector *target);
|
|
|
|
static void DoTankDoomAiming (CEntity *shooter, CEntity *driver, CVector *source, CVector *target);
|
|
|
|
static void DoDriveByAutoAiming(CEntity *driver, CVehicle *vehicle, CVector *source, CVector *target);
|
2020-04-15 05:03:53 +00:00
|
|
|
|
2019-06-30 21:50:40 +00:00
|
|
|
void Reload(void);
|
2020-05-17 17:36:48 +00:00
|
|
|
void Update(int32 audioEntity, CPed *pedToAdjustSound);
|
2020-04-15 05:03:53 +00:00
|
|
|
bool IsTypeMelee (void);
|
2019-07-15 12:11:40 +00:00
|
|
|
bool IsType2Handed(void);
|
2020-04-15 05:03:53 +00:00
|
|
|
|
|
|
|
static void MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target);
|
|
|
|
|
|
|
|
bool HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo);
|
|
|
|
static void BlowUpExplosiveThings(CEntity *thing);
|
2020-01-07 14:23:09 +00:00
|
|
|
bool HasWeaponAmmoToBeUsed(void);
|
2020-04-15 05:03:53 +00:00
|
|
|
|
2020-05-23 13:53:20 +00:00
|
|
|
static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; }
|
|
|
|
|
2020-04-15 05:03:53 +00:00
|
|
|
static bool ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects);
|
2020-05-02 15:02:17 +00:00
|
|
|
|
2020-08-27 16:52:43 +00:00
|
|
|
static void CheckForShootingVehicleOccupant(CEntity **victim, CColPoint *point, eWeaponType weapon, CVector const& source, CVector const& target);
|
2020-06-20 13:23:32 +00:00
|
|
|
|
2020-05-02 15:02:17 +00:00
|
|
|
#ifdef COMPATIBLE_SAVES
|
|
|
|
void Save(uint8*& buf);
|
|
|
|
void Load(uint8*& buf);
|
|
|
|
#endif
|
2019-05-29 16:06:33 +00:00
|
|
|
};
|
2020-04-15 05:03:53 +00:00
|
|
|
VALIDATE_SIZE(CWeapon, 0x18);
|
2020-03-31 22:58:40 +00:00
|
|
|
|
2020-04-15 05:03:53 +00:00
|
|
|
void FireOneInstantHitRound(CVector *source, CVector *target, int32 damage);
|