Fix MxParam casts in Notify functions (#1188)

* First batch

* Second batch
This commit is contained in:
MS 2024-12-03 17:51:03 -05:00 committed by GitHub
parent 5693b1a266
commit 7ece9cf37b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 92 additions and 28 deletions

View file

@ -130,8 +130,9 @@ void Ambulance::CreateState()
MxLong Ambulance::Notify(MxParam& p_param) MxLong Ambulance::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
result = HandleNotification0(); result = HandleNotification0();
break; break;

View file

@ -19,9 +19,12 @@ BuildingEntity::~BuildingEntity()
} }
// FUNCTION: LEGO1 0x100150a0 // FUNCTION: LEGO1 0x100150a0
// FUNCTION: BETA10 0x10024e37
MxLong BuildingEntity::Notify(MxParam& p_param) MxLong BuildingEntity::Notify(MxParam& p_param)
{ {
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
return HandleClick((LegoEventNotificationParam&) p_param); return HandleClick((LegoEventNotificationParam&) p_param);
} }

View file

@ -33,10 +33,12 @@ BumpBouy::~BumpBouy()
MxLong BumpBouy::Notify(MxParam& p_param) MxLong BumpBouy::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
IslePathActor* user = (IslePathActor*) UserActor(); IslePathActor* user = (IslePathActor*) UserActor();
assert(user); assert(user);
if (user->IsA("Jetski") && ((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { if (user->IsA("Jetski") && param.GetNotification() == c_notificationClick) {
VideoManager()->SetRender3D(FALSE); VideoManager()->SetRender3D(FALSE);
user->SetWorldSpeed(0); user->SetWorldSpeed(0);
user->Exit(); user->Exit();

View file

@ -25,11 +25,13 @@ MxResult IsleActor::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x1002c7b0 // FUNCTION: LEGO1 0x1002c7b0
// FUNCTION: BETA10 0x1003622e
MxLong IsleActor::Notify(MxParam& p_param) MxLong IsleActor::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
result = VTable0x6c(); result = VTable0x6c();
break; break;

View file

@ -46,11 +46,13 @@ void IslePathActor::Destroy(MxBool p_fromDestructor)
} }
// FUNCTION: LEGO1 0x1001a2c0 // FUNCTION: LEGO1 0x1001a2c0
// FUNCTION: BETA10 0x100364ca
MxLong IslePathActor::Notify(MxParam& p_param) MxLong IslePathActor::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
result = HandleNotification0(); result = HandleNotification0();
break; break;

View file

@ -30,9 +30,12 @@ JukeBoxEntity::~JukeBoxEntity()
} }
// FUNCTION: LEGO1 0x10085e40 // FUNCTION: LEGO1 0x10085e40
// FUNCTION: BETA10 0x10038c37
MxLong JukeBoxEntity::Notify(MxParam& p_param) MxLong JukeBoxEntity::Notify(MxParam& p_param)
{ {
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
if (!FUN_1003ef60()) { if (!FUN_1003ef60()) {
return 1; return 1;
} }

View file

@ -81,12 +81,14 @@ Radio::~Radio()
} }
// FUNCTION: LEGO1 0x1002ca30 // FUNCTION: LEGO1 0x1002ca30
// FUNCTION: BETA10 0x100f19e8
MxLong Radio::Notify(MxParam& p_param) MxLong Radio::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
if (m_unk0x0c) { if (m_unk0x0c) {
switch (((MxNotificationParam&) p_param).GetNotification()) { MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;

View file

@ -113,11 +113,13 @@ void TowTrack::CreateState()
} }
// FUNCTION: LEGO1 0x1004cc80 // FUNCTION: LEGO1 0x1004cc80
// FUNCTION: BETA10 0x100f6de2
MxLong TowTrack::Notify(MxParam& p_param) MxLong TowTrack::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
result = HandleNotification0(); result = HandleNotification0();
break; break;

View file

@ -196,9 +196,12 @@ void MxBackgroundAudioManager::FadeInOrFadeOut()
} }
// FUNCTION: LEGO1 0x1007f170 // FUNCTION: LEGO1 0x1007f170
// FUNCTION: BETA10 0x100e8eb6
MxLong MxBackgroundAudioManager::Notify(MxParam& p_param) MxLong MxBackgroundAudioManager::Notify(MxParam& p_param)
{ {
switch (((MxNotificationParam&) p_param).GetNotification()) { MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (param.GetNotification()) {
case c_notificationStartAction: case c_notificationStartAction:
StartAction(p_param); StartAction(p_param);
return 1; return 1;

View file

@ -656,9 +656,10 @@ MxResult LegoCarBuild::Tickle()
MxLong LegoCarBuild::Notify(MxParam& p_param) MxLong LegoCarBuild::Notify(MxParam& p_param)
{ {
MxLong result = LegoWorld::Notify(p_param); MxLong result = LegoWorld::Notify(p_param);
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam*) &p_param)->GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
FUN_10024c20((LegoEventNotificationParam*) &p_param); FUN_10024c20((LegoEventNotificationParam*) &p_param);
result = 1; result = 1;

View file

@ -215,9 +215,9 @@ void LegoAnimMMPresenter::DoneTickle()
MxLong LegoAnimMMPresenter::Notify(MxParam& p_param) MxLong LegoAnimMMPresenter::Notify(MxParam& p_param)
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAction && if (param.GetNotification() == c_notificationEndAction && param.GetSender() == m_presenter) {
((MxNotificationParam&) p_param).GetSender() == m_presenter) {
m_presenter = NULL; m_presenter = NULL;
} }

View file

@ -12,6 +12,7 @@
#include "mxtimer.h" #include "mxtimer.h"
#include "roi/legoroi.h" #include "roi/legoroi.h"
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <vec.h> #include <vec.h>
@ -148,7 +149,9 @@ MxResult Act2Brick::Tickle()
// FUNCTION: BETA10 0x10012ec4 // FUNCTION: BETA10 0x10012ec4
MxLong Act2Brick::Notify(MxParam& p_param) MxLong Act2Brick::Notify(MxParam& p_param)
{ {
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick && m_roi->GetVisibility()) { MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick && m_roi->GetVisibility()) {
m_roi->SetVisibility(FALSE); m_roi->SetVisibility(FALSE);
if (m_whistleSound != NULL) { if (m_whistleSound != NULL) {
@ -160,6 +163,7 @@ MxLong Act2Brick::Notify(MxParam& p_param)
return 1; return 1;
} }
assert(0);
return 0; return 0;
} }

View file

@ -9,9 +9,12 @@
DECOMP_SIZE_ASSERT(Act2PoliceStation, 0x68) DECOMP_SIZE_ASSERT(Act2PoliceStation, 0x68)
// FUNCTION: LEGO1 0x1004e0e0 // FUNCTION: LEGO1 0x1004e0e0
// FUNCTION: BETA10 0x100137c0
MxLong Act2PoliceStation::Notify(MxParam& p_param) MxLong Act2PoliceStation::Notify(MxParam& p_param)
{ {
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
MxNotificationParam param(c_notificationType23, NULL); MxNotificationParam param(c_notificationType23, NULL);
NotificationManager()->Send(CurrentWorld(), param); NotificationManager()->Send(CurrentWorld(), param);
return 1; return 1;

View file

@ -38,6 +38,7 @@ MxResult LegoCameraController::Create()
} }
// FUNCTION: LEGO1 0x10012020 // FUNCTION: LEGO1 0x10012020
// FUNCTION: BETA10 0x10067852
MxLong LegoCameraController::Notify(MxParam& p_param) MxLong LegoCameraController::Notify(MxParam& p_param)
{ {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (((MxNotificationParam&) p_param).GetNotification()) {

View file

@ -89,10 +89,11 @@ LegoRace::~LegoRace()
MxLong LegoRace::Notify(MxParam& p_param) MxLong LegoRace::Notify(MxParam& p_param)
{ {
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0; MxLong result = 0;
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
HandleType0Notification((MxNotificationParam&) p_param); HandleType0Notification((MxNotificationParam&) p_param);
break; break;

View file

@ -124,7 +124,9 @@ MxLong LegoRaceMap::Notify(MxParam& p_param)
return 1; return 1;
} }
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationControl && MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationControl &&
m_Map_Ctl->GetAction()->GetObjectId() == m_Map_Ctl->GetAction()->GetObjectId() ==
((LegoControlManagerNotificationParam&) p_param).GetClickedObjectId()) { ((LegoControlManagerNotificationParam&) p_param).GetClickedObjectId()) {

View file

@ -52,13 +52,15 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10018150 // FUNCTION: LEGO1 0x10018150
// FUNCTION: BETA10 0x10027d60
MxLong ElevatorBottom::Notify(MxParam& p_param) MxLong ElevatorBottom::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong ret = 0; MxLong ret = 0;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationControl: case c_notificationControl:
ret = HandleControl((LegoControlManagerNotificationParam&) p_param); ret = HandleControl((LegoControlManagerNotificationParam&) p_param);
break; break;

View file

@ -100,13 +100,15 @@ MxResult GasStation::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10004a60 // FUNCTION: LEGO1 0x10004a60
// FUNCTION: BETA10 0x10028883
MxLong GasStation::Notify(MxParam& p_param) MxLong GasStation::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxResult result = 0; MxResult result = 0;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;

View file

@ -68,12 +68,14 @@ MxResult HistoryBook::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10082680 // FUNCTION: LEGO1 0x10082680
// FUNCTION: BETA10 0x1002b907
MxLong HistoryBook::Notify(MxParam& p_param) MxLong HistoryBook::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationButtonUp: case c_notificationButtonUp:
m_destLocation = LegoGameState::Area::e_infoscor; m_destLocation = LegoGameState::Area::e_infoscor;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);

View file

@ -106,13 +106,15 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10074990 // FUNCTION: LEGO1 0x10074990
// FUNCTION: BETA10 0x1002ca3b
MxLong Hospital::Notify(MxParam& p_param) MxLong Hospital::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;

View file

@ -225,13 +225,15 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x1006ef10 // FUNCTION: LEGO1 0x1006ef10
// FUNCTION: BETA10 0x1002eaca
MxLong Infocenter::Notify(MxParam& p_param) MxLong Infocenter::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0; MxLong result = 0;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationType0: case c_notificationType0:
result = HandleNotification0((MxNotificationParam&) p_param); result = HandleNotification0((MxNotificationParam&) p_param);
break; break;

View file

@ -55,13 +55,15 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x100379e0 // FUNCTION: LEGO1 0x100379e0
// FUNCTION: BETA10 0x10032227
MxLong InfocenterDoor::Notify(MxParam& p_param) MxLong InfocenterDoor::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0; MxLong result = 0;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atomId) { if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atomId) {
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();

View file

@ -129,13 +129,15 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10030c10 // FUNCTION: LEGO1 0x10030c10
// FUNCTION: BETA10 0x10032b63
MxLong Isle::Notify(MxParam& p_param) MxLong Isle::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;
@ -468,6 +470,7 @@ void Isle::UpdateGlobe()
} }
// FUNCTION: LEGO1 0x100315f0 // FUNCTION: LEGO1 0x100315f0
// FUNCTION: BETA10 0x10033e46
MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;

View file

@ -68,13 +68,15 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x1005d980 // FUNCTION: LEGO1 0x1005d980
// FUNCTION: BETA10 0x10037daf
MxLong JukeBox::Notify(MxParam& p_param) MxLong JukeBox::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationControl: case c_notificationControl:
result = HandleControl((LegoControlManagerNotificationParam&) p_param); result = HandleControl((LegoControlManagerNotificationParam&) p_param);
break; break;

View file

@ -69,13 +69,15 @@ MxResult Police::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x1005e480 // FUNCTION: LEGO1 0x1005e480
// FUNCTION: BETA10 0x100f04a3
MxLong Police::Notify(MxParam& p_param) MxLong Police::Notify(MxParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;

View file

@ -108,13 +108,15 @@ MxResult RegistrationBook::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x100770e0 // FUNCTION: LEGO1 0x100770e0
// FUNCTION: BETA10 0x100f2d98
MxLong RegistrationBook::Notify(MxParam& p_param) MxLong RegistrationBook::Notify(MxParam& p_param)
{ {
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0; MxLong result = 0;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;

View file

@ -84,13 +84,16 @@ void Score::DeleteScript()
} }
// FUNCTION: LEGO1 0x10001410 // FUNCTION: LEGO1 0x10001410
// FUNCTION: BETA10 0x100f4398
MxLong Score::Notify(MxParam& p_param) MxLong Score::Notify(MxParam& p_param)
{ {
MxLong ret = 0; MxLong ret = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param); LegoWorld::Notify(p_param);
if (m_worldStarted) { if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationStartAction: case c_notificationStartAction:
Paint(); Paint();
ret = 1; ret = 1;

View file

@ -8,6 +8,8 @@
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxobjectfactory.h" #include "mxobjectfactory.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c); DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c);
// FUNCTION: LEGO1 0x100b60b0 // FUNCTION: LEGO1 0x100b60b0
@ -107,16 +109,22 @@ void MxCompositePresenter::EndAction()
} }
// FUNCTION: LEGO1 0x100b6760 // FUNCTION: LEGO1 0x100b6760
// FUNCTION: BETA10 0x1013771e
MxLong MxCompositePresenter::Notify(MxParam& p_param) MxLong MxCompositePresenter::Notify(MxParam& p_param)
{ {
AUTOLOCK(m_criticalSection); AUTOLOCK(m_criticalSection);
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (param.GetNotification()) {
case c_notificationEndAction: case c_notificationEndAction:
VTable0x58((MxEndActionNotificationParam&) p_param); VTable0x58((MxEndActionNotificationParam&) p_param);
break; break;
case c_notificationPresenter: case c_notificationPresenter:
VTable0x5c((MxNotificationParam&) p_param); VTable0x5c((MxNotificationParam&) p_param);
break;
default:
assert(0);
break;
} }
return 0; return 0;