Implement/match LegoAnimPresenter::PutFrame (#796)

* Implement/match LegoAnimPresenter::PutFrame

* compat mode
This commit is contained in:
Christian Semmler 2024-04-13 11:59:16 -04:00 committed by GitHub
parent d469cabd6b
commit 67127e2515
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 3 deletions

View file

@ -92,6 +92,7 @@ class LegoAnimPresenter : public MxVideoPresenter {
LegoBool FUN_1006aba0();
MxBool FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi);
void FUN_1006ac90();
void FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, MxMatrix& p_matrix);
void FUN_1006c8a0(MxBool p_bool);
LegoAnim* m_anim; // 0x64

View file

@ -510,10 +510,57 @@ void LegoAnimPresenter::FUN_1006ac90()
// TODO
}
// STUB: LEGO1 0x1006ad30
// FUNCTION: LEGO1 0x1006ad30
void LegoAnimPresenter::PutFrame()
{
// TODO
if (m_currentTickleState == e_streaming) {
MxLong time;
if (m_action->GetStartTime() <= m_action->GetElapsedTime()) {
time = m_action->GetElapsedTime() - m_action->GetStartTime();
}
else {
time = 0;
}
FUN_1006b9a0(m_anim, time, *m_unk0x78);
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
for (MxS32 i = 0; i < m_unk0x94; i++) {
if (m_unk0x8c[i] != NULL) {
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
Vector3 pos(mat[0]);
Vector3 dir(mat[1]);
Vector3 up(mat[2]);
Vector3 und(mat[3]);
float possqr = sqrt(pos.LenSquared());
float dirsqr = sqrt(dir.LenSquared());
float upsqr = sqrt(up.LenSquared());
up = und;
#ifdef COMPAT_MODE
Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation();
((Vector3&) up).Sub(&location);
#else
((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation());
#endif
((Vector3&) dir).Div(dirsqr);
pos.EqualsCross(&dir, &up);
pos.Unitize();
up.EqualsCross(&pos, &dir);
((Vector3&) pos).Mul(possqr);
((Vector3&) dir).Mul(dirsqr);
((Vector3&) up).Mul(upsqr);
m_unk0x8c[i]->FUN_100a58f0(mat);
m_unk0x8c[i]->VTable0x14();
}
}
}
}
}
// FUNCTION: LEGO1 0x1006b550
@ -643,6 +690,11 @@ const char* LegoAnimPresenter::GetActionObjectName()
return m_action->GetObjectName();
}
// STUB: LEGO1 0x1006b9a0
void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, MxMatrix& p_matrix)
{
}
// STUB: LEGO1 0x1006bac0
void LegoAnimPresenter::ParseExtra()
{

View file

@ -126,7 +126,7 @@ class Vector2 {
virtual void Sub(float* p_other) { SubImpl(p_other); } // vtable+0x58
// FUNCTION: LEGO1 0x10002200
virtual void Sub(Vector2* p_other) { SubImpl(p_other->m_data); } // vtable+0x54
virtual void Sub(const Vector2* p_other) { SubImpl((float*) p_other->m_data); } // vtable+0x54
// FUNCTION: LEGO1 0x10002210
virtual void Mul(float* p_other) { MulVectorImpl(p_other); } // vtable+0x64