From b6499025781dc621f525028be5bd914d2d4f7ee5 Mon Sep 17 00:00:00 2001
From: jonschz <17198703+jonschz@users.noreply.github.com>
Date: Wed, 21 Aug 2024 19:42:49 +0200
Subject: [PATCH] Various fixes in constructors (#1089)

* Various fixes in constructors

* Address review comment

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
---
 LEGO1/lego/legoomni/include/legocarbuild.h    |  6 ++++
 LEGO1/lego/legoomni/include/legojetski.h      | 17 ++++++++-
 .../legoomni/include/legojetskiraceactor.h    |  6 ++++
 LEGO1/lego/legoomni/include/legorace.h        |  8 +++++
 LEGO1/lego/legoomni/include/legoracers.h      | 12 +++++++
 LEGO1/lego/legoomni/include/legoracespecial.h |  3 ++
 .../lego/legoomni/src/build/legocarbuild.cpp  | 36 +++++++++++++++++++
 LEGO1/lego/legoomni/src/entity/legojetski.cpp |  4 +--
 LEGO1/lego/legoomni/src/race/legorace.cpp     | 19 ++++++++--
 9 files changed, 106 insertions(+), 5 deletions(-)

diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h
index e333c1e8..4312c52b 100644
--- a/LEGO1/lego/legoomni/include/legocarbuild.h
+++ b/LEGO1/lego/legoomni/include/legocarbuild.h
@@ -82,6 +82,12 @@ public:
 	MxBool VTable0x5c() override;                     // vtable+0x5c
 	MxBool Escape() override;                         // vtable+0x64
 	void Enable(MxBool p_enable) override;            // vtable+0x68
+	virtual void VTable0x6c();                        // vtable+0x6c
+	virtual void VTable0x70();                        // vtable+0x70
+	virtual void VTable0x74();                        // vtable+0x74
+	virtual void VTable0x78();                        // vtable+0x78
+	virtual void VTable0x7c();                        // vtable+0x7c
+	virtual void VTable0x80();                        // vtable+0x80
 
 	// SYNTHETIC: LEGO1 0x10022a60
 	// LegoCarBuild::`scalar deleting destructor'
diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h
index 8559cac7..56057da2 100644
--- a/LEGO1/lego/legoomni/include/legojetski.h
+++ b/LEGO1/lego/legoomni/include/legojetski.h
@@ -4,7 +4,7 @@
 #include "legojetskiraceactor.h"
 #include "legoracemap.h"
 
-// VTABLE: LEGO1 0x100d5a08 LegoJetskiRaceActor
+// VTABLE: LEGO1 0x100d5a08 LegoCarRaceActor
 // VTABLE: LEGO1 0x100d5a28 LegoRaceActor
 // VTABLE: LEGO1 0x100d5a30 LegoAnimActor
 // VTABLE: LEGO1 0x100d5a40 LegoPathActor
@@ -52,4 +52,19 @@ public:
 	// LegoJetski::`scalar deleting destructor'
 };
 
+// GLOBAL: LEGO1 0x100d59b8
+// LegoJetski::`vbtable'{for `LegoCarRaceActor'}
+
+// GLOBAL: LEGO1 0x100d59c8
+// LegoJetski::`vbtable'{for `LegoRaceActor'}
+
+// GLOBAL: LEGO1 0x100d59d8
+// LegoJetski::`vbtable'{for `LegoAnimActor'}
+
+// GLOBAL: LEGO1 0x100d59e0
+// LegoJetski::`vbtable'
+
+// GLOBAL: LEGO1 0x100d59f0
+// LegoJetski::`vbtable'{for `LegoJetskiRaceActor'}
+
 #endif // LEGOJETSKI_H
diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h
index 2f5b3d19..e2689968 100644
--- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h
+++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h
@@ -36,8 +36,14 @@ public:
 	void VTable0x70(float p_float) override;                                   // vtable+0x70
 	MxS32 VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edge) override; // vtable+0x1c
 
+	// SYNTHETIC: LEGO1 0x10013a80
+	// LegoJetskiRaceActor::`vbase destructor'
+
 	// SYNTHETIC: LEGO1 0x10081d50
 	// LegoJetskiRaceActor::`scalar deleting destructor'
+
+	// SYNTHETIC: LEGO1 0x10013ba0
+	// LegoJetskiRaceActor::~LegoJetskiRaceActor
 };
 
 #endif // LEGOJETSKIRACEACTOR_H
diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h
index 6bc7dde3..ff463538 100644
--- a/LEGO1/lego/legoomni/include/legorace.h
+++ b/LEGO1/lego/legoomni/include/legorace.h
@@ -23,6 +23,14 @@ public:
 	// SIZE 0x06
 	struct Entry {
 	public:
+		// FUNCTION: LEGO1 0x10016000
+		Entry()
+		{
+			m_id = 0;
+			m_unk0x02 = 0;
+			m_score = 0;
+		}
+
 		MxS16 GetUnknown0x02() { return m_unk0x02; }
 		MxS16 GetHighScore() { return m_score; }
 
diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h
index 7e207ef8..ea8472d1 100644
--- a/LEGO1/lego/legoomni/include/legoracers.h
+++ b/LEGO1/lego/legoomni/include/legoracers.h
@@ -115,3 +115,15 @@ private:
 };
 
 #endif // LEGORACERS_H
+
+// GLOBAL: LEGO1 0x100d5890
+// LegoRaceCar::`vbtable'{for `LegoCarRaceActor'}
+
+// GLOBAL: LEGO1 0x100d5880
+// LegoRaceCar::`vbtable'{for `LegoRaceMap'}
+
+// GLOBAL: LEGO1 0x100d5878
+// LegoRaceCar::`vbtable'{for `LegoAnimActor'}
+
+// GLOBAL: LEGO1 0x100d5868
+// LegoRaceCar::`vbtable'{for `LegoRaceActor'}
diff --git a/LEGO1/lego/legoomni/include/legoracespecial.h b/LEGO1/lego/legoomni/include/legoracespecial.h
index a85a967f..76245493 100644
--- a/LEGO1/lego/legoomni/include/legoracespecial.h
+++ b/LEGO1/lego/legoomni/include/legoracespecial.h
@@ -72,6 +72,9 @@ public:
 	// SYNTHETIC: LEGO1 0x10081620
 	// LegoCarRaceActor::`scalar deleting destructor'
 
+	// SYNTHETIC: LEGO1 0x10012d80
+	// LegoCarRaceActor::~LegoCarRaceActor
+
 protected:
 	MxFloat m_unk0x08; // 0x08
 	MxU8 m_unk0x0c;    // 0x0c
diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp
index 3eae3094..e5d2c381 100644
--- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp
+++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp
@@ -28,6 +28,42 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction)
 	return SUCCESS;
 }
 
+// STUB: LEGO1 0x10022fc0
+void LegoCarBuild::VTable0x6c()
+{
+	// TODO
+}
+
+// STUB: LEGO1 0x10023020
+void LegoCarBuild::VTable0x70()
+{
+	// TODO
+}
+
+// STUB: LEGO1 0x10023500
+void LegoCarBuild::VTable0x74()
+{
+	// TODO
+}
+
+// STUB: LEGO1 0x10023570
+void LegoCarBuild::VTable0x78()
+{
+	// TODO
+}
+
+// STUB: LEGO1 0x10023620
+void LegoCarBuild::VTable0x7c()
+{
+	// TODO
+}
+
+// STUB: LEGO1 0x100236a0
+void LegoCarBuild::VTable0x80()
+{
+	// TODO
+}
+
 // STUB: LEGO1 0x100238b0
 MxResult LegoCarBuild::Tickle()
 {
diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp
index 42a7ed5b..5ad8524d 100644
--- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp
+++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp
@@ -36,10 +36,10 @@ LegoJetski::LegoJetski()
 	NotificationManager()->Register(this);
 }
 
-// STUB: LEGO1 0x10013aa0
+// FUNCTION: LEGO1 0x10013aa0
 LegoJetski::~LegoJetski()
 {
-	// TODO
+	NotificationManager()->Unregister(this);
 }
 
 // STUB: LEGO1 0x10013bb0
diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp
index 2113be16..f4cad9d0 100644
--- a/LEGO1/lego/legoomni/src/race/legorace.cpp
+++ b/LEGO1/lego/legoomni/src/race/legorace.cpp
@@ -128,10 +128,25 @@ void LegoRace::Enable(MxBool p_enable)
 	LegoWorld::Enable(p_enable);
 }
 
-// STUB: LEGO1 0x10015f30
+// FUNCTION: LEGO1 0x10015f30
 RaceState::RaceState()
 {
-	// TODO
+	m_state[0].m_id = 1;
+	m_state[0].m_unk0x02 = 0;
+	m_state[0].m_score = 0;
+	m_state[1].m_id = 2;
+	m_state[1].m_unk0x02 = 0;
+	m_state[1].m_score = 0;
+	m_state[2].m_id = 3;
+	m_state[2].m_unk0x02 = 0;
+	m_state[2].m_score = 0;
+	m_state[3].m_id = 4;
+	m_state[3].m_unk0x02 = 0;
+	m_state[3].m_score = 0;
+	m_state[4].m_id = 5;
+	m_state[4].m_unk0x02 = 0;
+	m_state[4].m_score = 0;
+	m_unk0x28 = 0;
 }
 
 // FUNCTION: LEGO1 0x10016140