Ambulance::Create, dtor (#719)

* Ambulance::Create, dtor

* annotations

* fix

* remove comment

---------

Co-authored-by: Ramen2X <rmn@legoisland.org>
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2024-03-24 17:28:44 -04:00 committed by GitHub
parent 313bd9ffd0
commit 3f6f59852f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 20 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
@ -40,19 +42,18 @@ class Ambulance : public IslePathActor {
// Ambulance::`scalar deleting destructor'
private:
// TODO: Ambulance fields
undefined m_unk0x160[4];
MxS32 m_unk0x164;
MxS16 m_unk0x168;
MxS16 m_unk0x16a;
MxS16 m_unk0x16c;
MxS16 m_unk0x16e;
MxS16 m_unk0x170;
MxS16 m_unk0x172;
MxS32 m_unk0x174;
MxS32 m_unk0x178;
MxFloat m_unk0x17c;
undefined m_unk0x180[4];
undefined m_unk0x160[4]; // 0x160
AmbulanceMissionState* m_state; // 0x164
MxS16 m_unk0x168; // 0x168
MxS16 m_unk0x16a; // 0x16a
MxS16 m_unk0x16c; // 0x16c
MxS16 m_unk0x16e; // 0x16e
MxS16 m_unk0x170; // 0x170
MxS16 m_unk0x172; // 0x172
MxS32 m_unk0x174; // 0x174
MxS32 m_unk0x178; // 0x178
MxFloat m_unk0x17c; // 0x17c
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,43 @@ 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 0x10036150
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";