Implement/match LegoPathController::FUN_1004a240 (#941)

This commit is contained in:
Christian Semmler
2024-05-20 11:34:31 -04:00
committed by GitHub
parent 8428cde67f
commit 3342464321
19 changed files with 141 additions and 31 deletions

View File

@@ -151,7 +151,7 @@ MxResult LegoExtraActor::FUN_1002aae0()
m_boundary = oldEdge;
}
LegoPathActor::WaitForAnimation();
LegoPathActor::VTable0x9c();
return SUCCESS;
}
@@ -280,10 +280,10 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
}
// FUNCTION: LEGO1 0x1002b290
MxResult LegoExtraActor::WaitForAnimation()
MxResult LegoExtraActor::VTable0x9c()
{
LegoPathBoundary* oldBoundary = m_boundary;
MxResult result = LegoPathActor::WaitForAnimation();
MxResult result = LegoPathActor::VTable0x9c();
if (m_boundary != oldBoundary) {
MxU32 b = FALSE;

View File

@@ -5,6 +5,7 @@
#include "legocameracontroller.h"
#include "legonavcontroller.h"
#include "legopathboundary.h"
#include "legopathedgecontainer.h"
#include "legosoundmanager.h"
#include "legoworld.h"
#include "misc.h"
@@ -15,6 +16,7 @@
#include <vec.h>
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
DECOMP_SIZE_ASSERT(LegoPathEdgeContainer, 0x3c)
#ifndef M_PI
#define M_PI 3.1416
@@ -40,21 +42,21 @@ LegoPathActor::LegoPathActor()
m_unk0x7c = 0;
m_userNavFlag = FALSE;
m_state = 0;
m_unk0x134 = NULL;
m_grec = NULL;
m_controller = NULL;
m_unk0xe8 = 0;
m_unk0x148 = 0;
m_unk0x14c = 0;
m_unk0x140 = 0.0099999998f;
m_unk0x144 = 0.80000001f;
m_unk0x140 = 0.0099999999f;
m_unk0x144 = 0.8f;
m_unk0x150 = 2.0f;
}
// STUB: LEGO1 0x1002d820
// FUNCTION: LEGO1 0x1002d820
LegoPathActor::~LegoPathActor()
{
if (m_unk0x134) {
delete m_unk0x134;
if (m_grec) {
delete m_grec;
}
}
@@ -264,7 +266,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
LegoPathBoundary* oldBoundary = m_boundary;
if (m_unk0xe9 != 0) {
WaitForAnimation();
VTable0x9c();
if (m_boundary == oldBoundary) {
MxLong time = Timer()->GetTime();
@@ -344,7 +346,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
pos2 = pos1;
if (m_unk0xe9 != 0) {
WaitForAnimation();
VTable0x9c();
}
return 0;
@@ -544,7 +546,8 @@ void LegoPathActor::ParseAction(char* p_extra)
}
// STUB: LEGO1 0x1002f1b0
MxResult LegoPathActor::WaitForAnimation()
// FUNCTION: BETA10 0x100af899
MxResult LegoPathActor::VTable0x9c()
{
// TODO
return SUCCESS;

View File

@@ -87,7 +87,7 @@ MxU32 LegoPathBoundary::Intersect(
Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
LegoEdge*& p_edge
LegoUnknown100db7f4*& p_edge
)
{
LegoUnknown100db7f4* e = NULL;
@@ -207,7 +207,7 @@ MxU32 LegoPathBoundary::Intersect(
if (local58 <= 0.0f) {
if (!e->GetMask0x03()) {
p_edge = e->GetClockwiseEdge(*this);
p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this);
}
else {
p_edge = e;
@@ -227,7 +227,7 @@ MxU32 LegoPathBoundary::Intersect(
p_point3 = *e->CCWVertex(*this);
if (!e->GetMask0x03()) {
p_edge = e->GetCounterclockwiseEdge(*this);
p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this);
}
else {
p_edge = e;

View File

@@ -1,5 +1,6 @@
#include "legopathcontroller.h"
#include "legopathedgecontainer.h"
#include "legopathstruct.h"
#include "misc/legostorage.h"
#include "mxmisc.h"
@@ -727,3 +728,36 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat&
return SUCCESS;
}
// FUNCTION: LEGO1 0x1004a240
// FUNCTION: BETA10 0x100b9160
MxU32 LegoPathController::FUN_1004a240(
LegoPathEdgeContainer& p_grec,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
LegoUnknown100db7f4*& p_edge,
LegoPathBoundary*& p_boundary
)
{
if (p_grec.size() == 0) {
p_v1 = p_grec.m_unk0x0c;
p_v2 = p_grec.m_unk0x20;
p_boundary = p_grec.m_boundary;
p_grec.SetBit1(FALSE);
return 1;
}
p_edge = p_grec.front().m_edge;
p_boundary = p_grec.front().m_boundary;
p_grec.pop_front();
Mx3DPointFloat vec;
p_v1 = *p_edge->CCWVertex(*p_boundary);
p_v1.Sub(p_edge->GetOpposingPoint(*p_boundary));
p_v1.Mul(p_f1);
p_v1.Add(p_edge->GetOpposingPoint(*p_boundary));
p_edge->FUN_1002ddc0(*p_boundary, vec);
p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec);
return 0;
}