implement/match Hospital::Create() (#665)

This commit is contained in:
Ramen2X 2024-03-13 11:45:27 -04:00 committed by GitHub
parent 06080b6492
commit 4aafc435f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 35 deletions

View file

@ -2,6 +2,7 @@
#define HOSPITAL_H #define HOSPITAL_H
#include "decomp.h" #include "decomp.h"
#include "hospitalstate.h"
#include "legoworld.h" #include "legoworld.h"
// VTABLE: LEGO1 0x100d9730 // VTABLE: LEGO1 0x100d9730
@ -40,7 +41,7 @@ class Hospital : public LegoWorld {
undefined2 m_unk0xf8; // 0xf8 undefined2 m_unk0xf8; // 0xf8
undefined4 m_unk0xfc; // 0xfc undefined4 m_unk0xfc; // 0xfc
undefined2 m_unk0x100; // 0x100 undefined2 m_unk0x100; // 0x100
undefined4 m_unk0x104; // 0x104 - VTable0x18 suggests this may be pointer to a LegoGameState HospitalState* m_hospitalState; // 0x104
undefined2 m_unk0x108; // 0x108 undefined2 m_unk0x108; // 0x108
undefined4 m_unk0x10c; // 0x10c undefined4 m_unk0x10c; // 0x10c
undefined4 m_unk0x110; // 0x110 undefined4 m_unk0x110; // 0x110

View file

@ -2,12 +2,18 @@
#define HOSPITALSTATE_H #define HOSPITALSTATE_H
#include "decomp.h" #include "decomp.h"
#include "hospital_actions.h"
#include "legostate.h" #include "legostate.h"
// VTABLE: LEGO1 0x100d97a0 // VTABLE: LEGO1 0x100d97a0
// SIZE 0x18 // SIZE 0x18
class HospitalState : public LegoState { class HospitalState : public LegoState {
public: public:
// SIZE 0x04
struct Unknown0x08 {
undefined4 m_unk0x00; // 0x00
};
HospitalState(); HospitalState();
~HospitalState() override {} ~HospitalState() override {}
@ -29,8 +35,10 @@ class HospitalState : public LegoState {
// SYNTHETIC: LEGO1 0x100764c0 // SYNTHETIC: LEGO1 0x100764c0
// HospitalState::`scalar deleting destructor' // HospitalState::`scalar deleting destructor'
friend class Hospital;
private: private:
undefined m_unk0x08[4]; // 0x08 Unknown0x08 m_unk0x08; // 0x08
undefined2 m_unk0x0c; // 0x0c undefined2 m_unk0x0c; // 0x0c
undefined2 m_unk0x0e; // 0x0e undefined2 m_unk0x0e; // 0x0e
undefined2 m_unk0x10; // 0x10 undefined2 m_unk0x10; // 0x10

View file

@ -1,5 +1,10 @@
#include "hospital.h" #include "hospital.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoutils.h"
#include "misc.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
@ -8,18 +13,18 @@ DECOMP_SIZE_ASSERT(Hospital, 0x12c)
// FUNCTION: LEGO1 0x100745e0 // FUNCTION: LEGO1 0x100745e0
Hospital::Hospital() Hospital::Hospital()
{ {
this->m_unk0xf8 = 0; m_unk0xf8 = 0;
this->m_unk0x100 = 0; m_unk0x100 = 0;
this->m_unk0x104 = 0; m_hospitalState = NULL;
this->m_unk0x108 = 0; m_unk0x108 = 0;
this->m_unk0xfc = 0; m_unk0xfc = 0;
this->m_unk0x10c = 0; m_unk0x10c = 0;
this->m_unk0x110 = 0; m_unk0x110 = 0;
this->m_unk0x114 = 0; m_unk0x114 = 0;
this->m_unk0x118 = 0; m_unk0x118 = 0;
this->m_unk0x11c = 0; m_unk0x11c = 0;
this->m_unk0x120 = 0; m_unk0x120 = 0;
this->m_unk0x128 = 0; m_unk0x128 = 0;
NotificationManager()->Register(this); NotificationManager()->Register(this);
} }
@ -35,11 +40,36 @@ Hospital::~Hospital()
// TODO // TODO
} }
// STUB: LEGO1 0x100748c0 // FUNCTION: LEGO1 0x100748c0
MxResult Hospital::Create(MxDSAction& p_dsAction) MxResult Hospital::Create(MxDSAction& p_dsAction)
{ {
// TODO MxResult result = LegoWorld::Create(p_dsAction);
return SUCCESS; if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
SetIsWorldActive(FALSE);
m_hospitalState = (HospitalState*) GameState()->GetState("HospitalState");
if (!m_hospitalState) {
m_hospitalState = (HospitalState*) GameState()->CreateState("HospitalState");
m_hospitalState->m_unk0x08.m_unk0x00 = 1;
}
else if (m_hospitalState->m_unk0x08.m_unk0x00 == 4) {
m_hospitalState->m_unk0x08.m_unk0x00 = 4;
}
else {
m_hospitalState->m_unk0x08.m_unk0x00 = 3;
}
GameState()->SetCurrentArea(LegoGameState::e_hospital);
GameState()->StopArea(LegoGameState::e_previousArea);
InputManager()->Register(this);
FUN_1003ef00(FALSE);
return result;
} }
// STUB: LEGO1 0x10074990 // STUB: LEGO1 0x10074990