Implement GasStation::HandleEndAction (#1053)

This commit is contained in:
Christian Semmler 2024-07-01 17:37:51 -07:00 committed by GitHub
parent 7bee5fc6a5
commit 788cec2560
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 61 additions and 19 deletions

View file

@ -1,6 +1,7 @@
#include "gasstation.h"
#include "garage_actions.h"
#include "isle.h"
#include "islepathactor.h"
#include "jukebox.h"
#include "jukebox_actions.h"
@ -10,6 +11,7 @@
#include "legomain.h"
#include "legoutils.h"
#include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
@ -299,11 +301,56 @@ inline void GasStation::StopAction(GarageScript::Script p_objectId)
}
}
// STUB: LEGO1 0x10005660
// FUNCTION: LEGO1 0x10005660
MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
{
// TODO
return 0;
MxLong result = m_radio.Notify(p_param);
if (result == 0) {
MxDSAction* action = p_param.GetAction();
if (action->GetAtomId() == m_atom && action->GetObjectId()) {
m_state->FUN_10006460((GarageScript::Script) action->GetObjectId());
m_unk0x106 = 0;
switch (m_state->m_unk0x14.m_unk0x00) {
case 5:
g_unk0x100f0160 = 0;
m_state->m_unk0x14.m_unk0x00 = 6;
m_unk0x115 = TRUE;
PlayAction(GarageScript::c_wgs023nu_RunAnim);
m_unk0x106 = 1;
m_unk0x104 = 1;
break;
case 6:
g_unk0x100f0160 = 0;
m_unk0x115 = TRUE;
if (m_unk0x104 == 3) {
m_state->m_unk0x14.m_unk0x00 = 8;
PlayAction(GarageScript::c_wgs029nu_RunAnim);
m_unk0x106 = 1;
}
else {
m_state->m_unk0x14.m_unk0x00 = 7;
m_unk0x114 = TRUE;
}
break;
case 8:
m_state->m_unk0x14.m_unk0x00 = 2;
((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7;
m_destLocation = LegoGameState::e_unk28;
m_radio.Stop();
BackgroundAudioManager()->Stop();
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
}
result = 1;
}
}
return result;
}
// FUNCTION: LEGO1 0x10005920

View file

@ -19,37 +19,37 @@ class MxActionNotificationParam : public MxNotificationParam {
: MxNotificationParam(p_type, p_sender)
{
MxDSAction* oldAction = p_action;
this->m_realloc = p_reallocAction;
m_realloc = p_reallocAction;
if (p_reallocAction) {
this->m_action = new MxDSAction();
m_action = new MxDSAction();
}
else {
this->m_action = oldAction;
m_action = oldAction;
return;
}
this->m_action->SetAtomId(oldAction->GetAtomId());
this->m_action->SetObjectId(oldAction->GetObjectId());
this->m_action->SetUnknown24(oldAction->GetUnknown24());
m_action->SetAtomId(oldAction->GetAtomId());
m_action->SetObjectId(oldAction->GetObjectId());
m_action->SetUnknown24(oldAction->GetUnknown24());
}
// FUNCTION: LEGO1 0x10051050
inline ~MxActionNotificationParam() override
{
if (!this->m_realloc) {
if (!m_realloc) {
return;
}
if (this->m_action) {
delete this->m_action;
if (m_action) {
delete m_action;
}
}
// FUNCTION: LEGO1 0x100510c0
MxNotificationParam* Clone() const override
{
return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc);
return new MxActionNotificationParam(m_type, m_sender, m_action, m_realloc);
} // vtable+0x04
inline MxDSAction* GetAction() { return m_action; }
@ -93,12 +93,7 @@ class MxEndActionNotificationParam : public MxActionNotificationParam {
// FUNCTION: LEGO1 0x10051270
MxNotificationParam* Clone() const override
{
return new MxEndActionNotificationParam(
c_notificationEndAction,
this->m_sender,
this->m_action,
this->m_realloc
);
return new MxEndActionNotificationParam(c_notificationEndAction, m_sender, m_action, m_realloc);
} // vtable+0x04
};