diff options
Diffstat (limited to '')
-rw-r--r-- | src/weapons/Weapon.cpp | 2 | ||||
-rw-r--r-- | src/weapons/Weapon.h | 24 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.cpp | 14 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.h | 45 |
4 files changed, 84 insertions, 1 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 22ae595a..fea09245 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -2,3 +2,5 @@ #include "patcher.h" #include "Weapon.h" +WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); } +WRAPPER void CWeapon::AddGunshell(CEntity*, CVector const&, CVector2D const&, float) { EAXJMP(0x55F770); }
\ No newline at end of file diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index 0fab027b..87134929 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -1,4 +1,5 @@ #pragma once +#include "Entity.h" enum eWeaponType { @@ -18,14 +19,35 @@ enum eWeaponType WEAPONTYPE_HELICANNON }; +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 +}; + class CWeapon { public: eWeaponType m_eWeaponType; - int32 m_eWeaponState; + eWeaponState m_eWeaponState; int32 m_nAmmoInClip; int32 m_nAmmoTotal; int32 m_nTimer; bool m_bAddRotOffset; + + bool Fire(CEntity*, CVector*); + static void AddGunshell(CEntity*, CVector const&, CVector2D const&, float); }; static_assert(sizeof(CWeapon) == 0x18, "CWeapon: error"); diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp new file mode 100644 index 00000000..155425b5 --- /dev/null +++ b/src/weapons/WeaponInfo.cpp @@ -0,0 +1,14 @@ +#include "common.h" +#include "patcher.h" +#include "WeaponInfo.h" + +CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC; + +CWeaponInfo* +CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) { + return &CWeaponInfo::ms_apWeaponInfos[weaponType]; +} + +STARTPATCHES + InjectHook(0x564FD0, &CWeaponInfo::GetWeaponInfo, PATCH_JUMP); +ENDPATCHES
\ No newline at end of file diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h new file mode 100644 index 00000000..34790565 --- /dev/null +++ b/src/weapons/WeaponInfo.h @@ -0,0 +1,45 @@ +#pragma once +#include "common.h" +#include "Weapon.h" +#include "AnimManager.h" + +class CWeaponInfo { +public: + eWeaponFire m_eWeaponFire; + float m_fRange; + uint32 m_nFiringRate; + uint32 m_nReload; + uint32 m_nAmountofAmmunition; + uint32 m_nDamage; + float m_fSpeed; + float m_fRadius; + float m_fLifespan; + float m_fSpread; + CVector m_vecFireOffset; + AnimationId m_AnimToPlay; + AnimationId m_Anim2ToPlay; + float m_fAnimLoopStart; + float m_fAnimLoopEnd; + float m_fAnimFrameFire; + float m_fAnim2FrameFire; + int32 m_nModelId; + // flags + uint8 m_bUseGravity : 1; + uint8 m_bSlowsDown : 1; + uint8 m_bDissipates : 1; + uint8 m_bRandSpeed : 1; + uint8 m_bExpands : 1; + uint8 m_bExplodes : 1; + uint8 m_bCanAim : 1; + uint8 m_bCanAimWithArm : 1; + uint8 m_b1stPerson : 1; + uint8 m_bHeavy : 1; + uint8 m_bThrow : 1; + uint8 stuff; + + static CWeaponInfo (&ms_apWeaponInfos)[14]; + + static CWeaponInfo *GetWeaponInfo(eWeaponType weaponType); +}; + +static_assert(sizeof(CWeaponInfo) == 0x54, "CWeaponInfo: error");
\ No newline at end of file |