Limit scope for variables in compat mode

This commit is contained in:
Anonymous Maarten 2024-01-07 18:14:12 +01:00
parent 3552eb3dd6
commit 8a09a7a0b3
10 changed files with 58 additions and 28 deletions

View File

@ -133,8 +133,11 @@ BOOL IsleApp::SetupLegoOmni()
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxOmniCreateParam param(mediaPath, (struct HWND__*) m_windowHandle, m_videoParam, MxOmniCreateFlags()); BOOL failure;
BOOL failure = Lego()->Create(param) == FAILURE; {
MxOmniCreateParam param(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags());
failure = Lego()->Create(param) == FAILURE;
}
#else #else
BOOL failure = BOOL failure =
Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__*) m_windowHandle, m_videoParam, MxOmniCreateFlags()) Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__*) m_windowHandle, m_videoParam, MxOmniCreateFlags())

View File

@ -35,8 +35,11 @@ void MxAtomId::Destroy()
return; return;
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxAtomIdCounter id_counter(m_internal); MxAtomIdCounterSet::iterator it;
MxAtomIdCounterSet::iterator it = AtomIdCounterSet()->find(&id_counter); {
MxAtomIdCounter id_counter(m_internal);
it = AtomIdCounterSet()->find(&id_counter);
}
#else #else
MxAtomIdCounterSet::iterator it = AtomIdCounterSet()->find(&MxAtomIdCounter(m_internal)); MxAtomIdCounterSet::iterator it = AtomIdCounterSet()->find(&MxAtomIdCounter(m_internal));
#endif #endif

View File

