Refactor LegoUnknown100db7f4 to LegoOrientedEdge (#1515)

* Refactor `LegoUnknown100db7f4` to `LegoOrientedEdge`

* Update LEGO1/lego/sources/geom/legoorientededge.h

* Update legopathcontroller.h

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Florian Kaiser
2025-05-25 08:09:24 +02:00
committed by GitHub
parent 8e54a20d7d
commit 804632b13f
24 changed files with 158 additions and 166 deletions

View File

@@ -160,7 +160,7 @@ function(add_lego_libraries NAME)
add_library(geom${ARG_SUFFIX} STATIC add_library(geom${ARG_SUFFIX} STATIC
LEGO1/lego/sources/geom/legoedge.cpp LEGO1/lego/sources/geom/legoedge.cpp
LEGO1/lego/sources/geom/legoweedge.cpp LEGO1/lego/sources/geom/legoweedge.cpp
LEGO1/lego/sources/geom/legounkown100db7f4.cpp LEGO1/lego/sources/geom/legoorientededge.cpp
LEGO1/lego/sources/geom/legowegedge.cpp LEGO1/lego/sources/geom/legowegedge.cpp
) )
list(APPEND list_targets geom${ARG_SUFFIX}) list(APPEND list_targets geom${ARG_SUFFIX})

View File

@@ -140,7 +140,7 @@ public:
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void SwitchBoundary( void SwitchBoundary(
LegoPathBoundary*& p_boundary, LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
float& p_unk0xe4 float& p_unk0xe4
) override; // vtable+0x98 ) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c

View File

@@ -16,7 +16,7 @@ class LegoFile;
class LegoPathActor; class LegoPathActor;
class LegoPathBoundary; class LegoPathBoundary;
class LegoROIList; class LegoROIList;
struct LegoUnknown100db7f4; struct LegoOrientedEdge;
class LegoWorld; class LegoWorld;
class MxDSAction; class MxDSAction;
@@ -240,7 +240,7 @@ private:
void FUN_10063d10(); void FUN_10063d10();
void FUN_10063e40(LegoAnimPresenter* p_presenter); void FUN_10063e40(LegoAnimPresenter* p_presenter);
MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world);
MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale); MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale);
MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2); MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2);
MxResult FUN_10064380( MxResult FUN_10064380(
const char* p_name, const char* p_name,

View File

@@ -10,7 +10,7 @@ struct LegoNamedPlane;
class LegoPathBoundary; class LegoPathBoundary;
class LegoPathController; class LegoPathController;
struct LegoPathEdgeContainer; struct LegoPathEdgeContainer;
struct LegoUnknown100db7f4; struct LegoOrientedEdge;
class LegoWEEdge; class LegoWEEdge;
extern MxLong g_unk0x100f3308; extern MxLong g_unk0x100f3308;
@@ -67,7 +67,7 @@ public:
float p_time, float p_time,
Vector3& p_p1, Vector3& p_p1,
Vector3& p_p4, Vector3& p_p4,
LegoUnknown100db7f4& p_destEdge, LegoOrientedEdge& p_destEdge,
float p_destScale float p_destScale
); // vtable+0x84 ); // vtable+0x84
virtual MxResult VTable0x88( virtual MxResult VTable0x88(
@@ -75,7 +75,7 @@ public:
float p_time, float p_time,
LegoEdge& p_srcEdge, LegoEdge& p_srcEdge,
float p_srcScale, float p_srcScale,
LegoUnknown100db7f4& p_destEdge, LegoOrientedEdge& p_destEdge,
float p_destScale float p_destScale
); // vtable+0x88 ); // vtable+0x88
virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c
@@ -88,7 +88,7 @@ public:
virtual void SwitchBoundary( virtual void SwitchBoundary(
LegoPathBoundary*& p_boundary, LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
float& p_unk0xe4 float& p_unk0xe4
); // vtable+0x98 ); // vtable+0x98
virtual MxResult VTable0x9c(); // vtable+0x9c virtual MxResult VTable0x9c(); // vtable+0x9c
@@ -182,7 +182,7 @@ protected:
LegoPathBoundary* m_boundary; // 0x88 LegoPathBoundary* m_boundary; // 0x88
LegoUnknown m_unk0x8c; // 0x8c LegoUnknown m_unk0x8c; // 0x8c
MxU32 m_actorState; // 0xdc MxU32 m_actorState; // 0xdc
LegoUnknown100db7f4* m_destEdge; // 0xe0 LegoOrientedEdge* m_destEdge; // 0xe0
MxFloat m_unk0xe4; // 0xe4 MxFloat m_unk0xe4; // 0xe4
MxBool m_collideBox; // 0xe8 MxBool m_collideBox; // 0xe8
MxBool m_unk0xe9; // 0xe9 MxBool m_unk0xe9; // 0xe9

View File

@@ -43,16 +43,10 @@ public:
void SwitchBoundary( void SwitchBoundary(
LegoPathActor* p_actor, LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary, LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
float& p_unk0xe4 float& p_unk0xe4
); );
MxU32 Intersect( MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoOrientedEdge*& p_edge);
float p_scale,
Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
LegoUnknown100db7f4*& p_edge
);
MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter); MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter);
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);

View File

