Implement/match LegoAnimationManager::FUN_10064b50 (#926)

This commit is contained in:
Christian Semmler 2024-05-17 10:05:06 -04:00 committed by GitHub
parent 4419007355
commit 02c4aad33e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 45 additions and 7 deletions

View file

@ -188,7 +188,8 @@ class LegoAnimationManager : public MxCore {
MxBool m_suspended; // 0x42b MxBool m_suspended; // 0x42b
LegoTranInfo* m_unk0x42c; // 0x42c LegoTranInfo* m_unk0x42c; // 0x42c
MxBool m_unk0x430; // 0x430 MxBool m_unk0x430; // 0x430
undefined4 m_unk0x434[2]; // 0x434 MxLong m_unk0x434; // 0x434
MxLong m_unk0x438; // 0x438
MxMatrix m_unk0x43c; // 0x43c MxMatrix m_unk0x43c; // 0x43c
MxMatrix m_unk0x484; // 0x484 MxMatrix m_unk0x484; // 0x484
UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc

View file

@ -13,6 +13,7 @@ class MxPresenter;
// SIZE 0x78 // SIZE 0x78
struct LegoTranInfo { struct LegoTranInfo {
enum { enum {
c_bit1 = 0x01,
c_bit2 = 0x02 c_bit2 = 0x02
}; };

View file

@ -1,5 +1,6 @@
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "3dmanager/lego3dmanager.h"
#include "anim/legoanim.h" #include "anim/legoanim.h"
#include "animstate.h" #include "animstate.h"
#include "define.h" #include "define.h"
@ -13,6 +14,7 @@
#include "legomain.h" #include "legomain.h"
#include "legonavcontroller.h" #include "legonavcontroller.h"
#include "legoroilist.h" #include "legoroilist.h"
#include "legosoundmanager.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworld.h" #include "legoworld.h"
#include "misc.h" #include "misc.h"
@ -25,6 +27,7 @@
#include "viewmanager/viewmanager.h" #include "viewmanager/viewmanager.h"
#include <io.h> #include <io.h>
#include <vec.h>
DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500) DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500)
DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18)
@ -1863,9 +1866,42 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong)
// TODO // TODO
} }
// STUB: LEGO1 0x10064b50 // FUNCTION: LEGO1 0x10064b50
// FUNCTION: BETA10 0x10045f14 // FUNCTION: BETA10 0x10045f14
void LegoAnimationManager::FUN_10064b50(MxLong p_time) void LegoAnimationManager::FUN_10064b50(MxLong p_time)
{ {
// TODO if (m_unk0x430 && m_unk0x42c != NULL) {
MxMatrix mat;
if (p_time < 0 || p_time <= m_unk0x438) {
m_unk0x430 = FALSE;
m_unk0x42c->m_flags &= ~LegoTranInfo::c_bit1;
m_unk0x42c = NULL;
mat = m_unk0x484;
}
else {
float und = (float) (p_time - m_unk0x434) / (float) (m_unk0x438 - m_unk0x434);
float sub[3];
sub[0] = (m_unk0x484[3][0] - m_unk0x43c[3][0]) * und;
sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und;
sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und;
m_unk0x4cc.Unknown_100040a0(mat, (float) (p_time - m_unk0x434) / 1000.0f);
VPV3(mat[3], m_unk0x43c[3], sub);
mat[3][4] = 1.0f;
}
LegoROI* viewROI = VideoManager()->GetViewROI();
viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),
viewROI->GetWorldVelocity()
);
}
} }

View file

@ -100,6 +100,7 @@ class UnknownMx4DPointFloat {
undefined4 m_unk0x30; // 0x30 undefined4 m_unk0x30; // 0x30
}; };
// FUNCTION: BETA10 0x1004aaa0
int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f)
{ {
float data[4]; float data[4];
@ -114,6 +115,7 @@ int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f)
} }
// FUNCTION: LEGO1 0x100040a0 // FUNCTION: LEGO1 0x100040a0
// FUNCTION: BETA10 0x1004ab10
inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
{ {
undefined4 state = m_unk0x30; undefined4 state = m_unk0x30;
@ -136,7 +138,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
if (1.0 - d1 > 0.00001) { if (1.0 - d1 > 0.00001) {
double d = acos(d1); double d = acos(d1);
sin(d); sin(d);
d1 = sin((1 - p_f) * d) / sin(d); d1 = sin((1.0 - p_f) * d) / sin(d);
d2 = sin(p_f * d) / sin(d); d2 = sin(p_f * d) / sin(d);
} }
else { else {
@ -150,7 +152,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
} }
else { else {
p_v[0] = -m_unk0x00[1]; p_v[0] = -m_unk0x00[1];
p_v[1] = m_unk0x00[1]; p_v[1] = m_unk0x00[0];
p_v[2] = -m_unk0x00[3]; p_v[2] = -m_unk0x00[3];
p_v[3] = m_unk0x00[2]; p_v[3] = m_unk0x00[2];
d1 = sin((1.0 - p_f) * 1.570796326794895); d1 = sin((1.0 - p_f) * 1.570796326794895);

View file

@ -21,8 +21,6 @@ class MxMatrix : public Matrix4 {
// FUNCTION: LEGO1 0x10002850 // FUNCTION: LEGO1 0x10002850
void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28
// No idea why there's another equals. Maybe to some other type like the
// DirectX Retained Mode Matrix type which is also a float* alias?
// FUNCTION: LEGO1 0x10002860 // FUNCTION: LEGO1 0x10002860
virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48 virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48