summaryrefslogtreecommitdiffstats
path: root/src/weapons
diff options
context:
space:
mode:
Diffstat (limited to 'src/weapons')
-rw-r--r--src/weapons/Weapon.cpp16
-rw-r--r--src/weapons/Weapon.h4
2 files changed, 17 insertions, 3 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 860e3ab2..8019a1cf 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -45,7 +45,7 @@ CWeapon::Reload(void)
bool
CWeapon::IsType2Handed(void)
{
- return m_eWeaponType >= WEAPONTYPE_SHOTGUN && m_eWeaponType <= WEAPONTYPE_FLAMETHROWER && m_eWeaponType != WEAPONTYPE_ROCKETLAUNCHER;
+ return m_eWeaponType >= WEAPONTYPE_SHOTGUN && m_eWeaponType <= WEAPONTYPE_FLAMETHROWER && m_eWeaponType != WEAPONTYPE_ROCKETLAUNCHER;
}
bool
@@ -88,8 +88,20 @@ CWeapon::HitsGround(CEntity *holder, CVector *firePos, CEntity *aimingTo)
return false;
}
+bool
+CWeapon::HasWeaponAmmoToBeUsed(void)
+{
+ switch (m_eWeaponType) {
+ case WEAPONTYPE_UNARMED:
+ case WEAPONTYPE_BASEBALLBAT:
+ return true;
+ default:
+ return m_nAmmoTotal != 0;
+ }
+}
+
STARTPATCHES
InjectHook(0x55C330, &CWeapon::Initialise, PATCH_JUMP);
InjectHook(0x5639D0, &CWeapon::Reload, PATCH_JUMP);
InjectHook(0x564890, &CWeapon::HitsGround, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
+ENDPATCHES
diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h
index 1663ee0d..1db66720 100644
--- a/src/weapons/Weapon.h
+++ b/src/weapons/Weapon.h
@@ -15,7 +15,8 @@ enum eWeaponType
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR,
- WEAPONTYPE_TOTAL_INVENTORY_WEAPONS,
+ WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
+ WEAPONTYPE_HELICANNON = 13,
WEAPONTYPE_TOTALWEAPONS,
WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR,
@@ -72,6 +73,7 @@ public:
bool IsType2Handed(void);
static void DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end);
bool HitsGround(CEntity* holder, CVector* firePos, CEntity* aimingTo);
+ bool HasWeaponAmmoToBeUsed(void);
static void InitialiseWeapons(void);
static void UpdateWeapons(void);
};