@@ -2,7 +2,7 @@
#define LEGOPATHCONTROLLER_H #define LEGOPATHCONTROLLER_H
#include "decomp.h" #include "decomp.h"
#include "geom/legounkown100db7f4.h" #include "geom/legoorientededge.h"
#include "legopathactor.h" #include "legopathactor.h"
#include "legopathboundary.h" #include "legopathboundary.h"
#include "legopathstruct.h" #include "legopathstruct.h"
@@ -21,7 +21,7 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8 // VTABLE: LEGO1 0x100d7da8
// SIZE 0x40 // SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; struct LegoPathCtrlEdge : public LegoOrientedEdge {};
struct LegoPathCtrlEdgeCompare { struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
@@ -60,7 +60,7 @@ public:
} }
LegoPathController* m_controller; // 0x00 LegoPathController* m_controller; // 0x00
LegoUnknown100db7f4* m_edge; // 0x04 LegoOrientedEdge* m_edge; // 0x04
}; };
LegoPathController(); LegoPathController();
@@ -126,7 +126,7 @@ public:
Vector3& p_v1, Vector3& p_v1,
Vector3& p_v2, Vector3& p_v2,
float p_f1, float p_f1,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
LegoPathBoundary*& p_boundary LegoPathBoundary*& p_boundary
); );
MxResult FUN_1004a380( MxResult FUN_1004a380(
@@ -144,13 +144,13 @@ public:
static MxResult Reset(); static MxResult Reset();
// FUNCTION: BETA10 0x100cf580 // FUNCTION: BETA10 0x100cf580
static LegoUnknown100db7f4* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; } static LegoOrientedEdge* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; }
// FUNCTION: BETA10 0x100cf5b0 // FUNCTION: BETA10 0x100cf5b0
static LegoPathBoundary* GetControlBoundaryA(MxS32 p_index) { return g_ctrlBoundariesA[p_index].m_boundary; } static LegoPathBoundary* GetControlBoundaryA(MxS32 p_index) { return g_ctrlBoundariesA[p_index].m_boundary; }
// These two are an educated guess because BETA10 does not have the g_ctrl.*B globals // These two are an educated guess because BETA10 does not have the g_ctrl.*B globals
static LegoUnknown100db7f4* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; } static LegoOrientedEdge* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; }
static LegoPathBoundary* GetControlBoundaryB(MxS32 p_index) { return g_ctrlBoundariesB[p_index].m_boundary; } static LegoPathBoundary* GetControlBoundaryB(MxS32 p_index) { return g_ctrlBoundariesB[p_index].m_boundary; }
private: private:
@@ -264,7 +264,7 @@ private:
// LegoPathCtrlEdge::~LegoPathCtrlEdge // LegoPathCtrlEdge::~LegoPathCtrlEdge
// SYNTHETIC: LEGO1 0x10047ae0 // SYNTHETIC: LEGO1 0x10047ae0
// LegoUnknown100db7f4::~LegoUnknown100db7f4 // LegoOrientedEdge::~LegoOrientedEdge
// TEMPLATE: LEGO1 0x10048f00 // TEMPLATE: LEGO1 0x10048f00
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::begin // list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::begin

View File

@@ -72,7 +72,7 @@ public:
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// FUNCTION: LEGO1 0x100141d0 // FUNCTION: LEGO1 0x100141d0
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override
{ {
LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} // vtable+0x98 } // vtable+0x98
@@ -136,7 +136,7 @@ public:
// FUNCTION: LEGO1 0x10014560 // FUNCTION: LEGO1 0x10014560
// FUNCTION: BETA10 0x100cd660 // FUNCTION: BETA10 0x100cd660
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override
{ {
LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} // vtable+0x98 } // vtable+0x98

View File

@@ -44,7 +44,7 @@ public:
Vector3& p_v3 Vector3& p_v3
) override; // vtable+0x6c ) override; // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70 void Animate(float p_time) override; // vtable+0x70
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
override; // vtable+0x98 override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c

View File

@@ -417,7 +417,7 @@ void Act2Actor::FUN_100192a0(undefined4 p_location)
newPosition, newPosition,
newDirection, newDirection,
newBoundary, newBoundary,
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
NULL NULL
); );

View File

