Implement LegoExtraActor::VTable0x70 (#769)

* Implement LegoExtraActor::VTable0x70

* whitespace

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert 2024-04-05 06:56:31 -04:00 committed by GitHub
parent a8eebe454e
commit 32f1621ec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 58 additions and 7 deletions

View file

@ -58,7 +58,7 @@ class LegoExtraActor : public virtual LegoAnimActor {
MxU8 m_axis; // 0x0d
undefined m_unk0x0e; // 0x0e
MxFloat m_prevWorldSpeed; // 0x10
MxU8 m_unk0x14; // 0x14
MxU8 m_whichAnim; // 0x14
MxU8 m_unk0x15; // 0x15
MxMatrix m_unk0x18; // 0x18
LegoAnimActorStruct* m_assAnim; // 0x60

View file

@ -29,7 +29,7 @@ LegoExtraActor::LegoExtraActor()
m_scheduledTime = 0;
m_unk0x0c = 0;
m_unk0x0e = 0;
m_unk0x14 = 0;
m_whichAnim = 0;
m_assAnim = NULL;
m_disAnim = NULL;
m_unk0x15 = 0;
@ -232,7 +232,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
m_prevWorldSpeed = m_worldSpeed;
VTable0xc4();
SetWorldSpeed(0);
m_unk0x14 = 1;
m_whichAnim = 1;
m_state = 0x101;
}
}
@ -323,16 +323,67 @@ void LegoExtraActor::Restart()
}
}
// STUB: LEGO1 0x1002b440
void LegoExtraActor::VTable0x70(float)
// FUNCTION: LEGO1 0x1002b440
void LegoExtraActor::VTable0x70(float p_time)
{
// TODO
LegoAnimActorStruct* laas = NULL;
switch (m_whichAnim) {
case 0:
LegoAnimActor::VTable0x70(p_time);
break;
case 1:
if (m_scheduledTime < p_time) {
m_whichAnim = 2;
m_state = 0x101;
m_scheduledTime = m_assAnim->GetDuration() + p_time;
break;
}
else {
laas = m_disAnim;
break;
}
case 2:
if (m_scheduledTime < p_time) {
m_whichAnim = 0;
m_state = 0;
SetWorldSpeed(m_prevWorldSpeed);
m_roi->FUN_100a58f0(m_unk0x18);
m_lastTime = p_time;
break;
}
else {
laas = m_assAnim;
break;
}
}
if (laas) {
float duration2, duration;
duration = laas->GetDuration();
duration2 = p_time - (m_scheduledTime - duration);
if (duration2 < 0) {
duration2 = 0;
}
else if (duration2 > duration) {
duration2 = duration;
}
MxMatrix matrix(m_roi->GetLocal2World());
LegoTreeNode* root = laas->m_AnimTreePtr->GetRoot();
MxS32 count = root->GetNumChildren();
for (MxS32 i = 0; i < count; i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), matrix, duration2, laas->m_roiMap);
}
}
}
// FUNCTION: LEGO1 0x1002b5d0
void LegoExtraActor::VTable0x74(Matrix4& p_transform)
{
if (m_unk0x14 == 0) {
if (m_whichAnim == 0) {
LegoAnimActor::VTable0x74(p_transform);
}
}