diff --git a/CMakeLists.txt b/CMakeLists.txt index 143f3068..fadc7ffb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,7 +327,7 @@ target_sources(lego1 PRIVATE LEGO1/omni/src/entity/mxentity.cpp LEGO1/omni/src/event/mxeventmanager.cpp LEGO1/omni/src/event/mxeventpresenter.cpp - LEGO1/omni/src/main/mxomni.cpp + LEGO1/omni/src/main/mxmain.cpp LEGO1/omni/src/main/mxomnicreateflags.cpp LEGO1/omni/src/main/mxomnicreateparam.cpp LEGO1/omni/src/notify/mxactionnotificationparam.cpp diff --git a/ISLE/emscripten/filesystem.cpp b/ISLE/emscripten/filesystem.cpp index 740802b8..c2bfbc37 100644 --- a/ISLE/emscripten/filesystem.cpp +++ b/ISLE/emscripten/filesystem.cpp @@ -4,7 +4,7 @@ #include "extensions/textureloader.h" #include "legogamestate.h" #include "misc.h" -#include "mxomni.h" +#include "mxmain.h" #include #include diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index aa0befd1..2839bc88 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/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 4d27695c..355b9715 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -59,7 +59,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 7d4fd5b2..c5cb23af 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -5,7 +5,7 @@ #include "lego1_export.h" #include "legoutils.h" #include "mxdsaction.h" -#include "mxomni.h" +#include "mxmain.h" #include #include @@ -114,6 +114,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); @@ -153,9 +154,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; } @@ -204,6 +210,7 @@ class LegoOmni : public MxOmni { MxBool IsVersion10() { return m_version10; } // SYNTHETIC: LEGO1 0x10058b30 + // SYNTHETIC: BETA10 0x1008f8d0 // LegoOmni::`scalar deleting destructor' private: 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/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 3cdb5105..dc468dfd 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -32,7 +32,7 @@ class LEGO1_EXPORT 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 ff5f9ae3..b6ad3866 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -27,6 +27,7 @@ class Renderer; } // VTABLE: LEGO1 0x100d9c88 +// VTABLE: BETA10 0x101bef08 // SIZE 0x590 class LegoVideoManager : public MxVideoManager { public: @@ -49,6 +50,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); @@ -75,6 +77,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(); @@ -135,7 +141,4 @@ class LegoVideoManager : public MxVideoManager { friend class DebugViewer; }; -// 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/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 572864dc..a6224ccf 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 38a418d4..684b498f 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 864659da..8203a0df 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 d5bd05af..fb25945f 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/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/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 330b4179..90ea44c6 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2818,7 +2818,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; @@ -2839,11 +2843,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/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 8dae5d61..f82747bf 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 a67f7e08..206d03ff 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/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index ae11da97..79bcb6cf 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -87,7 +87,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/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index 7431033e..7e3d9294 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -22,6 +22,7 @@ MxTransitionManager::TransitionType g_transitionManagerConfig = MxTransitionMana 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/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index c1cfc87a..8ad9b428 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -672,10 +672,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/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 61dfa9bc..39a97cc0 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -28,6 +28,7 @@ const char* g_clickedAtom = NULL; MxBool g_unk0x100f67b8 = TRUE; // FUNCTION: LEGO1 0x1005b790 +// STUB: BETA10 0x10088a8e LegoInputManager::LegoInputManager() { m_keyboardNotifyList = NULL; @@ -55,11 +56,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 e2105797..4a2da536 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -41,6 +41,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"; @@ -51,12 +52,14 @@ LegoOmni::LegoOmni() } // FUNCTION: LEGO1 0x10058b50 +// FUNCTION: BETA10 0x1008d128 LegoOmni::~LegoOmni() { Destroy(); } // FUNCTION: LEGO1 0x10058bd0 +// FUNCTION: BETA10 0x1008d1b4 void LegoOmni::Init() { MxOmni::Init(); @@ -80,6 +83,7 @@ void LegoOmni::Init() } // FUNCTION: LEGO1 0x10058c30 +// STUB: BETA10 0x1008d299 void LegoOmni::Destroy() { AUTOLOCK(m_criticalSection); @@ -157,13 +161,19 @@ 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) { MxResult result = FAILURE; AUTOLOCK(m_criticalSection); - HWND hWnd = NULL; p_param.CreateFlags().CreateObjectFactory(FALSE); p_param.CreateFlags().CreateVideoManager(FALSE); @@ -179,19 +189,19 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxOmni"); goto done; } - + // LINE: BETA10 0x1008d7fa if (!(m_objectFactory = new LegoObjectFactory())) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoObjectFactory"); goto done; } - + // LINE: BETA10 0x1008d882 if (!(m_soundManager = new LegoSoundManager()) || m_soundManager->Create(10, 0) != SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoSoundManager"); 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) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoVideoManager"); @@ -199,24 +209,51 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) m_videoManager = NULL; goto done; } - + // LINE: BETA10 0x1008daa7 if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(p_param.GetWindowHandle()) != SUCCESS) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoInputManager"); 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 || @@ -230,33 +267,51 @@ 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) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create VisibilityVariable"); goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(visibilityVar); - if (!(variable = new CameraLocationVariable())) { + // LINE: BETA10 0x1008e031 + cameraLocationVar = new CameraLocationVariable(); + if (!cameraLocationVar) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create CameraLocationVariable"); goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(cameraLocationVar); - if (!(variable = new CursorVariable())) { + // LINE: BETA10 0x1008e0a5 + cursorVar = new CursorVariable(); + if (!cursorVar) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create CursorVariable"); goto done; } - m_variableTable->SetVariable(variable); + m_variableTable->SetVariable(cursorVar); - if (!(variable = new WhoAmIVariable())) { + // LINE: BETA10 0x1008e119 + whoAmIVar = new WhoAmIVariable(); + if (!whoAmIVar) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create WhoAmIVariable"); 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(); @@ -264,30 +319,41 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create RegisterWorlds"); goto done; } +#endif - if (!(m_bkgAudioManager = new MxBackgroundAudioManager())) { + // LINE: BETA10 0x1008e206 + m_bkgAudioManager = new MxBackgroundAudioManager(); + if (!m_bkgAudioManager) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxBackgroundAudioManager"); goto done; } - if (!(m_transitionManager = new MxTransitionManager())) { + // LINE: BETA10 0x1008e27d + m_transitionManager = new MxTransitionManager(); + + if (m_transitionManager) { + if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxTransitionManager::GetDDrawSurfaceFromVideoManager failed"); + 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; + } + else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxTransitionManager"); - goto done; } - - if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxTransitionManager::GetDDrawSurfaceFromVideoManager failed"); - 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 @@ -402,6 +468,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) { @@ -454,15 +521,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 (SDL_strcasecmp(p_id, g_current)) { world = FindWorld(MxAtomId(p_id, e_lowerCase2), p_entityId); } else { - world = this->m_currentWorld; + world = GetCurrentWorld(); } if (world != NULL) { @@ -473,14 +541,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)) { @@ -586,12 +657,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/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 25ec48a4..8f918c8b 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -46,7 +46,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/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index 53c79a5f..fe56a353 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -28,6 +28,7 @@ DECOMP_SIZE_ASSERT(MxStopWatch, 0x18) DECOMP_SIZE_ASSERT(MxFrequencyMeter, 0x20) // FUNCTION: LEGO1 0x1007aa20 +// FUNCTION: BETA10 0x100d5a00 LegoVideoManager::LegoVideoManager() { m_renderer = NULL; @@ -296,12 +297,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(); @@ -467,6 +471,7 @@ void LegoVideoManager::DrawFPS() } // FUNCTION: LEGO1 0x1007c080 +// FUNCTION: BETA10 0x100d6d28 MxPresenter* LegoVideoManager::GetPresenterAt(MxS32 p_x, MxS32 p_y) { MxPresenterListCursor cursor(m_presenters); @@ -504,6 +509,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()) { @@ -605,6 +611,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/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 8e839e3c..4a473611 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -782,6 +782,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); @@ -795,6 +796,10 @@ void Act3::GoodEnding(const Matrix4& p_destination) ); EmitGameEvent(e_goodEnding); +#else + m_state->m_unk0x08 = 2; + GameState()->SwitchArea(LegoGameState::Area::e_infomain); +#endif } // FUNCTION: LEGO1 0x10073500 diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 141b8f85..3e4eb728 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(); @@ -346,8 +347,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); @@ -357,13 +358,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; @@ -371,7 +372,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; @@ -380,8 +381,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: @@ -396,30 +397,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 && @@ -429,10 +430,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); } @@ -459,13 +460,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; } @@ -474,7 +475,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); @@ -493,13 +494,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; } @@ -511,7 +512,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); @@ -525,11 +526,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()) { @@ -538,7 +539,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(); @@ -556,7 +557,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); @@ -570,18 +571,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()) { @@ -590,7 +591,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(); @@ -609,7 +610,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); } @@ -708,37 +709,37 @@ MxLong Infocenter::HandleKeyPress(SDL_Keycode p_key) MxLong result = 0; if (p_key == SDLK_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; } @@ -849,37 +850,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; } @@ -889,13 +890,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 { @@ -959,7 +960,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) { @@ -974,7 +975,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) { @@ -993,10 +994,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; @@ -1032,7 +1033,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(); @@ -1051,10 +1052,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(); @@ -1067,14 +1068,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(); @@ -1084,7 +1085,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(); @@ -1135,13 +1136,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; @@ -1160,21 +1161,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); @@ -1416,17 +1417,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 ddd3b7cf..28407834 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -262,10 +262,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); @@ -355,7 +355,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); @@ -682,12 +682,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/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/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/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 260e51e5..4ebe1f5f 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -411,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); @@ -420,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/lego1_pch.h b/LEGO1/lego1_pch.h index 40c5db6c..0797d498 100644 --- a/LEGO1/lego1_pch.h +++ b/LEGO1/lego1_pch.h @@ -236,6 +236,7 @@ #include "omni/include/mxlist.h" #include "omni/include/mxloopingflcpresenter.h" #include "omni/include/mxloopingsmkpresenter.h" +#include "omni/include/mxmain.h" #include "omni/include/mxmediapresenter.h" #include "omni/include/mxmemorypool.h" #include "omni/include/mxmisc.h" @@ -243,7 +244,6 @@ #include "omni/include/mxnotificationmanager.h" #include "omni/include/mxnotificationparam.h" #include "omni/include/mxobjectfactory.h" -#include "omni/include/mxomni.h" #include "omni/include/mxomnicreateflags.h" #include "omni/include/mxomnicreateparam.h" #include "omni/include/mxpalette.h" diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 96437e7a..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 @@ -780,6 +783,64 @@ // LIBRARY: BETA10 0x100fa200 // strcpy +// 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 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/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/mxomni.h b/LEGO1/omni/include/mxmain.h similarity index 97% rename from LEGO1/omni/include/mxomni.h rename to LEGO1/omni/include/mxmain.h index 0e6bd07c..c9d20482 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 "lego1_export.h" #include "mxcore.h" @@ -32,6 +32,7 @@ class MxVariableTable; class MxVideoManager; // VTABLE: LEGO1 0x100dc168 +// VTABLE: BETA10 0x101c1c40 // SIZE 0x68 class MxOmni : public MxCore { public: @@ -103,6 +104,7 @@ class MxOmni : public MxCore { MxLong HandleEndAction(MxParam& p_param); // SYNTHETIC: LEGO1 0x100aefd0 + // SYNTHETIC: BETA10 0x10130c90 // MxOmni::`scalar deleting destructor' protected: @@ -128,4 +130,4 @@ class MxOmni : public MxCore { MxBool m_paused; // 0x64 }; -#endif // MXOMNI_H +#endif // MXMAIN_H diff --git a/LEGO1/omni/include/mxomnicreateparam.h b/LEGO1/omni/include/mxomnicreateparam.h index 25c0d9cf..f92b089b 100644 --- a/LEGO1/omni/include/mxomnicreateparam.h +++ b/LEGO1/omni/include/mxomnicreateparam.h @@ -24,8 +24,13 @@ class MxOmniCreateParam : public MxParam { MxOmniCreateFlags& CreateFlags() { return this->m_createFlags; } const MxString& GetMediaPath() const { return m_mediaPath; } - HWND GetWindowHandle() const { return m_windowHandle; } + + // 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/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/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index b380a3a7..45163de0 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -46,10 +46,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 @@ -119,17 +119,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' @@ -142,10 +142,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/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index dab79698..39091e8f 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 8601f44b..83e1f7c7 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 98e21f89..a6f3f7e0 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 0b2648bb..572dde35 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -12,10 +12,10 @@ #include "mxflcpresenter.h" #include "mxloopingflcpresenter.h" #include "mxloopingsmkpresenter.h" +#include "mxmain.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/common/mxstring.cpp b/LEGO1/omni/src/common/mxstring.cpp index e8167a0c..fc63d70b 100644 --- a/LEGO1/omni/src/common/mxstring.cpp +++ b/LEGO1/omni/src/common/mxstring.cpp @@ -1,7 +1,7 @@ #include "mxstring.h" #include "decomp.h" -#include "mxomni.h" +#include "mxmain.h" #include #include diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxmain.cpp similarity index 97% rename from LEGO1/omni/src/main/mxomni.cpp rename to LEGO1/omni/src/main/mxmain.cpp index c314c7a8..dc146927 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" @@ -42,23 +42,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; @@ -224,6 +228,7 @@ void MxOmni::Destroy() } // FUNCTION: LEGO1 0x100b0090 +// STUB: BETA10 0x101303ce MxResult MxOmni::Start(MxDSAction* p_dsAction) { MxResult result = FAILURE; @@ -235,6 +240,7 @@ MxResult MxOmni::Start(MxDSAction* p_dsAction) } // FUNCTION: LEGO1 0x100b00c0 +// FUNCTION: BETA10 0x101304aa void MxOmni::DeleteObject(MxDSAction& p_dsAction) { if (m_streamer != NULL) { @@ -243,6 +249,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; @@ -323,6 +330,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); @@ -399,6 +407,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/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 49980ee1..b3fad5fc 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 3634b6c7..0d49741a 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 966bec95..ecd1a6f9 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" #include "mxutilities.h" diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 51a2f36b..71a3808e 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/mxflcpresenter.cpp b/LEGO1/omni/src/video/mxflcpresenter.cpp index 1bc8462e..4bb95fbb 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..c5f9c568 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 @@ -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); @@ -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); @@ -100,7 +100,7 @@ void MxLoopingFlcPresenter::RepeatingTickle() break; } - VTable0x88(); + LoadFrameIfRequired(); m_loopingChunkCursor->Next(chunk); diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index b3705685..a74196b4 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 @@ -39,7 +39,7 @@ void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x100b4a00 -void MxLoopingSmkPresenter::VTable0x88() +void MxLoopingSmkPresenter::ResetCurrentFrameAtEnd() { // [library:libsmacker] Figure out if this functionality is still required } @@ -62,7 +62,7 @@ void MxLoopingSmkPresenter::NextFrame() } // FUNCTION: LEGO1 0x100b4a90 -void MxLoopingSmkPresenter::VTable0x8c() +void MxLoopingSmkPresenter::LoadFrameIfRequired() { if (m_action->GetDuration() < m_elapsedDuration) { ProgressTickleState(e_freezing); @@ -78,7 +78,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); @@ -106,7 +106,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 2eadc6bf..42164c87 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -27,8 +27,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 @@ -75,7 +75,7 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) MxBool paletteChanged; m_currentFrame++; - VTable0x88(); + ResetCurrentFrameAtEnd(); MxRect32List rects(TRUE); MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, m_currentFrame - 1, &rects); @@ -96,7 +96,7 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) } // FUNCTION: LEGO1 0x100b4260 -void MxSmkPresenter::VTable0x88() +void MxSmkPresenter::ResetCurrentFrameAtEnd() { // [library:libsmacker] Figure out if this functionality is still required } diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 2bcaea47..53a0427a 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" @@ -81,12 +81,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 ); @@ -96,11 +96,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); } } } @@ -198,7 +198,7 @@ void MxStillPresenter::ParseExtra() MxPresenter::ParseExtra(); if (m_action->GetFlags() & MxDSAction::c_bit5) { - SetBit3(TRUE); + SetDoNotWriteToSurface(TRUE); } MxU16 extraLength; @@ -218,9 +218,9 @@ void MxStillPresenter::ParseExtra() } if (KeyValueStringParse(output, g_strBMP_ISMAP, extraCopy)) { - SetBit4(TRUE); - SetBit1(FALSE); - SetBit2(FALSE); + SetBitmapIsMap(TRUE); + SetUseSurface(FALSE); + SetUseVideoMemory(FALSE); } } } @@ -236,11 +236,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; @@ -250,8 +250,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/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index e56cb48e..40078e66 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" @@ -15,6 +15,7 @@ DECOMP_SIZE_ASSERT(MxVideoManager, 0x64) // FUNCTION: LEGO1 0x100be1f0 +// STUB: BETA10 0x1012ca40 MxVideoManager::MxVideoManager() { Init(); diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index e5ed4564..38662f05 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 { @@ -277,7 +277,7 @@ void MxVideoPresenter::PutFrame() else { RECT src, dest; - if (m_unk0x58) { + if (m_surface) { src.left = 0; src.top = 0; src.right = GetWidth(); @@ -290,18 +290,18 @@ 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 { displaySurface->VTable0x30(m_frameBitmap, 0, 0, GetX(), GetY(), GetWidth(), GetHeight(), FALSE); } } - else if (m_unk0x58) { + else if (m_surface) { if (PrepareRects(src, dest) >= 0) { - ddSurface->Blt(&dest, m_unk0x58, &src, DDBLT_NONE, NULL); + ddSurface->Blt(&dest, m_surface, &src, DDBLT_NONE, NULL); } } else { @@ -348,7 +348,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(); @@ -364,15 +364,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; } } } @@ -392,7 +392,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(); @@ -407,15 +407,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; } } } @@ -428,11 +428,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); } }