Implement/match actor Create functions (#949)

This commit is contained in:
Christian Semmler 2024-05-24 14:44:09 -04:00 committed by GitHub
parent 63719ef689
commit e59d684f37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 55 additions and 23 deletions

View file

@ -24,8 +24,6 @@ class AmbulanceMissionState : public LegoState {
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
inline void SetUnknown0x08(undefined4 p_unk0x08) { m_unk0x08 = p_unk0x08; }
inline MxU16 GetScore(MxU8 p_id) inline MxU16 GetScore(MxU8 p_id)
{ {
switch (p_id) { switch (p_id) {
@ -47,7 +45,6 @@ class AmbulanceMissionState : public LegoState {
// SYNTHETIC: LEGO1 0x100376c0 // SYNTHETIC: LEGO1 0x100376c0
// AmbulanceMissionState::`scalar deleting destructor' // AmbulanceMissionState::`scalar deleting destructor'
protected:
undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c undefined4 m_unk0x0c; // 0x0c
MxU16 m_unk0x10; // 0x10 MxU16 m_unk0x10; // 0x10

View file

@ -49,7 +49,7 @@ class IsleActor : public LegoActor {
// FUNCTION: LEGO1 0x1000e650 // FUNCTION: LEGO1 0x1000e650
virtual undefined4 VTable0x80(MxParam&) { return 0; } // vtable+0x80 virtual undefined4 VTable0x80(MxParam&) { return 0; } // vtable+0x80
private: protected:
LegoWorld* m_world; // 0x78 LegoWorld* m_world; // 0x78
}; };

View file

@ -128,9 +128,6 @@ class IslePathActor : public LegoPathActor {
// SYNTHETIC: LEGO1 0x10002ff0 // SYNTHETIC: LEGO1 0x10002ff0
// IslePathActor::`scalar deleting destructor' // IslePathActor::`scalar deleting destructor'
inline void SetWorld(LegoWorld* p_world) { m_world = p_world; }
inline LegoWorld* GetWorld() { return m_world; }
void FUN_1001b660(); void FUN_1001b660();
static void RegisterSpawnLocations(); static void RegisterSpawnLocations();

View file

@ -4,6 +4,7 @@
#include "mxvariable.h" #include "mxvariable.h"
extern const char* g_varAMBULFUEL; extern const char* g_varAMBULFUEL;
extern const char* g_varTOWFUEL;
extern const char* g_varVISIBILITY; extern const char* g_varVISIBILITY;
extern const char* g_varCAMERALOCATION; extern const char* g_varCAMERALOCATION;
extern const char* g_varCURSOR; extern const char* g_varCURSOR;

View file

@ -51,7 +51,7 @@ class TowTrack : public IslePathActor {
MxS32 m_unk0x170; // 0x170 MxS32 m_unk0x170; // 0x170
MxS32 m_unk0x174; // 0x174 MxS32 m_unk0x174; // 0x174
MxFloat m_unk0x178; // 0x178 MxFloat m_unk0x178; // 0x178
undefined4 m_unk0x17c; // 0x17c MxFloat m_time; // 0x17c
}; };
#endif // TOWTRACK_H #endif // TOWTRACK_H

View file

@ -45,7 +45,6 @@ class TowTrackMissionState : public LegoState {
// SYNTHETIC: LEGO1 0x1004e060 // SYNTHETIC: LEGO1 0x1004e060
// TowTrackMissionState::`scalar deleting destructor' // TowTrackMissionState::`scalar deleting destructor'
protected:
undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c undefined4 m_unk0x0c; // 0x0c
MxU8 m_unk0x10; // 0x10 MxU8 m_unk0x10; // 0x10

View file

@ -58,7 +58,7 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction)
m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState"); m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
if (!m_state) { if (!m_state) {
m_state = new AmbulanceMissionState(); m_state = new AmbulanceMissionState();
m_state->SetUnknown0x08(0); m_state->m_unk0x08 = 0;
GameState()->RegisterState(m_state); GameState()->RegisterState(m_state);
} }
} }

View file

@ -40,15 +40,16 @@ Helicopter::~Helicopter()
MxResult Helicopter::Create(MxDSAction& p_dsAction) MxResult Helicopter::Create(MxDSAction& p_dsAction)
{ {
MxResult result = IslePathActor::Create(p_dsAction); MxResult result = IslePathActor::Create(p_dsAction);
LegoWorld* world = CurrentWorld();
SetWorld(world); m_world = CurrentWorld();
if (world->IsA("Act3")) { if (m_world->IsA("Act3")) {
((Act3*) GetWorld())->SetUnknown420c(this); ((Act3*) m_world)->SetUnknown420c(this);
} }
world = GetWorld();
if (world) { if (m_world != NULL) {
world->Add(this); m_world->Add(this);
} }
CreateState(); CreateState();
return result; return result;
} }

View file

@ -1,7 +1,9 @@
#include "pizza.h" #include "pizza.h"
#include "act1state.h" #include "act1state.h"
#include "isle_actions.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoworld.h"
#include "misc.h" #include "misc.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
@ -27,11 +29,17 @@ Pizza::~Pizza()
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
} }
// STUB: LEGO1 0x10038170 // FUNCTION: LEGO1 0x10038170
MxResult Pizza::Create(MxDSAction& p_dsAction) MxResult Pizza::Create(MxDSAction& p_dsAction)
{ {
// TODO MxResult result = IsleActor::Create(p_dsAction);
return SUCCESS;
if (result == SUCCESS) {
CreateState();
m_skateboard = (SkateBoard*) m_world->Find(m_atom, IsleScript::c_SkateBoard_Actor);
}
return result;
} }
// FUNCTION: LEGO1 0x100381b0 // FUNCTION: LEGO1 0x100381b0

View file

@ -1,7 +1,12 @@
#include "towtrack.h" #include "towtrack.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legovariables.h"
#include "legoworld.h"
#include "misc.h" #include "misc.h"
#include "mxmisc.h"
#include "mxtimer.h"
#include "mxvariabletable.h"
#include "towtrackmissionstate.h" #include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(TowTrack, 0x180) DECOMP_SIZE_ASSERT(TowTrack, 0x180)
@ -20,11 +25,31 @@ TowTrack::TowTrack()
m_unk0x178 = 1.0; m_unk0x178 = 1.0;
} }
// STUB: LEGO1 0x1004c9e0 // FUNCTION: LEGO1 0x1004c9e0
// FUNCTION: BETA10 0x100f6bf1
MxResult TowTrack::Create(MxDSAction& p_dsAction) MxResult TowTrack::Create(MxDSAction& p_dsAction)
{ {
// TODO MxResult result = IslePathActor::Create(p_dsAction);
return SUCCESS;
if (result == SUCCESS) {
m_world = CurrentWorld();
if (m_world) {
m_world->Add(this);
}
m_state = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
if (!m_state) {
m_state = new TowTrackMissionState();
m_state->m_unk0x08 = 0;
GameState()->RegisterState(m_state);
}
}
VariableTable()->SetVariable(g_varTOWFUEL, "1.0");
m_unk0x178 = 1.0;
m_time = Timer()->GetTime();
return result;
} }
// STUB: LEGO1 0x1004cb10 // STUB: LEGO1 0x1004cb10

View file

@ -20,6 +20,10 @@ DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
// STRING: LEGO1 0x100f39a0 // STRING: LEGO1 0x100f39a0
const char* g_varAMBULFUEL = "ambulFUEL"; const char* g_varAMBULFUEL = "ambulFUEL";
// GLOBAL: LEGO1 0x100f43b4
// STRING: LEGO1 0x100f439c
const char* g_varTOWFUEL = "towFUEL";
// GLOBAL: LEGO1 0x100f3a40 // GLOBAL: LEGO1 0x100f3a40
// STRING: LEGO1 0x100f3808 // STRING: LEGO1 0x100f3808
const char* g_varVISIBILITY = "VISIBILITY"; const char* g_varVISIBILITY = "VISIBILITY";