Implement/match LegoExtraActor:: WaitForAnimation, Restart (#768)

* Implement/match LegoExtraActor:: WaitForAnimation, Restart

* whitespace

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert 2024-04-04 06:26:03 -04:00 committed by GitHub
parent ce134e79ef
commit a8eebe454e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 88 additions and 20 deletions

View file

@ -51,7 +51,11 @@ class LegoAnimPresenter : public MxVideoPresenter {
virtual void VTable0x98(); // vtable+0x98
// STUB: LEGO1 0x1000c990
virtual void VTable0x9c() {} // vtable+0x9c
virtual undefined4* VTable0x9c(undefined4& p_unk0x6c)
{
p_unk0x6c = m_unk0x6c;
return m_unk0x68;
} // vtable+0x9c
virtual void VTable0xa0(); // vtable+0xa0

View file

@ -32,7 +32,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor {
MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98
void VTable0x9c() override; // vtable+0x9c
MxResult WaitForAnimation() override; // vtable+0x9c
virtual void FUN_10080590();

View file

@ -72,6 +72,7 @@ class LegoEntity : public MxEntity {
inline MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; }
inline MxU8 GetFlags() { return m_flags; }
inline MxFloat GetWorldSpeed() { return m_worldSpeed; }
inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetUnknown0x59() { return m_unk0x59; }

View file

@ -41,11 +41,12 @@ class LegoExtraActor : public virtual LegoAnimActor {
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
MxU32 VTable0x90(float p_float, Matrix4& p_matrix) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x9c() override; // vtable+0x9c
MxResult WaitForAnimation() override; // vtable+0x9c
void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4
void VTable0xc4() override; // vtable+0xc4
virtual MxResult FUN_1002aae0();
void Restart();
inline void FUN_1002ad8a();
// SYNTHETIC: LEGO1 0x1002b760
@ -56,7 +57,7 @@ class LegoExtraActor : public virtual LegoAnimActor {
undefined m_unk0x0c; // 0x0c
MxU8 m_axis; // 0x0d
undefined m_unk0x0e; // 0x0e
MxFloat m_unk0x10; // 0x10
MxFloat m_prevWorldSpeed; // 0x10
MxU8 m_unk0x14; // 0x14
MxU8 m_unk0x15; // 0x15
MxMatrix m_unk0x18; // 0x18

View file

@ -37,7 +37,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap {
void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98
void VTable0x9c() override; // vtable+0x9c
MxResult WaitForAnimation() override; // vtable+0x9c
virtual void FUN_100136f0(float p_worldSpeed);

View file

@ -30,7 +30,7 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor {
void VTable0x6c() override; // vtable+0x6c
void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x98() override; // vtable+0x98
void VTable0x9c() override; // vtable+0x9c
MxResult WaitForAnimation() override; // vtable+0x9c
void VTable0x1c() override; // vtable+0x1c
// SYNTHETIC: LEGO1 0x10081d40

View file

@ -52,7 +52,7 @@ class LegoPathActor : public LegoActor {
virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual void VTable0x98(); // vtable+0x98
virtual void VTable0x9c(); // vtable+0x9c
virtual MxResult WaitForAnimation(); // vtable+0x9c
// FUNCTION: LEGO1 0x10002d60
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0

View file

@ -2,6 +2,7 @@
#define LEGOPATHBOUNDARY_H
#include "geom/legowegedge.h"
#include "legoanimpresenter.h"
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
@ -9,6 +10,12 @@ struct LegoPathBoundaryComparator {
MxBool operator()(const undefined*, const undefined*) const { return 0; }
};
struct LegoAnimPresenterSetCompare {
MxBool operator()(const LegoAnimPresenter*, const LegoAnimPresenter*) const { return 0; }
};
typedef set<LegoAnimPresenter*, LegoAnimPresenterSetCompare> LegoAnimPresenterSet;
// VTABLE: LEGO1 0x100d8618
// SIZE 0x74
class LegoPathBoundary : public LegoWEGEdge {
@ -17,10 +24,16 @@ class LegoPathBoundary : public LegoWEGEdge {
// STUB: LEGO1 0x10047a80
// LegoPathBoundary::`scalar deleting destructor'
inline LegoAnimPresenterSet* GetUnknown0x64() { return &m_unk0x64; }
private:
map<undefined*, undefined*, LegoPathBoundaryComparator> m_unk0x54; // 0x54
map<undefined*, undefined*, LegoPathBoundaryComparator> m_unk0x64; // 0x64
LegoAnimPresenterSet m_unk0x64; // 0x64
};
// clang-format off
// GLOBAL: LEGO1 0x100f3200
// _Tree<LegoAnimPresenter *,LegoAnimPresenter *,set<LegoAnimPresenter *,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::_Kfn,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::_Nil
// clang-format on
#endif // LEGOPATHBOUNDARY_H

View file

@ -37,7 +37,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98
void VTable0x9c() override; // vtable+0x9c
MxResult WaitForAnimation() override; // vtable+0x9c
virtual void FUN_10012ea0(float p_worldSpeed);
virtual void FUN_10012ff0(float);

View file

@ -70,7 +70,8 @@ void LegoCarRaceActor::VTable0x98()
}
// STUB: LEGO1 0x10081d30
void LegoCarRaceActor::VTable0x9c()
MxResult LegoCarRaceActor::WaitForAnimation()
{
// TODO
return SUCCESS;
}

View file

@ -69,7 +69,8 @@ void LegoJetski::VTable0x98()
}
// STUB: LEGO1 0x10014200
void LegoJetski::VTable0x9c()
MxResult LegoJetski::WaitForAnimation()
{
// TODO
return SUCCESS;
}

View file

@ -36,7 +36,8 @@ void LegoJetskiRaceActor::VTable0x98()
}
// STUB: LEGO1 0x100822e0
void LegoJetskiRaceActor::VTable0x9c()
MxResult LegoJetskiRaceActor::WaitForAnimation()
{
// TODO
return SUCCESS;
}

View file

@ -145,7 +145,7 @@ MxResult LegoExtraActor::FUN_1002aae0()
m_boundary = oldEdge;
}
LegoPathActor::VTable0x9c();
LegoPathActor::WaitForAnimation();
return SUCCESS;
}
@ -229,7 +229,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
FUN_1002ad8a();
SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE);
m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration();
m_unk0x10 = m_worldSpeed;
m_prevWorldSpeed = m_worldSpeed;
VTable0xc4();
SetWorldSpeed(0);
m_unk0x14 = 1;
@ -273,10 +273,54 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
return SUCCESS;
}
// STUB: LEGO1 0x1002b290
void LegoExtraActor::VTable0x9c()
// FUNCTION: LEGO1 0x1002b290
MxResult LegoExtraActor::WaitForAnimation()
{
// TODO
LegoPathBoundary* oldBoundary = m_boundary;
MxResult result = LegoPathActor::WaitForAnimation();
if (m_boundary != oldBoundary) {
MxU32 b = FALSE;
LegoAnimPresenterSet* set = m_boundary->GetUnknown0x64();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
undefined4 tmp;
if ((*it)->VTable0x9c(tmp)) {
b = TRUE;
break;
}
}
if (b) {
m_unk0x0e = 1;
m_prevWorldSpeed = GetWorldSpeed();
SetWorldSpeed(0);
}
}
return result;
}
// FUNCTION: LEGO1 0x1002b370
void LegoExtraActor::Restart()
{
if (m_unk0x0e != 0) {
MxU32 b = FALSE;
LegoAnimPresenterSet* set = m_boundary->GetUnknown0x64();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
undefined4 tmp;
if ((*it)->VTable0x9c(tmp)) {
b = TRUE;
break;
}
}
if (!b) {
SetWorldSpeed(m_prevWorldSpeed);
m_unk0x0e = 0;
}
}
}
// STUB: LEGO1 0x1002b440

View file

@ -75,9 +75,10 @@ void LegoPathActor::ParseAction(char*)
}
// STUB: LEGO1 0x1002f1b0
void LegoPathActor::VTable0x9c()
MxResult LegoPathActor::WaitForAnimation()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x1002f650

View file

@ -89,7 +89,8 @@ void LegoRaceCar::VTable0x98()
}
// STUB: LEGO1 0x10014580
void LegoRaceCar::VTable0x9c()
MxResult LegoRaceCar::WaitForAnimation()
{
// TODO
return SUCCESS;
}