Implement functions in Act3Actor (#1180)

* Implement Act3Actor

* Minor consistency adjustments

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Mikhail 2024-11-30 11:57:44 -05:00 committed by GitHub
parent f56ffddfdc
commit cc682173eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 81 additions and 11 deletions

View file

@ -20,8 +20,8 @@ class Act3Actor : public LegoAnimActor {
return "Act3Actor";
}
MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxU32 VTable0x90(float p_float, Matrix4& p_transform) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// SYNTHETIC: LEGO1 0x10043330
// Act3Actor::`scalar deleting destructor'
@ -30,7 +30,12 @@ class Act3Actor : public LegoAnimActor {
// Act3Actor::~Act3Actor
private:
undefined4 m_unk0x1c; // 0x1c
MxFloat m_unk0x1c; // 0x1c
static Mx3DPointFloat g_unk0x10104ef0;
};
// GLOBAL: LEGO1 0x100d7660
// Act3Actor::`vbtable'
#endif // ACT3ACTORS_H

View file

@ -22,6 +22,7 @@ extern const char* g_strHIT_WALL_SOUND;
class LegoPathActor : public LegoActor {
public:
enum {
c_bit2 = 0x02,
c_bit3 = 0x04,
c_bit9 = 0x100
};

View file

@ -1,23 +1,87 @@
#include "act3actors.h"
#include "roi/legoroi.h"
DECOMP_SIZE_ASSERT(Act3Actor, 0x178)
// STUB: LEGO1 0x1003fa50
// Initialized at LEGO1 0x1003fa20
// GLOBAL: LEGO1 0x10104ef0
Mx3DPointFloat Act3Actor::g_unk0x10104ef0 = Mx3DPointFloat(0.0, 5.0, 0.0);
// FUNCTION: LEGO1 0x1003fa50
Act3Actor::Act3Actor()
{
m_unk0x1c = 0;
}
// STUB: LEGO1 0x1003fb70
MxU32 Act3Actor::VTable0x90(float, Matrix4&)
// FUNCTION: LEGO1 0x1003fb70
MxU32 Act3Actor::VTable0x90(float p_float, Matrix4& p_transform)
{
// TODO
// Note: Code duplication with LegoExtraActor::VTable0x90
switch (m_state & 0xff) {
case 0:
case 1:
return TRUE;
case 2:
m_unk0x1c = p_float + 2000.0f;
m_state = 3;
m_actorTime += (p_float - m_lastTime) * m_worldSpeed;
m_lastTime = p_float;
return FALSE;
case 3:
assert(!m_userNavFlag);
Vector3 positionRef(p_transform[3]);
p_transform = m_roi->GetLocal2World();
if (m_unk0x1c > p_float) {
Mx3DPointFloat position;
position = positionRef;
positionRef.Clear();
p_transform.RotateX(0.6);
positionRef = position;
m_actorTime += (p_float - m_lastTime) * m_worldSpeed;
m_lastTime = p_float;
VTable0x74(p_transform);
return FALSE;
}
else {
m_state = 0;
m_unk0x1c = 0;
((Vector3&) positionRef).Sub(g_unk0x10104ef0);
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
return TRUE;
}
}
return FALSE;
}
// STUB: LEGO1 0x1003fd90
MxResult Act3Actor::VTable0x94(LegoPathActor*, MxBool)
// FUNCTION: LEGO1 0x1003fd90
MxResult Act3Actor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
{
// TODO
return 0;
if (!p_actor->GetUserNavFlag() && p_bool) {
if (p_actor->GetState()) {
return FAILURE;
}
LegoROI* roi = p_actor->GetROI();
MxMatrix local2world;
local2world = roi->GetLocal2World();
Vector3(local2world[3]).Add(g_unk0x10104ef0);
roi->FUN_100a58f0(local2world);
roi->VTable0x14();
p_actor->SetState(c_bit2 | c_bit9);
}
return SUCCESS;
}