From 516e16faf68f7f7715bb77207028bce5471d0f04 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 11 Jan 2024 10:02:55 -0500 Subject: [PATCH] Further clean up Omni/LegoOmni separation (#423) * Fix inline functions * Whitespace * Try this * Fix MxEntity * Further fixes * Move main out * Replace tickle code --- CMakeLists.txt | 4 +- LEGO1/lego/legoomni/include/legoomni.h | 2 +- .../legoomni}/include/mxcontrolpresenter.h | 0 .../src/common/legoactioncontrolpresenter.cpp | 6 +- .../src/common/mxcompositemediapresenter.cpp | 6 +- .../src/control/mxcontrolpresenter.cpp | 4 +- .../src/entity/legoentitypresenter.cpp | 3 +- .../src/entity/legoworldpresenter.cpp | 6 +- LEGO1/lego/legoomni/src/main/legoomni.cpp | 20 ++-- .../src/video/legopalettepresenter.cpp | 4 +- LEGO1/{omni/src/main/mxmain.cpp => main.cpp} | 0 .../omni/include/mxactionnotificationparam.h | 17 +++- LEGO1/omni/include/mxaudiomanager.h | 8 +- LEGO1/omni/include/mxaudiopresenter.h | 7 +- LEGO1/omni/include/mxbitmap.h | 5 +- LEGO1/omni/include/mxcompositepresenter.h | 9 +- LEGO1/omni/include/mxcore.h | 4 +- LEGO1/omni/include/mxentity.h | 16 +++- LEGO1/omni/include/mxmediapresenter.h | 15 ++- LEGO1/omni/include/mxnotificationparam.h | 6 +- LEGO1/omni/include/mxomni.h | 6 +- LEGO1/omni/include/mxpresenter.h | 77 ++++++++++++---- LEGO1/omni/include/mxsoundpresenter.h | 7 +- LEGO1/omni/include/mxstillpresenter.h | 13 ++- LEGO1/omni/include/mxvariable.h | 12 ++- LEGO1/omni/include/mxvideopresenter.h | 61 ++++++++---- LEGO1/omni/include/mxwavepresenter.h | 25 +++-- LEGO1/omni/src/audio/mxaudiomanager.cpp | 6 -- LEGO1/omni/src/audio/mxaudiopresenter.cpp | 12 --- .../omni/src/audio/mxloopingmidipresenter.cpp | 6 +- LEGO1/omni/src/audio/mxmidipresenter.cpp | 15 +-- LEGO1/omni/src/audio/mxsoundpresenter.cpp | 12 --- LEGO1/omni/src/audio/mxwavepresenter.cpp | 24 +---- .../omni/src/common/mxcompositepresenter.cpp | 11 +-- LEGO1/omni/src/common/mxcore.cpp | 6 -- LEGO1/omni/src/common/mxmediapresenter.cpp | 33 ++----- LEGO1/omni/src/common/mxpresenter.cpp | 92 +------------------ LEGO1/omni/src/common/mxvariable.cpp | 18 ---- LEGO1/omni/src/entity/mxentity.cpp | 19 ---- LEGO1/omni/src/event/mxeventpresenter.cpp | 9 +- LEGO1/omni/src/main/mxomni.cpp | 26 ++---- .../src/notify/mxactionnotificationparam.cpp | 12 --- LEGO1/omni/src/notify/mxnotificationparam.cpp | 6 -- LEGO1/omni/src/video/mxbitmap.cpp | 6 -- .../omni/src/video/mxloopingflcpresenter.cpp | 6 +- .../omni/src/video/mxloopingsmkpresenter.cpp | 12 +-- LEGO1/omni/src/video/mxstillpresenter.cpp | 15 +-- LEGO1/omni/src/video/mxvideopresenter.cpp | 81 ++-------------- 48 files changed, 285 insertions(+), 485 deletions(-) rename LEGO1/{omni => lego/legoomni}/include/mxcontrolpresenter.h (100%) rename LEGO1/{omni => lego/legoomni}/src/control/mxcontrolpresenter.cpp (94%) rename LEGO1/{omni/src/main/mxmain.cpp => main.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6378a2b0..a3519ea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/common/legoutil.cpp LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp + LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp LEGO1/lego/legoomni/src/entity/legoactor.cpp LEGO1/lego/legoomni/src/entity/legoanimactor.cpp LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -139,6 +140,7 @@ add_library(lego1 SHARED LEGO1/lego/sources/3dmanager/legoview1.cpp LEGO1/lego/sources/3dmanager/tglsurface.cpp LEGO1/lego/sources/roi/legoroi.cpp + LEGO1/main.cpp LEGO1/mxdirectx/mxdirect3d.cpp LEGO1/mxdirectx/mxdirectdraw.cpp LEGO1/omni/src/action/mxdsaction.cpp @@ -177,11 +179,9 @@ add_library(lego1 SHARED LEGO1/omni/src/common/mxutil.cpp LEGO1/omni/src/common/mxvariable.cpp LEGO1/omni/src/common/mxvariabletable.cpp - LEGO1/omni/src/control/mxcontrolpresenter.cpp LEGO1/omni/src/entity/mxentity.cpp LEGO1/omni/src/event/mxeventmanager.cpp LEGO1/omni/src/event/mxeventpresenter.cpp - LEGO1/omni/src/main/mxmain.cpp LEGO1/omni/src/main/mxomni.cpp LEGO1/omni/src/main/mxomnicreateflags.cpp LEGO1/omni/src/main/mxomnicreateparam.cpp diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index fc9ba1c2..21c84801 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -148,7 +148,6 @@ __declspec(dllexport) LegoOmni* Lego(); __declspec(dllexport) LegoEntity* PickEntity(MxLong, MxLong); __declspec(dllexport) LegoROI* PickROI(MxLong, MxLong); __declspec(dllexport) LegoSoundManager* SoundManager(); -__declspec(dllexport) MxResult Start(MxDSAction*); __declspec(dllexport) MxTransitionManager* TransitionManager(); __declspec(dllexport) LegoVideoManager* VideoManager(); @@ -165,6 +164,7 @@ MxDSAction& GetCurrentAction(); void PlayMusic(MxU32 p_index); void SetIsWorldActive(MxBool p_isWorldActive); +void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); void RegisterScripts(); void UnregisterScripts(); diff --git a/LEGO1/omni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h similarity index 100% rename from LEGO1/omni/include/mxcontrolpresenter.h rename to LEGO1/lego/legoomni/include/mxcontrolpresenter.h diff --git a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp index 3649bb50..75890bec 100644 --- a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp @@ -19,8 +19,7 @@ void LegoActionControlPresenter::ReadyTickle() if (chunk) { ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); m_subscriber->DestroyChunk(chunk); if (m_compositePresenter) { @@ -47,8 +46,7 @@ void LegoActionControlPresenter::RepeatingTickle() #else InvokeAction(m_unk0x50, MxAtomId(m_unk0x54.GetData(), LookupMode_LowerCase2), m_unk0x64, NULL); #endif - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; + ProgressTickleState(TickleState_Done); } } diff --git a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp index 2a15d445..6b0a32ca 100644 --- a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp @@ -123,8 +123,7 @@ void MxCompositeMediaPresenter::StartingTickle() } if (!m_unk0x4c) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; + ProgressTickleState(TickleState_Streaming); MxLong time = Timer()->GetTime(); m_action->SetUnknown90(time); } @@ -138,8 +137,7 @@ MxResult MxCompositeMediaPresenter::Tickle() switch (m_currentTickleState) { case TickleState_Ready: - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); case TickleState_Starting: StartingTickle(); break; diff --git a/LEGO1/omni/src/control/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp similarity index 94% rename from LEGO1/omni/src/control/mxcontrolpresenter.cpp rename to LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp index 2c7fb81d..b7f8fa8e 100644 --- a/LEGO1/omni/src/control/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp @@ -88,9 +88,7 @@ void MxControlPresenter::ReadyTickle() { MxPresenter::ParseExtra(); TickleManager()->UnregisterClient(this); - - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; + ProgressTickleState(TickleState_Repeating); } // STUB: LEGO1 0x10044640 diff --git a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp index 7a586c80..995705bd 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp @@ -69,8 +69,7 @@ void LegoEntityPresenter::ReadyTickle() m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE); ParseExtra(); } - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 02578675..9e5e930c 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -95,8 +95,7 @@ void LegoWorldPresenter::ReadyTickle() } ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } // FUNCTION: LEGO1 0x10066ac0 @@ -116,8 +115,7 @@ void LegoWorldPresenter::StartingTickle() } } - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; + ProgressTickleState(TickleState_Streaming); } // STUB: LEGO1 0x10067a70 diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index 9f27a980..cd0bc4a0 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -241,6 +241,20 @@ void SetIsWorldActive(MxBool p_isWorldActive) g_isWorldActive = p_isWorldActive; } +// FUNCTION: LEGO1 0x100159e0 +void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last) +{ + MxDSAction action; + + action.SetAtomId(*p_id); + action.SetUnknown24(-2); + + for (MxS32 first = p_first, last = p_last; first <= last; first++) { + action.SetObjectId(first); + DeleteObject(action); + } +} + // STUB: LEGO1 0x1001a700 void FUN_1001a700() { @@ -685,9 +699,3 @@ void LegoOmni::StopTimer() MxOmni::StopTimer(); SetAppCursor(0); } - -// FUNCTION: LEGO1 0x100acf50 -MxResult Start(MxDSAction* p_dsAction) -{ - return MxOmni::GetInstance()->Start(p_dsAction); -} diff --git a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp index 821942b9..6fbc7803 100644 --- a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp @@ -76,8 +76,8 @@ void LegoPalettePresenter::ReadyTickle() if (chunk) { if (chunk->GetTime() <= m_action->GetElapsedTime()) { ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); + chunk = m_subscriber->NextChunk(); MxResult result = ParsePalette(chunk); m_subscriber->DestroyChunk(chunk); diff --git a/LEGO1/omni/src/main/mxmain.cpp b/LEGO1/main.cpp similarity index 100% rename from LEGO1/omni/src/main/mxmain.cpp rename to LEGO1/main.cpp diff --git a/LEGO1/omni/include/mxactionnotificationparam.h b/LEGO1/omni/include/mxactionnotificationparam.h index 24d9e5e1..750abd6d 100644 --- a/LEGO1/omni/include/mxactionnotificationparam.h +++ b/LEGO1/omni/include/mxactionnotificationparam.h @@ -43,7 +43,11 @@ class MxActionNotificationParam : public MxNotificationParam { delete this->m_action; } - virtual MxNotificationParam* Clone() override; // vtable+0x4 + // FUNCTION: LEGO1 0x100510c0 + virtual MxNotificationParam* Clone() override + { + return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc); + }; // vtable+0x4 inline MxDSAction* GetAction() { return m_action; } @@ -83,7 +87,16 @@ class MxEndActionNotificationParam : public MxActionNotificationParam { { } - virtual MxNotificationParam* Clone() override; // vtable+0x4 + // FUNCTION: LEGO1 0x10051270 + virtual MxNotificationParam* Clone() override + { + return new MxEndActionNotificationParam( + c_notificationEndAction, + this->m_sender, + this->m_action, + this->m_realloc + ); + }; // vtable+0x4 }; // VTABLE: LEGO1 0x100dc208 diff --git a/LEGO1/omni/include/mxaudiomanager.h b/LEGO1/omni/include/mxaudiomanager.h index c910a493..a7b58fd0 100644 --- a/LEGO1/omni/include/mxaudiomanager.h +++ b/LEGO1/omni/include/mxaudiomanager.h @@ -5,6 +5,7 @@ #include "mxmediamanager.h" // VTABLE: LEGO1 0x100dc6e0 +// SIZE 0x30 class MxAudioManager : public MxMediaManager { public: MxAudioManager(); @@ -12,8 +13,11 @@ class MxAudioManager : public MxMediaManager { virtual MxResult InitPresenters() override; // vtable+14 virtual void Destroy() override; // vtable+18 - virtual MxS32 GetVolume(); // vtable+28 - virtual void SetVolume(MxS32 p_volume); // vtable+2c + + // FUNCTION: LEGO1 0x10029910 + virtual MxS32 GetVolume() { return this->m_volume; }; // vtable+28 + + virtual void SetVolume(MxS32 p_volume); // vtable+2c private: void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/omni/include/mxaudiopresenter.h b/LEGO1/omni/include/mxaudiopresenter.h index 73024aac..4033f84d 100644 --- a/LEGO1/omni/include/mxaudiopresenter.h +++ b/LEGO1/omni/include/mxaudiopresenter.h @@ -23,8 +23,11 @@ class MxAudioPresenter : public MxMediaPresenter { return !strcmp(p_name, MxAudioPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual MxS32 GetVolume(); // vtable+0x5c - virtual void SetVolume(MxS32 p_volume); // vtable+0x60 + // FUNCTION: LEGO1 0x1000d260 + virtual MxS32 GetVolume() { return m_volume; }; // vtable+0x5c + + // FUNCTION: LEGO1 0x1000d270 + virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; }; // vtable+0x60 protected: MxS32 m_volume; diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index d9fda78d..d756b865 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -42,7 +42,10 @@ class MxBitmap : public MxCore { virtual MxResult SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette, MxBool); // vtable+1c virtual MxResult LoadFile(HANDLE p_handle); // vtable+20 __declspec(dllexport) virtual MxLong Read(const char* p_filename); // vtable+24 - virtual int VTable0x28(int); + + // FUNCTION: LEGO1 0x1004e0d0 + virtual int VTable0x28(int) { return -1; }; + virtual void VTable0x2c(int, int, int, int, int, int, int); virtual void VTable0x30(int, int, int, int, int, int, int); __declspec(dllexport) virtual MxPalette* CreatePalette(); // vtable+34 diff --git a/LEGO1/omni/include/mxcompositepresenter.h b/LEGO1/omni/include/mxcompositepresenter.h index 6f14e615..33d00dc8 100644 --- a/LEGO1/omni/include/mxcompositepresenter.h +++ b/LEGO1/omni/include/mxcompositepresenter.h @@ -37,7 +37,14 @@ class MxCompositePresenter : public MxPresenter { virtual void VTable0x58(MxEndActionNotificationParam& p_param); // vtable+0x58 virtual void VTable0x5c(MxNotificationParam& p_param); // vtable+0x5c virtual void VTable0x60(MxPresenter* p_presenter); // vtable+0x60 - virtual MxBool VTable0x64(undefined4 p_undefined); // vtable+0x64 + + // FUNCTION: LEGO1 0x1000caf0 + virtual MxBool VTable0x64(undefined4 p_undefined) + { + if (m_compositePresenter) + return m_compositePresenter->VTable0x64(p_undefined); + return TRUE; + }; // vtable+0x64 protected: MxCompositePresenterList m_list; // 0x40 diff --git a/LEGO1/omni/include/mxcore.h b/LEGO1/omni/include/mxcore.h index db812bba..22c06d32 100644 --- a/LEGO1/omni/include/mxcore.h +++ b/LEGO1/omni/include/mxcore.h @@ -15,7 +15,9 @@ class MxCore { __declspec(dllexport) MxCore(); __declspec(dllexport) virtual ~MxCore(); // vtable+00 __declspec(dllexport) virtual MxLong Notify(MxParam& p_param); // vtable+04 - virtual MxResult Tickle(); // vtable+08 + + // FUNCTION: LEGO1 0x10001f70 + virtual MxResult Tickle() { return SUCCESS; }; // vtable+08 // FUNCTION: LEGO1 0x100144c0 inline virtual const char* ClassName() const // vtable+0c diff --git a/LEGO1/omni/include/mxentity.h b/LEGO1/omni/include/mxentity.h index 64a003ee..2dd9ccf1 100644 --- a/LEGO1/omni/include/mxentity.h +++ b/LEGO1/omni/include/mxentity.h @@ -11,8 +11,11 @@ // SIZE 0x10 class MxEntity : public MxCore { public: - MxEntity(); - virtual ~MxEntity() override; + // FUNCTION: LEGO1 0x1001d190 + MxEntity() { this->m_mxEntityId = -1; } + + // FUNCTION: LEGO1 0x1000c110 + virtual ~MxEntity() override{}; // FUNCTION: LEGO1 0x1000c180 inline virtual const char* ClassName() const override // vtable+0xc @@ -27,7 +30,14 @@ class MxEntity : public MxCore { return !strcmp(p_name, MxEntity::ClassName()) || MxCore::IsA(p_name); } - virtual MxResult Create(MxS32 p_id, const MxAtomId& p_atom); // vtable+0x14 + // FUNCTION: LEGO1 0x10001070 + virtual MxResult Create(MxS32 p_id, const MxAtomId& p_atom) + { + this->m_mxEntityId = p_id; + this->m_atom = p_atom; + return SUCCESS; + }; // vtable+0x14 + inline MxResult Create(MxDSObject& p_dsObject) { m_mxEntityId = p_dsObject.GetObjectId(); diff --git a/LEGO1/omni/include/mxmediapresenter.h b/LEGO1/omni/include/mxmediapresenter.h index 64baa409..360e978e 100644 --- a/LEGO1/omni/include/mxmediapresenter.h +++ b/LEGO1/omni/include/mxmediapresenter.h @@ -11,7 +11,9 @@ class MxMediaPresenter : public MxPresenter { public: inline MxMediaPresenter() { Init(); } - virtual ~MxMediaPresenter() override; + + // FUNCTION: LEGO1 0x1000c550 + virtual ~MxMediaPresenter() override { Destroy(TRUE); }; virtual MxResult Tickle() override; // vtable+0x8 @@ -28,10 +30,13 @@ class MxMediaPresenter : public MxPresenter { return !strcmp(p_name, MxMediaPresenter::ClassName()) || MxPresenter::IsA(p_name); } - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void DoneTickle() override; // vtable+0x2c - virtual void Destroy() override; // vtable+0x38 + virtual void StreamingTickle() override; // vtable+0x20 + virtual void RepeatingTickle() override; // vtable+0x24 + virtual void DoneTickle() override; // vtable+0x2c + + // FUNCTION: LEGO1 0x1000c5b0 + virtual void Destroy() override { Destroy(FALSE); }; // vtable+0x38 + virtual MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c virtual void EndAction() override; // vtable+0x40 virtual void Enable(MxBool p_enable) override; // vtable+0x54 diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index 66f9dd95..256dd882 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -40,8 +40,10 @@ class MxNotificationParam : public MxParam { { } - virtual ~MxNotificationParam() override {} // vtable+0x0 (scalar deleting destructor) - virtual MxNotificationParam* Clone(); // vtable+0x4 + virtual ~MxNotificationParam() override {} + + // FUNCTION: LEGO1 0x10010390 + virtual MxNotificationParam* Clone() { return new MxNotificationParam(m_type, m_sender); }; // vtable+0x4 inline NotificationId GetNotification() const { return m_type; } inline MxCore* GetSender() const { return m_sender; } diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index 7bac0723..9f448c26 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -52,7 +52,9 @@ class MxOmni : public MxCore { virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34 virtual void StartTimer(); // vtable+38 virtual void StopTimer(); // vtable+3c - virtual MxBool IsTimerRunning(); // vtable+40 + + // FUNCTION: LEGO1 0x10058a90 + virtual MxBool IsTimerRunning() { return m_timerRunning; }; // vtable+40 static void SetInstance(MxOmni* p_instance); static MxBool FUN_100b06b0(MxDSAction* p_action, const char* p_name); @@ -98,12 +100,12 @@ __declspec(dllexport) MxSoundManager* MSoundManager(); __declspec(dllexport) MxVariableTable* VariableTable(); __declspec(dllexport) MxMusicManager* MusicManager(); __declspec(dllexport) MxEventManager* EventManager(); +__declspec(dllexport) MxResult Start(MxDSAction*); __declspec(dllexport) MxNotificationManager* NotificationManager(); MxVideoManager* MVideoManager(); MxAtomIdCounterSet* AtomIdCounterSet(); MxObjectFactory* ObjectFactory(); void DeleteObject(MxDSAction& p_dsAction); -void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); #endif // MXOMNI_H diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index bc327c1f..5659402b 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -28,8 +28,14 @@ class MxPresenter : public MxCore { MxPresenter() { Init(); } - __declspec(dllexport) virtual ~MxPresenter(); // vtable+0x0 - __declspec(dllexport) virtual MxResult Tickle() override; // vtable+0x8 +#ifdef COMPAT_MODE + __declspec(dllexport) virtual ~MxPresenter() override; // vtable+0x00 +#else + // FUNCTION: LEGO1 0x1000bf00 + __declspec(dllexport) virtual ~MxPresenter() override{}; // vtable+0x00 +#endif + + __declspec(dllexport) virtual MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1000bfe0 inline virtual const char* ClassName() const override // vtable+0xc @@ -44,27 +50,66 @@ class MxPresenter : public MxCore { return !strcmp(p_name, MxPresenter::ClassName()) || MxCore::IsA(p_name); } - virtual void VTable0x14(); // vtable+0x14 - virtual void ReadyTickle(); // vtable+0x18 - virtual void StartingTickle(); // vtable+0x1c - virtual void StreamingTickle(); // vtable+0x20 - virtual void RepeatingTickle(); // vtable+0x24 - virtual void Unk5Tickle(); // vtable+0x28 + // FUNCTION: LEGO1 0x1000be30 + virtual void VTable0x14() {} // vtable+0x14 + + // FUNCTION: LEGO1 0x1000be40 + virtual void ReadyTickle() + { + ParseExtra(); + ProgressTickleState(TickleState_Starting); + } // vtable+0x18 + + // FUNCTION: LEGO1 0x1000be60 + virtual void StartingTickle() { ProgressTickleState(TickleState_Streaming); } // vtable+0x1c + + // FUNCTION: LEGO1 0x1000be80 + virtual void StreamingTickle() { ProgressTickleState(TickleState_Repeating); }; // vtable+0x20 + + // FUNCTION: LEGO1 0x1000bea0 + virtual void RepeatingTickle() { ProgressTickleState(TickleState_unk5); }; // vtable+0x24 + + // FUNCTION: LEGO1 0x1000bec0 + virtual void Unk5Tickle() { ProgressTickleState(TickleState_Done); }; // vtable+0x28 protected: - __declspec(dllexport) virtual void DoneTickle(); // vtable+0x2c + // FUNCTION: LEGO1 0x1000bee0 + __declspec(dllexport) virtual void DoneTickle() { ProgressTickleState(TickleState_Idle); }; // vtable+0x2c + __declspec(dllexport) virtual void ParseExtra(); // vtable+0x30 + inline void ProgressTickleState(TickleState p_tickleState) + { + m_previousTickleStates |= 1 << (MxU8) m_currentTickleState; + m_currentTickleState = p_tickleState; + } + public: - virtual MxResult AddToManager(); // vtable+0x34 - virtual void Destroy(); // vtable+0x38 + // FUNCTION: LEGO1 0x1000bf70 + virtual MxResult AddToManager() { return SUCCESS; }; // vtable+0x34 + + // FUNCTION: LEGO1 0x1000bf80 + virtual void Destroy() { Init(); }; // vtable+0x38 + __declspec(dllexport) virtual MxResult StartAction(MxStreamController*, MxDSAction*); // vtable+0x3c __declspec(dllexport) virtual void EndAction(); // vtable+0x40 - virtual void SetTickleState(TickleState p_tickleState); // vtable+0x44 - virtual MxBool HasTickleStatePassed(TickleState p_tickleState); // vtable+0x48 - virtual MxResult PutData(); // vtable+0x4c - virtual MxBool IsHit(MxS32 p_x, MxS32 p_y); // vtable+0x50 - __declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54 + + // FUNCTION: LEGO1 0x1000bf90 + virtual void SetTickleState(TickleState p_tickleState) { ProgressTickleState(p_tickleState); } // vtable+0x44 + + // FUNCTION: LEGO1 0x1000bfb0 + virtual MxBool HasTickleStatePassed(TickleState p_tickleState) + { + return m_previousTickleStates & (1 << (MxU8) p_tickleState); + }; // vtable+0x48 + + // FUNCTION: LEGO1 0x1000bfc0 + virtual MxResult PutData() { return SUCCESS; }; // vtable+0x4c + + // FUNCTION: LEGO1 0x1000bfd0 + virtual MxBool IsHit(MxS32 p_x, MxS32 p_y) { return FALSE; }; // vtable+0x50 + + __declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54 MxEntity* CreateEntityBackend(const char* p_name); MxBool IsEnabled(); diff --git a/LEGO1/omni/include/mxsoundpresenter.h b/LEGO1/omni/include/mxsoundpresenter.h index d61d8088..1d49204a 100644 --- a/LEGO1/omni/include/mxsoundpresenter.h +++ b/LEGO1/omni/include/mxsoundpresenter.h @@ -8,7 +8,8 @@ // SIZE 0x54 class MxSoundPresenter : public MxAudioPresenter { public: - virtual ~MxSoundPresenter() override; + // FUNCTION: LEGO1 0x1000d430 + virtual ~MxSoundPresenter() override { Destroy(TRUE); }; // FUNCTION: LEGO1 0x1000d4a0 inline virtual const char* ClassName() const // vtable+0x0c @@ -24,7 +25,9 @@ class MxSoundPresenter : public MxAudioPresenter { }; virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + + // FUNCTION: LEGO1 0x1000d490 + virtual void Destroy() override { Destroy(FALSE); }; // vtable+0x38 protected: void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/omni/include/mxstillpresenter.h b/LEGO1/omni/include/mxstillpresenter.h index 828f58b7..0fa48bf3 100644 --- a/LEGO1/omni/include/mxstillpresenter.h +++ b/LEGO1/omni/include/mxstillpresenter.h @@ -25,11 +25,14 @@ class MxStillPresenter : public MxVideoPresenter { return !strcmp(p_name, MxStillPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 - virtual void Destroy() override; // vtable+0x38 + virtual void StartingTickle() override; // vtable+0x1c + virtual void StreamingTickle() override; // vtable+0x20 + virtual void RepeatingTickle() override; // vtable+0x24 + virtual void ParseExtra() override; // vtable+0x30 + + // FUNCTION: LEGO1 0x100435b0 + virtual void Destroy() override { Destroy(FALSE); }; // vtable+0x38 + virtual void Enable(MxBool p_enable) override; // vtable+0x54 virtual void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c virtual void CreateBitmap() override; // vtable+0x60 diff --git a/LEGO1/omni/include/mxvariable.h b/LEGO1/omni/include/mxvariable.h index d1434467..52fc48bc 100644 --- a/LEGO1/omni/include/mxvariable.h +++ b/LEGO1/omni/include/mxvariable.h @@ -20,9 +20,15 @@ class MxVariable { m_key.ToUpperCase(); m_value = p_value; } - virtual MxString* GetValue(); - virtual void SetValue(const char* p_value); - virtual void Destroy(); + + // FUNCTION: LEGO1 0x1003bea0 + virtual MxString* GetValue() { return &m_value; }; + + // FUNCTION: LEGO1 0x1003beb0 + virtual void SetValue(const char* p_value) { m_value = p_value; }; + + // FUNCTION: LEGO1 0x1003bec0 + virtual void Destroy() { delete this; }; inline const MxString* GetKey() const { return &m_key; } diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index f02f3f08..78c89f14 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -19,7 +19,9 @@ class MxVideoPresenter : public MxMediaPresenter { }; MxVideoPresenter() { Init(); } - virtual ~MxVideoPresenter() override; // vtable+0x0 + + // FUNCTION: LEGO1 0x1000c740 + virtual ~MxVideoPresenter() override { Destroy(TRUE); }; // vtable+0x0 // FUNCTION: LEGO1 0x1000c820 inline virtual const char* ClassName() const override // vtable+0x0c @@ -34,27 +36,48 @@ class MxVideoPresenter : public MxMediaPresenter { return !strcmp(p_name, MxVideoPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void Unk5Tickle() override; // vtable+0x28 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + virtual void ReadyTickle() override; // vtable+0x18 + virtual void StartingTickle() override; // vtable+0x1c + virtual void StreamingTickle() override; // vtable+0x20 + virtual void RepeatingTickle() override; // vtable+0x24 + virtual void Unk5Tickle() override; // vtable+0x28 + virtual MxResult AddToManager() override; // vtable+0x34 + + // FUNCTION: LEGO1 0x1000c7a0 + virtual void Destroy() override { Destroy(FALSE); }; // vtable+0x38 + virtual void EndAction() override; // vtable+0x40 virtual MxResult PutData() override; // vtable+0x4c virtual MxBool IsHit(MxS32 p_x, MxS32 p_y) override; // vtable+0x50 - virtual void LoadHeader(MxStreamChunk* p_chunk); // vtable+0x5c - virtual void CreateBitmap(); // vtable+0x60 - virtual void NextFrame(); // vtable+0x64 - virtual void LoadFrame(MxStreamChunk* p_chunk); // vtable+0x68 - virtual void PutFrame(); // vtable+0x6c - virtual void RealizePalette(); // vtable+0x70 - virtual undefined VTable0x74(); // vtable+0x74 - virtual LPDIRECTDRAWSURFACE VTable0x78(); // vtable+0x78 - virtual MxBool VTable0x7c(); // vtable+0x7c - virtual MxS32 GetWidth(); // vtable+0x80 - virtual MxS32 GetHeight(); // vtable+0x84 + + // FUNCTION: LEGO1 0x1000c700 + virtual void LoadHeader(MxStreamChunk* p_chunk){}; // vtable+0x5c + + // FUNCTION: LEGO1 0x1000c710 + virtual void CreateBitmap(){}; // vtable+0x60 + + virtual void NextFrame(); // vtable+0x64 + + // FUNCTION: LEGO1 0x1000c720 + virtual void LoadFrame(MxStreamChunk* p_chunk){}; // vtable+0x68 + + virtual void PutFrame(); // vtable+0x6c + + // FUNCTION: LEGO1 0x1000c730 + virtual void RealizePalette(){}; // vtable+0x70 + virtual undefined VTable0x74(); // vtable+0x74 + + // FUNCTION: LEGO1 0x1000c7b0 + virtual LPDIRECTDRAWSURFACE VTable0x78() { return m_unk0x58; }; // vtable+0x78 + + // FUNCTION: LEGO1 0x1000c7c0 + virtual MxBool VTable0x7c() { return (m_bitmap != NULL) || (m_alpha != NULL); }; // vtable+0x7c + + // FUNCTION: LEGO1 0x1000c7e0 + virtual MxS32 GetWidth() { return m_alpha ? m_alpha->m_width : m_bitmap->GetBmiWidth(); }; // vtable+0x80 + + // FUNCTION: LEGO1 0x1000c800 + virtual MxS32 GetHeight() { return m_alpha ? m_alpha->m_height : m_bitmap->GetBmiHeightAbs(); }; // vtable+0x84 // SIZE 0xc struct AlphaMask { diff --git a/LEGO1/omni/include/mxwavepresenter.h b/LEGO1/omni/include/mxwavepresenter.h index 383659ab..3bdf734f 100644 --- a/LEGO1/omni/include/mxwavepresenter.h +++ b/LEGO1/omni/include/mxwavepresenter.h @@ -11,7 +11,9 @@ class MxWavePresenter : public MxSoundPresenter { public: MxWavePresenter() { Init(); } - virtual ~MxWavePresenter() override; // vtable+0x00 + + // FUNCTION: LEGO1 0x1000d640 + virtual ~MxWavePresenter() override { Destroy(TRUE); }; // vtable+0x00 // FUNCTION: LEGO1 0x1000d6c0 inline virtual const char* ClassName() const override // vtable+0x0c @@ -26,13 +28,16 @@ class MxWavePresenter : public MxSoundPresenter { return !strcmp(p_name, MxWavePresenter::ClassName()) || MxSoundPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + virtual void ReadyTickle() override; // vtable+0x18 + virtual void StartingTickle() override; // vtable+0x1c + virtual void StreamingTickle() override; // vtable+0x20 + virtual void DoneTickle() override; // vtable+0x2c + virtual void ParseExtra() override; // vtable+0x30 + virtual MxResult AddToManager() override; // vtable+0x34 + + // FUNCTION: LEGO1 0x1000d6a0 + virtual void Destroy() override { Destroy(FALSE); }; // vtable+0x38 + virtual void EndAction() override; // vtable+0x40 virtual MxResult PutData() override; // vtable+0x4c virtual void Enable(MxBool p_enable) override; // vtable+0x54 @@ -40,7 +45,9 @@ class MxWavePresenter : public MxSoundPresenter { virtual void SetVolume(MxS32 p_volume) override; // vtable+0x60 virtual void Pause(); // vtable+0x64 virtual void Resume(); // vtable+0x68 - virtual MxBool IsPaused(); // vtable+0x6c + + // FUNCTION: LEGO1 0x1000d6b0 + virtual MxBool IsPaused() { return m_paused; }; // vtable+0x6c // Reference: https://github.com/itsmattkc/SIEdit/blob/master/lib/othertypes.h // SIZE 0x1c diff --git a/LEGO1/omni/src/audio/mxaudiomanager.cpp b/LEGO1/omni/src/audio/mxaudiomanager.cpp index 318a8446..a2d6072a 100644 --- a/LEGO1/omni/src/audio/mxaudiomanager.cpp +++ b/LEGO1/omni/src/audio/mxaudiomanager.cpp @@ -5,12 +5,6 @@ DECOMP_SIZE_ASSERT(MxAudioManager, 0x30); // GLOBAL: LEGO1 0x10102108 MxS32 MxAudioManager::g_count = 0; -// FUNCTION: LEGO1 0x10029910 -MxS32 MxAudioManager::GetVolume() -{ - return this->m_volume; -} - // FUNCTION: LEGO1 0x100b8d00 MxAudioManager::MxAudioManager() { diff --git a/LEGO1/omni/src/audio/mxaudiopresenter.cpp b/LEGO1/omni/src/audio/mxaudiopresenter.cpp index 1ef74dea..ac634362 100644 --- a/LEGO1/omni/src/audio/mxaudiopresenter.cpp +++ b/LEGO1/omni/src/audio/mxaudiopresenter.cpp @@ -3,15 +3,3 @@ #include "decomp.h" DECOMP_SIZE_ASSERT(MxAudioPresenter, 0x54); - -// FUNCTION: LEGO1 0x1000d260 -MxS32 MxAudioPresenter::GetVolume() -{ - return m_volume; -} - -// FUNCTION: LEGO1 0x1000d270 -void MxAudioPresenter::SetVolume(MxS32 p_volume) -{ - m_volume = p_volume; -} diff --git a/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp b/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp index 84b33229..921bc607 100644 --- a/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp +++ b/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp @@ -20,10 +20,8 @@ void MxLoopingMIDIPresenter::StreamingTickle() return; } - if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; - } + if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) + ProgressTickleState(TickleState_Done); } // FUNCTION: LEGO1 0x100c2ae0 diff --git a/LEGO1/omni/src/audio/mxmidipresenter.cpp b/LEGO1/omni/src/audio/mxmidipresenter.cpp index 95add150..b6d22d81 100644 --- a/LEGO1/omni/src/audio/mxmidipresenter.cpp +++ b/LEGO1/omni/src/audio/mxmidipresenter.cpp @@ -52,8 +52,7 @@ void MxMIDIPresenter::ReadyTickle() if (chunk) { m_subscriber->DestroyChunk(chunk); ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } } @@ -62,19 +61,15 @@ void MxMIDIPresenter::StartingTickle() { MxStreamChunk* chunk = CurrentChunk(); - if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; - } + if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) + ProgressTickleState(TickleState_Streaming); } // FUNCTION: LEGO1 0x100c2910 void MxMIDIPresenter::StreamingTickle() { - if (m_chunk) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; - } + if (m_chunk) + ProgressTickleState(TickleState_Done); else m_chunk = NextChunk(); } diff --git a/LEGO1/omni/src/audio/mxsoundpresenter.cpp b/LEGO1/omni/src/audio/mxsoundpresenter.cpp index 1065fc99..07e4a022 100644 --- a/LEGO1/omni/src/audio/mxsoundpresenter.cpp +++ b/LEGO1/omni/src/audio/mxsoundpresenter.cpp @@ -5,18 +5,6 @@ DECOMP_SIZE_ASSERT(MxSoundPresenter, 0x54) -// FUNCTION: LEGO1 0x1000d430 -MxSoundPresenter::~MxSoundPresenter() -{ - Destroy(TRUE); -} - -// FUNCTION: LEGO1 0x1000d490 -void MxSoundPresenter::Destroy() -{ - Destroy(FALSE); -} - // FUNCTION: LEGO1 0x100b1a50 void MxSoundPresenter::Destroy(MxBool p_fromDestructor) { diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index d77ccac2..e47a2630 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -11,24 +11,6 @@ DECOMP_SIZE_ASSERT(MxWavePresenter, 0x6c); DECOMP_SIZE_ASSERT(MxWavePresenter::WaveFormat, 0x1c); -// FUNCTION: LEGO1 0x1000d640 -MxWavePresenter::~MxWavePresenter() -{ - Destroy(TRUE); -} - -// FUNCTION: LEGO1 0x1000d6a0 -void MxWavePresenter::Destroy() -{ - Destroy(FALSE); -} - -// FUNCTION: LEGO1 0x1000d6b0 -MxBool MxWavePresenter::IsPaused() -{ - return m_paused; -} - // FUNCTION: LEGO1 0x100b1ad0 void MxWavePresenter::Init() { @@ -136,8 +118,7 @@ void MxWavePresenter::ReadyTickle() memcpy(m_waveFormat, chunk->GetData(), chunk->GetLength()); m_subscriber->DestroyChunk(chunk); ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } } @@ -188,8 +169,7 @@ void MxWavePresenter::StartingTickle() } else { SetVolume(((MxDSSound*) m_action)->GetVolume()); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; + ProgressTickleState(TickleState_Streaming); } } } diff --git a/LEGO1/omni/src/common/mxcompositepresenter.cpp b/LEGO1/omni/src/common/mxcompositepresenter.cpp index d22c979d..0b787a42 100644 --- a/LEGO1/omni/src/common/mxcompositepresenter.cpp +++ b/LEGO1/omni/src/common/mxcompositepresenter.cpp @@ -8,14 +8,6 @@ DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c); -// FUNCTION: LEGO1 0x1000caf0 -MxBool MxCompositePresenter::VTable0x64(undefined4 p_undefined) -{ - if (m_compositePresenter) - return m_compositePresenter->VTable0x64(p_undefined); - return TRUE; -} - // FUNCTION: LEGO1 0x100b60b0 MxCompositePresenter::MxCompositePresenter() { @@ -229,8 +221,7 @@ void MxCompositePresenter::VTable0x60(MxPresenter* p_presenter) // FUNCTION: LEGO1 0x100b6bc0 void MxCompositePresenter::SetTickleState(TickleState p_tickleState) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = p_tickleState; + ProgressTickleState(p_tickleState); for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { MxPresenter* presenter = *it; diff --git a/LEGO1/omni/src/common/mxcore.cpp b/LEGO1/omni/src/common/mxcore.cpp index 237ed1da..1266a1cb 100644 --- a/LEGO1/omni/src/common/mxcore.cpp +++ b/LEGO1/omni/src/common/mxcore.cpp @@ -2,12 +2,6 @@ #include "define.h" -// FUNCTION: LEGO1 0x10001f70 -MxResult MxCore::Tickle() -{ - return SUCCESS; -} - // FUNCTION: LEGO1 0x100ae1a0 MxCore::MxCore() { diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index a9383e4d..56297f53 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -11,18 +11,6 @@ DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50); DECOMP_SIZE_ASSERT(MxStreamChunkList, 0x18); DECOMP_SIZE_ASSERT(MxStreamChunkListCursor, 0x10); -// FUNCTION: LEGO1 0x1000c550 -MxMediaPresenter::~MxMediaPresenter() -{ - Destroy(TRUE); -} - -// FUNCTION: LEGO1 0x1000c5b0 -void MxMediaPresenter::Destroy() -{ - Destroy(FALSE); -} - // FUNCTION: LEGO1 0x100b54e0 void MxMediaPresenter::Init() { @@ -77,8 +65,7 @@ MxStreamChunk* MxMediaPresenter::CurrentChunk() m_subscriber->NextChunk(); m_subscriber->DestroyChunk(chunk); chunk = NULL; - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; + ProgressTickleState(TickleState_Done); } } @@ -97,8 +84,7 @@ MxStreamChunk* MxMediaPresenter::NextChunk() m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Bit7); m_subscriber->DestroyChunk(chunk); chunk = NULL; - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; + ProgressTickleState(TickleState_Done); } } @@ -195,8 +181,7 @@ void MxMediaPresenter::StreamingTickle() if (m_currentChunk->GetFlags() & MxDSChunk::Flag_End) { m_subscriber->DestroyChunk(m_currentChunk); m_currentChunk = NULL; - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; + ProgressTickleState(TickleState_Repeating); } else if (m_action->GetFlags() & MxDSAction::Flag_Looping) { LoopChunk(m_currentChunk); @@ -220,16 +205,12 @@ void MxMediaPresenter::RepeatingTickle() if (m_currentChunk) { MxLong time = m_currentChunk->GetTime(); - if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_unk5; - } + if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) + ProgressTickleState(TickleState_unk5); } else { - if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_unk5; - } + if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) + ProgressTickleState(TickleState_unk5); } } } diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index 0595aee7..6582d43c 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -18,96 +18,11 @@ DECOMP_SIZE_ASSERT(MxPresenter, 0x40); -// FUNCTION: LEGO1 0x1000be30 -void MxPresenter::VTable0x14() -{ -} - -// FUNCTION: LEGO1 0x1000be40 -void MxPresenter::ReadyTickle() -{ - ParseExtra(); - - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; -} - -// FUNCTION: LEGO1 0x1000be60 -void MxPresenter::StartingTickle() -{ - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; -} - -// FUNCTION: LEGO1 0x1000be80 -void MxPresenter::StreamingTickle() -{ - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; -} - -// FUNCTION: LEGO1 0x1000bea0 -void MxPresenter::RepeatingTickle() -{ - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_unk5; -} - -// FUNCTION: LEGO1 0x1000bec0 -void MxPresenter::Unk5Tickle() -{ - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; -} - -// FUNCTION: LEGO1 0x1000bee0 -void MxPresenter::DoneTickle() -{ - m_previousTickleStates |= 1 << m_currentTickleState; - m_currentTickleState = TickleState_Idle; -} - -// FUNCTION: LEGO1 0x1000bf00 +#ifdef COMPAT_MODE MxPresenter::~MxPresenter() { } - -// FUNCTION: LEGO1 0x1000bf70 -MxResult MxPresenter::AddToManager() -{ - return SUCCESS; -} - -// FUNCTION: LEGO1 0x1000bf80 -void MxPresenter::Destroy() -{ - Init(); -} - -// FUNCTION: LEGO1 0x1000bf90 -void MxPresenter::SetTickleState(TickleState p_tickleState) -{ - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = p_tickleState; -} - -// FUNCTION: LEGO1 0x1000bfb0 -MxBool MxPresenter::HasTickleStatePassed(TickleState p_tickleState) -{ - return m_previousTickleStates & (1 << (unsigned char) p_tickleState); -} - -// FUNCTION: LEGO1 0x1000bfc0 -MxResult MxPresenter::PutData() -{ - return SUCCESS; -} - -// FUNCTION: LEGO1 0x1000bfd0 -MxBool MxPresenter::IsHit(MxS32 p_x, MxS32 p_y) -{ - return FALSE; -} +#endif // FUNCTION: LEGO1 0x100b4d50 void MxPresenter::Init() @@ -132,8 +47,7 @@ MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) this->m_location = MxPoint32(this->m_action->GetLocation()[0], this->m_action->GetLocation()[1]); this->m_displayZ = this->m_action->GetLocation()[2]; - this->m_previousTickleStates |= 1 << (unsigned char) previousTickleState; - this->m_currentTickleState = TickleState_Ready; + ProgressTickleState(TickleState_Ready); return SUCCESS; } diff --git a/LEGO1/omni/src/common/mxvariable.cpp b/LEGO1/omni/src/common/mxvariable.cpp index a60051fd..7b0a46c1 100644 --- a/LEGO1/omni/src/common/mxvariable.cpp +++ b/LEGO1/omni/src/common/mxvariable.cpp @@ -4,21 +4,3 @@ #include "mxstring.h" DECOMP_SIZE_ASSERT(MxVariable, 0x24) - -// FUNCTION: LEGO1 0x1003bea0 -MxString* MxVariable::GetValue() -{ - return &m_value; -} - -// FUNCTION: LEGO1 0x1003beb0 -void MxVariable::SetValue(const char* p_value) -{ - m_value = p_value; -} - -// FUNCTION: LEGO1 0x1003bec0 -void MxVariable::Destroy() -{ - delete this; -} diff --git a/LEGO1/omni/src/entity/mxentity.cpp b/LEGO1/omni/src/entity/mxentity.cpp index 1f507257..2edc65f6 100644 --- a/LEGO1/omni/src/entity/mxentity.cpp +++ b/LEGO1/omni/src/entity/mxentity.cpp @@ -1,22 +1,3 @@ #include "mxentity.h" DECOMP_SIZE_ASSERT(MxEntity, 0x10) - -// FUNCTION: LEGO1 0x10001070 -MxResult MxEntity::Create(MxS32 p_id, const MxAtomId& p_atom) -{ - this->m_mxEntityId = p_id; - this->m_atom = p_atom; - return SUCCESS; -} - -// FUNCTION: LEGO1 0x1000c110 -MxEntity::~MxEntity() -{ -} - -// FUNCTION: LEGO1 0x1001d190 -MxEntity::MxEntity() -{ - this->m_mxEntityId = -1; -} diff --git a/LEGO1/omni/src/event/mxeventpresenter.cpp b/LEGO1/omni/src/event/mxeventpresenter.cpp index 6a0a0cbd..d934660a 100644 --- a/LEGO1/omni/src/event/mxeventpresenter.cpp +++ b/LEGO1/omni/src/event/mxeventpresenter.cpp @@ -71,8 +71,7 @@ void MxEventPresenter::ReadyTickle() CopyData(chunk); m_subscriber->DestroyChunk(chunk); ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } } @@ -81,10 +80,8 @@ void MxEventPresenter::StartingTickle() { MxStreamChunk* chunk = NextChunk(); - if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; - } + if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) + ProgressTickleState(TickleState_Streaming); } // FUNCTION: LEGO1 0x100c2ef0 diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index 377ba481..6df6d009 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -27,26 +27,6 @@ MxBool g_use3dSound; // GLOBAL: LEGO1 0x101015b0 MxOmni* MxOmni::g_instance = NULL; -// FUNCTION: LEGO1 0x100159e0 -void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last) -{ - MxDSAction action; - - action.SetAtomId(*p_id); - action.SetUnknown24(-2); - - for (MxS32 first = p_first, last = p_last; first <= last; first++) { - action.SetObjectId(first); - DeleteObject(action); - } -} - -// FUNCTION: LEGO1 0x10058a90 -MxBool MxOmni::IsTimerRunning() -{ - return m_timerRunning; -} - // FUNCTION: LEGO1 0x100acea0 MxObjectFactory* ObjectFactory() { @@ -113,6 +93,12 @@ MxEventManager* EventManager() return MxOmni::GetInstance()->GetEventManager(); } +// FUNCTION: LEGO1 0x100acf50 +MxResult Start(MxDSAction* p_dsAction) +{ + return MxOmni::GetInstance()->Start(p_dsAction); +} + // FUNCTION: LEGO1 0x100acf70 void DeleteObject(MxDSAction& p_dsAction) { diff --git a/LEGO1/omni/src/notify/mxactionnotificationparam.cpp b/LEGO1/omni/src/notify/mxactionnotificationparam.cpp index 5573677f..c5f816e7 100644 --- a/LEGO1/omni/src/notify/mxactionnotificationparam.cpp +++ b/LEGO1/omni/src/notify/mxactionnotificationparam.cpp @@ -3,18 +3,6 @@ DECOMP_SIZE_ASSERT(MxActionNotificationParam, 0x14) DECOMP_SIZE_ASSERT(MxEndActionNotificationParam, 0x14) -// FUNCTION: LEGO1 0x100510c0 -MxNotificationParam* MxActionNotificationParam::Clone() -{ - return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc); -} - -// FUNCTION: LEGO1 0x10051270 -MxNotificationParam* MxEndActionNotificationParam::Clone() -{ - return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc); -} - // FUNCTION: LEGO1 0x100b0300 MxNotificationParam* MxStartActionNotificationParam::Clone() { diff --git a/LEGO1/omni/src/notify/mxnotificationparam.cpp b/LEGO1/omni/src/notify/mxnotificationparam.cpp index 0797c9f1..cb15a2df 100644 --- a/LEGO1/omni/src/notify/mxnotificationparam.cpp +++ b/LEGO1/omni/src/notify/mxnotificationparam.cpp @@ -3,9 +3,3 @@ #include "decomp.h" DECOMP_SIZE_ASSERT(MxNotificationParam, 0xc); - -// FUNCTION: LEGO1 0x10010390 -MxNotificationParam* MxNotificationParam::Clone() -{ - return new MxNotificationParam(m_type, m_sender); -} diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index 4f2393cf..ea93279b 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -10,12 +10,6 @@ DECOMP_SIZE_ASSERT(MxBITMAPINFO, 0x428); // (1998) GLOBAL: LEGO1 0x10102184 MxU16 g_bitmapSignature = TWOCC('B', 'M'); -// FUNCTION: LEGO1 0x1004e0d0 -int MxBitmap::VTable0x28(int) -{ - return -1; -} - // FUNCTION: LEGO1 0x100bc980 MxBitmap::MxBitmap() { diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index fdd991a9..07af2513 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -40,10 +40,8 @@ void MxLoopingFlcPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::Flag_End) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; - } + if (chunk->GetFlags() & MxDSChunk::Flag_End) + ProgressTickleState(TickleState_Repeating); else { LoadFrame(chunk); LoopChunk(chunk); diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index efa758cd..29ee1747 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -51,10 +51,8 @@ void MxLoopingSmkPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::Flag_End) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; - } + if (chunk->GetFlags() & MxDSChunk::Flag_End) + ProgressTickleState(TickleState_Repeating); else { LoadFrame(chunk); LoopChunk(chunk); @@ -67,10 +65,8 @@ void MxLoopingSmkPresenter::NextFrame() // FUNCTION: LEGO1 0x100b4a90 void MxLoopingSmkPresenter::VTable0x8c() { - if (m_action->GetDuration() < m_elapsedDuration) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_unk5; - } + if (m_action->GetDuration() < m_elapsedDuration) + ProgressTickleState(TickleState_unk5); else { MxStreamChunk* chunk; m_loopingChunkCursor->Current(chunk); diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 20e6b3a2..ea3ba3a6 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -13,12 +13,6 @@ DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c); // GLOBAL: LEGO1 0x10101eb0 const char* g_strBmpIsmap = "BMP_ISMAP"; -// FUNCTION: LEGO1 0x100435b0 -void MxStillPresenter::Destroy() -{ - Destroy(FALSE); -} - // FUNCTION: LEGO1 0x100b9c70 void MxStillPresenter::Destroy(MxBool p_fromDestructor) { @@ -127,8 +121,7 @@ void MxStillPresenter::StreamingTickle() if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { m_chunkTime = chunk->GetTime(); NextFrame(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; + ProgressTickleState(TickleState_Repeating); if (m_action->GetDuration() == -1 && m_compositePresenter) m_compositePresenter->VTable0x60(this); @@ -139,10 +132,8 @@ void MxStillPresenter::StreamingTickle() void MxStillPresenter::RepeatingTickle() { if (m_action->GetDuration() != -1) { - if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_unk5; - } + if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) + ProgressTickleState(TickleState_unk5); } } diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 23c12cfb..765bb497 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -8,66 +8,6 @@ DECOMP_SIZE_ASSERT(MxVideoPresenter, 0x64); DECOMP_SIZE_ASSERT(MxVideoPresenter::AlphaMask, 0xc); -// FUNCTION: LEGO1 0x1000c700 -void MxVideoPresenter::LoadHeader(MxStreamChunk* p_chunk) -{ - // Empty -} - -// FUNCTION: LEGO1 0x1000c710 -void MxVideoPresenter::CreateBitmap() -{ - // Empty -} - -// FUNCTION: LEGO1 0x1000c720 -void MxVideoPresenter::LoadFrame(MxStreamChunk* p_chunk) -{ - // Empty -} - -// FUNCTION: LEGO1 0x1000c730 -void MxVideoPresenter::RealizePalette() -{ - // Empty -} - -// FUNCTION: LEGO1 0x1000c740 -MxVideoPresenter::~MxVideoPresenter() -{ - Destroy(TRUE); -} - -// FUNCTION: LEGO1 0x1000c7a0 -void MxVideoPresenter::Destroy() -{ - Destroy(FALSE); -} - -// FUNCTION: LEGO1 0x1000c7b0 -LPDIRECTDRAWSURFACE MxVideoPresenter::VTable0x78() -{ - return m_unk0x58; -} - -// FUNCTION: LEGO1 0x1000c7c0 -MxBool MxVideoPresenter::VTable0x7c() -{ - return (m_bitmap != NULL) || (m_alpha != NULL); -} - -// FUNCTION: LEGO1 0x1000c7e0 -MxS32 MxVideoPresenter::GetWidth() -{ - return m_alpha ? m_alpha->m_width : m_bitmap->GetBmiWidth(); -} - -// FUNCTION: LEGO1 0x1000c800 -MxS32 MxVideoPresenter::GetHeight() -{ - return m_alpha ? m_alpha->m_height : m_bitmap->GetBmiHeightAbs(); -} - // FUNCTION: LEGO1 0x100b24f0 MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap) { @@ -242,8 +182,7 @@ void MxVideoPresenter::NextFrame() if (chunk->GetFlags() & MxDSChunk::Flag_End) { m_subscriber->DestroyChunk(chunk); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Repeating; + ProgressTickleState(TickleState_Repeating); } else { LoadFrame(chunk); @@ -460,8 +399,7 @@ void MxVideoPresenter::ReadyTickle() LoadHeader(chunk); m_subscriber->DestroyChunk(chunk); ParseExtra(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Starting; + ProgressTickleState(TickleState_Starting); } } @@ -472,8 +410,7 @@ void MxVideoPresenter::StartingTickle() if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { CreateBitmap(); - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Streaming; + ProgressTickleState(TickleState_Streaming); } } @@ -564,15 +501,11 @@ void MxVideoPresenter::Unk5Tickle() if (m_unk0x60 == -1) m_unk0x60 = m_action->GetElapsedTime(); - if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; - } - } - else { - m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; - m_currentTickleState = TickleState_Done; + if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) + ProgressTickleState(TickleState_Done); } + else + ProgressTickleState(TickleState_Done); } }