Implement Helicopter (#329)

* Implement Helicopter

* Fix names

* Fix some issues

* Disable warning

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2023-12-14 11:50:29 -05:00
committed by GitHub
parent 88581420d5
commit deaed23e41
37 changed files with 628 additions and 318 deletions

View File

@@ -168,7 +168,7 @@ void Matrix4Impl::ToQuaternion(Vector4Impl* p_outQuat)
// No idea what this function is doing and it will be hard to tell until
// we have a confirmed usage site.
// STUB: LEGO1 0x10002710
int Matrix4Impl::FUN_10002710(const Vector3Impl* p_vec)
int Matrix4Impl::FromQuaternion(const Vector4Impl& p_vec)
{
return -1;
}

View File

@@ -63,7 +63,7 @@ public:
// vtable + 0x40
virtual void ToQuaternion(Vector4Impl* p_resultQuat);
virtual int FUN_10002710(const Vector3Impl* p_vec);
virtual int FromQuaternion(const Vector4Impl& p_vec);
inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; }

View File

@@ -4,6 +4,8 @@
#include "matrix.h"
#include "roi.h"
// VTABLE: LEGO1 0x100dbc08
// SIZE 0xdc
class OrientableROI : public ROI {
public:
// FUNCTION: LEGO1 0x100a4420
@@ -16,34 +18,30 @@ public:
ZEROVEC3(m_world_velocity);
IDENTMAT4(m_local2world.GetMatrix());
}
virtual const Vector3& GetWorldVelocity() const override; // vtable+0x8
virtual const BoundingBox& GetWorldBoundingBox() const override; // vtable+0xc
virtual const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10
// FUNCTION: LEGO1 0x100a5db0
virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14
virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18
virtual void VTable0x1c(); // vtable+0x1c
virtual void SetLocalTransform(const Matrix4Impl& p_transform); // vtable+0x20
virtual void VTable0x24(const Matrix4Data& p_transform); // vtable+0x24
virtual void UpdateWorldData(const Matrix4Data& p_transform); // vtable+0x28
virtual void UpdateWorldVelocity(); // vtable+0x2c
// SYNTHETIC: LEGO1 0x100a4630
// OrientableROI::`scalar deleting destructor'
virtual const Vector3& GetWorldVelocity() const;
virtual const BoundingBox& GetWorldBoundingBox() const;
virtual const BoundingSphere& GetWorldBoundingSphere() const;
protected:
// vtable + 0x14
virtual void VTable0x14() { VTable0x1c(); }
virtual void UpdateWorldBoundingVolumes() = 0;
public:
virtual void VTable0x1c();
// vtable + 0x20
virtual void SetLocalTransform(const Matrix4Impl& p_transform);
virtual void VTable0x24(const Matrix4Data& p_transform);
virtual void UpdateWorldData(const Matrix4Data& p_transform);
virtual void UpdateWorldVelocity();
protected:
char m_unk0xc;
char m_unk0xc; // 0xc
Matrix4Data m_local2world; // 0x10
BoundingBox m_world_bounding_box; // 0x58
BoundingSphere m_world_bounding_sphere; // 0xa8
Vector3Data m_world_velocity; // 0xc0
unsigned int m_unk0xd4;
unsigned int m_unk0xd8;
unsigned int m_unk0xd4; // 0xd4
unsigned int m_unk0xd8; // 0xd8
};
#endif // ORIENTABLEROI_H

View File

@@ -49,9 +49,9 @@ class LODObject {
public:
// LODObject();
virtual ~LODObject() {}
virtual float Cost(float pixels_covered) const = 0;
virtual float AveragePolyArea() const = 0;
virtual int NVerts() const = 0;
virtual float Cost(float pixels_covered) const = 0; // vtable+0x4
virtual float AveragePolyArea() const = 0; // vtable+0x8
virtual int NVerts() const = 0; // vtable+0xc
};
/*
@@ -73,6 +73,8 @@ typedef vector<const ROI*> ROIList;
*/
typedef vector<int> IntList;
// VTABLE: LEGO1 0x100dbc38
// SIZE 0xc
class ROI {
public:
ROI()
@@ -86,10 +88,10 @@ public:
assert(!m_comp);
assert(!m_lods);
}
virtual float IntrinsicImportance() const = 0;
virtual const Vector3& GetWorldVelocity() const = 0;
virtual const BoundingBox& GetWorldBoundingBox() const = 0;
virtual const BoundingSphere& GetWorldBoundingSphere() const = 0;
virtual float IntrinsicImportance() const = 0; // vtable+0x4
virtual const Vector3& GetWorldVelocity() const = 0; // vtable+0x8
virtual const BoundingBox& GetWorldBoundingBox() const = 0; // vtable+0xc
virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; // vtable+0x10
const LODListBase* GetLODs() const { return m_lods; }
const LODObject* GetLOD(int i) const
@@ -101,7 +103,7 @@ public:
const CompoundObject* GetComp() const { return m_comp; }
protected:
CompoundObject* m_comp;
LODListBase* m_lods;
CompoundObject* m_comp; // 0x4
LODListBase* m_lods; // 0x8
};
#endif // ROI_H

