Implement/match LegoAnimActor (#730)

* Implement/match LegoAnimActor

* Name changes (deviation from original source)

* Attempt to fix modern build

* Add missing override

* Match LegoAnimActor::SetWorldSpeed

* Remove junk

* Style changes and implement WEEdge

* Add override

* Match LegoAnimActor::FUN_1001c1f0, style

* Style

* Add missing annotations, STUB LegoPathBoundary

* Style

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-03-26 13:51:52 -04:00
committed by GitHub
parent 43ce89224a
commit 1e3ca11886
25 changed files with 534 additions and 94 deletions

View File

@@ -0,0 +1,55 @@
#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 (LegoS32 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 {
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
undefined* m_pointA; // 0x1c
undefined* m_pointB; // 0x20
};
// VTABLE: LEGO1 0x100db7c0
// SIZE 0x0c
class LegoWEEdge {
public:
LegoWEEdge();
virtual ~LegoWEEdge();
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 = NULL;
m_unk0x50 = NULL;
}
// 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

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