2019-05-29 16:06:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-07-04 20:31:21 +00:00
|
|
|
enum eWeaponType
|
2019-05-29 16:06:33 +00:00
|
|
|
{
|
2019-07-04 20:31:21 +00:00
|
|
|
WEAPONTYPE_UNARMED,
|
2019-05-29 16:06:33 +00:00
|
|
|
WEAPONTYPE_BASEBALLBAT,
|
|
|
|
WEAPONTYPE_COLT45,
|
|
|
|
WEAPONTYPE_UZI,
|
|
|
|
WEAPONTYPE_SHOTGUN,
|
|
|
|
WEAPONTYPE_AK47,
|
|
|
|
WEAPONTYPE_M16,
|
|
|
|
WEAPONTYPE_SNIPERRIFLE,
|
|
|
|
WEAPONTYPE_ROCKETLAUNCHER,
|
|
|
|
WEAPONTYPE_FLAMETHROWER,
|
|
|
|
WEAPONTYPE_MOLOTOV,
|
|
|
|
WEAPONTYPE_GRENADE,
|
|
|
|
WEAPONTYPE_DETONATOR,
|
2020-03-28 20:55:23 +00:00
|
|
|
WEAPONTYPE_HELICANNON,
|
|
|
|
WEAPONTYPE_LAST_WEAPONTYPE,
|
2019-07-04 20:31:21 +00:00
|
|
|
WEAPONTYPE_ARMOUR,
|
|
|
|
WEAPONTYPE_RAMMEDBYCAR,
|
|
|
|
WEAPONTYPE_RUNOVERBYCAR,
|
|
|
|
WEAPONTYPE_EXPLOSION,
|
|
|
|
WEAPONTYPE_UZI_DRIVEBY,
|
2020-03-28 20:55:23 +00:00
|
|
|
WEAPONTYPE_DROWNING,
|
|
|
|
WEAPONTYPE_FALL,
|
2019-07-04 20:31:21 +00:00
|
|
|
WEAPONTYPE_UNIDENTIFIED,
|
2020-03-28 20:55:23 +00:00
|
|
|
|
|
|
|
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
|
|
|
|
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
|
2019-05-29 16:06:33 +00:00
|
|
|
};
|
|
|
|
|
2019-06-20 11:22:44 +00:00
|
|
|
enum eWeaponFire {
|
|
|
|
WEAPON_FIRE_MELEE,
|
|
|
|
WEAPON_FIRE_INSTANT_HIT,
|
|
|
|
WEAPON_FIRE_PROJECTILE,
|
|
|
|
WEAPON_FIRE_AREA_EFFECT,
|
|
|
|
WEAPON_FIRE_USE
|
|
|
|
};
|
|
|
|
|
|
|
|
// Taken from MTA SA, seems it's unchanged
|
|
|
|
enum eWeaponState
|
|
|
|
{
|
|
|
|
WEAPONSTATE_READY,
|
|
|
|
WEAPONSTATE_FIRING,
|
|
|
|
WEAPONSTATE_RELOADING,
|
|
|
|
WEAPONSTATE_OUT_OF_AMMO,
|
|
|
|
WEAPONSTATE_MELEE_MADECONTACT
|
|
|
|
};
|
|
|
|
|
2019-07-23 14:39:30 +00:00
|
|
|
class CEntity;
|
|
|
|
class CAutomobile;
|
|
|
|
|
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;
|
2019-06-30 21:50:40 +00:00
|
|
|
uint32 m_nAmmoInClip;
|
|
|
|
uint32 m_nAmmoTotal;
|
2019-07-01 19:46:44 +00:00
|
|
|
uint32 m_nTimer;
|
2019-05-29 16:06:33 +00:00
|
|
|
bool m_bAddRotOffset;
|
2019-06-20 11:22:44 +00:00
|
|
|
|
2019-06-30 21:50:40 +00:00
|
|
|
CWeapon() {
|
|
|
|
m_bAddRotOffset = false;
|
|
|
|
}
|
|
|
|
|
2020-03-28 20:55:23 +00:00
|
|
|
static void ShutdownWeapons(void);
|
2019-06-30 21:50:40 +00:00
|
|
|
void Initialise(eWeaponType type, int ammo);
|
2019-07-23 14:39:30 +00:00
|
|
|
void Update(int32 audioEntity);
|
2019-06-30 21:50:40 +00:00
|
|
|
void Reload(void);
|
2019-06-20 11:22:44 +00:00
|
|
|
bool Fire(CEntity*, CVector*);
|
2019-07-23 14:39:30 +00:00
|
|
|
void FireFromCar(CAutomobile *car, bool left);
|
2019-06-21 18:16:51 +00:00
|
|
|
void AddGunshell(CEntity*, CVector const&, CVector2D const&, float);
|
2019-07-05 22:44:49 +00:00
|
|
|
bool IsTypeMelee(void);
|
2019-07-15 12:11:40 +00:00
|
|
|
bool IsType2Handed(void);
|
2019-07-25 14:33:37 +00:00
|
|
|
static void DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end);
|
2019-07-25 15:06:24 +00:00
|
|
|
bool HitsGround(CEntity* holder, CVector* firePos, CEntity* aimingTo);
|
2020-01-07 14:23:09 +00:00
|
|
|
bool HasWeaponAmmoToBeUsed(void);
|
2019-08-15 14:51:39 +00:00
|
|
|
static void InitialiseWeapons(void);
|
2019-10-18 22:23:40 +00:00
|
|
|
static void UpdateWeapons(void);
|
2019-05-29 16:06:33 +00:00
|
|
|
};
|
|
|
|
static_assert(sizeof(CWeapon) == 0x18, "CWeapon: error");
|
2020-03-31 22:58:40 +00:00
|
|
|
|
|
|
|
void FireOneInstantHitRound(CVector* shotSource, CVector* shotTarget, int32 damage);
|