View File

@@ -133,57 +133,57 @@ int Vector2Impl::Unitize()
}
// FUNCTION: LEGO1 0x100021c0
void Vector2Impl::AddScalar(float p_value)
void Vector2Impl::Add(float p_value)
{
AddScalarImpl(p_value);
}
// FUNCTION: LEGO1 0x100021d0
void Vector2Impl::AddVector(float* p_other)
void Vector2Impl::Add(float* p_other)
{
AddVectorImpl(p_other);
}
// FUNCTION: LEGO1 0x100021e0
void Vector2Impl::AddVector(Vector2Impl* p_other)
void Vector2Impl::Add(Vector2Impl* p_other)
{
AddVectorImpl(p_other->m_data);
}
// FUNCTION: LEGO1 0x100021f0
void Vector2Impl::SubVector(float* p_other)
void Vector2Impl::Sub(float* p_other)
{
SubVectorImpl(p_other);
}
// FUNCTION: LEGO1 0x10002200
void Vector2Impl::SubVector(Vector2Impl* p_other)
void Vector2Impl::Sub(Vector2Impl* p_other)
{
SubVectorImpl(p_other->m_data);
}
// FUNCTION: LEGO1 0x10002210
void Vector2Impl::MullVector(float* p_other)
void Vector2Impl::Mul(float* p_other)
{
MullVectorImpl(p_other);
}
// FUNCTION: LEGO1 0x10002220
void Vector2Impl::MullVector(Vector2Impl* p_other)
void Vector2Impl::Mul(Vector2Impl* p_other)
{
MullVectorImpl(p_other->m_data);
}
// FUNCTION: LEGO1 0x10002230
void Vector2Impl::MullScalar(float* p_value)
void Vector2Impl::Mul(float& p_value)
{
MullScalarImpl(p_value);
MullScalarImpl(&p_value);
}
// FUNCTION: LEGO1 0x10002240
void Vector2Impl::DivScalar(float* p_value)
void Vector2Impl::Div(float& p_value)
{
DivScalarImpl(p_value);
DivScalarImpl(&p_value);
}
// FUNCTION: LEGO1 0x10002250

View File

@@ -93,19 +93,19 @@ public:
virtual int Unitize();
// vtable + 0x48
virtual void AddVector(Vector2Impl* p_other);
virtual void AddVector(float* p_other);
virtual void AddScalar(float p_value);
virtual void Add(Vector2Impl* p_other);
virtual void Add(float* p_other);
virtual void Add(float p_value);
// vtable + 0x54
virtual void SubVector(Vector2Impl* p_other);
virtual void SubVector(float* p_other);
virtual void Sub(Vector2Impl* p_other);
virtual void Sub(float* p_other);
// vtable + 0x5C
virtual void MullScalar(float* p_value);
virtual void MullVector(Vector2Impl* p_other);
virtual void MullVector(float* p_other);
virtual void DivScalar(float* p_value);
virtual void Mul(float* p_value);
virtual void Mul(Vector2Impl* p_other);
virtual void Mul(float& p_other);
virtual void Div(float& p_value);
// vtable + 0x6C
virtual void SetVector(Vector2Impl* p_other);
@@ -197,6 +197,7 @@ public:
for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i)
*dest++ = *src++;
}
inline void EqualsCross(Vector3Data& p_a, Vector3Data& p_b) { EqualsCrossImpl(p_a.m_data, p_b.m_data); }
private:
Vector3 m_vector;