Begin LegoRace class (#1014)

* Begin LegoRace

* Match functions

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Mikhail Thompson
2024-06-10 14:58:05 +02:00
committed by GitHub
parent 0dca127649
commit 1c430f894d
9 changed files with 151 additions and 99 deletions

View File

@@ -1,60 +1,48 @@
#include "legorace.h"
#include "isle.h"
#include "legocontrolmanager.h"
#include "legonavcontroller.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
DECOMP_SIZE_ASSERT(LegoRace, 0x144)
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)
// FUNCTION: LEGO1 0x1000dab0
undefined4 LegoRace::VTable0x78(undefined4)
{
return 0;
}
// STUB: LEGO1 0x1000dac0
void LegoRace::VTable0x7c(undefined4, undefined4)
{
// TODO
}
// FUNCTION: LEGO1 0x1000dae0
MxBool LegoRace::VTable0x5c()
{
return TRUE;
}
// Defined in legopathstruct.cpp
extern MxBool g_unk0x100f119c;
// FUNCTION: LEGO1 0x10015aa0
LegoRace::LegoRace()
{
this->m_unk0xf8 = 0;
this->m_unk0xfc = 0;
this->m_unk0x100 = 0;
this->m_unk0x104 = 0;
this->m_unk0x108 = 0;
this->m_unk0x10c = 0;
this->m_unk0x140 = 0;
this->m_unk0x110 = 0;
this->m_unk0x114 = 0;
this->m_unk0x118 = 0;
this->m_unk0x128 = 0;
this->m_unk0x12c = 0;
this->m_unk0x120 = 0;
this->m_unk0x124 = 0;
this->m_unk0x11c = 0;
m_unk0xf8 = 0;
m_unk0xfc = 0;
m_unk0x100 = 0;
m_unk0x104 = 0;
m_unk0x108 = 0;
m_unk0x10c = 0;
m_unk0x140 = 0;
m_unk0x110 = 0;
m_unk0x114 = 0;
m_unk0x118 = 0;
m_unk0x128 = 0;
m_unk0x12c = 0;
m_pathActor = 0;
m_act1State = NULL;
m_destLocation = LegoGameState::e_undefined;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x10015b70
undefined4 LegoRace::VTable0x70(undefined4)
MxLong LegoRace::HandleType19Notification(MxType19NotificationParam&)
{
return 0;
}
// FUNCTION: LEGO1 0x10015b80
undefined4 LegoRace::VTable0x74(undefined4)
MxLong LegoRace::HandleEndAction(MxEndActionNotificationParam&)
{
return 0;
}
@@ -65,30 +53,79 @@ MxBool LegoRace::Escape()
return FALSE;
}
// STUB: LEGO1 0x10015ce0
// FUNCTION: LEGO1 0x10015ce0
MxResult LegoRace::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
MxResult result = LegoWorld::Create(p_dsAction);
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()
{
// 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
// FUNCTION: BETA10 0x100c7b3d
MxLong LegoRace::Notify(MxParam& p_param)
{
// TODO
return 0;
LegoWorld::Notify(p_param);
MxLong result = 0;
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationType0:
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
// FUNCTION: BETA10 0x100c7c3f
void LegoRace::Enable(MxBool p_enable)
{
// TODO
if (GetUnknown0xd0Empty() != p_enable && !p_enable) {
Remove(CurrentActor());
MxU8 oldActorId = GameState()->GetActorId();
GameState()->RemoveActor();
GameState()->SetActorId(oldActorId);
}
LegoWorld::Enable(p_enable);
}
// STUB: LEGO1 0x10015f30