implement Hospital::Notify(), Enable(), VTable0x64() (#670)

* implement Hospital::Notify(), Enable(), VTable0x64()

* function order

* Fix HandleClick

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Ramen2X 2024-03-13 16:32:20 -04:00 committed by GitHub
parent a9a564b25e
commit aaee10949e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 79 additions and 8 deletions

View file

@ -5,6 +5,7 @@
#include "hospitalstate.h"
#include "legogamestate.h"
#include "legoworld.h"
#include "radio.h"
// VTABLE: LEGO1 0x100d9730
// SIZE 0x12c
@ -39,6 +40,11 @@ public:
// Hospital::`scalar deleting destructor'
private:
MxLong HandleKeyPress(MxS8 p_key);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleButtonDown(LegoControlManagerEvent& p_param);
MxBool HandleClick(LegoControlManagerEvent& p_param);
undefined2 m_unk0xf8; // 0xf8
LegoGameState::Area m_destLocation; // 0xfc
undefined2 m_unk0x100; // 0x100

View file

@ -86,12 +86,35 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
return result;
}
// STUB: LEGO1 0x10074990
// FUNCTION: LEGO1 0x10074990
MxLong Hospital::Notify(MxParam& p_param)
{
// TODO
MxResult result = SUCCESS;
LegoWorld::Notify(p_param);
return 0;
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
result = HandleKeyPress((((LegoEventNotificationParam&) p_param)).GetKey());
break;
case c_notificationButtonDown:
result = HandleButtonDown(((LegoControlManagerEvent&) p_param));
break;
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
if (m_destLocation != LegoGameState::e_undefined) {
GameState()->SwitchArea(m_destLocation);
}
break;
}
}
return result;
}
// STUB: LEGO1 0x10074a60
@ -100,10 +123,48 @@ void Hospital::ReadyWorld()
// TODO
}
// STUB: LEGO1 0x10076220
void Hospital::Enable(MxBool p_enable)
// STUB: LEGO1 0x10074dd0
MxLong Hospital::HandleKeyPress(MxS8 p_key)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10074e00
MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10075710
MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10075f90
MxBool Hospital::HandleClick(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10076220
void Hospital::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// STUB: LEGO1 0x10076270
@ -113,9 +174,13 @@ MxResult Hospital::Tickle()
return SUCCESS;
}
// STUB: LEGO1 0x10076330
// FUNCTION: LEGO1 0x10076330
MxBool Hospital::VTable0x64()
{
// TODO
return FALSE;
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, 999);
m_hospitalState->m_unk0x08.m_unk0x00 = 0;
m_destLocation = LegoGameState::e_infomain;
return TRUE;
}