Style changes and implement WEEdge

This commit is contained in:
Nathan 2024-03-26 10:30:14 -04:00
parent 3bd0db6829
commit 36a6298419
14 changed files with 188 additions and 113 deletions

View File

@ -150,8 +150,8 @@ add_library(geom STATIC
LEGO1/lego/sources/geom/legomesh.cpp
LEGO1/lego/sources/geom/legosphere.cpp
LEGO1/lego/sources/geom/legovertex.cpp
"LEGO1/lego/sources/misc/legoweedge.cpp"
"LEGO1/lego/sources/misc/legowegedge.cpp"
LEGO1/lego/sources/geom/legoweedge.cpp
LEGO1/lego/sources/geom/legowegedge.cpp
)
register_lego1_target(geom)
set_property(TARGET geom PROPERTY ARCHIVE_OUTPUT_NAME "geom$<$<CONFIG:Debug>:d>")

View File

@ -1,20 +1,20 @@
#ifndef LEGOANIMACTOR_H
#define LEGOANIMACTOR_H
#include "anim/legoanim.h"
#include "decomp.h"
#include "lego/sources/anim/legoanim.h"
#include "legopathactor.h"
// SIZE 0x20
struct LegoAnimActorStruct {
LegoAnimActorStruct(float p_float, LegoAnim* p_animTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
~LegoAnimActorStruct();
float GetDuration();
float m_unk0x00; // 0x00
LegoAnim* m_animTreePtr; // 0x04
LegoROI** m_roiMap; // 0x08
MxU32 m_numROIs; // 0x0c
vector<void*> m_unk0x10; // 0x10
float m_unk0x00; // 0x00
LegoAnim* m_AnimTreePtr; // 0x04
LegoROI** m_roiMap; // 0x08
MxU32 m_numROIs; // 0x0c
vector<undefined*> m_unk0x10; // 0x10
};
// VTABLE: LEGO1 0x100d5440 LegoPathActor
@ -45,7 +45,7 @@ class LegoAnimActor : public virtual LegoPathActor {
virtual MxResult FUN_1001c1f0(float& p_out);
virtual MxResult FUN_1001c360(float, Matrix4& p_transform);
virtual MxResult FUN_1001c450(LegoAnim* p_animTreePtr, float p_float, LegoROI** p_roiMap, MxU32 p_numROIs);
virtual MxResult FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs);
virtual void ClearMaps();
// SYNTHETIC: LEGO1 0x1000fb60
@ -60,10 +60,10 @@ class LegoAnimActor : public virtual LegoPathActor {
// Vector<LegoAnimActorStruct *>::~Vector<LegoAnimActorStruct *>
// TEMPLATE: LEGO1 0x1001c010
// vector<void *,allocator<void *> >::~vector<void *,allocator<void *> >
// vector<unsigned char *,allocator<unsigned char *> >::~vector<unsigned char *,allocator<unsigned char *> >
// TEMPLATE: LEGO1 0x1001c050
// Vector<void *>::~Vector<void *>
// Vector<unsigned char *>::~Vector<unsigned char *>
// TEMPLATE: LEGO1 0x1001c7c0
// vector<LegoAnimActorStruct *,allocator<LegoAnimActorStruct *> >::size

View File

@ -95,7 +95,7 @@ class LegoPathActor : public LegoActor {
// LegoPathActor::`scalar deleting destructor'
protected:
MxFloat m_bADuration; // 0x78
MxFloat m_BADuration; // 0x78
undefined4 m_unk0x7c; // 0x7c
MxFloat m_unk0x80; // 0x80
MxFloat m_unk0x84; // 0x84

View File

@ -1,11 +1,12 @@
#ifndef LEGOPATHBOUNDARY_H
#define LEGOPATHBOUNDARY_H
#include "misc/legowegedge.h"
#include "geom/legowegedge.h"
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
struct LegoPathBoundaryComparator {
MxBool operator()(const void*, const void*) const { return 0; }
MxBool operator()(const undefined*, const undefined*) const { return 0; }
};
// SIZE 0x74
@ -14,8 +15,8 @@ class LegoPathBoundary : public LegoWEGEdge {
LegoPathBoundary();
private:
map<void*, void*, LegoPathBoundaryComparator> m_unk0x54; // 0x54
map<void*, void*, LegoPathBoundaryComparator> m_unk0x64; // 0x64
map<undefined*, undefined*, LegoPathBoundaryComparator> m_unk0x54; // 0x54
map<undefined*, undefined*, LegoPathBoundaryComparator> m_unk0x64; // 0x64
};
#endif // LEGOPATHBOUNDARY_H

View File

@ -9,7 +9,7 @@ class LegoPathBoundary;
class LegoWorld;
struct LegoPathControllerComparator {
MxBool operator()(void*, void*) const { return 0; }
MxBool operator()(undefined*, undefined*) const { return 0; }
};
// VTABLE: LEGO1 0x100d7d60
@ -46,16 +46,16 @@ class LegoPathController : public MxCore {
void FUN_10046bb0(LegoWorld* p_world);
private:
LegoPathBoundary* m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c
undefined4 m_unk0x10; // 0x10
undefined4 m_unk0x14; // 0x14
MxS16 m_numL; // 0x18
MxS16 m_numE; // 0x1a
MxS16 m_numN; // 0x1c
MxS16 m_numT; // 0x1e
map<void*, void*, LegoPathControllerComparator> m_pfsE; // 0x20
map<void*, void*, LegoPathControllerComparator> m_unk0x30; // 0x30
LegoPathBoundary* m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c
undefined4 m_unk0x10; // 0x10
undefined4 m_unk0x14; // 0x14
MxS16 m_numL; // 0x18
MxS16 m_numE; // 0x1a
MxS16 m_numN; // 0x1c
MxS16 m_numT; // 0x1e
map<undefined*, undefined*, LegoPathControllerComparator> m_pfsE; // 0x20
map<undefined*, undefined*, LegoPathControllerComparator> m_unk0x30; // 0x30
};
#endif // LEGOPATHCONTROLLER_H

View File

@ -10,10 +10,10 @@ DECOMP_SIZE_ASSERT(LegoAnimActor, 0x174)
DECOMP_SIZE_ASSERT(LegoAnimActorStruct, 0x20)
// FUNCTION: LEGO1 0x1001bf80
LegoAnimActorStruct::LegoAnimActorStruct(float p_float, LegoAnim* p_animTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs)
LegoAnimActorStruct::LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs)
{
m_unk0x00 = p_float;
m_animTreePtr = p_animTreePtr;
m_unk0x00 = p_unk0x00;
m_AnimTreePtr = p_AnimTreePtr;
m_roiMap = p_roiMap;
m_numROIs = p_numROIs;
}
@ -29,7 +29,7 @@ LegoAnimActorStruct::~LegoAnimActorStruct()
// FUNCTION: LEGO1 0x1001c130
float LegoAnimActorStruct::GetDuration()
{
return m_animTreePtr->GetDuration();
return m_AnimTreePtr->GetDuration();
}
// FUNCTION: LEGO1 0x1001c140
@ -45,8 +45,8 @@ LegoAnimActor::~LegoAnimActor()
// FUNCTION: LEGO1 0x1001c1f0
MxResult LegoAnimActor::FUN_1001c1f0(float& p_out)
{
p_out = m_unk0x80 - (float) m_animMaps[m_curAnim]->m_animTreePtr->GetDuration() *
((int) (m_unk0x80 / (float) m_animMaps[m_curAnim]->m_animTreePtr->GetDuration()));
p_out = m_unk0x80 - (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration() *
((MxS32) (m_unk0x80 / (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration()));
return SUCCESS;
}
@ -89,7 +89,7 @@ MxResult LegoAnimActor::FUN_1001c360(float p_float, Matrix4& p_transform)
LegoROI** roiMap = anim->m_roiMap;
MxU32 numROIs = anim->m_numROIs;
if (m_boundary->GetFlag0x10()) {
LegoTreeNode* root = anim->m_animTreePtr->GetRoot();
LegoTreeNode* root = anim->m_AnimTreePtr->GetRoot();
m_roi->SetVisibility(TRUE);
for (MxU32 i = 0; i < numROIs; i++) {
if (roiMap[i] && (roiMap[i] != m_roi)) {
@ -119,11 +119,11 @@ MxResult LegoAnimActor::FUN_1001c360(float p_float, Matrix4& p_transform)
}
// FUNCTION: LEGO1 0x1001c450
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_animTreePtr, float p_float, LegoROI** p_roiMap, MxU32 p_numROIs)
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_animTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs)
{
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_float, p_animTreePtr, p_roiMap, p_numROIs);
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_unk0x00, p_animTreePtr, p_roiMap, p_numROIs);
for (vector<LegoAnimActorStruct*>::iterator it = m_animMaps.begin(); it != m_animMaps.end(); it++) {
if (p_float < (*it)->m_unk0x00) {
if (p_unk0x00 < (*it)->m_unk0x00) {
m_animMaps.insert(it, laas);
SetWorldSpeed(m_worldSpeed);
return SUCCESS;

View File

@ -0,0 +1,53 @@
#include "legoweedge.h"
DECOMP_SIZE_ASSERT(Edge, 0x24)
DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c)
// FUNCTION: LEGO1 0x1009a550
LegoWEEdge::LegoWEEdge()
{
m_edges = NULL;
m_numEdges = 0;
}
// FUNCTION: LEGO1 0x1009a590
LegoWEEdge::~LegoWEEdge()
{
if (m_edges) {
delete m_edges;
}
}
// FUNCTION: LEGO1 0x1009a5b0
LegoResult LegoWEEdge::VTable0x04()
{
for (int i = 0; i < m_numEdges; i++) {
Edge* e1 = m_edges[i];
Edge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1];
if (e2->m_pointA == e1->m_pointA) {
e1->m_faceA = this;
e2->m_faceB = this;
e1->m_ccwA = e2;
e2->m_cwB = e1;
}
else if (e2->m_pointB == e1->m_pointA) {
e1->m_faceA = this;
e2->m_faceA = this;
e1->m_ccwA = e2;
e2->m_cwA = e1;
}
else if (e1->m_pointB == e2->m_pointA) {
e1->m_faceB = this;
e2->m_faceB = this;
e1->m_ccwB = e2;
e2->m_cwB = e1;
}
else {
e1->m_faceB = this;
e2->m_faceA = this;
e1->m_ccwB = e2;
e2->m_cwA = e1;
}
}
return SUCCESS;
}

View File

@ -0,0 +1,39 @@
#ifndef __LEGOWEEDGE_H
#define __LEGOWEEDGE_H
#include "decomp.h"
#include "misc/legotypes.h"
class LegoWEEdge;
// SIZE 0x24
struct Edge {
public:
undefined4 m_unk0x00; // 0x00
LegoWEEdge* m_faceA; // 0x04
LegoWEEdge* m_faceB; // 0x08
Edge* m_ccwA; // 0x0c
Edge* m_cwA; // 0x10
Edge* m_ccwB; // 0x14
Edge* m_cwB; // 0x18
void* m_pointA; // 0x1c
void* m_pointB; // 0x20
};
// VTABLE: LEGO1 0x100db7c0
// SIZE 0x0c
class LegoWEEdge {
public:
LegoWEEdge();
virtual ~LegoWEEdge(); // vtable+0x00
virtual LegoResult VTable0x04(); // vtable+0x04
// SYNTHETIC: LEGO1 0x1009a570
// LegoWEEdge::`scalar deleting destructor'
protected:
LegoU8 m_numEdges; // 0x04
Edge** m_edges; // 0x08
};
#endif // __LEGOWEEDGE_H

View File

@ -0,0 +1,44 @@
#include "legowegedge.h"
DECOMP_SIZE_ASSERT(LegoWEGEdge, 0x54)
// FUNCTION: LEGO1 0x1009a730
LegoWEGEdge::LegoWEGEdge()
{
m_unk0x0d = 0;
m_name = NULL;
m_unk0x14.Clear();
m_edgeNormals = NULL;
m_unk0x0c = 0;
m_unk0x48 = 0;
m_unk0x4c = 0;
m_unk0x50 = 0;
}
// FUNCTION: LEGO1 0x1009a800
LegoWEGEdge::~LegoWEGEdge()
{
if (m_edges) {
delete[] m_edges;
m_edges = NULL;
}
if (m_name) {
delete[] m_name;
}
if (m_edgeNormals) {
delete[] m_edgeNormals;
}
if (m_unk0x4c) {
delete m_unk0x4c;
}
if (m_unk0x50) {
delete m_unk0x50;
}
}
// STUB: LEGO1 0x1009a8c0
LegoResult LegoWEGEdge::VTable0x04()
{
// TODO
return SUCCESS;
}

View File

@ -1,28 +1,33 @@
#ifndef __LEGOWEGEDGE_H
#define __LEGOWEGEDGE_H
#include "decomp.h"
#include "legoweedge.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxtypes.h"
// VTABLE: LEGO1 0x100db7f8
// SIZE 0x54
class LegoWEGEdge : public LegoWEEdge {
public:
LegoWEGEdge();
virtual ~LegoWEGEdge(); // vtable+0x00
LegoResult VTable0x04() override; // vtable+0x04
inline LegoBool GetFlag0x10() { return m_unk0x0c & 0x10 ? FALSE : TRUE; }
inline MxBool GetFlag0x10() { return m_unk0x0c & 0x10 ? FALSE : TRUE; }
// SYNTHETIC: LEGO1 0x1009a7e0
// LegoWEGEdge::`scalar deleting destructor'
private:
LegoU8 m_unk0x0c; // 0x0c
LegoU8 m_unk0x0d; // 0x0d
char* m_name; // 0x10
LegoChar* m_name; // 0x10
Mx4DPointFloat m_unk0x14; // 0x14
Mx4DPointFloat* m_edgeNormals; // 0x2c
Mx3DPointFloat m_unk0x30; // 0x30
LegoU32 m_unk0x44; // 0x44
LegoU8 m_unk0x48; // 0x48
LegoU32 m_unk0x4c; // 0x4c
LegoU32 m_unk0x50; // 0x50
undefined* m_unk0x4c; // 0x4c
undefined* m_unk0x50; // 0x50
};
#endif // __LEGOWEGEDGE_H

View File

@ -1,12 +0,0 @@
#include "legoweedge.h"
DECOMP_SIZE_ASSERT(Edge, 0x24)
DECOMP_SIZE_ASSERT(EdgePair, 0x08)
DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c)
// FUNCTION: LEGO1 0x1009a550
LegoWEEdge::LegoWEEdge()
{
m_edges = NULL;
m_numEdges = 0;
}

View File

@ -1,45 +0,0 @@
#ifndef __LEGOWEEDGE_H
#define __LEGOWEEDGE_H
#include "decomp.h"
#include "legotypes.h"
class LegoWEEdge;
// SIZE 0x24
class Edge {
virtual ~Edge()
{
// TODO
}
LegoWEEdge* m_faceA; // 0x04
LegoWEEdge* m_faceB; // 0x08
Edge* m_ccwA; // 0x0c
Edge* m_cwA; // 0x10
Edge* m_ccwB; // 0x14
Edge* m_cwB; // 0x18
void* m_pointA; // 0x1c
void* m_pointB; // 0x20
};
// SIZE 0x08
struct EdgePair {
Edge* m_e1; // 0x00
Edge* m_e2; // 0x04
};
// SIZE 0x0c
class LegoWEEdge {
public:
LegoWEEdge();
virtual ~LegoWEEdge()
{
// TODO
}
private:
LegoU8 m_numEdges; // 0x04
EdgePair* m_edges; // 0x08
};
#endif // __LEGOWEEDGE_H

View File

@ -1,13 +0,0 @@
#include "legowegedge.h"
DECOMP_SIZE_ASSERT(LegoWEGEdge, 0x54)
// FUNCTION: LEGO1 0x1009a730
LegoWEGEdge::LegoWEGEdge()
{
m_edgeNormals = NULL;
m_unk0x0c = 0;
m_unk0x48 = 0;
m_unk0x4c = 0;
m_unk0x50 = 0;
}

View File

@ -21,3 +21,6 @@ delta_pos: "Allow original naming from 1996"
rot_mat: "Allow original naming from 1996"
new_pos: "Allow original naming from 1996"
new_dir: "Allow original naming from 1996"
p_AnimTreePtr: "Allow original naming from beta"
m_AnimTreePtr: "Allow original naming from beta"
m_BADuration: "Allow original naming from beta"