Ambulance::Create, dtor

This commit is contained in:
Joshua Peisach 2024-03-24 12:36:47 -04:00
parent b66e28ac5e
commit 33b604bcac
No known key found for this signature in database
GPG Key ID: 41C3D4189AFEDB5A
6 changed files with 51 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#ifndef AMBULANCE_H
#define AMBULANCE_H
#include "ambulancemissionstate.h"
#include "islepathactor.h"
// VTABLE: LEGO1 0x100d71a8
@ -8,6 +9,7 @@
class Ambulance : public IslePathActor {
public:
Ambulance();
~Ambulance() override;
MxLong Notify(MxParam& p_param) override; // vtable+0x04
MxResult Tickle() override; // vtable+0x08
@ -42,7 +44,7 @@ class Ambulance : public IslePathActor {
private:
// TODO: Ambulance fields
undefined m_unk0x160[4];
MxS32 m_unk0x164;
AmbulanceMissionState* m_state; // 0x164
MxS16 m_unk0x168;
MxS16 m_unk0x16a;
MxS16 m_unk0x16c;
@ -51,8 +53,8 @@ class Ambulance : public IslePathActor {
MxS16 m_unk0x172;
MxS32 m_unk0x174;
MxS32 m_unk0x178;
MxFloat m_unk0x17c;
undefined m_unk0x180[4];
MxFloat m_unk0x17c; // fuel?
MxFloat m_time; // 0x180
};
#endif // AMBULANCE_H

View File

@ -24,6 +24,8 @@ class AmbulanceMissionState : public LegoState {
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c
inline void SetUnknown0x08(undefined4 p_unk0x08) { m_unk0x08 = p_unk0x08; }
inline MxU16 GetColor(MxU8 p_id)
{
switch (p_id) {

View File

@ -177,9 +177,9 @@ class LegoGameState {
void SetCurrentAct(Act p_currentAct);
void FindLoadedAct();
void RegisterState(LegoState* p_state);
private:
void RegisterState(LegoState* p_state);
MxResult WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName);
MxResult WriteEndOfVariables(LegoStorage* p_storage);
MxS32 ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to);

View File

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

View File

@ -1,6 +1,14 @@
#include "ambulance.h"
#include "decomp.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoomni.h"
#include "legovariables.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
DECOMP_SIZE_ASSERT(Ambulance, 0x184)
@ -9,7 +17,7 @@ Ambulance::Ambulance()
{
this->m_unk0x168 = 0;
this->m_unk0x16a = -1;
this->m_unk0x164 = 0;
this->m_state = NULL;
this->m_unk0x16c = 0;
this->m_unk0x174 = -1;
this->m_unk0x16e = 0;
@ -20,17 +28,41 @@ Ambulance::Ambulance()
this->m_unk0x17c = 1.0;
}
// STUB: LEGO1 0x10035f90
// FUNCTION: LEGO1 0x10035f90
void Ambulance::Destroy(MxBool p_fromDestructor)
{
// TODO
}
// STUB: LEGO1 0x100361d0
// FUNCTION: LEGO1 0x10036160
Ambulance::~Ambulance()
{
ControlManager()->Unregister(this);
TickleManager()->UnregisterClient(this);
}
// FUNCTION: LEGO1 0x100361d0
MxResult Ambulance::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
MxResult result = IslePathActor::Create(p_dsAction);
if (result == SUCCESS) {
m_world = CurrentWorld();
if (m_world) {
m_world->Add(this);
}
m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
if (!m_state) {
m_state = new AmbulanceMissionState;
m_state->SetUnknown0x08(0);
GameState()->RegisterState(m_state);
}
}
VariableTable()->SetVariable(g_varAMBULFUEL, "1.0");
m_unk0x17c = 1.0;
m_time = Timer()->GetTime();
return result;
}
// STUB: LEGO1 0x10036300

View File

@ -15,6 +15,10 @@ DECOMP_SIZE_ASSERT(CursorVariable, 0x24)
DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24)
DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
// GLOBAL: LEGO1 0x100f39bc
// STRING: LEGO1 0x100f39a0
const char* g_varAMBULFUEL = "ambulFUEL";
// GLOBAL: LEGO1 0x100f3a40
// STRING: LEGO1 0x100f3808
const char* g_varVISIBILITY = "VISIBILITY";