Implement/match Doors::VTable0x70 and Doors::ParseAction (#1137)

* Implement/match Doors::VTable0x70 and Doors::ParseAction

* Fix
This commit is contained in:
Christian Semmler 2024-11-09 14:54:17 -07:00 committed by GitHub
parent f4ab226946
commit 2c10c8e344
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 100 additions and 17 deletions

View file

@ -3,11 +3,13 @@
#include "legopathactor.h" #include "legopathactor.h"
class LegoROI;
// VTABLE: LEGO1 0x100d4788 // VTABLE: LEGO1 0x100d4788
// SIZE 0x1f8 // SIZE 0x1f8
class Doors : public LegoPathActor { class Doors : public LegoPathActor {
public: public:
Doors() : m_unk0x154(0), m_unk0x15c(NULL), m_unk0x160(NULL), m_unk0x1f4(0) {} Doors() : m_unk0x154(0), m_ltDoor(NULL), m_rtDoor(NULL), m_unk0x1f4(0) {}
// FUNCTION: LEGO1 0x1000e430 // FUNCTION: LEGO1 0x1000e430
const char* ClassName() const override // vtable+0x0c const char* ClassName() const override // vtable+0x0c
@ -22,9 +24,10 @@ class Doors : public LegoPathActor {
return !strcmp(p_name, Doors::ClassName()) || LegoPathActor::IsA(p_name); return !strcmp(p_name, Doors::ClassName()) || LegoPathActor::IsA(p_name);
} }
void ParseAction(char*) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
virtual double VTable0xcc(float p_float); // vtable+0xcc
// SYNTHETIC: LEGO1 0x1000e580 // SYNTHETIC: LEGO1 0x1000e580
// Doors::`scalar deleting destructor' // Doors::`scalar deleting destructor'
@ -32,10 +35,10 @@ class Doors : public LegoPathActor {
private: private:
undefined4 m_unk0x154; // 0x154 undefined4 m_unk0x154; // 0x154
MxFloat m_unk0x158; // 0x158 MxFloat m_unk0x158; // 0x158
Matrix4* m_unk0x15c; // 0x15c LegoROI* m_ltDoor; // 0x15c
Matrix4* m_unk0x160; // 0x160 LegoROI* m_rtDoor; // 0x160
MxMatrix m_unk0x164; // 0x164 MxMatrix m_ltDoorLocal; // 0x164
MxMatrix m_unk0x1ac; // 0x1ac MxMatrix m_rtDoorLocal; // 0x1ac
MxFloat m_unk0x1f4; // 0x1f4 MxFloat m_unk0x1f4; // 0x1f4
}; };

View file

@ -1,31 +1,110 @@
#include "doors.h" #include "doors.h"
#include "legopathboundary.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxtimer.h" #include "mxtimer.h"
#include "roi/legoroi.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(Doors, 0x1f8) DECOMP_SIZE_ASSERT(Doors, 0x1f8)
// FUNCTION: LEGO1 0x10066100 // FUNCTION: LEGO1 0x10066100
// FUNCTION: BETA10 0x10026850
MxResult Doors::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) MxResult Doors::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
{ {
assert(m_ltDoor && m_rtDoor);
if (m_unk0x154 == 1) { if (m_unk0x154 == 1) {
m_unk0x154 = 2; m_unk0x154 = 2;
m_unk0x158 = Timer()->GetTime(); m_unk0x158 = Timer()->GetTime();
m_unk0x164 = m_unk0x15c[2]; m_ltDoorLocal = m_ltDoor->GetLocal2World();
m_unk0x1ac = m_unk0x160[2]; m_rtDoorLocal = m_rtDoor->GetLocal2World();
} }
return m_unk0x1f4 < 0.001 ? SUCCESS : FAILURE; return m_unk0x1f4 < 0.001 ? SUCCESS : FAILURE;
} }
// STUB: LEGO1 0x10066250 // STUB: LEGO1 0x10066190
void Doors::VTable0x70(float p_float) // FUNCTION: BETA10 0x1002696b
double Doors::VTable0xcc(float p_float)
{ {
// TODO return 0.0;
} }
// STUB: LEGO1 0x100664e0 // FUNCTION: LEGO1 0x10066250
void Doors::ParseAction(char*) // FUNCTION: BETA10 0x10026a45
void Doors::VTable0x70(float p_float)
{ {
// TODO assert(m_ltDoor && m_rtDoor);
// TODO: Match
m_roi->SetVisibility(m_boundary->GetFlag0x10());
switch (m_unk0x154) {
case 0:
m_unk0x154 = 1;
m_state = 0;
break;
case 1:
break;
case 2:
float local8 = VTable0xcc(p_float);
if (local8 > 0.0f) {
MxMatrix local58(m_ltDoorLocal);
Vector3 local10(local58[3]);
local10.Clear();
local58.RotateY(-local8);
local10 = m_ltDoorLocal[3];
m_ltDoor->FUN_100a58f0(local58);
m_ltDoor->VTable0x14();
local58 = m_rtDoorLocal;
local10.Clear();
local58.RotateY(local8);
local10 = m_rtDoorLocal[3];
m_rtDoor->FUN_100a58f0(local58);
m_rtDoor->VTable0x14();
m_unk0x1f4 = local8;
}
if (m_unk0x158 + 6000.0f < p_float) {
m_ltDoor->FUN_100a58f0(m_ltDoorLocal);
m_rtDoor->FUN_100a58f0(m_rtDoorLocal);
m_ltDoor->VTable0x14();
m_rtDoor->VTable0x14();
m_unk0x154 = 1;
m_state = 0;
m_unk0x1f4 = 0;
}
}
}
// FUNCTION: LEGO1 0x100664e0
// FUNCTION: BETA10 0x10026ceb
void Doors::ParseAction(char* p_extra)
{
LegoPathActor::ParseAction(p_extra);
assert(m_ltDoor == NULL && m_rtDoor == NULL);
assert(m_roi);
assert(!strncmp(m_roi->GetName(), "rcdor", 5));
const CompoundObject* comp = m_roi->GetComp();
for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) {
LegoROI* roi = (LegoROI*) *it;
if (roi && (!strnicmp(roi->GetName(), "dor-lt", 6) || !strnicmp(roi->GetName(), "dor-sl", 6))) {
m_ltDoor = roi;
}
else if (roi && (!strnicmp(roi->GetName(), "dor-rt", 6) || !strnicmp(roi->GetName(), "dor-sr", 6))) {
m_rtDoor = roi;
}
}
assert(m_ltDoor && m_rtDoor);
} }

View file

@ -40,6 +40,7 @@ class LegoWEGEdge : public LegoWEEdge {
LegoResult VTable0x04() override; // vtable+0x04 LegoResult VTable0x04() override; // vtable+0x04
// FUNCTION: BETA10 0x100270c0
LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; } LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; }
// FUNCTION: BETA10 0x1001ff80 // FUNCTION: BETA10 0x1001ff80