Implement/match GasStation::HandleButtonDown (#1052)

* Implement/match GasStation::HandleButtonDown

* Use enum
This commit is contained in:
Christian Semmler 2024-07-01 16:43:03 -07:00 committed by GitHub
parent 9ba05d021d
commit 7bee5fc6a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 49 additions and 7 deletions

View file

@ -38,7 +38,8 @@ class GasStationState : public LegoState {
// SYNTHETIC: LEGO1 0x10006290
// GasStationState::`scalar deleting destructor'
void FUN_10006430(undefined4);
void FUN_10006430(GarageScript::Script);
void FUN_10006460(GarageScript::Script);
void FUN_10006490();
// TODO: Most likely getters/setters are not used according to BETA.
@ -82,12 +83,13 @@ class GasStation : public LegoWorld {
void Enable(MxBool p_enable) override; // vtable+0x68
virtual MxLong HandleControl(LegoControlManagerNotificationParam& p_param); // vtable+0x6c
inline void PlayAction(MxU32 p_objectId);
// SYNTHETIC: LEGO1 0x100048a0
// GasStation::`scalar deleting destructor'
private:
inline void PlayAction(GarageScript::Script p_objectId);
inline void StopAction(GarageScript::Script p_objectId);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(MxS8 p_key);
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);

View file

@ -8,6 +8,7 @@
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legomain.h"
#include "legoutils.h"
#include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
@ -276,7 +277,8 @@ void GasStation::ReadyWorld()
}
// FUNCTION: LEGO1 0x10005590
inline void GasStation::PlayAction(MxU32 p_objectId)
// FUNCTION: BETA10 0x10029e30
inline void GasStation::PlayAction(GarageScript::Script p_objectId)
{
MxDSAction action;
action.SetAtomId(*g_garageScript);
@ -287,6 +289,16 @@ inline void GasStation::PlayAction(MxU32 p_objectId)
m_state->FUN_10006430(p_objectId);
}
// FUNCTION: BETA10 0x10029f00
inline void GasStation::StopAction(GarageScript::Script p_objectId)
{
if (p_objectId != GarageScript::c_noneGarage) {
InvokeAction(Extra::e_stop, *g_garageScript, p_objectId, NULL);
BackgroundAudioManager()->RaiseVolume();
m_state->FUN_10006460(p_objectId);
}
}
// STUB: LEGO1 0x10005660
MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
{
@ -305,10 +317,32 @@ MxLong GasStation::HandleKeyPress(MxS8 p_key)
return 0;
}
// STUB: LEGO1 0x10005960
// FUNCTION: LEGO1 0x10005960
// FUNCTION: BETA10 0x10029319
MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
{
// TODO
if (m_unk0x104 == 1 || m_unk0x104 == 2) {
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
if (roi != NULL) {
if (!strnicmp(roi->GetName(), "capdb", 5) || !strnicmp(roi->GetName(), "*capdb", 6)) {
m_unk0x104 = 3;
m_unk0x114 = FALSE;
if (m_state->m_unk0x14.m_unk0x00 == 7) {
m_state->m_unk0x14.m_unk0x00 = 8;
PlayAction(GarageScript::c_wgs029nu_RunAnim);
m_unk0x106 = 1;
}
else {
StopAction(GarageScript::c_wgs023nu_RunAnim);
}
return 1;
}
}
}
return 0;
}
@ -459,7 +493,13 @@ MxResult GasStationState::Serialize(LegoFile* p_file)
}
// STUB: LEGO1 0x10006430
void GasStationState::FUN_10006430(undefined4)
void GasStationState::FUN_10006430(GarageScript::Script)
{
// TODO
}
// STUB: LEGO1 0x10006460
void GasStationState::FUN_10006460(GarageScript::Script)
{
// TODO
}