@@ -353,7 +353,7 @@ MxResult Act3Cop::FUN_10040360()
local7c, local7c,
local5c, local5c,
boundary, boundary,
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
&local34 &local34
) != SUCCESS) { ) != SUCCESS) {
delete grec; delete grec;
@@ -391,7 +391,7 @@ MxResult Act3Cop::FUN_10040360()
local88, local88,
localec, localec,
donut->GetBoundary(), donut->GetBoundary(),
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
&locald8 &locald8
) == SUCCESS && ) == SUCCESS &&
(grec == NULL || locald8 < local18)) { (grec == NULL || locald8 < local18)) {
@@ -431,7 +431,7 @@ MxResult Act3Cop::FUN_10040360()
localf8, localf8,
local108, local108,
boundary, boundary,
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
&local100 &local100
) != SUCCESS) { ) != SUCCESS) {
local14c = local150 = grec; local14c = local150 = grec;
@@ -831,7 +831,7 @@ MxResult Act3Brickster::FUN_100417c0()
local88, local88,
localec, localec,
pizza->GetBoundary(), pizza->GetBoundary(),
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
&locald8 &locald8
) == SUCCESS && ) == SUCCESS &&
(grec == NULL || locald8 < local18)) { (grec == NULL || locald8 < local18)) {
@@ -915,7 +915,7 @@ MxResult Act3Brickster::FUN_100417c0()
local108, local108,
local138, local138,
localf4, localf4,
LegoUnknown100db7f4::c_bit1, LegoOrientedEdge::c_bit1,
&local13c &local13c
) != SUCCESS) { ) != SUCCESS) {
local1bc = local1c0 = grec; local1bc = local1c0 = grec;
@@ -1055,7 +1055,7 @@ MxS32 Act3Brickster::FUN_10042300()
assert(m_boundary && m_destEdge && m_roi); assert(m_boundary && m_destEdge && m_roi);
LegoPathBoundary* boundaries[2]; LegoPathBoundary* boundaries[2];
LegoUnknown100db7f4* maxE = NULL; LegoOrientedEdge* maxE = NULL;
boundaries[0] = m_boundary; boundaries[0] = m_boundary;
if (m_destEdge->FUN_10048c40(local38)) { if (m_destEdge->FUN_10048c40(local38)) {
@@ -1069,7 +1069,7 @@ MxS32 Act3Brickster::FUN_10042300()
for (MxS32 i = 0; i < (MxS32) sizeOfArray(boundaries); i++) { for (MxS32 i = 0; i < (MxS32) sizeOfArray(boundaries); i++) {
if (boundaries[i] != NULL) { if (boundaries[i] != NULL) {
for (MxS32 j = 0; j < boundaries[i]->GetNumEdges(); j++) { for (MxS32 j = 0; j < boundaries[i]->GetNumEdges(); j++) {
LegoUnknown100db7f4* e = boundaries[i]->GetEdges()[j]; LegoOrientedEdge* e = boundaries[i]->GetEdges()[j];
if (e->GetMask0x03()) { if (e->GetMask0x03()) {
Mx3DPointFloat local94(*e->GetPointA()); Mx3DPointFloat local94(*e->GetPointA());
@@ -1109,7 +1109,7 @@ MxS32 Act3Brickster::FUN_10042300()
// FUNCTION: LEGO1 0x10042990 // FUNCTION: LEGO1 0x10042990
// FUNCTION: BETA10 0x1001b6e2 // FUNCTION: BETA10 0x1001b6e2
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
{ {
if (m_unk0x38 != 8) { if (m_unk0x38 != 8) {
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);

View File

@@ -119,11 +119,11 @@ void IslePathActor::Exit()
MxS32 i; MxS32 i;
for (i = 0; i < m_boundary->GetNumEdges(); i++) { for (i = 0; i < m_boundary->GetNumEdges(); i++) {
LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) m_boundary->GetEdges()[i]; LegoOrientedEdge* e = (LegoOrientedEdge*) m_boundary->GetEdges()[i];
assert(e); assert(e);
Mx3DPointFloat local20; Mx3DPointFloat local20;
e->FUN_1002ddc0(*m_boundary, local20); e->GetFaceNormal(*m_boundary, local20);
local20 *= m_roi->GetWorldBoundingSphere().Radius(); local20 *= m_roi->GetWorldBoundingSphere().Radius();
local20 += GetWorldPosition(); local20 += GetWorldPosition();

View File

@@ -2464,7 +2464,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le
if (p_boundary->m_name != NULL) { if (p_boundary->m_name != NULL) {
Mx3DPointFloat vec; Mx3DPointFloat vec;
LegoPathBoundary* boundary = p_world->FindPathBoundary(p_boundary->m_name); LegoPathBoundary* boundary = p_world->FindPathBoundary(p_boundary->m_name);
LegoUnknown100db7f4* pSrcE = (LegoUnknown100db7f4*) boundary->GetEdges()[p_boundary->m_src]; LegoOrientedEdge* pSrcE = (LegoOrientedEdge*) boundary->GetEdges()[p_boundary->m_src];
return FUN_10064010(boundary, pSrcE, p_boundary->m_srcScale); return FUN_10064010(boundary, pSrcE, p_boundary->m_srcScale);
} }
@@ -2473,7 +2473,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le
// FUNCTION: LEGO1 0x10064010 // FUNCTION: LEGO1 0x10064010
// FUNCTION: BETA10 0x100453a5 // FUNCTION: BETA10 0x100453a5
MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale) MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale)
{ {
Mx3DPointFloat p1; Mx3DPointFloat p1;
Vector3* v1 = p_edge->CWVertex(*p_boundary); Vector3* v1 = p_edge->CWVertex(*p_boundary);
@@ -2521,15 +2521,15 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
Mx3DPointFloat direction = actor->GetWorldDirection(); Mx3DPointFloat direction = actor->GetWorldDirection();
float local4c = 0.0f; float local4c = 0.0f;
LegoUnknown100db7f4* local50 = NULL; LegoOrientedEdge* local50 = NULL;
LegoS32 numEdges = boundary->GetNumEdges(); LegoS32 numEdges = boundary->GetNumEdges();
Mx3DPointFloat vec; Mx3DPointFloat vec;
LegoUnknown100db7f4* e; LegoOrientedEdge* e;
MxS32 i; MxS32 i;
for (i = 0; i < numEdges; i++) { for (i = 0; i < numEdges; i++) {
e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; e = (LegoOrientedEdge*) boundary->GetEdges()[i];
e->FUN_1002ddc0(*boundary, vec); e->GetFaceNormal(*boundary, vec);
float dot = vec.Dot(direction, vec); float dot = vec.Dot(direction, vec);
if (dot > local4c) { if (dot > local4c) {
@@ -2540,7 +2540,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
e = local50; e = local50;
do { do {
e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*boundary); e = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*boundary);
if (e->GetMask0x03()) { if (e->GetMask0x03()) {
break; break;
} }
@@ -2550,8 +2550,8 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
return FALSE; return FALSE;
} }
LegoUnknown100db7f4* local34 = e; LegoOrientedEdge* local34 = e;
LegoUnknown100db7f4* local8 = local50; LegoOrientedEdge* local8 = local50;
while (local2c--) { while (local2c--) {
if (local34 != NULL) { if (local34 != NULL) {
@@ -2562,7 +2562,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
numEdges = boundary->GetNumEdges(); numEdges = boundary->GetNumEdges();
for (i = 0; i < numEdges; i++) { for (i = 0; i < numEdges; i++) {
LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; LegoOrientedEdge* e = (LegoOrientedEdge*) boundary->GetEdges()[i];
if (local34 == e) { if (local34 == e) {
p_boundary->m_src = i; p_boundary->m_src = i;
@@ -2581,10 +2581,10 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
do { do {
if (p_bool1) { if (p_bool1) {
local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(*boundary); local34 = (LegoOrientedEdge*) local34->GetCounterclockwiseEdge(*boundary);
} }
else { else {
local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(*boundary); local34 = (LegoOrientedEdge*) local34->GetClockwiseEdge(*boundary);
} }
} while (!local34->GetMask0x03() && local34 != local50); } while (!local34->GetMask0x03() && local34 != local50);

View File

@@ -1,7 +1,7 @@
#include "legopathactor.h" #include "legopathactor.h"
#include "define.h" #include "define.h"
#include "geom/legounkown100db7f4.h" #include "geom/legoorientededge.h"
#include "legocachesoundmanager.h" #include "legocachesoundmanager.h"
#include "legocameracontroller.h" #include "legocameracontroller.h"
#include "legonamedplane.h" #include "legonamedplane.h"
@@ -95,7 +95,7 @@ MxResult LegoPathActor::VTable0x88(
float p_time, float p_time,
LegoEdge& p_srcEdge, LegoEdge& p_srcEdge,
float p_srcScale, float p_srcScale,
LegoUnknown100db7f4& p_destEdge, LegoOrientedEdge& p_destEdge,
float p_destScale float p_destScale
) )
{ {
@@ -122,7 +122,7 @@ MxResult LegoPathActor::VTable0x88(
m_unk0x7c = 0; m_unk0x7c = 0;
m_lastTime = p_time; m_lastTime = p_time;
m_actorTime = p_time; m_actorTime = p_time;
p_destEdge.FUN_1002ddc0(*p_boundary, p3); p_destEdge.GetFaceNormal(*p_boundary, p3);
p4 = p2; p4 = p2;
p4 -= p1; p4 -= p1;
@@ -172,7 +172,7 @@ MxResult LegoPathActor::VTable0x84(
float p_time, float p_time,
Vector3& p_p1, Vector3& p_p1,
Vector3& p_p4, Vector3& p_p4,
LegoUnknown100db7f4& p_destEdge, LegoOrientedEdge& p_destEdge,
float p_destScale float p_destScale
) )
{ {
@@ -192,7 +192,7 @@ MxResult LegoPathActor::VTable0x84(
m_unk0x7c = 0; m_unk0x7c = 0;
m_lastTime = p_time; m_lastTime = p_time;
m_actorTime = p_time; m_actorTime = p_time;
p_destEdge.FUN_1002ddc0(*p_boundary, p3); p_destEdge.GetFaceNormal(*p_boundary, p3);
MxMatrix matrix; MxMatrix matrix;
Vector3 pos(matrix[3]); Vector3 pos(matrix[3]);
@@ -442,7 +442,7 @@ void LegoPathActor::Animate(float p_time)
// FUNCTION: LEGO1 0x1002e8b0 // FUNCTION: LEGO1 0x1002e8b0
// FUNCTION: BETA10 0x100af2f7 // FUNCTION: BETA10 0x100af2f7
void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
{ {
assert(m_boundary); assert(m_boundary);
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);
@@ -516,7 +516,7 @@ inline MxU32 LegoPathActor::FUN_1002edd0(
LegoS32 numEdges = p_boundary->GetNumEdges(); LegoS32 numEdges = p_boundary->GetNumEdges();
for (MxS32 i = 0; i < numEdges; i++) { for (MxS32 i = 0; i < numEdges; i++) {
LegoUnknown100db7f4* edge = p_boundary->GetEdges()[i]; LegoOrientedEdge* edge = p_boundary->GetEdges()[i];
LegoPathBoundary* boundary = (LegoPathBoundary*) edge->OtherFace(p_boundary); LegoPathBoundary* boundary = (LegoPathBoundary*) edge->OtherFace(p_boundary);
if (boundary != NULL) { if (boundary != NULL) {
@@ -652,7 +652,7 @@ MxResult LegoPathActor::VTable0x9c()
LERP3(local34, v1, v2, m_unk0xe4); LERP3(local34, v1, v2, m_unk0xe4);
m_destEdge->FUN_1002ddc0(*m_boundary, local78); m_destEdge->GetFaceNormal(*m_boundary, local78);
local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78); local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78);
local48.Unitize(); local48.Unitize();
} }

View File

@@ -1,7 +1,7 @@
#include "legopathboundary.h" #include "legopathboundary.h"
#include "decomp.h" #include "decomp.h"
#include "geom/legounkown100db7f4.h" #include "geom/legoorientededge.h"
#include "legolocomotionanimpresenter.h" #include "legolocomotionanimpresenter.h"
#include "legopathactor.h" #include "legopathactor.h"
#include "legopathstruct.h" #include "legopathstruct.h"
@@ -86,11 +86,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
void LegoPathBoundary::SwitchBoundary( void LegoPathBoundary::SwitchBoundary(
LegoPathActor* p_actor, LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary, LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
float& p_unk0xe4 float& p_unk0xe4
) )
{ {
LegoUnknown100db7f4* e = p_edge; LegoOrientedEdge* e = p_edge;
if (p_edge->BETA_100b53b0(*p_boundary)) { if (p_edge->BETA_100b53b0(*p_boundary)) {
LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary); LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary);
@@ -110,7 +110,7 @@ void LegoPathBoundary::SwitchBoundary(
} }
do { do {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary);
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) { if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) {
@@ -133,10 +133,10 @@ void LegoPathBoundary::SwitchBoundary(
while (local8 > 0) { while (local8 > 0) {
if (localc) { if (localc) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary);
} }
else { else {
p_edge = (LegoUnknown100db7f4*) p_edge->GetClockwiseEdge(*newBoundary); p_edge = (LegoOrientedEdge*) p_edge->GetClockwiseEdge(*newBoundary);
} }
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
@@ -147,8 +147,8 @@ void LegoPathBoundary::SwitchBoundary(
} }
if (p_edge == e) { if (p_edge == e) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary);
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary);
} }
if (p_boundary != newBoundary) { if (p_boundary != newBoundary) {
@@ -162,7 +162,7 @@ void LegoPathBoundary::SwitchBoundary(
} }
else { else {
do { do {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary);
if (p_edge->GetMask0x03()) { if (p_edge->GetMask0x03()) {
break; break;
@@ -170,8 +170,8 @@ void LegoPathBoundary::SwitchBoundary(
} while (p_edge != e); } while (p_edge != e);
if (p_edge == e) { if (p_edge == e) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary);
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary);
} }
p_unk0xe4 = 1.0 - p_unk0xe4; p_unk0xe4 = 1.0 - p_unk0xe4;
@@ -185,17 +185,17 @@ MxU32 LegoPathBoundary::Intersect(
Vector3& p_point1, Vector3& p_point1,
Vector3& p_point2, Vector3& p_point2,
Vector3& p_point3, Vector3& p_point3,
LegoUnknown100db7f4*& p_edge LegoOrientedEdge*& p_edge
) )
{ {
LegoUnknown100db7f4* e = NULL; LegoOrientedEdge* e = NULL;
float localc; float localc;
MxU32 local10 = 0; MxU32 local10 = 0;
float len = 0.0f; float len = 0.0f;
Mx3DPointFloat vec; Mx3DPointFloat vec;
for (MxS32 i = 0; i < m_numEdges; i++) { for (MxS32 i = 0; i < m_numEdges; i++) {
LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) m_edges[i]; LegoOrientedEdge* edge = (LegoOrientedEdge*) m_edges[i];
if (p_point2.Dot(m_edgeNormals[i], p_point2) + m_edgeNormals[i][3] <= -1e-07) { if (p_point2.Dot(m_edgeNormals[i], p_point2) + m_edgeNormals[i][3] <= -1e-07) {
if (local10 == 0) { if (local10 == 0) {
@@ -240,17 +240,17 @@ MxU32 LegoPathBoundary::Intersect(
local50 = p_point2; local50 = p_point2;
local50 -= *local5c; local50 -= *local5c;
e->FUN_1002ddc0(*this, local70); e->GetFaceNormal(*this, local70);
float local58 = local50.Dot(local50, local70); float local58 = local50.Dot(local50, local70);
LegoUnknown100db7f4* local54 = NULL; LegoOrientedEdge* local54 = NULL;
if (local58 < 0.0f) { if (local58 < 0.0f) {
Mx3DPointFloat local84; Mx3DPointFloat local84;
for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); e != local88; for (LegoOrientedEdge* local88 = (LegoOrientedEdge*) e->GetClockwiseEdge(*this); e != local88;
local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) { local88 = (LegoOrientedEdge*) local88->GetClockwiseEdge(*this)) {
local88->FUN_1002ddc0(*this, local84); local88->GetFaceNormal(*this, local84);
if (local84.Dot(local84, local70) <= 0.9) { if (local84.Dot(local84, local70) <= 0.9) {
break; break;
@@ -262,7 +262,7 @@ MxU32 LegoPathBoundary::Intersect(
float local8c = locala4.Dot(locala4, local84); float local8c = locala4.Dot(locala4, local84);
if (local8c > local58 && local8c < local88->m_unk0x3c) { if (local8c > local58 && local8c < local88->m_length) {
local54 = local88; local54 = local88;
local58 = local8c; local58 = local8c;
local70 = local84; local70 = local84;
@@ -271,13 +271,12 @@ MxU32 LegoPathBoundary::Intersect(
} }
} }
else { else {
if (e->m_unk0x3c < local58) { if (e->m_length < local58) {
Mx3DPointFloat localbc; Mx3DPointFloat localbc;
for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); for (LegoOrientedEdge* locala8 = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this); e != locala8;
e != locala8; locala8 = (LegoOrientedEdge*) locala8->GetCounterclockwiseEdge(*this)) {
locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) { locala8->GetFaceNormal(*this, localbc);
locala8->FUN_1002ddc0(*this, localbc);
if (localbc.Dot(localbc, local70) <= 0.9) { if (localbc.Dot(localbc, local70) <= 0.9) {
break; break;
@@ -305,7 +304,7 @@ MxU32 LegoPathBoundary::Intersect(
if (local58 <= 0.0f) { if (local58 <= 0.0f) {
if (!e->GetMask0x03()) { if (!e->GetMask0x03()) {
p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); p_edge = (LegoOrientedEdge*) e->GetClockwiseEdge(*this);
} }
else { else {
p_edge = e; p_edge = e;
@@ -314,7 +313,7 @@ MxU32 LegoPathBoundary::Intersect(
p_point3 = *local5c; p_point3 = *local5c;
return 2; return 2;
} }
else if (local58 > 0.0f && e->m_unk0x3c > local58) { else if (local58 > 0.0f && e->m_length > local58) {
p_point3 = local70; p_point3 = local70;
p_point3 *= local58; p_point3 *= local58;
p_point3 += *local5c; p_point3 += *local5c;
@@ -325,7 +324,7 @@ MxU32 LegoPathBoundary::Intersect(
p_point3 = *e->CCWVertex(*this); p_point3 = *e->CCWVertex(*this);
if (!e->GetMask0x03()) { if (!e->GetMask0x03()) {
p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); p_edge = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this);
} }
else { else {
p_edge = e; p_edge = e;

View File

@@ -224,7 +224,7 @@ MxResult LegoPathController::PlaceActor(
float time = Timer()->GetTime(); float time = Timer()->GetTime();
MxResult result = MxResult result =
p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoUnknown100db7f4&) *pDestE, p_destScale); p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoOrientedEdge&) *pDestE, p_destScale);
if (result != SUCCESS) { if (result != SUCCESS) {
assert(0); assert(0);
@@ -284,15 +284,14 @@ MxResult LegoPathController::PlaceActor(
} }
for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) {
LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) boundary->GetEdges()[j]; LegoOrientedEdge* edge = (LegoOrientedEdge*) boundary->GetEdges()[j];
if (edge->GetMask0x03()) { if (edge->GetMask0x03()) {
Mx3DPointFloat vec; Mx3DPointFloat vec;
if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && if (((LegoOrientedEdge*) edge->GetClockwiseEdge(*boundary))->GetFaceNormal(*boundary, vec) == SUCCESS &&
vec.Dot(vec, p_direction) < 0.0f) { vec.Dot(vec, p_direction) < 0.0f) {
edge = edge = (LegoOrientedEdge*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary);
(LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary);
} }
if (!edge->GetMask0x03()) { if (!edge->GetMask0x03()) {
@@ -567,7 +566,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
} }
edge.m_pointB = &m_unk0x10[s]; edge.m_pointB = &m_unk0x10[s];
if (edge.m_flags & LegoUnknown100db7f4::c_bit3) { if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) {
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
@@ -584,7 +583,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
edge.m_cwA = &m_edges[s]; edge.m_cwA = &m_edges[s];
} }
if (edge.m_flags & LegoUnknown100db7f4::c_bit4) { if (edge.m_flags & LegoOrientedEdge::c_hasFaceB) {
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
@@ -601,11 +600,11 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
edge.m_cwB = &m_edges[s]; edge.m_cwB = &m_edges[s];
} }
if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) { if (ReadVector(p_storage, edge.m_dir) != SUCCESS) {
return FAILURE; return FAILURE;
} }
if (p_storage->Read(&edge.m_unk0x3c, sizeof(float)) != SUCCESS) { if (p_storage->Read(&edge.m_length, sizeof(float)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
} }
@@ -629,7 +628,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
boundary.m_edgeNormals = new Mx4DPointFloat[numE]; boundary.m_edgeNormals = new Mx4DPointFloat[numE];
LegoUnknown100db7f4** edges = new LegoUnknown100db7f4*[numE]; LegoOrientedEdge** edges = new LegoOrientedEdge*[numE];
boundary.SetEdges(edges, numE); boundary.SetEdges(edges, numE);
for (j = 0; j < numE; j++) { for (j = 0; j < numE; j++) {
@@ -818,7 +817,7 @@ MxResult LegoPathController::FUN_10048310(
while (boundarySetItA != boundarySet.end()) { while (boundarySetItA != boundarySet.end()) {
MxU32 shouldRemove = TRUE; MxU32 shouldRemove = TRUE;
LegoUnknown100db7f4* e = (*boundarySetItA)->m_edge; LegoOrientedEdge* e = (*boundarySetItA)->m_edge;
LegoPathBoundary* b = (*boundarySetItA)->m_boundary; LegoPathBoundary* b = (*boundarySetItA)->m_boundary;
assert(e && b); assert(e && b);
@@ -935,7 +934,7 @@ MxS32 LegoPathController::FUN_1004a240(
Vector3& p_v1, Vector3& p_v1,
Vector3& p_v2, Vector3& p_v2,
float p_f1, float p_f1,
LegoUnknown100db7f4*& p_edge, LegoOrientedEdge*& p_edge,
LegoPathBoundary*& p_boundary LegoPathBoundary*& p_boundary
) )
{ {
@@ -956,7 +955,7 @@ MxS32 LegoPathController::FUN_1004a240(
p_v1 -= *p_edge->CWVertex(*p_boundary); p_v1 -= *p_edge->CWVertex(*p_boundary);
p_v1 *= p_f1; p_v1 *= p_f1;
p_v1 += *p_edge->CWVertex(*p_boundary); p_v1 += *p_edge->CWVertex(*p_boundary);
p_edge->FUN_1002ddc0(*p_boundary, vec); p_edge->GetFaceNormal(*p_boundary, vec);
p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec); p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec);
return 0; return 0;
} }

View File

@@ -316,12 +316,12 @@ void LegoRaceCar::FUN_10012ff0(float p_param)
if (a->GetDuration() <= deltaTime || deltaTime < 0.0) { if (a->GetDuration() <= deltaTime || deltaTime < 0.0) {
if (m_userState == LEGORACECAR_KICK1) { if (m_userState == LEGORACECAR_KICK1) {
LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); LegoOrientedEdge** edges = m_kick1B->GetEdges();
m_destEdge = edges[2]; m_destEdge = edges[2];
m_boundary = m_kick1B; m_boundary = m_kick1B;
} }
else { else {
LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); LegoOrientedEdge** edges = m_kick1B->GetEdges();
m_destEdge = edges[1]; m_destEdge = edges[1];
m_boundary = m_kick2B; m_boundary = m_kick2B;
} }

View File

@@ -1,6 +1,6 @@
#include "legoracespecial.h" #include "legoracespecial.h"
#include "geom/legounkown100db7f4.h" #include "geom/legoorientededge.h"
#include "legonavcontroller.h" #include "legonavcontroller.h"
#include "legopathboundary.h" #include "legopathboundary.h"
#include "legopathcontroller.h" #include "legopathcontroller.h"
@@ -65,7 +65,7 @@ void LegoCarRaceActor::FUN_10080590(float p_time)
Mx3DPointFloat destEdgeUnknownVector; Mx3DPointFloat destEdgeUnknownVector;
Mx3DPointFloat worldDirection = Mx3DPointFloat(m_roi->GetWorldDirection()); Mx3DPointFloat worldDirection = Mx3DPointFloat(m_roi->GetWorldDirection());
m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector);
if (abs(destEdgeUnknownVector.Dot(destEdgeUnknownVector.GetData(), worldDirection.GetData())) > 0.5) { if (abs(destEdgeUnknownVector.Dot(destEdgeUnknownVector.GetData(), worldDirection.GetData())) > 0.5) {
maxSpeed *= m_unk0x10; maxSpeed *= m_unk0x10;
@@ -169,7 +169,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
LERP3(pointUnknown, *v1, *v2, m_unk0xe4); LERP3(pointUnknown, *v1, *v2, m_unk0xe4);
m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector);
crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector); crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector);
crossProduct.Unitize(); crossProduct.Unitize();
@@ -212,7 +212,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
// FUNCTION: LEGO1 0x10080b40 // FUNCTION: LEGO1 0x10080b40
// FUNCTION: BETA10 0x100cdb3c // FUNCTION: BETA10 0x100cdb3c
void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
{ {
LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4); LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
} }
@@ -241,7 +241,7 @@ void LegoCarRaceActor::Animate(float p_time)
// FUNCTION: BETA10 0x100cdc54 // FUNCTION: BETA10 0x100cdc54
MxResult LegoCarRaceActor::VTable0x9c() MxResult LegoCarRaceActor::VTable0x9c()
{ {
LegoUnknown100db7f4* d = m_destEdge; LegoOrientedEdge* d = m_destEdge;
if (VTable0x1c(m_boundary, m_destEdge)) { if (VTable0x1c(m_boundary, m_destEdge)) {
LegoPathBoundary* b = m_boundary; LegoPathBoundary* b = m_boundary;
@@ -262,8 +262,8 @@ MxResult LegoCarRaceActor::VTable0x9c()
Mx3DPointFloat point4; Mx3DPointFloat point4;
Mx3DPointFloat point5; Mx3DPointFloat point5;
d->FUN_1002ddc0(*b, point2); d->GetFaceNormal(*b, point2);
m_destEdge->FUN_1002ddc0(*m_boundary, point3); m_destEdge->GetFaceNormal(*m_boundary, point3);
point4.EqualsCross(point2, *m_boundary->GetUnknown0x14()); point4.EqualsCross(point2, *m_boundary->GetUnknown0x14());
point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3); point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3);
@@ -364,7 +364,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
LERP3(a, *v1, *v2, m_unk0xe4); LERP3(a, *v1, *v2, m_unk0xe4);
m_destEdge->FUN_1002ddc0(*m_boundary, bbb); m_destEdge->GetFaceNormal(*m_boundary, bbb);
c.EqualsCross(bbb, *m_boundary->GetUnknown0x14()); c.EqualsCross(bbb, *m_boundary->GetUnknown0x14());
c.Unitize(); c.Unitize();

View File

@@ -17,7 +17,7 @@ struct LegoEdge {
Vector3* CWVertex(LegoWEEdge& p_face); Vector3* CWVertex(LegoWEEdge& p_face);
Vector3* CCWVertex(LegoWEEdge& p_face); Vector3* CCWVertex(LegoWEEdge& p_face);
LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point);
// FUNCTION: BETA10 0x10184170 // FUNCTION: BETA10 0x10184170
LegoWEEdge* GetFaceA() { return m_faceA; } LegoWEEdge* GetFaceA() { return m_faceA; }

View File

@@ -0,0 +1,12 @@
#include "legoorientededge.h"
DECOMP_SIZE_ASSERT(LegoOrientedEdge, 0x40)
// FUNCTION: LEGO1 0x1009a630
// FUNCTION: BETA10 0x10183050
LegoOrientedEdge::LegoOrientedEdge()
{
m_flags = 0;
m_dir.Clear();
m_length = 0.0f;
}

View File

@@ -1,5 +1,5 @@
#ifndef __LEGOUNKNOWN100DB7F4_H #ifndef __LEGOORIENTEDEDGE_H
#define __LEGOUNKNOWN100DB7F4_H #define __LEGOORIENTEDEDGE_H
#include "legoedge.h" #include "legoedge.h"
#include "legowegedge.h" #include "legowegedge.h"
@@ -9,31 +9,31 @@
// VTABLE: LEGO1 0x100db7f4 // VTABLE: LEGO1 0x100db7f4
// SIZE 0x40 // SIZE 0x40
struct LegoUnknown100db7f4 : public LegoEdge { struct LegoOrientedEdge : public LegoEdge {
public: public:
enum { enum {
c_bit1 = 0x01, c_bit1 = 0x01,
c_bit2 = 0x02, c_bit2 = 0x02,
c_bit3 = 0x04, c_hasFaceA = 0x04,
c_bit4 = 0x08 c_hasFaceB = 0x08
}; };
LegoUnknown100db7f4(); LegoOrientedEdge();
// FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: LEGO1 0x1002ddc0
// FUNCTION: BETA10 0x100372a0 // FUNCTION: BETA10 0x100372a0
LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) const LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point) const
{ {
if (p_f.IsEqual(m_faceA)) { if (p_face.IsEqual(m_faceA)) {
p_point[0] = -m_unk0x28[0]; p_point[0] = -m_dir[0];
p_point[1] = -m_unk0x28[1]; p_point[1] = -m_dir[1];
p_point[2] = -m_unk0x28[2]; p_point[2] = -m_dir[2];
} }
else { else {
// clang-format off // clang-format off
assert(p_f.IsEqual( m_faceB )); assert(p_face.IsEqual( m_faceB ));
// clang-format on // clang-format on
p_point = m_unk0x28; p_point = m_dir;
} }
return SUCCESS; return SUCCESS;
@@ -78,7 +78,7 @@ public:
} }
// FUNCTION: BETA10 0x100bd540 // FUNCTION: BETA10 0x100bd540
LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other) LegoFloat DistanceBetweenMidpoints(const LegoOrientedEdge& p_other)
{ {
Mx3DPointFloat point1(*m_pointA); Mx3DPointFloat point1(*m_pointA);
Mx3DPointFloat point2(*p_other.m_pointA); Mx3DPointFloat point2(*p_other.m_pointA);
@@ -99,22 +99,22 @@ public:
inline LegoU32 FUN_10048c40(const Vector3& p_position); inline LegoU32 FUN_10048c40(const Vector3& p_position);
// SYNTHETIC: LEGO1 0x1009a6c0 // SYNTHETIC: LEGO1 0x1009a6c0
// LegoUnknown100db7f4::`scalar deleting destructor' // LegoOrientedEdge::`scalar deleting destructor'
LegoU16 m_flags; // 0x24 LegoU16 m_flags; // 0x24
Mx3DPointFloat m_unk0x28; // 0x28 Mx3DPointFloat m_dir; // 0x28
float m_unk0x3c; // 0x3c float m_length; // 0x3c
}; };
// FUNCTION: LEGO1 0x10048c40 // FUNCTION: LEGO1 0x10048c40
// FUNCTION: BETA10 0x1001cc90 // FUNCTION: BETA10 0x1001cc90
inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) inline LegoU32 LegoOrientedEdge::FUN_10048c40(const Vector3& p_position)
{ {
LegoFloat localc, local10; LegoFloat localc, local10;
LegoU32 result = FALSE; LegoU32 result = FALSE;
if (m_unk0x28[0] > 0.001 || m_unk0x28[0] < -0.001) { if (m_dir[0] > 0.001 || m_dir[0] < -0.001) {
localc = (p_position[0] - (*m_pointA)[0]) / m_unk0x28[0]; localc = (p_position[0] - (*m_pointA)[0]) / m_dir[0];
if (localc < 0 || localc > 1) { if (localc < 0 || localc > 1) {
return FALSE; return FALSE;
@@ -128,8 +128,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position)
} }
} }
if (m_unk0x28[1] > 0.001 || m_unk0x28[1] < -0.001) { if (m_dir[1] > 0.001 || m_dir[1] < -0.001) {
local10 = (p_position[1] - (*m_pointA)[1]) / m_unk0x28[1]; local10 = (p_position[1] - (*m_pointA)[1]) / m_dir[1];
if (result) { if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) { if (localc > local10 + 0.001 || localc < local10 - 0.001) {
@@ -147,8 +147,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position)
} }
} }
if (m_unk0x28[2] > 0.001 || m_unk0x28[2] < -0.001) { if (m_dir[2] > 0.001 || m_dir[2] < -0.001) {
local10 = (p_position[2] - (*m_pointA)[2]) / m_unk0x28[2]; local10 = (p_position[2] - (*m_pointA)[2]) / m_dir[2];
if (result) { if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) { if (localc > local10 + 0.001 || localc < local10 - 0.001) {
@@ -168,4 +168,4 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position)
return TRUE; return TRUE;
} }
#endif // __LEGOUNKNOWN100DB7F4_H #endif // __LEGOORIENTEDEDGE_H

View File

@@ -1,12 +0,0 @@
#include "legounkown100db7f4.h"
DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40)
// FUNCTION: LEGO1 0x1009a630
// FUNCTION: BETA10 0x10183050
LegoUnknown100db7f4::LegoUnknown100db7f4()
{
m_flags = 0;
m_unk0x28.Clear();
m_unk0x3c = 0.0f;
}

View File

@@ -1,6 +1,6 @@
#include "legoweedge.h" #include "legoweedge.h"
#include "legounkown100db7f4.h" #include "legoorientededge.h"
DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c) DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c)
@@ -23,8 +23,8 @@ LegoWEEdge::~LegoWEEdge()
LegoS32 LegoWEEdge::VTable0x04() LegoS32 LegoWEEdge::VTable0x04()
{ {
for (LegoS32 i = 0; i < m_numEdges; i++) { for (LegoS32 i = 0; i < m_numEdges; i++) {
LegoUnknown100db7f4* e1 = m_edges[i]; LegoOrientedEdge* e1 = m_edges[i];
LegoUnknown100db7f4* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; LegoOrientedEdge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1];
if (e2->m_pointA == e1->m_pointA) { if (e2->m_pointA == e1->m_pointA) {
e1->m_faceA = this; e1->m_faceA = this;

View File

@@ -4,7 +4,7 @@
#include "decomp.h" #include "decomp.h"
#include "misc/legotypes.h" #include "misc/legotypes.h"
struct LegoUnknown100db7f4; struct LegoOrientedEdge;
// might be a struct with public members // might be a struct with public members
// VTABLE: LEGO1 0x100db7c0 // VTABLE: LEGO1 0x100db7c0
@@ -20,12 +20,12 @@ public:
LegoU8 GetNumEdges() { return m_numEdges; } LegoU8 GetNumEdges() { return m_numEdges; }
// FUNCTION: BETA10 0x1001cc30 // FUNCTION: BETA10 0x1001cc30
LegoUnknown100db7f4** GetEdges() { return m_edges; } LegoOrientedEdge** GetEdges() { return m_edges; }
// FUNCTION: BETA10 0x100373f0 // FUNCTION: BETA10 0x100373f0
LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; } LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; }
void SetEdges(LegoUnknown100db7f4** p_edges, LegoU8 p_numEdges) void SetEdges(LegoOrientedEdge** p_edges, LegoU8 p_numEdges)
{ {
m_edges = p_edges; m_edges = p_edges;
m_numEdges = p_numEdges; m_numEdges = p_numEdges;
@@ -35,8 +35,8 @@ public:
// LegoWEEdge::`scalar deleting destructor' // LegoWEEdge::`scalar deleting destructor'
protected: protected:
LegoU8 m_numEdges; // 0x04 LegoU8 m_numEdges; // 0x04
LegoUnknown100db7f4** m_edges; // 0x08 LegoOrientedEdge** m_edges; // 0x08
}; };
#endif // __LEGOWEEDGE_H #endif // __LEGOWEEDGE_H

View File

@@ -1,6 +1,6 @@
#include "legowegedge.h" #include "legowegedge.h"
#include "legounkown100db7f4.h" #include "legoorientededge.h"
#include <assert.h> #include <assert.h>
@@ -81,7 +81,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
m_edgeNormals = new Mx4DPointFloat[m_numEdges]; m_edgeNormals = new Mx4DPointFloat[m_numEdges];
assert(m_edgeNormals); assert(m_edgeNormals);
LegoUnknown100db7f4* edge; LegoOrientedEdge* edge;
LegoS32 i; LegoS32 i;
for (i = 0; i < m_numEdges; i++) { for (i = 0; i < m_numEdges; i++) {
@@ -118,27 +118,27 @@ LegoS32 LegoWEGEdge::VTable0x04()
for (i = 0; i < m_numEdges; i++) { for (i = 0; i < m_numEdges; i++) {
edge = m_edges[i]; edge = m_edges[i];
Vector3& local5c = edge->m_unk0x28; Vector3& local5c = edge->m_dir;
if (edge->m_unk0x3c == 0) { if (edge->m_length == 0) {
local5c = *m_edges[i]->m_pointB; local5c = *m_edges[i]->m_pointB;
local5c -= *m_edges[i]->m_pointA; local5c -= *m_edges[i]->m_pointA;
edge->m_unk0x3c = local5c.LenSquared(); edge->m_length = local5c.LenSquared();
if (edge->m_unk0x3c <= 0.0f) { if (edge->m_length <= 0.0f) {
assert(0); assert(0);
if (result == 0) { if (result == 0) {
result = -1; result = -1;
} }
} }
edge->m_unk0x3c = sqrt((double) edge->m_unk0x3c); edge->m_length = sqrt((double) edge->m_length);
local5c /= edge->m_unk0x3c; local5c /= edge->m_length;
} }
Mx3DPointFloat local58; Mx3DPointFloat local58;
Vector3 local64(&m_edgeNormals[i][0]); Vector3 local64(&m_edgeNormals[i][0]);
edge->FUN_1002ddc0(*this, local58); edge->GetFaceNormal(*this, local58);
local64.EqualsCross(local58, m_unk0x14); local64.EqualsCross(local58, m_unk0x14);
m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64); m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64);
@@ -147,7 +147,7 @@ LegoS32 LegoWEGEdge::VTable0x04()
} }
if (edge->GetFaceA() != NULL && edge->GetFaceB() != NULL) { if (edge->GetFaceA() != NULL && edge->GetFaceB() != NULL) {
edge->SetFlags(LegoUnknown100db7f4::c_bit1 | LegoUnknown100db7f4::c_bit2); edge->SetFlags(LegoOrientedEdge::c_bit1 | LegoOrientedEdge::c_bit2);
} }
} }