From 078919f9cdf12b5038ec4b9dd119a37406d15db5 Mon Sep 17 00:00:00 2001 From: Quentin Date: Tue, 20 Feb 2024 23:58:42 +0100 Subject: [PATCH] updated CItemInfo (#160) --- weapon/CAmmoRocketInfo.hpp | 28 ++++++++++++++-------------- weapon/CAmmoThrownInfo.hpp | 10 +++++----- weapon/CItemInfo.hpp | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/weapon/CAmmoRocketInfo.hpp b/weapon/CAmmoRocketInfo.hpp index be83d93..b22c720 100644 --- a/weapon/CAmmoRocketInfo.hpp +++ b/weapon/CAmmoRocketInfo.hpp @@ -8,17 +8,17 @@ class CAmmoRocketInfo : public CAmmoProjectileInfo { public: - float m_forward_drag_coeff; //0x0170 - float m_side_drag_coeff; //0x0174 - float m_time_before_homing; //0x0178 - float m_time_before_switch_target_min; //0x017C - float m_time_before_switch_target_max; //0x0180 - float m_proximity_radius; //0x0184 - float m_pitch_change_rate; //0x0188 - float m_yaw_change_rate; //0x018C - float m_roll_change_rate; //0x0190 - float m_max_roll_angle_sin; //0x0194 - float m_lifetime_player_vehicle_locked_override_mp; //0x0198 - class CHomingRocketParams m_homing_rocket_params; //0x019C -}; // Size: 0x01BC -static_assert(sizeof(CAmmoRocketInfo) == 0x1BC); \ No newline at end of file + float m_forward_drag_coeff; //0x0170 + float m_side_drag_coeff; //0x0174 + float m_time_before_homing; //0x0178 + float m_time_before_switch_target_min; //0x017C + float m_time_before_switch_target_max; //0x0180 + float m_proximity_radius; //0x0184 + float m_pitch_change_rate; //0x0188 + float m_yaw_change_rate; //0x018C + float m_roll_change_rate; //0x0190 + float m_max_roll_angle_sin; //0x0194 + float m_lifetime_player_vehicle_locked_override_mp; //0x0198 + class CHomingRocketParams m_homing_rocket_params; //0x019C +}; // Size: 0x1C0 +static_assert(sizeof(CAmmoRocketInfo) == 0x1C0); \ No newline at end of file diff --git a/weapon/CAmmoThrownInfo.hpp b/weapon/CAmmoThrownInfo.hpp index f09d8e7..5cc223e 100644 --- a/weapon/CAmmoThrownInfo.hpp +++ b/weapon/CAmmoThrownInfo.hpp @@ -6,8 +6,8 @@ class CAmmoThrownInfo : CAmmoProjectileInfo { - float m_thrown_force; //0x0170 - float m_thrown_force_from_vehicle; //0x0174 - int32_t m_ammo_max_mp_bonus; //0x0178 -}; // Size: 0x017C -static_assert(sizeof(CAmmoThrownInfo) == 0x17C); \ No newline at end of file + float m_thrown_force; //0x0170 + float m_thrown_force_from_vehicle; //0x0174 + int32_t m_ammo_max_mp_bonus; //0x0178 +}; // Size: 0x0180 +static_assert(sizeof(CAmmoThrownInfo) == 0x180); \ No newline at end of file diff --git a/weapon/CItemInfo.hpp b/weapon/CItemInfo.hpp index 9431108..80b33d5 100644 --- a/weapon/CItemInfo.hpp +++ b/weapon/CItemInfo.hpp @@ -2,13 +2,37 @@ #include +class parStructure; + +// https://github.com/Parik27/V.Rainbomizer/blob/0c70868626411a1d30483339003b9985b0ff1c98/lib/CItemInfo.hh class CItemInfo { public: - char pad_0000[16]; //0x0000 - uint32_t m_name; //0x0010 - uint32_t m_model; //0x0014 - uint32_t m_audio; //0x0018 - uint32_t m_slot; //0x001C -}; //Size: 0x0020 + char pad_0000[8]; //0x0000 + uint32_t m_name; //0x0010 + uint32_t m_model; //0x0014 + uint32_t m_audio; //0x0018 + uint32_t m_slot; //0x001C + +private: + virtual void destructor(); + virtual bool GetIsClassId(uint32_t hash); + + // virtual uint32_t* GetClassId(); (older versions) + virtual uint32_t* _GetClassId(uint32_t* out); + + // Not present in older versions of GTA V + virtual uint32_t* GetBaseClassId(uint32_t& out); + + // as a result, these functions are shifted by 1 function in the vftable. + virtual uint32_t GetModel(); + + virtual parStructure* parser_GetStructure(); + +public: + uint32_t GetClassId() + { + return static_cast(uintptr_t(_GetClassId(nullptr))); + } +}; static_assert(sizeof(CItemInfo) == 0x20);