mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-21 23:17:53 -05:00
Implement LegoCarBuildAnimPresenter::FUN_10079920()
(#1108)
* Implement `FUN_10079920()` * Fix formatting * Address review comment --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
parent
fa6de9cb6b
commit
e6474b7fcd
7 changed files with 77 additions and 10 deletions
|
@ -202,7 +202,7 @@ class LegoCarBuild : public LegoWorld {
|
|||
|
||||
static MxS16 g_unk0x100f11cc;
|
||||
static MxFloat g_unk0x100d65a4;
|
||||
static MxFloat g_unk0x100d65a8;
|
||||
static MxFloat g_rotationAngleStepYAxis;
|
||||
};
|
||||
|
||||
#endif // LEGOCARBUILD_H
|
||||
|
|
|
@ -45,7 +45,8 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
|
|||
void EndAction() override; // vtable+0x40
|
||||
void PutFrame() override; // vtable+0x6c
|
||||
|
||||
void FUN_10079920(float p_param1);
|
||||
void FUN_10079160();
|
||||
void RotateAroundYAxis(MxFloat p_angle);
|
||||
MxBool FUN_10079c30(const LegoChar* p_name);
|
||||
MxBool FUN_10079ca0(const LegoChar* p_name);
|
||||
MxBool FUN_10079cf0(const LegoChar* p_string);
|
||||
|
@ -64,11 +65,11 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
|
|||
undefined2 m_unk0xbc; // 0xbc
|
||||
MxS16 m_unk0xbe; // 0xbe
|
||||
MxS16 m_unk0xc0; // 0xc0
|
||||
undefined4 m_unk0xc4; // 0xc4
|
||||
LegoAnimNodeData* m_unk0xc4; // 0xc4
|
||||
LegoAnim m_unk0xc8; // 0xc8
|
||||
MxMatrix m_unk0xe0; // 0xe0
|
||||
UnknownListEntry* m_unk0x128; // 0x128
|
||||
undefined4 m_unk0x12c; // 0x12c
|
||||
MxFloat m_unk0x12c; // 0x12c
|
||||
undefined4 m_unk0x130; // 0x130
|
||||
undefined4 m_unk0x134; // 0x134
|
||||
undefined4 m_unk0x138; // 0x138
|
||||
|
|
|
@ -26,7 +26,7 @@ DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50)
|
|||
MxFloat LegoCarBuild::g_unk0x100d65a4 = -0.1f;
|
||||
|
||||
// GLOBAL: LEGO1 0x100d65a8
|
||||
MxFloat LegoCarBuild::g_unk0x100d65a8 = 0.07;
|
||||
MxFloat LegoCarBuild::g_rotationAngleStepYAxis = 0.07;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f11cc
|
||||
MxS16 LegoCarBuild::g_unk0x100f11cc = -1;
|
||||
|
@ -783,7 +783,7 @@ void LegoCarBuild::FUN_10024ef0()
|
|||
void LegoCarBuild::FUN_10024f50()
|
||||
{
|
||||
m_unk0x2d4 = FALSE;
|
||||
m_unk0x258->FUN_10079920(g_unk0x100d65a8);
|
||||
m_unk0x258->RotateAroundYAxis(g_rotationAngleStepYAxis);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10024f70
|
||||
|
|
|
@ -14,7 +14,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
|
|||
m_unk0xbe = 0;
|
||||
m_unk0xc0 = 0;
|
||||
m_unk0x128 = NULL;
|
||||
m_unk0xc4 = 0;
|
||||
m_unk0xc4 = NULL;
|
||||
m_unk0x130 = 0;
|
||||
m_unk0x12c = 0;
|
||||
m_unk0x134 = 0;
|
||||
|
@ -83,13 +83,46 @@ void LegoCarBuildAnimPresenter::EndAction()
|
|||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10079920
|
||||
// STUB: BETA10 0x1007225d
|
||||
void LegoCarBuildAnimPresenter::FUN_10079920(float p_param1)
|
||||
// STUB: LEGO1 0x10079160
|
||||
void LegoCarBuildAnimPresenter::FUN_10079160()
|
||||
{
|
||||
// called from LegoCarBuildAnimPresenter::StreamingTickle()
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10079920
|
||||
// FUNCTION: BETA10 0x1007225d
|
||||
void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle)
|
||||
{
|
||||
if (m_unk0xc4) {
|
||||
LegoRotationKey* rotationKey = m_unk0xc4->GetRotationKey(0);
|
||||
|
||||
Mx4DPointFloat
|
||||
currentRotation(rotationKey->GetX(), rotationKey->GetY(), rotationKey->GetZ(), rotationKey->GetAngle());
|
||||
Mx4DPointFloat additionalRotation(0.0f, 1.0f, 0.0f, -p_angle);
|
||||
Mx4DPointFloat newRotation;
|
||||
|
||||
additionalRotation.NormalizeQuaternion();
|
||||
newRotation.EqualsHamiltonProduct(¤tRotation, &additionalRotation);
|
||||
|
||||
if (newRotation[3] < 0.9999) {
|
||||
rotationKey->FUN_100739a0(TRUE);
|
||||
}
|
||||
else {
|
||||
rotationKey->FUN_100739a0(FALSE);
|
||||
}
|
||||
|
||||
m_unk0xc4->GetRotationKey(0)->SetX(newRotation[0]);
|
||||
m_unk0xc4->GetRotationKey(0)->SetY(newRotation[1]);
|
||||
m_unk0xc4->GetRotationKey(0)->SetZ(newRotation[2]);
|
||||
m_unk0xc4->GetRotationKey(0)->SetAngle(newRotation[3]);
|
||||
|
||||
if (m_unk0x140->GetROI()) {
|
||||
FUN_1006b9a0(&m_unk0xc8, m_unk0x12c, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10079b80
|
||||
// FUNCTION: BETA10 0x1007258f
|
||||
MxBool LegoCarBuildAnimPresenter::StringEndsOnYOrN(const LegoChar* p_string)
|
||||
|
|
|
@ -24,6 +24,17 @@ class LegoAnimKey {
|
|||
LegoU32 TestBit2() { return m_flags & c_bit2; }
|
||||
LegoU32 TestBit3() { return m_flags & c_bit3; }
|
||||
|
||||
// FUNCTION: BETA10 0x100739a0
|
||||
void FUN_100739a0(MxS32 p_param)
|
||||
{
|
||||
if (p_param) {
|
||||
m_flags |= c_bit1;
|
||||
}
|
||||
else {
|
||||
m_flags &= ~c_bit1;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
LegoU8 m_flags; // 0x00
|
||||
LegoFloat m_time; // 0x04
|
||||
|
@ -52,13 +63,29 @@ class LegoRotationKey : public LegoAnimKey {
|
|||
public:
|
||||
LegoRotationKey();
|
||||
LegoResult Read(LegoStorage* p_storage);
|
||||
|
||||
// FUNCTION: BETA10 0x10073a00
|
||||
LegoFloat GetAngle() { return m_angle; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073a30
|
||||
void SetAngle(LegoFloat p_angle) { m_angle = p_angle; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073a60
|
||||
LegoFloat GetX() { return m_x; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073a90
|
||||
void SetX(LegoFloat p_x) { m_x = p_x; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073ac0
|
||||
LegoFloat GetY() { return m_y; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073af0
|
||||
void SetY(LegoFloat p_y) { m_y = p_y; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073b20
|
||||
LegoFloat GetZ() { return m_z; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073b50
|
||||
void SetZ(LegoFloat p_z) { m_z = p_z; }
|
||||
|
||||
protected:
|
||||
|
@ -129,6 +156,9 @@ class LegoAnimNodeData : public LegoTreeNodeData {
|
|||
LegoU16 GetUnknown0x20() { return m_unk0x20; }
|
||||
LegoU16 GetUnknown0x22() { return m_unk0x22; }
|
||||
|
||||
// FUNCTION: BETA10 0x10073b80
|
||||
LegoRotationKey* GetRotationKey(MxS32 index) { return &m_rotationKeys[index]; }
|
||||
|
||||
void SetTranslationIndex(LegoU32 p_translationIndex) { m_translationIndex = p_translationIndex; }
|
||||
void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; }
|
||||
void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; }
|
||||
|
|
|
@ -50,6 +50,7 @@ class Mx3DPointFloat : public Vector3 {
|
|||
class Mx4DPointFloat : public Vector4 {
|
||||
public:
|
||||
// FUNCTION: LEGO1 0x10048290
|
||||
// FUNCTION: BETA10 0x100484c0
|
||||
Mx4DPointFloat() : Vector4(m_elements) {}
|
||||
|
||||
// FUNCTION: BETA10 0x10073bb0
|
||||
|
|
|
@ -182,6 +182,7 @@ class Vector2 {
|
|||
class Vector3 : public Vector2 {
|
||||
public:
|
||||
// FUNCTION: LEGO1 0x1001d150
|
||||
// FUNCTION: BETA10 0x10011660
|
||||
Vector3(float* p_data) : Vector2(p_data) {}
|
||||
|
||||
// Hack: Some code initializes a Vector3 from a (most likely) const float* source.
|
||||
|
@ -298,6 +299,7 @@ class Vector3 : public Vector2 {
|
|||
// SIZE 0x08
|
||||
class Vector4 : public Vector3 {
|
||||
public:
|
||||
// FUNCTION: BETA10 0x10048780
|
||||
Vector4(float* p_data) : Vector3(p_data) {}
|
||||
|
||||
// Hack: Some code initializes a Vector4 from a (most likely) const float* source.
|
||||
|
|
Loading…
Reference in a new issue