Begin LegoRace

This commit is contained in:
Mikhail Thompson 2024-06-10 13:06:42 +02:00
parent 0dca127649
commit 15fc3638e3
No known key found for this signature in database
GPG Key ID: B051154A5A5C574A
6 changed files with 125 additions and 61 deletions

View File

@ -2,8 +2,11 @@
#define CARRACE_H #define CARRACE_H
#include "decomp.h" #include "decomp.h"
#include "legoeventnotificationparam.h"
#include "legorace.h" #include "legorace.h"
class MxEndActionNotificationParam;
// VTABLE: LEGO1 0x100d4b70 // VTABLE: LEGO1 0x100d4b70
// SIZE 0x2c // SIZE 0x2c
class CarRaceState : public RaceState { class CarRaceState : public RaceState {
@ -44,13 +47,13 @@ class CarRace : public LegoRace {
return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name); return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name);
} }
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
undefined4 VTable0x6c(undefined4) override; // vtable+0x6c MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
undefined4 VTable0x70(undefined4) override; // vtable+0x70 MxLong HandleType19Notification(MxType19NotificationParam&) override; // vtable+0x70
undefined4 VTable0x74(undefined4) override; // vtable+0x74 MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
undefined4 VTable0x78(undefined4) override; // vtable+0x78 MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78
// SYNTHETIC: LEGO1 0x10016c70 // SYNTHETIC: LEGO1 0x10016c70
// CarRace::`scalar deleting destructor' // CarRace::`scalar deleting destructor'

View File

@ -1,6 +1,7 @@
#ifndef JETSKIRACE_H #ifndef JETSKIRACE_H
#define JETSKIRACE_H #define JETSKIRACE_H
#include "legoeventnotificationparam.h"
#include "legorace.h" #include "legorace.h"
// VTABLE: LEGO1 0x100d4fa8 // VTABLE: LEGO1 0x100d4fa8
@ -48,12 +49,12 @@ class JetskiRace : public LegoRace {
return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name); return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name);
} }
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
undefined4 VTable0x6c(undefined4) override; // vtable+0x6c MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
undefined4 VTable0x70(undefined4) override; // vtable+0x70 MxLong HandleType19Notification(MxType19NotificationParam&) override; // vtable+0x70
undefined4 VTable0x74(undefined4) override; // vtable+0x74 MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
}; };
// SYNTHETIC: LEGO1 0x1000f530 // SYNTHETIC: LEGO1 0x1000f530

View File

@ -2,11 +2,18 @@
#define LEGORACE_H #define LEGORACE_H
#include "decomp.h" #include "decomp.h"
#include "legoeventnotificationparam.h"
#include "legogamestate.h"
#include "legostate.h" #include "legostate.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxrect32.h" #include "mxrect32.h"
#include "mxtypes.h" #include "mxtypes.h"
class Act1State;
class LegoPathActor;
class MxEndActionNotificationParam;
class MxType19NotificationParam;
// VTABLE: LEGO1 0x100d5e30 // VTABLE: LEGO1 0x100d5e30
// SIZE 0x2c // SIZE 0x2c
class RaceState : public LegoState { class RaceState : public LegoState {
@ -85,34 +92,34 @@ class LegoRace : public LegoWorld {
return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name); return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name);
} }
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
MxBool VTable0x5c() override; // vtable+0x5c MxBool VTable0x5c() override; // vtable+0x5c
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68 void Enable(MxBool p_enable) override; // vtable+0x68
virtual undefined4 VTable0x6c(undefined4) = 0; // vtable+0x6c virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c
virtual undefined4 VTable0x70(undefined4); // vtable+0x70 virtual MxLong HandleType19Notification(MxType19NotificationParam&); // vtable+0x70
virtual undefined4 VTable0x74(undefined4); // vtable+0x74 virtual MxLong HandleEndAction(MxEndActionNotificationParam&); // vtable+0x74
virtual undefined4 VTable0x78(undefined4); // vtable+0x78 virtual MxLong HandleType0Notification(MxNotificationParam&); // vtable+0x78
virtual void VTable0x7c(undefined4, undefined4); // vtable+0x7c virtual void VTable0x7c(undefined4, undefined4); // vtable+0x7c
// SYNTHETIC: LEGO1 0x10015cc0 // SYNTHETIC: LEGO1 0x10015cc0
// LegoRace::`scalar deleting destructor' // LegoRace::`scalar deleting destructor'
private: private:
undefined4 m_unk0xf8; // 0xf8 undefined4 m_unk0xf8; // 0xf8
undefined4 m_unk0xfc; // 0xfc undefined4 m_unk0xfc; // 0xfc
undefined4 m_unk0x100; // 0x100 undefined4 m_unk0x100; // 0x100
undefined4 m_unk0x104; // 0x104 undefined4 m_unk0x104; // 0x104
undefined4 m_unk0x108; // 0x108 undefined4 m_unk0x108; // 0x108
undefined4 m_unk0x10c; // 0x10c undefined4 m_unk0x10c; // 0x10c
undefined4 m_unk0x110; // 0x110 undefined4 m_unk0x110; // 0x110
undefined4 m_unk0x114; // 0x114 undefined4 m_unk0x114; // 0x114
undefined4 m_unk0x118; // 0x118 undefined4 m_unk0x118; // 0x118
undefined4 m_unk0x11c; // 0x11c LegoGameState::Area m_destLocation; // 0x11c
undefined4 m_unk0x120; // 0x120 LegoPathActor* m_pathActor; // 0x120
undefined4 m_unk0x124; // 0x124 Act1State* m_act1State; // 0x124
undefined4 m_unk0x128; // 0x128 undefined4 m_unk0x128; // 0x128
undefined4 m_unk0x12c; // 0x12c undefined4 m_unk0x12c; // 0x12c
protected: protected:
MxRect32 m_unk0x130; // 0x130 MxRect32 m_unk0x130; // 0x130

