From 03adac0c58a85649f531296becdc474bcb0739d3 Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:13:34 +0200 Subject: [PATCH 1/7] Match `LegoOmni::Create()`, other BETA10 matches (#1651) * Match `LegoOmni::Create()`, other BETA10 matches --------- Co-authored-by: jonschz --- .../legoomni/include/legobuildingmanager.h | 3 +- LEGO1/lego/legoomni/include/legomain.h | 7 + .../lego/legoomni/include/legoplantmanager.h | 2 +- .../lego/legoomni/include/legovideomanager.h | 9 +- LEGO1/lego/legoomni/include/legoworldlist.h | 3 + .../src/audio/mxbackgroundaudiomanager.cpp | 1 + .../src/common/legobuildingmanager.cpp | 5 + .../legoomni/src/common/legoplantmanager.cpp | 7 +- LEGO1/lego/legoomni/src/common/misc.cpp | 2 + .../src/common/mxtransitionmanager.cpp | 1 + .../src/control/legocontrolmanager.cpp | 1 + .../legoomni/src/input/legoinputmanager.cpp | 3 + LEGO1/lego/legoomni/src/main/legomain.cpp | 143 ++++++++++++++---- LEGO1/lego/legoomni/src/main/scripts.cpp | 1 + .../src/video/legoflctexturepresenter.cpp | 7 +- .../legoomni/src/video/legovideomanager.cpp | 7 + LEGO1/lego/sources/misc/legocontainer.h | 4 + LEGO1/library_msvc.h | 3 + LEGO1/omni/include/mxomni.h | 2 + LEGO1/omni/include/mxomnicreateparam.h | 5 + LEGO1/omni/src/main/mxomni.cpp | 11 ++ .../omni/src/notify/mxnotificationmanager.cpp | 1 + LEGO1/omni/src/video/mxvideomanager.cpp | 1 + 23 files changed, 187 insertions(+), 42 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index c5a69309..934d14d1 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -58,7 +58,8 @@ class LegoBuildingManager : public MxCore { // FUNCTION: LEGO1 0x1002f930 const char* ClassName() const override // vtable+0x0c { - // not in BETA10 + // While this class exists in BETA10, it didn't have a ClassName(). + // The constructor suggests that it did not inherit from MxCore back then and did not have a VTABLE. // STRING: LEGO1 0x100f37d0 return "LegoBuildingManager"; } diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 9246a642..0fe040e3 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -109,6 +109,7 @@ class LegoOmni : public MxOmni { } // FUNCTION: LEGO1 0x10058ab0 + // FUNCTION: BETA10 0x1008f860 MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name); @@ -148,9 +149,14 @@ class LegoOmni : public MxOmni { // FUNCTION: BETA10 0x1009e7a0 LegoInputManager* GetInputManager() { return m_inputManager; } + // FUNCTION: BETA10 0x100e5400 LegoTextureContainer* GetTextureContainer() { return m_textureContainer; } + ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; } + + // FUNCTION: BETA10 0x100969b0 LegoWorld* GetCurrentWorld() { return m_currentWorld; } + LegoNavController* GetNavController() { return m_navController; } LegoPathActor* GetUserActor() { return m_userActor; } @@ -186,6 +192,7 @@ class LegoOmni : public MxOmni { void CloseMainWindow() { PostMessage(m_windowHandle, WM_CLOSE, 0, 0); } // SYNTHETIC: LEGO1 0x10058b30 + // SYNTHETIC: BETA10 0x1008f8d0 // LegoOmni::`scalar deleting destructor' private: diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index c3b2c4e1..187e12b5 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -32,7 +32,7 @@ class LegoPlantManager : public MxCore { const char* ClassName() const override // vtable+0x0c { // While this class exists in BETA10, it didn't have a ClassName(). - // I suppose it did not inherit from MxCore back then and likely did not have a VTABLE. + // The constructor suggests that it did not inherit from MxCore back then and did not have a VTABLE. // STRING: LEGO1 0x100f318c return "LegoPlantManager"; } diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index 52a760fe..0a451ca8 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -20,6 +20,7 @@ class Renderer; } // VTABLE: LEGO1 0x100d9c88 +// VTABLE: BETA10 0x101bef08 // SIZE 0x590 class LegoVideoManager : public MxVideoManager { public: @@ -41,6 +42,7 @@ class LegoVideoManager : public MxVideoManager { virtual MxPresenter* GetPresenterAt(MxS32 p_x, MxS32 p_y); // vtable+0x38 // FUNCTION: LEGO1 0x1007ab10 + // FUNCTION: BETA10 0x100d8010 virtual LegoPhonemeList* GetPhonemeList() { return m_phonemeRefList; } // vtable+0x3c void SetSkyColor(float p_red, float p_green, float p_blue); @@ -67,6 +69,10 @@ class LegoVideoManager : public MxVideoManager { void SetUnk0x554(MxBool p_unk0x554) { m_unk0x554 = p_unk0x554; } + // SYNTHETIC: LEGO1 0x1007ab20 + // SYNTHETIC: BETA10 0x100d8040 + // LegoVideoManager::`scalar deleting destructor' + private: MxResult CreateDirect3D(); MxResult ConfigureD3DRM(); @@ -122,7 +128,4 @@ class LegoVideoManager : public MxVideoManager { DWORD m_bufferCount; // 0x58c }; -// SYNTHETIC: LEGO1 0x1007ab20 -// LegoVideoManager::`scalar deleting destructor' - #endif // LEGOVIDEOMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoworldlist.h b/LEGO1/lego/legoomni/include/legoworldlist.h index 6d1006b0..6f92540c 100644 --- a/LEGO1/lego/legoomni/include/legoworldlist.h +++ b/LEGO1/lego/legoomni/include/legoworldlist.h @@ -16,12 +16,15 @@ class LegoWorld; // class MxPtrList // VTABLE: LEGO1 0x100d8680 +// VTABLE: BETA10 0x101bc900 // SIZE 0x18 class LegoWorldList : public MxPtrList { public: + // FUNCTION: BETA10 0x10092ce0 LegoWorldList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x100598d0 + // FUNCTION: BETA10 0x10092d80 MxS8 Compare(LegoWorld* p_a, LegoWorld* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 // SYNTHETIC: LEGO1 0x10059a00 diff --git a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp index 8b90d39b..567dd882 100644 --- a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp @@ -15,6 +15,7 @@ DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150) // FUNCTION: LEGO1 0x1007ea90 +// FUNCTION: BETA10 0x100e8530 MxBackgroundAudioManager::MxBackgroundAudioManager() { NotificationManager()->Register(this); diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 4ea96d2b..a987919e 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -47,6 +47,7 @@ MxU8 g_buildingInfoDownshift[16] = { }; // GLOBAL: LEGO1 0x100f3478 +// GLOBAL: BETA10 0x101e4d78 LegoBuildingInfo g_buildingInfoInit[16] = { { NULL, "infocen", @@ -236,8 +237,11 @@ void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerCo } // FUNCTION: LEGO1 0x1002f8c0 +// FUNCTION: BETA10 0x10063a30 LegoBuildingManager::LegoBuildingManager() { + // Note that Init() is inlined in BETA10 and the class did not inherit from MxCore, + // so the BETA10 match is much better on Init(). Init(); } @@ -247,6 +251,7 @@ LegoBuildingManager::~LegoBuildingManager() delete[] g_customizeAnimFile; } +// // FUNCTION: BETA10 0x10063a30 -- see the constructor // FUNCTION: LEGO1 0x1002f9d0 void LegoBuildingManager::Init() { diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 4e8e2626..1a873331 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -60,8 +60,11 @@ char* LegoPlantManager::g_customizeAnimFile = NULL; LegoPlantInfo g_plantInfo[81]; // FUNCTION: LEGO1 0x10026220 +// FUNCTION: BETA10 0x100c4f90 LegoPlantManager::LegoPlantManager() { + // Note that Init() is inlined in BETA10 and the class did not inherit from MxCore, + // so the BETA10 match is much better on Init(). Init(); } @@ -72,12 +75,10 @@ LegoPlantManager::~LegoPlantManager() delete[] g_customizeAnimFile; } +// // FUNCTION: BETA10 0x100c4f90 -- see the constructor // FUNCTION: LEGO1 0x10026330 -// FUNCTION: BETA10 0x100c4f90 void LegoPlantManager::Init() { - // In BETA10 this appears to be LegoPlantManager::LegoPlantManager() - for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { g_plantInfo[i] = g_plantInfoInit[i]; } diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index 19ff0a21..ade3e874 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -127,8 +127,10 @@ LegoBuildingManager* BuildingManager() } // FUNCTION: LEGO1 0x10015800 +// FUNCTION: BETA10 0x100e4bb7 LegoTextureContainer* TextureContainer() { + assert(LegoOmni::GetInstance()); return LegoOmni::GetInstance()->GetTextureContainer(); } diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index 6b0a9fe0..6313cae2 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -18,6 +18,7 @@ DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900) RECT g_fullScreenRect = {0, 0, 640, 480}; // FUNCTION: LEGO1 0x1004b8d0 +// FUNCTION: BETA10 0x100ec2c0 MxTransitionManager::MxTransitionManager() { m_animationTimer = 0; diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 7851a52a..ffd2adc3 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -14,6 +14,7 @@ DECOMP_SIZE_ASSERT(LegoControlManagerNotificationParam, 0x2c) DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x20) // FUNCTION: LEGO1 0x10028520 +// STUB: BETA10 0x1008ae50 LegoControlManager::LegoControlManager() { m_presenterList = NULL; diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 756d51aa..fea50c94 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -26,6 +26,7 @@ const char* g_clickedAtom = NULL; MxBool g_unk0x100f67b8 = TRUE; // FUNCTION: LEGO1 0x1005b790 +// STUB: BETA10 0x10088a8e LegoInputManager::LegoInputManager() { m_keyboardNotifyList = NULL; @@ -59,11 +60,13 @@ LegoInputManager::~LegoInputManager() } // FUNCTION: LEGO1 0x1005b960 +// STUB: BETA10 0x10088c9c MxResult LegoInputManager::Create(HWND p_hwnd) { MxResult result = SUCCESS; m_controlManager = new LegoControlManager; + assert(m_controlManager); if (!m_keyboardNotifyList) { m_keyboardNotifyList = new LegoNotifyList; diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 932ae247..530d4f0f 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -38,6 +38,7 @@ DECOMP_SIZE_ASSERT(LegoWorldList, 0x18) DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10) // GLOBAL: LEGO1 0x100f6718 +// GLOBAL: BETA10 0x101ee748 // STRING: LEGO1 0x100f6710 const char* g_current = "current"; @@ -48,12 +49,14 @@ LegoOmni::LegoOmni() } // FUNCTION: LEGO1 0x10058b50 +// FUNCTION: BETA10 0x1008d128 LegoOmni::~LegoOmni() { Destroy(); } // FUNCTION: LEGO1 0x10058bd0 +// FUNCTION: BETA10 0x1008d1b4 void LegoOmni::Init() { MxOmni::Init(); @@ -76,6 +79,7 @@ void LegoOmni::Init() } // FUNCTION: LEGO1 0x10058c30 +// STUB: BETA10 0x1008d299 void LegoOmni::Destroy() { AUTOLOCK(m_criticalSection); @@ -151,6 +155,13 @@ void LegoOmni::Destroy() MxOmni::Destroy(); } +#ifdef BETA10 +// FUNCTION: BETA10 0x100d4e5e +void EmptyFunction(int p_unknown) +{ +} +#endif + // FUNCTION: LEGO1 0x10058e70 // FUNCTION: BETA10 0x1008d6bf MxResult LegoOmni::Create(MxOmniCreateParam& p_param) @@ -170,40 +181,67 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) if (MxOmni::Create(p_param) != SUCCESS) { goto done; } - + // LINE: BETA10 0x1008d7fa if (!(m_objectFactory = new LegoObjectFactory())) { goto done; } - + // LINE: BETA10 0x1008d882 if (!(m_soundManager = new LegoSoundManager()) || m_soundManager->Create(10, 0) != SUCCESS) { delete m_soundManager; m_soundManager = NULL; goto done; } - + // LINE: BETA10 0x1008d990 if (!(m_videoManager = new LegoVideoManager()) || m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) { delete m_videoManager; m_videoManager = NULL; goto done; } - + // LINE: BETA10 0x1008daa7 if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(p_param.GetWindowHandle()) != SUCCESS) { delete m_inputManager; m_inputManager = NULL; goto done; } - + // LINE: BETA10 0x1008dbdb m_viewLODListManager = new ViewLODListManager(); + + // LINE: BETA10 0x1008dc32 m_textureContainer = new LegoTextureContainer(); + +#ifndef BETA10 m_textureContainer->SetOwnership(FALSE); +#else + // One more class is instantiated here in BETA10 that we don't find in LEGO1. + + // Based on `LegoOmni::getTextureContainer()` we know that `LegoTextureContainer` is at LegoOmni's offset 0x230, + // so the first instantiation is `LegoTextureContainer` and the second one is the unknown one. + + // We repeat the initialisation of LegoTextureContainer for the sake of a structural match, + // even though it is wrong semantically. + // LINE: BETA10 0x1008dc89 + m_textureContainer = new LegoTextureContainer(); + + // Something else happens here starting at BETA10 0x1008dcdd that has not been decompiled. + // It involves external calls, bit manipulation, and two globals. + // Those appear to involve classes that are either not present in LEGO1 or we have the wrong names for them + // (like LegoMaterialCache). +#endif + + // LINE: BETA10 0x1008dd17 LegoPathController::Init(); m_characterManager = new LegoCharacterManager(); + m_plantManager = new LegoPlantManager(); + // LINE: BETA10 0x1008ddca m_animationManager = new LegoAnimationManager(); + m_buildingManager = new LegoBuildingManager(); + // LINE: BETA10 0x1008de7b m_gameState = new LegoGameState(); + // LINE: BETA10 0x1008ded5 m_worldList = new LegoWorldList(TRUE); if (!m_viewLODListManager || !m_textureContainer || !m_worldList || !m_characterManager || !m_plantManager || @@ -211,56 +249,83 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) goto done; } - MxVariable* variable; - - if (!(variable = new VisibilityVariable())) { + MxVariable *visibilityVar, *cameraLocationVar, *cursorVar, *whoAmIVar, *debugVar; + // LINE: BETA10 0x1008dfbd + visibilityVar = new VisibilityVariable(); + if (!visibilityVar) { goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(visibilityVar); - if (!(variable = new CameraLocationVariable())) { + // LINE: BETA10 0x1008e031 + cameraLocationVar = new CameraLocationVariable(); + if (!cameraLocationVar) { goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(cameraLocationVar); - if (!(variable = new CursorVariable())) { + // LINE: BETA10 0x1008e0a5 + cursorVar = new CursorVariable(); + if (!cursorVar) { goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(cursorVar); - if (!(variable = new WhoAmIVariable())) { + // LINE: BETA10 0x1008e119 + whoAmIVar = new WhoAmIVariable(); + if (!whoAmIVar) { goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(whoAmIVar); +#ifdef BETA10 + debugVar = new DebugVariable(); + if (!debugVar) { + goto done; + } + m_variableTable->SetVariable(debugVar); +#endif + + // LINE: BETA10 0x1008e201 CreateScripts(); + +#ifndef BETA10 IslePathActor::RegisterSpawnLocations(); result = RegisterWorlds(); if (result != SUCCESS) { goto done; } +#endif - if (!(m_bkgAudioManager = new MxBackgroundAudioManager())) { + // LINE: BETA10 0x1008e206 + m_bkgAudioManager = new MxBackgroundAudioManager(); + if (!m_bkgAudioManager) { goto done; } - if (!(m_transitionManager = new MxTransitionManager())) { - goto done; + // LINE: BETA10 0x1008e27d + m_transitionManager = new MxTransitionManager(); + + if (m_transitionManager) { + if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) { + goto done; + } + +#ifdef BETA10 + NotificationManager()->Register(this); + EmptyFunction(0); +#else + m_notificationManager->Register(this); + SetAppCursor(e_cursorBusy); + m_gameState->SetCurrentAct(LegoGameState::e_act1); +#endif + + result = SUCCESS; } - - if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) { - goto done; - } - - m_notificationManager->Register(this); - SetAppCursor(e_cursorBusy); - m_gameState->SetCurrentAct(LegoGameState::e_act1); - - result = SUCCESS; - done: return result; + // LINE: BETA10 0x1008e35d } // FUNCTION: LEGO1 0x1005a5f0 @@ -375,6 +440,7 @@ LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) } // FUNCTION: LEGO1 0x1005b1d0 +// STUB: BETA10 0x1008e93e void LegoOmni::DeleteObject(MxDSAction& p_dsAction) { if (p_dsAction.GetAtomId().GetInternal() != NULL) { @@ -427,15 +493,16 @@ LegoROI* LegoOmni::FindROI(const char* p_name) } // FUNCTION: LEGO1 0x1005b2f0 +// FUNCTION: BETA10 0x1008eb66 MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) { - LegoWorld* world = NULL; + LegoWorld* world; if (strcmpi(p_id, g_current)) { world = FindWorld(MxAtomId(p_id, e_lowerCase2), p_entityId); } else { - world = this->m_currentWorld; + world = GetCurrentWorld(); } if (world != NULL) { @@ -446,14 +513,17 @@ MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* } // FUNCTION: LEGO1 0x1005b3a0 +// FUNCTION: BETA10 0x1008ec27 void LegoOmni::NotifyCurrentEntity(const MxNotificationParam& p_param) { - if (m_currentWorld) { - NotificationManager()->Send(m_currentWorld, p_param); + LegoWorld* currentWorld = GetCurrentWorld(); + if (currentWorld) { + NotificationManager()->Send(currentWorld, p_param); } } // FUNCTION: LEGO1 0x1005b3c0 +// FUNCTION: BETA10 0x1008ec72 MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) { if (MxOmni::DoesEntityExist(p_dsAction)) { @@ -559,12 +629,19 @@ void LegoOmni::CreateBackgroundAudio() } // FUNCTION: LEGO1 0x1005b580 +// FUNCTION: BETA10 0x1008f7e0 MxResult LegoOmni::Start(MxDSAction* p_dsAction) { MxResult result = MxOmni::Start(p_dsAction); +#ifdef BETA10 + this->m_action = *p_dsAction; +#else + // TODO: This is likely an inlined `MxDsAction::operator=`, see the BETA10 code. + // As of this commit, the operator is not inlined automatically. this->m_action.SetAtomId(p_dsAction->GetAtomId()); this->m_action.SetObjectId(p_dsAction->GetObjectId()); this->m_action.SetUnknown24(p_dsAction->GetUnknown24()); +#endif return result; } diff --git a/LEGO1/lego/legoomni/src/main/scripts.cpp b/LEGO1/lego/legoomni/src/main/scripts.cpp index 9aaa34d8..58eccfb3 100644 --- a/LEGO1/lego/legoomni/src/main/scripts.cpp +++ b/LEGO1/lego/legoomni/src/main/scripts.cpp @@ -91,6 +91,7 @@ MxAtomId* g_creditsScript = NULL; MxAtomId* g_nocdSourceName = NULL; // FUNCTION: LEGO1 0x100528e0 +// STUB: BETA10 0x100f6133 void CreateScripts() { g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", e_lowerCase2); diff --git a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp index 9aeabf74..cc6d62f4 100644 --- a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp @@ -4,6 +4,8 @@ #include "misc/legocontainer.h" #include "mxdsaction.h" +#include + DECOMP_SIZE_ASSERT(LegoFlcTexturePresenter, 0x70) // FUNCTION: LEGO1 0x1005de80 @@ -27,11 +29,14 @@ void LegoFlcTexturePresenter::StartingTickle() char* pp; char extraCopy[128]; m_action->GetExtra(extraLength, pp); + assert(pp); if (pp != NULL) { strcpy(extraCopy, pp); strcat(extraCopy, ".gif"); - m_texture = TextureContainer()->Get(extraCopy); + LegoTextureContainer* textureContainer = TextureContainer(); + assert(textureContainer); + m_texture = textureContainer->Get(extraCopy); } MxFlcPresenter::StartingTickle(); diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index 23e4c55d..b06add15 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -26,6 +26,7 @@ DECOMP_SIZE_ASSERT(MxStopWatch, 0x18) DECOMP_SIZE_ASSERT(MxFrequencyMeter, 0x20) // FUNCTION: LEGO1 0x1007aa20 +// FUNCTION: BETA10 0x100d5a00 LegoVideoManager::LegoVideoManager() { m_renderer = NULL; @@ -286,12 +287,15 @@ void LegoVideoManager::ToggleFPS(MxBool p_visible) } // FUNCTION: LEGO1 0x1007b770 +// STUB: BETA10 0x100d69cc MxResult LegoVideoManager::Tickle() { +#ifndef BETA10 if (m_unk0x554 && !m_videoParam.Flags().GetFlipSurfaces() && TransitionManager()->GetTransitionType() == MxTransitionManager::e_idle) { Sleep(30); } +#endif m_stopWatch->Stop(); m_elapsedSeconds = m_stopWatch->ElapsedSeconds(); @@ -514,6 +518,7 @@ void LegoVideoManager::DrawFPS() } // FUNCTION: LEGO1 0x1007c080 +// FUNCTION: BETA10 0x100d6d28 MxPresenter* LegoVideoManager::GetPresenterAt(MxS32 p_x, MxS32 p_y) { MxPresenterListCursor cursor(m_presenters); @@ -551,6 +556,7 @@ MxPresenter* LegoVideoManager::GetPresenterByActionObjectName(const char* p_acti } // FUNCTION: LEGO1 0x1007c290 +// FUNCTION: BETA10 0x100d731e MxResult LegoVideoManager::RealizePalette(MxPalette* p_pallete) { if (p_pallete && m_videoParam.GetPalette()) { @@ -652,6 +658,7 @@ void LegoVideoManager::OverrideSkyColor(MxBool p_shouldOverride) } // FUNCTION: LEGO1 0x1007c4d0 +// FUNCTION: BETA10 0x100d77d3 void LegoVideoManager::UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) { if (p_width == 0) { diff --git a/LEGO1/lego/sources/misc/legocontainer.h b/LEGO1/lego/sources/misc/legocontainer.h index fd439912..a7ab0068 100644 --- a/LEGO1/lego/sources/misc/legocontainer.h +++ b/LEGO1/lego/sources/misc/legocontainer.h @@ -122,6 +122,10 @@ class LegoTextureContainer : public LegoContainer { LegoTextureInfo* GetCached(LegoTextureInfo* p_textureInfo); void EraseCached(LegoTextureInfo* p_textureInfo); + // Verified by LegoOmni::Create(), even though there have been significant changes. + // SYNTHETIC: BETA10 0x10093ea0 + // LegoTextureContainer::LegoTextureContainer + protected: LegoCachedTextureList m_cached; // 0x18 }; diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 96437e7a..1d5e38c2 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -780,6 +780,9 @@ // LIBRARY: BETA10 0x100fa200 // strcpy +// LIBRARY: BETA10 0x100fa210 +// strcat + // LIBRARY: BETA10 0x100f8a88 // ??2@YAPAXI@Z diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index 40777113..bb8a54e9 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -24,6 +24,7 @@ class MxVariableTable; class MxVideoManager; // VTABLE: LEGO1 0x100dc168 +// VTABLE: BETA10 0x101c1c40 // SIZE 0x68 class MxOmni : public MxCore { public: @@ -96,6 +97,7 @@ class MxOmni : public MxCore { MxLong HandleEndAction(MxParam& p_param); // SYNTHETIC: LEGO1 0x100aefd0 + // SYNTHETIC: BETA10 0x10130c90 // MxOmni::`scalar deleting destructor' protected: diff --git a/LEGO1/omni/include/mxomnicreateparam.h b/LEGO1/omni/include/mxomnicreateparam.h index 338767bb..e84e80c2 100644 --- a/LEGO1/omni/include/mxomnicreateparam.h +++ b/LEGO1/omni/include/mxomnicreateparam.h @@ -23,8 +23,13 @@ class MxOmniCreateParam : public MxParam { MxOmniCreateFlags& CreateFlags() { return this->m_createFlags; } const MxString& GetMediaPath() const { return m_mediaPath; } + + // FUNCTION: BETA10 0x10092c50 const HWND GetWindowHandle() const { return m_windowHandle; } + + // FUNCTION: BETA10 0x10092c80 MxVideoParam& GetVideoParam() { return m_videoParam; } + const MxVideoParam& GetVideoParam() const { return m_videoParam; } // SYNTHETIC: LEGO1 0x100b0a70 diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index fd36b683..0cd04266 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -37,23 +37,27 @@ MxOmni::MxOmni() } // FUNCTION: LEGO1 0x100aefb0 +// FUNCTION: BETA10 0x10130c50 MxEntity* MxOmni::AddToWorld(const char*, MxS32, MxPresenter*) { return NULL; } // FUNCTION: LEGO1 0x100aefc0 +// FUNCTION: BETA10 0x10130c70 void MxOmni::NotifyCurrentEntity(const MxNotificationParam& p_param) { } // FUNCTION: LEGO1 0x100aeff0 +// STUB: BETA10 0x1012f2b7 MxOmni::~MxOmni() { Destroy(); } // FUNCTION: LEGO1 0x100af080 +// FUNCTION: BETA10 0x1012f359 void MxOmni::Init() { m_windowHandle = NULL; @@ -81,6 +85,8 @@ void MxOmni::SetInstance(MxOmni* p_instance) // FUNCTION: BETA10 0x1012f3ff MxResult MxOmni::Create(MxOmniCreateParam& p_param) { + // TODO: File name is MxMain.cpp according to BETA10 + MxResult result = FAILURE; if (!(m_atomSet = new MxAtomSet())) { @@ -223,6 +229,7 @@ void MxOmni::Destroy() } // FUNCTION: LEGO1 0x100b0090 +// STUB: BETA10 0x101303ce MxResult MxOmni::Start(MxDSAction* p_dsAction) { MxResult result = FAILURE; @@ -234,6 +241,7 @@ MxResult MxOmni::Start(MxDSAction* p_dsAction) } // FUNCTION: LEGO1 0x100b00c0 +// FUNCTION: BETA10 0x101304aa void MxOmni::DeleteObject(MxDSAction& p_dsAction) { if (m_streamer != NULL) { @@ -242,6 +250,7 @@ void MxOmni::DeleteObject(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x100b00e0 +// FUNCTION: BETA10 0x101304de MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action) { MxResult result = FAILURE; @@ -322,6 +331,7 @@ MxBool MxOmni::ActionSourceEquals(MxDSAction* p_action, const char* p_name) } // FUNCTION: LEGO1 0x100b07f0 +// STUB: BETA10 0x1013082b MxLong MxOmni::Notify(MxParam& p_param) { AUTOLOCK(m_criticalSection); @@ -396,6 +406,7 @@ void MxOmni::SetSound3D(MxBool p_use3dSound) } // FUNCTION: LEGO1 0x100b09a0 +// FUNCTION: BETA10 0x101309f5 MxBool MxOmni::DoesEntityExist(MxDSAction& p_dsAction) { if (m_streamer->FUN_100b9b30(p_dsAction)) { diff --git a/LEGO1/omni/src/notify/mxnotificationmanager.cpp b/LEGO1/omni/src/notify/mxnotificationmanager.cpp index 61e051f7..064f38f3 100644 --- a/LEGO1/omni/src/notify/mxnotificationmanager.cpp +++ b/LEGO1/omni/src/notify/mxnotificationmanager.cpp @@ -165,6 +165,7 @@ void MxNotificationManager::FlushPending(MxCore* p_listener) } // FUNCTION: LEGO1 0x100acd20 +// STUB: BETA10 0x1012666a void MxNotificationManager::Register(MxCore* p_listener) { AUTOLOCK(m_lock); diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 5649e2d1..7062c694 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -13,6 +13,7 @@ DECOMP_SIZE_ASSERT(MxVideoManager, 0x64) // FUNCTION: LEGO1 0x100be1f0 +// STUB: BETA10 0x1012ca40 MxVideoManager::MxVideoManager() { Init(); From a9e261606d0d332f2fa2325c8d2f896e92905ec3 Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Fri, 25 Jul 2025 22:19:09 +0200 Subject: [PATCH 2/7] Fix `mxomni.*` file names (#1654) Co-authored-by: jonschz --- CMakeLists.txt | 2 +- LEGO1/lego/legoomni/include/legomain.h | 2 +- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 2 +- LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp | 2 +- LEGO1/lego/legoomni/src/audio/legocachsound.cpp | 2 +- LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp | 2 +- LEGO1/omni/include/{mxomni.h => mxmain.h} | 6 +++--- LEGO1/omni/src/audio/mxsoundmanager.cpp | 2 +- LEGO1/omni/src/audio/mxwavepresenter.cpp | 2 +- LEGO1/omni/src/common/mxatom.cpp | 2 +- LEGO1/omni/src/common/mxmisc.cpp | 2 +- LEGO1/omni/src/common/mxpresentationmanager.cpp | 2 +- LEGO1/omni/src/common/mxpresenter.cpp | 2 +- LEGO1/omni/src/main/{mxomni.cpp => mxmain.cpp} | 4 +--- LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp | 2 +- LEGO1/omni/src/stream/mxdiskstreamprovider.cpp | 2 +- LEGO1/omni/src/stream/mxdsbuffer.cpp | 2 +- LEGO1/omni/src/stream/mxramstreamprovider.cpp | 2 +- LEGO1/omni/src/video/mxdisplaysurface.cpp | 2 +- LEGO1/omni/src/video/mxstillpresenter.cpp | 2 +- LEGO1/omni/src/video/mxvideomanager.cpp | 2 +- 21 files changed, 23 insertions(+), 25 deletions(-) rename LEGO1/omni/include/{mxomni.h => mxmain.h} (98%) rename LEGO1/omni/src/main/{mxomni.cpp => mxmain.cpp} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 286e3b1a..6485e070 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,7 +221,7 @@ function(add_lego_libraries NAME) LEGO1/omni/src/common/mxcore.cpp LEGO1/omni/src/common/mxstring.cpp LEGO1/omni/src/audio/mxsoundmanager.cpp - LEGO1/omni/src/main/mxomni.cpp + LEGO1/omni/src/main/mxmain.cpp LEGO1/omni/src/notify/mxactionnotificationparam.cpp LEGO1/omni/src/main/mxomnicreateflags.cpp LEGO1/omni/src/main/mxomnicreateparam.cpp diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 0fe040e3..5abf8a15 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -3,7 +3,7 @@ #include "compat.h" #include "mxdsaction.h" -#include "mxomni.h" +#include "mxmain.h" class Isle; class LegoAnimationManager; diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 81112ea8..7d4dc478 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -5,7 +5,7 @@ #include "legosoundmanager.h" #include "legovideomanager.h" #include "misc.h" -#include "mxomni.h" +#include "mxmain.h" #include diff --git a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp index 8083822e..97aa669a 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp @@ -2,7 +2,7 @@ #include "mxcompositepresenter.h" #include "mxdsaction.h" -#include "mxomni.h" +#include "mxmain.h" DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0) diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 27961810..5e1b731e 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -2,7 +2,7 @@ #include "legosoundmanager.h" #include "misc.h" -#include "mxomni.h" +#include "mxmain.h" #include diff --git a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp index a8bf9a07..2c52a1e6 100644 --- a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp @@ -2,7 +2,7 @@ #include "legocachesoundmanager.h" #include "mxautolock.h" -#include "mxomni.h" +#include "mxmain.h" #include diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxmain.h similarity index 98% rename from LEGO1/omni/include/mxomni.h rename to LEGO1/omni/include/mxmain.h index bb8a54e9..035779af 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxmain.h @@ -1,5 +1,5 @@ -#ifndef MXOMNI_H -#define MXOMNI_H +#ifndef MXMAIN_H +#define MXMAIN_H #include "mxcore.h" #include "mxcriticalsection.h" @@ -120,4 +120,4 @@ class MxOmni : public MxCore { MxBool m_paused; // 0x64 }; -#endif // MXOMNI_H +#endif // MXMAIN_H diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index 5bfa851c..660bda0d 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -2,8 +2,8 @@ #include "mxautolock.h" #include "mxdsaction.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxpresenter.h" #include "mxticklemanager.h" #include "mxticklethread.h" diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index ca55f73b..2b782da7 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -5,8 +5,8 @@ #include "mxautolock.h" #include "mxdssound.h" #include "mxdssubscriber.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxsoundmanager.h" #include "mxutilities.h" diff --git a/LEGO1/omni/src/common/mxatom.cpp b/LEGO1/omni/src/common/mxatom.cpp index e242ebb0..942346ec 100644 --- a/LEGO1/omni/src/common/mxatom.cpp +++ b/LEGO1/omni/src/common/mxatom.cpp @@ -1,8 +1,8 @@ #include "mxatom.h" #include "decomp.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include diff --git a/LEGO1/omni/src/common/mxmisc.cpp b/LEGO1/omni/src/common/mxmisc.cpp index 8dbab329..49f5551a 100644 --- a/LEGO1/omni/src/common/mxmisc.cpp +++ b/LEGO1/omni/src/common/mxmisc.cpp @@ -1,6 +1,6 @@ #include "mxmisc.h" -#include "mxomni.h" +#include "mxmain.h" #include diff --git a/LEGO1/omni/src/common/mxpresentationmanager.cpp b/LEGO1/omni/src/common/mxpresentationmanager.cpp index 6ef8448e..e4d96fb3 100644 --- a/LEGO1/omni/src/common/mxpresentationmanager.cpp +++ b/LEGO1/omni/src/common/mxpresentationmanager.cpp @@ -2,7 +2,7 @@ #include "decomp.h" #include "mxautolock.h" -#include "mxomni.h" +#include "mxmain.h" #include "mxpresenter.h" #include "mxticklemanager.h" diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index a2084656..9f297d9e 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -13,11 +13,11 @@ #include "mxloopingflcpresenter.h" #include "mxloopingmidipresenter.h" #include "mxloopingsmkpresenter.h" +#include "mxmain.h" #include "mxmidipresenter.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxobjectfactory.h" -#include "mxomni.h" #include "mxparam.h" #include "mxsmkpresenter.h" #include "mxstillpresenter.h" diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxmain.cpp similarity index 99% rename from LEGO1/omni/src/main/mxomni.cpp rename to LEGO1/omni/src/main/mxmain.cpp index 0cd04266..530154ec 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxmain.cpp @@ -1,4 +1,4 @@ -#include "mxomni.h" +#include "mxmain.h" #include "mxactionnotificationparam.h" #include "mxatom.h" @@ -85,8 +85,6 @@ void MxOmni::SetInstance(MxOmni* p_instance) // FUNCTION: BETA10 0x1012f3ff MxResult MxOmni::Create(MxOmniCreateParam& p_param) { - // TODO: File name is MxMain.cpp according to BETA10 - MxResult result = FAILURE; if (!(m_atomSet = new MxAtomSet())) { diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index 0e34ed5a..04f06b63 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -4,8 +4,8 @@ #include "mxautolock.h" #include "mxdiskstreamprovider.h" #include "mxdsstreamingaction.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxticklemanager.h" #include diff --git a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp index 3eee3477..de16f38c 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp @@ -5,7 +5,7 @@ #include "mxdsbuffer.h" #include "mxdsfile.h" #include "mxdsstreamingaction.h" -#include "mxomni.h" +#include "mxmain.h" #include "mxramstreamprovider.h" #include "mxstreamcontroller.h" #include "mxstring.h" diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index a73be62f..c3724347 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -3,8 +3,8 @@ #include "mxdiskstreamcontroller.h" #include "mxdschunk.h" #include "mxdsstreamingaction.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxstreamchunk.h" #include "mxstreamcontroller.h" #include "mxstreamer.h" diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index ddc25470..2cd707e4 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -3,7 +3,7 @@ #include "decomp.h" #include "mxdsbuffer.h" #include "mxdsfile.h" -#include "mxomni.h" +#include "mxmain.h" #include "mxstreamcontroller.h" DECOMP_SIZE_ASSERT(MxStreamProvider, 0x10) diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 6b6f4ce5..8200f478 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -2,8 +2,8 @@ #include "mxbitmap.h" #include "mxdebug.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxpalette.h" #include "mxutilities.h" #include "mxvideomanager.h" diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index db2f2ebb..8574e3eb 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -6,8 +6,8 @@ #include "mxdisplaysurface.h" #include "mxdsmediaaction.h" #include "mxdssubscriber.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxpalette.h" #include "mxutilities.h" #include "mxvideomanager.h" diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 7062c694..7194e453 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -2,8 +2,8 @@ #include "mxautolock.h" #include "mxdisplaysurface.h" +#include "mxmain.h" #include "mxmisc.h" -#include "mxomni.h" #include "mxpalette.h" #include "mxpresenter.h" #include "mxregion.h" From d555df6a5865c060ccf5040145362c85539416cb Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Fri, 25 Jul 2025 23:49:16 +0200 Subject: [PATCH 3/7] Add BETA10 matches on LegoWEGEdge and others (#1655) Co-authored-by: jonschz --- .../lego/legoomni/include/legopathboundary.h | 2 + .../src/common/legoanimationmanager.cpp | 8 ++- .../legoomni/src/video/legomodelpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/act3.cpp | 5 ++ LEGO1/lego/sources/geom/legoweedge.cpp | 24 +++++++- LEGO1/lego/sources/geom/legoweedge.h | 3 +- LEGO1/lego/sources/geom/legowegedge.cpp | 1 + LEGO1/lego/sources/geom/legowegedge.h | 2 + LEGO1/lego/sources/roi/legoroi.cpp | 9 ++- LEGO1/library_msvc.h | 58 +++++++++++++++++++ 10 files changed, 108 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 2bc304f0..d3c1c4e7 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -31,6 +31,7 @@ typedef set LegoPathActorSet; typedef set LegoAnimPresenterSet; // VTABLE: LEGO1 0x100d8618 +// VTABLE: BETA10 0x101bdd58 // SIZE 0x74 class LegoPathBoundary : public LegoWEGEdge { public: @@ -57,6 +58,7 @@ class LegoPathBoundary : public LegoWEGEdge { LegoAnimPresenterSet& GetPresenters() { return m_presenters; } // SYNTHETIC: LEGO1 0x10047a80 + // SYNTHETIC: BETA10 0x100bd300 // LegoPathBoundary::`vector deleting destructor' private: diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 1b9dffcb..1312da6a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2812,7 +2812,11 @@ MxResult LegoAnimationManager::FUN_10064880(const char* p_name, MxS32 p_unk0x0c, // FUNCTION: BETA10 0x10045daf void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404) { - if (m_unk0x402 && p_tranInfo->m_unk0x14) { + if ( +#ifndef BETA10 + m_unk0x402 && +#endif + p_tranInfo->m_unk0x14) { p_tranInfo->m_flags |= LegoTranInfo::c_bit1; m_unk0x430 = TRUE; m_unk0x42c = p_tranInfo; @@ -2833,11 +2837,13 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x if (location != NULL) { CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484); m_unk0x4cc.SetStartEnd(m_unk0x43c, m_unk0x484); +#ifndef BETA10 m_unk0x4cc.NormalizeDirection(); } else { p_tranInfo->m_flags &= ~LegoTranInfo::c_bit1; m_unk0x430 = FALSE; +#endif } Mx3DPointFloat vec; diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index b09dbd60..357976d6 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -44,7 +44,7 @@ void LegoModelPresenter::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x1007f6b0 -// FUNCTION: BETA10 0x1009845e +// STUB: BETA10 0x1009845e MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk) { MxResult result = FAILURE; diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index d48a3980..5c2d67e4 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -781,6 +781,7 @@ void Act3::GoodEnding(const Matrix4& p_destination) m_cop2->SetActorState(LegoPathActor::c_disabled); m_brickster->SetActorState(LegoPathActor::c_disabled); +#ifndef BETA10 m_unk0x4220.Clear(); m_copter->FUN_10004640(p_destination); @@ -792,6 +793,10 @@ void Act3::GoodEnding(const Matrix4& p_destination) m_copter->m_unk0x1a8, m_copter->m_unk0x1f4 ); +#else + m_state->m_unk0x08 = 2; + GameState()->SwitchArea(LegoGameState::Area::e_infomain); +#endif } // FUNCTION: LEGO1 0x10073500 diff --git a/LEGO1/lego/sources/geom/legoweedge.cpp b/LEGO1/lego/sources/geom/legoweedge.cpp index be522c4c..967e55ce 100644 --- a/LEGO1/lego/sources/geom/legoweedge.cpp +++ b/LEGO1/lego/sources/geom/legoweedge.cpp @@ -12,6 +12,7 @@ LegoWEEdge::LegoWEEdge() } // FUNCTION: LEGO1 0x1009a590 +// FUNCTION: BETA10 0x10182530 LegoWEEdge::~LegoWEEdge() { if (m_edges) { @@ -20,31 +21,52 @@ LegoWEEdge::~LegoWEEdge() } // FUNCTION: LEGO1 0x1009a5b0 +// FUNCTION: BETA10 0x10182577 LegoS32 LegoWEEdge::LinkEdgesAndFaces() { + assert(m_edges); + assert(m_numEdges); + for (LegoS32 i = 0; i < m_numEdges; i++) { LegoOrientedEdge* e1 = m_edges[i]; - LegoOrientedEdge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; + LegoOrientedEdge* e2 = (m_numEdges - 1) == i ? m_edges[0] : m_edges[i + 1]; if (e2->m_pointA == e1->m_pointA) { + assert(e1->m_faceA == NULL || e1->m_faceA == this); + assert(e2->m_faceB == NULL || e2->m_faceB == this); + assert(e1->m_ccwA == NULL || e1->m_ccwA == e2); + assert(e2->m_cwB == NULL || e2->m_cwB == e1); e1->m_faceA = this; e2->m_faceB = this; e1->m_ccwA = e2; e2->m_cwB = e1; } else if (e2->m_pointB == e1->m_pointA) { + assert(e1->m_faceA == NULL || e1->m_faceA == this); + assert(e2->m_faceA == NULL || e2->m_faceA == this); + assert(e1->m_ccwA == NULL || e1->m_ccwA == e2); + assert(e2->m_cwA == NULL || e2->m_cwA == e1); e1->m_faceA = this; e2->m_faceA = this; e1->m_ccwA = e2; e2->m_cwA = e1; } else if (e1->m_pointB == e2->m_pointA) { + assert(e1->m_faceB == NULL || e1->m_faceB == this); + assert(e2->m_faceB == NULL || e2->m_faceB == this); + assert(e1->m_ccwB == NULL || e1->m_ccwB == e2); + assert(e2->m_cwB == NULL || e2->m_cwB == e1); e1->m_faceB = this; e2->m_faceB = this; e1->m_ccwB = e2; e2->m_cwB = e1; } else { + assert(e1->m_pointB == e2->m_pointB); + assert(e1->m_faceB == NULL || e1->m_faceB == this); + assert(e2->m_faceA == NULL || e2->m_faceA == this); + assert(e1->m_ccwB == NULL || e1->m_ccwB == e2); + assert(e2->m_cwA == NULL || e2->m_cwA == e1); e1->m_faceB = this; e2->m_faceA = this; e1->m_ccwB = e2; diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index 7e0e9bae..2681c370 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -6,8 +6,8 @@ struct LegoOrientedEdge; -// might be a struct with public members // VTABLE: LEGO1 0x100db7c0 +// VTABLE: BETA10 0x101c3730 // SIZE 0x0c class LegoWEEdge { public: @@ -33,6 +33,7 @@ class LegoWEEdge { } // SYNTHETIC: LEGO1 0x1009a570 + // SYNTHETIC: BETA10 0x10182b70 // LegoWEEdge::`scalar deleting destructor' protected: diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index df37ab12..ae12c8ee 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -22,6 +22,7 @@ LegoWEGEdge::LegoWEGEdge() } // FUNCTION: LEGO1 0x1009a800 +// FUNCTION: BETA10 0x101831bd LegoWEGEdge::~LegoWEGEdge() { if (m_edges) { diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index c2929079..ea9fab08 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -29,6 +29,7 @@ struct PathWithTrigger { // might be a struct with public members // VTABLE: LEGO1 0x100db7f8 +// VTABLE: BETA10 0x101c3798 // SIZE 0x54 class LegoWEGEdge : public LegoWEEdge { public: @@ -80,6 +81,7 @@ class LegoWEGEdge : public LegoWEEdge { LegoU8 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); } // SYNTHETIC: LEGO1 0x1009a7e0 + // SYNTHETIC: BETA10 0x10184130 // LegoWEGEdge::`scalar deleting destructor' friend class LegoPathController; diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index a8f16636..4f7814ce 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -9,6 +9,7 @@ #include "shape/legobox.h" #include "shape/legosphere.h" +#include #include #include @@ -410,8 +411,7 @@ LegoResult LegoROI::ApplyChildAnimationTransformation( roi->m_local2world.Product(mat, p_matrix); roi->UpdateWorldData(); - LegoBool visibility = data->GetVisibility(p_time); - roi->SetVisibility(visibility); + roi->SetVisibility(data->GetVisibility(p_time)); for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { ApplyChildAnimationTransformation(p_node->GetChild(i), roi->m_local2world, p_time, roi); @@ -419,6 +419,11 @@ LegoResult LegoROI::ApplyChildAnimationTransformation( } else { FUN_100a81b0("%s ROI Not found\n", name); +#ifdef BETA10 + _RPT1(_CRT_ASSERT, "%s ROI Not Found", name); + // Note that the macro inserts an INT3, which breaks the assumption that INT3 + // only occurs as a filler for empty space in the binary. +#endif } return SUCCESS; diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 1d5e38c2..dfd217d4 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -132,9 +132,11 @@ // ??_L@YGXPAXIHP6EX0@Z1@Z // LIBRARY: LEGO1 0x1008c2e0 +// LIBRARY: BETA10 0x100f9800 // ??_M@YGXPAXIHP6EX0@Z@Z // LIBRARY: LEGO1 0x1008c370 +// LIBRARY: BETA10 0x100f98b0 // ?__ArrayUnwind@@YGXPAXIHP6EX0@Z@Z // LIBRARY: LEGO1 0x1008c410 @@ -162,6 +164,7 @@ // __amsg_exit // LIBRARY: LEGO1 0x1008c980 +// LIBRARY: BETA10 0x10101318 // __except_handler3 // LIBRARY: LEGO1 0x1008ca60 @@ -783,6 +786,61 @@ // LIBRARY: BETA10 0x100fa210 // strcat +// LIBRARY: BETA10 0x100fed20 +// strncat + +// LIBRARY: BETA10 0x100faab0 +// strncpy + +// LIBRARY: BETA10 0x100ff490 +// setvbuf + +// LIBRARY: BETA10 0x100ff180 +// fflush + +// LIBRARY: BETA10 0x100fec40 +// __crtMessageBoxA + +// LIBRARY: BETA10 0x100fee50 +// _itoa + +// LIBRARY: BETA10 0x10106f70 +// _lock_file + +// LIBRARY: BETA10 0x100ff1e0 +// _fflush_lk + +// LIBRARY: BETA10 0x10107010 +// _unlock_file + +// LIBRARY: BETA10 0x10106ea0 +// _lock + +// LIBRARY: BETA10 0x10106f50 +// _unlock + +// LIBRARY: BETA10 0x100fdaf0 +// _getptd + +// LIBRARY: BETA10 0x10104040 +// _malloc_dbg + +// GLOBAL: BETA10 0x101fb7b0 +// _locktable + +// LIBRARY: BETA10 0x10104c00 +// _free_dbg + +// LIBRARY: BETA10 0x100fe900 +// raise + +// GLOBAL: BETA10 0x101fa950 +// _iob + +// GLOBAL: BETA10 0x102122d0 +// _bufin + + // LIBRARY: BETA10 0x100f8a88 // ??2@YAPAXI@Z From ddaf497cc4855e1d14998e58627ff480a34e76a5 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sat, 26 Jul 2025 00:16:36 +0200 Subject: [PATCH 4/7] Clear unknowns in `MxVideoPresenter` (#1656) --- .../src/common/mxcontrolpresenter.cpp | 2 +- .../legoomni/src/worlds/registrationbook.cpp | 4 +- LEGO1/omni/include/mxvideopresenter.h | 30 ++++----- LEGO1/omni/src/video/mxflcpresenter.cpp | 4 +- .../omni/src/video/mxloopingflcpresenter.cpp | 6 +- .../omni/src/video/mxloopingsmkpresenter.cpp | 6 +- LEGO1/omni/src/video/mxsmkpresenter.cpp | 4 +- LEGO1/omni/src/video/mxstillpresenter.cpp | 38 +++++------ LEGO1/omni/src/video/mxvideopresenter.cpp | 66 +++++++++---------- 9 files changed, 80 insertions(+), 80 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index f39ad192..adfae9e1 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -84,7 +84,7 @@ MxBool MxControlPresenter::CheckButtonDown(MxS32 p_x, MxS32 p_y, MxPresenter* p_ assert(map && map->IsA("MxStillPresenter")); if (presenter == map || map->GetDisplayZ() < presenter->GetDisplayZ()) { - if (map->VTable0x7c()) { + if (map->HasFrameBitmapOrAlpha()) { MxRect32 rect(0, 0, map->GetWidth() - 1, map->GetHeight() - 1); rect += map->GetLocation(); diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 64f981ba..307206ce 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -619,12 +619,12 @@ MxBool RegistrationBook::CreateSurface() } if (presenter) { - m_checkboxSurface = presenter->VTable0x78(); + m_checkboxSurface = presenter->GetSurface(); } presenter = (MxStillPresenter*) Find("MxStillPresenter", "CheckHiLite_Bitmap"); if (presenter) { - m_checkboxHilite = presenter->VTable0x78(); + m_checkboxHilite = presenter->GetSurface(); } if (m_checkboxSurface && m_checkboxHilite) { diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 5a51c625..f2100d9b 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -42,10 +42,10 @@ class MxVideoPresenter : public MxMediaPresenter { void Destroy() override { Destroy(FALSE); } // vtable+0x38 // FUNCTION: LEGO1 0x1000c7b0 - virtual LPDIRECTDRAWSURFACE VTable0x78() { return m_unk0x58; } // vtable+0x78 + virtual LPDIRECTDRAWSURFACE GetSurface() { return m_surface; } // vtable+0x78 // FUNCTION: LEGO1 0x1000c7c0 - virtual MxBool VTable0x7c() { return m_frameBitmap != NULL || m_alpha != NULL; } // vtable+0x7c + virtual MxBool HasFrameBitmapOrAlpha() { return m_frameBitmap != NULL || m_alpha != NULL; } // vtable+0x7c // FUNCTION: LEGO1 0x1000c7e0 virtual MxS32 GetWidth() { return m_alpha ? m_alpha->GetWidth() : m_frameBitmap->GetBmiWidth(); } // vtable+0x80 @@ -115,17 +115,17 @@ class MxVideoPresenter : public MxMediaPresenter { // FUNCTION: BETA10 0x1002c2e0 MxU8* GetBitmapStart(MxS32 p_left, MxS32 p_top) { return m_frameBitmap->GetStart(p_left, p_top); } - void SetBit0(BOOL p_e) { m_flags.m_bit0 = p_e; } - void SetBit1(BOOL p_e) { m_flags.m_bit1 = p_e; } - void SetBit2(BOOL p_e) { m_flags.m_bit2 = p_e; } - void SetBit3(BOOL p_e) { m_flags.m_bit3 = p_e; } - void SetBit4(BOOL p_e) { m_flags.m_bit4 = p_e; } + void SetLoadedFirstFrame(BOOL p_loadedFirstFrame) { m_flags.m_bit0 = p_loadedFirstFrame; } + void SetUseSurface(BOOL p_useSurface) { m_flags.m_bit1 = p_useSurface; } + void SetUseVideoMemory(BOOL p_useVideoMemory) { m_flags.m_bit2 = p_useVideoMemory; } + void SetDoNotWriteToSurface(BOOL p_doNotWriteToSurface) { m_flags.m_bit3 = p_doNotWriteToSurface; } + void SetBitmapIsMap(BOOL p_bitmapIsMap) { m_flags.m_bit4 = p_bitmapIsMap; } - BYTE GetBit0() { return m_flags.m_bit0; } - BYTE GetBit1() { return m_flags.m_bit1; } - BYTE GetBit2() { return m_flags.m_bit2; } - BYTE GetBit3() { return m_flags.m_bit3; } - BYTE GetBit4() { return m_flags.m_bit4; } + BYTE LoadedFirstFrame() { return m_flags.m_bit0; } + BYTE UseSurface() { return m_flags.m_bit1; } + BYTE UseVideoMemory() { return m_flags.m_bit2; } + BYTE DoNotWriteToSurface() { return m_flags.m_bit3; } + BYTE BitmapIsMap() { return m_flags.m_bit4; } // SYNTHETIC: LEGO1 0x1000c910 // MxVideoPresenter::`scalar deleting destructor' @@ -138,10 +138,10 @@ class MxVideoPresenter : public MxMediaPresenter { MxBitmap* m_frameBitmap; // 0x50 AlphaMask* m_alpha; // 0x54 - LPDIRECTDRAWSURFACE m_unk0x58; // 0x58 - MxS16 m_unk0x5c; // 0x5c + LPDIRECTDRAWSURFACE m_surface; // 0x58 + MxS16 m_frameLoadTickleCount; // 0x5c FlagBitfield m_flags; // 0x5e - MxLong m_unk0x60; // 0x60 + MxLong m_frozenTime; // 0x60 }; #endif // MXVIDEOPRESENTER_H diff --git a/LEGO1/omni/src/video/mxflcpresenter.cpp b/LEGO1/omni/src/video/mxflcpresenter.cpp index eb075357..e9e95a18 100644 --- a/LEGO1/omni/src/video/mxflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxflcpresenter.cpp @@ -13,8 +13,8 @@ DECOMP_SIZE_ASSERT(MxFlcPresenter, 0x68); MxFlcPresenter::MxFlcPresenter() { m_flcHeader = NULL; - SetBit1(FALSE); - SetBit2(FALSE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } // FUNCTION: LEGO1 0x100b3420 diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index fb0e3134..c1ebb2cd 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -22,8 +22,8 @@ MxLoopingFlcPresenter::~MxLoopingFlcPresenter() void MxLoopingFlcPresenter::Init() { this->m_elapsedDuration = 0; - SetBit1(FALSE); - SetBit2(FALSE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } // FUNCTION: LEGO1 0x100b4430 @@ -72,7 +72,7 @@ void MxLoopingFlcPresenter::VTable0x88() // FUNCTION: LEGO1 0x100b4520 void MxLoopingFlcPresenter::RepeatingTickle() { - for (MxS16 i = 0; i < m_unk0x5c; i++) { + for (MxS16 i = 0; i < m_frameLoadTickleCount; i++) { if (!m_loopingChunkCursor->HasMatch()) { MxStreamChunk* chunk; MxStreamChunkListCursor cursor(m_loopingChunks); diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index 7933b3f3..27d1f0b9 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -22,8 +22,8 @@ MxLoopingSmkPresenter::~MxLoopingSmkPresenter() void MxLoopingSmkPresenter::Init() { m_elapsedDuration = 0; - SetBit1(FALSE); - SetBit2(FALSE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } // FUNCTION: LEGO1 0x100b49d0 @@ -82,7 +82,7 @@ void MxLoopingSmkPresenter::VTable0x8c() // FUNCTION: LEGO1 0x100b4b00 void MxLoopingSmkPresenter::RepeatingTickle() { - for (MxS16 i = 0; i < m_unk0x5c; i++) { + for (MxS16 i = 0; i < m_frameLoadTickleCount; i++) { if (!m_loopingChunkCursor->HasMatch()) { MxStreamChunk* chunk; MxStreamChunkListCursor cursor(m_loopingChunks); diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index e6bbc1d9..748ad1df 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -25,8 +25,8 @@ void MxSmkPresenter::Init() { m_currentFrame = 0; memset(&m_mxSmk, 0, sizeof(m_mxSmk)); - SetBit1(FALSE); - SetBit2(FALSE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } // FUNCTION: LEGO1 0x100b3900 diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 8574e3eb..0c0b3a1b 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -79,12 +79,12 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk) MxRect32 rect(x, y, width + x, height + y); MVideoManager()->InvalidateRect(rect); - if (GetBit1()) { - undefined4 und = 0; - m_unk0x58 = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44( + if (UseSurface()) { + undefined4 useVideoMemory = 0; + m_surface = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44( m_frameBitmap, - &und, - GetBit3(), + &useVideoMemory, + DoNotWriteToSurface(), m_action->GetFlags() & MxDSAction::c_bit4 ); @@ -94,11 +94,11 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk) delete m_frameBitmap; m_frameBitmap = NULL; - if (m_unk0x58 && und) { - SetBit2(TRUE); + if (m_surface && useVideoMemory) { + SetUseVideoMemory(TRUE); } else { - SetBit2(FALSE); + SetUseVideoMemory(FALSE); } } } @@ -196,7 +196,7 @@ void MxStillPresenter::ParseExtra() MxPresenter::ParseExtra(); if (m_action->GetFlags() & MxDSAction::c_bit5) { - SetBit3(TRUE); + SetDoNotWriteToSurface(TRUE); } MxU16 extraLength; @@ -216,9 +216,9 @@ void MxStillPresenter::ParseExtra() } if (KeyValueStringParse(output, g_strBMP_ISMAP, extraCopy)) { - SetBit4(TRUE); - SetBit1(FALSE); - SetBit2(FALSE); + SetBitmapIsMap(TRUE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } } } @@ -234,11 +234,11 @@ MxStillPresenter* MxStillPresenter::Clone() MxDSAction* action = GetAction()->Clone(); if (action && presenter->StartAction(NULL, action) == SUCCESS) { - presenter->SetBit0(GetBit0()); - presenter->SetBit1(GetBit1()); - presenter->SetBit2(GetBit2()); - presenter->SetBit3(GetBit3()); - presenter->SetBit4(GetBit4()); + presenter->SetLoadedFirstFrame(LoadedFirstFrame()); + presenter->SetUseSurface(UseSurface()); + presenter->SetUseVideoMemory(UseVideoMemory()); + presenter->SetDoNotWriteToSurface(DoNotWriteToSurface()); + presenter->SetBitmapIsMap(BitmapIsMap()); if (m_frameBitmap) { presenter->m_frameBitmap = new MxBitmap; @@ -248,8 +248,8 @@ MxStillPresenter* MxStillPresenter::Clone() } } - if (m_unk0x58) { - presenter->m_unk0x58 = MxDisplaySurface::CopySurface(m_unk0x58); + if (m_surface) { + presenter->m_surface = MxDisplaySurface::CopySurface(m_surface); } if (m_alpha) { diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 93a886a5..ff611085 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -93,19 +93,19 @@ void MxVideoPresenter::Init() { m_frameBitmap = NULL; m_alpha = NULL; - m_unk0x5c = 1; - m_unk0x58 = NULL; - m_unk0x60 = -1; - SetBit0(FALSE); + m_frameLoadTickleCount = 1; + m_surface = NULL; + m_frozenTime = -1; + SetLoadedFirstFrame(FALSE); if (MVideoManager() != NULL) { MVideoManager(); - SetBit1(TRUE); - SetBit2(FALSE); + SetUseSurface(TRUE); + SetUseVideoMemory(FALSE); } - SetBit3(FALSE); - SetBit4(FALSE); + SetDoNotWriteToSurface(FALSE); + SetBitmapIsMap(FALSE); } // FUNCTION: LEGO1 0x100b27b0 @@ -115,11 +115,11 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor) MVideoManager()->UnregisterPresenter(*this); } - if (m_unk0x58) { - m_unk0x58->Release(); - m_unk0x58 = NULL; - SetBit1(FALSE); - SetBit2(FALSE); + if (m_surface) { + m_surface->Release(); + m_surface = NULL; + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } if (MVideoManager() && (m_alpha || m_frameBitmap)) { @@ -183,7 +183,7 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y) MxU8* pixel = m_frameBitmap->GetStart(p_x - rect.GetLeft(), p_y - rect.GetTop()); - if (GetBit4()) { + if (BitmapIsMap()) { return (MxBool) *pixel; } @@ -241,7 +241,7 @@ void MxVideoPresenter::PutFrame() LPDIRECTDRAWSURFACE ddSurface = displaySurface->GetDirectDrawSurface2(); if (m_action->GetFlags() & MxDSAction::c_bit5) { - if (m_unk0x58) { + if (m_surface) { RECT src, dest; src.top = 0; src.left = 0; @@ -255,10 +255,10 @@ void MxVideoPresenter::PutFrame() switch (PrepareRects(src, dest)) { case 0: - ddSurface->Blt(&dest, m_unk0x58, &src, DDBLT_KEYSRC, NULL); + ddSurface->Blt(&dest, m_surface, &src, DDBLT_KEYSRC, NULL); break; case 1: - ddSurface->BltFast(dest.left, dest.top, m_unk0x58, &src, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + ddSurface->BltFast(dest.left, dest.top, m_surface, &src, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); } } else { @@ -282,7 +282,7 @@ void MxVideoPresenter::PutFrame() if (regionRect->GetWidth() >= 1 && regionRect->GetHeight() >= 1) { RECT src, dest; - if (m_unk0x58) { + if (m_surface) { src.left = regionRect->GetLeft() - GetX(); src.top = regionRect->GetTop() - GetY(); src.right = src.left + regionRect->GetWidth(); @@ -295,9 +295,9 @@ void MxVideoPresenter::PutFrame() } if (m_action->GetFlags() & MxDSAction::c_bit4) { - if (m_unk0x58) { + if (m_surface) { if (PrepareRects(src, dest) >= 0) { - ddSurface->Blt(&dest, m_unk0x58, &src, DDBLT_KEYSRC, NULL); + ddSurface->Blt(&dest, m_surface, &src, DDBLT_KEYSRC, NULL); } } else { @@ -313,9 +313,9 @@ void MxVideoPresenter::PutFrame() ); } } - else if (m_unk0x58) { + else if (m_surface) { if (PrepareRects(src, dest) >= 0) { - ddSurface->Blt(&dest, m_unk0x58, &src, 0, NULL); + ddSurface->Blt(&dest, m_surface, &src, 0, NULL); } } else { @@ -372,7 +372,7 @@ void MxVideoPresenter::StreamingTickle() } } else { - for (MxS16 i = 0; i < m_unk0x5c; i++) { + for (MxS16 i = 0; i < m_frameLoadTickleCount; i++) { if (!m_currentChunk) { MxMediaPresenter::StreamingTickle(); @@ -388,15 +388,15 @@ void MxVideoPresenter::StreamingTickle() LoadFrame(m_currentChunk); m_subscriber->FreeDataChunk(m_currentChunk); m_currentChunk = NULL; - SetBit0(TRUE); + SetLoadedFirstFrame(TRUE); if (m_currentTickleState != e_streaming) { break; } } - if (GetBit0()) { - m_unk0x5c = 5; + if (LoadedFirstFrame()) { + m_frameLoadTickleCount = 5; } } } @@ -416,7 +416,7 @@ void MxVideoPresenter::RepeatingTickle() } } else { - for (MxS16 i = 0; i < m_unk0x5c; i++) { + for (MxS16 i = 0; i < m_frameLoadTickleCount; i++) { if (!m_currentChunk) { MxMediaPresenter::RepeatingTickle(); @@ -431,15 +431,15 @@ void MxVideoPresenter::RepeatingTickle() LoadFrame(m_currentChunk); m_currentChunk = NULL; - SetBit0(TRUE); + SetLoadedFirstFrame(TRUE); if (m_currentTickleState != e_repeating) { break; } } - if (GetBit0()) { - m_unk0x5c = 5; + if (LoadedFirstFrame()) { + m_frameLoadTickleCount = 5; } } } @@ -452,11 +452,11 @@ void MxVideoPresenter::FreezingTickle() if (sustainTime != -1) { if (sustainTime) { - if (m_unk0x60 == -1) { - m_unk0x60 = m_action->GetElapsedTime(); + if (m_frozenTime == -1) { + m_frozenTime = m_action->GetElapsedTime(); } - if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) { + if (m_action->GetElapsedTime() >= m_frozenTime + ((MxDSMediaAction*) m_action)->GetSustainTime()) { ProgressTickleState(e_done); } } From 0442fadc0ef66663287bf57e2153354b64750c04 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sat, 26 Jul 2025 00:58:49 +0200 Subject: [PATCH 5/7] Clear unknown in `InfocenterState` (#1657) --- LEGO1/lego/legoomni/include/infocenter.h | 21 ++- .../legoomni/src/entity/legonavcontroller.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 167 +++++++++--------- .../legoomni/src/worlds/registrationbook.cpp | 6 +- 4 files changed, 109 insertions(+), 89 deletions(-) diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 3c58b325..888816d1 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -18,6 +18,25 @@ class LegoControlManagerNotificationParam; // SIZE 0x94 class InfocenterState : public LegoState { public: + enum { + e_playCutscene = 0, + e_introCancelled = 1, + e_notRegistered = 2, + e_newState = 3, + e_selectedSave = 4, + e_selectedCharacterAndDestination = 5, + // e_6 = 6, + // e_7 = 7, + e_exitQueried = 8, + // e_9 = 9, + // e_10 = 10, + e_welcomeAnimation = 11, + e_exiting = 12, + e_playCredits = 13, + e_exitingToIsland = 14, + e_backToInfoAct1 = 15, + }; + InfocenterState(); ~InfocenterState() override; @@ -72,7 +91,7 @@ class InfocenterState : public LegoState { Playlist m_returnDialogue[3]; // 0x20 Playlist m_leaveDialogue[3]; // 0x44 Playlist m_bricksterDialogue; // 0x68 - MxU32 m_unk0x74; // 0x74 + MxU32 m_state; // 0x74 MxStillPresenter* m_letters[7]; // 0x78 }; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 8410c63f..b539e050 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -666,10 +666,10 @@ MxLong LegoNavController::Notify(MxParam& p_param) InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); assert(state); - if (state != NULL && state->m_unk0x74 != 8 && currentWorld->Escape()) { + if (state != NULL && state->m_state != InfocenterState::e_exitQueried && currentWorld->Escape()) { BackgroundAudioManager()->Stop(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - state->m_unk0x74 = 8; + state->m_state = InfocenterState::e_exitQueried; } } break; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 67a21d69..957681d9 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -190,12 +190,13 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction) m_infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); if (!m_infocenterState) { m_infocenterState = (InfocenterState*) GameState()->CreateState("InfocenterState"); - m_infocenterState->m_unk0x74 = 3; + m_infocenterState->m_state = InfocenterState::e_newState; } else { - if (m_infocenterState->m_unk0x74 != 8 && m_infocenterState->m_unk0x74 != 4 && - m_infocenterState->m_unk0x74 != 15) { - m_infocenterState->m_unk0x74 = 2; + if (m_infocenterState->m_state != InfocenterState::e_exitQueried && + m_infocenterState->m_state != InfocenterState::e_selectedSave && + m_infocenterState->m_state != InfocenterState::e_backToInfoAct1) { + m_infocenterState->m_state = InfocenterState::e_notRegistered; } MxS16 count, i; @@ -217,7 +218,7 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction) GameState()->m_currentArea = LegoGameState::e_infomain; GameState()->StopArea(LegoGameState::e_previousArea); - if (m_infocenterState->m_unk0x74 == 4) { + if (m_infocenterState->m_state == InfocenterState::e_selectedSave) { LegoGameState* state = GameState(); state->m_previousArea = GameState()->m_unk0x42c; } @@ -266,9 +267,9 @@ MxLong Infocenter::Notify(MxParam& p_param) StopBookAnimation(); m_bookAnimationTimer = 0; - if (m_infocenterState->m_unk0x74 == 0x0c) { + if (m_infocenterState->m_state == InfocenterState::e_exiting) { StartCredits(); - m_infocenterState->m_unk0x74 = 0xd; + m_infocenterState->m_state = InfocenterState::e_playCredits; } else if (m_destLocation != 0) { BackgroundAudioManager()->RaiseVolume(); @@ -339,8 +340,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) m_bigInfoBlinkTimer = 0; } - switch (m_infocenterState->m_unk0x74) { - case 0: + switch (m_infocenterState->m_state) { + case InfocenterState::e_playCutscene: switch (m_currentCutscene) { case e_legoMovie: PlayCutscene(e_mindscapeMovie, FALSE); @@ -350,13 +351,13 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) return 1; case e_badEndMovie: StopCutscene(); - m_infocenterState->m_unk0x74 = 11; + m_infocenterState->m_state = InfocenterState::e_welcomeAnimation; PlayAction(InfomainScript::c_tic092in_RunAnim); m_currentCutscene = e_noIntro; return 1; case e_goodEndMovie: StopCutscene(); - m_infocenterState->m_unk0x74 = 11; + m_infocenterState->m_state = InfocenterState::e_welcomeAnimation; PlayAction(InfomainScript::c_tic089in_RunAnim); m_currentCutscene = e_noIntro; return 1; @@ -364,7 +365,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) // default / 2nd case probably? StopCutscene(); - m_infocenterState->m_unk0x74 = 11; + m_infocenterState->m_state = InfocenterState::e_welcomeAnimation; PlayAction(InfomainScript::c_iic001in_RunAnim); m_currentCutscene = e_noIntro; @@ -373,8 +374,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) return 1; } break; - case 1: - m_infocenterState->m_unk0x74 = 11; + case InfocenterState::e_introCancelled: + m_infocenterState->m_state = InfocenterState::e_welcomeAnimation; switch (m_currentCutscene) { case e_badEndMovie: @@ -389,30 +390,30 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) m_currentCutscene = e_noIntro; return 1; - case 2: + case InfocenterState::e_notRegistered: SetROIVisible(g_object2x4red, FALSE); SetROIVisible(g_object2x4grn, FALSE); BackgroundAudioManager()->RaiseVolume(); return 1; - case 4: + case InfocenterState::e_selectedSave: if (action->GetObjectId() == InfomainScript::c_GoTo_RegBook || action->GetObjectId() == InfomainScript::c_GoTo_RegBook_Red) { TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - m_infocenterState->m_unk0x74 = 14; + m_infocenterState->m_state = InfocenterState::e_exitingToIsland; return 1; } break; - case 5: + case InfocenterState::e_selectedCharacterAndDestination: if (action->GetObjectId() == m_currentInfomainScript) { if (GameState()->GetCurrentAct() != LegoGameState::e_act3 && m_selectedCharacter != e_noCharacter) { GameState()->SetActor(m_selectedCharacter); } TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - m_infocenterState->m_unk0x74 = 14; + m_infocenterState->m_state = InfocenterState::e_exitingToIsland; return 1; } break; - case 11: + case InfocenterState::e_welcomeAnimation: if (!m_infocenterState->HasRegistered() && m_currentInfomainScript != InfomainScript::c_Mama_All_Movie && m_currentInfomainScript != InfomainScript::c_Papa_All_Movie && m_currentInfomainScript != InfomainScript::c_Pepper_All_Movie && @@ -422,10 +423,10 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) PlayMusic(JukeboxScript::c_InformationCenter_Music); } - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; SetROIVisible("infoman", TRUE); return 1; - case 12: + case InfocenterState::e_exiting: if (action->GetObjectId() == m_currentInfomainScript) { TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } @@ -452,13 +453,13 @@ void Infocenter::ReadyWorld() bg->Enable(TRUE); InitializeBitmaps(); - switch (m_infocenterState->m_unk0x74) { - case 3: + switch (m_infocenterState->m_state) { + case InfocenterState::e_newState: PlayCutscene(e_legoMovie, TRUE); - m_infocenterState->m_unk0x74 = 0; + m_infocenterState->m_state = InfocenterState::e_playCutscene; return; - case 4: - m_infocenterState->m_unk0x74 = 2; + case InfocenterState::e_selectedSave: + m_infocenterState->m_state = InfocenterState::e_notRegistered; if (!m_infocenterState->HasRegistered()) { m_bookAnimationTimer = 1; } @@ -467,7 +468,7 @@ void Infocenter::ReadyWorld() PlayMusic(JukeboxScript::c_InformationCenter_Music); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); return; - case 5: + case InfocenterState::e_selectedCharacterAndDestination: default: { PlayMusic(JukeboxScript::c_InformationCenter_Music); @@ -486,13 +487,13 @@ void Infocenter::ReadyWorld() break; } - case 8: + case InfocenterState::e_exitQueried: PlayMusic(JukeboxScript::c_InformationCenter_Music); PlayAction(InfomainScript::c_iic043in_RunAnim); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); return; - case 0xf: - m_infocenterState->m_unk0x74 = 2; + case InfocenterState::e_backToInfoAct1: + m_infocenterState->m_state = InfocenterState::e_notRegistered; if (!m_infocenterState->HasRegistered()) { m_bookAnimationTimer = 1; } @@ -504,7 +505,7 @@ void Infocenter::ReadyWorld() } break; case LegoGameState::e_act2: { - if (m_infocenterState->m_unk0x74 == 8) { + if (m_infocenterState->m_state == InfocenterState::e_exitQueried) { PlayMusic(JukeboxScript::c_InformationCenter_Music); bgRed->Enable(TRUE); PlayAction(InfomainScript::c_iic043in_RunAnim); @@ -518,11 +519,11 @@ void Infocenter::ReadyWorld() if (state && state->GetUnknown0x08() == 0x68) { bg->Enable(TRUE); PlayCutscene(e_badEndMovie, TRUE); - m_infocenterState->m_unk0x74 = 0; + m_infocenterState->m_state = InfocenterState::e_playCutscene; return; } - if (m_infocenterState->m_unk0x74 == 4) { + if (m_infocenterState->m_state == InfocenterState::e_selectedSave) { bgRed->Enable(TRUE); if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) { @@ -531,7 +532,7 @@ void Infocenter::ReadyWorld() GameState()->m_currentArea = LegoGameState::e_infomain; } - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = LegoGameState::e_act2main; InfomainScript::Script script = m_infocenterState->GetNextReturnDialogue(); @@ -549,7 +550,7 @@ void Infocenter::ReadyWorld() break; } case LegoGameState::e_act3: { - if (m_infocenterState->m_unk0x74 == 8) { + if (m_infocenterState->m_state == InfocenterState::e_exitQueried) { PlayMusic(JukeboxScript::c_InformationCenter_Music); bgRed->Enable(TRUE); PlayAction(InfomainScript::c_iic043in_RunAnim); @@ -563,18 +564,18 @@ void Infocenter::ReadyWorld() if (state && state->GetUnknown0x08() == 3) { bg->Enable(TRUE); PlayCutscene(e_badEndMovie, TRUE); - m_infocenterState->m_unk0x74 = 0; + m_infocenterState->m_state = InfocenterState::e_playCutscene; return; } if (state && state->GetUnknown0x08() == 2) { bg->Enable(TRUE); PlayCutscene(e_goodEndMovie, TRUE); - m_infocenterState->m_unk0x74 = 0; + m_infocenterState->m_state = InfocenterState::e_playCutscene; return; } - if (m_infocenterState->m_unk0x74 == 4) { + if (m_infocenterState->m_state == InfocenterState::e_selectedSave) { bgRed->Enable(TRUE); if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) { @@ -583,7 +584,7 @@ void Infocenter::ReadyWorld() GameState()->m_currentArea = LegoGameState::e_infomain; } - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = LegoGameState::e_act3script; InfomainScript::Script script = m_infocenterState->GetNextReturnDialogue(); @@ -602,7 +603,7 @@ void Infocenter::ReadyWorld() } } - m_infocenterState->m_unk0x74 = 11; + m_infocenterState->m_state = InfocenterState::e_welcomeAnimation; Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } @@ -701,37 +702,37 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key) MxLong result = 0; if (p_key == VK_SPACE && m_worldStarted) { - switch (m_infocenterState->m_unk0x74) { - case 0: + switch (m_infocenterState->m_state) { + case InfocenterState::e_playCutscene: StopCutscene(); - m_infocenterState->m_unk0x74 = 1; + m_infocenterState->m_state = InfocenterState::e_introCancelled; if (!m_infocenterState->HasRegistered()) { m_bookAnimationTimer = 1; return 1; } break; - case 1: - case 4: + case InfocenterState::e_introCancelled: + case InfocenterState::e_selectedSave: break; default: { InfomainScript::Script script = m_currentInfomainScript; StopCurrentAction(); - switch (m_infocenterState->m_unk0x74) { - case 5: - case 12: + switch (m_infocenterState->m_state) { + case InfocenterState::e_selectedCharacterAndDestination: + case InfocenterState::e_exiting: m_currentInfomainScript = script; return 1; default: - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; return 1; - case 8: - case 11: + case InfocenterState::e_exitQueried: + case InfocenterState::e_welcomeAnimation: break; } } - case 13: + case InfocenterState::e_playCredits: StopCredits(); break; } @@ -842,37 +843,37 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) case InfocenterMapEntry::e_jetrace: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_jetraceExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; case InfocenterMapEntry::e_carrace: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_carraceExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; case InfocenterMapEntry::e_pizzeria: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_pizzeriaExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; case InfocenterMapEntry::e_garage: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_garageExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; case InfocenterMapEntry::e_hospital: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_hospitalExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; case InfocenterMapEntry::e_police: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_policeExterior; - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; } break; } @@ -882,13 +883,13 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_dragPresenter->Enable(FALSE); m_dragPresenter = NULL; - if (m_infocenterState->m_unk0x74 == 5) { + if (m_infocenterState->m_state == InfocenterState::e_selectedCharacterAndDestination) { InfomainScript::Script dialogueToPlay; if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { if (!m_infocenterState->HasRegistered()) { dialogueToPlay = InfomainScript::c_iic007in_PlayWav; - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; m_destLocation = LegoGameState::e_undefined; } else { @@ -952,7 +953,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case InfomainScript::c_LeftArrow_Ctl: - m_infocenterState->m_unk0x74 = 14; + m_infocenterState->m_state = InfocenterState::e_exitingToIsland; StopCurrentAction(); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { @@ -967,7 +968,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) break; case InfomainScript::c_RightArrow_Ctl: - m_infocenterState->m_unk0x74 = 14; + m_infocenterState->m_state = InfocenterState::e_exitingToIsland; StopCurrentAction(); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { @@ -986,10 +987,10 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) m_radio.Stop(); break; case InfomainScript::c_Door_Ctl: - if (m_infocenterState->m_unk0x74 != 8) { + if (m_infocenterState->m_state != InfocenterState::e_exitQueried) { actionToPlay = InfomainScript::c_iic043in_RunAnim; m_radio.Stop(); - m_infocenterState->m_unk0x74 = 8; + m_infocenterState->m_state = InfocenterState::e_exitQueried; } break; @@ -1025,7 +1026,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) case LegoGameState::e_infodoor: case LegoGameState::e_regbook: case LegoGameState::e_infoscor: - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = state->m_previousArea; actionToPlay = (InfomainScript::Script) m_infocenterState->GetNextLeaveDialogue(); m_radio.Stop(); @@ -1044,10 +1045,10 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) if (state->GetActorId() != LegoActor::c_none) { if (!m_infocenterState->HasRegistered()) { PlayAction(InfomainScript::c_iic007in_PlayWav); - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; } else { - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = state->m_previousArea; actionToPlay = (InfomainScript::Script) m_infocenterState->GetNextLeaveDialogue(); m_radio.Stop(); @@ -1060,14 +1061,14 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) } break; case LegoGameState::e_act2: - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = LegoGameState::e_act2main; actionToPlay = (InfomainScript::Script) m_infocenterState->GetNextLeaveDialogue(); InputManager()->DisableInputProcessing(); InputManager()->SetUnknown336(TRUE); break; case LegoGameState::e_act3: - m_infocenterState->m_unk0x74 = 5; + m_infocenterState->m_state = InfocenterState::e_selectedCharacterAndDestination; m_destLocation = LegoGameState::e_act3script; actionToPlay = (InfomainScript::Script) m_infocenterState->GetNextLeaveDialogue(); InputManager()->DisableInputProcessing(); @@ -1077,7 +1078,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) break; case InfomainScript::c_Book_Ctl: m_destLocation = LegoGameState::e_regbook; - m_infocenterState->m_unk0x74 = 4; + m_infocenterState->m_state = InfocenterState::e_selectedSave; actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? InfomainScript::c_GoTo_RegBook_Red : InfomainScript::c_GoTo_RegBook; m_radio.Stop(); @@ -1128,13 +1129,13 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param) MxCore* sender = p_param.GetSender(); if (sender == NULL) { - if (m_infocenterState->m_unk0x74 == 8) { + if (m_infocenterState->m_state == InfocenterState::e_exitQueried) { m_infoManDialogueTimer = 0; StopCutscene(); PlayAction(InfomainScript::c_iic043in_RunAnim); } } - else if (sender->IsA("MxEntity") && m_infocenterState->m_unk0x74 != 5 && m_infocenterState->m_unk0x74 != 12) { + else if (sender->IsA("MxEntity") && m_infocenterState->m_state != InfocenterState::e_selectedCharacterAndDestination && m_infocenterState->m_state != InfocenterState::e_exiting) { switch (((MxEntity*) sender)->GetEntityId()) { case 5: { m_infoManDialogueTimer = 0; @@ -1153,21 +1154,21 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param) return 1; } case 6: - if (m_infocenterState->m_unk0x74 == 8) { + if (m_infocenterState->m_state == InfocenterState::e_exitQueried) { StopCurrentAction(); SetROIVisible(g_object2x4red, FALSE); SetROIVisible(g_object2x4grn, FALSE); - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; PlayAction(InfomainScript::c_iicb28in_RunAnim); return 1; } case 7: - if (m_infocenterState->m_unk0x74 == 8) { + if (m_infocenterState->m_state == InfocenterState::e_exitQueried) { if (m_infocenterState->HasRegistered()) { GameState()->Save(0); } - m_infocenterState->m_unk0x74 = 12; + m_infocenterState->m_state = InfocenterState::e_exiting; PlayAction(InfomainScript::c_iic046in_RunAnim); InputManager()->DisableInputProcessing(); InputManager()->SetUnknown336(TRUE); @@ -1409,17 +1410,17 @@ void Infocenter::Reset() MxBool Infocenter::Escape() { if (m_infocenterState != NULL) { - MxU32 val = m_infocenterState->m_unk0x74; + MxU32 val = m_infocenterState->m_state; - if (val == 0) { + if (val == InfocenterState::e_playCutscene) { StopCutscene(); - m_infocenterState->m_unk0x74 = 1; + m_infocenterState->m_state = InfocenterState::e_introCancelled; } - else if (val == 13) { + else if (val == InfocenterState::e_playCredits) { StopCredits(); } - else if (val != 8) { - m_infocenterState->m_unk0x74 = 8; + else if (val != InfocenterState::e_exitQueried) { + m_infocenterState->m_state = InfocenterState::e_exitQueried; #ifdef COMPAT_MODE { diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 307206ce..42f5c90c 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -238,10 +238,10 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { - m_infocenterState->m_unk0x74 = 15; + m_infocenterState->m_state = InfocenterState::e_backToInfoAct1; } else { - m_infocenterState->m_unk0x74 = 2; + m_infocenterState->m_state = InfocenterState::e_notRegistered; } TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -323,7 +323,7 @@ void RegistrationBook::FUN_100775c0(MxS16 p_playerIndex) break; } - m_infocenterState->m_unk0x74 = 4; + m_infocenterState->m_state = InfocenterState::e_selectedSave; if (m_unk0x2b8 == 0 && !m_unk0x2c1) { DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); From 9f242021a411e4f4d2ad6189ec760ffacd158529 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sun, 27 Jul 2025 17:27:51 +0200 Subject: [PATCH 6/7] Clear unknowns in `MxSmkPresenter` and `MxLoopingSmkPresenter` (#1658) --- LEGO1/omni/include/mxloopingsmkpresenter.h | 12 ++++++------ LEGO1/omni/include/mxsmkpresenter.h | 2 +- LEGO1/omni/src/video/mxloopingsmkpresenter.cpp | 6 +++--- LEGO1/omni/src/video/mxsmkpresenter.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/LEGO1/omni/include/mxloopingsmkpresenter.h b/LEGO1/omni/include/mxloopingsmkpresenter.h index 01200170..b1de63fe 100644 --- a/LEGO1/omni/include/mxloopingsmkpresenter.h +++ b/LEGO1/omni/include/mxloopingsmkpresenter.h @@ -25,12 +25,12 @@ class MxLoopingSmkPresenter : public MxSmkPresenter { return HandlerClassName(); } - void RepeatingTickle() override; // vtable+0x24 - MxResult AddToManager() override; // vtable+0x34 - void Destroy() override; // vtable+0x38 - void NextFrame() override; // vtable+0x64 - void VTable0x88() override; // vtable+0x88 - virtual void VTable0x8c(); // vtable+0x8c + void RepeatingTickle() override; // vtable+0x24 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void NextFrame() override; // vtable+0x64 + void ResetCurrentFrameAtEnd() override; // vtable+0x88 + virtual void LoadFrameIfRequired(); // vtable+0x8c private: void Init(); diff --git a/LEGO1/omni/include/mxsmkpresenter.h b/LEGO1/omni/include/mxsmkpresenter.h index 53f7831f..7becc7cc 100644 --- a/LEGO1/omni/include/mxsmkpresenter.h +++ b/LEGO1/omni/include/mxsmkpresenter.h @@ -38,7 +38,7 @@ class MxSmkPresenter : public MxVideoPresenter { void CreateBitmap() override; // vtable+0x60 void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 void RealizePalette() override; // vtable+0x70 - virtual void VTable0x88(); // vtable+0x88 + virtual void ResetCurrentFrameAtEnd(); // vtable+0x88 // SYNTHETIC: LEGO1 0x100b3850 // MxSmkPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index 27d1f0b9..f23714a9 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -39,7 +39,7 @@ void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x100b4a00 -void MxLoopingSmkPresenter::VTable0x88() +void MxLoopingSmkPresenter::ResetCurrentFrameAtEnd() { if (m_mxSmk.m_smackTag.Frames == m_currentFrame) { m_currentFrame = 0; @@ -66,7 +66,7 @@ void MxLoopingSmkPresenter::NextFrame() } // FUNCTION: LEGO1 0x100b4a90 -void MxLoopingSmkPresenter::VTable0x8c() +void MxLoopingSmkPresenter::LoadFrameIfRequired() { if (m_action->GetDuration() < m_elapsedDuration) { ProgressTickleState(e_freezing); @@ -110,7 +110,7 @@ void MxLoopingSmkPresenter::RepeatingTickle() break; } - VTable0x8c(); + LoadFrameIfRequired(); m_loopingChunkCursor->Next(chunk); diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index 748ad1df..9955faab 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -70,7 +70,7 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) MxBool paletteChanged = m_mxSmk.m_frameTypes[m_currentFrame] & 1; m_currentFrame++; - VTable0x88(); + ResetCurrentFrameAtEnd(); MxRect32List rects(TRUE); MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, &rects); @@ -91,11 +91,11 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) } // FUNCTION: LEGO1 0x100b4260 -void MxSmkPresenter::VTable0x88() +void MxSmkPresenter::ResetCurrentFrameAtEnd() { if ((m_mxSmk.m_smackTag.SmackerType & 1) != 0) { - MxU32 und = (m_currentFrame % m_mxSmk.m_smackTag.Frames); - if (1 < m_currentFrame && und == 1) { + MxU32 validCurrentFrame = (m_currentFrame % m_mxSmk.m_smackTag.Frames); + if (1 < m_currentFrame && validCurrentFrame == 1) { m_currentFrame = 1; } } From 5495da6c5395753f1f32bb50b62819f77a41a64a Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sun, 27 Jul 2025 17:28:17 +0200 Subject: [PATCH 7/7] Clear unknown in `MxLoopingFlcPresenter` (#1659) --- LEGO1/omni/include/mxloopingflcpresenter.h | 10 +++++----- LEGO1/omni/src/video/mxloopingflcpresenter.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LEGO1/omni/include/mxloopingflcpresenter.h b/LEGO1/omni/include/mxloopingflcpresenter.h index 08232aa4..65361702 100644 --- a/LEGO1/omni/include/mxloopingflcpresenter.h +++ b/LEGO1/omni/include/mxloopingflcpresenter.h @@ -25,11 +25,11 @@ class MxLoopingFlcPresenter : public MxFlcPresenter { return HandlerClassName(); } - void RepeatingTickle() override; // vtable+0x24 - MxResult AddToManager() override; // vtable+0x34 - void Destroy() override; // vtable+0x38 - void NextFrame() override; // vtable+0x64 - virtual void VTable0x88(); // vtable+0x88 + void RepeatingTickle() override; // vtable+0x24 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void NextFrame() override; // vtable+0x64 + virtual void LoadFrameIfRequired(); // vtable+0x88 // SYNTHETIC: LEGO1 0x100b4390 // MxLoopingFlcPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index c1ebb2cd..c5f9c568 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -56,7 +56,7 @@ void MxLoopingFlcPresenter::NextFrame() } // FUNCTION: LEGO1 0x100b44c0 -void MxLoopingFlcPresenter::VTable0x88() +void MxLoopingFlcPresenter::LoadFrameIfRequired() { if (m_action->GetDuration() < m_elapsedDuration) { ProgressTickleState(e_freezing); @@ -100,7 +100,7 @@ void MxLoopingFlcPresenter::RepeatingTickle() break; } - VTable0x88(); + LoadFrameIfRequired(); m_loopingChunkCursor->Next(chunk);