Police: HandleClick (#565)

* Police: HandleClick

* Spacing

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2024-02-16 09:53:17 -05:00 committed by GitHub
parent 91643d59ba
commit efcb3cac2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 7 deletions

View file

@ -2,6 +2,7 @@
#define POLICE_H
#include "decomp.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoworld.h"
#include "mxdsaction.h"
@ -15,6 +16,12 @@ class PoliceState;
class Police : public LegoWorld {
public:
enum PoliceScript {
c_leftArrowCtl = 1,
c_rightArrowCtl = 2,
c_infoCtl = 3,
c_doorCtl = 4,
c_donutCtl = 5,
c_nickAnim = 500,
c_lauraAnim = 501,
};
@ -47,7 +54,7 @@ class Police : public LegoWorld {
// Police::`scalar deleting destructor'
private:
MxLong HandleNotification11(MxNotificationParam& p_param);
MxLong HandleClick(LegoControlManagerEvent& p_param);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(LegoEventNotificationParam& p_param);

View file

@ -5,7 +5,9 @@
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
#include "policestate.h"
DECOMP_SIZE_ASSERT(Police, 0x110)
@ -74,8 +76,8 @@ MxLong Police::Notify(MxParam& p_param)
case c_notificationKeyPress:
result = HandleKeyPress(((LegoEventNotificationParam&) p_param));
break;
case c_notificationType11:
result = HandleNotification11((MxNotificationParam&) p_param);
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination);
@ -94,11 +96,45 @@ void Police::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// STUB: LEGO1 0x1005e550
MxLong Police::HandleNotification11(MxNotificationParam& p_param)
// FUNCTION: LEGO1 0x1005e550
MxLong Police::HandleClick(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case c_leftArrowCtl:
case c_rightArrowCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_unk35;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_infoCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_doorCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_copter;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_donutCtl:
m_policeState->FUN_1005ea40();
}
}
return 1;
}
// FUNCTION: LEGO1 0x1005e6a0