Implement/match LegoCarRaceActor::VTable0x1c (#1078)

* Implement/match `LegoCarRaceActor::VTable0x1c`

* Fix formatting

* Fix LegoEdge::CWVertex()

* Fix more CI issues

* Trz to fix lvalue compile issue

* Fix formatting

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2024-08-04 21:13:12 +02:00
committed by GitHub
parent fe1b66938d
commit e09acfcddb
23 changed files with 328 additions and 161 deletions

View File

@@ -1,5 +1,6 @@
#include "legoedge.h"
#include "assert.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoEdge, 0x24)
@@ -51,13 +52,27 @@ LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge& p_face)
}
// FUNCTION: LEGO1 0x1009a510
// FUNCTION: BETA10 0x10182433
Vector3* LegoEdge::CWVertex(LegoWEEdge& p_face)
{
return &p_face == m_faceA ? m_pointB : m_pointA;
if (m_faceA == &p_face) {
return m_pointB;
}
else {
assert(m_faceB == &p_face);
return m_pointA;
}
}
// FUNCTION: LEGO1 0x1009a530
// FUNCTION: BETA10 0x10182498
Vector3* LegoEdge::CCWVertex(LegoWEEdge& p_face)
{
return &p_face == m_faceB ? m_pointB : m_pointA;
if (m_faceB == &p_face) {
return m_pointB;
}
else {
assert(m_faceA == &p_face);
return m_pointA;
}
}

View File

@@ -1,5 +1,7 @@
#include "legoweedge.h"
#include "legounkown100db7f4.h"
DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c)
// FUNCTION: LEGO1 0x1009a550
@@ -21,8 +23,8 @@ LegoWEEdge::~LegoWEEdge()
LegoResult LegoWEEdge::VTable0x04()
{
for (LegoS32 i = 0; i < m_numEdges; i++) {
LegoEdge* e1 = m_edges[i];
LegoEdge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1];
LegoUnknown100db7f4* e1 = m_edges[i];
LegoUnknown100db7f4* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1];
if (e2->m_pointA == e1->m_pointA) {
e1->m_faceA = this;

View File

@@ -2,9 +2,10 @@
#define __LEGOWEEDGE_H
#include "decomp.h"
#include "legoedge.h"
#include "misc/legotypes.h"
struct LegoUnknown100db7f4;
// might be a struct with public members
// VTABLE: LEGO1 0x100db7c0
// SIZE 0x0c
@@ -18,13 +19,13 @@ public:
LegoU8 GetNumEdges() { return m_numEdges; }
// FUNCTION: BETA10 0x1001cc30
LegoEdge** GetEdges() { return m_edges; }
LegoUnknown100db7f4** GetEdges() { return m_edges; }
// TODO: The assertion at BETA10 0x10037352 suggests that this function might take a pointer instead of a reference
// FUNCTION: BETA10 0x100373f0
LegoU32 IsEqual(LegoWEEdge& p_other) { return this == &p_other; }
void SetEdges(LegoEdge** p_edges, LegoU8 p_numEdges)
void SetEdges(LegoUnknown100db7f4** p_edges, LegoU8 p_numEdges)
{
m_edges = p_edges;
m_numEdges = p_numEdges;
@@ -34,8 +35,8 @@ public:
// LegoWEEdge::`scalar deleting destructor'
protected:
LegoU8 m_numEdges; // 0x04
LegoEdge** m_edges; // 0x08
LegoU8 m_numEdges; // 0x04
LegoUnknown100db7f4** m_edges; // 0x08
};
#endif // __LEGOWEEDGE_H

View File

@@ -41,7 +41,10 @@ public:
LegoResult VTable0x04() override; // vtable+0x04
LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; }
// FUNCTION: BETA10 0x1001ff80
Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; }
// FUNCTION: BETA10 0x1001c9b0