From 11e161582e1d48e026cfffbab5699cfbbf77ecb7 Mon Sep 17 00:00:00 2001 From: Yimura <24669514+Yimura@users.noreply.github.com> Date: Wed, 16 Nov 2022 19:46:11 +0100 Subject: [PATCH] feat(Vehicle): Added sub handling data (#73) --- enums/eHandlingType.hpp | 16 +++++++++ vehicle/CAdvancedData.hpp | 11 ++++++ vehicle/CBaseSubHandlingData.hpp | 11 ++++++ vehicle/CCarHandlingData.hpp | 61 ++++++++++++++++++++++++++++++++ vehicle/CHandlingData.hpp | 8 +++-- vehicle/CHandlingObject.hpp | 8 +++++ 6 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 enums/eHandlingType.hpp create mode 100644 vehicle/CAdvancedData.hpp create mode 100644 vehicle/CBaseSubHandlingData.hpp create mode 100644 vehicle/CCarHandlingData.hpp create mode 100644 vehicle/CHandlingObject.hpp diff --git a/enums/eHandlingType.hpp b/enums/eHandlingType.hpp new file mode 100644 index 0000000..7257da5 --- /dev/null +++ b/enums/eHandlingType.hpp @@ -0,0 +1,16 @@ +#pragma once + +enum class eHandlingType +{ + HANDLING_TYPE_BIKE, + HANDLING_TYPE_FLYING, + HANDLING_TYPE_VERTICAL_FLYING, + HANDLING_TYPE_BOAT, + HANDLING_TYPE_SEAPLANE, + HANDLING_TYPE_SUBMARINE, + HANDLING_TYPE_TRAIN, + HANDLING_TYPE_TRAILER, + HANDLING_TYPE_CAR, + HANDLING_TYPE_WEAPON, + HANDLING_TYPE_MAX_TYPES +}; \ No newline at end of file diff --git a/vehicle/CAdvancedData.hpp b/vehicle/CAdvancedData.hpp new file mode 100644 index 0000000..7de376f --- /dev/null +++ b/vehicle/CAdvancedData.hpp @@ -0,0 +1,11 @@ +#pragma once + +class CAdvancedData +{ +public: + virtual ~CAdvancedData() = 0; + + int m_slot; + int m_index; + float m_value; +}; \ No newline at end of file diff --git a/vehicle/CBaseSubHandlingData.hpp b/vehicle/CBaseSubHandlingData.hpp new file mode 100644 index 0000000..ba51dbb --- /dev/null +++ b/vehicle/CBaseSubHandlingData.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "CHandlingObject.hpp" +#include "../enums/eHandlingType.hpp" + +class CBaseSubHandlingData : public CHandlingObject +{ +public: + virtual eHandlingType GetHandlingType() = 0; + virtual void OnPostLoad() = 0; + +}; \ No newline at end of file diff --git a/vehicle/CCarHandlingData.hpp b/vehicle/CCarHandlingData.hpp new file mode 100644 index 0000000..a268109 --- /dev/null +++ b/vehicle/CCarHandlingData.hpp @@ -0,0 +1,61 @@ +#pragma once +#include + +#include "CAdvancedData.hpp" +#include "CBaseSubHandlingData.hpp" +#include "../rage/atArray.hpp" + +enum eAdvancedFlags +{ + NONE, + CF_DIFF_FRONT = 1 << 0, + CF_DIFF_REAR = 1 << 1, + CF_DIFF_CENTRE = 1 << 2, + CF_DIFF_LIMITED_FRONT = 1 << 3, + CF_DIFF_LIMITED_REAR = 1 << 4, + CF_DIFF_LIMITED_CENTRE = 1 << 5, + CF_DIFF_LOCKING_FRONT = 1 << 6, + CF_DIFF_LOCKING_REAR = 1 << 7, + CF_DIFF_LOCKING_CENTRE = 1 << 8, + CF_GEARBOX_FULL_AUTO = 1 << 9, + CF_GEARBOX_MANUAL = 1 << 10, + CF_GEARBOX_DIRECT_SHIFT = 1 << 11, + CF_GEARBOX_ELECTRIC = 1 << 12, + CF_ASSIST_TRACTION_CONTROL = 1 << 13, + CF_ASSIST_STABILITY_CONTROL = 1 << 14, + CF_ALLOW_REDUCED_SUSPENSION_FORCE = 1 << 15, + CF_HARD_REV_LIMIT = 1 << 16, + CF_HOLD_GEAR_WITH_WHEELSPIN = 1 << 17, + CF_INCREASE_SUSPENSION_FORCE_WITH_SPEED = 1 << 18, + CF_BLOCK_INCREASED_ROT_VELOCITY_WITH_DRIVE_FORCE = 1 << 19, + CF_REDUCED_SELF_RIGHTING_SPEED = 1 << 20, + CF_CLOSE_RATIO_GEARBOX = 1 << 21, + CF_FORCE_SMOOTH_RPM = 1 << 22, + CF_ALLOW_TURN_ON_SPOT = 1 << 23, + CF_CAN_WHEELIE = 1 << 24, + CF_ENABLE_WHEEL_BLOCKER_SIDE_IMPACTS = 1 << 25, + CF_FIX_OLD_BUGS = 1 << 26, + CF_USE_DOWNFORCE_BIAS = 1 << 27, + CF_REDUCE_BODY_ROLL_WITH_SUSPENSION_MODS = 1 << 28, + CF_ALLOWS_EXTENDED_MODS = 1 << 29 +}; + +class CCarHandlingData : public CBaseSubHandlingData +{ +public: + float m_back_end_popup_car_impulse_mult; //0x0008 + float m_back_end_popup_building_impulse_mult; //0x000C + float m_back_end_popup_max_delta_speed; //0x0010 + float m_toe_front; //0x0014 + float m_toe_rear; //0x0018 + float m_camber_front; //0x001C + float m_camber_rear; //0x0020 + float m_castor; //0x0024 + float m_engine_resistance; //0x0028 + float m_max_drive_bias_transfer; //0x002C + float m_jumpforce_scale; //0x0030 + float m_unk_034; //0x0034 + uint32_t m_unk_038; //0x0038 + uint32_t m_advanced_flags; //0x003C + rage::atArray m_advanced_data; //0x0040 +}; \ No newline at end of file diff --git a/vehicle/CHandlingData.hpp b/vehicle/CHandlingData.hpp index 636e47c..73dedda 100644 --- a/vehicle/CHandlingData.hpp +++ b/vehicle/CHandlingData.hpp @@ -1,5 +1,7 @@ #pragma once +#include "CBaseSubHandlingData.hpp" +#include "../rage/atArray.hpp" #include "../rage/vector.hpp" #include @@ -78,5 +80,7 @@ public: uint32_t m_damage_flags; //0x012C char pad_0130[12]; //0x0130 uint32_t m_ai_handling_hash; //0x013C -}; //Size: 0x0140 -static_assert(sizeof(CHandlingData) == 0x140); + char pad_140[24]; //0x140 + rage::atArray m_sub_handling_data; // 0x158 +}; //Size: 0x0160 +static_assert(sizeof(CHandlingData) == 0x168); diff --git a/vehicle/CHandlingObject.hpp b/vehicle/CHandlingObject.hpp new file mode 100644 index 0000000..b0bfef2 --- /dev/null +++ b/vehicle/CHandlingObject.hpp @@ -0,0 +1,8 @@ +#pragma once + +class CHandlingObject +{ +public: + virtual ~CHandlingObject() = 0; + virtual void* parser_GetStructure() = 0; //ret rage::parStructure +}; \ No newline at end of file