Implement/match Isle::CreateState and related (#948)

This commit is contained in:
Christian Semmler 2024-05-24 14:07:36 -04:00 committed by GitHub
parent 1633118f68
commit 63719ef689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 123 additions and 61 deletions

View file

@ -36,6 +36,7 @@ class Ambulance : public IslePathActor {
MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc
void VTable0xe4() override; // vtable+0xe4 void VTable0xe4() override; // vtable+0xe4
void CreateState();
void FUN_10036e60(); void FUN_10036e60();
void FUN_10037060(); void FUN_10037060();

View file

@ -37,6 +37,8 @@ class Helicopter : public IslePathActor {
// SYNTHETIC: LEGO1 0x10003210 // SYNTHETIC: LEGO1 0x10003210
// Helicopter::`scalar deleting destructor' // Helicopter::`scalar deleting destructor'
void CreateState();
protected: protected:
MxMatrix m_unk0x160; // 0x160 MxMatrix m_unk0x160; // 0x160
MxMatrix m_unk0x1a8; // 0x1a8 MxMatrix m_unk0x1a8; // 0x1a8
@ -44,9 +46,6 @@ class Helicopter : public IslePathActor {
UnknownMx4DPointFloat m_unk0x1f4; // 0x1f4 UnknownMx4DPointFloat m_unk0x1f4; // 0x1f4
HelicopterState* m_state; // 0x228 HelicopterState* m_state; // 0x228
MxAtomId m_script; // 0x22c MxAtomId m_script; // 0x22c
private:
void GetState();
}; };
#endif // HELICOPTER_H #endif // HELICOPTER_H

View file

@ -76,7 +76,7 @@ class Isle : public LegoWorld {
void HandleElevatorEndAction(); void HandleElevatorEndAction();
void UpdateGlobe(); void UpdateGlobe();
void FUN_10032620(); void FUN_10032620();
void FUN_100330e0(); void CreateState();
void FUN_10032d30( void FUN_10032d30(
IsleScript::Script p_script, IsleScript::Script p_script,
JukeboxScript::Script p_music, JukeboxScript::Script p_music,

View file

@ -4,6 +4,8 @@
#include "decomp.h" #include "decomp.h"
#include "isleactor.h" #include "isleactor.h"
class Act1State;
class PizzaMissionState;
class SkateBoard; class SkateBoard;
// VTABLE: LEGO1 0x100d7380 // VTABLE: LEGO1 0x100d7380
@ -33,6 +35,7 @@ class Pizza : public IsleActor {
undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
undefined4 VTable0x80(MxParam&) override; // vtable+0x80 undefined4 VTable0x80(MxParam&) override; // vtable+0x80
void CreateState();
void FUN_100382b0(); void FUN_100382b0();
void FUN_10038380(); void FUN_10038380();
@ -42,10 +45,10 @@ class Pizza : public IsleActor {
// Pizza::`scalar deleting destructor' // Pizza::`scalar deleting destructor'
private: private:
undefined4 m_unk0x7c; // 0x7c PizzaMissionState* m_state; // 0x7c
undefined4 m_unk0x80; // 0x80 undefined4 m_unk0x80; // 0x80
SkateBoard* m_skateboard; // 0x84 SkateBoard* m_skateboard; // 0x84
undefined4 m_unk0x88; // 0x88 Act1State* m_act1state; // 0x88
undefined4 m_unk0x8c; // 0x8c undefined4 m_unk0x8c; // 0x8c
undefined4 m_unk0x90; // 0x90 undefined4 m_unk0x90; // 0x90
undefined4 m_unk0x94; // 0x94 undefined4 m_unk0x94; // 0x94

View file

@ -29,12 +29,12 @@ class Pizzeria : public IsleActor {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
undefined4 VTable0x68() override; // vtable+0x68 undefined4 VTable0x68() override; // vtable+0x68
void CreateState();
// SYNTHETIC: LEGO1 0x1000e8d0 // SYNTHETIC: LEGO1 0x1000e8d0
// Pizzeria::`scalar deleting destructor' // Pizzeria::`scalar deleting destructor'
private: private:
void Init();
PizzeriaState* m_pizzeriaState; // 0x7c PizzeriaState* m_pizzeriaState; // 0x7c
PizzaMissionState* m_pizzaMissionState; // 0x80 PizzaMissionState* m_pizzaMissionState; // 0x80
}; };

View file

@ -30,6 +30,7 @@ class Radio : public MxCore {
} }
void Initialize(MxBool p_und); void Initialize(MxBool p_und);
void CreateState();
void Play(); void Play();
void Stop(); void Stop();
@ -39,8 +40,6 @@ class Radio : public MxCore {
// Radio::`scalar deleting destructor' // Radio::`scalar deleting destructor'
private: private:
void CreateRadioState();
RadioState* m_state; // 0x08 RadioState* m_state; // 0x08
MxBool m_unk0x0c; // 0x0c MxBool m_unk0x0c; // 0x0c
MxBool m_audioEnabled; // 0x0d MxBool m_audioEnabled; // 0x0d

View file

@ -4,6 +4,8 @@
#include "decomp.h" #include "decomp.h"
#include "islepathactor.h" #include "islepathactor.h"
class TowTrackMissionState;
// VTABLE: LEGO1 0x100d7ee0 // VTABLE: LEGO1 0x100d7ee0
// SIZE 0x180 // SIZE 0x180
class TowTrack : public IslePathActor { class TowTrack : public IslePathActor {
@ -32,6 +34,7 @@ class TowTrack : public IslePathActor {
MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc
void VTable0xe4() override; // vtable+0xe4 void VTable0xe4() override; // vtable+0xe4
void CreateState();
void FUN_1004dab0(); void FUN_1004dab0();
void FUN_1004dad0(); void FUN_1004dad0();
@ -39,17 +42,16 @@ class TowTrack : public IslePathActor {
// TowTrack::`scalar deleting destructor' // TowTrack::`scalar deleting destructor'
private: private:
// TODO: TowTrack field types undefined4 m_unk0x160; // 0x160
undefined m_unk0x154[4]; TowTrackMissionState* m_state; // 0x164
MxS32 m_unk0x164; MxS16 m_unk0x168; // 0x168
MxS16 m_unk0x168; MxS16 m_unk0x16a; // 0x16a
MxS16 m_unk0x16a; MxS16 m_unk0x16c; // 0x16c
MxS16 m_unk0x16c; MxS16 m_unk0x16e; // 0x16e
MxS16 m_unk0x16e; MxS32 m_unk0x170; // 0x170
MxS32 m_unk0x170; MxS32 m_unk0x174; // 0x174
MxS32 m_unk0x174; MxFloat m_unk0x178; // 0x178
MxFloat m_unk0x178; undefined4 m_unk0x17c; // 0x17c
undefined4 m_unk0x17c;
}; };
#endif // TOWTRACK_H #endif // TOWTRACK_H

View file

@ -18,17 +18,17 @@ DECOMP_SIZE_ASSERT(Ambulance, 0x184)
// FUNCTION: LEGO1 0x10035ee0 // FUNCTION: LEGO1 0x10035ee0
Ambulance::Ambulance() Ambulance::Ambulance()
{ {
this->m_unk0x168 = 0; m_unk0x168 = 0;
this->m_unk0x16a = -1; m_unk0x16a = -1;
this->m_state = NULL; m_state = NULL;
this->m_unk0x16c = 0; m_unk0x16c = 0;
this->m_unk0x174 = -1; m_unk0x174 = -1;
this->m_unk0x16e = 0; m_unk0x16e = 0;
this->m_unk0x178 = -1; m_unk0x178 = -1;
this->m_unk0x170 = 0; m_unk0x170 = 0;
this->m_unk0x172 = 0; m_unk0x172 = 0;
this->m_unk0x13c = 40.0; m_unk0x13c = 40.0;
this->m_unk0x17c = 1.0; m_unk0x17c = 1.0;
} }
// FUNCTION: LEGO1 0x10035f90 // FUNCTION: LEGO1 0x10035f90
@ -66,7 +66,6 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction)
VariableTable()->SetVariable(g_varAMBULFUEL, "1.0"); VariableTable()->SetVariable(g_varAMBULFUEL, "1.0");
m_unk0x17c = 1.0; m_unk0x17c = 1.0;
m_time = Timer()->GetTime(); m_time = Timer()->GetTime();
return result; return result;
} }
@ -76,6 +75,19 @@ void Ambulance::VTable0x70(float p_float)
// TODO // TODO
} }
// FUNCTION: LEGO1 0x100363f0
void Ambulance::CreateState()
{
LegoGameState* gameState = GameState();
AmbulanceMissionState* state = (AmbulanceMissionState*) gameState->GetState("AmbulanceMissionState");
if (state == NULL) {
state = (AmbulanceMissionState*) gameState->CreateState("AmbulanceMissionState");
}
m_state = state;
}
// STUB: LEGO1 0x10036420 // STUB: LEGO1 0x10036420
MxLong Ambulance::Notify(MxParam& p_param) MxLong Ambulance::Notify(MxParam& p_param)
{ {

View file

@ -49,12 +49,12 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
if (world) { if (world) {
world->Add(this); world->Add(this);
} }
GetState(); CreateState();
return result; return result;
} }
// FUNCTION: LEGO1 0x10003320 // FUNCTION: LEGO1 0x10003320
void Helicopter::GetState() void Helicopter::CreateState()
{ {
m_state = (HelicopterState*) GameState()->GetState("HelicopterState"); m_state = (HelicopterState*) GameState()->GetState("HelicopterState");
if (!m_state) { if (!m_state) {

View file

@ -1,17 +1,21 @@
#include "pizza.h" #include "pizza.h"
#include "act1state.h"
#include "legogamestate.h"
#include "misc.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
#include "pizzamissionstate.h"
DECOMP_SIZE_ASSERT(Pizza, 0x9c) DECOMP_SIZE_ASSERT(Pizza, 0x9c)
// FUNCTION: LEGO1 0x10037ef0 // FUNCTION: LEGO1 0x10037ef0
Pizza::Pizza() Pizza::Pizza()
{ {
m_unk0x7c = 0; m_state = NULL;
m_unk0x80 = 0; m_unk0x80 = 0;
m_skateboard = NULL; m_skateboard = NULL;
m_unk0x88 = 0; m_act1state = NULL;
m_unk0x8c = -1; m_unk0x8c = -1;
m_unk0x98 = 0; m_unk0x98 = 0;
m_unk0x90 = 0x80000000; m_unk0x90 = 0x80000000;
@ -30,6 +34,20 @@ MxResult Pizza::Create(MxDSAction& p_dsAction)
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x100381b0
void Pizza::CreateState()
{
m_state = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
if (m_state == NULL) {
m_state = (PizzaMissionState*) GameState()->CreateState("PizzaMissionState");
}
m_act1state = (Act1State*) GameState()->GetState("Act1State");
if (m_act1state == NULL) {
m_act1state = (Act1State*) GameState()->CreateState("Act1State");
}
}
// STUB: LEGO1 0x100382b0 // STUB: LEGO1 0x100382b0
void Pizza::FUN_100382b0() void Pizza::FUN_100382b0()
{ {

View file

@ -11,14 +11,14 @@ MxResult Pizzeria::Create(MxDSAction& p_dsAction)
MxResult result = IsleActor::Create(p_dsAction); MxResult result = IsleActor::Create(p_dsAction);
if (result == SUCCESS) { if (result == SUCCESS) {
Init(); CreateState();
} }
return result; return result;
} }
// FUNCTION: LEGO1 0x100179f0 // FUNCTION: LEGO1 0x100179f0
void Pizzeria::Init() void Pizzeria::CreateState()
{ {
LegoGameState* gameState = GameState(); LegoGameState* gameState = GameState();
PizzeriaState* pizzeriaState = (PizzeriaState*) gameState->GetState("PizzeriaState"); PizzeriaState* pizzeriaState = (PizzeriaState*) gameState->GetState("PizzeriaState");

View file

@ -22,7 +22,7 @@ Radio::Radio()
ControlManager()->Register(this); ControlManager()->Register(this);
m_unk0x0c = TRUE; m_unk0x0c = TRUE;
CreateRadioState(); CreateState();
} }
// FUNCTION: LEGO1 0x1002c990 // FUNCTION: LEGO1 0x1002c990
@ -147,12 +147,12 @@ void Radio::Initialize(MxBool p_und)
{ {
if (m_unk0x0c != p_und) { if (m_unk0x0c != p_und) {
m_unk0x0c = p_und; m_unk0x0c = p_und;
CreateRadioState(); CreateState();
} }
} }
// FUNCTION: LEGO1 0x1002cde0 // FUNCTION: LEGO1 0x1002cde0
void Radio::CreateRadioState() void Radio::CreateState()
{ {
LegoGameState* gameState = GameState(); LegoGameState* gameState = GameState();
RadioState* state = (RadioState*) gameState->GetState("RadioState"); RadioState* state = (RadioState*) gameState->GetState("RadioState");

View file

@ -1,19 +1,23 @@
#include "towtrack.h" #include "towtrack.h"
#include "legogamestate.h"
#include "misc.h"
#include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(TowTrack, 0x180) DECOMP_SIZE_ASSERT(TowTrack, 0x180)
// FUNCTION: LEGO1 0x1004c720 // FUNCTION: LEGO1 0x1004c720
TowTrack::TowTrack() TowTrack::TowTrack()
{ {
this->m_unk0x168 = 0; m_unk0x168 = 0;
this->m_unk0x16a = -1; m_unk0x16a = -1;
this->m_unk0x164 = 0; m_state = NULL;
this->m_unk0x16c = 0; m_unk0x16c = 0;
this->m_unk0x170 = -1; m_unk0x170 = -1;
this->m_unk0x16e = 0; m_unk0x16e = 0;
this->m_unk0x174 = -1; m_unk0x174 = -1;
this->m_unk0x13c = 40.0; m_unk0x13c = 40.0;
this->m_unk0x178 = 1.0; m_unk0x178 = 1.0;
} }
// STUB: LEGO1 0x1004c9e0 // STUB: LEGO1 0x1004c9e0
@ -29,6 +33,15 @@ void TowTrack::VTable0x70(float p_float)
// TODO // TODO
} }
// FUNCTION: LEGO1 0x1004cc40
void TowTrack::CreateState()
{
m_state = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
if (m_state == NULL) {
m_state = (TowTrackMissionState*) GameState()->CreateState("TowTrackMissionState");
}
}
// STUB: LEGO1 0x1004cc80 // STUB: LEGO1 0x1004cc80
MxLong TowTrack::Notify(MxParam& p_param) MxLong TowTrack::Notify(MxParam& p_param)
{ {

View file

@ -31,6 +31,7 @@
#include "mxtransitionmanager.h" #include "mxtransitionmanager.h"
#include "mxvariabletable.h" #include "mxvariabletable.h"
#include "pizza.h" #include "pizza.h"
#include "pizzeria.h"
#include "scripts.h" #include "scripts.h"
#include "skateboard.h" #include "skateboard.h"
#include "towtrack.h" #include "towtrack.h"
@ -474,7 +475,7 @@ void Isle::Enable(MxBool p_enable)
m_radio.Initialize(p_enable); m_radio.Initialize(p_enable);
if (p_enable) { if (p_enable) {
FUN_100330e0(); CreateState();
VideoManager()->ResetPalette(FALSE); VideoManager()->ResetPalette(FALSE);
m_act1state->FUN_10034d00(); m_act1state->FUN_10034d00();
@ -1095,10 +1096,24 @@ void Isle::VTable0x6c(LegoPathActor* p_actor)
} }
} }
// STUB: LEGO1 0x100330e0 // FUNCTION: LEGO1 0x100330e0
void Isle::FUN_100330e0() void Isle::CreateState()
{ {
// TODO m_act1state = (Act1State*) GameState()->GetState("Act1State");
if (!m_act1state) {
m_act1state = (Act1State*) GameState()->CreateState("Act1State");
m_act1state->m_unk0x018 = 0;
}
m_radio.CreateState();
m_pizzeria->CreateState();
m_pizza->CreateState();
m_towtrack->CreateState();
m_ambulance->CreateState();
if (m_helicopter != NULL) {
m_helicopter->CreateState();
}
} }
// STUB: LEGO1 0x10033180 // STUB: LEGO1 0x10033180