mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-29 10:55:42 -05:00
Implement/match LegoPathBoundary::FUN_100575b0 (#939)
This commit is contained in:
parent
c8a0e4cf8d
commit
fb16b2c896
9 changed files with 79 additions and 43 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include "mxatom.h"
|
#include "mxatom.h"
|
||||||
#include "mxtypes.h"
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
class LegoPathActor;
|
||||||
class LegoWorld;
|
class LegoWorld;
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100d7d9c
|
// VTABLE: LEGO1 0x100d7d9c
|
||||||
|
@ -35,7 +36,7 @@ struct LegoPathStruct : public LegoPathStructBase {
|
||||||
// FUNCTION: LEGO1 0x10047470
|
// FUNCTION: LEGO1 0x10047470
|
||||||
~LegoPathStruct() override {}
|
~LegoPathStruct() override {}
|
||||||
|
|
||||||
void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04
|
virtual void VTable0x04(LegoPathActor*, undefined4, undefined4); // vtable+0x04
|
||||||
|
|
||||||
inline void SetWorld(LegoWorld* p_world) { m_world = p_world; }
|
inline void SetWorld(LegoWorld* p_world) { m_world = p_world; }
|
||||||
inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
|
inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
|
||||||
|
|
|
@ -2139,8 +2139,8 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le
|
||||||
MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale)
|
MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale)
|
||||||
{
|
{
|
||||||
Mx3DPointFloat p1;
|
Mx3DPointFloat p1;
|
||||||
Vector3* v1 = p_edge->GetOpposingPoint(p_boundary);
|
Vector3* v1 = p_edge->GetOpposingPoint(*p_boundary);
|
||||||
Vector3* v2 = p_edge->GetPoint(p_boundary);
|
Vector3* v2 = p_edge->CCWVertex(*p_boundary);
|
||||||
|
|
||||||
p1 = *v2;
|
p1 = *v2;
|
||||||
((Vector3&) p1).Sub(v1);
|
((Vector3&) p1).Sub(v1);
|
||||||
|
@ -2196,7 +2196,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
|
||||||
|
|
||||||
e = local50;
|
e = local50;
|
||||||
do {
|
do {
|
||||||
e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(boundary);
|
e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*boundary);
|
||||||
if (e->GetMask0x03()) {
|
if (e->GetMask0x03()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2237,10 +2237,10 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (p_bool1) {
|
if (p_bool1) {
|
||||||
local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(boundary);
|
local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(*boundary);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(boundary);
|
local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(*boundary);
|
||||||
}
|
}
|
||||||
} while (!local34->GetMask0x03() && local34 != local50);
|
} while (!local34->GetMask0x03() && local34 != local50);
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,10 @@ MxResult LegoPathActor::VTable0x88(
|
||||||
float p_destScale
|
float p_destScale
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Vector3* v1 = p_srcEdge.GetOpposingPoint(p_boundary);
|
Vector3* v1 = p_srcEdge.GetOpposingPoint(*p_boundary);
|
||||||
Vector3* v2 = p_srcEdge.GetPoint(p_boundary);
|
Vector3* v2 = p_srcEdge.CCWVertex(*p_boundary);
|
||||||
Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary);
|
Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary);
|
||||||
Vector3* v4 = p_destEdge.GetPoint(p_boundary);
|
Vector3* v4 = p_destEdge.CCWVertex(*p_boundary);
|
||||||
|
|
||||||
Mx3DPointFloat p1, p2, p3, p4, p5;
|
Mx3DPointFloat p1, p2, p3, p4, p5;
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ MxResult LegoPathActor::VTable0x84(
|
||||||
float p_destScale
|
float p_destScale
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary);
|
Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary);
|
||||||
Vector3* v4 = p_destEdge.GetPoint(p_boundary);
|
Vector3* v4 = p_destEdge.CCWVertex(*p_boundary);
|
||||||
|
|
||||||
Mx3DPointFloat p2, p3, p5;
|
Mx3DPointFloat p2, p3, p5;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
#include "geom/legounkown100db7f4.h"
|
#include "geom/legounkown100db7f4.h"
|
||||||
#include "legopathactor.h"
|
#include "legopathactor.h"
|
||||||
|
#include "legopathstruct.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74)
|
DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74)
|
||||||
|
|
||||||
|
@ -40,9 +41,43 @@ MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100575b0
|
// FUNCTION: LEGO1 0x100575b0
|
||||||
|
// FUNCTION: BETA10 0x100b1598
|
||||||
void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor)
|
void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor)
|
||||||
{
|
{
|
||||||
|
Vector3* ccwV = NULL;
|
||||||
|
|
||||||
|
if (m_unk0x48 > 0 && m_unk0x50 != NULL) {
|
||||||
|
ccwV = m_edges[0]->CCWVertex(*this);
|
||||||
|
Mx3DPointFloat v;
|
||||||
|
|
||||||
|
v = p_point1;
|
||||||
|
((Vector3&) v).Sub(ccwV);
|
||||||
|
float dot1 = v.Dot(&v, m_unk0x50);
|
||||||
|
|
||||||
|
v = p_point2;
|
||||||
|
((Vector3&) v).Sub(ccwV);
|
||||||
|
float dot2 = v.Dot(&v, m_unk0x50);
|
||||||
|
|
||||||
|
if (dot2 > dot1) {
|
||||||
|
for (MxS32 i = 0; i < m_unk0x48; i++) {
|
||||||
|
LegoPathStruct* s = m_unk0x4c[i].m_unk0x00;
|
||||||
|
|
||||||
|
if (m_unk0x4c[i].m_unk0x08 >= dot1 && m_unk0x4c[i].m_unk0x08 < dot2) {
|
||||||
|
s->VTable0x04(p_actor, 1, m_unk0x4c[i].m_unk0x04);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dot2 < dot1) {
|
||||||
|
for (MxS32 i = 0; i < m_unk0x48; i++) {
|
||||||
|
LegoPathStruct* s = m_unk0x4c[i].m_unk0x00;
|
||||||
|
|
||||||
|
if (m_unk0x4c[i].m_unk0x08 >= dot2 && m_unk0x4c[i].m_unk0x08 < dot1) {
|
||||||
|
s->VTable0x04(p_actor, 0, m_unk0x4c[i].m_unk0x04);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10057950
|
// FUNCTION: LEGO1 0x10057950
|
||||||
|
@ -98,7 +133,7 @@ MxU32 LegoPathBoundary::Intersect(
|
||||||
|
|
||||||
Mx3DPointFloat local50;
|
Mx3DPointFloat local50;
|
||||||
Mx3DPointFloat local70;
|
Mx3DPointFloat local70;
|
||||||
Vector3* local5c = e->GetOpposingPoint(this);
|
Vector3* local5c = e->GetOpposingPoint(*this);
|
||||||
|
|
||||||
p_point3 = vec;
|
p_point3 = vec;
|
||||||
p_point3.Mul(localc);
|
p_point3.Mul(localc);
|
||||||
|
@ -115,15 +150,15 @@ MxU32 LegoPathBoundary::Intersect(
|
||||||
if (local58 < 0.0f) {
|
if (local58 < 0.0f) {
|
||||||
Mx3DPointFloat local84;
|
Mx3DPointFloat local84;
|
||||||
|
|
||||||
for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(this); e != local88;
|
for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); e != local88;
|
||||||
local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(this)) {
|
local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) {
|
||||||
local88->FUN_1002ddc0(*this, local84);
|
local88->FUN_1002ddc0(*this, local84);
|
||||||
|
|
||||||
if (local84.Dot(&local84, &local70) <= 0.9) {
|
if (local84.Dot(&local84, &local70) <= 0.9) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3* local90 = local88->GetOpposingPoint(this);
|
Vector3* local90 = local88->GetOpposingPoint(*this);
|
||||||
Mx3DPointFloat locala4(p_point3);
|
Mx3DPointFloat locala4(p_point3);
|
||||||
((Vector3&) locala4).Sub(local90);
|
((Vector3&) locala4).Sub(local90);
|
||||||
|
|
||||||
|
@ -141,16 +176,16 @@ MxU32 LegoPathBoundary::Intersect(
|
||||||
if (e->m_unk0x3c < local58) {
|
if (e->m_unk0x3c < local58) {
|
||||||
Mx3DPointFloat localbc;
|
Mx3DPointFloat localbc;
|
||||||
|
|
||||||
for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(this);
|
for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this);
|
||||||
e != locala8;
|
e != locala8;
|
||||||
locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(this)) {
|
locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) {
|
||||||
locala8->FUN_1002ddc0(*this, localbc);
|
locala8->FUN_1002ddc0(*this, localbc);
|
||||||
|
|
||||||
if (localbc.Dot(&localbc, &local70) <= 0.9) {
|
if (localbc.Dot(&localbc, &local70) <= 0.9) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3* localc4 = locala8->GetOpposingPoint(this);
|
Vector3* localc4 = locala8->GetOpposingPoint(*this);
|
||||||
Mx3DPointFloat locald8(p_point3);
|
Mx3DPointFloat locald8(p_point3);
|
||||||
((Vector3&) locald8).Sub(localc4);
|
((Vector3&) locald8).Sub(localc4);
|
||||||
|
|
||||||
|
@ -172,7 +207,7 @@ MxU32 LegoPathBoundary::Intersect(
|
||||||
|
|
||||||
if (local58 <= 0.0f) {
|
if (local58 <= 0.0f) {
|
||||||
if (!e->GetMask0x03()) {
|
if (!e->GetMask0x03()) {
|
||||||
p_edge = e->GetClockwiseEdge(this);
|
p_edge = e->GetClockwiseEdge(*this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_edge = e;
|
p_edge = e;
|
||||||
|
@ -189,10 +224,10 @@ MxU32 LegoPathBoundary::Intersect(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_point3 = *e->GetPoint(this);
|
p_point3 = *e->CCWVertex(*this);
|
||||||
|
|
||||||
if (!e->GetMask0x03()) {
|
if (!e->GetMask0x03()) {
|
||||||
p_edge = e->GetCounterclockwiseEdge(this);
|
p_edge = e->GetCounterclockwiseEdge(*this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_edge = e;
|
p_edge = e;
|
||||||
|
|
|
@ -279,10 +279,10 @@ MxResult LegoPathController::FUN_10046050(
|
||||||
if (edge->GetMask0x03()) {
|
if (edge->GetMask0x03()) {
|
||||||
Mx3DPointFloat vec;
|
Mx3DPointFloat vec;
|
||||||
|
|
||||||
if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS &&
|
if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS &&
|
||||||
vec.Dot(&vec, &p_direction) < 0.0f) {
|
vec.Dot(&vec, &p_direction) < 0.0f) {
|
||||||
edge =
|
edge =
|
||||||
(LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(boundary)->GetCounterclockwiseEdge(boundary);
|
(LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!edge->GetMask0x03()) {
|
if (!edge->GetMask0x03()) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
|
||||||
|
|
||||||
// STUB: LEGO1 0x1001b700
|
// STUB: LEGO1 0x1001b700
|
||||||
// FUNCTION: BETA10 0x100c26c5
|
// FUNCTION: BETA10 0x100c26c5
|
||||||
void LegoPathStruct::VTable0x04(undefined4, undefined4, undefined4)
|
void LegoPathStruct::VTable0x04(LegoPathActor*, undefined4, undefined4)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ LegoEdge::~LegoEdge()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009a4d0
|
// FUNCTION: LEGO1 0x1009a4d0
|
||||||
LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge* p_face)
|
LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge& p_face)
|
||||||
{
|
{
|
||||||
if (p_face == m_faceA) {
|
if (&p_face == m_faceA) {
|
||||||
return m_cwA;
|
return m_cwA;
|
||||||
}
|
}
|
||||||
else if (p_face == m_faceB) {
|
else if (&p_face == m_faceB) {
|
||||||
return m_cwB;
|
return m_cwB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -37,12 +37,12 @@ LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge* p_face)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009a4f0
|
// FUNCTION: LEGO1 0x1009a4f0
|
||||||
LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge* p_face)
|
LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge& p_face)
|
||||||
{
|
{
|
||||||
if (p_face == m_faceA) {
|
if (&p_face == m_faceA) {
|
||||||
return m_ccwA;
|
return m_ccwA;
|
||||||
}
|
}
|
||||||
else if (p_face == m_faceB) {
|
else if (&p_face == m_faceB) {
|
||||||
return m_ccwB;
|
return m_ccwB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -51,13 +51,13 @@ LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge* p_face)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009a510
|
// FUNCTION: LEGO1 0x1009a510
|
||||||
Vector3* LegoEdge::GetOpposingPoint(LegoWEEdge* p_face)
|
Vector3* LegoEdge::GetOpposingPoint(LegoWEEdge& p_face)
|
||||||
{
|
{
|
||||||
return p_face == m_faceA ? m_pointB : m_pointA;
|
return &p_face == m_faceA ? m_pointB : m_pointA;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009a530
|
// FUNCTION: LEGO1 0x1009a530
|
||||||
Vector3* LegoEdge::GetPoint(LegoWEEdge* p_face)
|
Vector3* LegoEdge::CCWVertex(LegoWEEdge& p_face)
|
||||||
{
|
{
|
||||||
return p_face == m_faceB ? m_pointB : m_pointA;
|
return &p_face == m_faceB ? m_pointB : m_pointA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@ struct LegoEdge {
|
||||||
LegoEdge();
|
LegoEdge();
|
||||||
virtual ~LegoEdge(); // vtable+0x00
|
virtual ~LegoEdge(); // vtable+0x00
|
||||||
|
|
||||||
LegoEdge* GetClockwiseEdge(LegoWEEdge* face);
|
LegoEdge* GetClockwiseEdge(LegoWEEdge& p_face);
|
||||||
LegoEdge* GetCounterclockwiseEdge(LegoWEEdge* face);
|
LegoEdge* GetCounterclockwiseEdge(LegoWEEdge& p_face);
|
||||||
Vector3* GetOpposingPoint(LegoWEEdge* face);
|
Vector3* GetOpposingPoint(LegoWEEdge& p_face);
|
||||||
Vector3* GetPoint(LegoWEEdge* face);
|
Vector3* CCWVertex(LegoWEEdge& p_face);
|
||||||
|
|
||||||
LegoResult FUN_1002ddc0(LegoWEEdge* p_face, Vector3& p_point);
|
LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point);
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1009a4a0
|
// SYNTHETIC: LEGO1 0x1009a4a0
|
||||||
// LegoEdge::`scalar deleting destructor'
|
// LegoEdge::`scalar deleting destructor'
|
||||||
|
|
|
@ -27,12 +27,12 @@ class LegoWEGEdge : public LegoWEEdge {
|
||||||
{
|
{
|
||||||
m_unk0x00 = NULL;
|
m_unk0x00 = NULL;
|
||||||
m_unk0x04 = 0;
|
m_unk0x04 = 0;
|
||||||
m_unk0x08 = 0;
|
m_unk0x08 = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
LegoPathStruct* m_unk0x00; // 0x00
|
LegoPathStruct* m_unk0x00; // 0x00
|
||||||
undefined4 m_unk0x04; // 0x04
|
undefined4 m_unk0x04; // 0x04
|
||||||
undefined4 m_unk0x08; // 0x08
|
float m_unk0x08; // 0x08
|
||||||
};
|
};
|
||||||
|
|
||||||
LegoWEGEdge();
|
LegoWEGEdge();
|
||||||
|
|
Loading…
Reference in a new issue