Implement Helicopter subclass

This commit is contained in:
Nathan 2023-12-16 01:31:00 -05:00
parent deaed23e41
commit 2817d7a61d
2 changed files with 48 additions and 3 deletions

View File

@ -321,8 +321,51 @@ void Helicopter::VTable0x70(float p_float)
}
}
// STUB: LEGO1 0x100040a0
// FUNCTION: LEGO1 0x100040a0
MxResult HelicopterSubclass::FUN_100040a0(Vector4Impl& p_v, float p_f)
{
return SUCCESS;
MxU32 state = m_unk0x30;
if (state == 1) {
p_v.EqualsImpl(m_unk0x0.GetVector().elements);
p_v[3] = acos(p_v[3]) * (1 - p_f) * 2.0;
p_v.NormalizeQuaternion();
return SUCCESS;
}
else if (state == 2) {
p_v.EqualsImpl(m_unk0x18.GetVector().elements);
p_v[3] = acos(p_v[3]) * p_f * 2.0;
p_v.NormalizeQuaternion();
return SUCCESS;
}
else if (state == 3) {
double d1 = p_v.Dot(&m_unk0x0, &m_unk0x18), d2;
if (d1 + 1 > 0.00001) {
if (1 - d1 > 0.00001) {
double d = acos(d1);
sin(d);
d1 = sin((1 - p_f) * d) / sin(d);
d2 = sin(p_f * d) / sin(d);
}
else {
d1 = 1 - p_f;
d2 = p_f;
}
for (int i = 0; i < 4; i++) {
p_v[i] = m_unk0x18[i] * d2 + m_unk0x0[i] * d1;
}
return SUCCESS;
}
p_v[0] = -m_unk0x0[1];
p_v[1] = m_unk0x0[1];
p_v[2] = -m_unk0x0[3];
p_v[3] = m_unk0x0[2];
d1 = sin((1 - p_f) * 1.570796326794895);
d2 = sin(p_f * 1.570796326794895);
for (int i = 0; i < 3; i++) {
p_v[i] = m_unk0x0[i] * d1 + p_v[i] * d2;
}
return SUCCESS;
}
else
return FAILURE;
}

View File

@ -174,11 +174,13 @@ class Vector4Impl : public Vector3Impl {
void EqualsScalar(float* p_value);
// vtable + 0x84
// vtable + 0x88
virtual void SetMatrixProduct(Vector4Impl* p_a, float* p_b);
virtual void SetMatrixProductImpl(float* p_vec, float* p_mat);
virtual int NormalizeQuaternion();
virtual void UnknownQuaternionOp(Vector4Impl* p_a, Vector4Impl* p_b);
inline Vector4& GetVector() { return *((Vector4*) m_data); }
};
// VTABLE: LEGO1 0x100d4488