diff --git a/base/CNavigation.hpp b/base/CNavigation.hpp index bdfb0de..7391da5 100644 --- a/base/CNavigation.hpp +++ b/base/CNavigation.hpp @@ -1,7 +1,7 @@ #pragma once #include "../rage/vector.hpp" -#include "phArchetypeDamp.hpp" +#include "phArchetype.hpp" #pragma pack(push, 1) class CNavigation @@ -10,13 +10,7 @@ public: char pad_0000[16]; //0x0000 class rage::phArchetypeDamp* m_damp; //0x0010 char pad_0018[8]; //0x0018 - rage::fvector3 m_right; //0x0020 - char pad_002C[4]; //0x002C - rage::fvector3 m_forward; //0x0030 - char pad_003C[4]; //0x003C - rage::fvector3 m_up; //0x0040 - char pad_004C[4]; //0x004C - rage::fvector3 m_position; //0x0050 + rage::fmatrix44 m_transformation_matrix; }; //Size: 0x0060 -static_assert(sizeof(CNavigation) == 0x5C); +static_assert(sizeof(CNavigation) == 0x60); #pragma pack(pop) diff --git a/base/pgBase.hpp b/base/pgBase.hpp index 9619054..d3483f1 100644 --- a/base/pgBase.hpp +++ b/base/pgBase.hpp @@ -7,6 +7,8 @@ namespace rage { public: virtual ~pgBase() = default; + virtual int return_zero() = 0; + virtual void error() = 0; void *unk_0000; // 0x0000 }; //Size: 0x0008 diff --git a/base/phArchetype.hpp b/base/phArchetype.hpp new file mode 100644 index 0000000..4dcbe8b --- /dev/null +++ b/base/phArchetype.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "phBound.hpp" + +namespace rage +{ + class phArchetype + { + char pad_0000[32]; //0x0000 + class phBound* m_bound; //0x0020 + char pad_0028[16]; //0x0028 + }; //Size: 0x0038 + static_assert(sizeof(phArchetype) == 0x38); + + class phArchetypePhys : public phArchetype + { + char pad_0038[28]; //0x0028 + float m_water_collision; //0x0054 + char pad_0058[40]; //0x0058 + }; //Size: 0x0080 + static_assert(sizeof(phArchetypePhys) == 0x80); + + class phArchetypeDamp : public phArchetypePhys + { + public: + char pad_0080[96]; //0x0080 + }; //Size: 0x00E0 + static_assert(sizeof(phArchetypeDamp) == 0xE0); +} \ No newline at end of file diff --git a/base/phArchetypeDamp.hpp b/base/phArchetypeDamp.hpp deleted file mode 100644 index 61f70bf..0000000 --- a/base/phArchetypeDamp.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "phBoundComposite.hpp" - -namespace rage -{ - - class phArchetypeDamp - { - public: - char pad_0000[32]; //0x0000 - class phBoundComposite* m_bound_composite; //0x0020 - char pad_0028[44]; //0x0028 - float m_water_collision; //0x0054 - }; //Size: 0x0058 - static_assert(sizeof(phArchetypeDamp) == 0x58); - -} \ No newline at end of file diff --git a/base/phBound.hpp b/base/phBound.hpp new file mode 100644 index 0000000..b3a8d01 --- /dev/null +++ b/base/phBound.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include +#include "pgBase.hpp" +#include "../rage/vector.hpp" + +namespace rage { + class phBoundBase : public pgBase + { + }; + +enum class eBoundType : uint8_t +{ + SPHERE, + CAPSULE, + BOX = 3, + GEOMETRY, + BVH = 8, + COMPOSITE = 10, + DISC = 12, + CYLINDER, + PLANE = 15 +}; + +#pragma pack(push,4) + class phBound : public phBoundBase { + public: + eBoundType m_type; //0x0010 + uint8_t m_flags; //0x0011 + uint16_t m_part_index; //0x0012 + float m_radius_around_centroid; //0x0014 + char pad_0018[8]; //0x0018 + fvector4 m_bounding_box_max_xyz_margin_w; //0x0020 + fvector4 m_bounding_box_min_xyz_ref_count_w; //0x0030 + fvector4 m_centroid_offset_xyz_material_id_0_w; //0x0040 + fvector4 m_cg_offset_xyz_material_id_1_w; //0x0050 + fvector4 m_volume_distribution; //0x0060 + }; //Size: 0x0070 + static_assert(sizeof(phBound) == 0x70); +#pragma pack(pop) +} \ No newline at end of file diff --git a/base/phBoundCapsule.hpp b/base/phBoundCapsule.hpp index 1de9148..8226d36 100644 --- a/base/phBoundCapsule.hpp +++ b/base/phBoundCapsule.hpp @@ -1,14 +1,17 @@ #pragma once +#include "phBound.hpp" + namespace rage { - - class phBoundCapsule +#pragma pack(push,1) + class phBoundCapsule : public phBound { public: - char pad_0000[44]; //0x0000 - float m_collision; //0x002C - }; //Size: 0x0030 - static_assert(sizeof(phBoundCapsule) == 0x30); - + float m_capsule_half_height; + uint64_t unk_0074; + uint32_t unk_007C; + }; //Size: 0x0080 + static_assert(sizeof(phBoundCapsule) == 0x80); +#pragma pack(pop) } \ No newline at end of file diff --git a/base/phBoundCapsuleList.hpp b/base/phBoundCapsuleList.hpp deleted file mode 100644 index 83f2568..0000000 --- a/base/phBoundCapsuleList.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "phBoundCapsule.hpp" - -namespace rage -{ - - class phBoundCapsuleList - { - public: - class phBoundCapsule* m_bound_capsule; //0x0000 - }; //Size: 0x0008 - static_assert(sizeof(phBoundCapsuleList) == 0x08); - -} \ No newline at end of file diff --git a/base/phBoundComposite.hpp b/base/phBoundComposite.hpp index cff7fcc..d059b68 100644 --- a/base/phBoundComposite.hpp +++ b/base/phBoundComposite.hpp @@ -1,16 +1,26 @@ #pragma once -#include "phBoundCapsuleList.hpp" +#include +#include "phBound.hpp" +#include "../rage/vector.hpp" namespace rage { - - class phBoundComposite +#pragma pack(push,8) + class phBoundComposite : public phBound { public: - char pad_0000[112]; //0x0000 - class phBoundCapsuleList* m_bound_capsule_list; //0x0070 - }; //Size: 0x0078 - static_assert(sizeof(phBoundComposite) == 0x78); - + class phBound** m_bounds; //0x0070 + fmatrix34* m_current_matrices; //0x0078 + fmatrix34* m_last_matrices; //0x0080 + fvector3* unk_0088; //0x0088 + uint32_t* m_type_and_include_flags; //0x0090 + uint32_t* m_owned_type_and_include_flags; //0x0098 + uint16_t m_max_num_bounds; //0x00A0 + uint16_t m_num_bounds; //0x00A2 + char pad_00A4[4]; //0x00A4 + void* unk_00A8; //0x00A8 + }; //Size: 0x00B0 + static_assert(sizeof(phBoundComposite) == 0xB0); +#pragma pack(pop) } \ No newline at end of file diff --git a/entities/fwEntity.hpp b/entities/fwEntity.hpp index b27e282..83924ff 100644 --- a/entities/fwEntity.hpp +++ b/entities/fwEntity.hpp @@ -14,30 +14,23 @@ namespace rage class fwEntity : public fwExtensibleBase { public: - class CBaseModelInfo *m_model_info; - char gap28; - uint8_t m_entity_type; - char gap2A[2]; + class CBaseModelInfo *m_model_info; //0x0020 + char gap28; //0x0028 + uint8_t m_entity_type; //0x0029 + char gap2A[2]; //0x002A uint8_t m_invisible; //0x002C char gap2D[3]; //0x002D class CNavigation *m_navigation; //0x0030 char gap38[16]; //0x0038 class rage::fwDrawData *m_draw_data; //0x0048 char gap50[16]; //0x0050 - rage::fvector3 m_right; //0x0060 - char gap6C[4]; //0x006C - rage::fvector3 m_forward; //0x0070 - char gap7C[4]; //0x007C - rage::fvector3 m_up; //0x0080 - char gap8C[4]; //0x008C - rage::fvector3 m_position; //0x0090 - char gap9C[4]; // 0x009C - uint64_t qwordA0; - uint32_t dwordA8; - uint32_t dwordAC; - uint32_t dwordB0; - char gapB4[4]; - std::uint8_t byteB8; + fmatrix44 m_transformation_matrix; //0x0060 + uint64_t qwordA0; //0x00A0 + uint32_t dwordA8; //0x00A8 + uint32_t dwordAC; //0x00AC + uint32_t dwordB0; //0x00B0 + char gapB4[4]; //0x00B4 + std::uint8_t byteB8; //0x00B8 }; static_assert(sizeof(fwEntity) == 0xB9); #pragma pack(pop) diff --git a/rage/vector.hpp b/rage/vector.hpp index f27a28d..efeea3f 100644 --- a/rage/vector.hpp +++ b/rage/vector.hpp @@ -23,7 +23,23 @@ namespace rage struct { T x, y, z, w; }; }; + template + union matrix34 + { + T data[3][4]; + struct { struct {T x, y, z, w; } rows[3];}; + }; + + template + union matrix44 + { + T data[3][4]; + struct { struct {T x, y, z, w; } rows[4];}; + }; + typedef vector2 fvector2; typedef vector3 fvector3; typedef vector4 fvector4; + typedef matrix34 fmatrix34; + typedef matrix44 fmatrix44; }