@ -98,8 +98,10 @@ void MxCompositePresenter::EndAction()
if (action && action->GetOrigin()) { if (action && action->GetOrigin()) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE); {
NotificationManager()->Send(action->GetOrigin(), &param); MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE);
NotificationManager()->Send(action->GetOrigin(), &param);
}
#else #else
NotificationManager()->Send( NotificationManager()->Send(
action->GetOrigin(), action->GetOrigin(),

View File

@ -25,8 +25,10 @@ MxDiskStreamController::~MxDiskStreamController()
if (m_provider) { if (m_provider) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxDSAction action; {
m_provider->VTable0x20(&action); MxDSAction action;
m_provider->VTable0x20(&action);
}
#else #else
m_provider->VTable0x20(&MxDSAction()); m_provider->VTable0x20(&MxDSAction());
#endif #endif
@ -306,8 +308,10 @@ MxResult MxDiskStreamController::VTable0x24(MxDSAction* p_action)
if (m_unk0x54.Find(p_action, FALSE) == NULL) { if (m_unk0x54.Find(p_action, FALSE) == NULL) {
if (VTable0x30(p_action) == SUCCESS) { if (VTable0x30(p_action) == SUCCESS) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxEndActionNotificationParam param(c_notificationEndAction, NULL, p_action, TRUE); {
MxOmni::GetInstance()->NotifyCurrentEntity(&param); MxEndActionNotificationParam param(c_notificationEndAction, NULL, p_action, TRUE);
MxOmni::GetInstance()->NotifyCurrentEntity(&param);
}
#else #else
MxOmni::GetInstance()->NotifyCurrentEntity( MxOmni::GetInstance()->NotifyCurrentEntity(
&MxEndActionNotificationParam(c_notificationEndAction, NULL, p_action, TRUE) &MxEndActionNotificationParam(c_notificationEndAction, NULL, p_action, TRUE)

View File

@ -161,8 +161,10 @@ void MxMediaPresenter::EndAction()
if (action && action->GetOrigin()) { if (action && action->GetOrigin()) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE); {
NotificationManager()->Send(action->GetOrigin(), &param); MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE);
NotificationManager()->Send(action->GetOrigin(), &param);
}
#else #else
NotificationManager()->Send( NotificationManager()->Send(
action->GetOrigin(), action->GetOrigin(),

View File

@ -346,8 +346,10 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p
if (object->StartAction(p_controller, &p_action) == SUCCESS) { if (object->StartAction(p_controller, &p_action) == SUCCESS) {
if (sender) { if (sender) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxType4NotificationParam param(this, &p_action, object); {
NotificationManager()->Send(sender, &param); MxType4NotificationParam param(this, &p_action, object);
NotificationManager()->Send(sender, &param);
}
#else #else
NotificationManager()->Send(sender, &MxType4NotificationParam(this, &p_action, object)); NotificationManager()->Send(sender, &MxType4NotificationParam(this, &p_action, object));
#endif #endif
@ -355,8 +357,10 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p
if (p_action.GetUnknown84()) { if (p_action.GetUnknown84()) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxStartActionNotificationParam param(c_notificationStartAction, object, &p_action, FALSE); {
NotificationManager()->Send(p_action.GetUnknown84(), &param); MxStartActionNotificationParam param(c_notificationStartAction, object, &p_action, FALSE);
NotificationManager()->Send(p_action.GetUnknown84(), &param);
}
#else #else
NotificationManager()->Send( NotificationManager()->Send(
p_action.GetUnknown84(), p_action.GetUnknown84(),

View File

@ -148,8 +148,10 @@ void MxPresenter::EndAction()
if (!this->m_compositePresenter) { if (!this->m_compositePresenter) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxEndActionNotificationParam param(c_notificationEndAction, NULL, this->m_action, TRUE); {
MxOmni::GetInstance()->NotifyCurrentEntity(&param); MxEndActionNotificationParam param(c_notificationEndAction, NULL, this->m_action, TRUE);
MxOmni::GetInstance()->NotifyCurrentEntity(&param);
}
#else #else
MxOmni::GetInstance()->NotifyCurrentEntity( MxOmni::GetInstance()->NotifyCurrentEntity(
&MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE) &MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE)
@ -201,8 +203,10 @@ void MxPresenter::SendToCompositePresenter(MxOmni* p_omni)
MxAutoLocker lock(&m_criticalSection); MxAutoLocker lock(&m_criticalSection);
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxNotificationParam param(MXPRESENTER_NOTIFICATION, this); {
NotificationManager()->Send(m_compositePresenter, &param); MxNotificationParam param(MXPRESENTER_NOTIFICATION, this);
NotificationManager()->Send(m_compositePresenter, &param);
}
#else #else
NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this)); NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this));
#endif #endif

View File

@ -56,8 +56,10 @@ MxStreamController::~MxStreamController()
MxStreamProvider* provider = m_provider; MxStreamProvider* provider = m_provider;
m_provider = NULL; m_provider = NULL;
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxDSAction action; {
provider->VTable0x20(&action); MxDSAction action;
provider->VTable0x20(&action);
}
#else #else
provider->VTable0x20(&MxDSAction()); provider->VTable0x20(&MxDSAction());
#endif #endif

View File

@ -83,8 +83,10 @@ MxLong MxStreamer::Close(const char* p_name)
delete c; delete c;
else { else {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c); {
NotificationManager()->Send(this, &notification); MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c);
NotificationManager()->Send(this, &notification);
}
#else #else
NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c)); NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c));
#endif #endif
@ -193,8 +195,10 @@ MxLong MxStreamer::Notify(MxParam& p_param)
delete c; delete c;
else { else {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c); {
NotificationManager()->Send(this, &notification); MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c);
NotificationManager()->Send(this, &notification);
}
#else #else
NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c)); NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c));
#endif #endif

View File

@ -141,8 +141,10 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
if (world) { if (world) {
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxNotificationParam param(MXTRANSITIONMANAGER_TRANSITIONENDED, this); {
world->Notify(param); MxNotificationParam param(MXTRANSITIONMANAGER_TRANSITIONENDED, this);
world->Notify(param);
}
#else #else
world->Notify(MxNotificationParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this)); world->Notify(MxNotificationParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this));
#endif #endif