mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-25 13:41:32 -04:00
Clear unknowns in LegoPathBoundary
, LegoWEEdge
, LegoWEGEdge
and LegoPathController
(#1546)
This commit is contained in:
parent
06af7d25c6
commit
36c1093c88
@ -39,7 +39,7 @@ public:
|
||||
|
||||
MxResult AddActor(LegoPathActor* p_actor);
|
||||
MxResult RemoveActor(LegoPathActor* p_actor);
|
||||
void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
|
||||
void CheckAndCallPathTriggers(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
|
||||
void SwitchBoundary(
|
||||
LegoPathActor* p_actor,
|
||||
LegoPathBoundary*& p_boundary,
|
||||
@ -47,8 +47,8 @@ public:
|
||||
float& p_unk0xe4
|
||||
);
|
||||
MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoOrientedEdge*& p_edge);
|
||||
MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter);
|
||||
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);
|
||||
MxU32 AddPresenterIfInRange(LegoAnimPresenter* p_presenter);
|
||||
MxU32 RemovePresenter(LegoAnimPresenter* p_presenter);
|
||||
|
||||
// FUNCTION: BETA10 0x1001ffb0
|
||||
LegoPathActorSet& GetActors() { return m_actors; }
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
MxResult PlaceActor(LegoPathActor* p_actor);
|
||||
MxResult RemoveActor(LegoPathActor* p_actor);
|
||||
void FUN_100468f0(LegoAnimPresenter* p_presenter);
|
||||
void FUN_10046930(LegoAnimPresenter* p_presenter);
|
||||
void RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter);
|
||||
MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL);
|
||||
LegoPathBoundary* GetPathBoundary(const char* p_name);
|
||||
void Enable(MxBool p_enable);
|
||||
@ -189,12 +189,12 @@ private:
|
||||
|
||||
LegoPathBoundary* m_boundaries; // 0x08
|
||||
LegoPathCtrlEdge* m_edges; // 0x0c
|
||||
Mx3DPointFloat* m_unk0x10; // 0x10
|
||||
Mx3DPointFloat* m_nodes; // 0x10
|
||||
LegoPathStruct* m_structs; // 0x14
|
||||
MxU16 m_numL; // 0x18
|
||||
MxU16 m_numE; // 0x1a
|
||||
MxU16 m_numN; // 0x1c
|
||||
MxU16 m_numT; // 0x1e
|
||||
MxU16 m_numL; // 0x18 Number of boundaries
|
||||
MxU16 m_numE; // 0x1a Number of edges
|
||||
MxU16 m_numN; // 0x1c Number of nodes
|
||||
MxU16 m_numT; // 0x1e Number of structs
|
||||
LegoPathCtrlEdgeSet m_pfsE; // 0x20
|
||||
LegoPathActorSet m_actors; // 0x30
|
||||
|
||||
|
@ -244,7 +244,7 @@ void Act3Cop::ParseAction(char* p_extra)
|
||||
}
|
||||
}
|
||||
|
||||
Mx4DPointFloat* boundary0x14 = boundary->GetUnknown0x14();
|
||||
Mx4DPointFloat* boundary0x14 = boundary->GetUp();
|
||||
|
||||
if (point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) <= 0.001 &&
|
||||
point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) >= -0.001) {
|
||||
|
@ -337,7 +337,7 @@ void Act3Ammo::Animate(float p_time)
|
||||
Vector3 local174(local104[2]);
|
||||
|
||||
if (IsPizza()) {
|
||||
local184 = *m_boundary->GetUnknown0x14();
|
||||
local184 = *m_boundary->GetUp();
|
||||
local17c[0] = 1.0f;
|
||||
local17c[1] = local17c[2] = 0.0f;
|
||||
local174.EqualsCross(local17c, local184);
|
||||
@ -345,7 +345,7 @@ void Act3Ammo::Animate(float p_time)
|
||||
local17c.EqualsCross(local184, local174);
|
||||
}
|
||||
else {
|
||||
local17c = *m_boundary->GetUnknown0x14();
|
||||
local17c = *m_boundary->GetUp();
|
||||
local184[0] = 1.0f;
|
||||
local184[1] = local184[2] = 0.0f;
|
||||
local174.EqualsCross(local17c, local184);
|
||||
|
@ -827,7 +827,7 @@ MxResult LegoBuildingManager::FUN_10030630()
|
||||
}
|
||||
|
||||
if (g_buildingInfo[i].m_boundary != NULL) {
|
||||
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUnknown0x14();
|
||||
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUp();
|
||||
|
||||
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
|
||||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {
|
||||
|
@ -160,7 +160,7 @@ MxResult LegoPlantManager::FUN_10026410()
|
||||
}
|
||||
|
||||
if (g_plantInfo[i].m_boundary != NULL) {
|
||||
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUnknown0x14();
|
||||
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUp();
|
||||
|
||||
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
|
||||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {
|
||||
|
@ -369,7 +369,7 @@ void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter)
|
||||
LegoPathController* controller;
|
||||
|
||||
while (cursor.Next(controller)) {
|
||||
controller->FUN_10046930(p_presenter);
|
||||
controller->RemovePresenterFromBoundaries(p_presenter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ MxResult LegoPathActor::VTable0x88(
|
||||
matrix.SetIdentity();
|
||||
pos = p1;
|
||||
dir = p4;
|
||||
up = *m_boundary->GetUnknown0x14();
|
||||
up = *m_boundary->GetUp();
|
||||
|
||||
if (!m_cameraFlag || !m_userNavFlag) {
|
||||
dir *= -1.0f;
|
||||
@ -150,7 +150,7 @@ MxResult LegoPathActor::VTable0x88(
|
||||
m_roi->UpdateTransformationRelativeToParent(matrix);
|
||||
|
||||
if (!m_cameraFlag || !m_userNavFlag) {
|
||||
p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3);
|
||||
p5.EqualsCross(*p_boundary->GetUp(), p3);
|
||||
p5.Unitize();
|
||||
|
||||
if (VTable0x80(p1, p4, p2, p5) == SUCCESS) {
|
||||
@ -211,7 +211,7 @@ MxResult LegoPathActor::VTable0x84(
|
||||
matrix.SetIdentity();
|
||||
pos = p_p1;
|
||||
dir = p_p4;
|
||||
up = *m_boundary->GetUnknown0x14();
|
||||
up = *m_boundary->GetUp();
|
||||
|
||||
if (!m_cameraFlag || !m_userNavFlag) {
|
||||
dir *= -1.0f;
|
||||
@ -225,7 +225,7 @@ MxResult LegoPathActor::VTable0x84(
|
||||
FUN_10010c30();
|
||||
}
|
||||
else {
|
||||
p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3);
|
||||
p5.EqualsCross(*p_boundary->GetUp(), p3);
|
||||
p5.Unitize();
|
||||
|
||||
if (VTable0x80(p_p1, p_p4, p2, p5) != SUCCESS) {
|
||||
@ -256,7 +256,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
|
||||
|
||||
m_worldSpeed = nav->GetLinearVel();
|
||||
|
||||
if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUnknown0x14())) {
|
||||
if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUp())) {
|
||||
Mx3DPointFloat p6;
|
||||
p6 = p2;
|
||||
MxS32 result = 0;
|
||||
@ -280,7 +280,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
|
||||
result = 0;
|
||||
}
|
||||
else {
|
||||
m_boundary->FUN_100575b0(p4, p2, this);
|
||||
m_boundary->CheckAndCallPathTriggers(p4, p2, this);
|
||||
}
|
||||
|
||||
LegoPathBoundary* oldBoundary = m_boundary;
|
||||
@ -321,7 +321,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
|
||||
Vector3 pos(p_transform[3]);
|
||||
|
||||
dir = p1;
|
||||
up = *m_boundary->GetUnknown0x14();
|
||||
up = *m_boundary->GetUp();
|
||||
right.EqualsCross(up, dir);
|
||||
|
||||
MxS32 res = right.Unitize();
|
||||
@ -354,10 +354,10 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
|
||||
|
||||
LegoResult r;
|
||||
if (m_userNavFlag) {
|
||||
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 0);
|
||||
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 0);
|
||||
}
|
||||
else {
|
||||
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 1);
|
||||
r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 1);
|
||||
}
|
||||
|
||||
assert(r == 0); // SUCCESS
|
||||
@ -371,7 +371,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
m_boundary->FUN_100575b0(pos2, pos1, this);
|
||||
m_boundary->CheckAndCallPathTriggers(pos2, pos1, this);
|
||||
pos2 = pos1;
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ MxResult LegoPathActor::VTable0x9c()
|
||||
LERP3(local34, v1, v2, m_unk0xe4);
|
||||
|
||||
m_destEdge->GetFaceNormal(*m_boundary, local78);
|
||||
local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78);
|
||||
local48.EqualsCross(*m_boundary->GetUp(), local78);
|
||||
local48.Unitize();
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ MxResult LegoPathActor::VTable0x9c()
|
||||
Vector3 upRef(m_unk0xec[1]);
|
||||
Vector3 dirRef(m_unk0xec[2]);
|
||||
|
||||
upRef = *m_boundary->GetUnknown0x14();
|
||||
upRef = *m_boundary->GetUp();
|
||||
|
||||
rightRef.EqualsCross(upRef, dirRef);
|
||||
rightRef.Unitize();
|
||||
|
@ -44,27 +44,27 @@ MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor)
|
||||
|
||||
// FUNCTION: LEGO1 0x100575b0
|
||||
// FUNCTION: BETA10 0x100b1598
|
||||
void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor)
|
||||
void LegoPathBoundary::CheckAndCallPathTriggers(Vector3& p_from, Vector3& p_to, LegoPathActor* p_actor)
|
||||
{
|
||||
Vector3* ccwV = NULL;
|
||||
|
||||
if (m_numTriggers > 0 && m_unk0x50 != NULL) {
|
||||
if (m_numTriggers > 0 && m_direction != NULL) {
|
||||
ccwV = m_edges[0]->CCWVertex(*this);
|
||||
Mx3DPointFloat v;
|
||||
|
||||
v = p_point1;
|
||||
v = p_from;
|
||||
v -= *ccwV;
|
||||
float dot1 = v.Dot(v, *m_unk0x50);
|
||||
float dot1 = v.Dot(v, *m_direction);
|
||||
|
||||
v = p_point2;
|
||||
v = p_to;
|
||||
v -= *ccwV;
|
||||
float dot2 = v.Dot(v, *m_unk0x50);
|
||||
float dot2 = v.Dot(v, *m_direction);
|
||||
|
||||
if (dot2 > dot1) {
|
||||
for (MxS32 i = 0; i < m_numTriggers; i++) {
|
||||
LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
|
||||
|
||||
if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) {
|
||||
if (m_pathTrigger[i].m_triggerLength >= dot1 && m_pathTrigger[i].m_triggerLength < dot2) {
|
||||
s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data);
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
|
||||
for (MxS32 i = 0; i < m_numTriggers; i++) {
|
||||
LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
|
||||
|
||||
if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) {
|
||||
if (m_pathTrigger[i].m_triggerLength >= dot2 && m_pathTrigger[i].m_triggerLength < dot1) {
|
||||
s->HandleTrigger(p_actor, FALSE, m_pathTrigger[i].m_data);
|
||||
}
|
||||
}
|
||||
@ -339,15 +339,15 @@ MxU32 LegoPathBoundary::Intersect(
|
||||
|
||||
// FUNCTION: LEGO1 0x10057fe0
|
||||
// FUNCTION: BETA10 0x100b2220
|
||||
MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
|
||||
MxU32 LegoPathBoundary::AddPresenterIfInRange(LegoAnimPresenter* p_presenter)
|
||||
{
|
||||
Mx3DPointFloat unk0x30;
|
||||
|
||||
unk0x30 = m_unk0x30;
|
||||
unk0x30 = m_centerPoint;
|
||||
unk0x30 -= p_presenter->m_unk0xa8;
|
||||
|
||||
float len = unk0x30.LenSquared();
|
||||
float local20 = p_presenter->m_unk0xa4 + m_unk0x44;
|
||||
float local20 = p_presenter->m_unk0xa4 + m_boundingRadius;
|
||||
|
||||
if (len > 0.001 && len > local20 * local20) {
|
||||
return 0;
|
||||
@ -362,7 +362,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
|
||||
|
||||
// FUNCTION: LEGO1 0x100586e0
|
||||
// FUNCTION: BETA10 0x100b22d1
|
||||
MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter)
|
||||
MxU32 LegoPathBoundary::RemovePresenter(LegoAnimPresenter* p_presenter)
|
||||
{
|
||||
if (p_presenter != NULL) {
|
||||
// TODO: This only seems to match if the type is not the same as the type of the
|
||||
|
@ -71,7 +71,7 @@ LegoPathController::LegoPathController()
|
||||
{
|
||||
m_boundaries = NULL;
|
||||
m_edges = NULL;
|
||||
m_unk0x10 = NULL;
|
||||
m_nodes = NULL;
|
||||
m_structs = NULL;
|
||||
m_numL = 0;
|
||||
m_numE = 0;
|
||||
@ -94,7 +94,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con
|
||||
}
|
||||
|
||||
for (i = 0; i < m_numN; i++) {
|
||||
m_unk0x10[i] += p_location;
|
||||
m_nodes[i] += p_location;
|
||||
}
|
||||
|
||||
for (i = 0; i < m_numL; i++) {
|
||||
@ -144,10 +144,10 @@ void LegoPathController::Destroy()
|
||||
m_boundaries = NULL;
|
||||
m_numL = 0;
|
||||
|
||||
if (m_unk0x10 != NULL) {
|
||||
delete[] m_unk0x10;
|
||||
if (m_nodes != NULL) {
|
||||
delete[] m_nodes;
|
||||
}
|
||||
m_unk0x10 = NULL;
|
||||
m_nodes = NULL;
|
||||
m_numN = 0;
|
||||
|
||||
if (m_structs != NULL) {
|
||||
@ -347,17 +347,17 @@ void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_numL; i++) {
|
||||
if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) {
|
||||
m_boundaries[i].FUN_10057fe0(p_presenter);
|
||||
m_boundaries[i].AddPresenterIfInRange(p_presenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10046930
|
||||
// FUNCTION: BETA10 0x100b737b
|
||||
void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter)
|
||||
void LegoPathController::RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_numL; i++) {
|
||||
m_boundaries[i].FUN_100586e0(p_presenter);
|
||||
m_boundaries[i].RemovePresenter(p_presenter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
|
||||
return FAILURE;
|
||||
}
|
||||
if (m_numN > 0) {
|
||||
m_unk0x10 = new Mx3DPointFloat[m_numN];
|
||||
m_nodes = new Mx3DPointFloat[m_numN];
|
||||
}
|
||||
|
||||
if (p_storage->Read(&m_numE, sizeof(MxU16)) != SUCCESS) {
|
||||
@ -494,7 +494,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
|
||||
|
||||
if (m_numN > 0) {
|
||||
for (MxS32 i = 0; i < m_numN; i++) {
|
||||
if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) {
|
||||
if (ReadVector(p_storage, m_nodes[i]) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -559,12 +559,12 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_pointA = &m_unk0x10[s];
|
||||
edge.m_pointA = &m_nodes[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_pointB = &m_unk0x10[s];
|
||||
edge.m_pointB = &m_nodes[s];
|
||||
|
||||
if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
@ -662,7 +662,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
|
||||
boundary.m_name[length] = '\0';
|
||||
}
|
||||
|
||||
if (ReadVector(p_storage, boundary.m_unk0x14) != SUCCESS) {
|
||||
if (ReadVector(p_storage, boundary.m_up) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -672,11 +672,11 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
|
||||
}
|
||||
}
|
||||
|
||||
if (ReadVector(p_storage, boundary.m_unk0x30) != SUCCESS) {
|
||||
if (ReadVector(p_storage, boundary.m_centerPoint) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_storage->Read(&boundary.m_unk0x44, sizeof(boundary.m_unk0x44)) != SUCCESS) {
|
||||
if (p_storage->Read(&boundary.m_boundingRadius, sizeof(boundary.m_boundingRadius)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
|
||||
}
|
||||
|
||||
if (boundary.m_numTriggers > 0) {
|
||||
boundary.m_unk0x50 = new Mx3DPointFloat;
|
||||
boundary.m_direction = new Mx3DPointFloat;
|
||||
boundary.m_pathTrigger = new PathWithTrigger[boundary.m_numTriggers];
|
||||
|
||||
for (j = 0; j < boundary.m_numTriggers; j++) {
|
||||
@ -701,14 +701,14 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
|
||||
}
|
||||
|
||||
if (p_storage->Read(
|
||||
&boundary.m_pathTrigger[j].m_unk0x08,
|
||||
sizeof(boundary.m_pathTrigger[j].m_unk0x08)
|
||||
&boundary.m_pathTrigger[j].m_triggerLength,
|
||||
sizeof(boundary.m_pathTrigger[j].m_triggerLength)
|
||||
) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ReadVector(p_storage, *boundary.m_unk0x50) != SUCCESS) {
|
||||
if (ReadVector(p_storage, *boundary.m_direction) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -956,7 +956,7 @@ MxS32 LegoPathController::FUN_1004a240(
|
||||
p_v1 *= p_f1;
|
||||
p_v1 += *p_edge->CWVertex(*p_boundary);
|
||||
p_edge->GetFaceNormal(*p_boundary, vec);
|
||||
p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec);
|
||||
p_v2.EqualsCross(*p_boundary->GetUp(), vec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -980,7 +980,7 @@ MxResult LegoPathController::FUN_1004a380(
|
||||
}
|
||||
|
||||
LegoPathBoundary* b = &m_boundaries[i];
|
||||
Mx4DPointFloat* unk0x14 = b->GetUnknown0x14();
|
||||
Mx4DPointFloat* unk0x14 = b->GetUp();
|
||||
float local28 = p_param3[0].Dot(p_param3[0], *unk0x14);
|
||||
|
||||
if (local28 < 0.001 && local28 > -0.001) {
|
||||
|
@ -171,7 +171,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
|
||||
|
||||
m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector);
|
||||
|
||||
crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector);
|
||||
crossProduct.EqualsCross(*m_boundary->GetUp(), destEdgeUnknownVector);
|
||||
crossProduct.Unitize();
|
||||
|
||||
Mx3DPointFloat worldDirection(Vector3(m_roi->GetWorldDirection()));
|
||||
@ -265,8 +265,8 @@ MxResult LegoCarRaceActor::VTable0x9c()
|
||||
d->GetFaceNormal(*b, point2);
|
||||
m_destEdge->GetFaceNormal(*m_boundary, point3);
|
||||
|
||||
point4.EqualsCross(point2, *m_boundary->GetUnknown0x14());
|
||||
point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3);
|
||||
point4.EqualsCross(point2, *m_boundary->GetUp());
|
||||
point5.EqualsCross(*m_boundary->GetUp(), point3);
|
||||
|
||||
point4.Unitize();
|
||||
point5.Unitize();
|
||||
@ -365,7 +365,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
|
||||
LERP3(a, *v1, *v2, m_unk0xe4);
|
||||
|
||||
m_destEdge->GetFaceNormal(*m_boundary, bbb);
|
||||
c.EqualsCross(bbb, *m_boundary->GetUnknown0x14());
|
||||
c.EqualsCross(bbb, *m_boundary->GetUp());
|
||||
c.Unitize();
|
||||
|
||||
Mx3DPointFloat worldDirection(m_roi->GetWorldDirection());
|
||||
|
@ -20,7 +20,7 @@ LegoWEEdge::~LegoWEEdge()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009a5b0
|
||||
LegoS32 LegoWEEdge::VTable0x04()
|
||||
LegoS32 LegoWEEdge::LinkEdgesAndFaces()
|
||||
{
|
||||
for (LegoS32 i = 0; i < m_numEdges; i++) {
|
||||
LegoOrientedEdge* e1 = m_edges[i];
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
LegoWEEdge();
|
||||
virtual ~LegoWEEdge(); // vtable+0x00
|
||||
|
||||
virtual LegoS32 VTable0x04(); // vtable+0x04
|
||||
virtual LegoS32 LinkEdgesAndFaces(); // vtable+0x04
|
||||
|
||||
// FUNCTION: BETA10 0x1001c980
|
||||
LegoU8 GetNumEdges() { return m_numEdges; }
|
||||
|
@ -13,12 +13,12 @@ LegoWEGEdge::LegoWEGEdge()
|
||||
{
|
||||
m_unk0x0d = 0;
|
||||
m_name = NULL;
|
||||
m_unk0x14.Clear();
|
||||
m_up.Clear();
|
||||
m_edgeNormals = NULL;
|
||||
m_flags = 0;
|
||||
m_numTriggers = 0;
|
||||
m_pathTrigger = NULL;
|
||||
m_unk0x50 = NULL;
|
||||
m_direction = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009a800
|
||||
@ -37,18 +37,18 @@ LegoWEGEdge::~LegoWEGEdge()
|
||||
if (m_pathTrigger) {
|
||||
delete[] m_pathTrigger;
|
||||
}
|
||||
if (m_unk0x50) {
|
||||
delete m_unk0x50;
|
||||
if (m_direction) {
|
||||
delete m_direction;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009a8c0
|
||||
// FUNCTION: BETA10 0x101832f7
|
||||
LegoS32 LegoWEGEdge::VTable0x04()
|
||||
LegoS32 LegoWEGEdge::LinkEdgesAndFaces()
|
||||
{
|
||||
LegoS32 result = 0;
|
||||
m_unk0x30.Clear();
|
||||
LegoWEEdge::VTable0x04();
|
||||
m_centerPoint.Clear();
|
||||
LegoWEEdge::LinkEdgesAndFaces();
|
||||
|
||||
assert(m_numEdges > 1);
|
||||
|
||||
@ -72,7 +72,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
local14 = m_edges[1]->m_pointB;
|
||||
}
|
||||
|
||||
result = FUN_1009aea0();
|
||||
result = ValidateFacePlanarity();
|
||||
if (result != 0) {
|
||||
result = -2;
|
||||
}
|
||||
@ -86,35 +86,35 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
|
||||
for (i = 0; i < m_numEdges; i++) {
|
||||
edge = m_edges[i];
|
||||
m_unk0x30 += *edge->m_pointA;
|
||||
m_unk0x30 += *edge->m_pointB;
|
||||
m_centerPoint += *edge->m_pointA;
|
||||
m_centerPoint += *edge->m_pointB;
|
||||
}
|
||||
|
||||
m_unk0x30 /= m_numEdges * 2;
|
||||
m_unk0x44 = 0.0f;
|
||||
m_centerPoint /= m_numEdges * 2;
|
||||
m_boundingRadius = 0.0f;
|
||||
|
||||
for (i = 0; i < m_numEdges; i++) {
|
||||
Mx3DPointFloat local44;
|
||||
edge = m_edges[i];
|
||||
|
||||
local44 = *edge->m_pointA;
|
||||
local44 -= m_unk0x30;
|
||||
local44 -= m_centerPoint;
|
||||
float length = local44.LenSquared();
|
||||
|
||||
if (m_unk0x44 < length) {
|
||||
m_unk0x44 = length;
|
||||
if (m_boundingRadius < length) {
|
||||
m_boundingRadius = length;
|
||||
}
|
||||
|
||||
local44 = *edge->m_pointB;
|
||||
local44 -= m_unk0x30;
|
||||
local44 -= m_centerPoint;
|
||||
length = local44.LenSquared();
|
||||
|
||||
if (m_unk0x44 < length) {
|
||||
m_unk0x44 = length;
|
||||
if (m_boundingRadius < length) {
|
||||
m_boundingRadius = length;
|
||||
}
|
||||
}
|
||||
|
||||
m_unk0x44 = sqrt((double) m_unk0x44);
|
||||
m_boundingRadius = sqrt((double) m_boundingRadius);
|
||||
|
||||
for (i = 0; i < m_numEdges; i++) {
|
||||
edge = m_edges[i];
|
||||
@ -139,10 +139,10 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
Mx3DPointFloat local58;
|
||||
Vector3 local64(&m_edgeNormals[i][0]);
|
||||
edge->GetFaceNormal(*this, local58);
|
||||
local64.EqualsCross(local58, m_unk0x14);
|
||||
local64.EqualsCross(local58, m_up);
|
||||
|
||||
m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64);
|
||||
if (m_edgeNormals[i][3] + m_unk0x30.Dot(m_unk0x30, local64) < 0.0f) {
|
||||
if (m_edgeNormals[i][3] + m_centerPoint.Dot(m_centerPoint, local64) < 0.0f) {
|
||||
m_edgeNormals[i] *= -1.0f;
|
||||
}
|
||||
|
||||
@ -156,14 +156,14 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
Vector3* vTrig2 = m_edges[1]->CCWVertex(*this);
|
||||
assert(vTrig1 && vTrig2);
|
||||
|
||||
m_unk0x50 = new Mx3DPointFloat();
|
||||
*m_unk0x50 = *vTrig2;
|
||||
*m_unk0x50 -= *vTrig1;
|
||||
m_direction = new Mx3DPointFloat();
|
||||
*m_direction = *vTrig2;
|
||||
*m_direction -= *vTrig1;
|
||||
|
||||
if (m_unk0x50->Unitize() < 0) {
|
||||
if (m_direction->Unitize() < 0) {
|
||||
assert(0);
|
||||
delete m_unk0x50;
|
||||
m_unk0x50 = NULL;
|
||||
delete m_direction;
|
||||
m_direction = NULL;
|
||||
}
|
||||
|
||||
if (GetNumEdges() == 4) {
|
||||
@ -178,12 +178,12 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
localb8 -= *vTrig1;
|
||||
local80 -= *vTrig1;
|
||||
|
||||
float locala4 = localb8.Dot(*m_unk0x50, localb8);
|
||||
float locala4 = localb8.Dot(*m_direction, localb8);
|
||||
if (local98 < locala4) {
|
||||
local98 = locala4;
|
||||
}
|
||||
|
||||
locala4 = local80.Dot(*m_unk0x50, local80);
|
||||
locala4 = local80.Dot(*m_direction, local80);
|
||||
if (locala4 < local9c) {
|
||||
local9c = locala4;
|
||||
}
|
||||
@ -199,12 +199,12 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
local9c -= 0.001;
|
||||
|
||||
for (LegoS32 j = 0; j < m_numTriggers; j++) {
|
||||
if (m_pathTrigger[j].m_unk0x08 < local98) {
|
||||
m_pathTrigger[j].m_unk0x08 = local98;
|
||||
if (m_pathTrigger[j].m_triggerLength < local98) {
|
||||
m_pathTrigger[j].m_triggerLength = local98;
|
||||
}
|
||||
|
||||
if (m_pathTrigger[j].m_unk0x08 > local9c) {
|
||||
m_pathTrigger[j].m_unk0x08 = local9c;
|
||||
if (m_pathTrigger[j].m_triggerLength > local9c) {
|
||||
m_pathTrigger[j].m_triggerLength = local9c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
|
||||
|
||||
// FUNCTION: LEGO1 0x1009aea0
|
||||
// FUNCTION: BETA10 0x10183e2a
|
||||
LegoS32 LegoWEGEdge::FUN_1009aea0()
|
||||
LegoS32 LegoWEGEdge::ValidateFacePlanarity()
|
||||
{
|
||||
LegoU32 localc = FALSE;
|
||||
Mx3DPointFloat local24;
|
||||
@ -255,17 +255,17 @@ LegoS32 LegoWEGEdge::FUN_1009aea0()
|
||||
local24 /= local58;
|
||||
|
||||
if (localc) {
|
||||
float local54 = local24.Dot(m_unk0x14, local24);
|
||||
float local54 = local24.Dot(m_up, local24);
|
||||
if (local54 < 0.98) {
|
||||
delete[] local8;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_unk0x14[0] = local24[0];
|
||||
m_unk0x14[1] = local24[1];
|
||||
m_unk0x14[2] = local24[2];
|
||||
m_unk0x14[3] = -local8[i]->Dot(*local8[i], local24);
|
||||
m_up[0] = local24[0];
|
||||
m_up[1] = local24[1];
|
||||
m_up[2] = local24[2];
|
||||
m_up[3] = -local8[i]->Dot(*local8[i], local24);
|
||||
localc = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ struct PathWithTrigger {
|
||||
{
|
||||
m_pathStruct = NULL;
|
||||
m_data = 0;
|
||||
m_unk0x08 = 0.0f;
|
||||
m_triggerLength = 0.0f;
|
||||
}
|
||||
|
||||
LegoPathStruct* m_pathStruct; // 0x00
|
||||
unsigned int m_data; // 0x04
|
||||
float m_unk0x08; // 0x08
|
||||
float m_triggerLength; // 0x08
|
||||
};
|
||||
|
||||
#include "mxgeometry/mxgeometry3d.h"
|
||||
@ -42,7 +42,7 @@ public:
|
||||
LegoWEGEdge();
|
||||
~LegoWEGEdge() override;
|
||||
|
||||
LegoS32 VTable0x04() override; // vtable+0x04
|
||||
LegoS32 LinkEdgesAndFaces() override; // vtable+0x04
|
||||
|
||||
// FUNCTION: BETA10 0x100270c0
|
||||
LegoU32 GetFlag0x10()
|
||||
@ -57,7 +57,7 @@ public:
|
||||
|
||||
// TODO: Other BETA10 reference at 0x1001c9e0, not sure what is going on
|
||||
// FUNCTION: BETA10 0x1001ff80
|
||||
Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
|
||||
Mx4DPointFloat* GetUp() { return &m_up; }
|
||||
|
||||
// FUNCTION: BETA10 0x1001ca10
|
||||
Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; }
|
||||
@ -85,18 +85,18 @@ public:
|
||||
friend class LegoPathController;
|
||||
|
||||
protected:
|
||||
LegoS32 FUN_1009aea0();
|
||||
LegoS32 ValidateFacePlanarity();
|
||||
|
||||
LegoU8 m_flags; // 0x0c
|
||||
LegoU8 m_unk0x0d; // 0x0d
|
||||
LegoChar* m_name; // 0x10
|
||||
Mx4DPointFloat m_unk0x14; // 0x14
|
||||
Mx4DPointFloat m_up; // 0x14
|
||||
Mx4DPointFloat* m_edgeNormals; // 0x2c
|
||||
Mx3DPointFloat m_unk0x30; // 0x30
|
||||
float m_unk0x44; // 0x44
|
||||
Mx3DPointFloat m_centerPoint; // 0x30
|
||||
float m_boundingRadius; // 0x44
|
||||
LegoU8 m_numTriggers; // 0x48
|
||||
PathWithTrigger* m_pathTrigger; // 0x4c
|
||||
Mx3DPointFloat* m_unk0x50; // 0x50
|
||||
Mx3DPointFloat* m_direction; // 0x50
|
||||
};
|
||||
|
||||
#endif // __LEGOWEGEDGE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user