View File

@ -1,5 +1,7 @@
#include "carrace.h" #include "carrace.h"
#include "mxactionnotificationparam.h"
DECOMP_SIZE_ASSERT(CarRace, 0x154) DECOMP_SIZE_ASSERT(CarRace, 0x154)
// FUNCTION: LEGO1 0x10016a90 // FUNCTION: LEGO1 0x10016a90
@ -23,28 +25,28 @@ void CarRace::ReadyWorld()
} }
// STUB: LEGO1 0x10016f60 // STUB: LEGO1 0x10016f60
undefined4 CarRace::VTable0x74(undefined4) MxLong CarRace::HandleEndAction(MxEndActionNotificationParam&)
{ {
// TODO // TODO
return 0; return 0;
} }
// STUB: LEGO1 0x100170e0 // STUB: LEGO1 0x100170e0
undefined4 CarRace::VTable0x70(undefined4) MxLong CarRace::HandleType19Notification(MxType19NotificationParam&)
{ {
// TODO // TODO
return 0; return 0;
} }
// STUB: LEGO1 0x10017650 // STUB: LEGO1 0x10017650
undefined4 CarRace::VTable0x6c(undefined4) MxLong CarRace::HandleClick(LegoEventNotificationParam&)
{ {
// TODO // TODO
return 0; return 0;
} }
// STUB: LEGO1 0x100177e0 // STUB: LEGO1 0x100177e0
undefined4 CarRace::VTable0x78(undefined4) MxLong CarRace::HandleType0Notification(MxNotificationParam&)
{ {
// TODO // TODO
return 0; return 0;

View File

@ -14,19 +14,19 @@ void JetskiRace::ReadyWorld()
} }
// STUB: LEGO1 0x10016520 // STUB: LEGO1 0x10016520
undefined4 JetskiRace::VTable0x74(undefined4) MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam&)
{ {
return 0; return 0;
} }
// STUB: LEGO1 0x100165a0 // STUB: LEGO1 0x100165a0
undefined4 JetskiRace::VTable0x6c(undefined4) MxLong JetskiRace::HandleClick(LegoEventNotificationParam&)
{ {
return 0; return 0;
} }
// STUB: LEGO1 0x100166a0 // STUB: LEGO1 0x100166a0
undefined4 JetskiRace::VTable0x70(undefined4) MxLong JetskiRace::HandleType19Notification(MxType19NotificationParam&)
{ {
return 0; return 0;
} }

View File

