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

View file

@ -5,7 +5,9 @@
#include "legogamestate.h" #include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legoomni.h" #include "legoomni.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
#include "policestate.h" #include "policestate.h"
DECOMP_SIZE_ASSERT(Police, 0x110) DECOMP_SIZE_ASSERT(Police, 0x110)
@ -74,8 +76,8 @@ MxLong Police::Notify(MxParam& p_param)
case c_notificationKeyPress: case c_notificationKeyPress:
result = HandleKeyPress(((LegoEventNotificationParam&) p_param)); result = HandleKeyPress(((LegoEventNotificationParam&) p_param));
break; break;
case c_notificationType11: case c_notificationClick:
result = HandleNotification11((MxNotificationParam&) p_param); result = HandleClick((LegoControlManagerEvent&) p_param);
break; break;
case c_notificationTransitioned: case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination); GameState()->SwitchArea(m_transitionDestination);
@ -94,11 +96,45 @@ void Police::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
} }
// STUB: LEGO1 0x1005e550 // FUNCTION: LEGO1 0x1005e550
MxLong Police::HandleNotification11(MxNotificationParam& p_param) MxLong Police::HandleClick(LegoControlManagerEvent& p_param)
{ {
// TODO if (p_param.GetUnknown0x28() == 1) {
return 0; 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 // FUNCTION: LEGO1 0x1005e6a0