From 76435d803f768be8da9821d72b98306a4b043ad2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 15:03:43 -0400 Subject: [PATCH 01/26] Style refactor omni/system components (#974) * Style refactor omni/system components * Fix * Fix --- CMakeLists.txt | 1 + LEGO1/omni/include/mxautolock.h | 2 +- LEGO1/omni/include/mxcriticalsection.h | 2 + LEGO1/omni/include/mxscheduler.h | 1 + LEGO1/omni/include/mxsemaphore.h | 6 +-- LEGO1/omni/include/mxthread.h | 15 ------- LEGO1/omni/include/mxticklethread.h | 21 ++++++++++ LEGO1/omni/src/audio/mxmusicmanager.cpp | 2 +- LEGO1/omni/src/audio/mxsoundmanager.cpp | 2 +- LEGO1/omni/src/event/mxeventmanager.cpp | 2 +- LEGO1/omni/src/system/mxautolock.cpp | 11 +++--- LEGO1/omni/src/system/mxcriticalsection.cpp | 44 ++++++++++----------- LEGO1/omni/src/system/mxsemaphore.cpp | 2 + LEGO1/omni/src/system/mxthread.cpp | 36 +---------------- LEGO1/omni/src/system/mxticklethread.cpp | 41 +++++++++++++++++++ LEGO1/omni/src/video/mxvideomanager.cpp | 2 +- 16 files changed, 106 insertions(+), 84 deletions(-) create mode 100644 LEGO1/omni/include/mxticklethread.h create mode 100644 LEGO1/omni/src/system/mxticklethread.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 58d2b662..cc660ede 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,7 @@ add_library(omni STATIC LEGO1/omni/src/system/mxscheduler.cpp LEGO1/omni/src/system/mxsemaphore.cpp LEGO1/omni/src/system/mxthread.cpp + LEGO1/omni/src/system/mxticklethread.cpp LEGO1/omni/src/video/flic.cpp LEGO1/omni/src/video/mxbitmap.cpp LEGO1/omni/src/video/mxdisplaysurface.cpp diff --git a/LEGO1/omni/include/mxautolock.h b/LEGO1/omni/include/mxautolock.h index 677804e7..8a2b3c35 100644 --- a/LEGO1/omni/include/mxautolock.h +++ b/LEGO1/omni/include/mxautolock.h @@ -11,7 +11,7 @@ class MxAutoLock { ~MxAutoLock(); private: - MxCriticalSection* m_criticalSection; + MxCriticalSection* m_criticalSection; // 0x00 }; #endif // MXAUTOLOCK_H diff --git a/LEGO1/omni/include/mxcriticalsection.h b/LEGO1/omni/include/mxcriticalsection.h index 011ac680..23c3fb76 100644 --- a/LEGO1/omni/include/mxcriticalsection.h +++ b/LEGO1/omni/include/mxcriticalsection.h @@ -8,7 +8,9 @@ class MxCriticalSection { public: MxCriticalSection(); ~MxCriticalSection(); + static void SetDoMutex(); + void Enter(); void Leave(); diff --git a/LEGO1/omni/include/mxscheduler.h b/LEGO1/omni/include/mxscheduler.h index 1f60029d..fbd972e8 100644 --- a/LEGO1/omni/include/mxscheduler.h +++ b/LEGO1/omni/include/mxscheduler.h @@ -6,6 +6,7 @@ class MxScheduler { public: static MxScheduler* GetInstance(); + void StartMultiTasking(MxULong); }; diff --git a/LEGO1/omni/include/mxsemaphore.h b/LEGO1/omni/include/mxsemaphore.h index 4e692395..a9c5f9d2 100644 --- a/LEGO1/omni/include/mxsemaphore.h +++ b/LEGO1/omni/include/mxsemaphore.h @@ -1,5 +1,5 @@ -#ifndef MX_SEMAPHORE_H -#define MX_SEMAPHORE_H +#ifndef MXSEMAPHORE_H +#define MXSEMAPHORE_H #include "mxtypes.h" @@ -23,4 +23,4 @@ class MxSemaphore { HANDLE m_hSemaphore; // 0x04 }; -#endif // MX_SEMAPHORE_H +#endif // MXSEMAPHORE_H diff --git a/LEGO1/omni/include/mxthread.h b/LEGO1/omni/include/mxthread.h index 6016aa8f..5f04a26c 100644 --- a/LEGO1/omni/include/mxthread.h +++ b/LEGO1/omni/include/mxthread.h @@ -42,19 +42,4 @@ class MxThread { MxCore* m_target; // 0x18 }; -// VTABLE: LEGO1 0x100dc6d8 -// SIZE 0x20 -class MxTickleThread : public MxThread { -public: - MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS); - - MxResult Run() override; - - // SYNTHETIC: LEGO1 0x100b8c20 - // MxTickleThread::`scalar deleting destructor' - -private: - MxS32 m_frequencyMS; // 0x1c -}; - #endif // MXTHREAD_H diff --git a/LEGO1/omni/include/mxticklethread.h b/LEGO1/omni/include/mxticklethread.h new file mode 100644 index 00000000..02b495ce --- /dev/null +++ b/LEGO1/omni/include/mxticklethread.h @@ -0,0 +1,21 @@ +#ifndef MXTICKLETHREAD_H +#define MXTICKLETHREAD_H + +#include "mxthread.h" + +// VTABLE: LEGO1 0x100dc6d8 +// SIZE 0x20 +class MxTickleThread : public MxThread { +public: + MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS); + + MxResult Run() override; + + // SYNTHETIC: LEGO1 0x100b8c20 + // MxTickleThread::`scalar deleting destructor' + +private: + MxS32 m_frequencyMS; // 0x1c +}; + +#endif // MXTICKLETHREAD_H diff --git a/LEGO1/omni/src/audio/mxmusicmanager.cpp b/LEGO1/omni/src/audio/mxmusicmanager.cpp index fa8bdcbe..94c56f04 100644 --- a/LEGO1/omni/src/audio/mxmusicmanager.cpp +++ b/LEGO1/omni/src/audio/mxmusicmanager.cpp @@ -1,8 +1,8 @@ #include "mxmusicmanager.h" #include "mxmisc.h" -#include "mxthread.h" #include "mxticklemanager.h" +#include "mxticklethread.h" #include diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index 33dd2bad..d5d8bd72 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -5,8 +5,8 @@ #include "mxmisc.h" #include "mxomni.h" #include "mxpresenter.h" -#include "mxthread.h" #include "mxticklemanager.h" +#include "mxticklethread.h" #include "mxwavepresenter.h" DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c); diff --git a/LEGO1/omni/src/event/mxeventmanager.cpp b/LEGO1/omni/src/event/mxeventmanager.cpp index 7e269ce6..43f1e045 100644 --- a/LEGO1/omni/src/event/mxeventmanager.cpp +++ b/LEGO1/omni/src/event/mxeventmanager.cpp @@ -2,8 +2,8 @@ #include "mxcriticalsection.h" #include "mxmisc.h" -#include "mxthread.h" #include "mxticklemanager.h" +#include "mxticklethread.h" // FUNCTION: LEGO1 0x100c0360 MxEventManager::MxEventManager() diff --git a/LEGO1/omni/src/system/mxautolock.cpp b/LEGO1/omni/src/system/mxautolock.cpp index a67c382c..5ab2e4bb 100644 --- a/LEGO1/omni/src/system/mxautolock.cpp +++ b/LEGO1/omni/src/system/mxautolock.cpp @@ -5,16 +5,17 @@ // FUNCTION: LEGO1 0x100b8ed0 MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection) { - this->m_criticalSection = p_criticalSection; - if (this->m_criticalSection != 0) { - this->m_criticalSection->Enter(); + m_criticalSection = p_criticalSection; + + if (m_criticalSection != NULL) { + m_criticalSection->Enter(); } } // FUNCTION: LEGO1 0x100b8ef0 MxAutoLock::~MxAutoLock() { - if (this->m_criticalSection != 0) { - this->m_criticalSection->Leave(); + if (m_criticalSection != NULL) { + m_criticalSection->Leave(); } } diff --git a/LEGO1/omni/src/system/mxcriticalsection.cpp b/LEGO1/omni/src/system/mxcriticalsection.cpp index 1038f7ad..f0adc551 100644 --- a/LEGO1/omni/src/system/mxcriticalsection.cpp +++ b/LEGO1/omni/src/system/mxcriticalsection.cpp @@ -4,35 +4,35 @@ #include -DECOMP_SIZE_ASSERT(MxCriticalSection, 0x1c); +DECOMP_SIZE_ASSERT(MxCriticalSection, 0x1c) // GLOBAL: LEGO1 0x10101e78 -int g_useMutex = 0; +BOOL g_useMutex = FALSE; // FUNCTION: LEGO1 0x100b6d20 MxCriticalSection::MxCriticalSection() { HANDLE mutex; - if (g_useMutex != 0) { + if (g_useMutex) { mutex = CreateMutexA(NULL, FALSE, NULL); - this->m_mutex = mutex; - return; + m_mutex = mutex; + } + else { + InitializeCriticalSection(&m_criticalSection); + m_mutex = NULL; } - - InitializeCriticalSection(&this->m_criticalSection); - this->m_mutex = NULL; } // FUNCTION: LEGO1 0x100b6d60 MxCriticalSection::~MxCriticalSection() { - if (this->m_mutex != NULL) { - CloseHandle(this->m_mutex); - return; + if (m_mutex != NULL) { + CloseHandle(m_mutex); + } + else { + DeleteCriticalSection(&m_criticalSection); } - - DeleteCriticalSection(&this->m_criticalSection); } // FUNCTION: LEGO1 0x100b6d80 @@ -41,8 +41,8 @@ void MxCriticalSection::Enter() DWORD result; FILE* file; - if (this->m_mutex != NULL) { - result = WaitForSingleObject(this->m_mutex, 5000); + if (m_mutex != NULL) { + result = WaitForSingleObject(m_mutex, 5000); if (result == WAIT_FAILED) { file = fopen("C:\\DEADLOCK.TXT", "a"); if (file != NULL) { @@ -54,23 +54,23 @@ void MxCriticalSection::Enter() } } else { - EnterCriticalSection(&this->m_criticalSection); + EnterCriticalSection(&m_criticalSection); } } // FUNCTION: LEGO1 0x100b6de0 void MxCriticalSection::Leave() { - if (this->m_mutex != NULL) { - ReleaseMutex(this->m_mutex); - return; + if (m_mutex != NULL) { + ReleaseMutex(m_mutex); + } + else { + LeaveCriticalSection(&m_criticalSection); } - - LeaveCriticalSection(&this->m_criticalSection); } // FUNCTION: LEGO1 0x100b6e00 void MxCriticalSection::SetDoMutex() { - g_useMutex = 1; + g_useMutex = TRUE; } diff --git a/LEGO1/omni/src/system/mxsemaphore.cpp b/LEGO1/omni/src/system/mxsemaphore.cpp index daba60f4..5c8b2a1f 100644 --- a/LEGO1/omni/src/system/mxsemaphore.cpp +++ b/LEGO1/omni/src/system/mxsemaphore.cpp @@ -15,9 +15,11 @@ MxSemaphore::MxSemaphore() MxResult MxSemaphore::Init(MxU32 p_initialCount, MxU32 p_maxCount) { MxResult result = FAILURE; + if ((m_hSemaphore = CreateSemaphoreA(NULL, p_initialCount, p_maxCount, NULL))) { result = SUCCESS; } + return result; } diff --git a/LEGO1/omni/src/system/mxthread.cpp b/LEGO1/omni/src/system/mxthread.cpp index fe327f2d..b0bd5b51 100644 --- a/LEGO1/omni/src/system/mxthread.cpp +++ b/LEGO1/omni/src/system/mxthread.cpp @@ -1,44 +1,10 @@ #include "mxthread.h" #include "decomp.h" -#include "mxmisc.h" -#include "mxtimer.h" #include DECOMP_SIZE_ASSERT(MxThread, 0x1c) -DECOMP_SIZE_ASSERT(MxTickleThread, 0x20) - -// FUNCTION: LEGO1 0x100b8bb0 -MxTickleThread::MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS) -{ - m_target = p_target; - m_frequencyMS = p_frequencyMS; -} - -// Match except for register allocation -// FUNCTION: LEGO1 0x100b8c90 -MxResult MxTickleThread::Run() -{ - MxTimer* timer = Timer(); - MxS32 lastTickled = -m_frequencyMS; - while (IsRunning()) { - MxLong currentTime = timer->GetTime(); - - if (currentTime < lastTickled) { - lastTickled = -m_frequencyMS; - } - - MxS32 timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled; - if (timeRemainingMS <= 0) { - m_target->Tickle(); - timeRemainingMS = 0; - lastTickled = currentTime; - } - Sleep(timeRemainingMS); - } - return MxThread::Run(); -} // FUNCTION: LEGO1 0x100bf510 MxThread::MxThread() @@ -62,12 +28,14 @@ typedef unsigned(__stdcall* ThreadFunc)(void*); MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag) { MxResult result = FAILURE; + if (m_semaphore.Init(0, 1) == SUCCESS) { if ((m_hThread = _beginthreadex(NULL, p_stack << 2, (ThreadFunc) &MxThread::ThreadProc, this, p_flag, &m_threadId))) { result = SUCCESS; } } + return result; } diff --git a/LEGO1/omni/src/system/mxticklethread.cpp b/LEGO1/omni/src/system/mxticklethread.cpp new file mode 100644 index 00000000..779e0cd8 --- /dev/null +++ b/LEGO1/omni/src/system/mxticklethread.cpp @@ -0,0 +1,41 @@ +#include "mxticklethread.h" + +#include "decomp.h" +#include "mxmisc.h" +#include "mxtimer.h" + +DECOMP_SIZE_ASSERT(MxTickleThread, 0x20) + +// FUNCTION: LEGO1 0x100b8bb0 +MxTickleThread::MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS) +{ + m_target = p_target; + m_frequencyMS = p_frequencyMS; +} + +// Match except for register allocation +// FUNCTION: LEGO1 0x100b8c90 +MxResult MxTickleThread::Run() +{ + MxTimer* timer = Timer(); + MxS32 lastTickled = -m_frequencyMS; + + while (IsRunning()) { + MxLong currentTime = timer->GetTime(); + + if (currentTime < lastTickled) { + lastTickled = -m_frequencyMS; + } + + MxS32 timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled; + if (timeRemainingMS <= 0) { + m_target->Tickle(); + timeRemainingMS = 0; + lastTickled = currentTime; + } + + Sleep(timeRemainingMS); + } + + return MxThread::Run(); +} diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index f3bf04fd..3c57ac52 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -7,8 +7,8 @@ #include "mxpalette.h" #include "mxpresenter.h" #include "mxregion.h" -#include "mxthread.h" #include "mxticklemanager.h" +#include "mxticklethread.h" DECOMP_SIZE_ASSERT(MxVideoManager, 0x64) From eeb81b7223c003b40d1dc2267555a815d08f8967 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 16:02:58 -0400 Subject: [PATCH 02/26] Use USHRT_MAX instead of MAXWORD (#975) --- .../src/common/legoactioncontrolpresenter.cpp | 6 +++--- .../legoomni/src/common/legoanimmmpresenter.cpp | 6 +++--- .../legoomni/src/common/mxcontrolpresenter.cpp | 6 +++--- .../legoomni/src/control/legometerpresenter.cpp | 6 +++--- .../legoomni/src/entity/legoactorpresenter.cpp | 6 +++--- .../legoomni/src/entity/legoentitypresenter.cpp | 6 +++--- .../legoomni/src/entity/legoworldpresenter.cpp | 6 +++--- .../legoomni/src/paths/legopathpresenter.cpp | 6 +++--- .../legoomni/src/video/legoanimpresenter.cpp | 12 ++++++------ .../legoomni/src/video/legomodelpresenter.cpp | 6 +++--- LEGO1/lego/sources/roi/legolod.cpp | 16 ++++++++-------- LEGO1/omni/src/audio/mxwavepresenter.cpp | 6 +++--- LEGO1/omni/src/common/mxpresenter.cpp | 12 ++++++------ LEGO1/omni/src/video/mxstillpresenter.cpp | 6 +++--- 14 files changed, 53 insertions(+), 53 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp index 607a0595..69ca127f 100644 --- a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp @@ -77,10 +77,10 @@ void LegoActionControlPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[1024]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[1024]; if (KeyValueStringParse(output, g_strACTION, extraCopy)) { diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index b88392e5..d115e732 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -241,10 +241,10 @@ void LegoAnimMMPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[1024]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[1024]; if (KeyValueStringParse(output, g_strANIMMAN_ID, extraCopy)) { diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 96e6d598..b1edc1e9 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -244,10 +244,10 @@ void MxControlPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[256]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[256]; if (KeyValueStringParse(output, g_strSTYLE, extraCopy)) { diff --git a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index c6c8352a..f0df5de9 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -40,10 +40,10 @@ void LegoMeterPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[256]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[256]; if (KeyValueStringParse(extraCopy, g_strTYPE, output)) { diff --git a/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp index 40273e1c..40cfb958 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp @@ -34,10 +34,10 @@ void LegoActorPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; m_entity->ParseAction(extraCopy); } diff --git a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp index a755bb2f..70be36c4 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp @@ -96,10 +96,10 @@ void LegoEntityPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; m_entity->ParseAction(extraCopy); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index a4e5902b..cc64360f 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -429,10 +429,10 @@ void LegoWorldPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[1024]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[1024]; if (KeyValueStringParse(output, g_strWORLD, extraCopy)) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index f5cb137b..42366127 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -122,10 +122,10 @@ void LegoPathPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[256], output[256]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; strupr(extraCopy); diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 9d126327..5f8662df 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -947,18 +947,18 @@ void LegoAnimPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[256]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[256]; if (KeyValueStringParse(NULL, g_strFROM_PARENT, extraCopy) && m_compositePresenter != NULL) { m_compositePresenter->GetAction()->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + if (extraLength & USHRT_MAX) { + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; } } diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 7395ccfc..ce448d71 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -296,11 +296,11 @@ void LegoModelPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[1024], output[1024]; output[0] = '\0'; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; if (KeyValueStringParse(output, g_strAUTO_CREATE, extraCopy) != 0) { char* token = strtok(output, g_parseExtraTokens); diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 2170c101..c325c670 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -137,14 +137,14 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text goto done; } - m_numPolys += numPolys & MAXWORD; + m_numPolys += numPolys & USHRT_MAX; if (p_storage->Read(&numVertices, 2) != SUCCESS) { goto done; } - polyIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*polyIndices)]; - if (p_storage->Read(polyIndices, (numPolys & MAXWORD) * sizeof(*polyIndices)) != SUCCESS) { + polyIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*polyIndices)]; + if (p_storage->Read(polyIndices, (numPolys & USHRT_MAX) * sizeof(*polyIndices)) != SUCCESS) { goto done; } @@ -153,8 +153,8 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } if (numTextureIndices > 0) { - textureIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*textureIndices)]; - if (p_storage->Read(textureIndices, (numPolys & MAXWORD) * sizeof(*textureIndices)) != SUCCESS) { + textureIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*textureIndices)]; + if (p_storage->Read(textureIndices, (numPolys & USHRT_MAX) * sizeof(*textureIndices)) != SUCCESS) { goto done; } } @@ -179,7 +179,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text shadingModel = Tgl::Gouraud; } - m_numVertices += numVertices & MAXWORD; + m_numVertices += numVertices & USHRT_MAX; textureName = mesh->GetTextureName(); materialName = mesh->GetMaterialName(); @@ -194,8 +194,8 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } m_melems[meshIndex].m_tglMesh = m_meshBuilder->CreateMesh( - numPolys & MAXWORD, - numVertices & MAXWORD, + numPolys & USHRT_MAX, + numVertices & USHRT_MAX, vertices, normals, textureVertices, diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index bc6f0683..80e52dd1 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -331,10 +331,10 @@ void MxWavePresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char soundValue[512]; if (KeyValueStringParse(soundValue, g_strSOUND, extraCopy)) { diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index 5d19f091..e599f568 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -87,10 +87,10 @@ void MxPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char worldValue[512]; if (KeyValueStringParse(worldValue, g_strWORLD, extraCopy)) { @@ -251,10 +251,10 @@ MxEntity* MxPresenter::CreateEntity(const char* p_defaultName) char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; KeyValueStringParse(objectName, g_strOBJECT, extraCopy); } diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 53fb3b35..4cae0f26 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -202,10 +202,10 @@ void MxStillPresenter::ParseExtra() char* extraData; m_action->GetExtra(extraLength, extraData); - if (extraLength & MAXWORD) { + if (extraLength & USHRT_MAX) { char extraCopy[512]; - memcpy(extraCopy, extraData, extraLength & MAXWORD); - extraCopy[extraLength & MAXWORD] = '\0'; + memcpy(extraCopy, extraData, extraLength & USHRT_MAX); + extraCopy[extraLength & USHRT_MAX] = '\0'; char output[512]; if (KeyValueStringParse(output, g_strVISIBILITY, extraCopy)) { From 3b3ac07cac2943c304481dfbad67614761f94463 Mon Sep 17 00:00:00 2001 From: DmitriLeon2000 Date: Fri, 31 May 2024 09:04:06 +0900 Subject: [PATCH 03/26] Rename LegoEdge::GetOpposingPoint to LegoEdge::CWVertex (#977) --- LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp | 2 +- LEGO1/lego/legoomni/src/paths/legopathactor.cpp | 8 ++++---- LEGO1/lego/legoomni/src/paths/legopathboundary.cpp | 6 +++--- LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp | 4 ++-- LEGO1/lego/sources/geom/legoedge.cpp | 2 +- LEGO1/lego/sources/geom/legoedge.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 39de0c7a..40afb7a3 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2451,7 +2451,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale) { Mx3DPointFloat p1; - Vector3* v1 = p_edge->GetOpposingPoint(*p_boundary); + Vector3* v1 = p_edge->CWVertex(*p_boundary); Vector3* v2 = p_edge->CCWVertex(*p_boundary); p1 = *v2; diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 17d89e68..430914b2 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -94,9 +94,9 @@ MxResult LegoPathActor::VTable0x88( float p_destScale ) { - Vector3* v1 = p_srcEdge.GetOpposingPoint(*p_boundary); + Vector3* v1 = p_srcEdge.CWVertex(*p_boundary); Vector3* v2 = p_srcEdge.CCWVertex(*p_boundary); - Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary); + Vector3* v3 = p_destEdge.CWVertex(*p_boundary); Vector3* v4 = p_destEdge.CCWVertex(*p_boundary); Mx3DPointFloat p1, p2, p3, p4, p5; @@ -171,7 +171,7 @@ MxResult LegoPathActor::VTable0x84( float p_destScale ) { - Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary); + Vector3* v3 = p_destEdge.CWVertex(*p_boundary); Vector3* v4 = p_destEdge.CCWVertex(*p_boundary); Mx3DPointFloat p2, p3, p5; @@ -624,7 +624,7 @@ MxResult LegoPathActor::VTable0x9c() if (local20 != 0) { Mx3DPointFloat local78; - Vector3& v1 = *m_destEdge->GetOpposingPoint(*m_boundary); + Vector3& v1 = *m_destEdge->CWVertex(*m_boundary); Vector3& v2 = *m_destEdge->CCWVertex(*m_boundary); LERP3(local34, v1, v2, m_unk0xe4); diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 81108d61..bcd1875c 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -231,7 +231,7 @@ MxU32 LegoPathBoundary::Intersect( Mx3DPointFloat local50; Mx3DPointFloat local70; - Vector3* local5c = e->GetOpposingPoint(*this); + Vector3* local5c = e->CWVertex(*this); p_point3 = vec; p_point3.Mul(localc); @@ -256,7 +256,7 @@ MxU32 LegoPathBoundary::Intersect( break; } - Vector3* local90 = local88->GetOpposingPoint(*this); + Vector3* local90 = local88->CWVertex(*this); Mx3DPointFloat locala4(p_point3); ((Vector3&) locala4).Sub(local90); @@ -283,7 +283,7 @@ MxU32 LegoPathBoundary::Intersect( break; } - Vector3* localc4 = locala8->GetOpposingPoint(*this); + Vector3* localc4 = locala8->CWVertex(*this); Mx3DPointFloat locald8(p_point3); ((Vector3&) locald8).Sub(localc4); diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 3a5a763b..19fc04fd 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -756,9 +756,9 @@ MxS32 LegoPathController::FUN_1004a240( Mx3DPointFloat vec; p_v1 = *p_edge->CCWVertex(*p_boundary); - p_v1.Sub(p_edge->GetOpposingPoint(*p_boundary)); + p_v1.Sub(p_edge->CWVertex(*p_boundary)); p_v1.Mul(p_f1); - p_v1.Add(p_edge->GetOpposingPoint(*p_boundary)); + p_v1.Add(p_edge->CWVertex(*p_boundary)); p_edge->FUN_1002ddc0(*p_boundary, vec); p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec); return 0; diff --git a/LEGO1/lego/sources/geom/legoedge.cpp b/LEGO1/lego/sources/geom/legoedge.cpp index 1788a0d7..7606d6a1 100644 --- a/LEGO1/lego/sources/geom/legoedge.cpp +++ b/LEGO1/lego/sources/geom/legoedge.cpp @@ -51,7 +51,7 @@ LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge& p_face) } // FUNCTION: LEGO1 0x1009a510 -Vector3* LegoEdge::GetOpposingPoint(LegoWEEdge& p_face) +Vector3* LegoEdge::CWVertex(LegoWEEdge& p_face) { return &p_face == m_faceA ? m_pointB : m_pointA; } diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index 0f238c37..753d6e11 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -14,7 +14,7 @@ struct LegoEdge { LegoEdge* GetClockwiseEdge(LegoWEEdge& p_face); LegoEdge* GetCounterclockwiseEdge(LegoWEEdge& p_face); - Vector3* GetOpposingPoint(LegoWEEdge& p_face); + Vector3* CWVertex(LegoWEEdge& p_face); Vector3* CCWVertex(LegoWEEdge& p_face); LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); From 77af1a5483780db06f09558d248a4766763c8701 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 31 May 2024 17:15:35 -0400 Subject: [PATCH 04/26] Fix Radio::HandleControl COMPAT_MODE branch (#978) --- LEGO1/lego/legoomni/src/actors/radio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index f625e787..e78e7ba8 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -111,7 +111,7 @@ MxLong Radio::HandleControl(LegoControlManagerEvent& p_param) if (CurrentWorld()) { #ifdef COMPAT_MODE - MxNotificationParam param(c_notificationEndAction, this); + MxNotificationParam param(c_notificationType0, this); CurrentWorld()->Notify(param); #else CurrentWorld()->Notify(MxNotificationParam(c_notificationType0, this)); From b67af71f338924b12e5514eed82d292bc92781e4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 31 May 2024 22:46:05 -0400 Subject: [PATCH 05/26] Improve naming, use virtual key constants (#979) --- ISLE/isleapp.cpp | 2 +- .../lego/legoomni/include/legoinputmanager.h | 8 ++-- .../legoomni/src/entity/legonavcontroller.cpp | 2 +- .../legoomni/src/input/legoinputmanager.cpp | 43 ++++++++++--------- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 3 +- LEGO1/lego/legoomni/src/worlds/police.cpp | 2 +- .../legoomni/src/worlds/registrationbook.cpp | 8 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 6f6296aa..3f0892ed 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -153,7 +153,7 @@ void IsleApp::Close() if (Lego()) { GameState()->Save(0); if (InputManager()) { - InputManager()->QueueEvent(c_notificationKeyPress, 0, 0, 0, 0x20); + InputManager()->QueueEvent(c_notificationKeyPress, 0, 0, 0, VK_SPACE); } VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL); diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 2bd7e26b..c4a0dc1a 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -125,8 +125,8 @@ class LegoInputManager : public MxPresenter { void ProcessEvents(); MxBool ProcessOneEvent(LegoEventNotificationParam& p_param); MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param); - void FUN_1005c0f0(); - MxResult FUN_1005c160(MxU32& p_keyFlags); + void GetKeyboardState(); + MxResult GetNavigationKeyStates(MxU32& p_keyFlags); // SYNTHETIC: LEGO1 0x1005b8d0 // LegoInputManager::`scalar deleting destructor' @@ -148,8 +148,8 @@ class LegoInputManager : public MxPresenter { MxBool m_unk0x88; // 0x88 IDirectInput* m_directInput; // 0x8c IDirectInputDevice* m_directInputDevice; // 0x90 - MxBool m_unk0x94; // 0x94 - MxU8 m_unk0x95[256]; // 0x95 + MxBool m_kbStateSuccess; // 0x94 + MxU8 m_keyboardState[256]; // 0x95 MxBool m_unk0x195; // 0x195 MxS32 m_joyid; // 0x198 MxS32 m_joystickIndex; // 0x19c diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 63377d72..7f5fef34 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -537,7 +537,7 @@ MxResult LegoNavController::ProcessKeyboardInput() LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager(); MxU32 keyFlags; - if (inputManager == NULL || inputManager->FUN_1005c160(keyFlags) == FAILURE) { + if (inputManager == NULL || inputManager->GetNavigationKeyStates(keyFlags) == FAILURE) { return FAILURE; } diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 200652b1..de3ae8b2 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -40,7 +40,7 @@ LegoInputManager::LegoInputManager() m_unk0x88 = FALSE; m_directInput = NULL; m_directInputDevice = NULL; - m_unk0x94 = FALSE; + m_kbStateSuccess = FALSE; m_unk0x195 = 0; m_joyid = -1; m_joystickIndex = -1; @@ -142,63 +142,63 @@ void LegoInputManager::ReleaseDX() } // FUNCTION: LEGO1 0x1005c0f0 -void LegoInputManager::FUN_1005c0f0() +void LegoInputManager::GetKeyboardState() { - m_unk0x94 = FALSE; + m_kbStateSuccess = FALSE; if (m_directInputDevice) { - HRESULT hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95); + HRESULT hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_keyboardState), &m_keyboardState); if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) { if (m_directInputDevice->Acquire() == S_OK) { - hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95); + hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_keyboardState), &m_keyboardState); } } if (hr == S_OK) { - m_unk0x94 = TRUE; + m_kbStateSuccess = TRUE; } } } // FUNCTION: LEGO1 0x1005c160 -MxResult LegoInputManager::FUN_1005c160(MxU32& p_keyFlags) +MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags) { - FUN_1005c0f0(); + GetKeyboardState(); - if (!m_unk0x94) { + if (!m_kbStateSuccess) { return FAILURE; } if (g_unk0x100f67b8) { - if (m_unk0x95[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) { - m_unk0x95[DIK_LEFT] = 0; + if (m_keyboardState[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) { + m_keyboardState[DIK_LEFT] = 0; } - if (m_unk0x95[DIK_RIGHT] & 0x80 && GetAsyncKeyState(VK_RIGHT) == 0) { - m_unk0x95[DIK_RIGHT] = 0; + if (m_keyboardState[DIK_RIGHT] & 0x80 && GetAsyncKeyState(VK_RIGHT) == 0) { + m_keyboardState[DIK_RIGHT] = 0; } } MxU32 keyFlags = 0; - if ((m_unk0x95[DIK_NUMPAD8] | m_unk0x95[DIK_UP]) & 0x80) { + if ((m_keyboardState[DIK_NUMPAD8] | m_keyboardState[DIK_UP]) & 0x80) { keyFlags |= c_up; } - if ((m_unk0x95[DIK_NUMPAD2] | m_unk0x95[DIK_DOWN]) & 0x80) { + if ((m_keyboardState[DIK_NUMPAD2] | m_keyboardState[DIK_DOWN]) & 0x80) { keyFlags |= c_down; } - if ((m_unk0x95[DIK_NUMPAD4] | m_unk0x95[DIK_LEFT]) & 0x80) { + if ((m_keyboardState[DIK_NUMPAD4] | m_keyboardState[DIK_LEFT]) & 0x80) { keyFlags |= c_left; } - if ((m_unk0x95[DIK_NUMPAD6] | m_unk0x95[DIK_RIGHT]) & 0x80) { + if ((m_keyboardState[DIK_NUMPAD6] | m_keyboardState[DIK_RIGHT]) & 0x80) { keyFlags |= c_right; } - if ((m_unk0x95[DIK_LCONTROL] | m_unk0x95[DIK_RCONTROL]) & 0x80) { + if ((m_keyboardState[DIK_LCONTROL] | m_keyboardState[DIK_RCONTROL]) & 0x80) { keyFlags |= c_bit5; } @@ -290,6 +290,7 @@ MxResult LegoInputManager::GetJoystickState( } } } + return FAILURE; } @@ -345,7 +346,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == c_notificationButtonDown)))) || - ((m_unk0x336 && (p_key == ' ')))) { + ((m_unk0x336 && (p_key == VK_SPACE)))) { ProcessOneEvent(param); } } @@ -369,8 +370,8 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) MxBool processRoi; if (p_param.GetType() == c_notificationKeyPress) { - if (!Lego()->IsTimerRunning() || p_param.GetKey() == 0x13) { - if (p_param.GetKey() == 0x10) { + if (!Lego()->IsTimerRunning() || p_param.GetKey() == VK_PAUSE) { + if (p_param.GetKey() == VK_SHIFT) { if (m_unk0x195) { m_unk0x80 = FALSE; p_param.SetType(c_notificationDrag); diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 4042eb8d..5f48e5f0 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -297,7 +297,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) // FUNCTION: LEGO1 0x10005920 MxLong GasStation::HandleKeyPress(MxS8 p_key) { - if (p_key == ' ' && g_unk0x100f0160 == 0 && this->m_unk0x106 != 0) { + if (p_key == VK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) { m_state->FUN_10006490(); return 1; } diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 59d265f7..5848b4ad 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -226,7 +226,7 @@ MxLong Hospital::HandleKeyPress(MxS8 p_key) { MxLong result = 0; - if (p_key == ' ' && g_unk0x100f7918 == 0) { + if (p_key == VK_SPACE && g_unk0x100f7918 == 0) { DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); result = 1; } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 2277300a..942551bd 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -612,7 +612,6 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y) VideoManager()->SortPresenterList(); m_unk0x11c->Enable(TRUE); m_unk0x11c->SetPosition(p_x, p_y); - m_unk0x11c->SetDisplayZ(oldDisplayZ); } else { @@ -631,7 +630,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key) { MxLong result = 0; - if (p_key == ' ' && m_worldStarted) { + if (p_key == VK_SPACE && m_worldStarted) { switch (m_infocenterState->GetUnknown0x74()) { case 0: StopCutscene(); diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index b80e1a33..897fa52c 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -164,7 +164,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param) { MxLong result = 0; - if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) { + if (p_param.GetKey() == VK_SPACE && m_policeState->GetUnknown0x0c() == 1) { DeleteObjects(&m_atom, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim); m_policeState->SetUnknown0x0c(0); return 1; diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 28cd8c27..803074d8 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -166,13 +166,13 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) key = p_key; } - if ((key < 'A' || key > 'Z') && key != '\b') { - if (key == ' ') { + if ((key < 'A' || key > 'Z') && key != VK_BACK) { + if (key == VK_SPACE) { DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); BackgroundAudioManager()->RaiseVolume(); } } - else if (key != '\b' && m_unk0x280.m_cursorPos < 7) { + else if (key != VK_BACK && m_unk0x280.m_cursorPos < 7) { m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone(); if (m_name[0][m_unk0x280.m_cursorPos] != NULL) { @@ -190,7 +190,7 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) } } else { - if (key == '\b' && m_unk0x280.m_cursorPos > 0) { + if (key == VK_BACK && m_unk0x280.m_cursorPos > 0) { m_unk0x280.m_cursorPos--; m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE); From df20b0551007de293cc8b8c54870eb7999ebbfa6 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 10:07:58 -0400 Subject: [PATCH 06/26] Define cursor enum and custom cursor window message (#980) * Define cursor enum and custom cursor window message * Fix param name * Remove unused header --- ISLE/isleapp.cpp | 27 ++++++++++--------- .../include/legoeventnotificationparam.h | 8 +++--- LEGO1/lego/legoomni/include/legonotify.h | 11 -------- LEGO1/lego/legoomni/include/legoutils.h | 19 ++++++++++++- LEGO1/lego/legoomni/src/common/legoutils.cpp | 4 +-- .../src/common/mxtransitionmanager.cpp | 2 +- .../src/entity/legocameracontroller.cpp | 5 ++-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../legoomni/src/input/legoinputmanager.cpp | 2 +- LEGO1/lego/legoomni/src/main/legomain.cpp | 6 ++--- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 8 +++--- LEGO1/lego/legoomni/src/worlds/isle.cpp | 8 +++--- 12 files changed, 54 insertions(+), 48 deletions(-) delete mode 100644 LEGO1/lego/legoomni/include/legonotify.h diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 3f0892ed..dc087d57 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -9,6 +9,7 @@ #include "legomain.h" #include "legomodelpresenter.h" #include "legopartpresenter.h" +#include "legoutils.h" #include "legovideomanager.h" #include "legoworldpresenter.h" #include "misc.h" @@ -506,7 +507,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) g_mousedown = 0; type = c_notificationButtonUp; break; - case 0x5400: + case WM_ISLE_SETCURSOR: if (g_isle) { g_isle->SetupCursor(wParam); return 0; @@ -893,25 +894,25 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame) void IsleApp::SetupCursor(WPARAM wParam) { switch (wParam) { - case 0: + case e_cursorArrow: m_cursorCurrent = m_cursorArrow; break; - case 1: + case e_cursorBusy: m_cursorCurrent = m_cursorBusy; break; - case 2: + case e_cursorNo: m_cursorCurrent = m_cursorNo; break; - case 0xB: + case e_cursorNone: m_cursorCurrent = NULL; - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 0xA: + case e_cursorUnused3: + case e_cursorUnused4: + case e_cursorUnused5: + case e_cursorUnused6: + case e_cursorUnused7: + case e_cursorUnused8: + case e_cursorUnused9: + case e_cursorUnused10: break; } diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index cdd771e3..2499454f 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -13,10 +13,10 @@ class LegoROI; class LegoEventNotificationParam : public MxNotificationParam { public: enum { - c_lButtonState = 0x01, - c_rButtonState = 0x02, - c_modKey1 = 0x04, - c_modKey2 = 0x08, + c_lButtonState = 1, + c_rButtonState = 2, + c_modKey1 = 4, + c_modKey2 = 8, }; // FUNCTION: LEGO1 0x10028690 diff --git a/LEGO1/lego/legoomni/include/legonotify.h b/LEGO1/lego/legoomni/include/legonotify.h deleted file mode 100644 index ed4218b2..00000000 --- a/LEGO1/lego/legoomni/include/legonotify.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef LEGONOTIFY_H -#define LEGONOTIFY_H - -enum LegoEventNotificationParamType { - c_lButtonState = 1, - c_rButtonState = 2, - c_modKey1 = 4, - c_modKey2 = 8, -}; - -#endif // LEGONOTIFY_H diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 118b6c1d..09e2d72e 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -7,6 +7,23 @@ #include +#define WM_ISLE_SETCURSOR 0x5400 + +enum Cursor { + e_cursorArrow = 0, + e_cursorBusy, + e_cursorNo, + e_cursorUnused3, + e_cursorUnused4, + e_cursorUnused5, + e_cursorUnused6, + e_cursorUnused7, + e_cursorUnused8, + e_cursorUnused9, + e_cursorUnused10, + e_cursorNone +}; + class MxAtomId; class LegoEntity; class LegoFile; @@ -28,7 +45,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool p_enable); -void SetAppCursor(WPARAM p_wparam); +void SetAppCursor(Cursor p_cursor); MxBool FUN_1003ef60(); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); MxS32 UpdateLightPosition(MxS32 p_increase); diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 60d96755..62783224 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -449,9 +449,9 @@ void FUN_1003ef00(MxBool p_enable) } // FUNCTION: LEGO1 0x1003ef40 -void SetAppCursor(WPARAM p_wparam) +void SetAppCursor(Cursor p_cursor) { - PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0); + PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), WM_ISLE_SETCURSOR, p_cursor, 0); } // FUNCTION: LEGO1 0x1003ef60 diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index 90a37ef2..bb252592 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -124,7 +124,7 @@ MxResult MxTransitionManager::StartTransition( LegoVideoManager* videoManager = VideoManager(); videoManager->SetRender3D(FALSE); - SetAppCursor(1); + SetAppCursor(e_cursorBusy); return SUCCESS; } return FAILURE; diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index da455eab..b07bb02a 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -2,7 +2,6 @@ #include "3dmanager/lego3dmanager.h" #include "legoinputmanager.h" -#include "legonotify.h" #include "legosoundmanager.h" #include "legovideomanager.h" #include "misc.h" @@ -109,10 +108,10 @@ void LegoCameraController::OnRButtonUp(MxPoint32 p_point) // FUNCTION: LEGO1 0x10012230 void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point) { - if (p_modifier & c_lButtonState) { + if (p_modifier & LegoEventNotificationParam::c_lButtonState) { LeftDrag(p_point.GetX(), p_point.GetY()); } - else if (p_modifier & c_rButtonState) { + else if (p_modifier & LegoEventNotificationParam::c_rButtonState) { RightDrag(p_point.GetX(), p_point.GetY()); } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 5d4dcd00..71ffefae 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -766,7 +766,7 @@ MxResult LegoWorld::Tickle() switch (m_startupTicks) { case e_start: m_worldStarted = TRUE; - SetAppCursor(0); + SetAppCursor(e_cursorArrow); ReadyWorld(); return TRUE; case e_two: diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index de3ae8b2..e99bdeec 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -401,7 +401,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) if (m_unk0x335 != 0) { if (p_param.GetType() == c_notificationButtonDown) { - LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, ' '); + LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, VK_SPACE); LegoNotifyListCursor cursor(m_keyboardNotifyList); MxCore* target; diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 7b559faa..ba6d7d84 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -254,7 +254,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) } m_notificationManager->Register(this); - SetAppCursor(1); + SetAppCursor(e_cursorBusy); m_gameState->SetCurrentAct(LegoGameState::e_act1); result = SUCCESS; @@ -582,12 +582,12 @@ MxLong LegoOmni::Notify(MxParam& p_param) void LegoOmni::StartTimer() { MxOmni::StartTimer(); - SetAppCursor(2); + SetAppCursor(e_cursorNo); } // FUNCTION: LEGO1 0x1005b650 void LegoOmni::StopTimer() { MxOmni::StopTimer(); - SetAppCursor(0); + SetAppCursor(e_cursorArrow); } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 942551bd..8308cf11 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -57,7 +57,7 @@ Infocenter::Infocenter() memset(&m_mapAreas, 0, sizeof(m_mapAreas)); m_unk0x1c8 = -1; - SetAppCursor(1); + SetAppCursor(e_cursorBusy); NotificationManager()->Register(this); m_infoManDialogueTimer = 0; @@ -1183,7 +1183,7 @@ void Infocenter::PlayCutscene(Cutscene p_entityId, MxBool p_scale) VideoManager()->EnableFullScreenMovie(TRUE, p_scale); InputManager()->SetUnknown336(TRUE); InputManager()->SetUnknown335(TRUE); - SetAppCursor(0xb); // Hide cursor + SetAppCursor(e_cursorNone); VideoManager()->GetDisplaySurface()->ClearScreen(); if (m_currentCutscene != e_noIntro) { @@ -1205,7 +1205,7 @@ void Infocenter::StopCutscene() VideoManager()->EnableFullScreenMovie(FALSE); InputManager()->SetUnknown335(FALSE); - SetAppCursor(0); // Restore cursor to arrow + SetAppCursor(e_cursorArrow); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } @@ -1405,7 +1405,7 @@ void Infocenter::StartCredits() GetViewManager()->RemoveAll(NULL); InvokeAction(Extra::e_opendisk, *g_creditsScript, CreditsScript::c_LegoCredits, NULL); - SetAppCursor(0); + SetAppCursor(e_cursorArrow); } // FUNCTION: LEGO1 0x10071250 diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f99cf6fc..78d05c70 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -816,7 +816,7 @@ void Isle::Enable(MxBool p_enable) break; } - SetAppCursor(0); + SetAppCursor(e_cursorArrow); if (m_act1state->m_unk0x018 != 8 && (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_elevride) && @@ -952,7 +952,7 @@ MxLong Isle::HandleTransitionEnd() VariableTable()->SetVariable("VISIBILITY", "Show Gas"); AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); - SetAppCursor(0); + SetAppCursor(e_cursorArrow); SetIsWorldActive(TRUE); break; case LegoGameState::e_unk33: @@ -962,7 +962,7 @@ MxLong Isle::HandleTransitionEnd() VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); - SetAppCursor(0); + SetAppCursor(e_cursorArrow); SetIsWorldActive(TRUE); break; case LegoGameState::e_polidoor: @@ -1073,7 +1073,7 @@ void Isle::FUN_10032d30( } FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); - SetAppCursor(0); + SetAppCursor(e_cursorArrow); m_destLocation = LegoGameState::e_undefined; m_act1state->m_unk0x01f = FALSE; } From 375ac29b9b87e113feb3ca96f5da79021b7d6bb5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 12:23:48 -0400 Subject: [PATCH 07/26] Implement/match Lego3DSound::Create (#981) * Implement/match Lego3DSound::Create * Add space * Naming * Changes --- LEGO1/lego/legoomni/include/lego3dsound.h | 24 +++-- LEGO1/lego/legoomni/include/legoactor.h | 15 +-- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 91 +++++++++++++++---- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- .../legoomni/src/entity/legocarraceactor.cpp | 2 +- 5 files changed, 97 insertions(+), 37 deletions(-) diff --git a/LEGO1/lego/legoomni/include/lego3dsound.h b/LEGO1/lego/legoomni/include/lego3dsound.h index a6f4bb02..14be04ee 100644 --- a/LEGO1/lego/legoomni/include/lego3dsound.h +++ b/LEGO1/lego/legoomni/include/lego3dsound.h @@ -6,6 +6,7 @@ #include +class LegoActor; class LegoROI; // VTABLE: LEGO1 0x100d5778 @@ -16,7 +17,7 @@ class Lego3DSound { virtual ~Lego3DSound(); void Init(); - MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume); + MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume); void Destroy(); undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer); void FUN_10011ca0(); @@ -26,15 +27,18 @@ class Lego3DSound { // Lego3DSound::`scalar deleting destructor' private: - undefined m_unk0x04[4]; // 0x04 - LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 - LegoROI* m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - MxBool m_unk0x14; // 0x14 - MxBool m_unk0x15; // 0x15 - undefined4 m_unk0x18; // 0x18 - undefined m_unk0x1c[0x10]; // 0x1c - MxS32 m_volume; // 0x2c + LPDIRECTSOUND3DBUFFER m_ds3dBuffer; // 0x08 + LegoROI* m_roi; // 0x0c + LegoROI* m_positionROI; // 0x10 + MxBool m_enabled; // 0x14 + MxBool m_isActor; // 0x15 + LegoActor* m_actor; // 0x18 + double m_frequencyFactor; // 0x20 + DWORD m_dwFrequency; // 0x28 + MxS32 m_volume; // 0x2c }; +// GLOBAL: LEGO1 0x100db6c0 +// IID_IDirectSound3DBuffer + #endif // LEGO3DSOUND_H diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index ebde373c..267de5a0 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -30,10 +30,13 @@ class LegoActor : public LegoEntity { void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 // FUNCTION: LEGO1 0x10002cc0 - virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50 + virtual MxFloat GetSoundFrequencyFactor() { return m_frequencyFactor; } // vtable+0x50 // FUNCTION: LEGO1 0x10002cd0 - virtual void VTable0x54(MxFloat p_unk0x68) { m_unk0x68 = p_unk0x68; } // vtable+0x54 + virtual void SetSoundFrequencyFactor(MxFloat p_frequencyFactor) + { + m_frequencyFactor = p_frequencyFactor; + } // vtable+0x54 // FUNCTION: LEGO1 0x10002ce0 virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58 @@ -52,10 +55,10 @@ class LegoActor : public LegoEntity { protected: void FUN_1002d6e0(MxBool); - MxFloat m_unk0x68; // 0x68 - LegoCacheSound* m_sound; // 0x6c - MxFloat m_unk0x70; // 0x70 - MxU8 m_actorId; // 0x74 + MxFloat m_frequencyFactor; // 0x68 + LegoCacheSound* m_sound; // 0x6c + MxFloat m_unk0x70; // 0x70 + MxU8 m_actorId; // 0x74 }; // SYNTHETIC: LEGO1 0x1002d300 diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 23b7a8c5..bc68915b 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -1,5 +1,6 @@ #include "lego3dsound.h" +#include "legoactor.h" #include "legocharactermanager.h" #include "misc.h" #include "mxomni.h" @@ -21,31 +22,83 @@ Lego3DSound::~Lego3DSound() // FUNCTION: LEGO1 0x10011680 void Lego3DSound::Init() { - m_dsBuffer = NULL; - m_unk0x0c = NULL; - m_unk0x10 = 0; - m_unk0x18 = 0; - m_unk0x14 = FALSE; - m_unk0x15 = FALSE; + m_ds3dBuffer = NULL; + m_roi = NULL; + m_positionROI = NULL; + m_actor = NULL; + m_enabled = FALSE; + m_isActor = FALSE; m_volume = 79; } -// STUB: LEGO1 0x100116a0 +// FUNCTION: LEGO1 0x100116a0 // FUNCTION: BETA10 0x10039647 -MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume) +MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume) { m_volume = p_volume; if (MxOmni::IsSound3D()) { - p_directSoundBuffer->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); - if (m_dsBuffer == NULL) { + p_directSoundBuffer->QueryInterface(IID_IDirectSound3DBuffer, (LPVOID*) &m_ds3dBuffer); + if (m_ds3dBuffer == NULL) { return FAILURE; } - // TODO + m_ds3dBuffer->SetMinDistance(15.0f, 0); + m_ds3dBuffer->SetMaxDistance(100.0f, 0); + m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, 0); + m_ds3dBuffer->SetConeOutsideVolume(-10000, 0); } - // TODO + if (m_ds3dBuffer == NULL || p_name == NULL) { + return SUCCESS; + } + + if (CharacterManager()->Exists(p_name)) { + m_roi = CharacterManager()->GetROI(p_name, TRUE); + m_enabled = m_isActor = TRUE; + } + else { + m_roi = FindROI(p_name); + } + + if (m_roi == NULL) { + m_roi = CharacterManager()->FUN_10085210(NULL, p_name, TRUE); + + if (m_roi != NULL) { + m_enabled = TRUE; + } + } + + if (m_roi == NULL) { + return SUCCESS; + } + + if (m_isActor) { + m_positionROI = m_roi->FindChildROI("head", m_roi); + } + else { + m_positionROI = m_roi; + } + + if (MxOmni::IsSound3D()) { + const float* position = m_positionROI->GetWorldPosition(); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + } + + LegoEntity* entity = m_roi->GetEntity(); + if (entity != NULL && entity->IsA("LegoActor") && ((LegoActor*) entity)->GetSoundFrequencyFactor() != 0.0f) { + m_actor = ((LegoActor*) entity); + } + + p_directSoundBuffer->GetFrequency(&m_dwFrequency); + + if (m_actor != NULL) { + m_frequencyFactor = m_actor->GetSoundFrequencyFactor(); + + if (m_frequencyFactor != 0.0) { + p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency); + } + } return SUCCESS; } @@ -53,17 +106,17 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char // FUNCTION: LEGO1 0x10011880 void Lego3DSound::Destroy() { - if (m_dsBuffer) { - m_dsBuffer->Release(); - m_dsBuffer = NULL; + if (m_ds3dBuffer) { + m_ds3dBuffer->Release(); + m_ds3dBuffer = NULL; } - if (m_unk0x14 && m_unk0x0c && CharacterManager()) { - if (m_unk0x15) { - CharacterManager()->FUN_10083db0(m_unk0x0c); + if (m_enabled && m_roi && CharacterManager()) { + if (m_isActor) { + CharacterManager()->FUN_10083db0(m_roi); } else { - CharacterManager()->FUN_10083f10(m_unk0x0c); + CharacterManager()->FUN_10083f10(m_roi); } } diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 6c455909..79c6571e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -15,7 +15,7 @@ const char* g_actorNames[] = {"none", "pepper", "mama", "papa", "nick", "laura", // FUNCTION: LEGO1 0x1002d110 LegoActor::LegoActor() { - m_unk0x68 = 0.0f; + m_frequencyFactor = 0.0f; m_sound = NULL; m_unk0x70 = 0.0f; m_unk0x10 = 0; diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index 33c04798..af8c95b0 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -30,7 +30,7 @@ LegoCarRaceActor::LegoCarRaceActor() m_unk0x70 = 0.0f; m_unk0x0c = 0; m_unk0x13c = 0.0f; - m_unk0x68 = 1.0f; + m_frequencyFactor = 1.0f; m_unk0x1c = 0; m_unk0x10 = 0.65f; m_unk0x14 = 0.03f; From 23e5ad7d15b84377cbe429ab2abdd0837058710a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 12:45:34 -0400 Subject: [PATCH 08/26] Name/rename functions in LegoCharacterManager (#982) * Name/rename functions in LegoCharacterManager * Name flag --- CMakeLists.txt | 2 +- .../{legocharacters.h => legoactors.h} | 18 +- .../legoomni/include/legocharactermanager.h | 26 +-- LEGO1/lego/legoomni/include/legoentity.h | 6 +- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 10 +- .../{legocharacters.cpp => legoactors.cpp} | 34 +-- .../src/common/legoanimationmanager.cpp | 62 +++--- .../src/common/legocharactermanager.cpp | 203 +++++++++--------- .../legoomni/src/common/legogamestate.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 12 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../legoomni/src/video/legoanimpresenter.cpp | 12 +- .../legoomni/src/video/legomodelpresenter.cpp | 11 +- .../src/video/legophonemepresenter.cpp | 8 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 2 +- 16 files changed, 206 insertions(+), 206 deletions(-) rename LEGO1/lego/legoomni/include/{legocharacters.h => legoactors.h} (81%) rename LEGO1/lego/legoomni/src/common/{legocharacters.cpp => legoactors.cpp} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc660ede..00b4fdda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,11 +321,11 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp LEGO1/lego/legoomni/src/common/animstate.cpp LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp + LEGO1/lego/legoomni/src/common/legoactors.cpp LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp LEGO1/lego/legoomni/src/common/legocharactermanager.cpp - LEGO1/lego/legoomni/src/common/legocharacters.cpp LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp LEGO1/lego/legoomni/src/common/legogamestate.cpp LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp diff --git a/LEGO1/lego/legoomni/include/legocharacters.h b/LEGO1/lego/legoomni/include/legoactors.h similarity index 81% rename from LEGO1/lego/legoomni/include/legocharacters.h rename to LEGO1/lego/legoomni/include/legoactors.h index c21d81c7..46f288b5 100644 --- a/LEGO1/lego/legoomni/include/legocharacters.h +++ b/LEGO1/lego/legoomni/include/legoactors.h @@ -1,5 +1,5 @@ -#ifndef LEGOCHARACTERS_H -#define LEGOCHARACTERS_H +#ifndef LEGOACTORS_H +#define LEGOACTORS_H #include "decomp.h" #include "mxtypes.h" @@ -8,7 +8,7 @@ class LegoExtraActor; class LegoROI; // SIZE 0x108 -struct LegoCharacterInfo { +struct LegoActorInfo { // SIZE 0x18 struct Part { MxU8* m_unk0x00; // 0x00 @@ -29,7 +29,7 @@ struct LegoCharacterInfo { }; // SIZE 0x58 -struct LegoCharacterLOD { +struct LegoActorLOD { enum { c_flag1 = 0x01, c_flag2 = 0x02 @@ -45,7 +45,7 @@ struct LegoCharacterLOD { float m_up[3]; // 0x4c }; -enum LegoCharacterLODs { +enum LegoActorLODs { c_topLOD, c_bodyLOD, c_infohatLOD, @@ -59,7 +59,7 @@ enum LegoCharacterLODs { c_legrtLOD }; -enum LegoCharacterParts { +enum LegoActorParts { c_bodyPart, c_infohatPart, c_infogronPart, @@ -72,7 +72,7 @@ enum LegoCharacterParts { c_legrtPart }; -extern LegoCharacterInfo g_characterInfoInit[66]; -extern LegoCharacterLOD g_characterLODs[11]; +extern LegoActorInfo g_actorInfoInit[66]; +extern LegoActorLOD g_actorLODs[11]; -#endif // LEGOCHARACTERS_H +#endif // LEGOACTORS_H diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index f92bdd76..1032f8b3 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -41,7 +41,7 @@ struct LegoCharacter { MxU32 m_refCount; // 0x04 }; -struct LegoCharacterInfo; +struct LegoActorInfo; typedef map LegoCharacterMap; @@ -53,32 +53,32 @@ class LegoCharacterManager { MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); - LegoROI* GetROI(const char* p_key, MxBool p_createEntity); + LegoROI* GetActorROI(const char* p_name, MxBool p_createEntity); void Init(); static void SetCustomizeAnimFile(const char* p_value); - static MxBool Exists(const char* p_key); + static MxBool IsActor(const char* p_name); - void FUN_100832a0(); - MxBool FUN_10083b20(const char* p_key); + void ReleaseAllActors(); + MxBool Exists(const char* p_name); MxU32 GetRefCount(LegoROI* p_roi); - void FUN_10083c30(const char* p_name); - void FUN_10083db0(LegoROI* p_roi); - void FUN_10083f10(LegoROI* p_roi); + void ReleaseActor(const char* p_name); + void ReleaseActor(LegoROI* p_roi); + void ReleaseAutoROI(LegoROI* p_roi); MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo); - LegoExtraActor* GetActor(const char* p_key); - LegoCharacterInfo* GetInfo(const char* p_key); - LegoCharacterInfo* GetInfo(LegoROI* p_roi); + LegoExtraActor* GetExtraActor(const char* p_name); + LegoActorInfo* GetActorInfo(const char* p_name); + LegoActorInfo* GetActorInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); - LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); + LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } private: - LegoROI* CreateROI(const char* p_key); + LegoROI* CreateActorROI(const char* p_key); void RemoveROI(LegoROI* p_roi); LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name); MxResult FUN_10085870(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 034dc700..5fcced29 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -14,16 +14,16 @@ class Vector3; class LegoEntity : public MxEntity { public: enum Type { - e_character = 0, + e_actor = 0, e_unk1, e_plant, e_building, - e_unk4 + e_autoROI }; enum { c_bit1 = 0x01, - c_bit2 = 0x02 + c_managerOwned = 0x02 }; enum { diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index bc68915b..eef3aa86 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -53,8 +53,8 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char return SUCCESS; } - if (CharacterManager()->Exists(p_name)) { - m_roi = CharacterManager()->GetROI(p_name, TRUE); + if (CharacterManager()->IsActor(p_name)) { + m_roi = CharacterManager()->GetActorROI(p_name, TRUE); m_enabled = m_isActor = TRUE; } else { @@ -62,7 +62,7 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char } if (m_roi == NULL) { - m_roi = CharacterManager()->FUN_10085210(NULL, p_name, TRUE); + m_roi = CharacterManager()->CreateAutoROI(NULL, p_name, TRUE); if (m_roi != NULL) { m_enabled = TRUE; @@ -113,10 +113,10 @@ void Lego3DSound::Destroy() if (m_enabled && m_roi && CharacterManager()) { if (m_isActor) { - CharacterManager()->FUN_10083db0(m_roi); + CharacterManager()->ReleaseActor(m_roi); } else { - CharacterManager()->FUN_10083f10(m_roi); + CharacterManager()->ReleaseAutoROI(m_roi); } } diff --git a/LEGO1/lego/legoomni/src/common/legocharacters.cpp b/LEGO1/lego/legoomni/src/common/legoactors.cpp similarity index 98% rename from LEGO1/lego/legoomni/src/common/legocharacters.cpp rename to LEGO1/lego/legoomni/src/common/legoactors.cpp index d80b49c8..acab09e1 100644 --- a/LEGO1/lego/legoomni/src/common/legocharacters.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactors.cpp @@ -1,16 +1,16 @@ -#include "legocharacters.h" +#include "legoactors.h" -DECOMP_SIZE_ASSERT(LegoCharacterInfo, 0x108) -DECOMP_SIZE_ASSERT(LegoCharacterInfo::Part, 0x18) -DECOMP_SIZE_ASSERT(LegoCharacterLOD, 0x58) +DECOMP_SIZE_ASSERT(LegoActorInfo, 0x108) +DECOMP_SIZE_ASSERT(LegoActorInfo::Part, 0x18) +DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58) -// Unclear whether g_characterLODs[0] (top) is its own global, see: LegoCharacterManager::CreateROI +// Unclear whether g_actorLODs[0] (top) is its own global, see: LegoCharacterManager::CreateActorROI // GLOBAL: LEGO1 0x100da3b0 -LegoCharacterLOD g_characterLODs[] = { +LegoActorLOD g_actorLODs[] = { {"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617, 1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0}, - {"body", "body", LegoCharacterLOD::c_flag1, + {"body", "body", LegoActorLOD::c_flag1, 0.00158332, 0.401828, -0.00048697, 0.408071, -0.287507, 0.150419, -0.147452, 0.289219, 0.649774, @@ -18,7 +18,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.007277, 0, 0, 1, 0, 1, 0}, - {"infohat", "infohat", LegoCharacterLOD::c_flag2, + {"infohat", "infohat", LegoActorLOD::c_flag2, 0, -0.00938, -0.01955, 0.35, -0.231822, -0.140237, -0.320954, 0.234149, 0.076968, @@ -26,7 +26,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.001767, 0, 0, 1, 0, 1, 0}, - {"infogron", "infogron", LegoCharacterLOD::c_flag2, + {"infogron", "infogron", LegoActorLOD::c_flag2, 0, 0.11477, 0.00042, 0.26, -0.285558, -0.134391, -0.142231, 0.285507, 0.152986, @@ -34,7 +34,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.007277, 0, 0, 1, 0, 1, 0}, - {"head", "head", LegoCharacterLOD::c_flag1, + {"head", "head", LegoActorLOD::c_flag1, 0, -0.03006, 0, 0.3, -0.189506, -0.209665, -0.189824, 0.189532, 0.228822, @@ -42,7 +42,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.001781, 0, 0, 1, 0, 1, 0}, - {"arm-lft", "arm-lft", LegoCharacterLOD::c_flag2, + {"arm-lft", "arm-lft", LegoActorLOD::c_flag2, -0.06815, -0.0973747, 0.0154655, 0.237, -0.137931, -0.282775, -0.105316, 0.000989, 0.100221, @@ -50,7 +50,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.023286, -0.003031, -0.017187, 0.999848, 0.173622, 0.984658, 0.017453}, - {"arm-rt", "arm-rt", LegoCharacterLOD::c_flag2, + {"arm-rt", "arm-rt", LegoActorLOD::c_flag2, 0.0680946, -0.097152, 0.0152722, 0.237, 0.00141, -0.289604, -0.100831, 0.138786, 0.09291, @@ -58,7 +58,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.018302, 0, 0, 1, -0.173648, 0.984808, 0}, - {"claw-lft", "claw-lft", LegoCharacterLOD::c_flag2, + {"claw-lft", "claw-lft", LegoActorLOD::c_flag2, 0.000773381, -0.101422, -0.0237761, 0.15, -0.089838, -0.246208, -0.117735, 0.091275, 0.000263, @@ -66,7 +66,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.092779, 0.000001, 0.000003, 1, 0.190812, 0.981627, -0.000003}, - {"claw-rt", "claw-lft", LegoCharacterLOD::c_flag2, + {"claw-rt", "claw-lft", LegoActorLOD::c_flag2, 0.000773381, -0.101422, -0.0237761, 0.15, -0.095016, -0.245349, -0.117979, 0.086528, 0.00067, @@ -74,7 +74,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.096123, 0.00606, -0.034369, 0.999391, -0.190704, 0.981027, 0.034894}, - {"leg-lft", "leg", LegoCharacterLOD::c_flag2, + {"leg-lft", "leg", LegoActorLOD::c_flag2, 0.00433584, -0.177404, -0.0313928, 0.33, -0.129782, -0.440428, -0.184207, 0.13817, 0.118415, @@ -82,7 +82,7 @@ LegoCharacterLOD g_characterLODs[] = { 0.006822, 0, 0, 1, 0, 1, 0}, - {"leg-rt", "leg", LegoCharacterLOD::c_flag2, + {"leg-rt", "leg", LegoActorLOD::c_flag2, 0.00433584, -0.177404, -0.0313928, 0.33, -0.132864, -0.437138, -0.183944, 0.134614, 0.12043, @@ -172,7 +172,7 @@ const char* g_unk0x100f80a0[] = {"lego white", "lego black", "lego yellow", "lego red", "lego blue", "lego brown", "lego lt grey", "lego green"}; // GLOBAL: LEGO1 0x100f80c0 -LegoCharacterInfo g_characterInfoInit[] = { +LegoActorInfo g_actorInfoInit[] = { {"pepper", NULL, NULL, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 40afb7a3..3c358af4 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -344,14 +344,14 @@ LegoAnimationManager::~LegoAnimationManager() LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { - LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) { CurrentWorld()->RemoveActor(actor); actor->SetController(NULL); } - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); } } @@ -430,14 +430,14 @@ void LegoAnimationManager::Suspend() LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { - LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); } if (m_extras[i].m_unk0x14) { @@ -1069,8 +1069,8 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt MxResult result = FAILURE; LegoROI* roi = p_entity->GetROI(); - if (p_entity->GetType() == LegoEntity::e_character) { - LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (p_entity->GetType() == LegoEntity::e_actor) { + LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor) { LegoPathController* controller = actor->GetController(); @@ -1395,7 +1395,7 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param) LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { - LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL) { actor->Restart(); } @@ -1444,14 +1444,14 @@ MxResult LegoAnimationManager::Tickle() LegoROI* roi = m_extras[i].m_roi; if (roi != NULL && m_extras[i].m_unk0x0d) { - LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); if (m_extras[i].m_unk0x14) { m_extras[i].m_unk0x14 = FALSE; @@ -1701,7 +1701,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) if (models != NULL && modelCount) { for (MxU8 i = 0; i < modelCount; i++) { - LegoPathActor* actor = CharacterManager()->GetActor(models[i].m_name); + LegoPathActor* actor = CharacterManager()->GetExtraActor(models[i].m_name); if (actor) { LegoPathController* controller = actor->GetController(); @@ -1814,13 +1814,13 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) !viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) { m_unk0x414--; - LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoPathActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); if (m_extras[i].m_unk0x14) { m_extras[i].m_unk0x14 = FALSE; @@ -1930,15 +1930,15 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) g_characters[m_lastExtraCharacterId].m_unk0x08 && !g_characters[m_lastExtraCharacterId].m_inExtras && g_characters[m_lastExtraCharacterId].m_active == active) { - if (!CharacterManager()->FUN_10083b20(g_characters[m_lastExtraCharacterId].m_name - )) { - m_extras[i].m_roi = CharacterManager()->GetROI( + if (!CharacterManager()->Exists(g_characters[m_lastExtraCharacterId].m_name)) { + m_extras[i].m_roi = CharacterManager()->GetActorROI( g_characters[m_lastExtraCharacterId].m_name, TRUE ); - LegoExtraActor* actor = - CharacterManager()->GetActor(g_characters[m_lastExtraCharacterId].m_name); + LegoExtraActor* actor = CharacterManager()->GetExtraActor( + g_characters[m_lastExtraCharacterId].m_name + ); switch (g_unk0x100f7504++ % 4) { case 0: @@ -2002,7 +2002,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) return; } else { - CharacterManager()->FUN_10083db0(m_extras[i].m_roi); + CharacterManager()->ReleaseActor(m_extras[i].m_roi); m_extras[i].m_roi = NULL; continue; } @@ -2042,7 +2042,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p MxBool inExtras = FALSE; const char* name = p_roi->GetName(); - LegoExtraActor* actor = CharacterManager()->GetActor(name); + LegoExtraActor* actor = CharacterManager()->GetExtraActor(name); if (actor != NULL) { MxS32 characterId = -1; MxS32 i; @@ -2104,7 +2104,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p return FALSE; } - CharacterManager()->FUN_10083db0(p_roi); + CharacterManager()->ReleaseActor(p_roi); } else { if (inExtras) { @@ -2216,7 +2216,7 @@ void LegoAnimationManager::FUN_10063270(LegoROIList* p_list, LegoAnimPresenter* FUN_10063950(roi); } else { - LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL) { for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { @@ -2277,7 +2277,7 @@ void LegoAnimationManager::FUN_10063780(LegoROIList* p_list) while (cursor.Next(roi)) { const char* name = roi->GetName(); - if (CharacterManager()->Exists(name)) { + if (CharacterManager()->IsActor(name)) { m_unk0x424->Append(roi); cursor.Detach(); } @@ -2292,7 +2292,7 @@ void LegoAnimationManager::FUN_10063950(LegoROI* p_roi) LegoROIListCursor cursor(m_unk0x424); if (cursor.Find(p_roi)) { - CharacterManager()->FUN_10083db0(p_roi); + CharacterManager()->ReleaseActor(p_roi); cursor.Detach(); } } @@ -2305,7 +2305,7 @@ void LegoAnimationManager::FUN_10063aa0() LegoROI* roi; while (cursor.Next(roi)) { - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); } } @@ -2388,7 +2388,7 @@ void LegoAnimationManager::FUN_10063d10() m_extras[i].m_unk0x0c = FALSE; - LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL) { float speed = m_extras[i].m_speed; @@ -2405,7 +2405,7 @@ void LegoAnimationManager::FUN_10063d10() } } else { - LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + LegoExtraActor* actor = CharacterManager()->GetExtraActor(roi->GetName()); if (actor != NULL) { actor->Restart(); } @@ -2424,7 +2424,7 @@ void LegoAnimationManager::FUN_10063e40(LegoAnimPresenter* p_presenter) while (cursor.Next(roi)) { if (!FUN_10062e20(roi, p_presenter)) { - CharacterManager()->FUN_10083db0(roi); + CharacterManager()->ReleaseActor(roi); } cursor.Detach(); @@ -2594,7 +2594,7 @@ MxResult LegoAnimationManager::FUN_10064380( } if (roi != NULL && !strcmpi(roi->GetName(), p_name)) { - actor = CharacterManager()->GetActor(p_name); + actor = CharacterManager()->GetExtraActor(p_name); if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->RemoveActor(actor); @@ -2620,11 +2620,11 @@ MxResult LegoAnimationManager::FUN_10064380( return FAILURE; } - m_extras[extraIndex].m_roi = CharacterManager()->GetROI(p_name, TRUE); + m_extras[extraIndex].m_roi = CharacterManager()->GetActorROI(p_name, TRUE); m_extras[extraIndex].m_characterId = characterId; m_extras[extraIndex].m_speed = p_speed; - actor = CharacterManager()->GetActor(p_name); + actor = CharacterManager()->GetExtraActor(p_name); m_unk0x414++; } @@ -2634,7 +2634,7 @@ MxResult LegoAnimationManager::FUN_10064380( actor->SetWorldSpeed(0.0f); if (world->PlaceActor(actor, p_boundaryName, p_src, p_srcScale, p_dest, p_destScale) != SUCCESS) { - CharacterManager()->FUN_10083db0(m_extras[i].m_roi); + CharacterManager()->ReleaseActor(m_extras[i].m_roi); m_extras[i].m_roi = NULL; m_unk0x414--; return FAILURE; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 9f409bfb..dc48d9b5 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -1,8 +1,8 @@ #include "legocharactermanager.h" #include "3dmanager/lego3dmanager.h" +#include "legoactors.h" #include "legoanimactor.h" -#include "legocharacters.h" #include "legoextraactor.h" #include "legogamestate.h" #include "legovariables.h" @@ -40,7 +40,7 @@ MxU32 g_unk0x100fc4ec = 2; MxU32 g_unk0x100fc4f0 = 0; // GLOBAL: LEGO1 0x10104f20 -LegoCharacterInfo g_characterInfo[66]; +LegoActorInfo g_actorInfo[66]; // FUNCTION: LEGO1 0x10082a20 LegoCharacterManager::LegoCharacterManager() @@ -75,26 +75,26 @@ LegoCharacterManager::~LegoCharacterManager() // FUNCTION: LEGO1 0x10083270 void LegoCharacterManager::Init() { - for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { - g_characterInfo[i] = g_characterInfoInit[i]; + for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { + g_actorInfo[i] = g_actorInfoInit[i]; } } // FUNCTION: LEGO1 0x100832a0 -void LegoCharacterManager::FUN_100832a0() +void LegoCharacterManager::ReleaseAllActors() { - for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { - LegoCharacterInfo* info = GetInfo(g_characterInfo[i].m_name); + for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { + LegoActorInfo* info = GetActorInfo(g_actorInfo[i].m_name); if (info != NULL) { LegoExtraActor* actor = info->m_actor; if (actor != NULL && actor->IsA("LegoExtraActor")) { - LegoROI* roi = g_characterInfo[i].m_roi; + LegoROI* roi = g_actorInfo[i].m_roi; MxU32 refCount = GetRefCount(roi); while (refCount != 0) { - FUN_10083db0(roi); + ReleaseActor(roi); refCount = GetRefCount(roi); } } @@ -107,8 +107,8 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { - LegoCharacterInfo* info = &g_characterInfo[i]; + for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { + LegoActorInfo* info = &g_actorInfo[i]; if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; @@ -162,8 +162,8 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { - LegoCharacterInfo* info = &g_characterInfo[i]; + for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { + LegoActorInfo* info = &g_actorInfo[i]; if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; @@ -213,10 +213,10 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) } // FUNCTION: LEGO1 0x10083500 -LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) +LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEntity) { LegoCharacter* character = NULL; - LegoCharacterMap::iterator it = m_characters->find(const_cast(p_key)); + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); if (it != m_characters->end()) { character = (*it).second; @@ -224,7 +224,7 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) } if (character == NULL) { - LegoROI* roi = CreateROI(p_key); + LegoROI* roi = CreateActorROI(p_name); if (roi == NULL) { goto done; @@ -234,11 +234,11 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) if (roi != NULL) { character = new LegoCharacter(roi); - char* key = new char[strlen(p_key) + 1]; + char* name = new char[strlen(p_name) + 1]; - if (key != NULL) { - strcpy(key, p_key); - (*m_characters)[key] = character; + if (name != NULL) { + strcpy(name, p_name); + (*m_characters)[name] = character; VideoManager()->Get3DManager()->Add(*roi); } } @@ -254,9 +254,9 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) LegoExtraActor* actor = new LegoExtraActor(); actor->SetROI(character->m_roi, FALSE, FALSE); - actor->SetType(LegoEntity::e_character); - actor->SetFlag(LegoActor::c_bit2); - GetInfo(p_key)->m_actor = actor; + actor->SetType(LegoEntity::e_actor); + actor->SetFlag(LegoEntity::c_managerOwned); + GetActorInfo(p_name)->m_actor = actor; } return character->m_roi; @@ -267,10 +267,10 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) // FUNCTION: LEGO1 0x10083b20 // FUNCTION: BETA10 0x10074608 -MxBool LegoCharacterManager::FUN_10083b20(const char* p_key) +MxBool LegoCharacterManager::Exists(const char* p_name) { LegoCharacter* character = NULL; - LegoCharacterMap::iterator it = m_characters->find(const_cast(p_key)); + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); if (it != m_characters->end()) { return TRUE; @@ -298,7 +298,7 @@ MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi) // FUNCTION: LEGO1 0x10083c30 // FUNCTION: BETA10 0x10074701 -void LegoCharacterManager::FUN_10083c30(const char* p_name) +void LegoCharacterManager::ReleaseActor(const char* p_name) { LegoCharacter* character = NULL; LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); @@ -307,7 +307,7 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name) character = (*it).second; if (character->RemoveRef() == 0) { - LegoCharacterInfo* info = GetInfo(p_name); + LegoActorInfo* info = GetActorInfo(p_name); LegoEntity* entity = character->m_roi->GetEntity(); if (entity != NULL) { @@ -323,11 +323,11 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name) if (info != NULL) { if (info->m_actor != NULL) { - info->m_actor->ClearFlag(LegoEntity::c_bit2); + info->m_actor->ClearFlag(LegoEntity::c_managerOwned); delete info->m_actor; } - else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { - entity->ClearFlag(LegoEntity::c_bit2); + else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) { + entity->ClearFlag(LegoEntity::c_managerOwned); delete entity; } @@ -339,7 +339,7 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name) } // FUNCTION: LEGO1 0x10083db0 -void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) +void LegoCharacterManager::ReleaseActor(LegoROI* p_roi) { LegoCharacter* character = NULL; LegoCharacterMap::iterator it; @@ -349,7 +349,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) if (character->m_roi == p_roi) { if (character->RemoveRef() == 0) { - LegoCharacterInfo* info = GetInfo(character->m_roi->GetName()); + LegoActorInfo* info = GetActorInfo(character->m_roi->GetName()); LegoEntity* entity = character->m_roi->GetEntity(); if (entity != NULL) { @@ -365,11 +365,11 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) if (info != NULL) { if (info->m_actor != NULL) { - info->m_actor->ClearFlag(LegoEntity::c_bit2); + info->m_actor->ClearFlag(LegoEntity::c_managerOwned); delete info->m_actor; } - else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { - entity->ClearFlag(LegoEntity::c_bit2); + else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) { + entity->ClearFlag(LegoEntity::c_managerOwned); delete entity; } @@ -384,7 +384,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) } // FUNCTION: LEGO1 0x10083f10 -void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi) +void LegoCharacterManager::ReleaseAutoROI(LegoROI* p_roi) { LegoCharacter* character = NULL; LegoCharacterMap::iterator it; @@ -407,8 +407,8 @@ void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi) m_characters->erase(it); - if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { - entity->ClearFlag(LegoEntity::c_bit2); + if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_managerOwned)) { + entity->ClearFlag(LegoEntity::c_managerOwned); delete entity; } } @@ -425,7 +425,7 @@ void LegoCharacterManager::RemoveROI(LegoROI* p_roi) } // FUNCTION: LEGO1 0x10084030 -LegoROI* LegoCharacterManager::CreateROI(const char* p_key) +LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key) { MxBool success = FALSE; LegoROI* roi = NULL; @@ -438,14 +438,14 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) Tgl::Renderer* renderer = VideoManager()->GetRenderer(); ViewLODListManager* lodManager = GetViewLODListManager(); LegoTextureContainer* textureContainer = TextureContainer(); - LegoCharacterInfo* info = GetInfo(p_key); + LegoActorInfo* info = GetActorInfo(p_key); if (info == NULL) { goto done; } if (!strcmpi(p_key, "pep")) { - LegoCharacterInfo* pepper = GetInfo("pepper"); + LegoActorInfo* pepper = GetActorInfo("pepper"); info->m_unk0x0c = pepper->m_unk0x0c; info->m_unk0x10 = pepper->m_unk0x10; @@ -459,33 +459,33 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) roi = new LegoROI(renderer); roi->SetName(p_key); - boundingSphere.Center()[0] = g_characterLODs[c_topLOD].m_boundingSphere[0]; - boundingSphere.Center()[1] = g_characterLODs[c_topLOD].m_boundingSphere[1]; - boundingSphere.Center()[2] = g_characterLODs[c_topLOD].m_boundingSphere[2]; - boundingSphere.Radius() = g_characterLODs[c_topLOD].m_boundingSphere[3]; + boundingSphere.Center()[0] = g_actorLODs[c_topLOD].m_boundingSphere[0]; + boundingSphere.Center()[1] = g_actorLODs[c_topLOD].m_boundingSphere[1]; + boundingSphere.Center()[2] = g_actorLODs[c_topLOD].m_boundingSphere[2]; + boundingSphere.Radius() = g_actorLODs[c_topLOD].m_boundingSphere[3]; roi->SetBoundingSphere(boundingSphere); - boundingBox.Min()[0] = g_characterLODs[c_topLOD].m_boundingBox[0]; - boundingBox.Min()[1] = g_characterLODs[c_topLOD].m_boundingBox[1]; - boundingBox.Min()[2] = g_characterLODs[c_topLOD].m_boundingBox[2]; - boundingBox.Max()[0] = g_characterLODs[c_topLOD].m_boundingBox[3]; - boundingBox.Max()[1] = g_characterLODs[c_topLOD].m_boundingBox[4]; - boundingBox.Max()[2] = g_characterLODs[c_topLOD].m_boundingBox[5]; + boundingBox.Min()[0] = g_actorLODs[c_topLOD].m_boundingBox[0]; + boundingBox.Min()[1] = g_actorLODs[c_topLOD].m_boundingBox[1]; + boundingBox.Min()[2] = g_actorLODs[c_topLOD].m_boundingBox[2]; + boundingBox.Max()[0] = g_actorLODs[c_topLOD].m_boundingBox[3]; + boundingBox.Max()[1] = g_actorLODs[c_topLOD].m_boundingBox[4]; + boundingBox.Max()[2] = g_actorLODs[c_topLOD].m_boundingBox[5]; roi->SetUnknown0x80(boundingBox); comp = new CompoundObject(); roi->SetComp(comp); - for (i = 0; i < sizeOfArray(g_characterLODs) - 1; i++) { + for (i = 0; i < sizeOfArray(g_actorLODs) - 1; i++) { char lodName[256]; - LegoCharacterInfo::Part& part = info->m_parts[i]; + LegoActorInfo::Part& part = info->m_parts[i]; const char* parentName; if (i == 0 || i == 1) { parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]]; } else { - parentName = g_characterLODs[i + 1].m_parentName; + parentName = g_actorLODs[i + 1].m_parentName; } ViewLODList* lodList = lodManager->Lookup(parentName); @@ -505,35 +505,34 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) LegoROI* childROI = new LegoROI(renderer, lodList); lodList->Release(); - childROI->SetName(g_characterLODs[i + 1].m_name); + childROI->SetName(g_actorLODs[i + 1].m_name); childROI->SetParentROI(roi); BoundingSphere childBoundingSphere; - childBoundingSphere.Center()[0] = g_characterLODs[i + 1].m_boundingSphere[0]; - childBoundingSphere.Center()[1] = g_characterLODs[i + 1].m_boundingSphere[1]; - childBoundingSphere.Center()[2] = g_characterLODs[i + 1].m_boundingSphere[2]; - childBoundingSphere.Radius() = g_characterLODs[i + 1].m_boundingSphere[3]; + childBoundingSphere.Center()[0] = g_actorLODs[i + 1].m_boundingSphere[0]; + childBoundingSphere.Center()[1] = g_actorLODs[i + 1].m_boundingSphere[1]; + childBoundingSphere.Center()[2] = g_actorLODs[i + 1].m_boundingSphere[2]; + childBoundingSphere.Radius() = g_actorLODs[i + 1].m_boundingSphere[3]; childROI->SetBoundingSphere(childBoundingSphere); BoundingBox childBoundingBox; - childBoundingBox.Min()[0] = g_characterLODs[i + 1].m_boundingBox[0]; - childBoundingBox.Min()[1] = g_characterLODs[i + 1].m_boundingBox[1]; - childBoundingBox.Min()[2] = g_characterLODs[i + 1].m_boundingBox[2]; - childBoundingBox.Max()[0] = g_characterLODs[i + 1].m_boundingBox[3]; - childBoundingBox.Max()[1] = g_characterLODs[i + 1].m_boundingBox[4]; - childBoundingBox.Max()[2] = g_characterLODs[i + 1].m_boundingBox[5]; + childBoundingBox.Min()[0] = g_actorLODs[i + 1].m_boundingBox[0]; + childBoundingBox.Min()[1] = g_actorLODs[i + 1].m_boundingBox[1]; + childBoundingBox.Min()[2] = g_actorLODs[i + 1].m_boundingBox[2]; + childBoundingBox.Max()[0] = g_actorLODs[i + 1].m_boundingBox[3]; + childBoundingBox.Max()[1] = g_actorLODs[i + 1].m_boundingBox[4]; + childBoundingBox.Max()[2] = g_actorLODs[i + 1].m_boundingBox[5]; childROI->SetUnknown0x80(childBoundingBox); CalcLocalTransform( - Mx3DPointFloat(g_characterLODs[i + 1].m_position), - Mx3DPointFloat(g_characterLODs[i + 1].m_direction), - Mx3DPointFloat(g_characterLODs[i + 1].m_up), + Mx3DPointFloat(g_actorLODs[i + 1].m_position), + Mx3DPointFloat(g_actorLODs[i + 1].m_direction), + Mx3DPointFloat(g_actorLODs[i + 1].m_up), mat ); childROI->WrappedSetLocalTransform(mat); - if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag1 && - (i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) { + if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag1 && (i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) { LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); @@ -542,7 +541,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F); } } - else if (g_characterLODs[i + 1].m_flags & LegoCharacterLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) { + else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) { LegoFloat red, green, blue, alpha; childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha); childROI->FUN_100a9170(red, green, blue, alpha); @@ -552,9 +551,9 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) } CalcLocalTransform( - Mx3DPointFloat(g_characterLODs[c_topLOD].m_position), - Mx3DPointFloat(g_characterLODs[c_topLOD].m_direction), - Mx3DPointFloat(g_characterLODs[c_topLOD].m_up), + Mx3DPointFloat(g_actorLODs[c_topLOD].m_position), + Mx3DPointFloat(g_actorLODs[c_topLOD].m_direction), + Mx3DPointFloat(g_actorLODs[c_topLOD].m_up), mat ); roi->WrappedSetLocalTransform(mat); @@ -576,12 +575,12 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo) { LegoResult result = SUCCESS; - LegoROI* head = FindChildROI(p_roi, g_characterLODs[c_headLOD].m_name); + LegoROI* head = FindChildROI(p_roi, g_actorLODs[c_headLOD].m_name); if (head != NULL) { char lodName[256]; - ViewLODList* lodList = GetViewLODListManager()->Lookup(g_characterLODs[c_headLOD].m_parentName); + ViewLODList* lodList = GetViewLODListManager()->Lookup(g_actorLODs[c_headLOD].m_parentName); MxS32 lodSize = lodList->Size(); sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++); ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize); @@ -589,8 +588,8 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex Tgl::Renderer* renderer = VideoManager()->GetRenderer(); if (p_textureInfo == NULL) { - LegoCharacterInfo* info = GetInfo(p_roi->GetName()); - LegoCharacterInfo::Part& part = info->m_parts[c_headPart]; + LegoActorInfo* info = GetActorInfo(p_roi->GetName()); + LegoActorInfo::Part& part = info->m_parts[c_headPart]; p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); } @@ -620,10 +619,10 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex } // FUNCTION: LEGO1 0x10084c00 -MxBool LegoCharacterManager::Exists(const char* p_key) +MxBool LegoCharacterManager::IsActor(const char* p_name) { - for (MxU32 i = 0; i < sizeOfArray(g_characterInfo); i++) { - if (!strcmpi(g_characterInfo[i].m_name, p_key)) { + for (MxU32 i = 0; i < sizeOfArray(g_actorInfo); i++) { + if (!strcmpi(g_actorInfo[i].m_name, p_name)) { return TRUE; } } @@ -632,9 +631,9 @@ MxBool LegoCharacterManager::Exists(const char* p_key) } // FUNCTION: LEGO1 0x10084c40 -LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key) +LegoExtraActor* LegoCharacterManager::GetExtraActor(const char* p_name) { - LegoCharacterInfo* info = GetInfo(p_key); + LegoActorInfo* info = GetActorInfo(p_name); if (info != NULL) { return info->m_actor; @@ -644,36 +643,36 @@ LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key) } // FUNCTION: LEGO1 0x10084c60 -LegoCharacterInfo* LegoCharacterManager::GetInfo(const char* p_key) +LegoActorInfo* LegoCharacterManager::GetActorInfo(const char* p_name) { MxU32 i; - for (i = 0; i < sizeOfArray(g_characterInfo); i++) { - if (!strcmpi(g_characterInfo[i].m_name, p_key)) { + for (i = 0; i < sizeOfArray(g_actorInfo); i++) { + if (!strcmpi(g_actorInfo[i].m_name, p_name)) { break; } } - if (i < sizeOfArray(g_characterInfo)) { - return &g_characterInfo[i]; + if (i < sizeOfArray(g_actorInfo)) { + return &g_actorInfo[i]; } return NULL; } // FUNCTION: LEGO1 0x10084cb0 -LegoCharacterInfo* LegoCharacterManager::GetInfo(LegoROI* p_roi) +LegoActorInfo* LegoCharacterManager::GetActorInfo(LegoROI* p_roi) { MxU32 i; - for (i = 0; i < sizeOfArray(g_characterInfo); i++) { - if (g_characterInfo[i].m_roi == p_roi) { + for (i = 0; i < sizeOfArray(g_actorInfo); i++) { + if (g_actorInfo[i].m_roi == p_roi) { break; } } - if (i < sizeOfArray(g_characterInfo)) { - return &g_characterInfo[i]; + if (i < sizeOfArray(g_actorInfo)) { + return &g_actorInfo[i]; } return NULL; @@ -703,13 +702,13 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) // FUNCTION: LEGO1 0x10084ec0 MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) { - LegoCharacterInfo* info = GetInfo(p_roi->GetName()); + LegoActorInfo* info = GetActorInfo(p_roi->GetName()); if (info == NULL) { return FALSE; } - LegoCharacterInfo::Part& part = info->m_parts[c_infohatPart]; + LegoActorInfo::Part& part = info->m_parts[c_infohatPart]; part.m_unk0x08++; MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08]; @@ -719,7 +718,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) unk0x00 = part.m_unk0x00[part.m_unk0x08]; } - LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[c_infohatLOD].m_name); + LegoROI* childROI = FindChildROI(p_roi, g_actorLODs[c_infohatLOD].m_name); if (childROI != NULL) { char lodName[256]; @@ -757,7 +756,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) // FUNCTION: LEGO1 0x10085140 MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) { - LegoCharacterInfo* info = GetInfo(p_roi); + LegoActorInfo* info = GetActorInfo(p_roi); if (p_und) { return info->m_mood + g_unk0x100fc4dc; @@ -774,7 +773,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) // FUNCTION: BETA10 0x100768c5 MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi) { - LegoCharacterInfo* info = GetInfo(p_roi); + LegoActorInfo* info = GetActorInfo(p_roi); if (info != NULL) { return info->m_mood; @@ -803,7 +802,7 @@ void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value) } // FUNCTION: LEGO1 0x10085210 -LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity) +LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity) { LegoROI* roi = NULL; @@ -853,8 +852,8 @@ LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lo LegoEntity* entity = new LegoEntity(); entity->SetROI(roi, FALSE, FALSE); - entity->SetType(LegoEntity::e_unk4); - entity->SetFlag(LegoActor::c_bit2); + entity->SetType(LegoEntity::e_autoROI); + entity->SetFlag(LegoEntity::c_managerOwned); } } } @@ -907,5 +906,5 @@ MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi) // FUNCTION: LEGO1 0x10085a80 LegoROI* LegoCharacterManager::FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity) { - return FUN_10085210(p_name, p_lodName, p_createEntity); + return CreateAutoROI(p_name, p_lodName, p_createEntity); } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 64f4c494..be09e19b 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -177,7 +177,7 @@ void LegoGameState::SetActor(MxU8 p_actorId) IslePathActor* newActor = new IslePathActor(); const char* actorName = LegoActor::GetActorName(m_actorId); - LegoROI* roi = CharacterManager()->GetROI(actorName, FALSE); + LegoROI* roi = CharacterManager()->GetActorROI(actorName, FALSE); MxDSAction action; action.SetAtomId(*g_isleScript); diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 79c6571e..6ab78b63 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -129,7 +129,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) { if (!strcmpi(name, g_actorNames[i])) { - m_type = e_character; + m_type = e_actor; m_actorId = i; break; } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 4d9324ad..de931cd2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -31,7 +31,7 @@ void LegoEntity::Init() m_flags = 0; m_actionType = Extra::ActionType::e_unknown; m_targetEntityId = -1; - m_type = e_unk4; + m_type = e_autoROI; } // FUNCTION: LEGO1 0x10010650 @@ -93,7 +93,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor) m_roi->SetEntity(NULL); } - CharacterManager()->FUN_10083db0(m_roi); + CharacterManager()->ReleaseActor(m_roi); } else { VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); @@ -252,7 +252,7 @@ void LegoEntity::VTable0x34(MxBool p_und) const LegoChar* roiName = m_roi->GetName(); switch (m_type) { - case e_character: + case e_actor: objectId = CharacterManager()->FUN_10085140(m_roi, p_und); break; case e_unk1: @@ -285,7 +285,7 @@ void LegoEntity::VTable0x38() void LegoEntity::VTable0x3c() { switch (m_type) { - case e_character: + case e_actor: CharacterManager()->SwitchHat(m_roi); break; case e_unk1: @@ -366,7 +366,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) break; case 6: switch (m_type) { - case e_character: + case e_actor: case e_unk1: break; case e_plant: @@ -375,7 +375,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) case e_building: BuildingManager()->FUN_10030000(this); break; - case e_unk4: + case e_autoROI: break; } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 71ffefae..9da873e0 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -187,7 +187,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) while (cursor.First(entity)) { cursor.Detach(); - if (!(entity->GetFlags() & LegoEntity::c_bit2)) { + if (!(entity->GetFlags() & LegoEntity::c_managerOwned)) { delete entity; } } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 5f8662df..ffdb2b63 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -188,7 +188,7 @@ LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar* p_und1) { LegoChar* str; - if (LegoCharacterManager::Exists(p_und1 + 1)) { + if (LegoCharacterManager::IsActor(p_und1 + 1)) { str = new LegoChar[strlen(p_und1)]; if (str != NULL) { @@ -232,7 +232,7 @@ void LegoAnimPresenter::FUN_100692b0() src = str; } - roi = CharacterManager()->GetROI(src, TRUE); + roi = CharacterManager()->GetActorROI(src, TRUE); if (roi != NULL && str[0] == '*') { roi->SetVisibility(FALSE); @@ -268,7 +268,7 @@ void LegoAnimPresenter::FUN_100692b0() strlwr(lodName); LegoChar* und = FUN_10069150(str); - roi = CharacterManager()->FUN_10085210(und, lodName, TRUE); + roi = CharacterManager()->CreateAutoROI(und, lodName, TRUE); if (roi != NULL) { roi->SetVisibility(FALSE); @@ -313,7 +313,7 @@ void LegoAnimPresenter::FUN_100695c0() strlwr(lodName); - CharacterManager()->FUN_10085210(actorName, lodName, FALSE); + CharacterManager()->CreateAutoROI(actorName, lodName, FALSE); FUN_100698b0(rois, actorName); } } @@ -530,8 +530,8 @@ void LegoAnimPresenter::FUN_1006aa60() while (cursor.Next(roi)) { const char* name = roi->GetName(); - if (m_unk0x96 || !CharacterManager()->Exists(name)) { - CharacterManager()->FUN_10083c30(name); + if (m_unk0x96 || !CharacterManager()->IsActor(name)) { + CharacterManager()->ReleaseActor(name); } } } diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index ce448d71..4a2cf715 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -224,7 +224,7 @@ MxResult LegoModelPresenter::FUN_1007ff70( if (p_entity != NULL) { p_entity->SetROI(m_roi, TRUE, TRUE); - p_entity->ClearFlag(LegoEntity::c_bit2); + p_entity->ClearFlag(LegoEntity::c_managerOwned); } else { p_world->GetROIList().push_back(m_roi); @@ -249,9 +249,10 @@ void LegoModelPresenter::ReadyTickle() ((LegoEntityPresenter*) m_compositePresenter) ->GetInternalEntity() ->SetFlags( - ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ~LegoEntity::c_bit2 + ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & + ~LegoEntity::c_managerOwned ); - ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetType(LegoEntity::e_character); + ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetType(LegoEntity::e_actor); } ParseExtra(); @@ -276,7 +277,7 @@ void LegoModelPresenter::ReadyTickle() ->GetInternalEntity() ->SetFlags( ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & - ~LegoEntity::c_bit2 + ~LegoEntity::c_managerOwned ); } @@ -306,7 +307,7 @@ void LegoModelPresenter::ParseExtra() char* token = strtok(output, g_parseExtraTokens); if (m_roi == NULL) { - m_roi = CharacterManager()->GetROI(token, FALSE); + m_roi = CharacterManager()->GetActorROI(token, FALSE); m_addedToView = FALSE; } } diff --git a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp index 5fbbba21..824a4ce2 100644 --- a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp @@ -52,7 +52,7 @@ void LegoPhonemePresenter::StartingTickle() m_unk0x84 = TRUE; } else { - entityROI = CharacterManager()->GetROI(m_roiName.GetData(), TRUE); + entityROI = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE); } head = entityROI->FindChildROI("head", entityROI); @@ -143,7 +143,7 @@ void LegoPhonemePresenter::EndAction() roi = FindROI(m_roiName.GetData()); } else { - roi = CharacterManager()->GetROI(m_roiName.GetData(), TRUE); + roi = CharacterManager()->GetActorROI(m_roiName.GetData(), TRUE); } if (roi != NULL) { @@ -151,7 +151,7 @@ void LegoPhonemePresenter::EndAction() } if (!m_unk0x84) { - CharacterManager()->FUN_10083c30(m_roiName.GetData()); + CharacterManager()->ReleaseActor(m_roiName.GetData()); } TextureContainer()->EraseCached(phoneme->VTable0x10()); @@ -164,7 +164,7 @@ void LegoPhonemePresenter::EndAction() } if (!m_unk0x84) { - CharacterManager()->FUN_10083c30(m_roiName.GetData()); + CharacterManager()->ReleaseActor(m_roiName.GetData()); } } } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 8308cf11..af05132d 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1308,7 +1308,7 @@ void Infocenter::Reset() PlantManager()->FUN_10027120(); BuildingManager()->FUN_10030590(); AnimationManager()->Reset(FALSE); - CharacterManager()->FUN_100832a0(); + CharacterManager()->ReleaseAllActors(); GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->SetPreviousArea(LegoGameState::e_undefined); GameState()->SetUnknown0x42c(LegoGameState::e_undefined); From 919a3f5c492390f022e4ae05b53e164e4b076619 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 13:38:13 -0400 Subject: [PATCH 09/26] Implement/match Lego3DSound::UpdatePosition (#983) --- LEGO1/lego/legoomni/include/lego3dsound.h | 2 +- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 61 +++++++++++++++++-- .../src/audio/lego3dwavepresenter.cpp | 2 +- .../lego/legoomni/src/audio/legocachsound.cpp | 2 +- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/lego3dsound.h b/LEGO1/lego/legoomni/include/lego3dsound.h index 14be04ee..315858d0 100644 --- a/LEGO1/lego/legoomni/include/lego3dsound.h +++ b/LEGO1/lego/legoomni/include/lego3dsound.h @@ -19,7 +19,7 @@ class Lego3DSound { void Init(); MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume); void Destroy(); - undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer); + MxU32 UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer); void FUN_10011ca0(); MxS32 FUN_10011cf0(undefined4, undefined4); diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index eef3aa86..d93e0c6d 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -2,9 +2,13 @@ #include "legoactor.h" #include "legocharactermanager.h" +#include "legosoundmanager.h" +#include "legovideomanager.h" #include "misc.h" #include "mxomni.h" +#include + DECOMP_SIZE_ASSERT(Lego3DSound, 0x30) // FUNCTION: LEGO1 0x10011630 @@ -123,12 +127,61 @@ void Lego3DSound::Destroy() Init(); } -// STUB: LEGO1 0x100118e0 +// FUNCTION: LEGO1 0x100118e0 // FUNCTION: BETA10 0x10039a2a -undefined4 Lego3DSound::FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer) +MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) { - // TODO - return 0; + MxU32 updated = FALSE; + + if (m_positionROI != NULL) { + const float* position = m_positionROI->GetWorldPosition(); + + ViewROI* pov = VideoManager()->GetViewROI(); + assert(pov); + + const float* povPosition = pov->GetWorldPosition(); + float distance = DISTSQRD3(povPosition, position); + + if (distance > 10000.0f) { + return FALSE; + } + + if (m_ds3dBuffer != NULL) { + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + } + else { + MxS32 newVolume = m_volume; + + if (distance < 100.0f) { + newVolume = m_volume; + } + else if (distance < 400.0f) { + newVolume *= 0.4; + } + else if (distance < 3600.0f) { + newVolume *= 0.1; + } + else if (distance < 10000.0f) { + newVolume = 0; + } + + newVolume = newVolume * SoundManager()->GetVolume() / 100; + newVolume = SoundManager()->GetAttenuation(newVolume); + p_directSoundBuffer->SetVolume(newVolume); + } + + updated = TRUE; + } + + if (m_actor != NULL) { + if (abs(m_frequencyFactor - m_actor->GetSoundFrequencyFactor()) > 0.0001) { + m_frequencyFactor = m_actor->GetSoundFrequencyFactor(); + p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency); + updated = TRUE; + } + } + + return updated; } // STUB: LEGO1 0x10011ca0 diff --git a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp index 10b79146..8083822e 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp @@ -62,5 +62,5 @@ void Lego3DWavePresenter::StartingTickle() void Lego3DWavePresenter::StreamingTickle() { MxWavePresenter::StreamingTickle(); - m_sound.FUN_100118e0(m_dsBuffer); + m_sound.UpdatePosition(m_dsBuffer); } diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 7d4f565c..3c2ab5f1 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -134,7 +134,7 @@ void LegoCacheSound::FUN_10006be0() } if (m_string0x74.GetLength() != 0 && !m_unk0x84) { - if (!m_unk0x10.FUN_100118e0(m_dsBuffer)) { + if (!m_unk0x10.UpdatePosition(m_dsBuffer)) { if (m_unk0x6a) { return; } From ac4e8da662039188654c986423ae8c0fee8a665c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 13:45:22 -0400 Subject: [PATCH 10/26] Implement/match Lego3DSound::SetDistance and Reset (#984) --- LEGO1/lego/legoomni/include/lego3dsound.h | 4 +-- LEGO1/lego/legoomni/include/legocachsound.h | 4 +-- LEGO1/lego/legoomni/include/legoworld.h | 4 +-- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 34 +++++++++++++++---- .../lego/legoomni/src/audio/legocachsound.cpp | 10 +++--- .../src/build/legobuildingmanager.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 1 + LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 ++ 8 files changed, 42 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/lego3dsound.h b/LEGO1/lego/legoomni/include/lego3dsound.h index 315858d0..e52c249b 100644 --- a/LEGO1/lego/legoomni/include/lego3dsound.h +++ b/LEGO1/lego/legoomni/include/lego3dsound.h @@ -20,8 +20,8 @@ class Lego3DSound { MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume); void Destroy(); MxU32 UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer); - void FUN_10011ca0(); - MxS32 FUN_10011cf0(undefined4, undefined4); + void Reset(); + MxS32 SetDistance(MxS32 p_min, MxS32 p_max); // SYNTHETIC: LEGO1 0x10011650 // Lego3DSound::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index f424a465..86255152 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -37,7 +37,7 @@ class LegoCacheSound : public MxCore { MxResult FUN_10006a30(const char* p_str, MxBool); void FUN_10006b80(); void FUN_10006be0(); - void FUN_10006cb0(undefined4 p_und1, undefined4 p_und2); + void SetDistance(MxS32 p_min, MxS32 p_max); // SYNTHETIC: LEGO1 0x10006610 // LegoCacheSound::`scalar deleting destructor' @@ -47,7 +47,7 @@ class LegoCacheSound : public MxCore { LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 undefined m_unk0xc[4]; // 0x0c - Lego3DSound m_unk0x10; // 0x10 + Lego3DSound m_sound; // 0x10 undefined* m_unk0x40; // 0x40 undefined4 m_unk0x44; // 0x44 MxString m_string0x48; // 0x48 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 79088500..766d5ca5 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -1,14 +1,14 @@ #ifndef LEGOWORLD_H #define LEGOWORLD_H -#include "legocachesoundlist.h" #include "legoentity.h" -#include "legoentitylist.h" #include "legopathcontrollerlist.h" #include "mxpresenterlist.h" #include "roi/legoroi.h" +class LegoCacheSoundList; class LegoCameraController; +class LegoEntityList; class LegoPathBoundary; class LegoHideAnimPresenter; diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index d93e0c6d..5f6c1a95 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -184,15 +184,35 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) return updated; } -// STUB: LEGO1 0x10011ca0 -void Lego3DSound::FUN_10011ca0() +// FUNCTION: LEGO1 0x10011ca0 +void Lego3DSound::Reset() { - // TODO + if (m_enabled && m_roi && CharacterManager()) { + if (m_isActor) { + CharacterManager()->ReleaseActor(m_roi); + } + else { + CharacterManager()->ReleaseAutoROI(m_roi); + } + } + + m_roi = NULL; + m_positionROI = NULL; + m_actor = NULL; } -// STUB: LEGO1 0x10011cf0 -MxS32 Lego3DSound::FUN_10011cf0(undefined4, undefined4) +// FUNCTION: LEGO1 0x10011cf0 +MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max) { - // TODO - return 0; + if (MxOmni::IsSound3D()) { + if (m_ds3dBuffer == NULL) { + return -1; + } + + m_ds3dBuffer->SetMinDistance(p_min, 0); + m_ds3dBuffer->SetMaxDistance(p_max, 0); + return 0; + } + + return 1; } diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 3c2ab5f1..2a6b70ca 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -100,7 +100,7 @@ void LegoCacheSound::FUN_10006b80() m_unk0x58 = 0; m_unk0x6a = FALSE; - m_unk0x10.FUN_10011ca0(); + m_sound.Reset(); if (m_string0x74.GetLength() != 0) { m_string0x74 = ""; } @@ -123,7 +123,7 @@ void LegoCacheSound::FUN_10006be0() if (dwStatus == 0) { m_dsBuffer->Stop(); - m_unk0x10.FUN_10011ca0(); + m_sound.Reset(); if (m_string0x74.GetLength() != 0) { m_string0x74 = ""; } @@ -134,7 +134,7 @@ void LegoCacheSound::FUN_10006be0() } if (m_string0x74.GetLength() != 0 && !m_unk0x84) { - if (!m_unk0x10.UpdatePosition(m_dsBuffer)) { + if (!m_sound.UpdatePosition(m_dsBuffer)) { if (m_unk0x6a) { return; } @@ -150,9 +150,9 @@ void LegoCacheSound::FUN_10006be0() } // FUNCTION: LEGO1 0x10006cb0 -void LegoCacheSound::FUN_10006cb0(undefined4 p_und1, undefined4 p_und2) +void LegoCacheSound::SetDistance(MxS32 p_min, MxS32 p_max) { - m_unk0x10.FUN_10011cf0(p_und1, p_und2); + m_sound.SetDistance(p_min, p_max); } // FUNCTION: LEGO1 0x10006cd0 diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 3aeef9bb..863520da 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -619,7 +619,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length if (p_haveSound) { m_sound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); - m_sound->FUN_10006cb0(35, 60); + m_sound->SetDistance(35, 60); } if (m_numEntries == 0) { diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 3c358af4..19ff9fa3 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -9,6 +9,7 @@ #include "legoanimpresenter.h" #include "legocharactermanager.h" #include "legoendanimnotificationparam.h" +#include "legoentitylist.h" #include "legoextraactor.h" #include "legogamestate.h" #include "legolocomotionanimpresenter.h" diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 9da873e0..fcec9fdd 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -4,9 +4,11 @@ #include "legoanimationmanager.h" #include "legoanimpresenter.h" #include "legobuildingmanager.h" +#include "legocachesoundlist.h" #include "legocachesoundmanager.h" #include "legocameracontroller.h" #include "legocontrolmanager.h" +#include "legoentitylist.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legolocomotionanimpresenter.h" From 1423eb56fc2846b9883640f8b83420deac79744e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 17:13:57 -0400 Subject: [PATCH 11/26] Implement/match LegoSoundManager::UpdateListener (#985) --- .../lego/legoomni/include/legosoundmanager.h | 2 +- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 16 ++++----- .../lego/legoomni/src/audio/legocachsound.cpp | 1 + .../legoomni/src/audio/legosoundmanager.cpp | 36 +++++++++++++++++-- .../src/common/legoanimationmanager.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- .../src/entity/legocameracontroller.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 4 +-- .../legoomni/src/entity/legopovcontroller.cpp | 4 +-- 9 files changed, 50 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legosoundmanager.h b/LEGO1/lego/legoomni/include/legosoundmanager.h index ad46bf8f..72638c63 100644 --- a/LEGO1/lego/legoomni/include/legosoundmanager.h +++ b/LEGO1/lego/legoomni/include/legosoundmanager.h @@ -19,7 +19,7 @@ class LegoSoundManager : public MxSoundManager { // SYNTHETIC: LEGO1 0x10029920 // LegoSoundManager::`scalar deleting destructor' - void FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel); + void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity); inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; } diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 5f6c1a95..f2da166c 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -47,10 +47,10 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char return FAILURE; } - m_ds3dBuffer->SetMinDistance(15.0f, 0); - m_ds3dBuffer->SetMaxDistance(100.0f, 0); - m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, 0); - m_ds3dBuffer->SetConeOutsideVolume(-10000, 0); + m_ds3dBuffer->SetMinDistance(15.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetMaxDistance(100.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetConeOutsideVolume(-10000, DS3D_IMMEDIATE); } if (m_ds3dBuffer == NULL || p_name == NULL) { @@ -86,7 +86,7 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char if (MxOmni::IsSound3D()) { const float* position = m_positionROI->GetWorldPosition(); - m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE); } LegoEntity* entity = m_roi->GetEntity(); @@ -147,7 +147,7 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) } if (m_ds3dBuffer != NULL) { - m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE); } else { MxS32 newVolume = m_volume; @@ -209,8 +209,8 @@ MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max) return -1; } - m_ds3dBuffer->SetMinDistance(p_min, 0); - m_ds3dBuffer->SetMaxDistance(p_max, 0); + m_ds3dBuffer->SetMinDistance(p_min, DS3D_IMMEDIATE); + m_ds3dBuffer->SetMaxDistance(p_max, DS3D_IMMEDIATE); return 0; } diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 2a6b70ca..b426da5a 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -34,6 +34,7 @@ void LegoCacheSound::Init() } // STUB: LEGO1 0x10006710 +// FUNCTION: BETA10 0x10066505 MxResult LegoCacheSound::FUN_10006710() { // TODO diff --git a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp index 942f8040..2832d825 100644 --- a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp @@ -97,8 +97,38 @@ MxResult LegoSoundManager::Tickle() return m_cacheSoundManager->Tickle(); } -// STUB: LEGO1 0x1002a410 -void LegoSoundManager::FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel) +// FUNCTION: LEGO1 0x1002a410 +// FUNCTION: BETA10 0x100d03a5 +void LegoSoundManager::UpdateListener( + const float* p_position, + const float* p_direction, + const float* p_up, + const float* p_velocity +) { - // TODO + if (m_listener != NULL) { + if (p_position != NULL) { + m_listener->SetPosition(p_position[0], p_position[1], p_position[2], DS3D_DEFERRED); + } + + if (p_direction != NULL && p_up != NULL) { + m_listener->SetOrientation( + p_direction[0], + p_direction[1], + p_direction[2], + p_up[0], + p_up[1], + p_up[2], + DS3D_DEFERRED + ); + } + + if (p_velocity != NULL) { + m_listener->SetVelocity(p_velocity[0], p_velocity[1], p_velocity[2], DS3D_DEFERRED); + } + + if (p_position != NULL || (p_direction != NULL && p_up != NULL) || p_velocity != NULL) { + m_listener->CommitDeferredSettings(); + } + } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 19ff9fa3..fde5a979 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2812,7 +2812,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 62783224..7e431d03 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -369,7 +369,7 @@ void FUN_1003eda0() LegoROI* viewROI = VideoManager()->GetViewROI(); if (viewROI) { viewROI->FUN_100a5a30(vec); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index b07bb02a..3db91002 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -159,7 +159,7 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und) pov->WrappedSetLocalTransform(mat); m_lego3DView->Moved(*pov); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 7f5fef34..87274d00 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -421,7 +421,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), @@ -458,7 +458,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index 0575056d..d2fedcb6 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -156,7 +156,7 @@ MxResult LegoPointOfViewController::Tickle() pov->WrappedSetLocalTransform(mat); m_lego3DView->Moved(*pov); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(), @@ -172,7 +172,7 @@ MxResult LegoPointOfViewController::Tickle() vel.Clear(); pov->FUN_100a5a30(vel); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(), From 03ffb9c5de0aefda46634d57bb8f6be5ed345917 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jun 2024 17:29:37 -0400 Subject: [PATCH 12/26] Implement/match LegoCacheSound::Create and LegoLoadCacheSoundPresenter::StreamingTickle (#986) * Implement/match LegoCacheSound::Create * Naming * Fix naming * Fix parens --- .../legoomni/include/legocachesoundmanager.h | 2 +- LEGO1/lego/legoomni/include/legocachsound.h | 28 +++-- .../include/legoloadcachesoundpresenter.h | 8 +- .../src/audio/legocachesoundmanager.cpp | 8 +- .../lego/legoomni/src/audio/legocachsound.cpp | 112 +++++++++++++++--- .../src/audio/legoloadcachesoundpresenter.cpp | 50 +++++--- LEGO1/omni/include/mxdsmediaaction.h | 3 + LEGO1/omni/include/mxdssound.h | 4 +- LEGO1/omni/src/audio/mxwavepresenter.cpp | 4 +- 9 files changed, 165 insertions(+), 54 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index e8dbc204..8297b416 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -12,7 +12,7 @@ struct LegoCacheSoundEntry { LegoCacheSoundEntry() : m_sound(NULL), m_name(NULL) {} LegoCacheSoundEntry(LegoCacheSound* p_sound, const char* p_name) : m_sound(p_sound), m_name(p_name) {} - LegoCacheSoundEntry(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetString0x48().GetData()) {} + LegoCacheSoundEntry(LegoCacheSound* p_sound) : m_sound(p_sound), m_name(p_sound->GetUnknown0x48().GetData()) {} // FUNCTION: LEGO1 0x1003d030 ~LegoCacheSoundEntry() diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 86255152..10d0108b 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -26,12 +26,18 @@ class LegoCacheSound : public MxCore { return !strcmp(p_name, LegoCacheSound::ClassName()) || MxCore::IsA(p_name); } - virtual MxResult FUN_10006710(); // vtable+0x14 + virtual MxResult Create( + LPPCMWAVEFORMAT p_pwfx, + MxString p_mediaSrcPath, + MxS32 p_volume, + MxU8* p_data, + MxU32 p_dataSize + ); // vtable+0x14 virtual void Destroy(); // vtable+0x18 virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c - inline const MxString& GetString0x48() const { return m_string0x48; } - inline const undefined GetUnk0x58() const { return m_unk0x58; } + inline const MxString& GetUnknown0x48() const { return m_unk0x48; } + inline const undefined GetUnknown0x58() const { return m_unk0x58; } LegoCacheSound* FUN_10006960(); MxResult FUN_10006a30(const char* p_str, MxBool); @@ -44,20 +50,22 @@ class LegoCacheSound : public MxCore { private: void Init(); + void CopyData(MxU8* p_data, MxU32 p_dataSize); + MxString FUN_10006d80(const MxString& p_str); LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 - undefined m_unk0xc[4]; // 0x0c + undefined m_unk0x0c[4]; // 0x0c Lego3DSound m_sound; // 0x10 - undefined* m_unk0x40; // 0x40 - undefined4 m_unk0x44; // 0x44 - MxString m_string0x48; // 0x48 + MxU8* m_data; // 0x40 + MxU32 m_dataSize; // 0x44 + MxString m_unk0x48; // 0x48 undefined m_unk0x58; // 0x58 - PCMWAVEFORMAT m_unk0x59; // 0x59 + PCMWAVEFORMAT m_wfx; // 0x59 MxBool m_isLooping; // 0x69 MxBool m_unk0x6a; // 0x6a - undefined4 m_unk0x6c; // 0x6c + MxS32 m_volume; // 0x6c undefined m_unk0x70; // 0x70 - MxString m_string0x74; // 0x74 + MxString m_unk0x74; // 0x74 undefined m_unk0x84; // 0x84 }; diff --git a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h index 883f4b01..6def0dee 100644 --- a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h @@ -37,10 +37,10 @@ class LegoLoadCacheSoundPresenter : public MxWavePresenter { void Destroy(MxBool p_fromDestructor); LegoCacheSound* m_cacheSound; // 0x6c - undefined* m_unk0x70; // 0x70 - undefined* m_unk0x74; // 0x74 - undefined4 m_unk0x78; // 0x78 - undefined m_unk0x7c; // 0x7c + MxU8* m_data; // 0x70 + MxU8* m_pData; // 0x74 + MxU32 m_dataSize; // 0x78 + MxBool m_unk0x7c; // 0x7c PCMWAVEFORMAT m_pcmWaveFormat; // 0x7d }; diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index 8d645dfd..6628246b 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -37,7 +37,7 @@ MxResult LegoCacheSoundManager::Tickle() for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { #endif LegoCacheSound* sound = (*setIter).GetSound(); - if (sound->GetUnk0x58()) { + if (sound->GetUnknown0x58()) { sound->FUN_10006be0(); } } @@ -46,7 +46,7 @@ MxResult LegoCacheSoundManager::Tickle() while (listIter != m_list.end()) { LegoCacheSound* sound = (*listIter).GetSound(); - if (sound->GetUnk0x58()) { + if (sound->GetUnknown0x58()) { sound->FUN_10006be0(); listIter++; } @@ -84,7 +84,7 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) if (it != m_set.end()) { LegoCacheSound* sound = (*it).GetSound(); - if (sound->GetUnk0x58()) { + if (sound->GetUnknown0x58()) { m_list.push_back(LegoCacheSoundEntry(p_sound)); return p_sound; } @@ -117,7 +117,7 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003db10(LegoCacheSound* p_one, const return NULL; } - if (p_one->GetUnk0x58()) { + if (p_one->GetUnknown0x58()) { LegoCacheSound* result = p_one->FUN_10006960(); if (result) { diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index b426da5a..19ba06f3 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -12,10 +12,9 @@ LegoCacheSound::LegoCacheSound() Init(); } -// STUB: LEGO1 0x10006630 +// FUNCTION: LEGO1 0x10006630 LegoCacheSound::~LegoCacheSound() { - // TODO Destroy(); } @@ -23,39 +22,85 @@ LegoCacheSound::~LegoCacheSound() void LegoCacheSound::Init() { m_dsBuffer = NULL; - m_unk0x40 = NULL; + m_data = NULL; m_unk0x58 = 0; - memset(&m_unk0x59, 0, sizeof(m_unk0x59)); + memset(&m_wfx, 0, sizeof(m_wfx)); m_unk0x6a = FALSE; m_unk0x70 = 0; m_isLooping = TRUE; - m_unk0x6c = 79; + m_volume = 79; m_unk0x84 = 0; } -// STUB: LEGO1 0x10006710 +// FUNCTION: LEGO1 0x10006710 // FUNCTION: BETA10 0x10066505 -MxResult LegoCacheSound::FUN_10006710() +MxResult LegoCacheSound::Create( + LPPCMWAVEFORMAT p_pwfx, + MxString p_mediaSrcPath, + MxS32 p_volume, + MxU8* p_data, + MxU32 p_dataSize +) { - // TODO + WAVEFORMATEX wfx; + wfx.wFormatTag = p_pwfx->wf.wFormatTag; + wfx.nChannels = p_pwfx->wf.nChannels; + wfx.nSamplesPerSec = p_pwfx->wf.nSamplesPerSec; + wfx.nAvgBytesPerSec = p_pwfx->wf.nAvgBytesPerSec; + wfx.nBlockAlign = p_pwfx->wf.nBlockAlign; + wfx.wBitsPerSample = p_pwfx->wBitsPerSample; + wfx.cbSize = 0; + DSBUFFERDESC desc; memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); if (MxOmni::IsSound3D()) { - desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D; + desc.dwFlags = + DSBCAPS_STATIC | DSBCAPS_LOCSOFTWARE | DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME; } else { - desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME; + desc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME; } + desc.dwBufferBytes = p_dataSize; + desc.lpwfxFormat = &wfx; + if (SoundManager()->GetDirectSound()->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) { return FAILURE; } + m_volume = p_volume; + + MxS32 volume = m_volume * SoundManager()->GetVolume() / 100; + MxS32 attenuation = SoundManager()->GetAttenuation(volume); + m_dsBuffer->SetVolume(attenuation); + + if (m_sound.Create(m_dsBuffer, NULL, m_volume) != SUCCESS) { + m_dsBuffer->Release(); + m_dsBuffer = NULL; + return FAILURE; + } + + if (p_data != NULL && p_dataSize != 0) { + CopyData(p_data, p_dataSize); + } + + m_unk0x48 = FUN_10006d80(p_mediaSrcPath); + m_wfx = *p_pwfx; return SUCCESS; } +// FUNCTION: LEGO1 0x100068e0 +// FUNCTION: BETA10 0x100667a0 +void LegoCacheSound::CopyData(MxU8* p_data, MxU32 p_dataSize) +{ + delete[] m_data; + m_dataSize = p_dataSize; + m_data = new MxU8[m_dataSize]; + memcpy(m_data, p_data, m_dataSize); +} + // FUNCTION: LEGO1 0x10006920 void LegoCacheSound::Destroy() { @@ -65,7 +110,7 @@ void LegoCacheSound::Destroy() m_dsBuffer = NULL; } - delete m_unk0x40; + delete[] m_data; Init(); } @@ -81,7 +126,7 @@ MxResult LegoCacheSound::FUN_10006a30(const char* p_str, MxBool) { // TODO // gets param2 from FUN_1003db10 - if (!m_unk0x40 && !m_unk0x44) { + if (m_data == NULL && m_dataSize == 0) { return FAILURE; } @@ -102,8 +147,8 @@ void LegoCacheSound::FUN_10006b80() m_unk0x6a = FALSE; m_sound.Reset(); - if (m_string0x74.GetLength() != 0) { - m_string0x74 = ""; + if (m_unk0x74.GetLength() != 0) { + m_unk0x74 = ""; } } @@ -125,8 +170,8 @@ void LegoCacheSound::FUN_10006be0() if (dwStatus == 0) { m_dsBuffer->Stop(); m_sound.Reset(); - if (m_string0x74.GetLength() != 0) { - m_string0x74 = ""; + if (m_unk0x74.GetLength() != 0) { + m_unk0x74 = ""; } m_unk0x58 = 0; @@ -134,7 +179,7 @@ void LegoCacheSound::FUN_10006be0() } } - if (m_string0x74.GetLength() != 0 && !m_unk0x84) { + if (m_unk0x74.GetLength() != 0 && !m_unk0x84) { if (!m_sound.UpdatePosition(m_dsBuffer)) { if (m_unk0x6a) { return; @@ -160,3 +205,36 @@ void LegoCacheSound::SetDistance(MxS32 p_min, MxS32 p_max) void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) { } + +// FUNCTION: LEGO1 0x10006d80 +// FUNCTION: BETA10 0x100670e7 +MxString LegoCacheSound::FUN_10006d80(const MxString& p_str) +{ + // TODO: Clean up code + char* str = p_str.GetData(); + MxU32 length = strlen(str); + + char* local28 = str + length; + char* local14 = local28; + char* pVar1 = local28; + + do { + local14 = pVar1; + pVar1 = local14 + -1; + + if (str == local14) { + break; + } + + if (*pVar1 == '.') { + local28 = pVar1; + } + } while (*pVar1 != '\\'); + + local14 = pVar1; + + MxString local24; + local14++; + *local28 = '\0'; + return local24 = local14; +} diff --git a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp index 7bf31340..a0a66e89 100644 --- a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp @@ -4,6 +4,7 @@ #include "legocachsound.h" #include "legosoundmanager.h" #include "misc.h" +#include "mxdssound.h" #include "mxdssubscriber.h" #include "mxstreamchunk.h" #include "mxwavepresenter.h" @@ -25,50 +26,71 @@ LegoLoadCacheSoundPresenter::~LegoLoadCacheSoundPresenter() // FUNCTION: LEGO1 0x100184e0 void LegoLoadCacheSoundPresenter::Init() { - this->m_unk0x70 = NULL; - this->m_unk0x78 = 0; - this->m_unk0x7c = 0; + m_data = NULL; + m_dataSize = 0; + m_unk0x7c = FALSE; } // FUNCTION: LEGO1 0x100184f0 void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor) { - delete[] this->m_unk0x70; + delete[] m_data; MxWavePresenter::Destroy(p_fromDestructor); } // FUNCTION: LEGO1 0x10018510 +// FUNCTION: BETA10 0x1008c305 void LegoLoadCacheSoundPresenter::ReadyTickle() { MxStreamChunk* chunk = NextChunk(); if (chunk) { WaveFormat* header = (WaveFormat*) chunk->GetData(); - m_unk0x78 = 0; + m_dataSize = 0; MxU8* data = new MxU8[header->m_dataSize]; - m_unk0x70 = data; - m_unk0x74 = data; + m_data = data; + m_pData = data; - m_cacheSound = new LegoCacheSound; - memcpy(&m_pcmWaveFormat, &header->m_pcmWaveFormat, sizeof(m_pcmWaveFormat)); + m_cacheSound = new LegoCacheSound(); + m_pcmWaveFormat = header->m_pcmWaveFormat; m_subscriber->FreeDataChunk(chunk); ProgressTickleState(e_streaming); } } -// STUB: LEGO1 0x100185f0 +// FUNCTION: LEGO1 0x100185f0 +// FUNCTION: BETA10 0x1008c48f void LegoLoadCacheSoundPresenter::StreamingTickle() { - // TODO - EndAction(); + MxStreamChunk* chunk = NextChunk(); + + if (chunk) { + if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { + m_cacheSound->Create( + &m_pcmWaveFormat, + ((MxDSSound*) m_action)->GetMediaSrcPath(), + ((MxDSSound*) m_action)->GetVolume(), + m_data + 2, + m_dataSize - 2 + ); + ProgressTickleState(e_done); + } + else { + memcpy(m_pData, chunk->GetData(), chunk->GetLength()); + m_dataSize += chunk->GetLength(); + m_pData += chunk->GetLength(); + } + + m_subscriber->FreeDataChunk(chunk); + } } // FUNCTION: LEGO1 0x100186f0 void LegoLoadCacheSoundPresenter::DoneTickle() { - if (m_unk0x7c != 0) { + if (m_unk0x7c) { EndAction(); } } @@ -80,7 +102,7 @@ MxResult LegoLoadCacheSoundPresenter::PutData() if (m_currentTickleState == e_done) { m_cacheSound = SoundManager()->GetCacheSoundManager()->ManageSoundEntry(m_cacheSound); - m_unk0x7c = 1; + m_unk0x7c = TRUE; } m_criticalSection.Leave(); diff --git a/LEGO1/omni/include/mxdsmediaaction.h b/LEGO1/omni/include/mxdsmediaaction.h index 9b5f8604..ec393c05 100644 --- a/LEGO1/omni/include/mxdsmediaaction.h +++ b/LEGO1/omni/include/mxdsmediaaction.h @@ -42,6 +42,9 @@ class MxDSMediaAction : public MxDSAction { void CopyMediaSrcPath(const char* p_mediaSrcPath); + // FUNCTION: LEGO1 0x100186e0 + inline const char* GetMediaSrcPath() { return m_mediaSrcPath; } + // FUNCTION: BETA10 0x1013c2e0 inline MxS32 GetFramesPerSecond() const { return m_framesPerSecond; } diff --git a/LEGO1/omni/include/mxdssound.h b/LEGO1/omni/include/mxdssound.h index c406ba92..bd4f7c6b 100644 --- a/LEGO1/omni/include/mxdssound.h +++ b/LEGO1/omni/include/mxdssound.h @@ -36,8 +36,8 @@ class MxDSSound : public MxDSMediaAction { // MxDSSound::`scalar deleting destructor' private: - MxU32 m_sizeOnDisk; - MxS32 m_volume; // 0xbc + MxU32 m_sizeOnDisk; // 0xb8 + MxS32 m_volume; // 0xbc }; #endif // MXDSSOUND_H diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index 80e52dd1..caac77cc 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -299,8 +299,8 @@ void MxWavePresenter::SetVolume(MxS32 p_volume) m_volume = p_volume; if (m_dsBuffer != NULL) { MxS32 volume = p_volume * MxOmni::GetInstance()->GetSoundManager()->GetVolume() / 100; - MxS32 otherVolume = MxOmni::GetInstance()->GetSoundManager()->GetAttenuation(volume); - m_dsBuffer->SetVolume(otherVolume); + MxS32 attenuation = MxOmni::GetInstance()->GetSoundManager()->GetAttenuation(volume); + m_dsBuffer->SetVolume(attenuation); } m_criticalSection.Leave(); From 828b35e9d22c7a17f7af4906049b56e0b1f4c789 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 2 Jun 2024 11:09:09 -0400 Subject: [PATCH 13/26] Implement/match LegoCacheSound::Play and Lego3DSound::FUN_10011a60 (#987) * Implement/match LegoCacheSound::Play and Lego3DSound::FUN_10011a60 * Update names * Update --- LEGO1/lego/legoomni/include/lego3dsound.h | 1 + .../legoomni/include/legocachesoundmanager.h | 7 +- LEGO1/lego/legoomni/include/legocachsound.h | 12 +-- LEGO1/lego/legoomni/src/audio/lego3dsound.cpp | 96 ++++++++++++++++++- .../src/audio/legocachesoundmanager.cpp | 41 ++++---- .../lego/legoomni/src/audio/legocachsound.cpp | 81 ++++++++++++---- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../legoomni/src/paths/legoextraactor.cpp | 4 +- .../lego/legoomni/src/paths/legopathactor.cpp | 2 +- 10 files changed, 193 insertions(+), 55 deletions(-) diff --git a/LEGO1/lego/legoomni/include/lego3dsound.h b/LEGO1/lego/legoomni/include/lego3dsound.h index e52c249b..dc7840a3 100644 --- a/LEGO1/lego/legoomni/include/lego3dsound.h +++ b/LEGO1/lego/legoomni/include/lego3dsound.h @@ -20,6 +20,7 @@ class Lego3DSound { MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume); void Destroy(); MxU32 UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer); + void FUN_10011a60(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name); void Reset(); MxS32 SetDistance(MxS32 p_min, MxS32 p_max); diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index 8297b416..0856aa70 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -56,11 +56,12 @@ class LegoCacheSoundManager { LegoCacheSound* FindSoundByKey(const char* p_key); LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); - LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); - LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); - void FUN_1003dc40(LegoCacheSound** p_und); + LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping); + void Destroy(LegoCacheSound*& p_sound); private: + LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping); + Set100d6b4c m_set; // 0x04 List100d6b4c m_list; // 0x14 }; diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 10d0108b..b80ded36 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -37,10 +37,10 @@ class LegoCacheSound : public MxCore { virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c inline const MxString& GetUnknown0x48() const { return m_unk0x48; } - inline const undefined GetUnknown0x58() const { return m_unk0x58; } + inline const MxBool GetUnknown0x58() const { return m_unk0x58; } - LegoCacheSound* FUN_10006960(); - MxResult FUN_10006a30(const char* p_str, MxBool); + LegoCacheSound* Clone(); + MxResult Play(const char* p_name, MxBool p_looping); void FUN_10006b80(); void FUN_10006be0(); void SetDistance(MxS32 p_min, MxS32 p_max); @@ -59,12 +59,12 @@ class LegoCacheSound : public MxCore { MxU8* m_data; // 0x40 MxU32 m_dataSize; // 0x44 MxString m_unk0x48; // 0x48 - undefined m_unk0x58; // 0x58 + MxBool m_unk0x58; // 0x58 PCMWAVEFORMAT m_wfx; // 0x59 - MxBool m_isLooping; // 0x69 + MxBool m_looping; // 0x69 MxBool m_unk0x6a; // 0x6a MxS32 m_volume; // 0x6c - undefined m_unk0x70; // 0x70 + MxBool m_unk0x70; // 0x70 MxString m_unk0x74; // 0x74 undefined m_unk0x84; // 0x84 }; diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index f2da166c..508cd395 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -151,7 +151,6 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) } else { MxS32 newVolume = m_volume; - if (distance < 100.0f) { newVolume = m_volume; } @@ -184,6 +183,101 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) return updated; } +// FUNCTION: LEGO1 0x10011a60 +// FUNCTION: BETA10 0x10039d04 +void Lego3DSound::FUN_10011a60(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name) +{ + assert(p_directSoundBuffer); + + if (p_name == NULL) { + if (m_ds3dBuffer != NULL) { + m_ds3dBuffer->SetMode(DS3DMODE_DISABLE, DS3D_IMMEDIATE); + } + } + else { + if (CharacterManager()->IsActor(p_name)) { + m_roi = CharacterManager()->GetActorROI(p_name, TRUE); + m_enabled = m_isActor = TRUE; + } + else { + m_roi = FindROI(p_name); + } + + if (m_roi == NULL) { + m_roi = CharacterManager()->CreateAutoROI(NULL, p_name, TRUE); + + if (m_roi != NULL) { + m_enabled = TRUE; + } + } + + if (m_roi == NULL) { + return; + } + + if (m_isActor) { + m_positionROI = m_roi->FindChildROI("head", m_roi); + } + else { + m_positionROI = m_roi; + } + + if (m_ds3dBuffer != NULL) { + DWORD dwMode; + m_ds3dBuffer->GetMode(&dwMode); + + if (dwMode & DS3DMODE_DISABLE) { + m_ds3dBuffer->SetMode(DS3DMODE_NORMAL, DS3D_IMMEDIATE); + } + + const float* position = m_positionROI->GetWorldPosition(); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE); + } + else { + const float* position = m_positionROI->GetWorldPosition(); + ViewROI* pov = VideoManager()->GetViewROI(); + + if (pov != NULL) { + const float* povPosition = pov->GetWorldPosition(); + float distance = DISTSQRD3(povPosition, position); + + MxS32 newVolume; + if (distance < 100.0f) { + newVolume = m_volume; + } + else if (distance < 400.0f) { + newVolume = m_volume * 0.4; + } + else if (distance < 3600.0f) { + newVolume = m_volume * 0.1; + } + else { + newVolume = 0; + } + + newVolume = newVolume * SoundManager()->GetVolume() / 100; + newVolume = SoundManager()->GetAttenuation(newVolume); + p_directSoundBuffer->SetVolume(newVolume); + } + } + + LegoEntity* entity = m_roi->GetEntity(); + if (entity != NULL && entity->IsA("LegoActor") && ((LegoActor*) entity)->GetSoundFrequencyFactor() != 0.0f) { + m_actor = ((LegoActor*) entity); + } + + p_directSoundBuffer->GetFrequency(&m_dwFrequency); + + if (m_actor != NULL) { + m_frequencyFactor = m_actor->GetSoundFrequencyFactor(); + + if (m_frequencyFactor != 0.0) { + p_directSoundBuffer->SetFrequency(m_frequencyFactor * m_dwFrequency); + } + } + } +} + // FUNCTION: LEGO1 0x10011ca0 void Lego3DSound::Reset() { diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index 6628246b..36445ce7 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -104,53 +104,48 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) } // FUNCTION: LEGO1 0x1003dae0 -LegoCacheSound* LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three) +LegoCacheSound* LegoCacheSoundManager::Play(const char* p_key, const char* p_name, MxBool p_looping) { - // DECOMP: Second parameter is LegoRoi::m_name (0xe4) - return FUN_1003db10(FindSoundByKey(p_one), p_two, p_three); + return Play(FindSoundByKey(p_key), p_name, p_looping); } // FUNCTION: LEGO1 0x1003db10 -LegoCacheSound* LegoCacheSoundManager::FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three) +LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping) { - if (!p_one) { + if (!p_sound) { return NULL; } - if (p_one->GetUnknown0x58()) { - LegoCacheSound* result = p_one->FUN_10006960(); + if (p_sound->GetUnknown0x58()) { + LegoCacheSound* clone = p_sound->Clone(); - if (result) { - LegoCacheSound* t = ManageSoundEntry(result); - t->FUN_10006a30(p_two, p_three); - return t; + if (clone) { + LegoCacheSound* sound = ManageSoundEntry(clone); + sound->Play(p_name, p_looping); + return sound; } } else { - p_one->FUN_10006a30(p_two, p_three); - return p_one; + p_sound->Play(p_name, p_looping); + return p_sound; } return NULL; } // FUNCTION: LEGO1 0x1003dc40 -void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und) +void LegoCacheSoundManager::Destroy(LegoCacheSound*& p_sound) { - // Called during LegoWorld::Destroy like this: - // SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); - // LegoCacheSound*& p_sound? - #ifdef COMPAT_MODE Set100d6b4c::iterator setIter; for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { #else for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { #endif - if ((*setIter).GetSound() == *p_und) { - (*p_und)->FUN_10006b80(); + if ((*setIter).GetSound() == p_sound) { + p_sound->FUN_10006b80(); - delete *p_und; + delete p_sound; m_set.erase(setIter); return; } @@ -167,8 +162,8 @@ void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und) } LegoCacheSound* sound = (*listIter).GetSound(); - if (sound == *p_und) { - (*p_und)->FUN_10006b80(); + if (sound == p_sound) { + p_sound->FUN_10006b80(); delete sound; m_list.erase(listIter); diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 19ba06f3..457e51f4 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -23,11 +23,11 @@ void LegoCacheSound::Init() { m_dsBuffer = NULL; m_data = NULL; - m_unk0x58 = 0; + m_unk0x58 = FALSE; memset(&m_wfx, 0, sizeof(m_wfx)); m_unk0x6a = FALSE; - m_unk0x70 = 0; - m_isLooping = TRUE; + m_unk0x70 = FALSE; + m_looping = TRUE; m_volume = 79; m_unk0x84 = 0; } @@ -114,22 +114,69 @@ void LegoCacheSound::Destroy() Init(); } -// STUB: LEGO1 0x10006960 -LegoCacheSound* LegoCacheSound::FUN_10006960() +// FUNCTION: LEGO1 0x10006960 +// FUNCTION: BETA10 0x100668cf +LegoCacheSound* LegoCacheSound::Clone() { - // TODO + LegoCacheSound* pnew = new LegoCacheSound(); + + if (pnew->Create(&m_wfx, m_unk0x48, m_volume, m_data, m_dataSize) == SUCCESS) { + return pnew; + } + + delete pnew; return NULL; } -// STUB: LEGO1 0x10006a30 -MxResult LegoCacheSound::FUN_10006a30(const char* p_str, MxBool) +// FUNCTION: LEGO1 0x10006a30 +// FUNCTION: BETA10 0x10066a23 +MxResult LegoCacheSound::Play(const char* p_name, MxBool p_looping) { - // TODO - // gets param2 from FUN_1003db10 - if (m_data == NULL && m_dataSize == 0) { + if (m_data == NULL || m_dataSize == 0) { return FAILURE; } + m_unk0x6a = FALSE; + m_sound.FUN_10011a60(m_dsBuffer, p_name); + + if (p_name != NULL) { + m_unk0x74 = p_name; + } + + DWORD dwStatus; + m_dsBuffer->GetStatus(&dwStatus); + + if (dwStatus == DSBSTATUS_BUFFERLOST) { + m_dsBuffer->Restore(); + m_dsBuffer->GetStatus(&dwStatus); + } + + if (dwStatus != DSBSTATUS_BUFFERLOST) { + LPVOID pvAudioPtr1, pvAudioPtr2; + DWORD dwAudioBytes1, dwAudioBytes2; + + if (m_dsBuffer->Lock(0, m_dataSize, &pvAudioPtr1, &dwAudioBytes1, &pvAudioPtr2, &dwAudioBytes2, 0) == DS_OK) { + memcpy(pvAudioPtr1, m_data, dwAudioBytes1); + + if (dwAudioBytes2 != 0) { + memcpy(pvAudioPtr2, m_data + dwAudioBytes1, dwAudioBytes2); + } + + m_dsBuffer->Unlock(pvAudioPtr1, dwAudioBytes1, pvAudioPtr2, dwAudioBytes2); + m_dsBuffer->SetCurrentPosition(0); + m_dsBuffer->Play(0, 0, p_looping); + } + } + + if (p_looping == FALSE) { + m_looping = FALSE; + } + else { + m_looping = TRUE; + } + + m_unk0x58 = TRUE; + m_unk0x70 = TRUE; return SUCCESS; } @@ -137,13 +184,13 @@ MxResult LegoCacheSound::FUN_10006a30(const char* p_str, MxBool) void LegoCacheSound::FUN_10006b80() { DWORD dwStatus; - m_dsBuffer->GetStatus(&dwStatus); + if (dwStatus) { m_dsBuffer->Stop(); } - m_unk0x58 = 0; + m_unk0x58 = FALSE; m_unk0x6a = FALSE; m_sound.Reset(); @@ -155,7 +202,7 @@ void LegoCacheSound::FUN_10006b80() // FUNCTION: LEGO1 0x10006be0 void LegoCacheSound::FUN_10006be0() { - if (!m_isLooping) { + if (!m_looping) { DWORD dwStatus; m_dsBuffer->GetStatus(&dwStatus); @@ -164,7 +211,7 @@ void LegoCacheSound::FUN_10006be0() return; } - m_unk0x70 = 0; + m_unk0x70 = FALSE; } if (dwStatus == 0) { @@ -174,7 +221,7 @@ void LegoCacheSound::FUN_10006be0() m_unk0x74 = ""; } - m_unk0x58 = 0; + m_unk0x58 = FALSE; return; } } @@ -189,7 +236,7 @@ void LegoCacheSound::FUN_10006be0() m_unk0x6a = TRUE; } else if (m_unk0x6a) { - m_dsBuffer->Play(0, 0, m_isLooping); + m_dsBuffer->Play(0, 0, m_looping); m_unk0x6a = FALSE; } } diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 6ab78b63..d7d79e1a 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -103,7 +103,7 @@ void LegoActor::ParseAction(char* p_extra) } if (KeyValueStringParse(value, g_strSOUND, p_extra)) { - m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003dae0(value, GetROI()->GetName(), TRUE); + m_sound = SoundManager()->GetCacheSoundManager()->Play(value, GetROI()->GetName(), TRUE); } if (KeyValueStringParse(value, g_strMUTE, p_extra)) { diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index fcec9fdd..fecff1de 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -204,7 +204,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) while (cursor.First(sound)) { cursor.Detach(); - SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); + SoundManager()->GetCacheSoundManager()->Destroy(sound); } delete m_cacheSoundList; diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index e1eeedbe..f0e2e69b 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -233,7 +233,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) m_roi->FUN_100a58f0(matrix2); m_roi->VTable0x14(); FUN_1002ad8a(); - SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); + SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration(); m_prevWorldSpeed = m_worldSpeed; VTable0xc4(); @@ -245,7 +245,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) if (b) { LegoROI* roi = m_roi; - SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); + SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); VTable0xc4(); m_state = 0x102; Mx3DPointFloat dir = p_actor->GetWorldDirection(); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 430914b2..454f04fb 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -278,7 +278,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); if (var && var[0] != 0) { - SoundManager()->GetCacheSoundManager()->FUN_1003dae0(var, NULL, FALSE); + SoundManager()->GetCacheSoundManager()->Play(var, NULL, FALSE); } } From 73bb37596e05f353011c38fb57f39350577bad54 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 3 Jun 2024 07:00:38 -0400 Subject: [PATCH 14/26] Refactor JukeBox, add enum for music (#988) * Refactor JukeBox, add enum for music * add BETA annotation * Fix BETA annotation * Fix BETA annotation * Fix --- LEGO1/lego/legoomni/include/act1state.h | 6 +- LEGO1/lego/legoomni/include/jukeboxstate.h | 17 ++-- .../legoomni/include/legocontrolmanager.h | 3 +- LEGO1/lego/legoomni/include/legogamestate.h | 30 +++---- LEGO1/lego/legoomni/include/legoutils.h | 2 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 44 +++++----- .../legoomni/src/common/legogamestate.cpp | 4 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 14 ++-- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 81 ++++++++++--------- 12 files changed, 102 insertions(+), 105 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index dcc09959..2d428e69 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -79,6 +79,8 @@ class Act1State : public LegoState { void FUN_10034b60(); void FUN_10034d00(); + // TODO: Most likely getters/setters are not used according to BETA. + inline MxU32 GetUnknown18() { return m_unk0x018; } inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } inline MxU8 GetUnknown21() { return m_unk0x021; } @@ -90,10 +92,6 @@ class Act1State : public LegoState { // SYNTHETIC: LEGO1 0x10033960 // Act1State::`scalar deleting destructor' - friend class Isle; - friend class SkateBoard; - -protected: MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 MxS16 m_unk0x00c; // 0x00c undefined2 m_unk0x00e; // 0x00e diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h index 393da756..d9da3b84 100644 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ b/LEGO1/lego/legoomni/include/jukeboxstate.h @@ -7,6 +7,15 @@ // SIZE 0x10 class JukeBoxState : public LegoState { public: + enum Music { + e_pasquell = 0, + e_right, + e_decal, + e_wallis, + e_nelson, + e_torpedos + }; + // FUNCTION: LEGO1 0x1000f310 inline const char* ClassName() const override // vtable+0x0c { @@ -22,16 +31,10 @@ class JukeBoxState : public LegoState { MxBool IsSerializable() override; // vtable+0x14 - inline MxU32 IsActive() { return m_active; } - inline void SetActive(MxU32 p_active) { m_active = p_active; } - inline MxU32 GetState() { return m_state; } - inline void SetState(MxU32 p_state) { m_state = p_state; } - // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' - // protected: - MxU32 m_state; // 0x08 + Music m_music; // 0x08 MxU32 m_active; // 0x0c }; diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 09e5a6d5..22cd2c58 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -18,6 +18,8 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { m_clickedAtom = NULL; } + // TODO: Most likely getters/setters are not used according to BETA. + inline MxS32 GetClickedObjectId() const { return m_clickedObjectId; } inline const char* GetClickedAtom() const { return m_clickedAtom; } inline MxS16 GetUnknown0x28() const { return m_unk0x28; } @@ -26,7 +28,6 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { inline void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; } inline void SetUnknown0x28(MxS16 p_unk0x28) { m_unk0x28 = p_unk0x28; } -private: MxS32 m_clickedObjectId; // 0x20 const char* m_clickedAtom; // 0x24 MxS16 m_unk0x28; // 0x28 diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index b1a9051f..db21dd3c 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -90,7 +90,7 @@ class LegoGameState { e_unk51, e_unk52, e_jukeboxw, - e_unk54, + e_jukeboxExterior, e_unk55, e_histbook, e_bike, @@ -174,7 +174,6 @@ class LegoGameState { inline Act GetLoadedAct() { return m_loadedAct; } inline Area GetCurrentArea() { return m_currentArea; } inline Area GetPreviousArea() { return m_previousArea; } - inline JukeboxScript::Script GetUnknown0x41c() { return m_unk0x41c; } inline Area GetUnknown0x42c() { return m_unk0x42c; } inline History* GetHistory() { return &m_history; } @@ -182,7 +181,6 @@ class LegoGameState { inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; } inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; } inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } - inline void SetUnknown0x41c(JukeboxScript::Script p_unk0x41c) { m_unk0x41c = p_unk0x41c; } inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; } inline Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; } inline MxS16 GetPlayerCount() { return m_playerCount; } @@ -210,24 +208,18 @@ class LegoGameState { LegoFullScreenMovie* m_fullScreenMovie; // 0x20 MxU16 m_unk0x24; // 0x24 - // Member visibility needs to be refactored, since most members are accessed directly. + // TODO: Most likely getters/setters are not used according to BETA for the following members: public: - MxS16 m_playerCount; // 0x26 - Username m_players[9]; // 0x28 - -private: - History m_history; // 0xa6 - undefined2 m_unk0x41a; // 0x41a - JukeboxScript::Script m_unk0x41c; // 0x41c - MxBool m_isDirty; // 0x420 - -public: - Area m_currentArea; // 0x424 - Area m_previousArea; // 0x428 - -private: - Area m_unk0x42c; // 0x42c + MxS16 m_playerCount; // 0x26 + Username m_players[9]; // 0x28 + History m_history; // 0xa6 + undefined2 m_unk0x41a; // 0x41a + JukeboxScript::Script m_jukeboxMusic; // 0x41c + MxBool m_isDirty; // 0x420 + Area m_currentArea; // 0x424 + Area m_previousArea; // 0x428 + Area m_unk0x42c; // 0x42c }; MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen); diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 09e2d72e..74545513 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -44,7 +44,7 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); -void FUN_1003ef00(MxBool p_enable); +void EnableAnimations(MxBool p_enable); void SetAppCursor(Cursor p_cursor); MxBool FUN_1003ef60(); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index b4f1266a..e526384e 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -430,7 +430,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_noneJukebox ); g_spawnLocations[27] = SpawnLocation( - LegoGameState::e_unk54, + LegoGameState::e_jukeboxExterior, g_isleScript, 0, "int36", diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index a4c505a2..f4e2af0a 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -55,37 +55,37 @@ void JukeBoxEntity::StartAction() MxDSAction action; BackgroundAudioManager()->Stop(); JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); - state->SetActive(TRUE); + state->m_active = TRUE; - switch (state->GetState()) { - case 0: + switch (state->m_music) { + case JukeBoxState::e_pasquell: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic1); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic1; break; - case 1: + case JukeBoxState::e_right: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic2); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic2; break; - case 2: + case JukeBoxState::e_decal: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic3); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic3; break; - case 3: + case JukeBoxState::e_wallis: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic4); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic4; break; - case 4: + case JukeBoxState::e_nelson: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic5); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic5; break; - case 5: + case JukeBoxState::e_torpedos: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic6); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic6; break; } action.SetAtomId(*g_jukeboxScript); - action.SetObjectId(GameState()->GetUnknown0x41c()); + action.SetObjectId(GameState()->m_jukeboxMusic); m_audioEnabled = BackgroundAudioManager()->GetEnabled(); if (!m_audioEnabled) { @@ -100,30 +100,30 @@ void JukeBoxEntity::StopAction(JukeboxScript::Script p_script) { JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); - if (state && state->IsActive()) { + if (state && state->m_active) { switch (p_script) { case JukeboxScript::c_JBMusic1: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic2: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic3: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic4: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic5: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic6: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL); break; } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index be09e19b..0f339590 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -124,7 +124,7 @@ LegoGameState::LegoGameState() m_actorId = 0; m_savePath = NULL; m_stateArray = NULL; - m_unk0x41c = JukeboxScript::c_noneJukebox; + m_jukeboxMusic = JukeboxScript::c_noneJukebox; m_currentArea = e_undefined; m_previousArea = e_undefined; m_unk0x42c = e_undefined; @@ -982,7 +982,7 @@ void LegoGameState::SwitchArea(Area p_area) VideoManager()->SetUnk0x554(TRUE); InvokeAction(Extra::ActionType::e_opendisk, *g_jukeboxwScript, JukeboxwScript::c__StartUp, NULL); break; - case e_unk54: + case e_jukeboxExterior: LoadIsle(); break; case e_histbook: diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 7e431d03..d769404e 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -437,7 +437,7 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor } // FUNCTION: LEGO1 0x1003ef00 -void FUN_1003ef00(MxBool p_enable) +void EnableAnimations(MxBool p_enable) { if (p_enable) { AnimationManager()->Resume(); diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 5848b4ad..d62baa21 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -100,7 +100,7 @@ MxResult Hospital::Create(MxDSAction& p_dsAction) GameState()->StopArea(LegoGameState::e_previousArea); InputManager()->Register(this); - FUN_1003ef00(FALSE); + EnableAnimations(FALSE); return result; } diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 78d05c70..2d5fee23 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -113,7 +113,7 @@ MxResult Isle::Create(MxDSAction& p_dsAction) } m_act1state = act1state; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); GameState()->SetDirty(TRUE); } @@ -270,7 +270,7 @@ void Isle::ReadyWorld() m_act1state->SetUnknown21(0); } else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) { - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); FUN_10032620(); m_act1state->FUN_10034d00(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); @@ -548,7 +548,7 @@ void Isle::Enable(MxBool p_enable) GameState()->StopArea(LegoGameState::e_previousArea); GameState()->m_previousArea = GameState()->m_currentArea; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); if (m_act1state->m_unk0x018 == 0) { MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; @@ -748,7 +748,7 @@ void Isle::Enable(MxBool p_enable) } m_act1state->m_unk0x018 = 0; - FUN_1003ef00(FALSE); + EnableAnimations(FALSE); AnimationManager()->FUN_10064670(NULL); break; } @@ -781,7 +781,7 @@ void Isle::Enable(MxBool p_enable) } m_act1state->m_unk0x018 = 0; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); break; } case 7: @@ -806,12 +806,12 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 0; ((IslePathActor*) CurrentActor()) ->SpawnPlayer( - LegoGameState::e_unk54, + LegoGameState::e_jukeboxExterior, TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); GameState()->m_currentArea = LegoGameState::e_unk66; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); m_jukebox->StartAction(); break; } diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 421760ab..5cb59794 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -58,7 +58,7 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction) m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); if (!m_state) { m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState"); - m_state->SetState(0); + m_state->m_music = JukeBoxState::e_pasquell; } GameState()->SetCurrentArea(LegoGameState::e_jukeboxw); @@ -89,24 +89,27 @@ MxLong JukeBox::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x1005d9f0 +// FUNCTION: BETA10 0x10037e39 void JukeBox::ReadyWorld() { MxStillPresenter* presenter = NULL; - switch (m_state->GetState()) { - case 1: + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + break; + case JukeBoxState::e_right: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); break; - case 2: + case JukeBoxState::e_decal: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); break; - case 3: + case JukeBoxState::e_wallis: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); break; - case 4: + case JukeBoxState::e_nelson: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); break; - case 5: + case JukeBoxState::e_torpedos: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); break; } @@ -119,47 +122,48 @@ void JukeBox::ReadyWorld() } // FUNCTION: LEGO1 0x1005da70 +// FUNCTION: BETA10 0x10037f6d MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) { MxStillPresenter* presenter; - if (p_param.GetUnknown0x28() == 1) { - switch (p_param.GetClickedObjectId()) { + if (p_param.m_unk0x28 == 1) { + switch (p_param.m_clickedObjectId) { case JukeboxwScript::c_Dback_Ctl: - switch (m_state->GetState()) { - case JukeboxScript::c_MusicTheme1: - m_state->SetState(JukeboxScript::c_ResidentalArea_Music); + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + m_state->m_music = JukeBoxState::e_torpedos; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_MusicTheme3: - m_state->SetState(JukeboxScript::c_MusicTheme1); + case JukeBoxState::e_right: + m_state->m_music = JukeBoxState::e_pasquell; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(FALSE); break; - case JukeboxScript::c_Act2Cave: - m_state->SetState(JukeboxScript::c_MusicTheme3); + case JukeBoxState::e_decal: + m_state->m_music = JukeBoxState::e_right; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickstrChase: - m_state->SetState(JukeboxScript::c_Act2Cave); + case JukeBoxState::e_wallis: + m_state->m_music = JukeBoxState::e_decal; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickHunt: - m_state->SetState(JukeboxScript::c_BrickstrChase); + case JukeBoxState::e_nelson: + m_state->m_music = JukeBoxState::e_wallis; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_ResidentalArea_Music: - m_state->SetState(JukeboxScript::c_BrickHunt); + case JukeBoxState::e_torpedos: + m_state->m_music = JukeBoxState::e_nelson; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); @@ -168,52 +172,51 @@ MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) } break; case JukeboxwScript::c_Dfwd_Ctl: - switch (m_state->GetState()) { - case JukeboxScript::c_MusicTheme1: - m_state->SetState(JukeboxScript::c_MusicTheme3); + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + m_state->m_music = JukeBoxState::e_right; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_MusicTheme3: - m_state->SetState(JukeboxScript::c_Act2Cave); + case JukeBoxState::e_right: + m_state->m_music = JukeBoxState::e_decal; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_Act2Cave: - m_state->SetState(JukeboxScript::c_BrickstrChase); + case JukeBoxState::e_decal: + m_state->m_music = JukeBoxState::e_wallis; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickstrChase: - m_state->SetState(JukeboxScript::c_BrickHunt); + case JukeBoxState::e_wallis: + m_state->m_music = JukeBoxState::e_nelson; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickHunt: - m_state->SetState(JukeboxScript::c_ResidentalArea_Music); + case JukeBoxState::e_nelson: + m_state->m_music = JukeBoxState::e_torpedos; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_ResidentalArea_Music: - m_state->SetState(JukeboxScript::c_MusicTheme1); + case JukeBoxState::e_torpedos: + m_state->m_music = JukeBoxState::e_pasquell; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(FALSE); break; } break; case JukeboxwScript::c_Note_Ctl: - LegoGameState* gameState = GameState(); - Act1State* act1State = (Act1State*) gameState->GetState("Act1State"); - act1State->SetUnknown18(11); - m_destLocation = LegoGameState::Area::e_unk54; + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + act1State->m_unk0x018 = 11; + m_destLocation = LegoGameState::Area::e_jukeboxExterior; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, 0, FALSE); break; } From 133a312aee16be8519dc8a1525ef718aa4b10c98 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 3 Jun 2024 12:53:25 -0400 Subject: [PATCH 15/26] Consolidate state and building entity classes (#989) --- CMakeLists.txt | 29 +- LEGO1/lego/legoomni/include/act1state.h | 134 -------- LEGO1/lego/legoomni/include/act3.h | 33 ++ LEGO1/lego/legoomni/include/act3state.h | 36 --- LEGO1/lego/legoomni/include/ambulance.h | 57 +++- .../legoomni/include/ambulancemissionstate.h | 62 ---- LEGO1/lego/legoomni/include/animstate.h | 71 ----- .../lego/legoomni/include/beachhouseentity.h | 29 -- LEGO1/lego/legoomni/include/buildings.h | 166 ++++++++++ LEGO1/lego/legoomni/include/carrace.h | 21 ++ LEGO1/lego/legoomni/include/carracestate.h | 27 -- LEGO1/lego/legoomni/include/caveentity.h | 2 +- LEGO1/lego/legoomni/include/gasstation.h | 45 ++- .../lego/legoomni/include/gasstationentity.h | 29 -- LEGO1/lego/legoomni/include/gasstationstate.h | 50 --- LEGO1/lego/legoomni/include/helicopter.h | 39 ++- LEGO1/lego/legoomni/include/helicopterstate.h | 44 --- LEGO1/lego/legoomni/include/hospital.h | 43 ++- LEGO1/lego/legoomni/include/hospitalentity.h | 29 -- LEGO1/lego/legoomni/include/hospitalstate.h | 49 --- LEGO1/lego/legoomni/include/infocenter.h | 52 ++- .../lego/legoomni/include/infocenterentity.h | 29 -- LEGO1/lego/legoomni/include/infocenterstate.h | 59 ---- LEGO1/lego/legoomni/include/isle.h | 129 +++++++- LEGO1/lego/legoomni/include/jailentity.h | 29 -- LEGO1/lego/legoomni/include/jetskirace.h | 21 ++ LEGO1/lego/legoomni/include/jetskiracestate.h | 27 -- LEGO1/lego/legoomni/include/jukebox.h | 38 ++- LEGO1/lego/legoomni/include/jukeboxstate.h | 41 --- LEGO1/lego/legoomni/include/legoact2.h | 35 +++ LEGO1/lego/legoomni/include/legoact2state.h | 38 --- .../legoomni/include/legoanimationmanager.h | 68 +++- LEGO1/lego/legoomni/include/legocarbuild.h | 46 +++ ...nimpresenter.h => legocarbuildpresenter.h} | 6 +- LEGO1/lego/legoomni/include/legorace.h | 50 +++ .../legoomni/include/legovehiclebuildstate.h | 52 --- LEGO1/lego/legoomni/include/pizza.h | 43 ++- .../lego/legoomni/include/pizzamissionstate.h | 47 --- LEGO1/lego/legoomni/include/pizzeria.h | 43 ++- LEGO1/lego/legoomni/include/pizzeriastate.h | 46 --- LEGO1/lego/legoomni/include/police.h | 38 ++- LEGO1/lego/legoomni/include/policeentity.h | 29 -- LEGO1/lego/legoomni/include/policestate.h | 43 --- .../lego/legoomni/include/racestandsentity.h | 28 -- LEGO1/lego/legoomni/include/racestate.h | 54 ---- LEGO1/lego/legoomni/include/radio.h | 41 ++- LEGO1/lego/legoomni/include/radiostate.h | 45 --- LEGO1/lego/legoomni/include/score.h | 40 ++- LEGO1/lego/legoomni/include/scorestate.h | 36 --- LEGO1/lego/legoomni/include/towtrack.h | 58 +++- .../legoomni/include/towtrackmissionstate.h | 63 ---- LEGO1/lego/legoomni/src/act1/act1state.cpp | 296 ------------------ .../lego/legoomni/src/act2/legoact2state.cpp | 9 - LEGO1/lego/legoomni/src/act3/act3state.cpp | 9 - .../src/{act3 => actors}/act3shark.cpp | 0 LEGO1/lego/legoomni/src/actors/ambulance.cpp | 26 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 176 +++++++++++ LEGO1/lego/legoomni/src/actors/helicopter.cpp | 3 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/pizza.cpp | 23 +- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 23 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 98 +++++- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 1 - LEGO1/lego/legoomni/src/actors/towtrack.cpp | 72 ++++- .../legoomni/src/build/helicopterstate.cpp | 3 - .../lego/legoomni/src/build/legocarbuild.cpp | 18 ++ .../legocarbuildpresenter.cpp} | 2 +- .../src/build/legovehiclebuildstate.cpp | 22 -- LEGO1/lego/legoomni/src/common/animstate.cpp | 46 --- .../src/common/legoanimationmanager.cpp | 45 ++- .../legoomni/src/common/legogamestate.cpp | 3 +- .../legoomni/src/common/legoobjectfactory.cpp | 29 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 2 +- .../src/gasstation/gasstationentity.cpp | 39 --- .../src/gasstation/gasstationstate.cpp | 37 --- .../src/hospital/ambulancemissionstate.cpp | 27 -- .../legoomni/src/hospital/hospitalentity.cpp | 39 --- .../legoomni/src/hospital/hospitalstate.cpp | 49 --- .../src/infocenter/infocenterentity.cpp | 60 ---- .../src/infocenter/infocenterstate.cpp | 133 -------- .../legoomni/src/infocenter/scorestate.cpp | 16 - .../legoomni/src/isle/beachhouseentity.cpp | 36 --- LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp | 9 - LEGO1/lego/legoomni/src/isle/radiostate.cpp | 103 ------ .../legoomni/src/paths/legopathstruct.cpp | 2 +- .../src/pizzeria/pizzamissionstate.cpp | 23 -- .../legoomni/src/pizzeria/pizzeriastate.cpp | 22 -- .../lego/legoomni/src/police/policeentity.cpp | 39 --- .../lego/legoomni/src/police/policestate.cpp | 70 ----- LEGO1/lego/legoomni/src/race/legorace.cpp | 30 ++ .../legoomni/src/race/racestandsentity.cpp | 36 --- LEGO1/lego/legoomni/src/race/racestate.cpp | 33 -- .../src/towtrack/towtrackmissionstate.cpp | 73 ----- LEGO1/lego/legoomni/src/worlds/act3.cpp | 1 + .../legoomni/src/worlds/elevatorbottom.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 36 ++- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 50 ++- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 135 +++++++- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 295 ++++++++++++++++- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 1 + LEGO1/lego/legoomni/src/worlds/police.cpp | 60 +++- .../legoomni/src/worlds/registrationbook.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/score.cpp | 14 +- 107 files changed, 2190 insertions(+), 2569 deletions(-) delete mode 100644 LEGO1/lego/legoomni/include/act1state.h delete mode 100644 LEGO1/lego/legoomni/include/act3state.h delete mode 100644 LEGO1/lego/legoomni/include/ambulancemissionstate.h delete mode 100644 LEGO1/lego/legoomni/include/animstate.h delete mode 100644 LEGO1/lego/legoomni/include/beachhouseentity.h create mode 100644 LEGO1/lego/legoomni/include/buildings.h delete mode 100644 LEGO1/lego/legoomni/include/carracestate.h delete mode 100644 LEGO1/lego/legoomni/include/gasstationentity.h delete mode 100644 LEGO1/lego/legoomni/include/gasstationstate.h delete mode 100644 LEGO1/lego/legoomni/include/helicopterstate.h delete mode 100644 LEGO1/lego/legoomni/include/hospitalentity.h delete mode 100644 LEGO1/lego/legoomni/include/hospitalstate.h delete mode 100644 LEGO1/lego/legoomni/include/infocenterentity.h delete mode 100644 LEGO1/lego/legoomni/include/infocenterstate.h delete mode 100644 LEGO1/lego/legoomni/include/jailentity.h delete mode 100644 LEGO1/lego/legoomni/include/jetskiracestate.h delete mode 100644 LEGO1/lego/legoomni/include/jukeboxstate.h delete mode 100644 LEGO1/lego/legoomni/include/legoact2state.h rename LEGO1/lego/legoomni/include/{legocarbuildanimpresenter.h => legocarbuildpresenter.h} (93%) delete mode 100644 LEGO1/lego/legoomni/include/legovehiclebuildstate.h delete mode 100644 LEGO1/lego/legoomni/include/pizzamissionstate.h delete mode 100644 LEGO1/lego/legoomni/include/pizzeriastate.h delete mode 100644 LEGO1/lego/legoomni/include/policeentity.h delete mode 100644 LEGO1/lego/legoomni/include/policestate.h delete mode 100644 LEGO1/lego/legoomni/include/racestandsentity.h delete mode 100644 LEGO1/lego/legoomni/include/racestate.h delete mode 100644 LEGO1/lego/legoomni/include/radiostate.h delete mode 100644 LEGO1/lego/legoomni/include/scorestate.h delete mode 100644 LEGO1/lego/legoomni/include/towtrackmissionstate.h delete mode 100644 LEGO1/lego/legoomni/src/act1/act1state.cpp delete mode 100644 LEGO1/lego/legoomni/src/act2/legoact2state.cpp delete mode 100644 LEGO1/lego/legoomni/src/act3/act3state.cpp rename LEGO1/lego/legoomni/src/{act3 => actors}/act3shark.cpp (100%) create mode 100644 LEGO1/lego/legoomni/src/actors/buildings.cpp delete mode 100644 LEGO1/lego/legoomni/src/build/helicopterstate.cpp rename LEGO1/lego/legoomni/src/{video/legocarbuildanimpresenter.cpp => build/legocarbuildpresenter.cpp} (94%) delete mode 100644 LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/common/animstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/scorestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/radiostate.cpp delete mode 100644 LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp delete mode 100644 LEGO1/lego/legoomni/src/police/policeentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/police/policestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/race/racestandsentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/race/racestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 00b4fdda..06c10670 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,14 +284,12 @@ target_link_libraries(omni PRIVATE dsound winmm Smacker::Smacker) add_library(lego1 SHARED LEGO1/define.cpp - LEGO1/lego/legoomni/src/act1/act1state.cpp - LEGO1/lego/legoomni/src/act2/legoact2state.cpp - LEGO1/lego/legoomni/src/act3/act3shark.cpp - LEGO1/lego/legoomni/src/act3/act3state.cpp LEGO1/lego/legoomni/src/actors/act2actor.cpp LEGO1/lego/legoomni/src/actors/act3actor.cpp + LEGO1/lego/legoomni/src/actors/act3shark.cpp LEGO1/lego/legoomni/src/actors/ambulance.cpp LEGO1/lego/legoomni/src/actors/bike.cpp + LEGO1/lego/legoomni/src/actors/buildings.cpp LEGO1/lego/legoomni/src/actors/bumpbouy.cpp LEGO1/lego/legoomni/src/actors/doors.cpp LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -315,11 +313,9 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp LEGO1/lego/legoomni/src/build/buildingentity.cpp - LEGO1/lego/legoomni/src/build/helicopterstate.cpp LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp LEGO1/lego/legoomni/src/build/legocarbuild.cpp - LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp - LEGO1/lego/legoomni/src/common/animstate.cpp + LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp LEGO1/lego/legoomni/src/common/legoactors.cpp LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -356,18 +352,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp LEGO1/lego/legoomni/src/entity/legoworld.cpp LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp - LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp - LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp - LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp - LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp - LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp - LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp - LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp - LEGO1/lego/legoomni/src/infocenter/scorestate.cpp LEGO1/lego/legoomni/src/input/legoinputmanager.cpp - LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp - LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp - LEGO1/lego/legoomni/src/isle/radiostate.cpp LEGO1/lego/legoomni/src/main/legomain.cpp LEGO1/lego/legoomni/src/main/scripts.cpp LEGO1/lego/legoomni/src/notify/legoeventnotificationparam.cpp @@ -378,22 +363,14 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp LEGO1/lego/legoomni/src/paths/legopathstruct.cpp - LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp - LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp - LEGO1/lego/legoomni/src/police/policeentity.cpp - LEGO1/lego/legoomni/src/police/policestate.cpp LEGO1/lego/legoomni/src/race/carrace.cpp LEGO1/lego/legoomni/src/race/jetskirace.cpp LEGO1/lego/legoomni/src/race/legorace.cpp LEGO1/lego/legoomni/src/race/legoraceactor.cpp LEGO1/lego/legoomni/src/race/legoracecar.cpp LEGO1/lego/legoomni/src/race/legoracemap.cpp - LEGO1/lego/legoomni/src/race/racestandsentity.cpp LEGO1/lego/legoomni/src/race/raceskel.cpp - LEGO1/lego/legoomni/src/race/racestate.cpp - LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp - LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h deleted file mode 100644 index 2d428e69..00000000 --- a/LEGO1/lego/legoomni/include/act1state.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef ACT1STATE_H -#define ACT1STATE_H - -#include "legostate.h" - -class LegoNamedTexture; - -// VTABLE: LEGO1 0x100d7028 -// SIZE 0x26c -class Act1State : public LegoState { -public: - enum ElevatorFloor { - c_floor1 = 1, - c_floor2, - c_floor3 - }; - - enum { - e_unk953 = 953, - e_unk954 = 954, - e_unk955 = 955, - }; - - // SIZE 0x4c - class NamedPlane { - public: - // FUNCTION: LEGO1 0x10033800 - NamedPlane() {} - - inline void SetName(const char* p_name) { m_name = p_name; } - inline const MxString* GetName() const { return &m_name; } - - // FUNCTION: LEGO1 0x100344d0 - MxResult Serialize(LegoFile* p_file) - { - if (p_file->IsWriteMode()) { - p_file->WriteString(m_name); - p_file->WriteVector3(m_point1); - p_file->WriteVector3(m_point2); - p_file->WriteVector3(m_point3); - } - else if (p_file->IsReadMode()) { - p_file->ReadString(m_name); - p_file->ReadVector3(m_point1); - p_file->ReadVector3(m_point2); - p_file->ReadVector3(m_point3); - } - - return SUCCESS; - } - - private: - MxString m_name; // 0x00 - Mx3DPointFloat m_point1; // 0x10 - Mx3DPointFloat m_point2; // 0x24 - Mx3DPointFloat m_point3; // 0x38 - }; - - Act1State(); - - // FUNCTION: LEGO1 0x100338a0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0154 - return "Act1State"; - } - - // FUNCTION: LEGO1 0x100338b0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - void FUN_10034660(); - void FUN_100346a0(); - void FUN_10034b60(); - void FUN_10034d00(); - - // TODO: Most likely getters/setters are not used according to BETA. - - inline MxU32 GetUnknown18() { return m_unk0x018; } - inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } - inline MxU8 GetUnknown21() { return m_unk0x021; } - - inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } - inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } - inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } - - // SYNTHETIC: LEGO1 0x10033960 - // Act1State::`scalar deleting destructor' - - MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 - MxS16 m_unk0x00c; // 0x00c - undefined2 m_unk0x00e; // 0x00e - undefined2 m_unk0x010; // 0x010 - undefined m_unk0x012; // 0x012 - MxS32 m_unk0x014; // 0x014 - MxU32 m_unk0x018; // 0x018 - MxS16 m_elevFloor; // 0x01c - MxBool m_unk0x01e; // 0x01e - MxBool m_unk0x01f; // 0x01f - MxBool m_planeActive; // 0x020 - undefined m_unk0x021; // 0x021 - MxBool m_unk0x022; // 0x022 - undefined m_unk0x023; // 0x023 - NamedPlane m_unk0x024; // 0x024 - NamedPlane m_unk0x070; // 0x070 - NamedPlane m_unk0x0bc; // 0x0bc - NamedPlane m_unk0x108; // 0x108 - LegoNamedTexture* m_unk0x154; // 0x154 - LegoNamedTexture* m_unk0x158; // 0x158 - LegoNamedTexture* m_unk0x15c; // 0x15c - MxCore* m_unk0x160; // 0x160 - NamedPlane m_unk0x164; // 0x164 - LegoNamedTexture* m_unk0x1b0; // 0x1b0 - LegoNamedTexture* m_unk0x1b4; // 0x1b4 - MxCore* m_unk0x1b8; // 0x1b8 - NamedPlane m_unk0x1bc; // 0x1bc - LegoNamedTexture* m_unk0x208; // 0x208 - MxCore* m_unk0x20c; // 0x20c - NamedPlane m_unk0x210; // 0x210 - LegoNamedTexture* m_unk0x25c; // 0x25c - LegoNamedTexture* m_unk0x260; // 0x260 - LegoNamedTexture* m_unk0x264; // 0x264 - MxCore* m_unk0x268; // 0x268 -}; - -// FUNCTION: LEGO1 0x10033a70 -// Act1State::NamedPlane::~NamedPlane - -#endif // ACT1STATE_H diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index b476dcc0..ddaccb13 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -1,8 +1,41 @@ #ifndef ACT3_H #define ACT3_H +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d4fc8 +// SIZE 0x0c +class Act3State : public LegoState { +public: + inline Act3State() { m_unk0x08 = 0; } + + // FUNCTION: LEGO1 0x1000e300 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f03f0 + return "Act3State"; + } + + // FUNCTION: LEGO1 0x1000e310 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000e2f0 + MxBool IsSerializable() override { return FALSE; } + + // SYNTHETIC: LEGO1 0x1000e3c0 + // Act3State::`scalar deleting destructor' + + inline undefined4 GetUnknown0x08() { return m_unk0x08; } + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08; // 0x08 +}; + // VTABLE: LEGO1 0x100d9628 // SIZE 0x4274 class Act3 : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/act3state.h b/LEGO1/lego/legoomni/include/act3state.h deleted file mode 100644 index 3df4e4f3..00000000 --- a/LEGO1/lego/legoomni/include/act3state.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef ACT3STATE_H -#define ACT3STATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4fc8 -// SIZE 0x0c -class Act3State : public LegoState { -public: - inline Act3State() { m_unk0x08 = 0; } - - // FUNCTION: LEGO1 0x1000e300 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f03f0 - return "Act3State"; - } - - // FUNCTION: LEGO1 0x1000e310 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; - - // SYNTHETIC: LEGO1 0x1000e3c0 - // Act3State::`scalar deleting destructor' - - inline undefined4 GetUnknown0x08() { return m_unk0x08; } - -private: - undefined4 m_unk0x08; // 0x08 -}; - -#endif // ACT3STATE_H diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 0edd9cae..1a92eb78 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -2,8 +2,63 @@ #define AMBULANCE_H #include "islepathactor.h" +#include "legostate.h" -class AmbulanceMissionState; +// VTABLE: LEGO1 0x100d72a0 +// SIZE 0x24 +class AmbulanceMissionState : public LegoState { +public: + AmbulanceMissionState(); + + // FUNCTION: LEGO1 0x10037600 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00e8 + return "AmbulanceMissionState"; + } + + // FUNCTION: LEGO1 0x10037610 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) + { + switch (p_id) { + case 1: + return m_score1; + case 2: + return m_score2; + case 3: + return m_score3; + case 4: + return m_score4; + case 5: + return m_score5; + default: + return 0; + } + } + + // SYNTHETIC: LEGO1 0x100376c0 + // AmbulanceMissionState::`scalar deleting destructor' + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxU16 m_unk0x10; // 0x10 + MxU16 m_unk0x12; // 0x12 + MxU16 m_unk0x14; // 0x14 + MxU16 m_unk0x16; // 0x16 + MxU16 m_unk0x18; // 0x18 + MxU16 m_score1; // 0x1a + MxU16 m_score2; // 0x1c + MxU16 m_score3; // 0x1e + MxU16 m_score4; // 0x20 + MxU16 m_score5; // 0x22 +}; // VTABLE: LEGO1 0x100d71a8 // SIZE 0x184 diff --git a/LEGO1/lego/legoomni/include/ambulancemissionstate.h b/LEGO1/lego/legoomni/include/ambulancemissionstate.h deleted file mode 100644 index 002d2803..00000000 --- a/LEGO1/lego/legoomni/include/ambulancemissionstate.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef AMBULANCEMISSIONSTATE_H -#define AMBULANCEMISSIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d72a0 -// SIZE 0x24 -class AmbulanceMissionState : public LegoState { -public: - AmbulanceMissionState(); - - // FUNCTION: LEGO1 0x10037600 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00e8 - return "AmbulanceMissionState"; - } - - // FUNCTION: LEGO1 0x10037610 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) - { - switch (p_id) { - case 1: - return m_score1; - case 2: - return m_score2; - case 3: - return m_score3; - case 4: - return m_score4; - case 5: - return m_score5; - default: - return 0; - } - } - - // SYNTHETIC: LEGO1 0x100376c0 - // AmbulanceMissionState::`scalar deleting destructor' - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - MxU16 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_score1; // 0x1a - MxU16 m_score2; // 0x1c - MxU16 m_score3; // 0x1e - MxU16 m_score4; // 0x20 - MxU16 m_score5; // 0x22 -}; - -#endif // AMBULANCEMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h deleted file mode 100644 index 8f3eda25..00000000 --- a/LEGO1/lego/legoomni/include/animstate.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef ANIMSTATE_H -#define ANIMSTATE_H - -#include "legostate.h" - -// SIZE 0x30 -struct ModelInfo { - char* m_name; // 0x00 - MxU8 m_unk0x04; // 0x04 - float m_location[3]; // 0x08 - float m_direction[3]; // 0x14 - float m_up[3]; // 0x20 - MxU8 m_unk0x2c; // 0x2c -}; - -// SIZE 0x30 -struct AnimInfo { - char* m_name; // 0x00 - MxU32 m_objectId; // 0x04 - MxS16 m_location; // 0x08 - MxBool m_unk0x0a; // 0x0a - MxU8 m_unk0x0b; // 0x0b - MxU8 m_unk0x0c; // 0x0c - MxU8 m_unk0x0d; // 0x0d - float m_unk0x10[4]; // 0x10 - MxU8 m_modelCount; // 0x20 - MxU16 m_unk0x22; // 0x22 - ModelInfo* m_models; // 0x24 - MxS8 m_unk0x28; // 0x28 - MxBool m_unk0x29; // 0x29 - MxS8 m_unk0x2a[3]; // 0x2a -}; - -// VTABLE: LEGO1 0x100d8d80 -// SIZE 0x1c -class AnimState : public LegoState { -public: - AnimState(); - ~AnimState() override; // vtable+0x00 - - // FUNCTION: LEGO1 0x10065070 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0460 - return "AnimState"; - } - - // FUNCTION: LEGO1 0x10065080 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - void FUN_100651d0(MxU32, AnimInfo*, MxU32&); - void FUN_10065240(MxU32, AnimInfo*, MxU32); - - // SYNTHETIC: LEGO1 0x10065130 - // AnimState::`scalar deleting destructor' - -private: - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - void* m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - void* m_unk0x18; // 0x18 -}; - -#endif // ANIMSTATE_H diff --git a/LEGO1/lego/legoomni/include/beachhouseentity.h b/LEGO1/lego/legoomni/include/beachhouseentity.h deleted file mode 100644 index 34e9db47..00000000 --- a/LEGO1/lego/legoomni/include/beachhouseentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef BEACHHOUSEENTITY_H -#define BEACHHOUSEENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4a18 -// SIZE 0x68 -class BeachHouseEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ee80 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0314 - return "BeachHouseEntity"; - } - - // FUNCTION: LEGO1 0x1000ee90 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f970 - // BeachHouseEntity::`scalar deleting destructor' -}; - -#endif // BEACHHOUSEENTITY_H diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h new file mode 100644 index 00000000..39394628 --- /dev/null +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -0,0 +1,166 @@ +#ifndef BUILDINGS_H +#define BUILDINGS_H + +#include "buildingentity.h" + +// VTABLE: LEGO1 0x100d48a8 +// SIZE 0x68 +class RaceStandsEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000efa0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000efb0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f9e0 + // RaceStandsEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4a18 +// SIZE 0x68 +class BeachHouseEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ee80 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0314 + return "BeachHouseEntity"; + } + + // FUNCTION: LEGO1 0x1000ee90 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f970 + // BeachHouseEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4ab0 +// SIZE 0x68 +class PoliceEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ed60 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0328 + return "PoliceEntity"; + } + + // FUNCTION: LEGO1 0x1000ed70 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f900 + // PoliceEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4b90 +// SIZE 0x68 +class InfoCenterEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ea00 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f035c + return "InfoCenterEntity"; + } + + // FUNCTION: LEGO1 0x1000ea10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f7b0 + // InfoCenterEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5068 +// SIZE 0x68 +class HospitalEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ec40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0338 + return "HospitalEntity"; + } + + // FUNCTION: LEGO1 0x1000ec50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f820 + // HospitalEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5200 +// SIZE 0x68 +class JailEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000f0c0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000f0d0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + // STUB: LEGO1 0x100154f0 + MxLong VTable0x50(MxParam& p_param) override { return 0; } + + // SYNTHETIC: LEGO1 0x1000fac0 + // JailEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5258 +// SIZE 0x68 +class GasStationEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000eb20 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0348 + return "GasStationEntity"; + } + + // FUNCTION: LEGO1 0x1000eb30 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f890 + // GasStationEntity::`scalar deleting destructor' +}; + +#endif // BUILDINGS_H diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index bb9d6324..67332197 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -4,6 +4,27 @@ #include "decomp.h" #include "legorace.h" +// VTABLE: LEGO1 0x100d4b70 +// SIZE 0x2c +class CarRaceState : public RaceState { +public: + // FUNCTION: LEGO1 0x1000dd30 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f009c + return "CarRaceState"; + } + + // FUNCTION: LEGO1 0x1000dd40 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, CarRaceState::ClassName()) || RaceState::IsA(p_name); + } + + // SYNTHETIC: LEGO1 0x1000f740 + // CarRaceState::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d5e50 // SIZE 0x154 class CarRace : public LegoRace { diff --git a/LEGO1/lego/legoomni/include/carracestate.h b/LEGO1/lego/legoomni/include/carracestate.h deleted file mode 100644 index c7a1e376..00000000 --- a/LEGO1/lego/legoomni/include/carracestate.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CARRACESTATE_H -#define CARRACESTATE_H - -#include "racestate.h" - -// VTABLE: LEGO1 0x100d4b70 -// SIZE 0x2c -class CarRaceState : public RaceState { -public: - // FUNCTION: LEGO1 0x1000dd30 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f009c - return "CarRaceState"; - } - - // FUNCTION: LEGO1 0x1000dd40 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, CarRaceState::ClassName()) || RaceState::IsA(p_name); - } - - // SYNTHETIC: LEGO1 0x1000f740 - // CarRaceState::`scalar deleting destructor' -}; - -#endif // CARRACESTATE_H diff --git a/LEGO1/lego/legoomni/include/caveentity.h b/LEGO1/lego/legoomni/include/caveentity.h index 24b9759f..308f35bc 100644 --- a/LEGO1/lego/legoomni/include/caveentity.h +++ b/LEGO1/lego/legoomni/include/caveentity.h @@ -1,7 +1,7 @@ #ifndef CAVEENTITY_H #define CAVEENTITY_H -#include "racestandsentity.h" +#include "buildings.h" // No overrides, uses vtable from RaceStandsEntity // SIZE 0x68 diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 0709f0ad..6a37db84 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -3,12 +3,55 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" -class GasStationState; class MxStillPresenter; +// VTABLE: LEGO1 0x100d46e0 +// SIZE 0x24 +class GasStationState : public LegoState { +public: + // SIZE 0x04 + struct Unknown0x14 { + undefined4 m_unk0x00; // 0x00 + }; + + GasStationState(); + + // FUNCTION: LEGO1 0x100061d0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0174 + return "GasStationState"; + } + + // FUNCTION: LEGO1 0x100061e0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x10006290 + // GasStationState::`scalar deleting destructor' + + void FUN_10006430(undefined4); + void FUN_10006490(); + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08[3]; // 0x08 + Unknown0x14 m_unk0x14; // 0x14 + MxS16 m_unk0x18; // 0x18 + MxS16 m_unk0x1a; // 0x1a + MxS16 m_unk0x1c; // 0x1c + MxS16 m_unk0x1e; // 0x1e + MxS16 m_unk0x20; // 0x20 +}; + // VTABLE: LEGO1 0x100d4650 // SIZE 0x128 class GasStation : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/gasstationentity.h b/LEGO1/lego/legoomni/include/gasstationentity.h deleted file mode 100644 index 1b25cfd2..00000000 --- a/LEGO1/lego/legoomni/include/gasstationentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GASSTATIONENTITY_H -#define GASSTATIONENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5258 -// SIZE 0x68 -class GasStationEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000eb20 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0348 - return "GasStationEntity"; - } - - // FUNCTION: LEGO1 0x1000eb30 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f890 - // GasStationEntity::`scalar deleting destructor' -}; - -#endif // GASSTATIONENTITY_H diff --git a/LEGO1/lego/legoomni/include/gasstationstate.h b/LEGO1/lego/legoomni/include/gasstationstate.h deleted file mode 100644 index bf0327da..00000000 --- a/LEGO1/lego/legoomni/include/gasstationstate.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef GASSTATIONSTATE_H -#define GASSTATIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d46e0 -// SIZE 0x24 -class GasStationState : public LegoState { -public: - // SIZE 0x04 - struct Unknown0x14 { - undefined4 m_unk0x00; // 0x00 - }; - - GasStationState(); - - // FUNCTION: LEGO1 0x100061d0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0174 - return "GasStationState"; - } - - // FUNCTION: LEGO1 0x100061e0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x10006290 - // GasStationState::`scalar deleting destructor' - - void FUN_10006430(undefined4); - void FUN_10006490(); - - friend class GasStation; - -private: - undefined4 m_unk0x08[3]; // 0x08 - Unknown0x14 m_unk0x14; // 0x14 - MxS16 m_unk0x18; // 0x18 - MxS16 m_unk0x1a; // 0x1a - MxS16 m_unk0x1c; // 0x1c - MxS16 m_unk0x1e; // 0x1e - MxS16 m_unk0x20; // 0x20 -}; - -#endif // GASSTATIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 638f9287..dd9451c0 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -2,9 +2,46 @@ #define HELICOPTER_H #include "islepathactor.h" +#include "legostate.h" #include "realtime/matrix.h" -class HelicopterState; +// VTABLE: LEGO1 0x100d5418 +// SIZE 0x0c +class HelicopterState : public LegoState { +public: + // FUNCTION: LEGO1 0x1000e0d0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0144 + return "HelicopterState"; + } + + // FUNCTION: LEGO1 0x1000e0e0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000e0b0 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000e0c0 + MxBool SetFlag() override + { + m_unk0x08 = 0; + return TRUE; + } // vtable+0x18 + + inline void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } + inline MxU32 GetUnkown8() { return m_unk0x08; } + + // SYNTHETIC: LEGO1 0x1000e190 + // HelicopterState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxU32 m_unk0x08; // 0x08 +}; // VTABLE: LEGO1 0x100d40f8 // SIZE 0x230 diff --git a/LEGO1/lego/legoomni/include/helicopterstate.h b/LEGO1/lego/legoomni/include/helicopterstate.h deleted file mode 100644 index 7bda248f..00000000 --- a/LEGO1/lego/legoomni/include/helicopterstate.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef HELICOPTERSTATE_H -#define HELICOPTERSTATE_H - -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d5418 -// SIZE 0x0c -class HelicopterState : public LegoState { -public: - // FUNCTION: LEGO1 0x1000e0d0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0144 - return "HelicopterState"; - } - - // FUNCTION: LEGO1 0x1000e0e0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); - } - - // FUNCTION: LEGO1 0x1000e0b0 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - // FUNCTION: LEGO1 0x1000e0c0 - MxBool SetFlag() override - { - m_unk0x08 = 0; - return TRUE; - } // vtable+0x18 - - inline void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } - inline MxU32 GetUnkown8() { return m_unk0x08; } - - // SYNTHETIC: LEGO1 0x1000e190 - // HelicopterState::`scalar deleting destructor' - -protected: - MxU32 m_unk0x08; // 0x08 -}; - -#endif // HELICOPTERSTATE_H diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 014e872d..32377fe3 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -4,13 +4,54 @@ #include "actionsfwd.h" #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" -class HospitalState; class LegoControlManagerEvent; class MxEndActionNotificationParam; class MxStillPresenter; +// VTABLE: LEGO1 0x100d97a0 +// SIZE 0x18 +class HospitalState : public LegoState { +public: + // SIZE 0x04 + struct Unknown0x08 { + undefined4 m_unk0x00; // 0x00 + }; + + HospitalState(); + ~HospitalState() override {} + + // FUNCTION: LEGO1 0x10076400 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0480 + return "HospitalState"; + } + + // FUNCTION: LEGO1 0x10076410 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x100764c0 + // HospitalState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Unknown0x08 m_unk0x08; // 0x08 + MxS16 m_unk0x0c; // 0x0c + MxS16 m_unk0x0e; // 0x0e + MxS16 m_unk0x10; // 0x10 + MxS16 m_unk0x12; // 0x12 + MxS16 m_unk0x14; // 0x14 + MxS16 m_unk0x16; // 0x16 +}; + // VTABLE: LEGO1 0x100d9730 // SIZE 0x12c class Hospital : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/hospitalentity.h b/LEGO1/lego/legoomni/include/hospitalentity.h deleted file mode 100644 index 3dbe7d54..00000000 --- a/LEGO1/lego/legoomni/include/hospitalentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef HOSPITALENTITY_H -#define HOSPITALENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5068 -// SIZE 0x68 -class HospitalEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ec40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0338 - return "HospitalEntity"; - } - - // FUNCTION: LEGO1 0x1000ec50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f820 - // HospitalEntity::`scalar deleting destructor' -}; - -#endif // HOSPITALENTITY_H diff --git a/LEGO1/lego/legoomni/include/hospitalstate.h b/LEGO1/lego/legoomni/include/hospitalstate.h deleted file mode 100644 index 16d80cb6..00000000 --- a/LEGO1/lego/legoomni/include/hospitalstate.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef HOSPITALSTATE_H -#define HOSPITALSTATE_H - -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d97a0 -// SIZE 0x18 -class HospitalState : public LegoState { -public: - // SIZE 0x04 - struct Unknown0x08 { - undefined4 m_unk0x00; // 0x00 - }; - - HospitalState(); - ~HospitalState() override {} - - // FUNCTION: LEGO1 0x10076400 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0480 - return "HospitalState"; - } - - // FUNCTION: LEGO1 0x10076410 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x100764c0 - // HospitalState::`scalar deleting destructor' - - friend class Hospital; - -private: - Unknown0x08 m_unk0x08; // 0x08 - MxS16 m_unk0x0c; // 0x0c - MxS16 m_unk0x0e; // 0x0e - MxS16 m_unk0x10; // 0x10 - MxS16 m_unk0x12; // 0x12 - MxS16 m_unk0x14; // 0x14 - MxS16 m_unk0x16; // 0x16 -}; - -#endif // HOSPITALSTATE_H diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 08bb9a2c..7d805246 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -3,15 +3,65 @@ #include "actionsfwd.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "mxrect32.h" #include "radio.h" -class InfocenterState; class MxNotificationParam; class MxStillPresenter; class LegoControlManagerEvent; +// VTABLE: LEGO1 0x100d93a8 +// SIZE 0x94 +class InfocenterState : public LegoState { +public: + InfocenterState(); + ~InfocenterState() override; + + // FUNCTION: LEGO1 0x10071840 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f04dc + return "InfocenterState"; + } + + // FUNCTION: LEGO1 0x10071850 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, InfocenterState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x10071830 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + inline MxS16 GetMaxNameLength() { return sizeOfArray(m_letters); } + inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; } + inline void SetNameLetter(MxS32 p_index, MxStillPresenter* p_letter) { m_letters[p_index] = p_letter; } + inline MxBool HasRegistered() { return m_letters[0] != NULL; } + inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; } + inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; } + inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; } + inline Playlist& GetLeaveDialogue(LegoGameState::Act p_act) { return m_leaveDialogue[p_act]; } + inline Playlist& GetBricksterDialogue() { return m_bricksterDialogue; } + inline MxU32 GetUnknown0x74() { return m_unk0x74; } + + inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } + + // SYNTHETIC: LEGO1 0x10071900 + // InfocenterState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_exitDialogueAct1; // 0x08 + Playlist m_exitDialogueAct23; // 0x14 + Playlist m_returnDialogue[3]; // 0x20 + Playlist m_leaveDialogue[3]; // 0x44 + Playlist m_bricksterDialogue; // 0x68 + MxU32 m_unk0x74; // 0x74 + MxStillPresenter* m_letters[7]; // 0x78 +}; + // SIZE 0x18 struct InfocenterMapEntry { // FUNCTION: LEGO1 0x1006ec80 diff --git a/LEGO1/lego/legoomni/include/infocenterentity.h b/LEGO1/lego/legoomni/include/infocenterentity.h deleted file mode 100644 index 82fa3d30..00000000 --- a/LEGO1/lego/legoomni/include/infocenterentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INFOCENTERENTITY_H -#define INFOCENTERENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4b90 -// SIZE 0x68 -class InfoCenterEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ea00 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f035c - return "InfoCenterEntity"; - } - - // FUNCTION: LEGO1 0x1000ea10 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f7b0 - // InfoCenterEntity::`scalar deleting destructor' -}; - -#endif // INFOCENTERENTITY_H diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h deleted file mode 100644 index b1c418f1..00000000 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef INFOCENTERSTATE_H -#define INFOCENTERSTATE_H - -#include "decomp.h" -#include "legogamestate.h" -#include "legostate.h" - -class MxStillPresenter; - -// VTABLE: LEGO1 0x100d93a8 -// SIZE 0x94 -class InfocenterState : public LegoState { -public: - InfocenterState(); - ~InfocenterState() override; - - // FUNCTION: LEGO1 0x10071840 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f04dc - return "InfocenterState"; - } - - // FUNCTION: LEGO1 0x10071850 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, InfocenterState::ClassName()) || LegoState::IsA(p_name); - } - - // FUNCTION: LEGO1 0x10071830 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - inline MxS16 GetMaxNameLength() { return sizeOfArray(m_letters); } - inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; } - inline void SetNameLetter(MxS32 p_index, MxStillPresenter* p_letter) { m_letters[p_index] = p_letter; } - inline MxBool HasRegistered() { return m_letters[0] != NULL; } - inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; } - inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; } - inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; } - inline Playlist& GetLeaveDialogue(LegoGameState::Act p_act) { return m_leaveDialogue[p_act]; } - inline Playlist& GetBricksterDialogue() { return m_bricksterDialogue; } - inline MxU32 GetUnknown0x74() { return m_unk0x74; } - - inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } - - // SYNTHETIC: LEGO1 0x10071900 - // InfocenterState::`scalar deleting destructor' - -private: - Playlist m_exitDialogueAct1; // 0x08 - Playlist m_exitDialogueAct23; // 0x14 - Playlist m_returnDialogue[3]; // 0x20 - Playlist m_leaveDialogue[3]; // 0x44 - Playlist m_bricksterDialogue; // 0x68 - MxU32 m_unk0x74; // 0x74 - MxStillPresenter* m_letters[7]; // 0x78 -}; - -#endif // INFOCENTERSTATE_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index e9d4da42..8af16007 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -3,16 +3,17 @@ #include "actionsfwd.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" -class Act1State; class Ambulance; class Bike; class DuneBuggy; class Helicopter; class Jetski; class JukeBoxEntity; +class LegoNamedTexture; class Motocycle; class MxType19NotificationParam; class Pizza; @@ -21,6 +22,132 @@ class RaceCar; class SkateBoard; class TowTrack; +// VTABLE: LEGO1 0x100d7028 +// SIZE 0x26c +class Act1State : public LegoState { +public: + enum ElevatorFloor { + c_floor1 = 1, + c_floor2, + c_floor3 + }; + + enum { + e_unk953 = 953, + e_unk954 = 954, + e_unk955 = 955, + }; + + // SIZE 0x4c + class NamedPlane { + public: + // FUNCTION: LEGO1 0x10033800 + NamedPlane() {} + + inline void SetName(const char* p_name) { m_name = p_name; } + inline const MxString* GetName() const { return &m_name; } + + // FUNCTION: LEGO1 0x100344d0 + MxResult Serialize(LegoFile* p_file) + { + if (p_file->IsWriteMode()) { + p_file->WriteString(m_name); + p_file->WriteVector3(m_point1); + p_file->WriteVector3(m_point2); + p_file->WriteVector3(m_point3); + } + else if (p_file->IsReadMode()) { + p_file->ReadString(m_name); + p_file->ReadVector3(m_point1); + p_file->ReadVector3(m_point2); + p_file->ReadVector3(m_point3); + } + + return SUCCESS; + } + + private: + MxString m_name; // 0x00 + Mx3DPointFloat m_point1; // 0x10 + Mx3DPointFloat m_point2; // 0x24 + Mx3DPointFloat m_point3; // 0x38 + }; + + Act1State(); + + // FUNCTION: LEGO1 0x100338a0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0154 + return "Act1State"; + } + + // FUNCTION: LEGO1 0x100338b0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); + } + + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + void FUN_10034660(); + void FUN_100346a0(); + void FUN_10034b60(); + void FUN_10034d00(); + + inline MxU32 GetUnknown18() { return m_unk0x018; } + inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } + inline MxU8 GetUnknown21() { return m_unk0x021; } + + inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } + inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } + inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } + + // SYNTHETIC: LEGO1 0x10033960 + // Act1State::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 + MxS16 m_unk0x00c; // 0x00c + undefined2 m_unk0x00e; // 0x00e + undefined2 m_unk0x010; // 0x010 + undefined m_unk0x012; // 0x012 + MxS32 m_unk0x014; // 0x014 + MxU32 m_unk0x018; // 0x018 + MxS16 m_elevFloor; // 0x01c + MxBool m_unk0x01e; // 0x01e + MxBool m_unk0x01f; // 0x01f + MxBool m_planeActive; // 0x020 + undefined m_unk0x021; // 0x021 + MxBool m_unk0x022; // 0x022 + undefined m_unk0x023; // 0x023 + NamedPlane m_unk0x024; // 0x024 + NamedPlane m_unk0x070; // 0x070 + NamedPlane m_unk0x0bc; // 0x0bc + NamedPlane m_unk0x108; // 0x108 + LegoNamedTexture* m_unk0x154; // 0x154 + LegoNamedTexture* m_unk0x158; // 0x158 + LegoNamedTexture* m_unk0x15c; // 0x15c + MxCore* m_unk0x160; // 0x160 + NamedPlane m_unk0x164; // 0x164 + LegoNamedTexture* m_unk0x1b0; // 0x1b0 + LegoNamedTexture* m_unk0x1b4; // 0x1b4 + MxCore* m_unk0x1b8; // 0x1b8 + NamedPlane m_unk0x1bc; // 0x1bc + LegoNamedTexture* m_unk0x208; // 0x208 + MxCore* m_unk0x20c; // 0x20c + NamedPlane m_unk0x210; // 0x210 + LegoNamedTexture* m_unk0x25c; // 0x25c + LegoNamedTexture* m_unk0x260; // 0x260 + LegoNamedTexture* m_unk0x264; // 0x264 + MxCore* m_unk0x268; // 0x268 +}; + +// FUNCTION: LEGO1 0x10033a70 +// Act1State::NamedPlane::~NamedPlane + // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 class Isle : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/jailentity.h b/LEGO1/lego/legoomni/include/jailentity.h deleted file mode 100644 index adf7089a..00000000 --- a/LEGO1/lego/legoomni/include/jailentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef JAILENTITY_H -#define JAILENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5200 -// SIZE 0x68 -class JailEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000f0c0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0300 - return "RaceStandsEntity"; - } - - // FUNCTION: LEGO1 0x1000f0d0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - // STUB: LEGO1 0x100154f0 - MxLong VTable0x50(MxParam& p_param) override { return 0; } - - // SYNTHETIC: LEGO1 0x1000fac0 - // JailEntity::`scalar deleting destructor' -}; - -#endif // JAILENTITY_H diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 7f17a1fc..b51496c4 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -3,6 +3,27 @@ #include "legorace.h" +// VTABLE: LEGO1 0x100d4fa8 +// SIZE 0x2c +class JetskiRaceState : public RaceState { +public: + // FUNCTION: LEGO1 0x1000dc40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00ac + return "JetskiRaceState"; + } + + // FUNCTION: LEGO1 0x1000dc50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); + } + + // SYNTHETIC: LEGO1 0x1000f680 + // JetskiRaceState::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d4fe8 // SIZE 0x144 class JetskiRace : public LegoRace { diff --git a/LEGO1/lego/legoomni/include/jetskiracestate.h b/LEGO1/lego/legoomni/include/jetskiracestate.h deleted file mode 100644 index 812a0a0f..00000000 --- a/LEGO1/lego/legoomni/include/jetskiracestate.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef JETSKIRACESTATE_H -#define JETSKIRACESTATE_H - -#include "racestate.h" - -// VTABLE: LEGO1 0x100d4fa8 -// SIZE 0x2c -class JetskiRaceState : public RaceState { -public: - // FUNCTION: LEGO1 0x1000dc40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00ac - return "JetskiRaceState"; - } - - // FUNCTION: LEGO1 0x1000dc50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); - } - - // SYNTHETIC: LEGO1 0x1000f680 - // JetskiRaceState::`scalar deleting destructor' -}; - -#endif // JETSKIRACESTATE_H diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 2ee17f37..8b624191 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -3,10 +3,46 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" class LegoControlManagerEvent; -class JukeBoxState; + +// VTABLE: LEGO1 0x100d4a90 +// SIZE 0x10 +class JukeBoxState : public LegoState { +public: + enum Music { + e_pasquell = 0, + e_right, + e_decal, + e_wallis, + e_nelson, + e_torpedos + }; + + // FUNCTION: LEGO1 0x1000f310 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f02bc + return "JukeBoxState"; + } + + // FUNCTION: LEGO1 0x1000f320 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000f300 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1000f3d0 + // JukeBoxState::`scalar deleting destructor' + + Music m_music; // 0x08 + MxU32 m_active; // 0x0c +}; // VTABLE: LEGO1 0x100d8958 // SIZE 0x104 diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h deleted file mode 100644 index d9da3b84..00000000 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef JUKEBOXSTATE_H -#define JUKEBOXSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4a90 -// SIZE 0x10 -class JukeBoxState : public LegoState { -public: - enum Music { - e_pasquell = 0, - e_right, - e_decal, - e_wallis, - e_nelson, - e_torpedos - }; - - // FUNCTION: LEGO1 0x1000f310 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f02bc - return "JukeBoxState"; - } - - // FUNCTION: LEGO1 0x1000f320 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1000f3d0 - // JukeBoxState::`scalar deleting destructor' - - Music m_music; // 0x08 - MxU32 m_active; // 0x0c -}; - -#endif // JUKEBOXSTATE_H diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index b84fada3..735e31c2 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -2,8 +2,43 @@ #define LEGOACT2_H #include "act2brick.h" +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d4a70 +// SIZE 0x10 +class LegoAct2State : public LegoState { +public: + ~LegoAct2State() override {} + + // FUNCTION: LEGO1 0x1000df80 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0428 + return "LegoAct2State"; + } + + // FUNCTION: LEGO1 0x1000df90 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000df70 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1000e040 + // LegoAct2State::`scalar deleting destructor' + + inline undefined4 GetUnknown0x08() { return m_unk0x08; } + inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c +}; + // VTABLE: LEGO1 0x100d82e0 // SIZE 0x1154 class LegoAct2 : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legoact2state.h b/LEGO1/lego/legoomni/include/legoact2state.h deleted file mode 100644 index 5f046e74..00000000 --- a/LEGO1/lego/legoomni/include/legoact2state.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef LEGOACT2STATE_H -#define LEGOACT2STATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4a70 -// SIZE 0x10 -class LegoAct2State : public LegoState { -public: - ~LegoAct2State() override {} - - // FUNCTION: LEGO1 0x1000df80 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0428 - return "LegoAct2State"; - } - - // FUNCTION: LEGO1 0x1000df90 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1000e040 - // LegoAct2State::`scalar deleting destructor' - - inline undefined4 GetUnknown0x08() { return m_unk0x08; } - inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } - -private: - undefined4 m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c -}; - -#endif // LEGOACT2STATE_H diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index e118cbf5..8e473077 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -4,11 +4,11 @@ #include "actionsfwd.h" #include "decomp.h" #include "legolocations.h" +#include "legostate.h" #include "legotraninfolist.h" #include "mxcore.h" #include "mxgeometry/mxgeometry3d.h" -class AnimState; class LegoAnimPresenter; class LegoEntity; class LegoExtraActor; @@ -18,9 +18,73 @@ class LegoPathBoundary; class LegoROIList; struct LegoUnknown100db7f4; class LegoWorld; -struct ModelInfo; class MxDSAction; +// SIZE 0x30 +struct ModelInfo { + char* m_name; // 0x00 + MxU8 m_unk0x04; // 0x04 + float m_location[3]; // 0x08 + float m_direction[3]; // 0x14 + float m_up[3]; // 0x20 + MxU8 m_unk0x2c; // 0x2c +}; + +// SIZE 0x30 +struct AnimInfo { + char* m_name; // 0x00 + MxU32 m_objectId; // 0x04 + MxS16 m_location; // 0x08 + MxBool m_unk0x0a; // 0x0a + MxU8 m_unk0x0b; // 0x0b + MxU8 m_unk0x0c; // 0x0c + MxU8 m_unk0x0d; // 0x0d + float m_unk0x10[4]; // 0x10 + MxU8 m_modelCount; // 0x20 + MxU16 m_unk0x22; // 0x22 + ModelInfo* m_models; // 0x24 + MxS8 m_unk0x28; // 0x28 + MxBool m_unk0x29; // 0x29 + MxS8 m_unk0x2a[3]; // 0x2a +}; + +// VTABLE: LEGO1 0x100d8d80 +// SIZE 0x1c +class AnimState : public LegoState { +public: + AnimState(); + ~AnimState() override; // vtable+0x00 + + // FUNCTION: LEGO1 0x10065070 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0460 + return "AnimState"; + } + + // FUNCTION: LEGO1 0x10065080 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); + } + + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + void FUN_100651d0(MxU32, AnimInfo*, MxU32&); + void FUN_10065240(MxU32, AnimInfo*, MxU32); + + // SYNTHETIC: LEGO1 0x10065130 + // AnimState::`scalar deleting destructor' + +private: + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + void* m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 + void* m_unk0x18; // 0x18 +}; + // VTABLE: LEGO1 0x100d8c18 // SIZE 0x500 class LegoAnimationManager : public MxCore { diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index bd86964e..ed486c9f 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -1,8 +1,54 @@ #ifndef LEGOCARBUILD_H #define LEGOCARBUILD_H +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d66e0 +// SIZE 0x50 +class LegoVehicleBuildState : public LegoState { +public: + LegoVehicleBuildState(char* p_classType); + + // FUNCTION: LEGO1 0x10025ff0 + inline const char* ClassName() const override // vtable+0x0c + { + return this->m_className.GetData(); + } + + // FUNCTION: LEGO1 0x10026000 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x100260a0 + // LegoVehicleBuildState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[4]; // 0x08 + + // This can be one of the following: + // * LegoRaceCarBuildState + // * LegoCopterBuildState + // * LegoDuneCarBuildState + // * LegoJetskiBuildState + MxString m_className; // 0x38 + + // Known States: + // * 1 == enter(ing) build screen + // * 3 == cutscene/dialogue + // * 6 == exit(ing) build screen + MxU32 m_animationState; // 0x48 + undefined m_unk0x4c; // 0x4c + MxBool m_unk0x4d; // 0x4d + MxBool m_unk0x4e; // 0x4e + MxU8 m_placedPartCount; // 0x4f +}; + // VTABLE: LEGO1 0x100d6658 // SIZE 0x34c class LegoCarBuild : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h similarity index 93% rename from LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h rename to LEGO1/lego/legoomni/include/legocarbuildpresenter.h index d4c12d76..69afdebf 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -1,5 +1,5 @@ -#ifndef LEGOCARBUILDANIMPRESENTER_H -#define LEGOCARBUILDANIMPRESENTER_H +#ifndef LEGOCARBUILDPRESENTER_H +#define LEGOCARBUILDPRESENTER_H #include "anim/legoanim.h" #include "legoanimpresenter.h" @@ -59,4 +59,4 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { undefined4 m_unk0x14c; // 0x14c }; -#endif // LEGOCARBUILDANIMPRESENTER_H +#endif // LEGOCARBUILDPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index f99f7e28..76282d0b 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -2,10 +2,60 @@ #define LEGORACE_H #include "decomp.h" +#include "legostate.h" #include "legoworld.h" #include "mxrect32.h" #include "mxtypes.h" +// VTABLE: LEGO1 0x100d5e30 +// SIZE 0x2c +class RaceState : public LegoState { +public: + // SIZE 0x06 + struct Entry { + public: + inline MxS16 GetUnknown0x02() { return m_unk0x02; } + inline MxU16 GetScore() { return m_score; } + + // TODO: Possibly private + MxU8 m_id; // 0x00 + MxS16 m_unk0x02; // 0x02 + MxU16 m_score; // 0x04 + }; + + RaceState(); + + // FUNCTION: LEGO1 0x10016010 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f07d0 + return "RaceState"; + } + + // FUNCTION: LEGO1 0x10016020 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + Entry* GetState(MxU8 p_id); + + inline undefined4 GetUnknown0x28() { return m_unk0x28; } + + // SYNTHETIC: LEGO1 0x1000f6f0 + // RaceState::~RaceState + + // SYNTHETIC: LEGO1 0x100160d0 + // RaceState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Entry m_state[5]; // 0x08 + undefined4 m_unk0x28; // 0x28 +}; + // VTABLE: LEGO1 0x100d5db0 // SIZE 0x144 class LegoRace : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h deleted file mode 100644 index 7a70a873..00000000 --- a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef LEGOVEHICLEBUILDSTATE_H -#define LEGOVEHICLEBUILDSTATE_H - -#include "decomp.h" -#include "legostate.h" -#include "mxstring.h" - -// VTABLE: LEGO1 0x100d66e0 -// SIZE 0x50 -class LegoVehicleBuildState : public LegoState { -public: - LegoVehicleBuildState(char* p_classType); - - // FUNCTION: LEGO1 0x10025ff0 - inline const char* ClassName() const override // vtable+0x0c - { - return this->m_className.GetData(); - } - - // FUNCTION: LEGO1 0x10026000 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x100260a0 - // LegoVehicleBuildState::`scalar deleting destructor' - - // private: - Playlist m_unk0x08[4]; // 0x08 - - // This can be one of the following: - // * LegoRaceCarBuildState - // * LegoCopterBuildState - // * LegoDuneCarBuildState - // * LegoJetskiBuildState - MxString m_className; // 0x38 - - // Known States: - // * 1 == enter(ing) build screen - // * 3 == cutscene/dialogue - // * 6 == exit(ing) build screen - MxU32 m_animationState; // 0x48 - undefined m_unk0x4c; // 0x4c - MxBool m_unk0x4d; // 0x4d - MxBool m_unk0x4e; // 0x4e - MxU8 m_placedPartCount; // 0x4f -}; - -#endif // LEGOVEHICLEBUILDSTATE_H diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 01e99d7f..7f1356be 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -3,11 +3,52 @@ #include "decomp.h" #include "isleactor.h" +#include "legostate.h" class Act1State; -class PizzaMissionState; class SkateBoard; +// VTABLE: LEGO1 0x100d7408 +// SIZE 0xb0 +class PizzaMissionState : public LegoState { +public: + // SIZE 0x20 + struct Entry { + public: + undefined2 m_unk0x00; // 0x00 + MxU8 m_id; // 0x02 + undefined m_unk0x03[0x15]; // 0x03 + MxU16 m_score; // 0x18 + undefined m_unk0x18[6]; // 0x1a + }; + + // FUNCTION: LEGO1 0x10039290 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00d4 + return "PizzaMissionState"; + } + + // FUNCTION: LEGO1 0x100392a0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; } + + // SYNTHETIC: LEGO1 0x10039350 + // PizzaMissionState::`scalar deleting destructor' + + Entry* GetState(MxU8 p_id); + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + Entry m_state[5]; // 0x10 +}; + // VTABLE: LEGO1 0x100d7380 // SIZE 0x9c class Pizza : public IsleActor { diff --git a/LEGO1/lego/legoomni/include/pizzamissionstate.h b/LEGO1/lego/legoomni/include/pizzamissionstate.h deleted file mode 100644 index c74ea4b1..00000000 --- a/LEGO1/lego/legoomni/include/pizzamissionstate.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef PIZZAMISSIONSTATE_H -#define PIZZAMISSIONSTATE_H - -#include "legostate.h" - -// SIZE 0x20 -struct PizzaMissionStateEntry { -public: - undefined2 m_unk0x00; // 0x00 - MxU8 m_id; // 0x02 - undefined m_unk0x03[0x15]; // 0x03 - MxU16 m_score; // 0x18 - undefined m_unk0x18[6]; // 0x1a -}; - -// VTABLE: LEGO1 0x100d7408 -// SIZE 0xb0 -class PizzaMissionState : public LegoState { -public: - // FUNCTION: LEGO1 0x10039290 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00d4 - return "PizzaMissionState"; - } - - // FUNCTION: LEGO1 0x100392a0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; } - - // SYNTHETIC: LEGO1 0x10039350 - // PizzaMissionState::`scalar deleting destructor' - - PizzaMissionStateEntry* GetState(MxU8 p_id); - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - PizzaMissionStateEntry m_state[5]; // 0x10 -}; - -#endif // PIZZAMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 91f76f46..46150249 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -3,10 +3,51 @@ #include "decomp.h" #include "isleactor.h" +#include "legostate.h" -class PizzeriaState; class PizzaMissionState; +// VTABLE: LEGO1 0x100d5ee8 +// SIZE 0x58 +class PizzeriaState : public LegoState { +public: + // SIZE 0x14 + struct StateStruct { + undefined4 m_unk0x00; // 0x00 + undefined4 m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + undefined4 m_unk0x10; // 0x10 + }; + + PizzeriaState(); + + // FUNCTION: LEGO1 0x10017c20 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0370 + return "PizzeriaState"; + } + + // FUNCTION: LEGO1 0x10017c30 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x10017ce0 + // PizzeriaState::`scalar deleting destructor' + + MxU32 FUN_10017d70(); + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[5]; // 0x08 + StateStruct m_unk0x44; // 0x44 +}; + // VTABLE: LEGO1 0x100d5520 // SIZE 0x84 class Pizzeria : public IsleActor { diff --git a/LEGO1/lego/legoomni/include/pizzeriastate.h b/LEGO1/lego/legoomni/include/pizzeriastate.h deleted file mode 100644 index 6bed2aad..00000000 --- a/LEGO1/lego/legoomni/include/pizzeriastate.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef PIZZERIASTATE_H -#define PIZZERIASTATE_H - -#include "legostate.h" - -// SIZE 0x14 -struct PizzeriaStateStruct { - undefined4 m_unk0x00; // 0x00 - undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 -}; - -// VTABLE: LEGO1 0x100d5ee8 -// SIZE 0x58 -class PizzeriaState : public LegoState { -public: - PizzeriaState(); - - // FUNCTION: LEGO1 0x10017c20 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0370 - return "PizzeriaState"; - } - - // FUNCTION: LEGO1 0x10017c30 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x10017ce0 - // PizzeriaState::`scalar deleting destructor' - - MxU32 FUN_10017d70(); - -private: - Playlist m_unk0x08[5]; // 0x08 - PizzeriaStateStruct m_unk0x44; // 0x44 -}; - -#endif // PIZZERIASTATE_H diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 67c3586a..4c8c34eb 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -3,13 +3,49 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" class LegoControlManagerEvent; class LegoEventNotificationParam; class MxDSAction; -class PoliceState; + +// VTABLE: LEGO1 0x100d8af0 +// SIZE 0x10 +class PoliceState : public LegoState { +public: + PoliceState(); + ~PoliceState() override {} + + // FUNCTION: LEGO1 0x1005e860 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0444 + return "PoliceState"; + } + + // FUNCTION: LEGO1 0x1005e870 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x1005e920 + // PoliceState::`scalar deleting destructor' + + inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } + inline void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + + void FUN_1005ea40(); + + // TODO: Most likely getters/setters are not used according to BETA. + + PoliceScript::Script m_policeScript; // 0x08 + undefined4 m_unk0x0c; // 0x0c +}; // VTABLE: LEGO1 0x100d8a80 // SIZE 0x110 diff --git a/LEGO1/lego/legoomni/include/policeentity.h b/LEGO1/lego/legoomni/include/policeentity.h deleted file mode 100644 index 48156150..00000000 --- a/LEGO1/lego/legoomni/include/policeentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef POLICEENTITY_H -#define POLICEENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4ab0 -// SIZE 0x68 -class PoliceEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ed60 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0328 - return "PoliceEntity"; - } - - // FUNCTION: LEGO1 0x1000ed70 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f900 - // PoliceEntity::`scalar deleting destructor' -}; - -#endif // POLICEENTITY_H diff --git a/LEGO1/lego/legoomni/include/policestate.h b/LEGO1/lego/legoomni/include/policestate.h deleted file mode 100644 index 75970729..00000000 --- a/LEGO1/lego/legoomni/include/policestate.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef POLICESTATE_H -#define POLICESTATE_H - -#include "actionsfwd.h" -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d8af0 -// SIZE 0x10 -class PoliceState : public LegoState { -public: - PoliceState(); - ~PoliceState() override {} - - // FUNCTION: LEGO1 0x1005e860 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0444 - return "PoliceState"; - } - - // FUNCTION: LEGO1 0x1005e870 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x1005e920 - // PoliceState::`scalar deleting destructor' - - inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } - inline void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } - - void FUN_1005ea40(); - -private: - PoliceScript::Script m_policeScript; // 0x08 - undefined4 m_unk0x0c; // 0x0c -}; - -#endif // POLICESTATE_H diff --git a/LEGO1/lego/legoomni/include/racestandsentity.h b/LEGO1/lego/legoomni/include/racestandsentity.h deleted file mode 100644 index 22bc4dd2..00000000 --- a/LEGO1/lego/legoomni/include/racestandsentity.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef RACESTANDSENTITY_H -#define RACESTANDSENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d48a8 -// SIZE 0x68 -class RaceStandsEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000efa0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0300 - return "RaceStandsEntity"; - } - - // FUNCTION: LEGO1 0x1000efb0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f9e0 - // RaceStandsEntity::`scalar deleting destructor' -}; - -#endif // RACESTANDSENTITY_H diff --git a/LEGO1/lego/legoomni/include/racestate.h b/LEGO1/lego/legoomni/include/racestate.h deleted file mode 100644 index e2321be1..00000000 --- a/LEGO1/lego/legoomni/include/racestate.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef RACESTATE_H -#define RACESTATE_H - -#include "legostate.h" - -// SIZE 0x06 -struct RaceStateEntry { -public: - inline MxS16 GetUnknown0x02() { return m_unk0x02; } - inline MxU16 GetScore() { return m_score; } - - // TODO: Possibly private - MxU8 m_id; // 0x00 - MxS16 m_unk0x02; // 0x02 - MxU16 m_score; // 0x04 -}; - -// VTABLE: LEGO1 0x100d5e30 -// SIZE 0x2c -class RaceState : public LegoState { -public: - RaceState(); - - // FUNCTION: LEGO1 0x10016010 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f07d0 - return "RaceState"; - } - - // FUNCTION: LEGO1 0x10016020 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - RaceStateEntry* GetState(MxU8 p_id); - - inline undefined4 GetUnknown0x28() { return m_unk0x28; } - - // SYNTHETIC: LEGO1 0x1000f6f0 - // RaceState::~RaceState - - // SYNTHETIC: LEGO1 0x100160d0 - // RaceState::`scalar deleting destructor' - -protected: - RaceStateEntry m_state[5]; // 0x08 - undefined4 m_unk0x28; // 0x28 -}; - -#endif // RACESTATE_H diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 997c6579..cd411036 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -1,11 +1,50 @@ #ifndef RADIO_H #define RADIO_H +#include "legostate.h" #include "mxcore.h" class LegoControlManagerEvent; +class MxAtomId; class MxEndActionNotificationParam; -class RadioState; + +// VTABLE: LEGO1 0x100d6d28 +// SIZE 0x30 +class RadioState : public LegoState { +public: + RadioState(); + + // FUNCTION: LEGO1 0x1002cf60 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f04f8 + return "RadioState"; + } + + // FUNCTION: LEGO1 0x1002cf70 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RadioState::ClassName()) || LegoState::IsA(p_name); + } + + MxBool IsSerializable() override; // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1002d020 + // RadioState::`scalar deleting destructor' + + inline MxBool IsActive() { return m_active; } + + inline void SetActive(MxBool p_active) { m_active = p_active; } + + undefined4 FUN_1002d090(); + MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId); + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[3]; // 0x08 + MxS16 m_unk0x2c; // 0x2c + MxBool m_active; // 0x2e +}; // VTABLE: LEGO1 0x100d6d10 // SIZE 0x10 diff --git a/LEGO1/lego/legoomni/include/radiostate.h b/LEGO1/lego/legoomni/include/radiostate.h deleted file mode 100644 index e0c0066c..00000000 --- a/LEGO1/lego/legoomni/include/radiostate.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RADIOSTATE_H -#define RADIOSTATE_H - -#include "legostate.h" - -class MxAtomId; - -// VTABLE: LEGO1 0x100d6d28 -// SIZE 0x30 -class RadioState : public LegoState { -public: - RadioState(); - - // FUNCTION: LEGO1 0x1002cf60 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f04f8 - return "RadioState"; - } - - // FUNCTION: LEGO1 0x1002cf70 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RadioState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1002d020 - // RadioState::`scalar deleting destructor' - - inline MxBool IsActive() { return m_active; } - - inline void SetActive(MxBool p_active) { m_active = p_active; } - - undefined4 FUN_1002d090(); - MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId); - -private: - Playlist m_unk0x08[3]; // 0x08 - MxS16 m_unk0x2c; // 0x2c - MxBool m_active; // 0x2e -}; - -#endif // RADIOSTATE_H diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 979fa33d..76a4ac8e 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -2,11 +2,49 @@ #define SCORE_H #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" class LegoControlManagerEvent; class MxEndActionNotificationParam; -class ScoreState; + +// VTABLE: LEGO1 0x100d53f8 +// SIZE 0x0c +class ScoreState : public LegoState { +public: + // FUNCTION: LEGO1 0x1000de40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0084 + return "ScoreState"; + } + + // FUNCTION: LEGO1 0x1000de50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000de20 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000de30 + MxBool SetFlag() override + { + m_playCubeTutorial = TRUE; + return TRUE; + } // vtable+0x18 + + inline MxBool GetTutorialFlag() { return m_playCubeTutorial; } + inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } + + // SYNTHETIC: LEGO1 0x1000df00 + // ScoreState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxBool m_playCubeTutorial; // 0x08 +}; // VTABLE: LEGO1 0x100d4018 // SIZE 0x104 diff --git a/LEGO1/lego/legoomni/include/scorestate.h b/LEGO1/lego/legoomni/include/scorestate.h deleted file mode 100644 index ac651a19..00000000 --- a/LEGO1/lego/legoomni/include/scorestate.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SCORESTATE_H -#define SCORESTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d53f8 -// SIZE 0x0c -class ScoreState : public LegoState { -public: - // FUNCTION: LEGO1 0x1000de40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0084 - return "ScoreState"; - } - - // FUNCTION: LEGO1 0x1000de50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - MxBool SetFlag() override; // vtable+0x18 - - inline MxBool GetTutorialFlag() { return m_playCubeTutorial; } - inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } - - // SYNTHETIC: LEGO1 0x1000df00 - // ScoreState::`scalar deleting destructor' - -private: - MxBool m_playCubeTutorial; // 0x08 -}; - -#endif // SCORESTATE_H diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 4f4f1bb5..a8738cbf 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -3,8 +3,64 @@ #include "decomp.h" #include "islepathactor.h" +#include "legostate.h" -class TowTrackMissionState; +// VTABLE: LEGO1 0x100d7fd8 +// SIZE 0x28 +class TowTrackMissionState : public LegoState { +public: + TowTrackMissionState(); + + // FUNCTION: LEGO1 0x1004dfa0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00bc + return "TowTrackMissionState"; + } + + // FUNCTION: LEGO1 0x1004dfb0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) + { + switch (p_id) { + case 1: + return m_score1; + case 2: + return m_score2; + case 3: + return m_score3; + case 4: + return m_score4; + case 5: + return m_score5; + default: + return 0; + } + } + + // SYNTHETIC: LEGO1 0x1004e060 + // TowTrackMissionState::`scalar deleting destructor' + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxU8 m_unk0x10; // 0x10 + MxU16 m_unk0x12; // 0x12 + MxU16 m_unk0x14; // 0x14 + MxU16 m_unk0x16; // 0x16 + MxU16 m_unk0x18; // 0x18 + MxU16 m_unk0x1a; // 0x1a + MxU16 m_score1; // 0x1c + MxU16 m_score2; // 0x1e + MxU16 m_score3; // 0x20 + MxU16 m_score4; // 0x22 + MxU16 m_score5; // 0x24 +}; // VTABLE: LEGO1 0x100d7ee0 // SIZE 0x180 diff --git a/LEGO1/lego/legoomni/include/towtrackmissionstate.h b/LEGO1/lego/legoomni/include/towtrackmissionstate.h deleted file mode 100644 index 5a684011..00000000 --- a/LEGO1/lego/legoomni/include/towtrackmissionstate.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef TOWTRACKMISSIONSTATE_H -#define TOWTRACKMISSIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d7fd8 -// SIZE 0x28 -class TowTrackMissionState : public LegoState { -public: - TowTrackMissionState(); - - // FUNCTION: LEGO1 0x1004dfa0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00bc - return "TowTrackMissionState"; - } - - // FUNCTION: LEGO1 0x1004dfb0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) - { - switch (p_id) { - case 1: - return m_score1; - case 2: - return m_score2; - case 3: - return m_score3; - case 4: - return m_score4; - case 5: - return m_score5; - default: - return 0; - } - } - - // SYNTHETIC: LEGO1 0x1004e060 - // TowTrackMissionState::`scalar deleting destructor' - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - MxU8 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_unk0x1a; // 0x1a - MxU16 m_score1; // 0x1c - MxU16 m_score2; // 0x1e - MxU16 m_score3; // 0x20 - MxU16 m_score4; // 0x22 - MxU16 m_score5; // 0x24 -}; - -#endif // TOWTRACKMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp deleted file mode 100644 index 013347d3..00000000 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include "act1state.h" - -#include "legonamedtexture.h" -#include "legoutils.h" - -DECOMP_SIZE_ASSERT(Act1State, 0x26c) -DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c) - -// GLOBAL: ISLE 0x100f37f0 -MxS32 g_unk0x100f37f0[] = { - Act1State::e_unk953, - Act1State::e_unk954, - Act1State::e_unk955, -}; - -extern MxAtomId* g_isleScript; - -// STUB: LEGO1 0x100334b0 -Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0) -{ - m_unk0x01e = FALSE; - m_unk0x018 = 1; - m_unk0x010 = 0; - m_planeActive = FALSE; - m_unk0x00e = 0; - m_unk0x01f = FALSE; - m_unk0x008 = g_unk0x100f37f0; - m_unk0x014 = -1; - m_unk0x022 = FALSE; - m_unk0x154 = NULL; - m_unk0x158 = NULL; - m_unk0x15c = NULL; - m_unk0x160 = NULL; - m_unk0x1b0 = NULL; - m_unk0x021 = 1; - m_elevFloor = Act1State::c_floor1; - m_unk0x00c = sizeOfArray(g_unk0x100f37f0); - m_unk0x1b4 = NULL; - m_unk0x1b8 = NULL; - m_unk0x208 = NULL; - m_unk0x20c = NULL; - m_unk0x25c = NULL; - m_unk0x260 = NULL; - m_unk0x264 = NULL; - m_unk0x268 = NULL; - SetFlag(); -} - -// FUNCTION: LEGO1 0x10033ac0 -MxResult Act1State::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - m_unk0x024.Serialize(p_legoFile); - m_unk0x070.Serialize(p_legoFile); - m_unk0x0bc.Serialize(p_legoFile); - m_unk0x108.Serialize(p_legoFile); - m_unk0x164.Serialize(p_legoFile); - m_unk0x1bc.Serialize(p_legoFile); - m_unk0x210.Serialize(p_legoFile); - - if (p_legoFile->IsWriteMode()) { - if (m_unk0x108.GetName()->Compare("") != 0) { - if (m_unk0x154) { - WriteNamedTexture(p_legoFile, m_unk0x154); - } - else { - FUN_1003f540(p_legoFile, "chwind.gif"); - } - if (m_unk0x158) { - WriteNamedTexture(p_legoFile, m_unk0x158); - } - else { - FUN_1003f540(p_legoFile, "chjetl.gif"); - } - if (m_unk0x15c) { - WriteNamedTexture(p_legoFile, m_unk0x15c); - } - else { - FUN_1003f540(p_legoFile, "chjetr.gif"); - } - } - if (m_unk0x164.GetName()->Compare("") != 0) { - if (m_unk0x1b0) { - WriteNamedTexture(p_legoFile, m_unk0x1b0); - } - else { - FUN_1003f540(p_legoFile, "jsfrnt.gif"); - } - if (m_unk0x1b4) { - WriteNamedTexture(p_legoFile, m_unk0x1b4); - } - else { - FUN_1003f540(p_legoFile, "jswnsh.gif"); - } - } - if (m_unk0x1bc.GetName()->Compare("") != 0) { - if (m_unk0x208) { - WriteNamedTexture(p_legoFile, m_unk0x208); - } - else { - FUN_1003f540(p_legoFile, "dbfrfn.gif"); - } - } - if (m_unk0x210.GetName()->Compare("") != 0) { - if (m_unk0x25c) { - WriteNamedTexture(p_legoFile, m_unk0x25c); - } - else { - FUN_1003f540(p_legoFile, "rcfrnt.gif"); - } - if (m_unk0x260) { - WriteNamedTexture(p_legoFile, m_unk0x260); - } - else { - FUN_1003f540(p_legoFile, "rcback.gif"); - } - if (m_unk0x264) { - WriteNamedTexture(p_legoFile, m_unk0x264); - } - else { - FUN_1003f540(p_legoFile, "rctail.gif"); - } - } - - p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); - } - else if (p_legoFile->IsReadMode()) { - if (m_unk0x108.GetName()->Compare("") != 0) { - m_unk0x154 = ReadNamedTexture(p_legoFile); - if (m_unk0x154 == NULL) { - return FAILURE; - } - - m_unk0x158 = ReadNamedTexture(p_legoFile); - if (m_unk0x158 == NULL) { - return FAILURE; - } - - m_unk0x15c = ReadNamedTexture(p_legoFile); - if (m_unk0x15c == NULL) { - return FAILURE; - } - } - if (m_unk0x164.GetName()->Compare("") != 0) { - m_unk0x1b0 = ReadNamedTexture(p_legoFile); - if (m_unk0x1b0 == NULL) { - return FAILURE; - } - - m_unk0x1b4 = ReadNamedTexture(p_legoFile); - if (m_unk0x1b4 == NULL) { - return FAILURE; - } - } - if (m_unk0x1bc.GetName()->Compare("") != 0) { - m_unk0x208 = ReadNamedTexture(p_legoFile); - if (m_unk0x208 == NULL) { - return FAILURE; - } - } - if (m_unk0x210.GetName()->Compare("") != 0) { - m_unk0x25c = ReadNamedTexture(p_legoFile); - if (m_unk0x25c == NULL) { - return FAILURE; - } - - m_unk0x260 = ReadNamedTexture(p_legoFile); - if (m_unk0x260 == NULL) { - return FAILURE; - } - - m_unk0x264 = ReadNamedTexture(p_legoFile); - if (m_unk0x264 == NULL) { - return FAILURE; - } - } - - p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); - } - - // TODO - return SUCCESS; -} - -// STUB: LEGO1 0x10034660 -void Act1State::FUN_10034660() -{ - // TODO -} - -// FUNCTION: LEGO1 0x100346a0 -void Act1State::FUN_100346a0() -{ - if (m_unk0x014 != -1) { - InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL); - m_unk0x014 = -1; - } -} - -// FUNCTION: LEGO1 0x100346d0 -MxBool Act1State::SetFlag() -{ - m_unk0x024.SetName(""); - m_unk0x070.SetName(""); - m_unk0x0bc.SetName(""); - m_unk0x022 = FALSE; - m_unk0x108.SetName(""); - - if (m_unk0x154) { - delete m_unk0x154; - m_unk0x154 = NULL; - } - - if (m_unk0x158) { - delete m_unk0x158; - m_unk0x158 = NULL; - } - - if (m_unk0x15c) { - delete m_unk0x15c; - m_unk0x15c = NULL; - } - - if (m_unk0x160) { - delete m_unk0x160; - m_unk0x160 = NULL; - } - - m_unk0x164.SetName(""); - - if (m_unk0x1b0) { - delete m_unk0x1b0; - m_unk0x1b0 = NULL; - } - - if (m_unk0x1b4) { - delete m_unk0x1b4; - m_unk0x1b4 = NULL; - } - - if (m_unk0x1b8) { - delete m_unk0x1b8; - m_unk0x1b8 = NULL; - } - - m_unk0x1bc.SetName(""); - - if (m_unk0x208) { - delete m_unk0x208; - m_unk0x208 = NULL; - } - - if (m_unk0x20c) { - delete m_unk0x20c; - m_unk0x20c = NULL; - } - - m_unk0x210.SetName(""); - - if (m_unk0x25c) { - delete m_unk0x25c; - m_unk0x25c = NULL; - } - - if (m_unk0x260) { - delete m_unk0x260; - m_unk0x260 = NULL; - } - - if (m_unk0x264) { - delete m_unk0x264; - m_unk0x264 = NULL; - } - - if (m_unk0x268) { - delete m_unk0x268; - m_unk0x268 = NULL; - } - - return TRUE; -} - -// STUB: LEGO1 0x10034b60 -void Act1State::FUN_10034b60() -{ - // TODO -} - -// STUB: LEGO1 0x10034d00 -void Act1State::FUN_10034d00() -{ - // TODO -} diff --git a/LEGO1/lego/legoomni/src/act2/legoact2state.cpp b/LEGO1/lego/legoomni/src/act2/legoact2state.cpp deleted file mode 100644 index 955de04e..00000000 --- a/LEGO1/lego/legoomni/src/act2/legoact2state.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "legoact2state.h" - -DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) - -// FUNCTION: LEGO1 0x1000df70 -MxBool LegoAct2State::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/act3/act3state.cpp b/LEGO1/lego/legoomni/src/act3/act3state.cpp deleted file mode 100644 index de1bac5f..00000000 --- a/LEGO1/lego/legoomni/src/act3/act3state.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "act3state.h" - -DECOMP_SIZE_ASSERT(Act3State, 0x0c) - -// FUNCTION: LEGO1 0x1000e2f0 -MxBool Act3State::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/act3/act3shark.cpp b/LEGO1/lego/legoomni/src/actors/act3shark.cpp similarity index 100% rename from LEGO1/lego/legoomni/src/act3/act3shark.cpp rename to LEGO1/lego/legoomni/src/actors/act3shark.cpp diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 2d293972..1a15d7c8 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -1,6 +1,5 @@ #include "ambulance.h" -#include "ambulancemissionstate.h" #include "decomp.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -14,6 +13,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Ambulance, 0x184) +DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) // FUNCTION: LEGO1 0x10035ee0 Ambulance::Ambulance() @@ -152,3 +152,27 @@ void Ambulance::FUN_10037250() { // TODO } + +// FUNCTION: LEGO1 0x100373a0 +AmbulanceMissionState::AmbulanceMissionState() +{ + m_unk0x10 = 0; + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x08 = 0; + m_unk0x16 = 0; + m_unk0x0c = 0; + m_unk0x18 = 0; + m_score1 = 0; + m_score2 = 0; + m_score3 = 0; + m_score4 = 0; + m_score5 = 0; +} + +// STUB: LEGO1 0x10037440 +MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp new file mode 100644 index 00000000..9c3c174b --- /dev/null +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -0,0 +1,176 @@ +#include "buildings.h" + +#include "act2main_actions.h" +#include "act3.h" +#include "act3_actions.h" +#include "isle.h" +#include "isle_actions.h" +#include "islepathactor.h" +#include "legoact2.h" +#include "legoanimationmanager.h" +#include "legogamestate.h" +#include "legoutils.h" +#include "legoworld.h" +#include "misc.h" +#include "mxtransitionmanager.h" +#include "scripts.h" + +DECOMP_SIZE_ASSERT(BeachHouseEntity, 0x68) +DECOMP_SIZE_ASSERT(GasStationEntity, 0x68) +DECOMP_SIZE_ASSERT(HospitalEntity, 0x68) +DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) +DECOMP_SIZE_ASSERT(JailEntity, 0x68) +DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) +DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) + +// FUNCTION: LEGO1 0x100150c0 +MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) +{ + switch (GameState()->GetCurrentAct()) { + case LegoGameState::Act::e_act1: { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->FUN_10033350(); + isle->SetDestLocation(LegoGameState::Area::e_infomain); + + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + act1state->SetUnknown18(0); + break; + } + case LegoGameState::Act::e_act2: { + LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); + act2->SetUnknown0x1150(2); + + LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); + if (act2state) { + act2state->SetUnknown0x0c(0); + } + break; + } + case LegoGameState::Act::e_act3: + Act3* act3 = (Act3*) FindWorld(*g_act3Script, Act3Script::c__Act3); + act3->SetUnknown4270(2); + break; + } + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + return 1; +} + +// FUNCTION: LEGO1 0x100151d0 +MxLong GasStationEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (state->GetUnknown18() != 8) { + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_garage); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015270 +MxLong HospitalEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + + if (act1State->GetUnknown18() != 10) { + act1State->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_hospital); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015310 +MxLong PoliceEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (state->GetUnknown18() != 10) { + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_police); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x100153b0 +MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015450 +MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + + return 1; +} diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index dee0a47b..1b765b2b 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -1,9 +1,7 @@ #include "helicopter.h" -#include "act1state.h" #include "act3.h" #include "act3_actions.h" -#include "helicopterstate.h" #include "isle.h" #include "isle_actions.h" #include "jukebox.h" @@ -19,6 +17,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Helicopter, 0x230) +DECOMP_SIZE_ASSERT(HelicopterState, 0x0c) DECOMP_SIZE_ASSERT(Mx3DPointFloat, 0x14) DECOMP_SIZE_ASSERT(Mx4DPointFloat, 0x18) DECOMP_SIZE_ASSERT(MxMatrix, 0x48) diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index e526384e..0f8da9e7 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -4,10 +4,10 @@ #include "isle_actions.h" #include "jukebox_actions.h" #include "legoanimationmanager.h" +#include "legocarbuild.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legoutils.h" -#include "legovehiclebuildstate.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index f4e2af0a..340ea64d 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -3,8 +3,8 @@ #include "isle.h" #include "isle_actions.h" #include "islepathactor.h" +#include "jukebox.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "legogamestate.h" #include "legoutils.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 9185de23..43ef2ddb 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -1,15 +1,15 @@ #include "pizza.h" -#include "act1state.h" #include "isle_actions.h" #include "legogamestate.h" #include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxticklemanager.h" -#include "pizzamissionstate.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) +DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) +DECOMP_SIZE_ASSERT(PizzaMissionState::Entry, 0x20) // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() @@ -98,3 +98,22 @@ undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&) // TODO return 0; } + +// STUB: LEGO1 0x100393c0 +MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// FUNCTION: LEGO1 0x10039510 +PizzaMissionState::Entry* PizzaMissionState::GetState(MxU8 p_id) +{ + for (MxS16 i = 0; i < 5; i++) { + if (m_state[i].m_id == p_id) { + return m_state + i; + } + } + + return NULL; +} diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 46139dd7..1ae45305 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -9,11 +9,11 @@ #include "legoworld.h" #include "misc.h" #include "pizza.h" -#include "pizzamissionstate.h" -#include "pizzeriastate.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Pizzeria, 0x84) +DECOMP_SIZE_ASSERT(PizzeriaState, 0x58) +DECOMP_SIZE_ASSERT(PizzeriaState::StateStruct, 0x14) // FUNCTION: LEGO1 0x100179c0 MxResult Pizzeria::Create(MxDSAction& p_dsAction) @@ -63,3 +63,22 @@ undefined4 Pizzeria::HandleClick() return 1; } + +// STUB: LEGO1 0x10017af0 +PizzeriaState::PizzeriaState() +{ + // TODO +} + +// STUB: LEGO1 0x10017d70 +MxU32 PizzeriaState::FUN_10017d70() +{ + return 0; +} + +// STUB: LEGO1 0x10017da0 +MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index e78e7ba8..89d39357 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -1,6 +1,7 @@ #include "radio.h" #include "isle_actions.h" +#include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoworld.h" @@ -10,10 +11,52 @@ #include "mxcontrolpresenter.h" #include "mxmisc.h" #include "mxnotificationmanager.h" -#include "radiostate.h" +#include "mxtimer.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Radio, 0x10) +DECOMP_SIZE_ASSERT(RadioState, 0x30) + +// GLOBAL: LEGO1 0x100f3218 +JukeboxScript::Script g_unk0x100f3218[6] = { + JukeboxScript::c_sns002ra_Audio, + JukeboxScript::c_sns001ja_Audio, + JukeboxScript::c_snsc01js_Audio, + JukeboxScript::c_snsb01js_Audio, + JukeboxScript::c_snsa01js_Audio, + JukeboxScript::c_sns009ra_Audio +}; + +// GLOBAL: LEGO1 0x100f3230 +JukeboxScript::Script g_unk0x100f3230[14] = { + JukeboxScript::c_ham035ra_Audio, + JukeboxScript::c_ham039ra_Audio, + JukeboxScript::c_sns005ra_Audio, + JukeboxScript::c_sns078pa_Audio, + JukeboxScript::c_ham036ra_Audio, + JukeboxScript::c_sns006ra_Audio, + JukeboxScript::c_sns013ra_Audio, + JukeboxScript::c_sns004ra_Audio, + JukeboxScript::c_sns079pa_Audio, + JukeboxScript::c_sns007ra_Audio, + JukeboxScript::c_sns008ra_Audio, + JukeboxScript::c_hpz037ma_Audio, + JukeboxScript::c_sns003ra_Audio, + JukeboxScript::c_sns010ra_Audio, +}; + +// GLOBAL: LEGO1 0x100f3268 +JukeboxScript::Script g_unk0x100f3268[9] = { + JukeboxScript::c_CentralRoads_Music, + JukeboxScript::c_BeachBlvd_Music, + JukeboxScript::c_ResidentalArea_Music, + JukeboxScript::c_Radio1_Music, + JukeboxScript::c_Radio2_Music, + JukeboxScript::c_Radio3_Music, + JukeboxScript::c_Radio4_Music, + JukeboxScript::c_Radio5_Music, + JukeboxScript::c_Radio6_Music, +}; // FUNCTION: LEGO1 0x1002c850 Radio::Radio() @@ -162,3 +205,56 @@ void Radio::CreateState() m_state = state; } + +// FUNCTION: LEGO1 0x1002ce10 +RadioState::RadioState() +{ + srand(Timer()->GetTime()); + + MxS32 random = rand(); + m_unk0x2c = random % 3; + + m_unk0x08[0] = LegoState::Playlist((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])); + m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]))); + + m_unk0x08[1] = LegoState::Playlist((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])); + m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]))); + + m_unk0x08[2] = LegoState::Playlist((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])); + m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]))); + + m_active = FALSE; +} + +// FUNCTION: LEGO1 0x1002cf50 +MxBool RadioState::IsSerializable() +{ + return FALSE; +} + +// FUNCTION: LEGO1 0x1002d090 +MxU32 RadioState::FUN_1002d090() +{ + if (m_unk0x2c == 2) { + m_unk0x2c = 0; + } + else { + m_unk0x2c++; + } + + return m_unk0x08[m_unk0x2c].Next(); +} + +// FUNCTION: LEGO1 0x1002d0c0 +MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId) +{ + if (*g_jukeboxScript == p_atom) { + for (MxS16 i = 0; i < 3; i++) { + if (m_unk0x08[i].Contains(p_objectId)) { + return TRUE; + } + } + } + + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index ab37d3f1..814e1332 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,6 +1,5 @@ #include "skateboard.h" -#include "act1state.h" #include "decomp.h" #include "isle.h" #include "isle_actions.h" diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index cf155775..4f259903 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -7,9 +7,9 @@ #include "mxmisc.h" #include "mxtimer.h" #include "mxvariabletable.h" -#include "towtrackmissionstate.h" DECOMP_SIZE_ASSERT(TowTrack, 0x180) +DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28) // FUNCTION: LEGO1 0x1004c720 TowTrack::TowTrack() @@ -131,3 +131,73 @@ void TowTrack::FUN_1004dbe0() { // TODO } + +// FUNCTION: LEGO1 0x1004dd30 +TowTrackMissionState::TowTrackMissionState() +{ + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x16 = 0; + m_unk0x08 = 0; + m_unk0x18 = 0; + m_unk0x0c = 0; + m_unk0x1a = 0; + m_unk0x10 = 0; + m_score1 = 0; + m_score2 = 0; + m_score3 = 0; + m_score4 = 0; + m_score5 = 0; +} + +// FUNCTION: LEGO1 0x1004dde0 +MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); + p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); + p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); + p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); + p_legoFile->Read(&m_score1, sizeof(m_score1)); + p_legoFile->Read(&m_score2, sizeof(m_score2)); + p_legoFile->Read(&m_score3, sizeof(m_score3)); + p_legoFile->Read(&m_score4, sizeof(m_score4)); + p_legoFile->Read(&m_score5, sizeof(m_score5)); + } + else if (p_legoFile->IsWriteMode()) { + MxU16 write = m_unk0x12; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x14; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x16; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x18; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x1a; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score1; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score2; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score3; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score4; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score5; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + } + + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp b/LEGO1/lego/legoomni/src/build/helicopterstate.cpp deleted file mode 100644 index 1a9ca3fa..00000000 --- a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "helicopterstate.h" - -DECOMP_SIZE_ASSERT(HelicopterState, 0x0c) diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index f844aa08..ed32a3f2 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -1,6 +1,7 @@ #include "legocarbuild.h" DECOMP_SIZE_ASSERT(LegoCarBuild, 0x34c) +DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) // STUB: LEGO1 0x100226d0 LegoCarBuild::LegoCarBuild() @@ -61,3 +62,20 @@ MxBool LegoCarBuild::Escape() // TODO return FALSE; } + +// FUNCTION: LEGO1 0x10025f30 +LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) +{ + m_className = p_classType; + m_unk0x4c = 0; + m_unk0x4d = FALSE; + m_unk0x4e = FALSE; + m_placedPartCount = 0; +} + +// STUB: LEGO1 0x10026120 +MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp similarity index 94% rename from LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp rename to LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index d759364b..fddac82e 100644 --- a/LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -1,4 +1,4 @@ -#include "legocarbuildanimpresenter.h" +#include "legocarbuildpresenter.h" DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) diff --git a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp deleted file mode 100644 index 2e5df9ef..00000000 --- a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "legovehiclebuildstate.h" - -#include "decomp.h" - -DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) - -// FUNCTION: LEGO1 0x10025f30 -LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) -{ - this->m_className = p_classType; - this->m_unk0x4c = 0; - this->m_unk0x4d = FALSE; - this->m_unk0x4e = FALSE; - this->m_placedPartCount = 0; -} - -// STUB: LEGO1 0x10026120 -MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/common/animstate.cpp b/LEGO1/lego/legoomni/src/common/animstate.cpp deleted file mode 100644 index 24a0bf12..00000000 --- a/LEGO1/lego/legoomni/src/common/animstate.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "animstate.h" - -DECOMP_SIZE_ASSERT(AnimState, 0x1c) -DECOMP_SIZE_ASSERT(ModelInfo, 0x30) -DECOMP_SIZE_ASSERT(AnimInfo, 0x30) - -// FUNCTION: LEGO1 0x10064ff0 -AnimState::AnimState() -{ - m_unk0x0c = 0; - m_unk0x10 = NULL; - m_unk0x14 = 0; - m_unk0x18 = NULL; -} - -// STUB: LEGO1 0x10065150 -AnimState::~AnimState() -{ - // TODO -} - -// STUB: LEGO1 0x100651d0 -void AnimState::FUN_100651d0(MxU32, AnimInfo*, MxU32&) -{ - // TODO -} - -// STUB: LEGO1 0x10065240 -void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) -{ - // TODO -} - -// STUB: LEGO1 0x100652d0 -MxResult AnimState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// STUB: LEGO1 0x100654f0 -MxBool AnimState::SetFlag() -{ - // TODO - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index fde5a979..f1915ef9 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2,7 +2,6 @@ #include "3dmanager/lego3dmanager.h" #include "anim/legoanim.h" -#include "animstate.h" #include "define.h" #include "islepathactor.h" #include "legoanimmmpresenter.h" @@ -37,6 +36,9 @@ DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) DECOMP_SIZE_ASSERT(LegoAnimationManager::Vehicle, 0x08) DECOMP_SIZE_ASSERT(LegoAnimationManager::Extra, 0x18) DECOMP_SIZE_ASSERT(LegoTranInfo, 0x78) +DECOMP_SIZE_ASSERT(AnimState, 0x1c) +DECOMP_SIZE_ASSERT(AnimInfo, 0x30) +DECOMP_SIZE_ASSERT(ModelInfo, 0x30) // GLOBAL: LEGO1 0x100d8b28 MxU8 g_unk0x100d8b28[] = {0, 1, 2, 4, 8, 16}; @@ -2820,3 +2822,44 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) ); } } + +// FUNCTION: LEGO1 0x10064ff0 +AnimState::AnimState() +{ + m_unk0x0c = 0; + m_unk0x10 = NULL; + m_unk0x14 = 0; + m_unk0x18 = NULL; +} + +// STUB: LEGO1 0x10065150 +AnimState::~AnimState() +{ + // TODO +} + +// STUB: LEGO1 0x100651d0 +void AnimState::FUN_100651d0(MxU32, AnimInfo*, MxU32&) +{ + // TODO +} + +// STUB: LEGO1 0x10065240 +void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) +{ + // TODO +} + +// STUB: LEGO1 0x100652d0 +MxResult AnimState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// STUB: LEGO1 0x100654f0 +MxBool AnimState::SetFlag() +{ + // TODO + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 0f339590..b7882a3c 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1,7 +1,6 @@ #include "legogamestate.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "act2main_actions.h" #include "act3_actions.h" #include "carrace_actions.h" @@ -15,7 +14,7 @@ #include "helicopter.h" #include "histbook_actions.h" #include "hospital_actions.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "infodoor_actions.h" #include "infomain_actions.h" #include "infoscor_actions.h" diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index 46926705..23b0227e 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -7,27 +7,22 @@ #include "dunebuggy.h" #include "elevatorbottom.h" #include "gasstation.h" -#include "gasstationstate.h" #include "helicopter.h" -#include "helicopterstate.h" #include "historybook.h" #include "hospital.h" -#include "hospitalstate.h" #include "infocenter.h" #include "infocenterdoor.h" -#include "infocenterstate.h" #include "isle.h" #include "jetskirace.h" #include "lego3dwavepresenter.h" #include "legoact2.h" -#include "legoact2state.h" #include "legoactioncontrolpresenter.h" #include "legoactor.h" #include "legoactorpresenter.h" #include "legoanimactor.h" #include "legoanimpresenter.h" #include "legocarbuild.h" -#include "legocarbuildanimpresenter.h" +#include "legocarbuildpresenter.h" #include "legocarraceactor.h" #include "legoentity.h" #include "legoentitypresenter.h" @@ -51,52 +46,34 @@ #include "mxcontrolpresenter.h" #include "mxvideopresenter.h" #include "pizza.h" -#include "pizzamissionstate.h" #include "police.h" -#include "policestate.h" #include "registrationbook.h" #include "score.h" -#include "scorestate.h" #include "skateboard.h" // #include "act2genactor.h" #include "act2policestation.h" #include "act3.h" -#include "act3state.h" #include "ambulance.h" -#include "ambulancemissionstate.h" #include "bike.h" #include "doors.h" #include "jetski.h" +#include "legoanimationmanager.h" #include "legoanimmmpresenter.h" #include "motocycle.h" #include "racecar.h" #include "towtrack.h" -#include "towtrackmissionstate.h" // #include "act3cop.h" // #include "act3brickster.h" -#include "act1state.h" #include "act3actor.h" #include "act3shark.h" -#include "animstate.h" -#include "beachhouseentity.h" +#include "buildings.h" #include "bumpbouy.h" -#include "carracestate.h" #include "caveentity.h" -#include "gasstationentity.h" -#include "hospitalentity.h" -#include "infocenterentity.h" -#include "jailentity.h" -#include "jetskiracestate.h" #include "jukebox.h" #include "jukeboxentity.h" -#include "jukeboxstate.h" #include "mxcompositemediapresenter.h" #include "pizzeria.h" -#include "pizzeriastate.h" -#include "policeentity.h" #include "raceskel.h" -#include "racestandsentity.h" -#include "radiostate.h" // TODO: Before HospitalState, add all of the different LegoVehicleBuildState's diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index d769404e..8f9d9b12 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -1,8 +1,8 @@ #include "legoutils.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "anim/legoanim.h" +#include "isle.h" #include "islepathactor.h" #include "legoanimationmanager.h" #include "legoanimpresenter.h" diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 87274d00..70c2bb88 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -1,7 +1,7 @@ #include "legonavcontroller.h" #include "3dmanager/lego3dmanager.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "legoanimationmanager.h" #include "legocameracontroller.h" #include "legogamestate.h" diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp deleted file mode 100644 index aa14a197..00000000 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "gasstationentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(GasStationEntity, 0x68) - -// FUNCTION: LEGO1 0x100151d0 -MxLong GasStationEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - - if (state->GetUnknown18() != 8) { - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_garage); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp deleted file mode 100644 index 613a74eb..00000000 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "gasstationstate.h" - -DECOMP_SIZE_ASSERT(GasStationState, 0x24) - -// FUNCTION: LEGO1 0x10005eb0 -GasStationState::GasStationState() -{ - m_unk0x18 = 0; - m_unk0x1a = 0; - m_unk0x1c = 0; - m_unk0x1e = 0; - m_unk0x20 = 0; - - undefined4* unk0x08 = m_unk0x08; - unk0x08[0] = -1; - unk0x08[1] = -1; - unk0x08[2] = -1; -} - -// STUB: LEGO1 0x10006300 -MxResult GasStationState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// STUB: LEGO1 0x10006430 -void GasStationState::FUN_10006430(undefined4) -{ - // TODO -} - -// STUB: LEGO1 0x10006490 -void GasStationState::FUN_10006490() -{ - // TODO -} diff --git a/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp b/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp deleted file mode 100644 index 860bd0f0..00000000 --- a/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "ambulancemissionstate.h" - -DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) - -// FUNCTION: LEGO1 0x100373a0 -AmbulanceMissionState::AmbulanceMissionState() -{ - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x08 = 0; - m_unk0x16 = 0; - m_unk0x0c = 0; - m_unk0x18 = 0; - m_score1 = 0; - m_score2 = 0; - m_score3 = 0; - m_score4 = 0; - m_score5 = 0; -} - -// STUB: LEGO1 0x10037440 -MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp deleted file mode 100644 index b6c995d9..00000000 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "hospitalentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(HospitalEntity, 0x68) - -// FUNCTION: LEGO1 0x10015270 -MxLong HospitalEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); - - if (act1State->GetUnknown18() != 10) { - act1State->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_hospital); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp deleted file mode 100644 index da61f0fb..00000000 --- a/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "hospitalstate.h" - -DECOMP_SIZE_ASSERT(HospitalState, 0x18) - -// FUNCTION: LEGO1 0x10076370 -HospitalState::HospitalState() -{ - m_unk0x0c = 0; - m_unk0x0e = 0; - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x16 = 0; -} - -// FUNCTION: LEGO1 0x10076530 -MxResult HospitalState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsWriteMode()) { - // A write variable needs to be used here, otherwise - // the compiler aggresively optimizes the function - MxS16 write; - - write = m_unk0x0c; - p_legoFile->Write(&write, sizeof(m_unk0x0c)); - write = m_unk0x0e; - p_legoFile->Write(&write, sizeof(m_unk0x0e)); - write = m_unk0x10; - p_legoFile->Write(&write, sizeof(m_unk0x10)); - write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x14)); - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x16)); - } - else if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x0c, sizeof(m_unk0x0c)); - p_legoFile->Read(&m_unk0x0e, sizeof(m_unk0x0e)); - p_legoFile->Read(&m_unk0x10, sizeof(m_unk0x10)); - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); - } - - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp deleted file mode 100644 index 1928f1c7..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "infocenterentity.h" - -#include "act1state.h" -#include "act2main_actions.h" -#include "act3.h" -#include "act3_actions.h" -#include "act3state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoact2.h" -#include "legoact2state.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) - -// FUNCTION: LEGO1 0x100150c0 -MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) -{ - switch (GameState()->GetCurrentAct()) { - case LegoGameState::Act::e_act1: { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->FUN_10033350(); - isle->SetDestLocation(LegoGameState::Area::e_infomain); - - Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); - act1state->SetUnknown18(0); - break; - } - case LegoGameState::Act::e_act2: { - LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); - act2->SetUnknown0x1150(2); - - LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); - if (act2state) { - act2state->SetUnknown0x0c(0); - } - break; - } - case LegoGameState::Act::e_act3: - Act3* act3 = (Act3*) FindWorld(*g_act3Script, Act3Script::c__Act3); - act3->SetUnknown4270(2); - break; - } - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp deleted file mode 100644 index 0fd99839..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include "infocenterstate.h" - -#include "infocenter.h" -#include "infomain_actions.h" -#include "mxstillpresenter.h" - -DECOMP_SIZE_ASSERT(InfocenterState, 0x94) - -// GLOBAL: LEGO1 0x100f76a8 -InfomainScript::Script g_exitDialogueAct1[14] = { - InfomainScript::c_iic019in_RunAnim, - InfomainScript::c_iic020in_RunAnim, - InfomainScript::c_iic021in_RunAnim, - InfomainScript::c_iic022in_RunAnim, - InfomainScript::c_iic023in_RunAnim, - InfomainScript::c_iic024in_RunAnim, - InfomainScript::c_iic025in_RunAnim, - InfomainScript::c_iic026in_RunAnim, - InfomainScript::c_iic027in_RunAnim, - InfomainScript::c_iica28in_RunAnim, - InfomainScript::c_iicb28in_RunAnim, - InfomainScript::c_iicc28in_RunAnim, - InfomainScript::c_iic029in_RunAnim, - InfomainScript::c_iic032in_RunAnim -}; - -// GLOBAL: LEGO1 0x100f76e0 -InfomainScript::Script g_exitDialogueAct23[6] = { - InfomainScript::c_iic027in_RunAnim, - InfomainScript::c_iic029in_RunAnim, - InfomainScript::c_iic048in_RunAnim, - InfomainScript::c_iic056in_RunAnim, - InfomainScript::c_iicx23in_RunAnim - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f76f8 -InfomainScript::Script g_returnDialogueAct1[6] = { - InfomainScript::c_iicx26in_RunAnim, - InfomainScript::c_iic033in_RunAnim, - InfomainScript::c_iic034in_RunAnim, - InfomainScript::c_iic035in_RunAnim, - InfomainScript::c_iic036in_RunAnim - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7710 -InfomainScript::Script g_returnDialogueAct2[4] = { - InfomainScript::c_iic048in_RunAnim, - InfomainScript::c_iic049in_RunAnim, - InfomainScript::c_iic050in_RunAnim, - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7720 -InfomainScript::Script g_returnDialogueAct3[4] = { - InfomainScript::c_iic055in_RunAnim, - InfomainScript::c_iic056in_RunAnim, - InfomainScript::c_iic057in_RunAnim, - InfomainScript::c_iic058in_RunAnim -}; - -// GLOBAL: LEGO1 0x100f7730 -InfomainScript::Script g_leaveDialogueAct1[4] = { - InfomainScript::c_iic039in_PlayWav, - InfomainScript::c_iic040in_PlayWav, - InfomainScript::c_iic041in_PlayWav, - InfomainScript::c_iic042in_PlayWav -}; - -// GLOBAL: LEGO1 0x100f7740 -InfomainScript::Script g_leaveDialogueAct2[4] = { - InfomainScript::c_iic051in_PlayWav, - InfomainScript::c_iic052in_PlayWav, - InfomainScript::c_iic053in_PlayWav, - InfomainScript::c_iic054in_PlayWav -}; - -// GLOBAL: LEGO1 0x100f7750 -InfomainScript::Script g_leaveDialogueAct3[4] = { - InfomainScript::c_iic059in_PlayWav, - InfomainScript::c_iic060in_PlayWav, - InfomainScript::c_iic061in_PlayWav, - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7760 -InfomainScript::Script g_bricksterDialogue[2] = { - InfomainScript::c_sbleh2br_PlayWav, - InfomainScript::c_snshahbr_PlayWav -}; - -// FUNCTION: LEGO1 0x10071600 -InfocenterState::InfocenterState() -{ - m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, sizeOfArray(g_exitDialogueAct1)); - m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, sizeOfArray(g_exitDialogueAct23) - 1); - - m_returnDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_returnDialogueAct1, sizeOfArray(g_returnDialogueAct1) - 1); - - m_returnDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_returnDialogueAct2, sizeOfArray(g_returnDialogueAct2) - 1); - - m_returnDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_returnDialogueAct3, sizeOfArray(g_returnDialogueAct3)); - - m_leaveDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct1, sizeOfArray(g_leaveDialogueAct1)); - - m_leaveDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct2, sizeOfArray(g_leaveDialogueAct2)); - - m_leaveDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct3, sizeOfArray(g_leaveDialogueAct3) - 1); - - m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, sizeOfArray(g_bricksterDialogue)); - - memset(m_letters, 0, sizeof(m_letters)); -} - -// FUNCTION: LEGO1 0x10071920 -InfocenterState::~InfocenterState() -{ - MxS16 i = 0; - do { - if (GetNameLetter(i) != NULL) { - delete GetNameLetter(i)->GetAction(); - delete GetNameLetter(i); - } - i++; - } while (i < GetMaxNameLength()); -} diff --git a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp b/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp deleted file mode 100644 index e1b3522c..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "scorestate.h" - -DECOMP_SIZE_ASSERT(ScoreState, 0x0c) - -// FUNCTION: LEGO1 0x1000de20 -MxBool ScoreState::IsSerializable() -{ - return FALSE; -} - -// FUNCTION: LEGO1 0x1000de30 -MxBool ScoreState::SetFlag() -{ - m_playCubeTutorial = TRUE; - return TRUE; -} diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp deleted file mode 100644 index 1e7167dd..00000000 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "beachhouseentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(BeachHouseEntity, 0x68) - -// FUNCTION: LEGO1 0x100153b0 -MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp b/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp deleted file mode 100644 index 7efc9695..00000000 --- a/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "jukeboxstate.h" - -DECOMP_SIZE_ASSERT(JukeBoxState, 0x10) - -// FUNCTION: LEGO1 0x1000f300 -MxBool JukeBoxState::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/isle/radiostate.cpp b/LEGO1/lego/legoomni/src/isle/radiostate.cpp deleted file mode 100644 index 5927a94b..00000000 --- a/LEGO1/lego/legoomni/src/isle/radiostate.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "radiostate.h" - -#include "jukebox.h" -#include "jukebox_actions.h" -#include "mxmisc.h" -#include "mxtimer.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(RadioState, 0x30) - -// GLOBAL: LEGO1 0x100f3218 -JukeboxScript::Script g_unk0x100f3218[6] = { - JukeboxScript::c_sns002ra_Audio, - JukeboxScript::c_sns001ja_Audio, - JukeboxScript::c_snsc01js_Audio, - JukeboxScript::c_snsb01js_Audio, - JukeboxScript::c_snsa01js_Audio, - JukeboxScript::c_sns009ra_Audio -}; - -// GLOBAL: LEGO1 0x100f3230 -JukeboxScript::Script g_unk0x100f3230[14] = { - JukeboxScript::c_ham035ra_Audio, - JukeboxScript::c_ham039ra_Audio, - JukeboxScript::c_sns005ra_Audio, - JukeboxScript::c_sns078pa_Audio, - JukeboxScript::c_ham036ra_Audio, - JukeboxScript::c_sns006ra_Audio, - JukeboxScript::c_sns013ra_Audio, - JukeboxScript::c_sns004ra_Audio, - JukeboxScript::c_sns079pa_Audio, - JukeboxScript::c_sns007ra_Audio, - JukeboxScript::c_sns008ra_Audio, - JukeboxScript::c_hpz037ma_Audio, - JukeboxScript::c_sns003ra_Audio, - JukeboxScript::c_sns010ra_Audio, -}; - -// GLOBAL: LEGO1 0x100f3268 -JukeboxScript::Script g_unk0x100f3268[9] = { - JukeboxScript::c_CentralRoads_Music, - JukeboxScript::c_BeachBlvd_Music, - JukeboxScript::c_ResidentalArea_Music, - JukeboxScript::c_Radio1_Music, - JukeboxScript::c_Radio2_Music, - JukeboxScript::c_Radio3_Music, - JukeboxScript::c_Radio4_Music, - JukeboxScript::c_Radio5_Music, - JukeboxScript::c_Radio6_Music, -}; - -// FUNCTION: LEGO1 0x1002ce10 -RadioState::RadioState() -{ - srand(Timer()->GetTime()); - - MxS32 random = rand(); - m_unk0x2c = random % 3; - - m_unk0x08[0] = LegoState::Playlist((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])); - m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]))); - - m_unk0x08[1] = LegoState::Playlist((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])); - m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]))); - - m_unk0x08[2] = LegoState::Playlist((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])); - m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]))); - - m_active = FALSE; -} - -// FUNCTION: LEGO1 0x1002cf50 -MxBool RadioState::IsSerializable() -{ - return FALSE; -} - -// FUNCTION: LEGO1 0x1002d090 -MxU32 RadioState::FUN_1002d090() -{ - if (m_unk0x2c == 2) { - m_unk0x2c = 0; - } - else { - m_unk0x2c++; - } - - return m_unk0x08[m_unk0x2c].Next(); -} - -// FUNCTION: LEGO1 0x1002d0c0 -MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId) -{ - if (*g_jukeboxScript == p_atom) { - for (MxS16 i = 0; i < 3; i++) { - if (m_unk0x08[i].Contains(p_objectId)) { - return TRUE; - } - } - } - - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index db2cc767..d15d083b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -1,8 +1,8 @@ #include "legopathstruct.h" #include "isle.h" +#include "jukebox.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "legohideanimpresenter.h" #include "legopathactor.h" #include "legoutils.h" diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp deleted file mode 100644 index 543a5152..00000000 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "pizzamissionstate.h" - -DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20) -DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) - -// STUB: LEGO1 0x100393c0 -MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// FUNCTION: LEGO1 0x10039510 -PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id) -{ - for (MxS16 i = 0; i < 5; i++) { - if (m_state[i].m_id == p_id) { - return m_state + i; - } - } - - return NULL; -} diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp deleted file mode 100644 index 3271c3d6..00000000 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "pizzeriastate.h" - -DECOMP_SIZE_ASSERT(PizzeriaState, 0x58) - -// STUB: LEGO1 0x10017af0 -PizzeriaState::PizzeriaState() -{ - // TODO -} - -// STUB: LEGO1 0x10017d70 -MxU32 PizzeriaState::FUN_10017d70() -{ - return 0; -} - -// STUB: LEGO1 0x10017da0 -MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp deleted file mode 100644 index a9090b61..00000000 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "policeentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) - -// FUNCTION: LEGO1 0x10015310 -MxLong PoliceEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - - if (state->GetUnknown18() != 10) { - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_police); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/police/policestate.cpp b/LEGO1/lego/legoomni/src/police/policestate.cpp deleted file mode 100644 index c0a6e716..00000000 --- a/LEGO1/lego/legoomni/src/police/policestate.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "policestate.h" - -#include "islepathactor.h" -#include "misc.h" -#include "mxdsaction.h" -#include "mxmisc.h" -#include "police.h" -#include "police_actions.h" -#include "scripts.h" - -#include - -DECOMP_SIZE_ASSERT(PoliceState, 0x10) - -// FUNCTION: LEGO1 0x1005e7c0 -PoliceState::PoliceState() -{ - m_unk0x0c = 0; - m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim; -} - -// FUNCTION: LEGO1 0x1005e990 -MxResult PoliceState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_policeScript, sizeof(m_policeScript)); - } - else { - PoliceScript::Script policeScript = m_policeScript; - p_legoFile->Write(&policeScript, sizeof(m_policeScript)); - } - - return SUCCESS; -} - -// FUNCTION: LEGO1 0x1005ea40 -void PoliceState::FUN_1005ea40() -{ - PoliceScript::Script policeScript; - - if (m_unk0x0c == 1) { - return; - } - - switch (CurrentActor()->GetActorId()) { - case 4: - policeScript = PoliceScript::c_nps002la_RunAnim; - m_policeScript = policeScript; - break; - case 5: - policeScript = PoliceScript::c_nps001ni_RunAnim; - m_policeScript = policeScript; - break; - default: - policeScript = m_policeScript; - m_policeScript = policeScript == PoliceScript::c_nps002la_RunAnim ? PoliceScript::c_nps001ni_RunAnim - : PoliceScript::c_nps002la_RunAnim; - } - - { - MxDSAction action; - action.SetObjectId(policeScript); - action.SetAtomId(*g_policeScript); - Start(&action); - } - - m_unk0x0c = 1; -} diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index c7959fc7..a2204345 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -4,6 +4,9 @@ #include "mxnotificationmanager.h" DECOMP_SIZE_ASSERT(LegoRace, 0x144) +DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06) +// TODO: Must be 0x2c but current structure is incorrect +// DECOMP_SIZE_ASSERT(RaceState, 0x2c) // FUNCTION: LEGO1 0x1000dab0 undefined4 LegoRace::VTable0x78(undefined4) @@ -87,3 +90,30 @@ void LegoRace::Enable(MxBool p_enable) { // TODO } + +// STUB: LEGO1 0x10015f30 +RaceState::RaceState() +{ + // TODO +} + +// STUB: LEGO1 0x10016140 +MxResult RaceState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// FUNCTION: LEGO1 0x10016280 +RaceState::Entry* RaceState::GetState(MxU8 p_id) +{ + for (MxS16 i = 0;; i++) { + if (i >= 5) { + return NULL; + } + + if (m_state[i].m_id == p_id) { + return m_state + i; + } + } +} diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp deleted file mode 100644 index 8cceb324..00000000 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "racestandsentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) - -// FUNCTION: LEGO1 0x10015450 -MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/race/racestate.cpp b/LEGO1/lego/legoomni/src/race/racestate.cpp deleted file mode 100644 index 897190f7..00000000 --- a/LEGO1/lego/legoomni/src/race/racestate.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "racestate.h" - -DECOMP_SIZE_ASSERT(RaceStateEntry, 0x06) - -// TODO: Must be 0x2c but current structure is incorrect -// DECOMP_SIZE_ASSERT(RaceState, 0x2c) - -// STUB: LEGO1 0x10015f30 -RaceState::RaceState() -{ - // TODO -} - -// STUB: LEGO1 0x10016140 -MxResult RaceState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// FUNCTION: LEGO1 0x10016280 -RaceStateEntry* RaceState::GetState(MxU8 p_id) -{ - for (MxS16 i = 0;; i++) { - if (i >= 5) { - return NULL; - } - - if (m_state[i].m_id == p_id) { - return m_state + i; - } - } -} diff --git a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp b/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp deleted file mode 100644 index bbf080ff..00000000 --- a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "towtrackmissionstate.h" - -DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28) - -// FUNCTION: LEGO1 0x1004dd30 -TowTrackMissionState::TowTrackMissionState() -{ - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x16 = 0; - m_unk0x08 = 0; - m_unk0x18 = 0; - m_unk0x0c = 0; - m_unk0x1a = 0; - m_unk0x10 = 0; - m_score1 = 0; - m_score2 = 0; - m_score3 = 0; - m_score4 = 0; - m_score5 = 0; -} - -// FUNCTION: LEGO1 0x1004dde0 -MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); - p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); - p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); - p_legoFile->Read(&m_score1, sizeof(m_score1)); - p_legoFile->Read(&m_score2, sizeof(m_score2)); - p_legoFile->Read(&m_score3, sizeof(m_score3)); - p_legoFile->Read(&m_score4, sizeof(m_score4)); - p_legoFile->Read(&m_score5, sizeof(m_score5)); - } - else if (p_legoFile->IsWriteMode()) { - MxU16 write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x18; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x1a; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score1; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score2; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score3; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score4; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score5; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - } - - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 98f789da..c8ec77c3 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -1,6 +1,7 @@ #include "act3.h" DECOMP_SIZE_ASSERT(Act3, 0x4274) +DECOMP_SIZE_ASSERT(Act3State, 0x0c) // STUB: LEGO1 0x10072270 Act3::Act3() diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 219fcf79..3b8381da 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -1,7 +1,7 @@ #include "elevatorbottom.h" -#include "act1state.h" #include "elevbott_actions.h" +#include "isle.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 5f48e5f0..82ef467b 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -1,7 +1,6 @@ #include "gasstation.h" #include "garage_actions.h" -#include "gasstationstate.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" @@ -21,6 +20,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(GasStation, 0x128) +DECOMP_SIZE_ASSERT(GasStationState, 0x24) // GLOBAL: LEGO1 0x100f0160 undefined4 g_unk0x100f0160 = 3; @@ -419,3 +419,37 @@ MxBool GasStation::Escape() m_destLocation = LegoGameState::Area::e_infomain; return TRUE; } + +// FUNCTION: LEGO1 0x10005eb0 +GasStationState::GasStationState() +{ + m_unk0x18 = 0; + m_unk0x1a = 0; + m_unk0x1c = 0; + m_unk0x1e = 0; + m_unk0x20 = 0; + + undefined4* unk0x08 = m_unk0x08; + unk0x08[0] = -1; + unk0x08[1] = -1; + unk0x08[2] = -1; +} + +// STUB: LEGO1 0x10006300 +MxResult GasStationState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// STUB: LEGO1 0x10006430 +void GasStationState::FUN_10006430(undefined4) +{ + // TODO +} + +// STUB: LEGO1 0x10006490 +void GasStationState::FUN_10006490() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index d62baa21..c715bcf6 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -1,8 +1,7 @@ #include "hospital.h" -#include "act1state.h" #include "hospital_actions.h" -#include "hospitalstate.h" +#include "isle.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" @@ -22,6 +21,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Hospital, 0x12c) +DECOMP_SIZE_ASSERT(HospitalState, 0x18) // GLOBAL: LEGO1 0x100f7918 undefined4 g_unk0x100f7918 = 3; @@ -671,3 +671,49 @@ MxBool Hospital::Escape() return TRUE; } + +// FUNCTION: LEGO1 0x10076370 +HospitalState::HospitalState() +{ + m_unk0x0c = 0; + m_unk0x0e = 0; + m_unk0x10 = 0; + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x16 = 0; +} + +// FUNCTION: LEGO1 0x10076530 +MxResult HospitalState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsWriteMode()) { + // A write variable needs to be used here, otherwise + // the compiler aggresively optimizes the function + MxS16 write; + + write = m_unk0x0c; + p_legoFile->Write(&write, sizeof(m_unk0x0c)); + write = m_unk0x0e; + p_legoFile->Write(&write, sizeof(m_unk0x0e)); + write = m_unk0x10; + p_legoFile->Write(&write, sizeof(m_unk0x10)); + write = m_unk0x12; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + write = m_unk0x14; + p_legoFile->Write(&write, sizeof(m_unk0x14)); + write = m_unk0x16; + p_legoFile->Write(&write, sizeof(m_unk0x16)); + } + else if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_unk0x0c, sizeof(m_unk0x0c)); + p_legoFile->Read(&m_unk0x0e, sizeof(m_unk0x0e)); + p_legoFile->Read(&m_unk0x10, sizeof(m_unk0x10)); + p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); + p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); + p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + } + + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index af05132d..f8a1426d 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1,13 +1,12 @@ #include "infocenter.h" -#include "act3state.h" +#include "act3.h" #include "credits_actions.h" -#include "helicopterstate.h" -#include "infocenterstate.h" +#include "helicopter.h" #include "infomain_actions.h" #include "jukebox.h" #include "jukebox_actions.h" -#include "legoact2state.h" +#include "legoact2.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legocharactermanager.h" @@ -29,13 +28,13 @@ #include "mxticklemanager.h" #include "mxtransitionmanager.h" #include "mxutilities.h" -#include "radiostate.h" #include "scripts.h" #include "sndanim_actions.h" #include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(Infocenter, 0x1d8) DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18) +DECOMP_SIZE_ASSERT(InfocenterState, 0x94) // GLOBAL: LEGO1 0x100f76a0 const char* g_object2x4red = "2x4red"; @@ -43,6 +42,90 @@ const char* g_object2x4red = "2x4red"; // GLOBAL: LEGO1 0x100f76a4 const char* g_object2x4grn = "2x4grn"; +// GLOBAL: LEGO1 0x100f76a8 +InfomainScript::Script g_exitDialogueAct1[14] = { + InfomainScript::c_iic019in_RunAnim, + InfomainScript::c_iic020in_RunAnim, + InfomainScript::c_iic021in_RunAnim, + InfomainScript::c_iic022in_RunAnim, + InfomainScript::c_iic023in_RunAnim, + InfomainScript::c_iic024in_RunAnim, + InfomainScript::c_iic025in_RunAnim, + InfomainScript::c_iic026in_RunAnim, + InfomainScript::c_iic027in_RunAnim, + InfomainScript::c_iica28in_RunAnim, + InfomainScript::c_iicb28in_RunAnim, + InfomainScript::c_iicc28in_RunAnim, + InfomainScript::c_iic029in_RunAnim, + InfomainScript::c_iic032in_RunAnim +}; + +// GLOBAL: LEGO1 0x100f76e0 +InfomainScript::Script g_exitDialogueAct23[6] = { + InfomainScript::c_iic027in_RunAnim, + InfomainScript::c_iic029in_RunAnim, + InfomainScript::c_iic048in_RunAnim, + InfomainScript::c_iic056in_RunAnim, + InfomainScript::c_iicx23in_RunAnim + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f76f8 +InfomainScript::Script g_returnDialogueAct1[6] = { + InfomainScript::c_iicx26in_RunAnim, + InfomainScript::c_iic033in_RunAnim, + InfomainScript::c_iic034in_RunAnim, + InfomainScript::c_iic035in_RunAnim, + InfomainScript::c_iic036in_RunAnim + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7710 +InfomainScript::Script g_returnDialogueAct2[4] = { + InfomainScript::c_iic048in_RunAnim, + InfomainScript::c_iic049in_RunAnim, + InfomainScript::c_iic050in_RunAnim, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7720 +InfomainScript::Script g_returnDialogueAct3[4] = { + InfomainScript::c_iic055in_RunAnim, + InfomainScript::c_iic056in_RunAnim, + InfomainScript::c_iic057in_RunAnim, + InfomainScript::c_iic058in_RunAnim +}; + +// GLOBAL: LEGO1 0x100f7730 +InfomainScript::Script g_leaveDialogueAct1[4] = { + InfomainScript::c_iic039in_PlayWav, + InfomainScript::c_iic040in_PlayWav, + InfomainScript::c_iic041in_PlayWav, + InfomainScript::c_iic042in_PlayWav +}; + +// GLOBAL: LEGO1 0x100f7740 +InfomainScript::Script g_leaveDialogueAct2[4] = { + InfomainScript::c_iic051in_PlayWav, + InfomainScript::c_iic052in_PlayWav, + InfomainScript::c_iic053in_PlayWav, + InfomainScript::c_iic054in_PlayWav +}; + +// GLOBAL: LEGO1 0x100f7750 +InfomainScript::Script g_leaveDialogueAct3[4] = { + InfomainScript::c_iic059in_PlayWav, + InfomainScript::c_iic060in_PlayWav, + InfomainScript::c_iic061in_PlayWav, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7760 +InfomainScript::Script g_bricksterDialogue[2] = { + InfomainScript::c_sbleh2br_PlayWav, + InfomainScript::c_snshahbr_PlayWav +}; + // FUNCTION: LEGO1 0x1006ea20 Infocenter::Infocenter() { @@ -1462,3 +1545,45 @@ void Infocenter::StopBookAnimation() action.SetUnknown24(-2); DeleteObject(action); } + +// FUNCTION: LEGO1 0x10071600 +InfocenterState::InfocenterState() +{ + m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, sizeOfArray(g_exitDialogueAct1)); + m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, sizeOfArray(g_exitDialogueAct23) - 1); + + m_returnDialogue[LegoGameState::e_act1] = + LegoState::Playlist((MxU32*) g_returnDialogueAct1, sizeOfArray(g_returnDialogueAct1) - 1); + + m_returnDialogue[LegoGameState::e_act2] = + LegoState::Playlist((MxU32*) g_returnDialogueAct2, sizeOfArray(g_returnDialogueAct2) - 1); + + m_returnDialogue[LegoGameState::e_act3] = + LegoState::Playlist((MxU32*) g_returnDialogueAct3, sizeOfArray(g_returnDialogueAct3)); + + m_leaveDialogue[LegoGameState::e_act1] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct1, sizeOfArray(g_leaveDialogueAct1)); + + m_leaveDialogue[LegoGameState::e_act2] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct2, sizeOfArray(g_leaveDialogueAct2)); + + m_leaveDialogue[LegoGameState::e_act3] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct3, sizeOfArray(g_leaveDialogueAct3) - 1); + + m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, sizeOfArray(g_bricksterDialogue)); + + memset(m_letters, 0, sizeof(m_letters)); +} + +// FUNCTION: LEGO1 0x10071920 +InfocenterState::~InfocenterState() +{ + MxS16 i = 0; + do { + if (GetNameLetter(i) != NULL) { + delete GetNameLetter(i)->GetAction(); + delete GetNameLetter(i); + } + i++; + } while (i < GetMaxNameLength()); +} diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index d433c337..a4afe604 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -1,6 +1,6 @@ #include "infocenterdoor.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "infodoor_actions.h" #include "jukebox.h" #include "jukebox_actions.h" diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 2d5fee23..f643cc94 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1,16 +1,15 @@ #include "isle.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "ambulance.h" #include "bike.h" -#include "carracestate.h" +#include "carrace.h" #include "dunebuggy.h" #include "helicopter.h" #include "isle_actions.h" #include "islepathactor.h" #include "jetski.h" -#include "jetskiracestate.h" +#include "jetskirace.h" #include "jukebox_actions.h" #include "jukeboxentity.h" #include "legoanimationmanager.h" @@ -18,6 +17,7 @@ #include "legocontrolmanager.h" #include "legoinputmanager.h" #include "legomain.h" +#include "legonamedtexture.h" #include "legoutils.h" #include "legovariables.h" #include "legovideomanager.h" @@ -37,11 +37,20 @@ #include "skateboard.h" #include "towtrack.h" +DECOMP_SIZE_ASSERT(Act1State, 0x26c) +DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c) DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 MxU32 g_isleFlags = 0x7f; +// GLOBAL: ISLE 0x100f37f0 +MxS32 g_unk0x100f37f0[] = { + Act1State::e_unk953, + Act1State::e_unk954, + Act1State::e_unk955, +}; + // FUNCTION: LEGO1 0x10030820 Isle::Isle() { @@ -1271,3 +1280,283 @@ void Isle::FUN_10033350() m_destLocation = LegoGameState::e_infomain; } + +// STUB: LEGO1 0x100334b0 +Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0) +{ + m_unk0x01e = FALSE; + m_unk0x018 = 1; + m_unk0x010 = 0; + m_planeActive = FALSE; + m_unk0x00e = 0; + m_unk0x01f = FALSE; + m_unk0x008 = g_unk0x100f37f0; + m_unk0x014 = -1; + m_unk0x022 = FALSE; + m_unk0x154 = NULL; + m_unk0x158 = NULL; + m_unk0x15c = NULL; + m_unk0x160 = NULL; + m_unk0x1b0 = NULL; + m_unk0x021 = 1; + m_elevFloor = Act1State::c_floor1; + m_unk0x00c = sizeOfArray(g_unk0x100f37f0); + m_unk0x1b4 = NULL; + m_unk0x1b8 = NULL; + m_unk0x208 = NULL; + m_unk0x20c = NULL; + m_unk0x25c = NULL; + m_unk0x260 = NULL; + m_unk0x264 = NULL; + m_unk0x268 = NULL; + SetFlag(); +} + +// FUNCTION: LEGO1 0x10033ac0 +MxResult Act1State::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + m_unk0x024.Serialize(p_legoFile); + m_unk0x070.Serialize(p_legoFile); + m_unk0x0bc.Serialize(p_legoFile); + m_unk0x108.Serialize(p_legoFile); + m_unk0x164.Serialize(p_legoFile); + m_unk0x1bc.Serialize(p_legoFile); + m_unk0x210.Serialize(p_legoFile); + + if (p_legoFile->IsWriteMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + if (m_unk0x154) { + WriteNamedTexture(p_legoFile, m_unk0x154); + } + else { + FUN_1003f540(p_legoFile, "chwind.gif"); + } + if (m_unk0x158) { + WriteNamedTexture(p_legoFile, m_unk0x158); + } + else { + FUN_1003f540(p_legoFile, "chjetl.gif"); + } + if (m_unk0x15c) { + WriteNamedTexture(p_legoFile, m_unk0x15c); + } + else { + FUN_1003f540(p_legoFile, "chjetr.gif"); + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + if (m_unk0x1b0) { + WriteNamedTexture(p_legoFile, m_unk0x1b0); + } + else { + FUN_1003f540(p_legoFile, "jsfrnt.gif"); + } + if (m_unk0x1b4) { + WriteNamedTexture(p_legoFile, m_unk0x1b4); + } + else { + FUN_1003f540(p_legoFile, "jswnsh.gif"); + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + if (m_unk0x208) { + WriteNamedTexture(p_legoFile, m_unk0x208); + } + else { + FUN_1003f540(p_legoFile, "dbfrfn.gif"); + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + if (m_unk0x25c) { + WriteNamedTexture(p_legoFile, m_unk0x25c); + } + else { + FUN_1003f540(p_legoFile, "rcfrnt.gif"); + } + if (m_unk0x260) { + WriteNamedTexture(p_legoFile, m_unk0x260); + } + else { + FUN_1003f540(p_legoFile, "rcback.gif"); + } + if (m_unk0x264) { + WriteNamedTexture(p_legoFile, m_unk0x264); + } + else { + FUN_1003f540(p_legoFile, "rctail.gif"); + } + } + + p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); + } + else if (p_legoFile->IsReadMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + m_unk0x154 = ReadNamedTexture(p_legoFile); + if (m_unk0x154 == NULL) { + return FAILURE; + } + + m_unk0x158 = ReadNamedTexture(p_legoFile); + if (m_unk0x158 == NULL) { + return FAILURE; + } + + m_unk0x15c = ReadNamedTexture(p_legoFile); + if (m_unk0x15c == NULL) { + return FAILURE; + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + m_unk0x1b0 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b0 == NULL) { + return FAILURE; + } + + m_unk0x1b4 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b4 == NULL) { + return FAILURE; + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + m_unk0x208 = ReadNamedTexture(p_legoFile); + if (m_unk0x208 == NULL) { + return FAILURE; + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + m_unk0x25c = ReadNamedTexture(p_legoFile); + if (m_unk0x25c == NULL) { + return FAILURE; + } + + m_unk0x260 = ReadNamedTexture(p_legoFile); + if (m_unk0x260 == NULL) { + return FAILURE; + } + + m_unk0x264 = ReadNamedTexture(p_legoFile); + if (m_unk0x264 == NULL) { + return FAILURE; + } + } + + p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); + } + + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10034660 +void Act1State::FUN_10034660() +{ + // TODO +} + +// FUNCTION: LEGO1 0x100346a0 +void Act1State::FUN_100346a0() +{ + if (m_unk0x014 != -1) { + InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL); + m_unk0x014 = -1; + } +} + +// FUNCTION: LEGO1 0x100346d0 +MxBool Act1State::SetFlag() +{ + m_unk0x024.SetName(""); + m_unk0x070.SetName(""); + m_unk0x0bc.SetName(""); + m_unk0x022 = FALSE; + m_unk0x108.SetName(""); + + if (m_unk0x154) { + delete m_unk0x154; + m_unk0x154 = NULL; + } + + if (m_unk0x158) { + delete m_unk0x158; + m_unk0x158 = NULL; + } + + if (m_unk0x15c) { + delete m_unk0x15c; + m_unk0x15c = NULL; + } + + if (m_unk0x160) { + delete m_unk0x160; + m_unk0x160 = NULL; + } + + m_unk0x164.SetName(""); + + if (m_unk0x1b0) { + delete m_unk0x1b0; + m_unk0x1b0 = NULL; + } + + if (m_unk0x1b4) { + delete m_unk0x1b4; + m_unk0x1b4 = NULL; + } + + if (m_unk0x1b8) { + delete m_unk0x1b8; + m_unk0x1b8 = NULL; + } + + m_unk0x1bc.SetName(""); + + if (m_unk0x208) { + delete m_unk0x208; + m_unk0x208 = NULL; + } + + if (m_unk0x20c) { + delete m_unk0x20c; + m_unk0x20c = NULL; + } + + m_unk0x210.SetName(""); + + if (m_unk0x25c) { + delete m_unk0x25c; + m_unk0x25c = NULL; + } + + if (m_unk0x260) { + delete m_unk0x260; + m_unk0x260 = NULL; + } + + if (m_unk0x264) { + delete m_unk0x264; + m_unk0x264 = NULL; + } + + if (m_unk0x268) { + delete m_unk0x268; + m_unk0x268 = NULL; + } + + return TRUE; +} + +// STUB: LEGO1 0x10034b60 +void Act1State::FUN_10034b60() +{ + // TODO +} + +// STUB: LEGO1 0x10034d00 +void Act1State::FUN_10034d00() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 5cb59794..57c30be3 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -1,8 +1,7 @@ #include "jukebox.h" -#include "act1state.h" +#include "isle.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "jukeboxw_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -17,6 +16,7 @@ #include "mxvideopresenter.h" DECOMP_SIZE_ASSERT(JukeBox, 0x104) +DECOMP_SIZE_ASSERT(JukeBoxState, 0x10) // FUNCTION: LEGO1 0x1005d660 JukeBox::JukeBox() diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index cc108d10..eb44f2b0 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1,6 +1,7 @@ #include "legoact2.h" DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) +DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) // FUNCTION: LEGO1 0x1004fe10 MxBool LegoAct2::VTable0x5c() diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index 897fa52c..a20f5163 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -13,9 +13,10 @@ #include "mxnotificationmanager.h" #include "mxtransitionmanager.h" #include "police_actions.h" -#include "policestate.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Police, 0x110) +DECOMP_SIZE_ASSERT(PoliceState, 0x10) // FUNCTION: LEGO1 0x1005e130 Police::Police() @@ -196,3 +197,60 @@ MxBool Police::Escape() m_destLocation = LegoGameState::e_infomain; return TRUE; } + +// FUNCTION: LEGO1 0x1005e7c0 +PoliceState::PoliceState() +{ + m_unk0x0c = 0; + m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim; +} + +// FUNCTION: LEGO1 0x1005e990 +MxResult PoliceState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_policeScript, sizeof(m_policeScript)); + } + else { + PoliceScript::Script policeScript = m_policeScript; + p_legoFile->Write(&policeScript, sizeof(m_policeScript)); + } + + return SUCCESS; +} + +// FUNCTION: LEGO1 0x1005ea40 +void PoliceState::FUN_1005ea40() +{ + PoliceScript::Script policeScript; + + if (m_unk0x0c == 1) { + return; + } + + switch (CurrentActor()->GetActorId()) { + case 4: + policeScript = PoliceScript::c_nps002la_RunAnim; + m_policeScript = policeScript; + break; + case 5: + policeScript = PoliceScript::c_nps001ni_RunAnim; + m_policeScript = policeScript; + break; + default: + policeScript = m_policeScript; + m_policeScript = policeScript == PoliceScript::c_nps002la_RunAnim ? PoliceScript::c_nps001ni_RunAnim + : PoliceScript::c_nps002la_RunAnim; + } + + { + MxDSAction action; + action.SetObjectId(policeScript); + action.SetAtomId(*g_policeScript); + Start(&action); + } + + m_unk0x0c = 1; +} diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 803074d8..414f4faa 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -1,6 +1,6 @@ #include "registrationbook.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index a4ff3621..1482e253 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -1,9 +1,10 @@ #include "score.h" -#include "ambulancemissionstate.h" -#include "carracestate.h" +#include "ambulance.h" +#include "carrace.h" #include "infoscor_actions.h" -#include "jetskiracestate.h" +#include "jetski.h" +#include "jetskirace.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" @@ -17,13 +18,12 @@ #include "mxnotificationmanager.h" #include "mxnotificationparam.h" #include "mxtransitionmanager.h" -#include "pizzamissionstate.h" -#include "racestate.h" -#include "scorestate.h" +#include "pizza.h" #include "scripts.h" -#include "towtrackmissionstate.h" +#include "towtrack.h" DECOMP_SIZE_ASSERT(Score, 0x104) +DECOMP_SIZE_ASSERT(ScoreState, 0x0c) // FUNCTION: LEGO1 0x10001000 Score::Score() From 4898a55508d5a51c88840271685a6811fca051b8 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 4 Jun 2024 12:05:01 -0400 Subject: [PATCH 16/26] Match LegoCacheSoundManager::FindSoundByKey (#991) * Match LegoCacheSoundManager::FindSoundByKey * Remove space --- .../src/audio/legocachesoundmanager.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index 36445ce7..c18d5dcb 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -60,18 +60,15 @@ MxResult LegoCacheSoundManager::Tickle() return SUCCESS; } -// STUB: LEGO1 0x1003d170 +// FUNCTION: LEGO1 0x1003d170 LegoCacheSound* LegoCacheSoundManager::FindSoundByKey(const char* p_key) { - // TODO - char* x = new char[strlen(p_key) + 1]; - strcpy(x, p_key); + char* key = new char[strlen(p_key) + 1]; + strcpy(key, p_key); - Set100d6b4c::iterator setIter; - for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { - if (!strcmpi((*setIter).GetName(), x)) { - return (*setIter).GetSound(); - } + Set100d6b4c::iterator it = m_set.find(LegoCacheSoundEntry(NULL, key)); + if (it != m_set.end()) { + return (*it).GetSound(); } return NULL; @@ -104,12 +101,14 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) } // FUNCTION: LEGO1 0x1003dae0 +// FUNCTION: BETA10 0x10065502 LegoCacheSound* LegoCacheSoundManager::Play(const char* p_key, const char* p_name, MxBool p_looping) { return Play(FindSoundByKey(p_key), p_name, p_looping); } // FUNCTION: LEGO1 0x1003db10 +// FUNCTION: BETA10 0x10065537 LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping) { if (!p_sound) { From 0c7c77aad37ed2af1ac7c99fbc9ba7cb8c9715f9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 4 Jun 2024 12:19:59 -0400 Subject: [PATCH 17/26] Implement/match LegoActor::Mute (#992) --- LEGO1/lego/legoomni/include/legoactor.h | 2 +- LEGO1/lego/legoomni/include/legocachsound.h | 3 ++- .../lego/legoomni/src/audio/legocachsound.cpp | 20 +++++++++++++++++-- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 10 ++++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 267de5a0..026f5885 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -53,7 +53,7 @@ class LegoActor : public LegoEntity { static const char* GetActorName(MxU8 p_id); protected: - void FUN_1002d6e0(MxBool); + void Mute(MxBool p_muted); MxFloat m_frequencyFactor; // 0x68 LegoCacheSound* m_sound; // 0x6c diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index b80ded36..de312a93 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -44,6 +44,7 @@ class LegoCacheSound : public MxCore { void FUN_10006b80(); void FUN_10006be0(); void SetDistance(MxS32 p_min, MxS32 p_max); + void Mute(MxBool p_mute); // SYNTHETIC: LEGO1 0x10006610 // LegoCacheSound::`scalar deleting destructor' @@ -66,7 +67,7 @@ class LegoCacheSound : public MxCore { MxS32 m_volume; // 0x6c MxBool m_unk0x70; // 0x70 MxString m_unk0x74; // 0x74 - undefined m_unk0x84; // 0x84 + MxBool m_muted; // 0x84 }; #endif // LEGOCACHSOUND_H diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 457e51f4..7665e5d7 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -29,7 +29,7 @@ void LegoCacheSound::Init() m_unk0x70 = FALSE; m_looping = TRUE; m_volume = 79; - m_unk0x84 = 0; + m_muted = FALSE; } // FUNCTION: LEGO1 0x10006710 @@ -226,7 +226,7 @@ void LegoCacheSound::FUN_10006be0() } } - if (m_unk0x74.GetLength() != 0 && !m_unk0x84) { + if (m_unk0x74.GetLength() != 0 && !m_muted) { if (!m_sound.UpdatePosition(m_dsBuffer)) { if (m_unk0x6a) { return; @@ -253,6 +253,22 @@ void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) { } +// FUNCTION: LEGO1 0x10006d40 +// FUNCTION: BETA10 0x10066ec8 +void LegoCacheSound::Mute(MxBool p_muted) +{ + if (m_muted != p_muted) { + m_muted = p_muted; + + if (m_muted) { + m_dsBuffer->Stop(); + } + else { + m_dsBuffer->Play(0, 0, m_looping); + } + } +} + // FUNCTION: LEGO1 0x10006d80 // FUNCTION: BETA10 0x100670e7 MxString LegoCacheSound::FUN_10006d80(const MxString& p_str) diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index d7d79e1a..2377302e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -107,7 +107,7 @@ void LegoActor::ParseAction(char* p_extra) } if (KeyValueStringParse(value, g_strMUTE, p_extra)) { - FUN_1002d6e0(TRUE); + Mute(TRUE); } if (KeyValueStringParse(value, g_strVISIBILITY, p_extra)) { @@ -139,8 +139,10 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) LegoEntity::SetROI(p_roi, p_bool1, p_bool2); } -// STUB: LEGO1 0x1002d6e0 -void LegoActor::FUN_1002d6e0(MxBool) +// FUNCTION: LEGO1 0x1002d6e0 +void LegoActor::Mute(MxBool p_muted) { - // TODO + if (m_sound != NULL) { + m_sound->Mute(p_muted); + } } From 6e7e9a3f20e73e1791ca8488e37368f8d873ff52 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 06:31:23 -0400 Subject: [PATCH 18/26] Add more annotations to ISLE (#990) * Minor improvements in ISLE.EXE * Add more annotations * Fix * Comment out * Fix lint --- ISLE/isleapp.cpp | 20 +- ISLE/library_msvc.h | 288 ++++++++++++++++++++++++ LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- 3 files changed, 295 insertions(+), 15 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index dc087d57..9b2a6512 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -164,16 +164,10 @@ void IsleApp::Close() TransitionManager()->SetWaitIndicator(NULL); Lego()->StopTimer(); - MxLong lVar8; - do { - lVar8 = Streamer()->Close(NULL); - } while (lVar8 == 0); - - while (Lego()) { - if (Lego()->DoesEntityExist(ds)) { - break; - } + while (Streamer()->Close(NULL) == SUCCESS) { + } + while (Lego() && !Lego()->DoesEntityExist(ds)) { Timer()->GetRealTime(); TickleManager()->Tickle(); } @@ -404,9 +398,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcA(hWnd, uMsg, wParam, lParam); case WM_CLOSE: if (!g_closed && g_isle) { - if (g_isle) { - delete g_isle; - } + delete g_isle; g_isle = NULL; g_closed = TRUE; return 0; @@ -646,8 +638,8 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine) } GameState()->SetSavePath(m_savePath); - GameState()->SerializePlayersInfo(1); - GameState()->SerializeScoreHistory(1); + GameState()->SerializePlayersInfo(LegoStorage::c_read); + GameState()->SerializeScoreHistory(LegoStorage::c_read); int iVar10; switch (m_islandQuality) { diff --git a/ISLE/library_msvc.h b/ISLE/library_msvc.h index a837fd3b..b65591d6 100644 --- a/ISLE/library_msvc.h +++ b/ISLE/library_msvc.h @@ -18,6 +18,18 @@ // LIBRARY: ISLE 0x407ec0 // ___CxxFrameHandler +// LIBRARY: ISLE 0x4080ec +// __global_unwind2 + +// LIBRARY: ISLE 0x40812e +// __local_unwind2 + +// LIBRARY: ISLE 0x4081b9 +// __NLG_Notify1 + +// LIBRARY: ISLE 0x4081c2 +// __NLG_Notify + // LIBRARY: ISLE 0x4081e0 // _srand @@ -30,6 +42,9 @@ // LIBRARY: ISLE 0x4082d0 // _atoi +// LIBRARY: ISLE 0x408490 +// __amsg_exit + // LIBRARY: ISLE 0x4084c0 // ?_query_new_handler@@YAP6AHI@ZXZ @@ -42,22 +57,295 @@ // LIBRARY: ISLE 0x408630 // _abort +// LIBRARY: ISLE 0x408650 +// ___InternalCxxFrameHandler + +// LIBRARY: ISLE 0x408b30 +// ___FrameUnwindToState + +// LIBRARY: ISLE 0x4090c0 +// __CallSettingFrame@12 + // LIBRARY: ISLE 0x409110 // __mtinit +// LIBRARY: ISLE 0x409170 +// __initptd + // LIBRARY: ISLE 0x409190 // __getptd +// LIBRARY: ISLE 0x409200 +// __isctype + +// LIBRARY: ISLE 0x4092e0 +// ?terminate@@YAXXZ + +// LIBRARY: ISLE 0x409360 +// ?_inconsistency@@YAXXZ + +// LIBRARY: ISLE 0x4093e0 +// __cinit + +// LIBRARY: ISLE 0x409410 +// _exit + +// LIBRARY: ISLE 0x409430 +// __exit + +// LIBRARY: ISLE 0x409550 +// __XcptFilter + +// LIBRARY: ISLE 0x4096d0 +// __ismbblead + +// LIBRARY: ISLE 0x409730 +// __setenvp + +// LIBRARY: ISLE 0x409820 +// __setargv + +// LIBRARY: ISLE 0x409a90 +// ___crtGetEnvironmentStringsA + +// LIBRARY: ISLE 0x409c20 +// __setmbcp + +// LIBRARY: ISLE 0x409f30 +// ___initmbctable + +// LIBRARY: ISLE 0x409f40 +// __ioinit + +// LIBRARY: ISLE 0x40a120 +// __heap_init + +// LIBRARY: ISLE 0x40a160 +// __FF_MSGBANNER + +// LIBRARY: ISLE 0x40a1a0 +// __NMSG_WRITE + +// LIBRARY: ISLE 0x40a3a0 +// __mtinitlocks + +// LIBRARY: ISLE 0x40a3d0 +// __lock + +// LIBRARY: ISLE 0x40a440 +// __unlock + +// LIBRARY: ISLE 0x40a540 +// __flsbuf + +// LIBRARY: ISLE 0x40a690 +// __output + +// LIBRARY: ISLE 0x40b090 +// _write_multi_char + +// LIBRARY: ISLE 0x40b0d0 +// _write_string + +// LIBRARY: ISLE 0x40b150 +// _raise + +// LIBRARY: ISLE 0x40b780 +// ___crtGetStringTypeA + +// LIBRARY: ISLE 0x40b8b0 +// ___sbh_new_region + +// LIBRARY: ISLE 0x40ba20 +// ___crtMessageBoxA + +// LIBRARY: ISLE 0x40bac0 +// _strncpy + +// LIBRARY: ISLE 0x40bcb0 +// __write + +// LIBRARY: ISLE 0x40bd30 +// __write_lk + +// LIBRARY: ISLE 0x40bf30 +// __lseek + +// LIBRARY: ISLE 0x40bfb0 +// __lseek_lk + +// LIBRARY: ISLE 0x40c040 +// __getbuf + +// LIBRARY: ISLE 0x40c090 +// __isatty + +// LIBRARY: ISLE 0x40c0c0 +// _wctomb + +// LIBRARY: ISLE 0x40c120 +// __wctomb_lk + +// LIBRARY: ISLE 0x40c1c0 +// __aulldiv + +// LIBRARY: ISLE 0x40c230 +// __aullrem + +// LIBRARY: ISLE 0x40c2b0 +// __dosmaperr + +// LIBRARY: ISLE 0x40c330 +// __errno + +// LIBRARY: ISLE 0x40c340 +// ___doserrno + +// LIBRARY: ISLE 0x40c710 +// __get_osfhandle + +// LIBRARY: ISLE 0x40c760 +// __lock_fhandle + +// LIBRARY: ISLE 0x40c7d0 +// __unlock_fhandle + +// LIBRARY: ISLE 0x40c810 +// __fptrap + +// GLOBAL: ISLE 0x40f448 +// ___lookuptable + +// GLOBAL: ISLE 0x410000 +// ___xc_a + +// GLOBAL: ISLE 0x410008 +// ___xc_z + +// GLOBAL: ISLE 0x41000c +// ___xi_a + +// GLOBAL: ISLE 0x410018 +// ___xi_z + +// GLOBAL: ISLE 0x41068c +// __NLG_Destination + +// GLOBAL: ISLE 0x41069c +// __aenvptr + +// GLOBAL: ISLE 0x4106a8 +// ___error_mode + +// GLOBAL: ISLE 0x4106ac +// ___app_type + +// GLOBAL: ISLE 0x4106c0 +// ___tlsindex + +// GLOBAL: ISLE 0x4106c8 +// __pctype + +// GLOBAL: ISLE 0x4108d4 +// ___mb_cur_max + +// GLOBAL: ISLE 0x4108e0 +// ?__pInconsistency@@3P6AXXZA + // GLOBAL: ISLE 0x4108e8 // __osver +// GLOBAL: ISLE 0x4108ec +// __winver + // GLOBAL: ISLE 0x4108f0 // __winmajor // GLOBAL: ISLE 0x4108f4 // __winminor +// GLOBAL: ISLE 0x4108f8 +// ___argc + +// GLOBAL: ISLE 0x4108fc +// ___argv + +// GLOBAL: ISLE 0x410904 +// __environ + +// GLOBAL: ISLE 0x410914 +// __pgmptr + +// GLOBAL: ISLE 0x410928 +// __XcptActTab + +// GLOBAL: ISLE 0x4109a0 +// __First_FPE_Indx + +// GLOBAL: ISLE 0x4109a4 +// __Num_FPE + +// GLOBAL: ISLE 0x4109b8 +// __mbctype + +// GLOBAL: ISLE 0x410abc +// ___mbcodepage + +// GLOBAL: ISLE 0x410ac0 +// ___mblcid + +// GLOBAL: ISLE 0x410ac8 +// ___mbulinfo + +// GLOBAL: ISLE 0x410bd0 +// ___badioinfo + +// GLOBAL: ISLE 0x410c88 +// __adbgmsg + +// GLOBAL: ISLE 0x410c90 +// __locktable + // GLOBAL: ISLE 0x410d50 // __newmode +// GLOBAL: ISLE 0x410d54 +// ___nullstring + +// GLOBAL: ISLE 0x410d58 +// ___wnullstring + +// GLOBAL: ISLE 0x410d90 +// ___lc_codepage + +// GLOBAL: ISLE 0x410d98 +// ___small_block_heap + +// GLOBAL: ISLE 0x411850 +// __cflush + +// XGLOBAL ISLE 0x4125f8 +// ?_pnhHeap@@3P6AHI@ZA + +// GLOBAL: ISLE 0x412888 +// ___setlc_active + +// GLOBAL: ISLE 0x41288c +// ___unguarded_readlc_active + +// GLOBAL: ISLE 0x4138a4 +// __crtheap + +// GLOBAL: ISLE 0x4138b0 +// ___pioinfo + +// GLOBAL: ISLE 0x4139b0 +// __nhandle + +// GLOBAL: ISLE 0x4139bc +// __FPinit + +// GLOBAL: ISLE 0x4139c0 +// __acmdln + #endif diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f643cc94..1e8ea520 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -44,7 +44,7 @@ DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 MxU32 g_isleFlags = 0x7f; -// GLOBAL: ISLE 0x100f37f0 +// GLOBAL: LEGO1 0x100f37f0 MxS32 g_unk0x100f37f0[] = { Act1State::e_unk953, Act1State::e_unk954, From 6a9f68872b0bc43d4f20298cdfaf1cc6b0aca9b9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 12:11:46 -0400 Subject: [PATCH 19/26] Add enum for actor IDs (#993) --- LEGO1/lego/legoomni/include/legoactor.h | 10 ++++++ .../src/common/legoanimationmanager.cpp | 8 ++--- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 12 +++---- .../lego/legoomni/src/paths/legopathactor.cpp | 12 +++---- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 12 +++---- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 34 +++++++++---------- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 12 +++---- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/police.cpp | 4 +-- 10 files changed, 59 insertions(+), 49 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 026f5885..64f4aae3 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -10,6 +10,16 @@ class LegoCacheSound; // SIZE 0x78 class LegoActor : public LegoEntity { public: + enum { + c_none = 0, + c_pepper, + c_mama, + c_papa, + c_nick, + c_laura, + c_brickster + }; + LegoActor(); ~LegoActor() override; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index f1915ef9..8b8b30fa 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1496,7 +1496,7 @@ MxResult LegoAnimationManager::Tickle() MxU8 unk0x0c = 0; MxU8 actorId = GameState()->GetActorId(); - if (actorId <= 5) { + if (actorId <= LegoActor::c_laura) { unk0x0c = g_unk0x100d8b28[actorId]; } @@ -1762,7 +1762,7 @@ MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info) MxU8 und = 0; MxU8 actorId = GameState()->GetActorId(); - if (actorId <= 5) { + if (actorId <= LegoActor::c_laura) { und = g_unk0x100d8b28[actorId]; } @@ -2712,11 +2712,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) } if (success) { - if (GameState()->GetActorId() != 2) { + if (GameState()->GetActorId() != LegoActor::c_mama) { FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f); } - if (GameState()->GetActorId() != 3) { + if (GameState()->GetActorId() != LegoActor::c_papa) { FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f); } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index de931cd2..cb426fac 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -346,25 +346,25 @@ MxLong LegoEntity::Notify(MxParam& p_param) } else { switch (GameState()->GetActorId()) { - case 1: + case LegoActor::c_pepper: if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && GameState()->GetCurrentAct() != LegoGameState::e_act3) { VTable0x3c(); } break; - case 2: + case LegoActor::c_mama: VTable0x40(); break; - case 3: + case LegoActor::c_papa: VTable0x44(); break; - case 4: + case LegoActor::c_nick: VTable0x48(param.GetROI()); break; - case 5: + case LegoActor::c_laura: VTable0x4c(); break; - case 6: + case LegoActor::c_brickster: switch (m_type) { case e_actor: case e_unk1: diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 454f04fb..6990f1dd 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -675,24 +675,24 @@ MxResult LegoPathActor::VTable0x9c() void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) { switch (GetActorId()) { - case 1: + case c_pepper: p_und1 = TRUE; p_und2 = 2; break; - case 2: + case c_mama: p_und1 = FALSE; p_und2 = 1; break; - case 3: + case c_papa: p_und1 = TRUE; p_und2 = 1; break; - case 4: - case 6: + case c_nick: + case c_brickster: p_und1 = TRUE; p_und2 = rand() % p_und2 + 1; break; - case 5: + case c_laura: p_und1 = FALSE; p_und2 = 2; break; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 82ef467b..10debbd7 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -31,7 +31,7 @@ MxBool g_trackLedEnabled = FALSE; // FUNCTION: LEGO1 0x100046a0 GasStation::GasStation() { - m_currentActorId = 0; + m_currentActorId = LegoActor::c_none; m_state = NULL; m_destLocation = LegoGameState::e_undefined; m_trackLedBitmap = NULL; @@ -134,7 +134,7 @@ void GasStation::ReadyWorld() m_currentActorId = CurrentActor()->GetActorId(); switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_state->m_unk0x18) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -165,7 +165,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 2: + case LegoActor::c_mama: switch (m_state->m_unk0x1a) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -191,7 +191,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 3: + case LegoActor::c_papa: switch (m_state->m_unk0x1c) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -217,7 +217,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 4: + case LegoActor::c_nick: switch (m_state->m_unk0x1e) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -243,7 +243,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 5: + case LegoActor::c_laura: switch (m_state->m_unk0x20) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index c715bcf6..8cd8ae92 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -35,7 +35,7 @@ MxBool g_pizzaLedEnabled = FALSE; // FUNCTION: LEGO1 0x100745e0 Hospital::Hospital() { - m_currentActorId = 0; + m_currentActorId = LegoActor::c_none; m_unk0x100 = 0; m_hospitalState = NULL; m_unk0x108 = 0; @@ -145,14 +145,14 @@ void Hospital::ReadyWorld() m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap"); if (CurrentActor() == NULL) { - m_currentActorId = 5; + m_currentActorId = LegoActor::c_laura; } else { m_currentActorId = CurrentActor()->GetActorId(); } switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e; if (m_hospitalState->m_unk0x0e < 5) { @@ -160,7 +160,7 @@ void Hospital::ReadyWorld() } break; - case 2: + case LegoActor::c_mama: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10; if (m_hospitalState->m_unk0x10 < 5) { @@ -168,7 +168,7 @@ void Hospital::ReadyWorld() } break; - case 3: + case LegoActor::c_papa: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12; if (m_hospitalState->m_unk0x12 < 5) { @@ -176,7 +176,7 @@ void Hospital::ReadyWorld() } break; - case 4: + case LegoActor::c_nick: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14; if (m_hospitalState->m_unk0x14 < 5) { @@ -184,7 +184,7 @@ void Hospital::ReadyWorld() } break; - case 5: + case LegoActor::c_laura: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16; if (m_hospitalState->m_unk0x16 < 5) { @@ -269,7 +269,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; case 11: switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_hospitalState->m_unk0x0e) { case 0: case 1: @@ -288,7 +288,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 2: + case LegoActor::c_mama: switch (m_hospitalState->m_unk0x10) { case 0: case 1: @@ -307,7 +307,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 3: + case LegoActor::c_papa: switch (m_hospitalState->m_unk0x12) { case 0: case 1: @@ -326,7 +326,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 4: + case LegoActor::c_nick: switch (m_hospitalState->m_unk0x14) { case 0: case 1: @@ -345,7 +345,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 5: + case LegoActor::c_laura: switch (m_hospitalState->m_unk0x16) { case 0: case 1: @@ -438,7 +438,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) } else { switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_hospitalState->m_unk0x0e) { case 0: case 1: @@ -457,7 +457,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 2: + case LegoActor::c_mama: switch (m_hospitalState->m_unk0x10) { case 0: case 1: @@ -476,7 +476,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 3: + case LegoActor::c_papa: switch (m_hospitalState->m_unk0x12) { case 0: case 1: @@ -495,7 +495,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 4: + case LegoActor::c_nick: switch (m_hospitalState->m_unk0x14) { case 0: case 1: @@ -514,7 +514,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 5: + case LegoActor::c_laura: switch (m_hospitalState->m_unk0x16) { case 0: case 1: diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index f8a1426d..a2ae514f 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1047,7 +1047,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param) InputManager()->SetUnknown336(TRUE); break; case LegoGameState::e_unk4: - if (state->GetActorId()) { + if (state->GetActorId() != LegoActor::c_none) { if (m_infocenterState->HasRegistered()) { m_infocenterState->SetUnknown0x74(5); m_destLocation = state->GetPreviousArea(); @@ -1336,23 +1336,23 @@ void Infocenter::UpdateFrameHot(MxBool p_display) MxS32 x, y; switch (GameState()->GetActorId()) { - case 1: + case LegoActor::c_pepper: x = 302; y = 81; break; - case 2: + case LegoActor::c_mama: x = 204; y = 81; break; - case 3: + case LegoActor::c_papa: x = 253; y = 81; break; - case 4: + case LegoActor::c_nick: x = 353; y = 81; break; - case 5: + case LegoActor::c_laura: x = 399; y = 81; break; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index a4afe604..dde3e760 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -114,7 +114,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param) result = 1; break; case InfodoorScript::c_Door_Ctl: - if (GameState()->GetActorId()) { + if (GameState()->GetActorId() != LegoActor::c_none) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { m_destLocation = LegoGameState::e_unk4; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 1e8ea520..806903af 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -544,7 +544,7 @@ void Isle::Enable(MxBool p_enable) VideoManager()->ResetPalette(FALSE); m_act1state->FUN_10034d00(); - if (CurrentActor() != NULL && CurrentActor()->GetActorId() != 0) { + if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) { // TODO: Match, most likely an inline function MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index a20f5163..0efbea20 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -231,11 +231,11 @@ void PoliceState::FUN_1005ea40() } switch (CurrentActor()->GetActorId()) { - case 4: + case LegoActor::c_nick: policeScript = PoliceScript::c_nps002la_RunAnim; m_policeScript = policeScript; break; - case 5: + case LegoActor::c_laura: policeScript = PoliceScript::c_nps001ni_RunAnim; m_policeScript = policeScript; break; From f6c923a84e1862248114c016d521521192a54880 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 13:00:46 -0400 Subject: [PATCH 20/26] Implement/match LegoEntity::ClickAnimation (#994) * Implement/match LegoEntity::VTable0x38 * Update names --- .../legoomni/include/legobuildingmanager.h | 5 +- .../legoomni/include/legocharactermanager.h | 1 + LEGO1/lego/legoomni/include/legoentity.h | 6 +- LEGO1/lego/legoomni/include/legomain.h | 4 +- .../lego/legoomni/include/legoplantmanager.h | 4 +- .../src/build/legobuildingmanager.cpp | 2 +- .../src/common/legocharactermanager.cpp | 16 +++++ .../legoomni/src/common/legoplantmanager.cpp | 9 ++- LEGO1/lego/legoomni/src/common/misc.cpp | 4 +- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 67 ++++++++++++++++--- 10 files changed, 95 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index bec82ceb..cf7a4099 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -72,12 +72,12 @@ class LegoBuildingManager : public MxCore { MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); LegoBuildingInfo* GetInfo(LegoEntity* p_entity); - MxBool IncrementVariant(LegoEntity* p_entity); + MxBool SwitchVariant(LegoEntity* p_entity); MxBool FUN_1002fe40(LegoEntity* p_entity); MxBool FUN_1002fe80(LegoEntity* p_entity); MxBool FUN_1002fed0(LegoEntity* p_entity); MxU32 GetBuildingEntityId(LegoEntity* p_entity); - MxU32 FUN_1002ff40(LegoEntity*, MxBool); + MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030110(LegoBuildingInfo* p_data); @@ -89,6 +89,7 @@ class LegoBuildingManager : public MxCore { void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); static void FUN_10030800(); + static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } // SYNTHETIC: LEGO1 0x1002f940 // LegoBuildingManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 1032f8b3..e8d5abee 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -70,6 +70,7 @@ class LegoCharacterManager { LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); + MxU32 FUN_10085120(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 5fcced29..4435ac19 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -64,9 +64,9 @@ class LegoEntity : public MxEntity { // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void VTable0x34(MxBool p_und); // vtable+0x34 - virtual void VTable0x38(); // vtable+0x38 - virtual void VTable0x3c(); // vtable+0x3c + virtual void ClickSound(MxBool p_und); // vtable+0x34 + virtual void ClickAnimation(); // vtable+0x38 + virtual void SwitchVariant(); // vtable+0x3c virtual void VTable0x40(); // vtable+0x40 virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 4a2fad65..e3264e06 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -128,9 +128,9 @@ class LegoOmni : public MxOmni { LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } LegoPathActor* GetCurrentActor() { return m_currentActor; } - LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } + LegoPlantManager* GetPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } - LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } + LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } LegoGameState* GetGameState() { return m_gameState; } MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; } MxTransitionManager* GetTransitionManager() { return m_transitionManager; } diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index e2eccd80..0c9e18eb 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -30,11 +30,13 @@ class LegoPlantManager : public MxCore { void Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); MxBool FUN_100269e0(LegoEntity* p_entity); - MxU32 FUN_10026ba0(LegoEntity*, MxBool); + MxU32 FUN_10026b70(LegoEntity* p_entity); + MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool); void FUN_10026c50(LegoEntity* p_entity); void FUN_10027120(); static void SetCustomizeAnimFile(const char* p_value); + static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } // SYNTHETIC: LEGO1 0x100262a0 // LegoPlantManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 863520da..d6cc74d1 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -441,7 +441,7 @@ LegoBuildingInfo* LegoBuildingManager::GetInfo(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fdb0 // FUNCTION: BETA10 0x10064101 -MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) { if (g_buildingManagerConfig <= 1) { return TRUE; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index dc48d9b5..eca959d9 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -21,6 +21,9 @@ DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) +// GLOBAL: LEGO1 0x100fc4e0 +MxU32 g_unk0x100fc4e0 = 10; + // GLOBAL: LEGO1 0x100fc4e4 char* LegoCharacterManager::g_customizeAnimFile = NULL; @@ -753,6 +756,19 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) return TRUE; } +// FUNCTION: LEGO1 0x10085120 +// FUNCTION: BETA10 0x1007680c +MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) +{ + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + return info->m_unk0x10 + g_unk0x100fc4e0; + } + + return 0; +} + // FUNCTION: LEGO1 0x10085140 MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) { diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 3e7aeed8..bcda73cd 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -56,8 +56,15 @@ MxBool LegoPlantManager::FUN_100269e0(LegoEntity* p_entity) return FALSE; } +// STUB: LEGO1 0x10026b70 +MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity) +{ + // TODO + return 0; +} + // STUB: LEGO1 0x10026ba0 -MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity*, MxBool) +MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity* p_entity, MxBool) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index 34060c5f..2427097c 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -93,13 +93,13 @@ ViewManager* GetViewManager() // FUNCTION: LEGO1 0x100157e0 LegoPlantManager* PlantManager() { - return LegoOmni::GetInstance()->GetLegoPlantManager(); + return LegoOmni::GetInstance()->GetPlantManager(); } // FUNCTION: LEGO1 0x100157f0 LegoBuildingManager* BuildingManager() { - return LegoOmni::GetInstance()->GetLegoBuildingManager(); + return LegoOmni::GetInstance()->GetBuildingManager(); } // FUNCTION: LEGO1 0x10015800 diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index cb426fac..48ec6d62 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -2,11 +2,13 @@ #include "3dmanager/lego3dmanager.h" #include "define.h" +#include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legocameracontroller.h" #include "legocharactermanager.h" #include "legoeventnotificationparam.h" #include "legogamestate.h" +#include "legomain.h" #include "legoplantmanager.h" #include "legoutils.h" #include "legovideomanager.h" @@ -245,11 +247,12 @@ void LegoEntity::ParseAction(char* p_extra) } // FUNCTION: LEGO1 0x10010f10 -void LegoEntity::VTable0x34(MxBool p_und) +// FUNCTION: BETA10 0x1007ee87 +void LegoEntity::ClickSound(MxBool p_und) { if (!GetUnknown0x10IsSet(c_altBit1)) { MxU32 objectId = 0; - const LegoChar* roiName = m_roi->GetName(); + const char* name = m_roi->GetName(); switch (m_type) { case e_actor: @@ -269,20 +272,56 @@ void LegoEntity::VTable0x34(MxBool p_und) MxDSAction action; action.SetAtomId(MxAtomId(CharacterManager()->GetCustomizeAnimFile(), e_lowerCase2)); action.SetObjectId(objectId); - action.AppendExtra(strlen(roiName) + 1, roiName); + action.AppendExtra(strlen(name) + 1, name); Start(&action); } } } -// STUB: LEGO1 0x10011070 -void LegoEntity::VTable0x38() +// FUNCTION: LEGO1 0x10011070 +// FUNCTION: BETA10 0x1007f062 +void LegoEntity::ClickAnimation() { - // TODO + if (!GetUnknown0x10IsSet(c_altBit1)) { + MxU32 objectId = 0; + MxDSAction action; + const char* name = m_roi->GetName(); + char extra[1024]; + + switch (m_type) { + case e_actor: + objectId = LegoOmni::GetInstance()->GetCharacterManager()->FUN_10085120(m_roi); + action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:actor_01:%s", name); + break; + case e_unk1: + break; + case e_plant: + objectId = LegoOmni::GetInstance()->GetPlantManager()->FUN_10026b70(this); + action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name); + break; + case e_building: + objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetBuildingEntityId(this); + action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:haus1:%s", name); + break; + case e_autoROI: + break; + } + + if (objectId) { + action.SetObjectId(objectId); + action.AppendExtra(strlen(extra) + 1, extra); + LegoOmni::GetInstance()->GetAnimationManager()->StartEntityAction(action, this); + m_unk0x10 |= c_altBit1; + } + } } // FUNCTION: LEGO1 0x10011300 -void LegoEntity::VTable0x3c() +// FUNCTION: BETA10 0x1007f35a +void LegoEntity::SwitchVariant() { switch (m_type) { case e_actor: @@ -294,45 +333,51 @@ void LegoEntity::VTable0x3c() PlantManager()->FUN_100269e0(this); break; case e_building: - BuildingManager()->IncrementVariant(this); + BuildingManager()->SwitchVariant(this); break; } - VTable0x34(FALSE); - VTable0x38(); + ClickSound(FALSE); + ClickAnimation(); } // STUB: LEGO1 0x10011360 +// FUNCTION: BETA10 0x1007f411 void LegoEntity::VTable0x40() { // TODO } // STUB: LEGO1 0x100113c0 +// FUNCTION: BETA10 0x1007f4c8 void LegoEntity::VTable0x44() { // TODO } // STUB: LEGO1 0x10011420 +// FUNCTION: BETA10 0x1007f57f void LegoEntity::VTable0x48(LegoROI* p_roi) { // TODO } // STUB: LEGO1 0x10011470 +// FUNCTION: BETA10 0x1007f62c void LegoEntity::VTable0x4c() { // TODO } // FUNCTION: LEGO1 0x100114e0 +// FUNCTION: BETA10 0x1007f6f0 void LegoEntity::SetType(MxU8 p_type) { m_type = p_type; } // FUNCTION: LEGO1 0x100114f0 +// FUNCTION: BETA10 0x1007f711 MxLong LegoEntity::Notify(MxParam& p_param) { LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param; @@ -349,7 +394,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) case LegoActor::c_pepper: if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && GameState()->GetCurrentAct() != LegoGameState::e_act3) { - VTable0x3c(); + SwitchVariant(); } break; case LegoActor::c_mama: From 49c17c9c6afddf1ec9d16f6f8819556cd63c022c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 13:40:44 -0400 Subject: [PATCH 21/26] Implement/match LegoEntity::SwitchSound / SwitchMove / SwitchColor / SwitchMood (#995) * Implement/match LegoEntity::SwitchSound * Name * Name * Implement/match LegoEntity::SwitchMove * Mood --- LEGO1/lego/legoomni/include/legoactors.h | 4 +- .../legoomni/include/legobuildingmanager.h | 22 ++-- .../legoomni/include/legocharactermanager.h | 8 +- LEGO1/lego/legoomni/include/legoentity.h | 14 +-- .../lego/legoomni/include/legoplantmanager.h | 6 +- .../src/build/legobuildingmanager.cpp | 58 +++++----- .../src/common/legocharactermanager.cpp | 92 +++++++++++++-- .../legoomni/src/common/legoplantmanager.cpp | 30 ++++- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 106 +++++++++++++++--- 9 files changed, 262 insertions(+), 78 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactors.h b/LEGO1/lego/legoomni/include/legoactors.h index 46f288b5..aa31343d 100644 --- a/LEGO1/lego/legoomni/include/legoactors.h +++ b/LEGO1/lego/legoomni/include/legoactors.h @@ -22,8 +22,8 @@ struct LegoActorInfo { const char* m_name; // 0x00 LegoROI* m_roi; // 0x04 LegoExtraActor* m_actor; // 0x08 - MxS32 m_unk0x0c; // 0x0c - MxS32 m_unk0x10; // 0x10 + MxS32 m_sound; // 0x0c + MxS32 m_move; // 0x10 MxU8 m_mood; // 0x14 Part m_parts[10]; // 0x18 }; diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index cf7a4099..57544ba7 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -15,17 +15,17 @@ class LegoPathBoundary; // SIZE 0x2c struct LegoBuildingInfo { enum { - c_bit1 = 0x01, - c_bit2 = 0x02, - c_bit3 = 0x04, - c_bit4 = 0x08 + c_hasVariants = 0x01, + c_hasSounds = 0x02, + c_hasMoves = 0x04, + c_hasMoods = 0x08 }; LegoEntity* m_entity; // 0x00 const char* m_hausName; // 0x04 - MxU32 m_cycle1; // 0x08 - MxU32 m_cycle2; // 0x0c - MxU8 m_cycle3; // 0x10 + MxU32 m_sound; // 0x08 + MxU32 m_move; // 0x0c + MxU8 m_mood; // 0x10 MxS8 m_unk0x11; // 0x11 MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 MxU8 m_flags; // 0x13 @@ -73,9 +73,9 @@ class LegoBuildingManager : public MxCore { MxResult Read(LegoStorage* p_storage); LegoBuildingInfo* GetInfo(LegoEntity* p_entity); MxBool SwitchVariant(LegoEntity* p_entity); - MxBool FUN_1002fe40(LegoEntity* p_entity); - MxBool FUN_1002fe80(LegoEntity* p_entity); - MxBool FUN_1002fed0(LegoEntity* p_entity); + MxBool SwitchSound(LegoEntity* p_entity); + MxBool SwitchMove(LegoEntity* p_entity); + MxBool SwitchMood(LegoEntity* p_entity); MxU32 GetBuildingEntityId(LegoEntity* p_entity); MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); @@ -96,6 +96,8 @@ class LegoBuildingManager : public MxCore { private: static char* g_customizeAnimFile; + static MxS32 g_maxMove[16]; + static MxU32 g_maxSound; MxU8 m_nextVariant; // 0x08 MxU8 m_unk0x09; // 0x09 diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index e8d5abee..2c2238d6 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -69,7 +69,11 @@ class LegoCharacterManager { LegoExtraActor* GetExtraActor(const char* p_name); LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(LegoROI* p_roi); - MxBool SwitchHat(LegoROI* p_roi); + MxBool SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI); + MxBool SwitchVariant(LegoROI* p_roi); + MxBool SwitchSound(LegoROI* p_roi); + MxBool SwitchMove(LegoROI* p_roi); + MxBool SwitchMood(LegoROI* p_roi); MxU32 FUN_10085120(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); @@ -85,6 +89,8 @@ class LegoCharacterManager { MxResult FUN_10085870(LegoROI* p_roi); static char* g_customizeAnimFile; + static MxU32 g_maxMove; + static MxU32 g_maxSound; LegoCharacterMap* m_characters; // 0x00 CustomizeAnimFileVariable* m_customizeAnimFile; // 0x04 diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 4435ac19..2adc7179 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -64,13 +64,13 @@ class LegoEntity : public MxEntity { // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void ClickSound(MxBool p_und); // vtable+0x34 - virtual void ClickAnimation(); // vtable+0x38 - virtual void SwitchVariant(); // vtable+0x3c - virtual void VTable0x40(); // vtable+0x40 - virtual void VTable0x44(); // vtable+0x44 - virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48 - virtual void VTable0x4c(); // vtable+0x4c + virtual void ClickSound(MxBool p_und); // vtable+0x34 + virtual void ClickAnimation(); // vtable+0x38 + virtual void SwitchVariant(); // vtable+0x3c + virtual void SwitchSound(); // vtable+0x40 + virtual void SwitchMove(); // vtable+0x44 + virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48 + virtual void SwitchMood(); // vtable+0x4c void FUN_10010c30(); void SetType(MxU8 p_type); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 0c9e18eb..f32adafa 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -29,7 +29,11 @@ class LegoPlantManager : public MxCore { void FUN_100263a0(undefined4 p_und); void Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); - MxBool FUN_100269e0(LegoEntity* p_entity); + MxBool SwitchColor(LegoEntity* p_entity); + MxBool SwitchVariant(LegoEntity* p_entity); + MxBool SwitchSound(LegoEntity* p_entity); + MxBool SwitchMove(LegoEntity* p_entity); + MxBool SwitchMood(LegoEntity* p_entity); MxU32 FUN_10026b70(LegoEntity* p_entity); MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool); void FUN_10026c50(LegoEntity* p_entity); diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index d6cc74d1..9cd60b54 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -193,7 +193,7 @@ LegoBuildingInfo g_buildingInfoInit[16] = { // clang-format on // GLOBAL: LEGO1 0x100f3738 -MxU32 g_buildingCycle1Length = 6; +MxU32 LegoBuildingManager::g_maxSound = 6; // GLOBAL: LEGO1 0x100f373c MxU32 g_cycleLengthOffset1 = 0x3c; @@ -221,7 +221,7 @@ MxS32 g_buildingManagerConfig = 1; LegoBuildingInfo g_buildingInfo[16]; // GLOBAL: LEGO1 0x100f3748 -MxS32 g_buildingCycle2Length[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0}; +MxS32 LegoBuildingManager::g_maxMove[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0}; // FUNCTION: LEGO1 0x1002f8b0 void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig) @@ -330,13 +330,13 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; - if (p_storage->Write(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) { @@ -363,13 +363,13 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; - if (p_storage->Read(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) { @@ -449,7 +449,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) { + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) { LegoROI* roi = p_entity->GetROI(); if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) { m_nextVariant = 0; @@ -471,16 +471,16 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fe40 // FUNCTION: BETA10 0x100641d3 -MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchSound(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit2) { - info->m_cycle1++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasSounds) { + info->m_sound++; - if (info->m_cycle1 >= g_buildingCycle1Length) { - info->m_cycle1 = 0; + if (info->m_sound >= g_maxSound) { + info->m_sound = 0; } result = TRUE; @@ -491,16 +491,16 @@ MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fe80 // FUNCTION: BETA10 0x10064242 -MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchMove(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { - info->m_cycle2++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) { + info->m_move++; - if (info->m_cycle2 >= g_buildingCycle2Length[info - g_buildingInfo]) { - info->m_cycle2 = 0; + if (info->m_move >= g_maxMove[info - g_buildingInfo]) { + info->m_move = 0; } result = TRUE; @@ -511,16 +511,16 @@ MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fed0 // FUNCTION: BETA10 0x100642c2 -MxBool LegoBuildingManager::FUN_1002fed0(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchMood(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit4) { - info->m_cycle3++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoods) { + info->m_mood++; - if (info->m_cycle3 > 3) { - info->m_cycle3 = 0; + if (info->m_mood > 3) { + info->m_mood = 0; } result = TRUE; @@ -535,8 +535,8 @@ MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity) { LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { - return g_buildingEntityId[info - g_buildingInfo] + info->m_cycle2; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) { + return g_buildingEntityId[info - g_buildingInfo] + info->m_move; } return 0; @@ -548,16 +548,16 @@ MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state) { LegoBuildingInfo* info = GetInfo(p_entity); - if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_bit2)) { + if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_hasSounds)) { return 0; } if (p_state) { - return info->m_cycle3 + g_cycleLengthOffset3; + return info->m_mood + g_cycleLengthOffset3; } if (info != NULL) { - return info->m_cycle1 + g_cycleLengthOffset1; + return info->m_sound + g_cycleLengthOffset1; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index eca959d9..04a3e74f 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -21,6 +21,12 @@ DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) +// GLOBAL: LEGO1 0x100fc4d0 +MxU32 LegoCharacterManager::g_maxMove = 4; + +// GLOBAL: LEGO1 0x100fc4d4 +MxU32 LegoCharacterManager::g_maxSound = 9; + // GLOBAL: LEGO1 0x100fc4e0 MxU32 g_unk0x100fc4e0 = 10; @@ -113,10 +119,10 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { LegoActorInfo* info = &g_actorInfo[i]; - if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { + if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { + if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { @@ -168,10 +174,10 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { LegoActorInfo* info = &g_actorInfo[i]; - if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { + if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { + if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { @@ -450,8 +456,8 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key) if (!strcmpi(p_key, "pep")) { LegoActorInfo* pepper = GetActorInfo("pepper"); - info->m_unk0x0c = pepper->m_unk0x0c; - info->m_unk0x10 = pepper->m_unk0x10; + info->m_sound = pepper->m_sound; + info->m_move = pepper->m_move; info->m_mood = pepper->m_mood; for (i = 0; i < sizeOfArray(info->m_parts); i++) { @@ -702,8 +708,16 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) return NULL; } +// STUB: LEGO1 0x10084d50 +// FUNCTION: BETA10 0x10076223 +MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI) +{ + // TODO + return FALSE; +} + // FUNCTION: LEGO1 0x10084ec0 -MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) +MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi) { LegoActorInfo* info = GetActorInfo(p_roi->GetName()); @@ -756,6 +770,66 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) return TRUE; } +// FUNCTION: LEGO1 0x10085090 +// FUNCTION: BETA10 0x100766f6 +MxBool LegoCharacterManager::SwitchSound(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_sound++; + + if (info->m_sound >= g_maxSound) { + info->m_sound = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x100850c0 +// FUNCTION: BETA10 0x10076754 +MxBool LegoCharacterManager::SwitchMove(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_move++; + + if (info->m_move >= g_maxMove) { + info->m_move = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x100850f0 +// FUNCTION: BETA10 0x100767b2 +MxBool LegoCharacterManager::SwitchMood(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_mood++; + + if (info->m_mood > 3) { + info->m_mood = 0; + } + + result = TRUE; + } + + return result; +} + // FUNCTION: LEGO1 0x10085120 // FUNCTION: BETA10 0x1007680c MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) @@ -763,7 +837,7 @@ MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) LegoActorInfo* info = GetActorInfo(p_roi); if (info != NULL) { - return info->m_unk0x10 + g_unk0x100fc4e0; + return info->m_move + g_unk0x100fc4e0; } return 0; @@ -779,7 +853,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) } if (info != NULL) { - return info->m_unk0x0c + g_unk0x100fc4d8; + return info->m_sound + g_unk0x100fc4d8; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index bcda73cd..4cc23472 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -49,8 +49,36 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage) return SUCCESS; } +// STUB: LEGO1 0x10026920 +MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + // STUB: LEGO1 0x100269e0 -MxBool LegoPlantManager::FUN_100269e0(LegoEntity* p_entity) +MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026ad0 +MxBool LegoPlantManager::SwitchSound(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026b00 +MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026b40 +MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity) { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 48ec6d62..cca706a7 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -325,48 +325,118 @@ void LegoEntity::SwitchVariant() { switch (m_type) { case e_actor: - CharacterManager()->SwitchHat(m_roi); + CharacterManager()->SwitchVariant(m_roi); break; case e_unk1: break; case e_plant: - PlantManager()->FUN_100269e0(this); + PlantManager()->SwitchVariant(this); break; case e_building: BuildingManager()->SwitchVariant(this); break; + case e_autoROI: + break; } ClickSound(FALSE); ClickAnimation(); } -// STUB: LEGO1 0x10011360 +// FUNCTION: LEGO1 0x10011360 // FUNCTION: BETA10 0x1007f411 -void LegoEntity::VTable0x40() +void LegoEntity::SwitchSound() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchSound(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchSound(this); + break; + case e_building: + BuildingManager()->SwitchSound(this); + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x100113c0 +// FUNCTION: LEGO1 0x100113c0 // FUNCTION: BETA10 0x1007f4c8 -void LegoEntity::VTable0x44() +void LegoEntity::SwitchMove() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchMove(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchMove(this); + break; + case e_building: + BuildingManager()->SwitchMove(this); + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x10011420 +// FUNCTION: LEGO1 0x10011420 // FUNCTION: BETA10 0x1007f57f -void LegoEntity::VTable0x48(LegoROI* p_roi) +void LegoEntity::SwitchColor(LegoROI* p_roi) { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchColor(m_roi, p_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchColor(this); + break; + case e_building: + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x10011470 +// FUNCTION: LEGO1 0x10011470 // FUNCTION: BETA10 0x1007f62c -void LegoEntity::VTable0x4c() +void LegoEntity::SwitchMood() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchMood(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchMood(this); + break; + case e_building: + BuildingManager()->SwitchMood(this); + break; + case e_autoROI: + break; + } + + ClickSound(TRUE); + ClickSound(FALSE); + ClickAnimation(); } // FUNCTION: LEGO1 0x100114e0 @@ -398,16 +468,16 @@ MxLong LegoEntity::Notify(MxParam& p_param) } break; case LegoActor::c_mama: - VTable0x40(); + SwitchSound(); break; case LegoActor::c_papa: - VTable0x44(); + SwitchMove(); break; case LegoActor::c_nick: - VTable0x48(param.GetROI()); + SwitchColor(param.GetROI()); break; case LegoActor::c_laura: - VTable0x4c(); + SwitchMood(); break; case LegoActor::c_brickster: switch (m_type) { From 9b22642f0c4bc639a4fee072cb80e0770d8e3d90 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 08:26:33 -0400 Subject: [PATCH 22/26] Implement/match LegoCharacterManager::SwitchColor (#996) --- .../src/common/legocharactermanager.cpp | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 04a3e74f..826f471b 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -708,12 +708,64 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) return NULL; } -// STUB: LEGO1 0x10084d50 +// FUNCTION: LEGO1 0x10084d50 // FUNCTION: BETA10 0x10076223 MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI) { - // TODO - return FALSE; + MxS32 numParts = 10; + const char* targetName = p_targetROI->GetName(); + + MxS32 partIndex; + for (partIndex = 0; partIndex < numParts; partIndex++) { + if (!strcmp(targetName, g_actorLODs[partIndex + 1].m_name)) { + break; + } + } + + assert(partIndex < numParts); + + MxBool findChild = TRUE; + if (partIndex == 6) { + partIndex = 4; + } + else if (partIndex == 7) { + partIndex = 5; + } + else if (partIndex == 3) { + partIndex = 1; + } + else if (partIndex == 0) { + partIndex = 2; + } + else { + findChild = FALSE; + } + + if (!(g_actorLODs[partIndex + 1].m_flags & LegoActorLOD::c_flag2)) { + return FALSE; + } + + LegoActorInfo* info = GetActorInfo(p_roi->GetName()); + + if (info == NULL) { + return FALSE; + } + + if (findChild) { + p_targetROI = FindChildROI(p_roi, g_actorLODs[partIndex + 1].m_name); + } + + LegoActorInfo::Part& part = info->m_parts[partIndex]; + + part.m_unk0x14++; + if (part.m_unk0x0c[part.m_unk0x14] == 0xff) { + part.m_unk0x14 = 0; + } + + LegoFloat red, green, blue, alpha; + LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha); + p_targetROI->FUN_100a9170(red, green, blue, alpha); + return TRUE; } // FUNCTION: LEGO1 0x10084ec0 From 9a9bccda0efa99d154adf26bd05fd16e667a425c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 11:45:37 -0400 Subject: [PATCH 23/26] Implement/match IslePathActor::Exit (#997) * Implement/match IslePathActor::Exit * Name * Name * Partially fix vector interface * Revert "Partially fix vector interface" This reverts commit 6e7a1e2b08fd82012b28be3054eeff65428eb4d1. * Revert "Revert "Partially fix vector interface"" This reverts commit e3860e3c9fa1f8937b702d6c81d6e3bb4dadecc6. * Fix * Remove some COMPAT_MODE --- LEGO1/lego/legoomni/include/ambulance.h | 2 +- LEGO1/lego/legoomni/include/bike.h | 2 +- LEGO1/lego/legoomni/include/dunebuggy.h | 2 +- LEGO1/lego/legoomni/include/helicopter.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 17 ++-- LEGO1/lego/legoomni/include/jetski.h | 2 +- .../lego/legoomni/include/legonavcontroller.h | 2 +- LEGO1/lego/legoomni/include/legopathactor.h | 6 +- LEGO1/lego/legoomni/include/motocycle.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 2 +- LEGO1/lego/legoomni/include/towtrack.h | 2 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 4 +- LEGO1/lego/legoomni/src/actors/bike.cpp | 6 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 12 +-- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 4 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 20 ++--- .../legoomni/src/actors/islepathactor.cpp | 83 +++++++++++++++---- LEGO1/lego/legoomni/src/actors/jetski.cpp | 4 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 4 +- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 2 +- LEGO1/lego/legoomni/src/actors/racecar.cpp | 4 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 12 +-- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 4 +- .../src/common/legoanimationmanager.cpp | 14 ++-- LEGO1/lego/legoomni/src/common/legoutils.cpp | 1 - .../legoomni/src/entity/legocarraceactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legojetski.cpp | 4 +- .../legoomni/src/paths/legoextraactor.cpp | 8 +- .../lego/legoomni/src/paths/legopathactor.cpp | 26 +++--- .../legoomni/src/paths/legopathboundary.cpp | 18 ++-- .../legoomni/src/paths/legopathcontroller.cpp | 6 +- LEGO1/lego/legoomni/src/race/legoracecar.cpp | 4 +- .../legoomni/src/video/legoanimpresenter.cpp | 13 +-- .../src/video/legoloopinganimpresenter.cpp | 7 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 8 +- LEGO1/lego/sources/misc/legounknown.cpp | 6 +- LEGO1/lego/sources/roi/legoroi.cpp | 18 ++-- LEGO1/mxgeometry/mxgeometry3d.h | 4 +- LEGO1/realtime/vector.h | 4 +- LEGO1/viewmanager/viewmanager.cpp | 4 +- 41 files changed, 196 insertions(+), 153 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 1a92eb78..a22c0515 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -89,7 +89,7 @@ class Ambulance : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index a71747ad..b042bee6 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -26,7 +26,7 @@ class Bike : public IslePathActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10076b60(); diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 6abe2881..287417d6 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -28,7 +28,7 @@ class DuneBuggy : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index dd9451c0..1617d6b5 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -69,7 +69,7 @@ class Helicopter : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 758039ff..4150db87 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -4,6 +4,7 @@ #include "legogamestate.h" #include "legopathactor.h" #include "mxtypes.h" +#include "roi/legoroi.h" class LegoControlManagerEvent; class LegoEndAnimNotificationParam; @@ -120,8 +121,8 @@ class IslePathActor : public LegoPathActor { // FUNCTION: LEGO1 0x10002e00 virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 + virtual void Enter(); // vtable+0xe0 + virtual void Exit(); // vtable+0xe4 virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags); // vtable+0xe8 virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec @@ -130,12 +131,18 @@ class IslePathActor : public LegoPathActor { void FUN_1001b660(); + void Reset() + { + m_roi->SetVisibility(TRUE); + SetState(0); + } + static void RegisterSpawnLocations(); protected: - LegoWorld* m_world; // 0x154 - LegoPathActor* m_unk0x158; // 0x158 - MxFloat m_unk0x15c; // 0x15c + LegoWorld* m_world; // 0x154 + LegoPathActor* m_previousActor; // 0x158 + MxFloat m_previousVel; // 0x15c }; #endif // ISLEPATHACTOR_H diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 773513f9..3eb972a6 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -29,7 +29,7 @@ class Jetski : public IslePathActor { void VTable0x70(float p_float) override; // vtable+0x70 MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 8e54bd1e..3e310dde 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -80,7 +80,7 @@ class LegoNavController : public MxCore { inline MxFloat GetLinearVel() { return m_linearVel; } inline MxFloat GetRotationalVel() { return m_rotationalVel; } inline MxFloat GetMaxLinearVel() { return m_maxLinearVel; } - inline void ResetLinearVel(MxFloat p_maxLinearVel) + inline void ResetMaxLinearVel(MxFloat p_maxLinearVel) { m_maxLinearVel = p_maxLinearVel; m_trackDefault = 0; diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 71e9f68e..d407a483 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -100,10 +100,10 @@ class LegoPathActor : public LegoActor { virtual void VTable0xa8(); // vtable+0xa8 // FUNCTION: LEGO1 0x10002d70 - virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac + virtual void SetMaxLinearVel(MxFloat p_maxLinearVel) { m_maxLinearVel = p_maxLinearVel; } // vtable+0xac // FUNCTION: LEGO1 0x10002d80 - virtual MxFloat VTable0xb0() { return m_unk0x13c; } // vtable+0xb0 + virtual MxFloat GetMaxLinearVel() { return m_maxLinearVel; } // vtable+0xb0 // FUNCTION: LEGO1 0x10002d90 virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4 @@ -162,7 +162,7 @@ class LegoPathActor : public LegoActor { MxMatrix m_unk0xec; // 0xec LegoPathEdgeContainer* m_grec; // 0x134 LegoPathController* m_controller; // 0x138 - MxFloat m_unk0x13c; // 0x13c + MxFloat m_maxLinearVel; // 0x13c MxFloat m_unk0x140; // 0x140 MxFloat m_unk0x144; // 0x144 MxU8 m_unk0x148; // 0x148 diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index e23e87ad..1e7599af 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -28,7 +28,7 @@ class Motocycle : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 26007aed..4e8d17fd 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -30,7 +30,7 @@ class SkateBoard : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 VTable0xd0() override; // vtable+0xd0 MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index a8738cbf..921ccbca 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -88,7 +88,7 @@ class TowTrack : public IslePathActor { MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 1a15d7c8..e1a52601 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -27,7 +27,7 @@ Ambulance::Ambulance() m_unk0x178 = -1; m_unk0x170 = 0; m_unk0x172 = 0; - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; m_unk0x17c = 1.0; } @@ -116,7 +116,7 @@ void Ambulance::FUN_10036e60() } // STUB: LEGO1 0x10036e90 -void Ambulance::VTable0xe4() +void Ambulance::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 20b6e904..3511971f 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -13,7 +13,7 @@ DECOMP_SIZE_ASSERT(Bike, 0x164) // FUNCTION: LEGO1 0x10076670 Bike::Bike() { - this->m_unk0x13c = 20.0; + this->m_maxLinearVel = 20.0; this->m_unk0x150 = 3.0; this->m_unk0x148 = 1; } @@ -32,9 +32,9 @@ MxResult Bike::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10076920 -void Bike::VTable0xe4() +void Bike::Exit() { - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); GameState()->SetCurrentArea(LegoGameState::Area::e_bike); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeDashboard_Bitmap); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeArms_Ctl); diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 9c3c174b..2d896957 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -29,7 +29,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) switch (GameState()->GetCurrentAct()) { case LegoGameState::Act::e_act1: { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -71,7 +71,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -95,7 +95,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) act1State->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -119,7 +119,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -141,7 +141,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -162,7 +162,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 30923948..f8d9f2dd 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c) // FUNCTION: LEGO1 0x10067bb0 DuneBuggy::DuneBuggy() { - this->m_unk0x13c = 25.0; + this->m_maxLinearVel = 25.0; this->m_unk0x164 = 1.0; } @@ -25,7 +25,7 @@ void DuneBuggy::VTable0x70(float p_float) } // STUB: LEGO1 0x10067fa0 -void DuneBuggy::VTable0xe4() +void DuneBuggy::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 1b765b2b..bcdbab6f 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -25,7 +25,7 @@ DECOMP_SIZE_ASSERT(MxMatrix, 0x48) // FUNCTION: LEGO1 0x10001e60 Helicopter::Helicopter() { - m_unk0x13c = 60; + m_maxLinearVel = 60; } // FUNCTION: LEGO1 0x10003230 @@ -63,7 +63,7 @@ void Helicopter::CreateState() } // FUNCTION: LEGO1 0x10003360 -void Helicopter::VTable0xe4() +void Helicopter::Exit() { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { SpawnPlayer( @@ -73,7 +73,7 @@ void Helicopter::VTable0xe4() ); } - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_copter); @@ -117,7 +117,7 @@ MxU32 Helicopter::HandleClick() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } @@ -144,7 +144,7 @@ MxU32 Helicopter::HandleClick() break; } - VTable0xe0(); + Enter(); InvokeAction(Extra::ActionType::e_start, m_script, IsleScript::c_HelicopterDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); @@ -179,7 +179,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) else if (m_state->GetUnkown8() != 0) { break; } - VTable0xe4(); + Exit(); GameState()->SetCurrentArea(LegoGameState::e_unk66); ret = 1; break; @@ -227,7 +227,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) lookat = dir; float scale = 3; lookat.Mul(scale); - lookat.Add(&loc); + lookat.Add(loc); Mx3DPointFloat v68, v7c, v90(0, 1, 0), va4; v68 = m_world->GetCamera()->GetWorldUp(); va4.EqualsCross(&v68, &dir); @@ -248,7 +248,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - VTable0xe4(); + Exit(); } ret = 1; break; @@ -379,9 +379,9 @@ void Helicopter::VTable0x70(float p_float) mat.SetIdentity(); m_unk0x1f4.Unknown6(mat, f2); v2.SetVector(loc); - v2.Sub(&v); + v2.Sub(v); v2.Mul(f2); - v2.Add(&v); + v2.Add(v); m_world->GetCamera()->FUN_100123e0(mat, 0); } else { diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 0f8da9e7..e920cb2f 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -14,6 +14,7 @@ #include "mxbackgroundaudiomanager.h" #include "mxnotificationparam.h" #include "scripts.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(IslePathActor, 0x160) DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38) @@ -25,9 +26,9 @@ IslePathActor::SpawnLocation g_spawnLocations[IslePathActor::c_LOCATIONS_NUM]; IslePathActor::IslePathActor() { m_world = NULL; - m_unk0x13c = 6.0; - m_unk0x15c = 1.0; - m_unk0x158 = NULL; + m_maxLinearVel = 6.0; + m_previousVel = 1.0; + m_previousActor = NULL; } // FUNCTION: LEGO1 0x1001a280 @@ -71,15 +72,15 @@ MxLong IslePathActor::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x1001a350 -void IslePathActor::VTable0xe0() +void IslePathActor::Enter() { m_roi->SetVisibility(FALSE); if (CurrentActor() != this) { - m_unk0x15c = NavController()->GetMaxLinearVel(); - m_unk0x158 = CurrentActor(); - if (m_unk0x158) { - m_unk0x158->ResetWorldTransform(FALSE); - m_unk0x158->SetUserNavFlag(FALSE); + m_previousVel = NavController()->GetMaxLinearVel(); + m_previousActor = CurrentActor(); + if (m_previousActor) { + m_previousActor->ResetWorldTransform(FALSE); + m_previousActor->SetUserNavFlag(FALSE); } } @@ -88,7 +89,7 @@ void IslePathActor::VTable0xe0() ResetWorldTransform(TRUE); SetUserNavFlag(TRUE); - NavController()->ResetLinearVel(m_unk0x13c); + NavController()->ResetMaxLinearVel(m_maxLinearVel); SetCurrentActor(this); FUN_1001b660(); @@ -96,10 +97,62 @@ void IslePathActor::VTable0xe0() } } -// STUB: LEGO1 0x1001a3f0 -void IslePathActor::VTable0xe4() +// FUNCTION: LEGO1 0x1001a3f0 +// FUNCTION: BETA10 0x1003669f +void IslePathActor::Exit() { - // TODO + Reset(); + + GetViewManager()->Remove(m_roi); + GetViewManager()->Add(m_roi); + + ResetWorldTransform(FALSE); + SetUserNavFlag(FALSE); + + if (m_previousActor != NULL) { + SetCurrentActor(m_previousActor); + NavController()->ResetMaxLinearVel(m_previousVel); + m_previousActor->ResetWorldTransform(TRUE); + m_previousActor->SetUserNavFlag(TRUE); + m_previousActor->SetBoundary(m_boundary); + + MxS32 i; + for (i = 0; i < m_boundary->GetNumEdges(); i++) { + LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) m_boundary->GetEdges()[i]; + assert(e); + + Mx3DPointFloat local20; + e->FUN_1002ddc0(*m_boundary, local20); + + ((Vector3&) local20).Mul(m_roi->GetWorldBoundingSphere().Radius()); + ((Vector3&) local20).Add(GetWorldPosition()); + + MxS32 j; + for (j = 0; j < m_boundary->GetNumEdges(); j++) { + Mx4DPointFloat& normal = *m_boundary->GetEdgeNormal(j); + + if (local20.Dot(&normal, &local20) + normal[3] < -0.001) { + break; + } + } + + if (m_boundary->GetNumEdges() == j) { + m_previousActor->SetLocation(local20, GetWorldDirection(), GetWorldUp(), TRUE); + break; + } + } + + if (m_boundary->GetNumEdges() == i) { + m_previousActor->SetLocation(GetWorldPosition(), GetWorldDirection(), GetWorldUp(), TRUE); + } + + m_previousActor->SetState(0); + GameState()->m_currentArea = LegoGameState::Area::e_unk66; + } + + FUN_1001b660(); + FUN_10010c30(); + FUN_1003eda0(); } // FUNCTION: LEGO1 0x1001a700 @@ -479,7 +532,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p m_world = world; if (p_und) { - VTable0xe0(); + Enter(); } m_world->PlaceActor( @@ -563,7 +616,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar m_world = CurrentWorld(); if (p_reset) { - VTable0xe0(); + Enter(); } m_world->PlaceActor(this); diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 2b26d842..8b79a9d3 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(Jetski, 0x164) // FUNCTION: LEGO1 0x1007e3b0 Jetski::Jetski() { - this->m_unk0x13c = 25.0; + this->m_maxLinearVel = 25.0; this->m_unk0x150 = 2.0; this->m_unk0x148 = 1; } @@ -24,7 +24,7 @@ void Jetski::VTable0x70(float p_float) } // STUB: LEGO1 0x1007e6f0 -void Jetski::VTable0xe4() +void Jetski::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 340ea64d..1aefb3d5 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -38,7 +38,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param) } if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } ((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw); diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index a716d266..101656d0 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(Motocycle, 0x16c) // FUNCTION: LEGO1 0x100357b0 Motocycle::Motocycle() { - this->m_unk0x13c = 40.0; + this->m_maxLinearVel = 40.0; this->m_unk0x150 = 1.75; this->m_unk0x148 = 1; this->m_unk0x164 = 1.0; @@ -25,7 +25,7 @@ void Motocycle::VTable0x70(float p_float) } // STUB: LEGO1 0x10035bc0 -void Motocycle::VTable0xe4() +void Motocycle::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 1ae45305..b1c563e3 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -51,7 +51,7 @@ undefined4 Pizzeria::HandleClick() if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index e32fab62..c4f57c9d 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -8,14 +8,14 @@ DECOMP_SIZE_ASSERT(RaceCar, 0x164) // FUNCTION: LEGO1 0x10028200 RaceCar::RaceCar() { - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; } // FUNCTION: LEGO1 0x10028420 RaceCar::~RaceCar() { ControlManager()->Unregister(this); - VTable0xe4(); + Exit(); } // STUB: LEGO1 0x10028490 diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 814e1332..90480a84 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -21,7 +21,7 @@ DECOMP_SIZE_ASSERT(SkateBoard, 0x168) SkateBoard::SkateBoard() { m_unk0x160 = FALSE; - m_unk0x13c = 15.0; + m_maxLinearVel = 15.0; m_unk0x150 = 3.5; m_unk0x148 = 1; @@ -54,7 +54,7 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10010050 -void SkateBoard::VTable0xe4() +void SkateBoard::Exit() { if (m_act1state->m_unk0x018 == 3) { Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); @@ -63,7 +63,7 @@ void SkateBoard::VTable0xe4() m_unk0x160 = FALSE; } - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); GameState()->m_currentArea = LegoGameState::Area::e_skateboard; RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); @@ -86,12 +86,12 @@ MxU32 SkateBoard::HandleClick() if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } if (!CurrentActor()->IsA("SkateBoard")) { - VTable0xe0(); + Enter(); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); @@ -111,7 +111,7 @@ MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param) MxU32 result = 0; if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) { - VTable0xe4(); + Exit(); GameState()->m_currentArea = LegoGameState::Area::e_unk66; result = 1; } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 4f259903..40958be7 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -21,7 +21,7 @@ TowTrack::TowTrack() m_unk0x170 = -1; m_unk0x16e = 0; m_unk0x174 = -1; - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; m_unk0x178 = 1.0; } @@ -96,7 +96,7 @@ MxU32 TowTrack::HandleClick() } // STUB: LEGO1 0x1004d8f0 -void TowTrack::VTable0xe4() +void TowTrack::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 8b8b30fa..50e1581c 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1573,7 +1573,7 @@ MxU16 LegoAnimationManager::FUN_10062110( Mx3DPointFloat position(p_roi->GetWorldPosition()); // TODO: Fix call - ((Vector3&) position).Sub(&p_position); + ((Vector3&) position).Sub(p_position); float len = position.LenSquared(); float min, max; @@ -2458,17 +2458,17 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn Vector3* v2 = p_edge->CCWVertex(*p_boundary); p1 = *v2; - ((Vector3&) p1).Sub(v1); + ((Vector3&) p1).Sub(*v1); ((Vector3&) p1).Mul(p_destScale); - ((Vector3&) p1).Add(v1); + ((Vector3&) p1).Add(*v1); BoundingBox boundingBox; Mx3DPointFloat vec(1.0f, 1.0f, 1.0f); boundingBox.Min() = p1; - boundingBox.Min().Sub(&vec); + boundingBox.Min().Sub(vec); boundingBox.Max() = p1; - boundingBox.Max().Add(&vec); + boundingBox.Max().Add(vec); return GetViewManager()->FUN_100a6150(boundingBox) == FALSE; } @@ -2677,7 +2677,7 @@ MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position) if (p_position != NULL) { Mx3DPointFloat vec(98.875f, 0.0f, -46.1564f); - ((Vector3&) vec).Sub(p_position); + ((Vector3&) vec).Sub(*p_position); if (vec.LenSquared() < 800.0f) { success = TRUE; @@ -2701,7 +2701,7 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) if (p_position != NULL) { Mx3DPointFloat vec(-21.375f, 0.0f, -41.75f); - ((Vector3&) vec).Sub(p_position); + ((Vector3&) vec).Sub(*p_position); if (vec.LenSquared() < 1000.0f) { success = TRUE; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 8f9d9b12..a0c1095b 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -467,7 +467,6 @@ MxBool FUN_1003ef60() GameState()->m_currentArea != LegoGameState::e_elevdown && GameState()->m_currentArea != LegoGameState::e_garadoor && GameState()->m_currentArea != LegoGameState::e_polidoor) { - if (CurrentActor() == NULL || !CurrentActor()->IsA("TowTrack")) { if (CurrentActor() == NULL || !CurrentActor()->IsA("Ambulance")) { MxU32 unk0x18 = act1State->GetUnknown18(); diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index af8c95b0..7414b8bf 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -29,7 +29,7 @@ LegoCarRaceActor::LegoCarRaceActor() m_unk0x08 = 1.0f; m_unk0x70 = 0.0f; m_unk0x0c = 0; - m_unk0x13c = 0.0f; + m_maxLinearVel = 0.0f; m_frequencyFactor = 1.0f; m_unk0x1c = 0; m_unk0x10 = 0.65f; diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index a0e72803..5160ab25 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -10,11 +10,11 @@ void LegoJetski::FUN_100136f0(float p_worldSpeed) { if (p_worldSpeed < 0) { LegoCarRaceActor::m_unk0x0c = 2; - m_unk0x13c = 0; + m_maxLinearVel = 0; SetWorldSpeed(0); } else { - m_unk0x13c = p_worldSpeed; + m_maxLinearVel = p_worldSpeed; } } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index f0e2e69b..0e8aeff8 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -97,7 +97,7 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform) else { m_state = 0; m_scheduledTime = 0.0f; - ((Vector3&) positionRef).Sub(&g_unk0x10104c18); // TODO: Fix call + ((Vector3&) positionRef).Sub(g_unk0x10104c18); // TODO: Fix call m_roi->FUN_100a58f0(p_transform); return TRUE; } @@ -218,7 +218,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) // TODO: Fix calls ((Mx3DPointFloat&) dir).Mul(2.0f); - ((Vector3&) positionRef).Add(&dir); + ((Vector3&) positionRef).Add(dir); for (MxS32 i = 0; i < m_boundary->GetNumEdges(); i++) { Mx4DPointFloat* normal = m_boundary->GetEdgeNormal(i); @@ -251,7 +251,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) Mx3DPointFloat dir = p_actor->GetWorldDirection(); MxMatrix matrix3 = MxMatrix(roi->GetLocal2World()); Vector3 positionRef(matrix3[3]); - ((Vector3&) positionRef).Add(&g_unk0x10104c18); + ((Vector3&) positionRef).Add(g_unk0x10104c18); roi->FUN_100a58f0(matrix3); #ifdef COMPAT_MODE @@ -463,7 +463,7 @@ MxU32 LegoExtraActor::VTable0x6c( Vector3 local60(local2world[3]); Mx3DPointFloat local54(p_v1); - ((Vector3&) local54).Sub(&local60); + ((Vector3&) local54).Sub(local60); float local1c = p_v2.Dot(&p_v2, &p_v2); float local24 = p_v2.Dot(&p_v2, &local54) * 2.0f; float local20 = local54.Dot(&local54, &local54); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 6990f1dd..b2250703 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -68,7 +68,7 @@ MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3 Mx3DPointFloat p1, p2, p3; p1 = p_point3; - ((Vector3&) p1).Sub(&p_point1); + ((Vector3&) p1).Sub(p_point1); m_BADuration = p1.LenSquared(); if (m_BADuration > 0.0f) { @@ -102,14 +102,14 @@ MxResult LegoPathActor::VTable0x88( Mx3DPointFloat p1, p2, p3, p4, p5; p1 = *v2; - ((Vector3&) p1).Sub(v1); + ((Vector3&) p1).Sub(*v1); ((Vector3&) p1).Mul(p_srcScale); - ((Vector3&) p1).Add(v1); + ((Vector3&) p1).Add(*v1); p2 = *v4; - ((Vector3&) p2).Sub(v3); + ((Vector3&) p2).Sub(*v3); ((Vector3&) p2).Mul(p_destScale); - ((Vector3&) p2).Add(v3); + ((Vector3&) p2).Add(*v3); m_boundary = p_boundary; m_destEdge = &p_destEdge; @@ -120,7 +120,7 @@ MxResult LegoPathActor::VTable0x88( p_destEdge.FUN_1002ddc0(*p_boundary, p3); p4 = p2; - ((Vector3&) p4).Sub(&p1); + ((Vector3&) p4).Sub(p1); p4.Unitize(); MxMatrix matrix; @@ -177,9 +177,9 @@ MxResult LegoPathActor::VTable0x84( Mx3DPointFloat p2, p3, p5; p2 = *v4; - ((Vector3&) p2).Sub(v3); + ((Vector3&) p2).Sub(*v3); ((Vector3&) p2).Mul(p_destScale); - ((Vector3&) p2).Add(v3); + ((Vector3&) p2).Add(*v3); m_boundary = p_boundary; m_destEdge = &p_destEdge; @@ -285,12 +285,12 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) m_worldSpeed *= m_unk0x144; nav->SetLinearVel(m_worldSpeed); Mx3DPointFloat p7(p2); - ((Vector3&) p7).Sub(&p6); + ((Vector3&) p7).Sub(p6); if (p7.Unitize() == 0) { float f = sqrt(p1.LenSquared()) * m_unk0x140; ((Vector3&) p7).Mul(f); - ((Vector3&) p1).Add(&p7); + ((Vector3&) p1).Add(p7); } } } @@ -474,7 +474,7 @@ MxU32 LegoPathActor::VTable0x6c( MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) { Mx3DPointFloat v2(p_v2); - ((Vector3&) v2).Sub(&p_v1); + ((Vector3&) v2).Sub(p_v1); float len = v2.LenSquared(); @@ -553,7 +553,7 @@ void LegoPathActor::ParseAction(char* p_extra) if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) { SetUserNavFlag(TRUE); - NavController()->ResetLinearVel(m_worldSpeed); + NavController()->ResetMaxLinearVel(m_worldSpeed); SetCurrentActor(this); } @@ -650,7 +650,7 @@ MxResult LegoPathActor::VTable0x9c() Mx3DPointFloat local84(m_unk0xec[2]); Mx3DPointFloat local70(local34); - ((Vector3&) local70).Sub(&localc0); + ((Vector3&) local70).Sub(localc0); float len = local70.LenSquared(); if (len >= 0.0f) { len = sqrt(len); diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index bcd1875c..297aa223 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -53,11 +53,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa Mx3DPointFloat v; v = p_point1; - ((Vector3&) v).Sub(ccwV); + ((Vector3&) v).Sub(*ccwV); float dot1 = v.Dot(&v, m_unk0x50); v = p_point2; - ((Vector3&) v).Sub(ccwV); + ((Vector3&) v).Sub(*ccwV); float dot2 = v.Dot(&v, m_unk0x50); if (dot2 > dot1) { @@ -201,7 +201,7 @@ MxU32 LegoPathBoundary::Intersect( if (local10 == 0) { local10 = 1; vec = p_point2; - ((Vector3&) vec).Sub(&p_point1); + ((Vector3&) vec).Sub(p_point1); len = vec.LenSquared(); if (len <= 0.0f) { @@ -235,10 +235,10 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = vec; p_point3.Mul(localc); - p_point3.Add(&p_point1); + p_point3.Add(p_point1); local50 = p_point2; - ((Vector3&) local50).Sub(local5c); + ((Vector3&) local50).Sub(*local5c); e->FUN_1002ddc0(*this, local70); @@ -258,7 +258,7 @@ MxU32 LegoPathBoundary::Intersect( Vector3* local90 = local88->CWVertex(*this); Mx3DPointFloat locala4(p_point3); - ((Vector3&) locala4).Sub(local90); + ((Vector3&) locala4).Sub(*local90); float local8c = locala4.Dot(&locala4, &local84); @@ -285,7 +285,7 @@ MxU32 LegoPathBoundary::Intersect( Vector3* localc4 = locala8->CWVertex(*this); Mx3DPointFloat locald8(p_point3); - ((Vector3&) locald8).Sub(localc4); + ((Vector3&) locald8).Sub(*localc4); float localc0 = locald8.Dot(&locald8, &localbc); @@ -317,7 +317,7 @@ MxU32 LegoPathBoundary::Intersect( else if (local58 > 0.0f && e->m_unk0x3c > local58) { p_point3 = local70; p_point3.Mul(local58); - p_point3.Add(local5c); + p_point3.Add(*local5c); p_edge = e; return 1; } @@ -345,7 +345,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) Mx3DPointFloat unk0x30; unk0x30 = m_unk0x30; - ((Vector3&) unk0x30).Sub(&p_presenter->m_unk0xa8); + ((Vector3&) unk0x30).Sub(p_presenter->m_unk0xa8); float len = unk0x30.LenSquared(); float local20 = p_presenter->m_unk0xa4 + m_unk0x44; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 19fc04fd..ddfe66ec 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -94,7 +94,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con for (i = 0; i < m_numN; i++) { // TODO: Fix call - ((Vector3&) m_unk0x10[i]).Add(&p_location); + ((Vector3&) m_unk0x10[i]).Add(p_location); } for (i = 0; i < m_numL; i++) { @@ -756,9 +756,9 @@ MxS32 LegoPathController::FUN_1004a240( Mx3DPointFloat vec; p_v1 = *p_edge->CCWVertex(*p_boundary); - p_v1.Sub(p_edge->CWVertex(*p_boundary)); + p_v1.Sub(*p_edge->CWVertex(*p_boundary)); p_v1.Mul(p_f1); - p_v1.Add(p_edge->CWVertex(*p_boundary)); + p_v1.Add(*p_edge->CWVertex(*p_boundary)); p_edge->FUN_1002ddc0(*p_boundary, vec); p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec); return 0; diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index 949ae142..0345f9eb 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -23,11 +23,11 @@ void LegoRaceCar::FUN_10012ea0(float p_worldSpeed) { if (p_worldSpeed < 0) { LegoCarRaceActor::m_unk0x0c = 2; - m_unk0x13c = 0; + m_maxLinearVel = 0; SetWorldSpeed(0); } else { - m_unk0x13c = p_worldSpeed; + m_maxLinearVel = p_worldSpeed; } } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index ffdb2b63..723a1a30 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -648,12 +648,7 @@ void LegoAnimPresenter::PutFrame() up = und; -#ifdef COMPAT_MODE - Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation(); - ((Vector3&) up).Sub(&location); -#else - ((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation()); -#endif + ((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation()); ((Vector3&) dir).Div(dirsqr); pos.EqualsCross(&dir, &up); pos.Unitize(); @@ -1119,7 +1114,7 @@ void LegoAnimPresenter::VTable0x8c() m_unk0xa8.Add((*m_unk0x78)[3]); } else { - m_unk0xa8.Add(&m_action->GetLocation()); + m_unk0xa8.Add(m_action->GetLocation()); } if (m_currentWorld == NULL) { @@ -1176,10 +1171,10 @@ MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_v1, Vector3& p_v2, float p_f1, fl b = p_v2; ((Vector3&) b).Mul(p_f1); - ((Vector3&) b).Add(&p_v1); + ((Vector3&) b).Add(p_v1); a = b; - ((Vector3&) a).Sub(&m_unk0xa8); + ((Vector3&) a).Sub(m_unk0xa8); float len = a.LenSquared(); if (len <= 0.0f) { diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index eaba5d98..56386538 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -66,12 +66,7 @@ void LegoLoopingAnimPresenter::PutFrame() up = und; -#ifdef COMPAT_MODE - Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation(); - ((Vector3&) up).Sub(&location); -#else - ((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation()); -#endif + ((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation()); ((Vector3&) dir).Div(dirsqr); pos.EqualsCross(&dir, &up); pos.Unitize(); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 806903af..de524cb2 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -717,13 +717,13 @@ void Isle::Enable(MxBool p_enable) Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); - ((Vector3&) sub).Sub(&position); + ((Vector3&) sub).Sub(position); if (sub.LenSquared() < 1024.0f) { AnimationManager()->FUN_10064740(NULL); } Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f); - ((Vector3&) sub2).Sub(&position); + ((Vector3&) sub2).Sub(position); if (sub2.LenSquared() < 1024.0f) { AnimationManager()->FUN_10064670(NULL); } @@ -1219,7 +1219,7 @@ MxBool Isle::Escape() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } @@ -1265,7 +1265,7 @@ void Isle::FUN_10033350() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index 117a50af..b3976b51 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -42,9 +42,9 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L } else if (p_f1 >= 0.999) { v1 = m_unk0x00[0]; - ((Vector3&) v1).Add(&m_unk0x00[1]); - ((Vector3&) v1).Add(&m_unk0x00[2]); - ((Vector3&) v1).Add(&m_unk0x00[3]); + ((Vector3&) v1).Add(m_unk0x00[1]); + ((Vector3&) v1).Add(m_unk0x00[2]); + ((Vector3&) v1).Add(m_unk0x00[3]); for (LegoS32 i = 0; i < 3; i++) { v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f; diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c978b6ce..c2f35dae 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -565,7 +565,7 @@ LegoU32 LegoROI::FUN_100a9410( if (p_collideBox) { Mx3DPointFloat v2(p_v2); ((Vector3&) v2).Mul(p_f1); - ((Vector3&) v2).Add(&p_v1); + ((Vector3&) v2).Add(p_v1); Mx4DPointFloat localc0; Mx4DPointFloat local9c; @@ -585,7 +585,7 @@ LegoU32 LegoROI::FUN_100a9410( localc0[3] = local9c[3] = local168[3] = 1.0f; local38 = local58; - ((Vector3&) local38).Add(&locala8); + ((Vector3&) local38).Add(locala8); ((Vector3&) local38).Mul(0.5f); local70 = localc0; @@ -624,7 +624,7 @@ LegoU32 LegoROI::FUN_100a9410( if (local50 >= 0.0f && local50 <= p_f1) { Mx3DPointFloat local17c(p_v2); ((Vector3&) local17c).Mul(local50); - ((Vector3&) local17c).Add(&local4c); + ((Vector3&) local17c).Add(local4c); LegoS32 j; for (j = 0; j < 6; j++) { @@ -644,7 +644,7 @@ LegoU32 LegoROI::FUN_100a9410( } else { Mx3DPointFloat v1(p_v1); - ((Vector3&) v1).Sub(&GetWorldBoundingSphere().Center()); + ((Vector3&) v1).Sub(GetWorldBoundingSphere().Center()); float local10 = GetWorldBoundingSphere().Radius(); float local8 = p_v2.Dot(&p_v2, &p_v2); @@ -681,7 +681,7 @@ LegoU32 LegoROI::FUN_100a9410( if (local1c >= 0.0f && p_f1 >= local1c) { p_v3 = p_v2; p_v3.Mul(local1c); - p_v3.Add(&p_v1); + p_v3.Add(p_v1); return 1; } } @@ -708,13 +708,7 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) Mx3DPointFloat targetPosition(p_matrix[3]); // TODO: Figure out how to get type right for the call - // TODO: Fix constness of vector/matrix functions -#ifdef COMPAT_MODE - Vector3 worldPosition(m_local2world[3]); - ((Vector3&) targetPosition).Sub(&worldPosition); -#else - ((Vector3&) targetPosition).Sub(&Vector3(m_local2world[3])); -#endif + ((Vector3&) targetPosition).Sub(Vector3(m_local2world[3])); float division = time * 0.001; ((Vector3&) targetPosition).Div(division); diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 970695bb..61fdac1d 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -149,10 +149,10 @@ inline void UnknownMx4DPointFloat::Unknown7() Mx4DPointFloat v2; v1 = m_unk0x00; - ((Vector4&) v1).Add(&m_unk0x18); + ((Vector4&) v1).Add(m_unk0x18); v2 = m_unk0x00; - ((Vector4&) v2).Sub(&m_unk0x18); + ((Vector4&) v2).Sub(m_unk0x18); if (v1.Dot(&v1, &v1) < v2.Dot(&v2, &v2)) { ((Vector4&) m_unk0x18).Mul(-1.0f); diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 01a15d49..3fd82220 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -120,13 +120,13 @@ class Vector2 { virtual void Add(float* p_other) { AddImpl(p_other); } // vtable+0x4c // FUNCTION: LEGO1 0x100021e0 - virtual void Add(const Vector2* p_other) { AddImpl((float*) p_other->m_data); } // vtable+0x48 + virtual void Add(const Vector2& p_other) { AddImpl((float*) p_other.m_data); } // vtable+0x48 // FUNCTION: LEGO1 0x100021f0 virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58 // FUNCTION: LEGO1 0x10002200 - virtual void Sub(const Vector2* p_other) { SubImpl((float*) p_other->m_data); } // vtable+0x54 + virtual void Sub(const Vector2& p_other) { SubImpl((float*) p_other.m_data); } // vtable+0x54 // FUNCTION: LEGO1 0x10002210 virtual void Mul(float* p_other) { MulVectorImpl(p_other); } // vtable+0x64 diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index fe6c00a6..3531381c 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -428,10 +428,10 @@ void ViewManager::UpdateViewTransformations() Vector3 u(unk0x150[i]); x = c; - ((Vector3&) x).Sub(&b); // TODO: Fix call + ((Vector3&) x).Sub(b); // TODO: Fix call y = a; - ((Vector3&) y).Sub(&b); // TODO: Fix call + ((Vector3&) y).Sub(b); // TODO: Fix call u.EqualsCross(&x, &y); u.Unitize(); From ca17928fc60e6ef25b10d3f4a6a5ff565ba96801 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 12:19:43 -0400 Subject: [PATCH 24/26] Implement/match Ambulance::Notify (#998) --- LEGO1/lego/legoomni/include/ambulance.h | 18 +++--- LEGO1/lego/legoomni/include/bike.h | 8 +-- LEGO1/lego/legoomni/include/dunebuggy.h | 12 ++-- LEGO1/lego/legoomni/include/helicopter.h | 14 ++--- LEGO1/lego/legoomni/include/islepathactor.h | 10 ++-- LEGO1/lego/legoomni/include/jetski.h | 10 ++-- LEGO1/lego/legoomni/include/motocycle.h | 12 ++-- LEGO1/lego/legoomni/include/racecar.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 10 ++-- LEGO1/lego/legoomni/include/towtrack.h | 16 +++--- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 57 ++++++++++++++++--- LEGO1/lego/legoomni/src/actors/bike.cpp | 4 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 6 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 6 +- .../legoomni/src/actors/islepathactor.cpp | 6 +- LEGO1/lego/legoomni/src/actors/jetski.cpp | 4 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 6 +- LEGO1/lego/legoomni/src/actors/racecar.cpp | 2 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 6 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 8 +-- 20 files changed, 131 insertions(+), 86 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index a22c0515..aa357385 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -4,6 +4,8 @@ #include "islepathactor.h" #include "legostate.h" +class MxEndActionNotificationParam; + // VTABLE: LEGO1 0x100d72a0 // SIZE 0x24 class AmbulanceMissionState : public LegoState { @@ -83,13 +85,15 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 + virtual MxLong HandleButtonDown(LegoControlManagerEvent& p_param); // vtable+0xf0 + virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index b042bee6..a77156b5 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -23,10 +23,10 @@ class Bike : public IslePathActor { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void FUN_10076b60(); diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 287417d6..662d90ef 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -23,12 +23,12 @@ class DuneBuggy : public IslePathActor { return !strcmp(p_name, DuneBuggy::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 1617d6b5..2676aa52 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -63,13 +63,13 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + void Exit() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 4150db87..48aef88f 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -107,19 +107,19 @@ class IslePathActor : public LegoPathActor { void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c // FUNCTION: LEGO1 0x10002e70 - virtual MxU32 HandleClick() { return 0; } // vtable+0xcc + virtual MxLong HandleClick() { return 0; } // vtable+0xcc // FUNCTION: LEGO1 0x10002df0 - virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 + virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0 // FUNCTION: LEGO1 0x10002e80 - virtual MxU32 HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 + virtual MxLong HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 - virtual MxU32 VTable0xd8(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 + virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc + virtual MxLong HandleNotification19(MxType19NotificationParam&) { return 0; } // vtable+0xdc virtual void Enter(); // vtable+0xe0 virtual void Exit(); // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 3eb972a6..b49b11fe 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -25,11 +25,11 @@ class Jetski : public IslePathActor { return !strcmp(p_name, Jetski::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index 1e7599af..8a15967f 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -23,12 +23,12 @@ class Motocycle : public IslePathActor { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam&) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/racecar.h b/LEGO1/lego/legoomni/include/racecar.h index 72174c8f..b0afd960 100644 --- a/LEGO1/lego/legoomni/include/racecar.h +++ b/LEGO1/lego/legoomni/include/racecar.h @@ -25,7 +25,7 @@ class RaceCar : public IslePathActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc + MxLong HandleClick() override; // vtable+0xcc // SYNTHETIC: LEGO1 0x10028400 // RaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 4e8d17fd..fa78c2e8 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -26,11 +26,11 @@ class SkateBoard : public IslePathActor { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 VTable0xd0() override; // vtable+0xd0 - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleNotification0() override; // vtable+0xd0 + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 921ccbca..ee91b5a5 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -81,14 +81,14 @@ class TowTrack : public IslePathActor { return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name); } - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index e1a52601..2474c7b9 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -16,18 +16,19 @@ DECOMP_SIZE_ASSERT(Ambulance, 0x184) DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) // FUNCTION: LEGO1 0x10035ee0 +// FUNCTION: BETA10 0x10022820 Ambulance::Ambulance() { + m_maxLinearVel = 40.0; + m_state = NULL; m_unk0x168 = 0; m_unk0x16a = -1; - m_state = NULL; m_unk0x16c = 0; - m_unk0x174 = -1; m_unk0x16e = 0; - m_unk0x178 = -1; m_unk0x170 = 0; + m_unk0x174 = -1; m_unk0x172 = 0; - m_maxLinearVel = 40.0; + m_unk0x178 = -1; m_unk0x17c = 1.0; } @@ -37,6 +38,7 @@ void Ambulance::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x10036150 +// FUNCTION: BETA10 0x100228fe Ambulance::~Ambulance() { ControlManager()->Unregister(this); @@ -44,6 +46,7 @@ Ambulance::~Ambulance() } // FUNCTION: LEGO1 0x100361d0 +// FUNCTION: BETA10 0x10022993 MxResult Ambulance::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); @@ -76,6 +79,7 @@ void Ambulance::VTable0x70(float p_float) } // FUNCTION: LEGO1 0x100363f0 +// FUNCTION: BETA10 0x10022b2a void Ambulance::CreateState() { LegoGameState* gameState = GameState(); @@ -88,22 +92,59 @@ void Ambulance::CreateState() m_state = state; } -// STUB: LEGO1 0x10036420 +// FUNCTION: LEGO1 0x10036420 +// FUNCTION: BETA10 0x10022b84 MxLong Ambulance::Notify(MxParam& p_param) +{ + MxLong result = 0; + + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationType0: + result = HandleNotification0(); + break; + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationButtonDown: + result = HandleButtonDown((LegoControlManagerEvent&) p_param); + break; + case c_notificationClick: + result = HandleClick(); + break; + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); + break; + case c_notificationType19: + result = HandleNotification19((MxType19NotificationParam&) p_param); + break; + } + + return result; +} + +// STUB: LEGO1 0x100364d0 +MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x100367c0 +MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10036860 -MxU32 Ambulance::VTable0xdc(MxType19NotificationParam& p_param) +MxLong Ambulance::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x10036ce0 -MxU32 Ambulance::HandleClick() +MxLong Ambulance::HandleClick() { // TODO return 0; @@ -122,7 +163,7 @@ void Ambulance::Exit() } // STUB: LEGO1 0x10036f90 -MxU32 Ambulance::HandleControl(LegoControlManagerEvent& p_param) +MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 3511971f..52401e28 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -45,14 +45,14 @@ void Bike::Exit() } // STUB: LEGO1 0x100769a0 -MxU32 Bike::HandleClick() +MxLong Bike::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10076aa0 -MxU32 Bike::HandleControl(LegoControlManagerEvent& p_param) +MxLong Bike::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index f8d9f2dd..5f51d088 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -31,21 +31,21 @@ void DuneBuggy::Exit() } // STUB: LEGO1 0x10068060 -MxU32 DuneBuggy::HandleClick() +MxLong DuneBuggy::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x100681b0 -MxU32 DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) +MxLong DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10068270 -MxU32 DuneBuggy::VTable0xdc(MxType19NotificationParam& p_param) +MxLong DuneBuggy::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index bcdbab6f..5bd4b364 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -103,7 +103,7 @@ void Helicopter::Exit() } // FUNCTION: LEGO1 0x10003480 -MxU32 Helicopter::HandleClick() +MxLong Helicopter::HandleClick() { if (!FUN_1003ef60()) { return 1; @@ -152,7 +152,7 @@ MxU32 Helicopter::HandleClick() } // FUNCTION: LEGO1 0x100035e0 -MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) +MxLong Helicopter::HandleControl(LegoControlManagerEvent& p_param) { MxU32 ret = 0; MxAtomId script; @@ -261,7 +261,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10003c20 -MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param) +MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { MxU32 ret = 0; diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index e920cb2f..e58ff645 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -52,7 +52,7 @@ MxLong IslePathActor::Notify(MxParam& p_param) switch (((MxNotificationParam&) p_param).GetType()) { case c_notificationType0: - ret = VTable0xd0(); + ret = HandleNotification0(); break; case c_notificationClick: ret = HandleClick(); @@ -61,10 +61,10 @@ MxLong IslePathActor::Notify(MxParam& p_param) ret = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationEndAnim: - ret = VTable0xd8((LegoEndAnimNotificationParam&) p_param); + ret = HandleEndAnim((LegoEndAnimNotificationParam&) p_param); break; case c_notificationType19: - ret = VTable0xdc((MxType19NotificationParam&) p_param); + ret = HandleNotification19((MxType19NotificationParam&) p_param); break; } diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 8b79a9d3..fa6ad80b 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -30,14 +30,14 @@ void Jetski::Exit() } // STUB: LEGO1 0x1007e750 -MxU32 Jetski::HandleClick() +MxLong Jetski::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x1007e8e0 -MxU32 Jetski::HandleControl(LegoControlManagerEvent& p_param) +MxLong Jetski::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 101656d0..01ae480e 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -31,21 +31,21 @@ void Motocycle::Exit() } // STUB: LEGO1 0x10035c50 -MxU32 Motocycle::HandleClick() +MxLong Motocycle::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10035d70 -MxU32 Motocycle::HandleControl(LegoControlManagerEvent& p_param) +MxLong Motocycle::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10035df0 -MxU32 Motocycle::VTable0xdc(MxType19NotificationParam& p_param) +MxLong Motocycle::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index c4f57c9d..c38d3537 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -26,7 +26,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction) } // STUB: LEGO1 0x100284d0 -MxU32 RaceCar::HandleClick() +MxLong RaceCar::HandleClick() { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 90480a84..8e88733a 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -71,7 +71,7 @@ void SkateBoard::Exit() } // FUNCTION: LEGO1 0x100100e0 -MxU32 SkateBoard::HandleClick() +MxLong SkateBoard::HandleClick() { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -106,7 +106,7 @@ MxU32 SkateBoard::HandleClick() } // FUNCTION: LEGO1 0x10010230 -MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param) +MxLong SkateBoard::HandleControl(LegoControlManagerEvent& p_param) { MxU32 result = 0; @@ -139,7 +139,7 @@ void SkateBoard::EnableScenePresentation(MxBool p_enable) // FUNCTION: LEGO1 0x100104f0 // FUNCTION: BETA10 0x100f5472 -MxU32 SkateBoard::VTable0xd0() +MxLong SkateBoard::HandleNotification0() { EnableScenePresentation(m_unk0x160); return 1; diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 40958be7..461777cf 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -75,21 +75,21 @@ MxLong TowTrack::Notify(MxParam& p_param) } // STUB: LEGO1 0x1004cd30 -MxU32 TowTrack::VTable0xd8(LegoEndAnimNotificationParam& p_param) +MxLong TowTrack::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x1004d330 -MxU32 TowTrack::VTable0xdc(MxType19NotificationParam& p_param) +MxLong TowTrack::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x1004d690 -MxU32 TowTrack::HandleClick() +MxLong TowTrack::HandleClick() { // TODO return 0; @@ -102,7 +102,7 @@ void TowTrack::Exit() } // STUB: LEGO1 0x1004d9e0 -MxU32 TowTrack::HandleControl(LegoControlManagerEvent& p_param) +MxLong TowTrack::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; From ba378eb22442d71fe4f23a5c818cdfad16d3b16d Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 6 Jun 2024 17:15:57 -0400 Subject: [PATCH 25/26] Streamline MxVideoParamFlags (#999) * Streamline MxVideoParamFlags * Remove this-> from MxOmniCreateFlags --- LEGO1/omni/include/mxomnicreateflags.h | 28 ++++---- LEGO1/omni/include/mxvideoparam.h | 27 +++++--- LEGO1/omni/include/mxvideoparamflags.h | 81 +++++++++++++--------- LEGO1/omni/src/main/mxomnicreateflags.cpp | 20 +++--- LEGO1/omni/src/video/mxvideoparam.cpp | 71 ++++++++++--------- LEGO1/omni/src/video/mxvideoparamflags.cpp | 24 ++++--- 6 files changed, 144 insertions(+), 107 deletions(-) diff --git a/LEGO1/omni/include/mxomnicreateflags.h b/LEGO1/omni/include/mxomnicreateflags.h index 561af2a1..c3b25957 100644 --- a/LEGO1/omni/include/mxomnicreateflags.h +++ b/LEGO1/omni/include/mxomnicreateflags.h @@ -9,46 +9,46 @@ class MxOmniCreateFlags { MxOmniCreateFlags(); // FUNCTION: BETA10 0x10092b50 - inline void CreateObjectFactory(MxBool p_enable) { this->m_flags1.m_bit0 = p_enable; } + inline void CreateObjectFactory(MxBool p_enable) { m_flags1.m_bit0 = p_enable; } // FUNCTION: BETA10 0x10092b90 - inline void CreateTickleManager(MxBool p_enable) { this->m_flags1.m_bit2 = p_enable; } + inline void CreateTickleManager(MxBool p_enable) { m_flags1.m_bit2 = p_enable; } // FUNCTION: BETA10 0x10092bd0 - inline void CreateVideoManager(MxBool p_enable) { this->m_flags1.m_bit4 = p_enable; } + inline void CreateVideoManager(MxBool p_enable) { m_flags1.m_bit4 = p_enable; } // FUNCTION: BETA10 0x10092c10 - inline void CreateSoundManager(MxBool p_enable) { this->m_flags1.m_bit5 = p_enable; } + inline void CreateSoundManager(MxBool p_enable) { m_flags1.m_bit5 = p_enable; } // FUNCTION: BETA10 0x10130cd0 - inline const MxBool CreateObjectFactory() const { return this->m_flags1.m_bit0; } + inline const MxBool CreateObjectFactory() const { return m_flags1.m_bit0; } // FUNCTION: BETA10 0x10130cf0 - inline const MxBool CreateVariableTable() const { return this->m_flags1.m_bit1; } + inline const MxBool CreateVariableTable() const { return m_flags1.m_bit1; } // FUNCTION: BETA10 0x10130d10 - inline const MxBool CreateTickleManager() const { return this->m_flags1.m_bit2; } + inline const MxBool CreateTickleManager() const { return m_flags1.m_bit2; } // FUNCTION: BETA10 0x10130d30 - inline const MxBool CreateNotificationManager() const { return this->m_flags1.m_bit3; } + inline const MxBool CreateNotificationManager() const { return m_flags1.m_bit3; } // FUNCTION: BETA10 0x10130d50 - inline const MxBool CreateVideoManager() const { return this->m_flags1.m_bit4; } + inline const MxBool CreateVideoManager() const { return m_flags1.m_bit4; } // FUNCTION: BETA10 0x10130d70 - inline const MxBool CreateSoundManager() const { return this->m_flags1.m_bit5; } + inline const MxBool CreateSoundManager() const { return m_flags1.m_bit5; } // FUNCTION: BETA10 0x10130d90 - inline const MxBool CreateMusicManager() const { return this->m_flags1.m_bit6; } + inline const MxBool CreateMusicManager() const { return m_flags1.m_bit6; } // FUNCTION: BETA10 0x10130db0 - inline const MxBool CreateEventManager() const { return this->m_flags1.m_bit7; } + inline const MxBool CreateEventManager() const { return m_flags1.m_bit7; } // FUNCTION: BETA10 0x10130dd0 - inline const MxBool CreateTimer() const { return this->m_flags2.m_bit1; } + inline const MxBool CreateTimer() const { return m_flags2.m_bit1; } // FUNCTION: BETA10 0x10130e00 - inline const MxBool CreateStreamer() const { return this->m_flags2.m_bit2; } + inline const MxBool CreateStreamer() const { return m_flags2.m_bit2; } private: FlagBitfield m_flags1; diff --git a/LEGO1/omni/include/mxvideoparam.h b/LEGO1/omni/include/mxvideoparam.h index f9766b97..c3185738 100644 --- a/LEGO1/omni/include/mxvideoparam.h +++ b/LEGO1/omni/include/mxvideoparam.h @@ -14,22 +14,33 @@ class MxPalette; class MxVideoParam { public: MxVideoParam(); - MxVideoParam(MxVideoParam& p_videoParam); __declspec(dllexport) MxVideoParam(MxRect32& p_rect, MxPalette* p_palette, MxULong p_backBuffers, MxVideoParamFlags& p_flags); - MxVideoParam& operator=(const MxVideoParam& p_videoParam); + MxVideoParam(MxVideoParam& p_videoParam); ~MxVideoParam(); void SetDeviceName(char* p_deviceId); + MxVideoParam& operator=(const MxVideoParam& p_videoParam); + // FUNCTION: BETA10 0x100886e0 inline MxVideoParamFlags& Flags() { return m_flags; } - inline void SetPalette(MxPalette* p_palette) { this->m_palette = p_palette; } - inline void SetBackBuffers(MxU32 p_backBuffers) { this->m_backBuffers = p_backBuffers; } + // FUNCTION: BETA10 0x100d81f0 + inline MxRect32& GetRect() { return m_rect; } - inline MxRect32& GetRect() { return this->m_rect; } - inline MxPalette* GetPalette() { return this->m_palette; } - inline MxU32 GetBackBuffers() { return this->m_backBuffers; } - inline char* GetDeviceName() { return this->m_deviceId; } + // FUNCTION: BETA10 0x100d8210 + inline MxPalette* GetPalette() { return m_palette; } + + // FUNCTION: BETA10 0x100d8240 + inline void SetPalette(MxPalette* p_palette) { m_palette = p_palette; } + + // FUNCTION: BETA10 0x100d8270 + inline char* GetDeviceName() { return m_deviceId; } + + // FUNCTION: BETA10 0x10141f60 + inline MxU32 GetBackBuffers() { return m_backBuffers; } + + // FUNCTION: BETA10 0x10141fe0 + inline void SetBackBuffers(MxU32 p_backBuffers) { m_backBuffers = p_backBuffers; } private: MxRect32 m_rect; // 0x00 diff --git a/LEGO1/omni/include/mxvideoparamflags.h b/LEGO1/omni/include/mxvideoparamflags.h index 8b937d38..25f9bb50 100644 --- a/LEGO1/omni/include/mxvideoparamflags.h +++ b/LEGO1/omni/include/mxvideoparamflags.h @@ -9,39 +9,56 @@ class MxVideoParamFlags { public: MxVideoParamFlags(); - inline void SetFullScreen(BOOL p_e) { m_flags1.m_bit0 = p_e; } - inline void SetFlipSurfaces(BOOL p_e) { m_flags1.m_bit1 = p_e; } - inline void SetBackBuffers(BOOL p_e) { m_flags1.m_bit2 = p_e; } - inline void SetF1bit3(BOOL p_e) { m_flags1.m_bit3 = p_e; } - inline void SetF1bit4(BOOL p_e) { m_flags1.m_bit4 = p_e; } - inline void Set16Bit(BYTE p_e) { m_flags1.m_bit5 = p_e; } - inline void SetWideViewAngle(BOOL p_e) { m_flags1.m_bit6 = p_e; } - inline void SetF1bit7(BOOL p_e) { m_flags1.m_bit7 = p_e; } - inline void SetF2bit0(BOOL p_e) { m_flags2.m_bit0 = p_e; } - inline void SetF2bit1(BOOL p_e) { m_flags2.m_bit1 = p_e; } - inline void SetF2bit2(BOOL p_e) { m_flags2.m_bit2 = p_e; } - inline void SetF2bit3(BOOL p_e) { m_flags2.m_bit3 = p_e; } - inline void SetF2bit4(BOOL p_e) { m_flags2.m_bit4 = p_e; } - inline void SetF2bit5(BOOL p_e) { m_flags2.m_bit5 = p_e; } - inline void SetF2bit6(BOOL p_e) { m_flags2.m_bit6 = p_e; } - inline void SetF2bit7(BOOL p_e) { m_flags2.m_bit7 = p_e; } + // inlined in ISLE + inline void SetFullScreen(MxBool p_e) { m_flags1.m_bit0 = p_e; } - inline BYTE GetFullScreen() { return m_flags1.m_bit0; } - inline BYTE GetFlipSurfaces() { return m_flags1.m_bit1; } - inline BYTE GetBackBuffers() { return m_flags1.m_bit2; } - inline BYTE GetF1bit3() { return m_flags1.m_bit3; } - inline BYTE GetF1bit4() { return m_flags1.m_bit4; } - inline BYTE Get16Bit() { return m_flags1.m_bit5; } - inline BYTE GetWideViewAngle() { return m_flags1.m_bit6; } - inline BYTE GetF1bit7() { return m_flags1.m_bit7; } - inline BYTE GetF2bit0() { return m_flags2.m_bit0; } - inline BYTE GetF2bit1() { return m_flags2.m_bit1; } - inline BYTE GetF2bit2() { return m_flags2.m_bit2; } - inline BYTE GetF2bit3() { return m_flags2.m_bit3; } - inline BYTE GetF2bit4() { return m_flags2.m_bit4; } - inline BYTE GetF2bit5() { return m_flags2.m_bit5; } - inline BYTE GetF2bit6() { return m_flags2.m_bit6; } - inline BYTE GetF2bit7() { return m_flags2.m_bit7; } + // FUNCTION: BETA10 0x10141f80 + inline void SetFlipSurfaces(MxBool p_e) { m_flags1.m_bit1 = p_e; } + + // FUNCTION: BETA10 0x10141fb0 + inline void SetBackBuffers(MxBool p_e) { m_flags1.m_bit2 = p_e; } + + // FUNCTION: BETA10 0x100d9250 + inline void SetF1bit3(MxBool p_e) { m_flags1.m_bit3 = p_e; } + + // inlined in ISLE + inline void Set16Bit(MxBool p_e) { m_flags1.m_bit5 = p_e; } + + // inlined in ISLE + inline void SetWideViewAngle(MxBool p_e) { m_flags1.m_bit6 = p_e; } + + // inlined in ISLE + inline void SetF1bit7(MxBool p_e) { m_flags1.m_bit7 = p_e; } + + // FUNCTION: BETA10 0x100d81b0 + inline void SetF2bit0(MxBool p_e) { m_flags2.m_bit0 = p_e; } + + // inlined in ISLE + inline void SetF2bit1(MxBool p_e) { m_flags2.m_bit1 = p_e; } + + // FUNCTION: BETA10 0x1009e770 + inline MxBool GetFullScreen() { return m_flags1.m_bit0; } + + // FUNCTION: BETA10 0x100d80f0 + inline MxBool GetFlipSurfaces() { return m_flags1.m_bit1; } + + // FUNCTION: BETA10 0x100d8120 + inline MxBool GetBackBuffers() { return m_flags1.m_bit2; } + + // FUNCTION: BETA10 0x10142010 + inline MxBool GetF1bit3() { return m_flags1.m_bit3; } + + // FUNCTION: BETA10 0x100d8150 + inline MxBool Get16Bit() { return m_flags1.m_bit5; } + + // FUNCTION: BETA10 0x100d8180 + inline MxBool GetWideViewAngle() { return m_flags1.m_bit6; } + + // FUNCTION: BETA10 0x100886b0 + inline MxBool GetF2bit0() { return m_flags2.m_bit0; } + + // FUNCTION: BETA10 0x10142050 + inline MxBool GetF2bit1() { return m_flags2.m_bit1; } private: FlagBitfield m_flags1; diff --git a/LEGO1/omni/src/main/mxomnicreateflags.cpp b/LEGO1/omni/src/main/mxomnicreateflags.cpp index 916c7bcd..2edaaf17 100644 --- a/LEGO1/omni/src/main/mxomnicreateflags.cpp +++ b/LEGO1/omni/src/main/mxomnicreateflags.cpp @@ -8,15 +8,15 @@ DECOMP_SIZE_ASSERT(MxOmniCreateFlags, 0x02) // FUNCTION: BETA10 0x10130a1c MxOmniCreateFlags::MxOmniCreateFlags() { - this->m_flags1.m_bit0 = TRUE; // CreateObjectFactory - this->m_flags1.m_bit1 = TRUE; // CreateVariableTable - this->m_flags1.m_bit2 = TRUE; // CreateTickleManager - this->m_flags1.m_bit3 = TRUE; // CreateNotificationManager - this->m_flags1.m_bit4 = TRUE; // CreateVideoManager - this->m_flags1.m_bit5 = TRUE; // CreateSoundManager - this->m_flags1.m_bit6 = TRUE; // CreateMusicManager - this->m_flags1.m_bit7 = TRUE; // CreateEventManager + m_flags1.m_bit0 = TRUE; // CreateObjectFactory + m_flags1.m_bit1 = TRUE; // CreateVariableTable + m_flags1.m_bit2 = TRUE; // CreateTickleManager + m_flags1.m_bit3 = TRUE; // CreateNotificationManager + m_flags1.m_bit4 = TRUE; // CreateVideoManager + m_flags1.m_bit5 = TRUE; // CreateSoundManager + m_flags1.m_bit6 = TRUE; // CreateMusicManager + m_flags1.m_bit7 = TRUE; // CreateEventManager - this->m_flags2.m_bit1 = TRUE; // CreateTimer - this->m_flags2.m_bit2 = TRUE; // CreateStreamer + m_flags2.m_bit1 = TRUE; // CreateTimer + m_flags2.m_bit2 = TRUE; // CreateStreamer } diff --git a/LEGO1/omni/src/video/mxvideoparam.cpp b/LEGO1/omni/src/video/mxvideoparam.cpp index 8e48773f..9a095c4e 100644 --- a/LEGO1/omni/src/video/mxvideoparam.cpp +++ b/LEGO1/omni/src/video/mxvideoparam.cpp @@ -5,79 +5,82 @@ #include #include -DECOMP_SIZE_ASSERT(MxVideoParam, 0x24); +DECOMP_SIZE_ASSERT(MxVideoParam, 0x24) // FUNCTION: LEGO1 0x100bec70 +// FUNCTION: BETA10 0x1012db3e MxVideoParam::MxVideoParam() { - this->m_rect.SetRight(640); - this->m_rect.SetBottom(480); - this->m_rect.SetLeft(0); - this->m_rect.SetTop(0); - this->m_palette = NULL; - this->m_backBuffers = 0; - this->m_unk0x1c = 0; - this->m_deviceId = NULL; + m_rect = MxRect32(0, 0, 640, 480); + m_palette = NULL; + m_backBuffers = 0; + m_unk0x1c = 0; + m_deviceId = NULL; } // FUNCTION: LEGO1 0x100beca0 +// FUNCTION: BETA10 0x1012dbb1 MxVideoParam::MxVideoParam(MxRect32& p_rect, MxPalette* p_palette, MxULong p_backBuffers, MxVideoParamFlags& p_flags) { - this->m_rect = p_rect; - this->m_palette = p_palette; - this->m_backBuffers = p_backBuffers; - this->m_flags = p_flags; - this->m_unk0x1c = 0; - this->m_deviceId = NULL; + m_rect = p_rect; + m_palette = p_palette; + m_backBuffers = p_backBuffers; + m_flags = p_flags; + m_unk0x1c = 0; + m_deviceId = NULL; } // FUNCTION: LEGO1 0x100becf0 +// FUNCTION: BETA10 0x1012dc1e MxVideoParam::MxVideoParam(MxVideoParam& p_videoParam) { - this->m_rect = p_videoParam.m_rect; - this->m_palette = p_videoParam.m_palette; - this->m_backBuffers = p_videoParam.m_backBuffers; - this->m_flags = p_videoParam.m_flags; - this->m_unk0x1c = p_videoParam.m_unk0x1c; - this->m_deviceId = NULL; + m_rect = p_videoParam.m_rect; + m_palette = p_videoParam.m_palette; + m_backBuffers = p_videoParam.m_backBuffers; + m_flags = p_videoParam.m_flags; + m_unk0x1c = p_videoParam.m_unk0x1c; + m_deviceId = NULL; SetDeviceName(p_videoParam.m_deviceId); } // FUNCTION: LEGO1 0x100bed50 +// FUNCTION: BETA10 0x1012dca3 MxVideoParam::~MxVideoParam() { - if (this->m_deviceId != NULL) { - delete[] this->m_deviceId; + if (m_deviceId != NULL) { + delete[] m_deviceId; } } // FUNCTION: LEGO1 0x100bed70 +// FUNCTION: BETA10 0x1012dce1 void MxVideoParam::SetDeviceName(char* p_deviceId) { - if (this->m_deviceId != NULL) { - delete[] this->m_deviceId; + if (m_deviceId != NULL) { + delete[] m_deviceId; } if (p_deviceId != NULL) { - this->m_deviceId = new char[strlen(p_deviceId) + 1]; + m_deviceId = new char[strlen(p_deviceId) + 1]; - if (this->m_deviceId != NULL) { - strcpy(this->m_deviceId, p_deviceId); + if (m_deviceId != NULL) { + strcpy(m_deviceId, p_deviceId); } } else { - this->m_deviceId = NULL; + m_deviceId = NULL; } } // FUNCTION: LEGO1 0x100bede0 +// FUNCTION: BETA10 0x1012dd76 MxVideoParam& MxVideoParam::operator=(const MxVideoParam& p_videoParam) { - this->m_rect = p_videoParam.m_rect; - this->m_palette = p_videoParam.m_palette; - this->m_backBuffers = p_videoParam.m_backBuffers; - this->m_flags = p_videoParam.m_flags; - this->m_unk0x1c = p_videoParam.m_unk0x1c; + m_rect = p_videoParam.m_rect; + m_palette = p_videoParam.m_palette; + m_backBuffers = p_videoParam.m_backBuffers; + m_flags = p_videoParam.m_flags; + m_unk0x1c = p_videoParam.m_unk0x1c; SetDeviceName(p_videoParam.m_deviceId); return *this; diff --git a/LEGO1/omni/src/video/mxvideoparamflags.cpp b/LEGO1/omni/src/video/mxvideoparamflags.cpp index 967ec824..1a70dc83 100644 --- a/LEGO1/omni/src/video/mxvideoparamflags.cpp +++ b/LEGO1/omni/src/video/mxvideoparamflags.cpp @@ -1,15 +1,21 @@ #include "mxvideoparamflags.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxVideoParamFlags, 0x02) + // FUNCTION: LEGO1 0x100bec40 +// FUNCTION: BETA10 0x1012dadb MxVideoParamFlags::MxVideoParamFlags() { - this->SetFullScreen(0); - this->SetFlipSurfaces(0); - this->SetBackBuffers(0); - this->SetF1bit3(0); - this->SetF1bit4(0); - this->Set16Bit(0); - this->SetWideViewAngle(1); - this->SetF1bit7(1); - this->SetF2bit1(1); + m_flags1.m_bit0 = FALSE; // FullScreen + m_flags1.m_bit1 = FALSE; // FlipSurfaces + m_flags1.m_bit2 = FALSE; // BackBuffers + m_flags1.m_bit3 = FALSE; + m_flags1.m_bit4 = FALSE; + m_flags1.m_bit5 = FALSE; // 16Bit + m_flags1.m_bit6 = TRUE; // WideViewAngle + m_flags1.m_bit7 = TRUE; + + m_flags2.m_bit1 = TRUE; } From 2147be19de0f1ea28e379bd7c3141b8cf76bf6af Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 7 Jun 2024 16:13:42 -0400 Subject: [PATCH 26/26] Rename InitPresenters to Create, remove this keyword (#1000) --- LEGO1/omni/include/mxaudiomanager.h | 6 +++--- LEGO1/omni/include/mxmediamanager.h | 2 +- LEGO1/omni/src/audio/mxaudiomanager.cpp | 20 ++++++++++---------- LEGO1/omni/src/audio/mxmusicmanager.cpp | 2 +- LEGO1/omni/src/audio/mxsoundmanager.cpp | 16 ++++++++-------- LEGO1/omni/src/audio/mxsoundpresenter.cpp | 4 ++-- LEGO1/omni/src/common/mxmediamanager.cpp | 2 +- LEGO1/omni/src/event/mxeventmanager.cpp | 2 +- LEGO1/omni/src/video/mxvideomanager.cpp | 4 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/LEGO1/omni/include/mxaudiomanager.h b/LEGO1/omni/include/mxaudiomanager.h index 020bda54..f962a16d 100644 --- a/LEGO1/omni/include/mxaudiomanager.h +++ b/LEGO1/omni/include/mxaudiomanager.h @@ -11,11 +11,11 @@ class MxAudioManager : public MxMediaManager { MxAudioManager(); ~MxAudioManager() override; - MxResult InitPresenters() override; // vtable+14 - void Destroy() override; // vtable+18 + MxResult Create() override; // vtable+14 + void Destroy() override; // vtable+18 // FUNCTION: LEGO1 0x10029910 - virtual MxS32 GetVolume() { return this->m_volume; } // vtable+28 + virtual MxS32 GetVolume() { return m_volume; } // vtable+28 virtual void SetVolume(MxS32 p_volume); // vtable+2c diff --git a/LEGO1/omni/include/mxmediamanager.h b/LEGO1/omni/include/mxmediamanager.h index 5fd2390c..38f611eb 100644 --- a/LEGO1/omni/include/mxmediamanager.h +++ b/LEGO1/omni/include/mxmediamanager.h @@ -16,7 +16,7 @@ class MxMediaManager : public MxCore { ~MxMediaManager() override; MxResult Tickle() override; // vtable+08 - virtual MxResult InitPresenters(); // vtable+14 + virtual MxResult Create(); // vtable+14 virtual void Destroy(); // vtable+18 virtual void RegisterPresenter(MxPresenter& p_presenter); // vtable+1c virtual void UnregisterPresenter(MxPresenter& p_presenter); // vtable+20 diff --git a/LEGO1/omni/src/audio/mxaudiomanager.cpp b/LEGO1/omni/src/audio/mxaudiomanager.cpp index 0be79a24..81b8922e 100644 --- a/LEGO1/omni/src/audio/mxaudiomanager.cpp +++ b/LEGO1/omni/src/audio/mxaudiomanager.cpp @@ -20,16 +20,16 @@ MxAudioManager::~MxAudioManager() // FUNCTION: LEGO1 0x100b8df0 void MxAudioManager::Init() { - this->m_volume = 100; + m_volume = 100; } // FUNCTION: LEGO1 0x100b8e00 void MxAudioManager::Destroy(MxBool p_fromDestructor) { - this->m_criticalSection.Enter(); + m_criticalSection.Enter(); g_count--; Init(); - this->m_criticalSection.Leave(); + m_criticalSection.Leave(); if (!p_fromDestructor) { MxMediaManager::Destroy(); @@ -37,13 +37,13 @@ void MxAudioManager::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x100b8e40 -MxResult MxAudioManager::InitPresenters() +MxResult MxAudioManager::Create() { MxResult result = FAILURE; MxBool success = FALSE; - if (MxMediaManager::InitPresenters() == SUCCESS) { - this->m_criticalSection.Enter(); + if (MxMediaManager::Create() == SUCCESS) { + m_criticalSection.Enter(); success = TRUE; result = SUCCESS; g_count++; @@ -54,7 +54,7 @@ MxResult MxAudioManager::InitPresenters() } if (success) { - this->m_criticalSection.Leave(); + m_criticalSection.Leave(); } return result; @@ -69,7 +69,7 @@ void MxAudioManager::Destroy() // FUNCTION: LEGO1 0x100b8ea0 void MxAudioManager::SetVolume(MxS32 p_volume) { - this->m_criticalSection.Enter(); - this->m_volume = p_volume; - this->m_criticalSection.Leave(); + m_criticalSection.Enter(); + m_volume = p_volume; + m_criticalSection.Leave(); } diff --git a/LEGO1/omni/src/audio/mxmusicmanager.cpp b/LEGO1/omni/src/audio/mxmusicmanager.cpp index 94c56f04..762d3757 100644 --- a/LEGO1/omni/src/audio/mxmusicmanager.cpp +++ b/LEGO1/omni/src/audio/mxmusicmanager.cpp @@ -144,7 +144,7 @@ MxResult MxMusicManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) MxResult status = FAILURE; MxBool locked = FALSE; - if (MxAudioManager::InitPresenters() == SUCCESS) { + if (MxAudioManager::Create() == SUCCESS) { if (p_createThread) { m_criticalSection.Enter(); locked = TRUE; diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index d5d8bd72..e97f7f29 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -44,22 +44,22 @@ void MxSoundManager::Init() // FUNCTION: LEGO1 0x100ae840 void MxSoundManager::Destroy(MxBool p_fromDestructor) { - if (this->m_thread) { - this->m_thread->Terminate(); - delete this->m_thread; + if (m_thread) { + m_thread->Terminate(); + delete m_thread; } else { TickleManager()->UnregisterClient(this); } - this->m_criticalSection.Enter(); + m_criticalSection.Enter(); - if (this->m_dsBuffer) { - this->m_dsBuffer->Release(); + if (m_dsBuffer) { + m_dsBuffer->Release(); } Init(); - this->m_criticalSection.Leave(); + m_criticalSection.Leave(); if (!p_fromDestructor) { MxAudioManager::Destroy(); @@ -72,7 +72,7 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) MxResult status = FAILURE; MxBool locked = FALSE; - if (MxAudioManager::InitPresenters() != SUCCESS) { + if (MxAudioManager::Create() != SUCCESS) { goto done; } diff --git a/LEGO1/omni/src/audio/mxsoundpresenter.cpp b/LEGO1/omni/src/audio/mxsoundpresenter.cpp index aa0435a2..9d784532 100644 --- a/LEGO1/omni/src/audio/mxsoundpresenter.cpp +++ b/LEGO1/omni/src/audio/mxsoundpresenter.cpp @@ -13,9 +13,9 @@ void MxSoundPresenter::Destroy(MxBool p_fromDestructor) MSoundManager()->UnregisterPresenter(*this); } - this->m_criticalSection.Enter(); + m_criticalSection.Enter(); MxMediaPresenter::Init(); - this->m_criticalSection.Leave(); + m_criticalSection.Leave(); if (!p_fromDestructor) { MxMediaPresenter::Destroy(FALSE); diff --git a/LEGO1/omni/src/common/mxmediamanager.cpp b/LEGO1/omni/src/common/mxmediamanager.cpp index bd32c70b..cc1611ae 100644 --- a/LEGO1/omni/src/common/mxmediamanager.cpp +++ b/LEGO1/omni/src/common/mxmediamanager.cpp @@ -31,7 +31,7 @@ MxResult MxMediaManager::Init() } // FUNCTION: LEGO1 0x100b85e0 -MxResult MxMediaManager::InitPresenters() +MxResult MxMediaManager::Create() { AUTOLOCK(m_criticalSection); diff --git a/LEGO1/omni/src/event/mxeventmanager.cpp b/LEGO1/omni/src/event/mxeventmanager.cpp index 43f1e045..29b8aba0 100644 --- a/LEGO1/omni/src/event/mxeventmanager.cpp +++ b/LEGO1/omni/src/event/mxeventmanager.cpp @@ -45,7 +45,7 @@ MxResult MxEventManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) MxResult status = FAILURE; MxBool locked = FALSE; - MxResult result = MxMediaManager::InitPresenters(); + MxResult result = MxMediaManager::Create(); if (result == SUCCESS) { if (p_createThread) { this->m_criticalSection.Enter(); diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 3c57ac52..9c99f944 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -146,7 +146,7 @@ MxResult MxVideoManager::VTable0x28( m_unk0x60 = FALSE; - if (MxMediaManager::InitPresenters() != SUCCESS) { + if (MxMediaManager::Create() != SUCCESS) { goto done; } @@ -219,7 +219,7 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, m_unk0x60 = TRUE; - if (MxMediaManager::InitPresenters() != SUCCESS) { + if (MxMediaManager::Create() != SUCCESS) { goto done; }