@ -1,15 +1,21 @@
#include "legorace.h" #include "legorace.h"
#include "isle.h"
#include "legocontrolmanager.h"
#include "legonavcontroller.h"
#include "misc.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
DECOMP_SIZE_ASSERT(LegoRace, 0x144) DECOMP_SIZE_ASSERT(LegoRace, 0x144)
DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06) DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06)
// TODO: Must be 0x2c but current structure is incorrect DECOMP_SIZE_ASSERT(RaceState, 0x2c)
// DECOMP_SIZE_ASSERT(RaceState, 0x2c)
// Defined in legopathstruct.cpp
extern MxBool g_unk0x100f119c;
// FUNCTION: LEGO1 0x1000dab0 // FUNCTION: LEGO1 0x1000dab0
undefined4 LegoRace::VTable0x78(undefined4) MxLong LegoRace::HandleType0Notification(MxNotificationParam&)
{ {
return 0; return 0;
} }
@ -41,20 +47,20 @@ LegoRace::LegoRace()
this->m_unk0x118 = 0; this->m_unk0x118 = 0;
this->m_unk0x128 = 0; this->m_unk0x128 = 0;
this->m_unk0x12c = 0; this->m_unk0x12c = 0;
this->m_unk0x120 = 0; this->m_pathActor = 0;
this->m_unk0x124 = 0; this->m_act1State = NULL;
this->m_unk0x11c = 0; this->m_destLocation = LegoGameState::e_undefined;
NotificationManager()->Register(this); NotificationManager()->Register(this);
} }
// FUNCTION: LEGO1 0x10015b70 // FUNCTION: LEGO1 0x10015b70
undefined4 LegoRace::VTable0x70(undefined4) MxLong LegoRace::HandleType19Notification(MxType19NotificationParam&)
{ {
return 0; return 0;
} }
// FUNCTION: LEGO1 0x10015b80 // FUNCTION: LEGO1 0x10015b80
undefined4 LegoRace::VTable0x74(undefined4) MxLong LegoRace::HandleEndAction(MxEndActionNotificationParam&)
{ {
return 0; return 0;
} }
@ -65,30 +71,75 @@ MxBool LegoRace::Escape()
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x10015ce0 // FUNCTION: LEGO1 0x10015ce0
MxResult LegoRace::Create(MxDSAction& p_dsAction) MxResult LegoRace::Create(MxDSAction& p_dsAction)
{ {
// TODO MxResult result = LegoWorld::Create(p_dsAction);
return SUCCESS; if (result == SUCCESS) {
m_act1State = (Act1State*) GameState()->GetState("Act1State");
ControlManager()->Register(this);
m_pathActor = CurrentActor();
m_pathActor->SetWorldSpeed(0);
SetCurrentActor(NULL);
}
return result;
} }
// STUB: LEGO1 0x10015d40 // FUNCTION: LEGO1 0x10015d40
LegoRace::~LegoRace() LegoRace::~LegoRace()
{ {
// TODO g_unk0x100f119c = FALSE;
if (m_pathActor) {
SetCurrentActor(m_pathActor);
NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel());
m_pathActor = NULL;
}
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
} }
// STUB: LEGO1 0x10015e00 // FUNCTION: LEGO1 0x10015e00
MxLong LegoRace::Notify(MxParam& p_param) MxLong LegoRace::Notify(MxParam& p_param)
{ {
// TODO MxLong result = 0;
return 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationType0:
result = HandleType0Notification((MxNotificationParam&) p_param);
break;
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationClick:
result = HandleClick((LegoEventNotificationParam&) p_param);
break;
case c_notificationType19:
result = HandleType19Notification((MxType19NotificationParam&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_destLocation);
break;
}
}
return result;
} }
// STUB: LEGO1 0x10015ed0 // FUNCTION: LEGO1 0x10015ed0
void LegoRace::Enable(MxBool p_enable) void LegoRace::Enable(MxBool p_enable)
{ {
// TODO if (GetUnknown0xd0().size() == 1 && !p_enable) {
Remove(CurrentActor());
MxU8 oldActorId = GameState()->GetActorId();
GameState()->RemoveActor();
GameState()->SetActorId(oldActorId);
}
LegoWorld::Enable(p_enable);
} }
// STUB: LEGO1 0x10015f30 // STUB: LEGO1 0x10015f30