From fb6eed9bff6ee9c49c7c689acf8ba10c6c9512a6 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 1 Mar 2024 13:07:07 -0500 Subject: [PATCH] Match StartAction functions, remove NextFragment (#610) --- .../src/common/mxcompositemediapresenter.cpp | 27 ++++++++++--------- .../src/control/legocontrolmanager.cpp | 6 +---- .../src/entity/legoworldpresenter.cpp | 23 +++++++++------- LEGO1/omni/include/mxdsaction.h | 10 ------- LEGO1/omni/include/mxlist.h | 8 ------ .../omni/src/common/mxcompositepresenter.cpp | 23 +++++++++------- 6 files changed, 42 insertions(+), 55 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp index fe1543a2..355cf12f 100644 --- a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp @@ -36,21 +36,24 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller MxDSAction* action; if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) { - // The usual cursor.Next() loop doesn't match here, even though - // the logic is the same. It does match when "deconstructed" into - // the following Head(), Current() and NextFragment() calls, - // but this seems unlikely to be the original code. - // The alpha debug build also uses Next(). - // cursor.Head(); - // while (cursor.Current(action)) { - // cursor.NextFragment(); - while (cursor.Next(action)) { + cursor.Head(); + + while (cursor.Current(action)) { MxBool success = FALSE; + const char* presenterName; + MxPresenter* presenter = NULL; - action->CopyFlags(m_action->GetFlags()); + cursor.Next(); - const char* presenterName = PresenterNameDispatch(*action); - MxPresenter* presenter = (MxPresenter*) ObjectFactory()->Create(presenterName); + if (m_action->GetFlags() & MxDSAction::c_looping) { + action->SetFlags(action->GetFlags() | MxDSAction::c_looping); + } + else if (m_action->GetFlags() & MxDSAction::c_bit3) { + action->SetFlags(action->GetFlags() | MxDSAction::c_bit3); + } + + presenterName = PresenterNameDispatch(*action); + presenter = (MxPresenter*) ObjectFactory()->Create(presenterName); if (presenter && presenter->AddToManager() == SUCCESS) { presenter->SetCompositePresenter(this); diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 01d5bb3a..8ff38b9c 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -107,13 +107,9 @@ void LegoControlManager::FUN_100292e0() LegoNotifyListCursor cursor(&m_notifyList); MxCore* target; - // The usual cursor.Next() loop doesn't match here, even though - // the logic is the same. It does match when "deconstructed" into - // the following Head(), Current() and NextFragment() calls, - // but this seems unlikely to be the original code. cursor.Head(); while (cursor.Current(target)) { - cursor.NextFragment(); + cursor.Next(); target->Notify(m_event); } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 6b6ed8ae..be761f30 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -74,21 +74,24 @@ MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSA MxDSAction* action; if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) { - // The usual cursor.Next() loop doesn't match here, even though - // the logic is the same. It does match when "deconstructed" into - // the following Head(), Current() and NextFragment() calls, - // but this seems unlikely to be the original code. - // The alpha debug build also uses Next(). cursor.Head(); + while (cursor.Current(action)) { - cursor.NextFragment(); - MxBool success = FALSE; + const char* presenterName; + MxPresenter* presenter = NULL; - action->CopyFlags(m_action->GetFlags()); + cursor.Next(); - const char* presenterName = PresenterNameDispatch(*action); - MxPresenter* presenter = (MxPresenter*) factory->Create(presenterName); + if (m_action->GetFlags() & MxDSAction::c_looping) { + action->SetFlags(action->GetFlags() | MxDSAction::c_looping); + } + else if (m_action->GetFlags() & MxDSAction::c_bit3) { + action->SetFlags(action->GetFlags() | MxDSAction::c_bit3); + } + + presenterName = PresenterNameDispatch(*action); + presenter = (MxPresenter*) factory->Create(presenterName); if (presenter && presenter->AddToManager() == SUCCESS) { presenter->SetCompositePresenter(this); diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index 7bfe16c0..f1294371 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -81,16 +81,6 @@ class MxDSAction : public MxDSObject { inline MxBool IsLooping() const { return m_flags & c_looping; } inline MxBool IsBit3() const { return m_flags & c_bit3; } - inline void CopyFlags(MxU32 p_flags) - { - if (p_flags & MxDSAction::c_looping) { - SetFlags(GetFlags() | MxDSAction::c_looping); - } - else if (p_flags & MxDSAction::c_bit3) { - SetFlags(GetFlags() | MxDSAction::c_bit3); - } - } - // SYNTHETIC: LEGO1 0x100ada60 // MxDSAction::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxlist.h b/LEGO1/omni/include/mxlist.h index aeed9646..80b0b4d5 100644 --- a/LEGO1/omni/include/mxlist.h +++ b/LEGO1/omni/include/mxlist.h @@ -118,14 +118,6 @@ class MxListCursor : public MxCore { void Reset() { m_match = NULL; } void Prepend(T p_newobj); - // TODO: Probably shouldn't exist - void NextFragment() - { - if (m_match) { - m_match = m_match->GetNext(); - } - } - private: MxList* m_list; // 0x08 MxListEntry* m_match; // 0x0c diff --git a/LEGO1/omni/src/common/mxcompositepresenter.cpp b/LEGO1/omni/src/common/mxcompositepresenter.cpp index 5996f634..7e3c75f1 100644 --- a/LEGO1/omni/src/common/mxcompositepresenter.cpp +++ b/LEGO1/omni/src/common/mxcompositepresenter.cpp @@ -32,21 +32,24 @@ MxResult MxCompositePresenter::StartAction(MxStreamController* p_controller, MxD MxDSAction* action; if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) { - // The usual cursor.Next() loop doesn't match here, even though - // the logic is the same. It does match when "deconstructed" into - // the following Head(), Current() and NextFragment() calls, - // but this seems unlikely to be the original code. - // The alpha debug build also uses Next(). cursor.Head(); + while (cursor.Current(action)) { - cursor.NextFragment(); - MxBool success = FALSE; + const char* presenterName; + MxPresenter* presenter = NULL; - action->CopyFlags(m_action->GetFlags()); + cursor.Next(); - const char* presenterName = PresenterNameDispatch(*action); - MxPresenter* presenter = (MxPresenter*) factory->Create(presenterName); + if (m_action->GetFlags() & MxDSAction::c_looping) { + action->SetFlags(action->GetFlags() | MxDSAction::c_looping); + } + else if (m_action->GetFlags() & MxDSAction::c_bit3) { + action->SetFlags(action->GetFlags() | MxDSAction::c_bit3); + } + + presenterName = PresenterNameDispatch(*action); + presenter = (MxPresenter*) factory->Create(presenterName); if (presenter && presenter->AddToManager() == SUCCESS) { presenter->SetCompositePresenter(this);