From 545437416a1149def97bee6cc7a01f053b359a21 Mon Sep 17 00:00:00 2001 From: jonschz Date: Wed, 13 Nov 2024 23:13:28 +0100 Subject: [PATCH] Fix declaration order issue --- LEGO1/lego/legoomni/include/jetskirace.h | 2 -- LEGO1/lego/legoomni/include/legoracers.h | 2 ++ LEGO1/lego/legoomni/src/race/jetskirace.cpp | 19 ++----------------- LEGO1/lego/legoomni/src/race/legoracers.cpp | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index cebc77a0..ce1ea834 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -61,8 +61,6 @@ class JetskiRace : public LegoRace { MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70 MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 - - void FUN_10013670(); }; // SYNTHETIC: LEGO1 0x1000f530 diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index ee96d826..b16328d7 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -75,6 +75,8 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { virtual void FUN_10012ff0(float p_param); virtual MxU32 HandleSkeletonKicks(float p_param1); + static void FUN_10013670(); + // SYNTHETIC: LEGO1 0x10014240 // LegoRaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index dcd24229..bcb35b6b 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -9,6 +9,7 @@ #include "legohideanimpresenter.h" #include "legomain.h" #include "legopathstruct.h" +#include "legoracers.h" #include "legoracespecial.h" #include "legoutils.h" #include "misc.h" @@ -34,12 +35,6 @@ extern const char* g_racing; // Defined in legopathactor.cpp extern const char* g_strHIT_WALL_SOUND; -// GLOBAL: LEGO1 0x100f0bac -static undefined4 g_unk0x100f0bac = 0; - -// GLOBAL: LEGO1 0x100f0bb0 -static undefined4 g_unk0x100f0bb0 = 0; - DECOMP_SIZE_ASSERT(JetskiRace, 0x144) // FUNCTION: LEGO1 0x100162c0 @@ -68,7 +63,7 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction) m_unk0x130.SetTop(317); m_unk0x130.SetRight(543); m_unk0x130.SetBottom(333); - FUN_10013670(); + LegoRaceCar::FUN_10013670(); InvokeAction( Extra::e_start, m_atomId, @@ -81,16 +76,6 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction) return result; } -// FUNCTION: LEGO1 0x10013670 -void JetskiRace::FUN_10013670() -{ - g_unk0x100f0bac = (rand() & 0xc) >> 2; - - // Inlining the `rand()` causes this function to mismatch - MxU32 uVar1 = rand(); - g_unk0x100f0bb0 = uVar1 % 0xc >> 2; -} - // FUNCTION: LEGO1 0x100163b0 // FUNCTION: BETA10 0x100c7f10 void JetskiRace::ReadyWorld() diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 4f6c92e7..62346548 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -21,6 +21,12 @@ DECOMP_SIZE_ASSERT(EdgeReference, 0x08) DECOMP_SIZE_ASSERT(SkeletonKickPhase, 0x10) DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200) +// GLOBAL: LEGO1 0x100f0bac +static undefined4 g_unk0x100f0bac = 0; + +// GLOBAL: LEGO1 0x100f0bb0 +static undefined4 g_unk0x100f0bb0 = 0; + // GLOBAL: LEGO1 0x100f0a20 // GLOBAL: BETA10 0x101f5e34 EdgeReference LegoRaceCar::g_skBMap[] = { @@ -501,6 +507,16 @@ MxResult LegoRaceCar::VTable0x9c() return result; } +// FUNCTION: LEGO1 0x10013670 +void LegoRaceCar::FUN_10013670() +{ + g_unk0x100f0bac = (rand() & 0xc) >> 2; + + // Inlining the `rand()` causes this function to mismatch + MxU32 uVar1 = rand(); + g_unk0x100f0bb0 = uVar1 % 0xc >> 2; +} + // FUNCTION: LEGO1 0x10014500 // FUNCTION: BETA10 0x100cd5e0 MxU32 LegoRaceCar::VTable0x6c(