From c9acd9a49f7ab93382d991c1a0664cef5e32cfb0 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 20 Dec 2024 12:23:01 -0700 Subject: [PATCH 01/16] Minor fixes (#1248) --- LEGO1/lego/legoomni/src/common/legogamestate.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/act3.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index ca462124..0db04109 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -408,7 +408,7 @@ MxResult LegoGameState::Load(MxULong p_slot) Read(&fileStorage, &actArea); - if (m_currentAct == 0) { + if (m_currentAct == e_act1) { m_unk0x42c = e_undefined; } else { diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index b3bd9337..15b97913 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -639,7 +639,7 @@ MxLong Act3::Notify(MxParam& p_param) case c_notificationEndAnim: if (m_state->m_unk0x08 == 1) { assert(m_copter && m_brickster && m_cop1 && m_cop2); - m_unk0x4220.FUN_100720d0(NULL); + m_unk0x4220.FUN_100720d0(0); m_state->m_unk0x08 = 0; FUN_10015820(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); m_copter->HandleClick(); From 5a61cf65664fa8c28ef5a09bea24dd668818416e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 20 Dec 2024 14:15:52 -0700 Subject: [PATCH 02/16] Move `CreateStreamObject` to proper location (#1249) --- CMakeLists.txt | 1 - LEGO1/omni/include/mxdsobject.h | 2 ++ LEGO1/omni/include/mxdssource.h | 32 +++++++++++++++-------- LEGO1/omni/include/mxutilities.h | 1 - LEGO1/omni/src/action/mxdsobject.cpp | 37 +++++++++++++++++++++++++++ LEGO1/omni/src/common/mxutilities.cpp | 36 -------------------------- LEGO1/omni/src/stream/mxdsfile.cpp | 1 + LEGO1/omni/src/stream/mxdssource.cpp | 23 ----------------- 8 files changed, 61 insertions(+), 72 deletions(-) delete mode 100644 LEGO1/omni/src/stream/mxdssource.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cd1c901..e8cd185e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,7 +251,6 @@ function(add_lego_libraries NAME) LEGO1/omni/src/stream/mxdsbuffer.cpp LEGO1/omni/src/stream/mxdschunk.cpp LEGO1/omni/src/stream/mxdsfile.cpp - LEGO1/omni/src/stream/mxdssource.cpp LEGO1/omni/src/stream/mxdssubscriber.cpp LEGO1/omni/src/stream/mxio.cpp LEGO1/omni/src/stream/mxramstreamcontroller.cpp diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index eb80044b..6e3d2fc3 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -5,6 +5,7 @@ #include "mxatom.h" #include "mxcore.h" +class MxDSFile; class MxPresenter; // VTABLE: LEGO1 0x100dc868 @@ -104,5 +105,6 @@ class MxDSObject : public MxCore { }; MxDSObject* DeserializeDSObjectDispatch(MxU8*&, MxS16); +MxDSObject* CreateStreamObject(MxDSFile*, MxS16); #endif // MXDSOBJECT_H diff --git a/LEGO1/omni/include/mxdssource.h b/LEGO1/omni/include/mxdssource.h index 06f5e556..745c2656 100644 --- a/LEGO1/omni/include/mxdssource.h +++ b/LEGO1/omni/include/mxdssource.h @@ -2,8 +2,7 @@ #define MXDSSOURCE_H #include "mxcore.h" - -class MxDSBuffer; +#include "mxdsbuffer.h" // VTABLE: LEGO1 0x100dc8c8 // SIZE 0x14 @@ -27,15 +26,26 @@ class MxDSSource : public MxCore { return !strcmp(p_name, MxDSSource::ClassName()) || MxCore::IsA(p_name); } - virtual MxLong Open(MxULong) = 0; // vtable+0x14 - virtual MxLong Close() = 0; // vtable+0x18 - virtual MxResult ReadToBuffer(MxDSBuffer* p_buffer); // vtable+0x1c - virtual MxResult Read(unsigned char*, MxULong) = 0; // vtable+0x20 - virtual MxLong Seek(MxLong, MxS32) = 0; // vtable+0x24 - virtual MxULong GetBufferSize() = 0; // vtable+0x28 - virtual MxULong GetStreamBuffersNum() = 0; // vtable+0x2c - virtual MxLong GetLengthInDWords(); // vtable+0x30 - virtual MxU32* GetBuffer(); // vtable+0x34 + virtual MxLong Open(MxULong) = 0; // vtable+0x14 + virtual MxLong Close() = 0; // vtable+0x18 + + // FUNCTION: LEGO1 0x100bffd0 + virtual MxResult ReadToBuffer(MxDSBuffer* p_buffer) + { + return Read(p_buffer->GetBuffer(), p_buffer->GetWriteOffset()); + } // vtable+0x1c + + virtual MxResult Read(unsigned char*, MxULong) = 0; // vtable+0x20 + virtual MxLong Seek(MxLong, MxS32) = 0; // vtable+0x24 + virtual MxULong GetBufferSize() = 0; // vtable+0x28 + virtual MxULong GetStreamBuffersNum() = 0; // vtable+0x2c + + // FUNCTION: LEGO1 0x100bfff0 + virtual MxLong GetLengthInDWords() { return m_lengthInDWords; } // vtable+0x30 + + // FUNCTION: LEGO1 0x100c0000 + virtual MxU32* GetBuffer() { return m_pBuffer; } // vtable+0x34 + MxLong GetPosition() const { return m_position; } protected: diff --git a/LEGO1/omni/include/mxutilities.h b/LEGO1/omni/include/mxutilities.h index 59ff7d89..c7a2bcfb 100644 --- a/LEGO1/omni/include/mxutilities.h +++ b/LEGO1/omni/include/mxutilities.h @@ -76,7 +76,6 @@ void OmniError(const char* p_message, MxS32 p_status); void SetOmniUserMessage(void (*p_omniUserMessage)(const char*, MxS32)); MxBool ContainsPresenter(MxCompositePresenterList& p_presenterList, MxPresenter* p_presenter); void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags); -MxDSObject* CreateStreamObject(MxDSFile*, MxS16); MxBool KeyValueStringParse(char*, const char*, const char*); #endif // MXUTILITIES_H diff --git a/LEGO1/omni/src/action/mxdsobject.cpp b/LEGO1/omni/src/action/mxdsobject.cpp index ae266fe0..3bb189c7 100644 --- a/LEGO1/omni/src/action/mxdsobject.cpp +++ b/LEGO1/omni/src/action/mxdsobject.cpp @@ -3,6 +3,7 @@ #include "mxdsaction.h" #include "mxdsanim.h" #include "mxdsevent.h" +#include "mxdsfile.h" #include "mxdsmediaaction.h" #include "mxdsmultiaction.h" #include "mxdsobjectaction.h" @@ -227,3 +228,39 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) return obj; } + +// FUNCTION: LEGO1 0x100c0280 +MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs) +{ + MxU8* buf; + _MMCKINFO tmpChunk; + + if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], SEEK_SET)) { + return NULL; + } + + if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) { + if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) { + + buf = new MxU8[tmpChunk.cksize]; + if (!buf) { + return NULL; + } + + if (p_file->Read(buf, tmpChunk.cksize) != 0) { + return NULL; + } + + // Save a copy so we can clean up properly, because + // this function will alter the pointer value. + MxU8* copy = buf; + MxDSObject* obj = DeserializeDSObjectDispatch(buf, -1); + delete[] copy; + return obj; + } + + return NULL; + } + + return NULL; +} diff --git a/LEGO1/omni/src/common/mxutilities.cpp b/LEGO1/omni/src/common/mxutilities.cpp index c943bde5..c1a102f5 100644 --- a/LEGO1/omni/src/common/mxutilities.cpp +++ b/LEGO1/omni/src/common/mxutilities.cpp @@ -158,39 +158,3 @@ void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags) } } } - -// Should probably be somewhere else -// FUNCTION: LEGO1 0x100c0280 -MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs) -{ - MxU8* buf; - _MMCKINFO tmpChunk; - - if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], SEEK_SET)) { - return NULL; - } - - if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) { - if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) { - - buf = new MxU8[tmpChunk.cksize]; - if (!buf) { - return NULL; - } - - if (p_file->Read(buf, tmpChunk.cksize) != 0) { - return NULL; - } - - // Save a copy so we can clean up properly, because - // this function will alter the pointer value. - MxU8* copy = buf; - MxDSObject* obj = DeserializeDSObjectDispatch(buf, -1); - delete[] copy; - return obj; - } - return NULL; - } - - return NULL; -} diff --git a/LEGO1/omni/src/stream/mxdsfile.cpp b/LEGO1/omni/src/stream/mxdsfile.cpp index 54195f92..51ca6615 100644 --- a/LEGO1/omni/src/stream/mxdsfile.cpp +++ b/LEGO1/omni/src/stream/mxdsfile.cpp @@ -8,6 +8,7 @@ #define SI_MAJOR_VERSION 2 #define SI_MINOR_VERSION 2 +DECOMP_SIZE_ASSERT(MxDSSource, 0x14) DECOMP_SIZE_ASSERT(MxDSFile::ChunkHeader, 0x0c) DECOMP_SIZE_ASSERT(MxDSFile, 0x7c) diff --git a/LEGO1/omni/src/stream/mxdssource.cpp b/LEGO1/omni/src/stream/mxdssource.cpp deleted file mode 100644 index c2d86abb..00000000 --- a/LEGO1/omni/src/stream/mxdssource.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "mxdssource.h" - -#include "mxdsbuffer.h" - -DECOMP_SIZE_ASSERT(MxDSSource, 0x14) - -// FUNCTION: LEGO1 0x100bffd0 -MxResult MxDSSource::ReadToBuffer(MxDSBuffer* p_buffer) -{ - return Read(p_buffer->GetBuffer(), p_buffer->GetWriteOffset()); -} - -// FUNCTION: LEGO1 0x100bfff0 -MxLong MxDSSource::GetLengthInDWords() -{ - return m_lengthInDWords; -} - -// FUNCTION: LEGO1 0x100c0000 -MxU32* MxDSSource::GetBuffer() -{ - return m_pBuffer; -} From fc93b84655ca67aa17447cc7185623008022de14 Mon Sep 17 00:00:00 2001 From: MS Date: Sat, 21 Dec 2024 02:36:57 -0500 Subject: [PATCH 03/16] MxDSBuffer::FUN_100c67b0 100% (#1250) --- LEGO1/omni/include/mxdsbuffer.h | 11 +++ LEGO1/omni/include/mxdsstreamingaction.h | 3 + LEGO1/omni/src/stream/mxdsbuffer.cpp | 91 ++++++++++++++---------- 3 files changed, 67 insertions(+), 38 deletions(-) diff --git a/LEGO1/omni/include/mxdsbuffer.h b/LEGO1/omni/include/mxdsbuffer.h index c70da4aa..e1db60a9 100644 --- a/LEGO1/omni/include/mxdsbuffer.h +++ b/LEGO1/omni/include/mxdsbuffer.h @@ -63,13 +63,24 @@ class MxDSBuffer : public MxCore { static MxCore* ReadChunk(MxDSBuffer* p_buffer, MxU32* p_chunkData, MxU16 p_flags); static MxResult Append(MxU8* p_buffer1, MxU8* p_buffer2); + // FUNCTION: BETA10 0x10148c60 MxU8* GetBuffer() { return m_pBuffer; } + MxU8** GetBufferRef() { return &m_pBuffer; } undefined4 GetUnknown14() { return m_unk0x14; } + + // FUNCTION: BETA10 0x10156420 + MxBool HasRef() { return m_referenceCount != 0; } + MxU16 GetRefCount() { return m_referenceCount; } Type GetMode() { return m_mode; } + + // FUNCTION: BETA10 0x10148c40 MxU32 GetWriteOffset() { return m_writeOffset; } + + // FUNCTION: BETA10 0x101590d0 MxU32 GetBytesRemaining() { return m_bytesRemaining; } + void SetUnknown14(undefined4 p_unk0x14) { m_unk0x14 = p_unk0x14; } void SetUnknown1c(undefined4 p_unk0x1c) { m_unk0x1c = p_unk0x1c; } void SetMode(Type p_mode) { m_mode = p_mode; } diff --git a/LEGO1/omni/include/mxdsstreamingaction.h b/LEGO1/omni/include/mxdsstreamingaction.h index 4d594fe1..dc1c8815 100644 --- a/LEGO1/omni/include/mxdsstreamingaction.h +++ b/LEGO1/omni/include/mxdsstreamingaction.h @@ -44,6 +44,9 @@ class MxDSStreamingAction : public MxDSAction { void SetUnknowna4(MxDSBuffer* p_unk0xa4) { m_unk0xa4 = p_unk0xa4; } void SetBufferOffset(MxU32 p_bufferOffset) { m_bufferOffset = p_bufferOffset; } + // FUNCTION: BETA10 0x10156650 + void ClearUnknowna0() { m_unk0xa0 = NULL; } + // SYNTHETIC: LEGO1 0x100cd0b0 // MxDSStreamingAction::`scalar deleting destructor' diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 44de686b..322fdd6b 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -95,6 +95,7 @@ MxResult MxDSBuffer::SetBufferPointer(MxU8* p_buffer, MxU32 p_size) } // FUNCTION: LEGO1 0x100c67b0 +// FUNCTION: BETA10 0x10157295 MxResult MxDSBuffer::FUN_100c67b0( MxStreamController* p_controller, MxDSAction* p_action, @@ -102,56 +103,60 @@ MxResult MxDSBuffer::FUN_100c67b0( ) { MxResult result = FAILURE; + MxU8* data = m_pBuffer; m_unk0x30 = (MxDSStreamingAction*) p_controller->GetUnk0x3c().Find(p_action); if (m_unk0x30 == NULL) { return FAILURE; } - MxU8* data; while ((data = (MxU8*) SkipToData())) { - if (*p_streamingAction == NULL) { - result = CreateObject(p_controller, (MxU32*) data, p_action, p_streamingAction); - - if (result == FAILURE) { - return result; - } - // TODO: Not a MxResult value? - if (result == 1) { - break; - } - } - else { + if (*p_streamingAction != NULL) { MxDSBuffer* buffer = (*p_streamingAction)->GetUnknowna0(); - if (buffer->CalcBytesRemaining(data) != SUCCESS) { - return result; + if (buffer->CalcBytesRemaining(data)) { + goto done; } if (buffer->GetBytesRemaining() == 0) { - buffer->SetUnk30(m_unk0x30); + buffer->m_unk0x30 = m_unk0x30; result = buffer->CreateObject(p_controller, (MxU32*) buffer->GetBuffer(), p_action, p_streamingAction); - if (result != SUCCESS) { - return result; - } + if (result == SUCCESS) { + if (buffer->HasRef()) { + // Note: *p_streamingAction is always null in MxRamStreamProvider + ((MxDiskStreamController*) p_controller)->InsertToList74(buffer); + (*p_streamingAction)->ClearUnknowna0(); + } - if (buffer->GetRefCount() != 0) { - // Note: *p_streamingAction is always null in MxRamStreamProvider - ((MxDiskStreamController*) p_controller)->InsertToList74(buffer); - (*p_streamingAction)->SetUnknowna0(NULL); + ((MxDiskStreamController*) p_controller)->FUN_100c7cb0(*p_streamingAction); + *p_streamingAction = NULL; } + else { + goto done; + } + } + } + else { + result = CreateObject(p_controller, (MxU32*) data, p_action, p_streamingAction); - ((MxDiskStreamController*) p_controller)->FUN_100c7cb0(*p_streamingAction); - *p_streamingAction = NULL; + if (result == FAILURE) { + goto done; + } + else if (result == 1) { + // TODO: Not a MxResult value? + break; } } } - return SUCCESS; + result = SUCCESS; +done: + return result; } // FUNCTION: LEGO1 0x100c68a0 +// FUNCTION: BETA10 0x10157450 MxResult MxDSBuffer::CreateObject( MxStreamController* p_controller, MxU32* p_data, @@ -170,7 +175,8 @@ MxResult MxDSBuffer::CreateObject( } if (*p_data == FOURCC('M', 'x', 'O', 'b')) { - return StartPresenterFromAction(p_controller, p_action, (MxDSAction*) header); + MxDSAction* action = (MxDSAction*) header; + return StartPresenterFromAction(p_controller, p_action, action); } else if (*p_data == FOURCC('M', 'x', 'C', 'h')) { MxStreamChunk* chunk = (MxStreamChunk*) header; @@ -181,8 +187,10 @@ MxResult MxDSBuffer::CreateObject( return ParseChunk(p_controller, p_data, p_action, p_streamingAction, chunk); } + else { + delete header; + } - delete header; return FAILURE; } @@ -314,6 +322,7 @@ MxResult MxDSBuffer::ParseChunk( } // FUNCTION: LEGO1 0x100c6d00 +// FUNCTION: BETA10 0x10157c94 MxCore* MxDSBuffer::ReadChunk(MxDSBuffer* p_buffer, MxU32* p_chunkData, MxU16 p_flags) { // This function reads a chunk. If it is an object, this function returns an MxDSObject. If it is a chunk, @@ -322,16 +331,21 @@ MxCore* MxDSBuffer::ReadChunk(MxDSBuffer* p_buffer, MxU32* p_chunkData, MxU16 p_ MxU8* dataStart = (MxU8*) p_chunkData + 8; switch (*p_chunkData) { - case FOURCC('M', 'x', 'O', 'b'): - result = DeserializeDSObjectDispatch(dataStart, p_flags); + case FOURCC('M', 'x', 'O', 'b'): { + MxDSObject* obj = DeserializeDSObjectDispatch(dataStart, p_flags); + result = obj; break; - case FOURCC('M', 'x', 'C', 'h'): - result = new MxStreamChunk(); - if (result != NULL && ((MxStreamChunk*) result)->ReadChunk(p_buffer, (MxU8*) p_chunkData) != SUCCESS) { - delete result; - result = NULL; + } + case FOURCC('M', 'x', 'C', 'h'): { + MxStreamChunk* chunk = new MxStreamChunk(); + if (chunk && chunk->ReadChunk(p_buffer, (MxU8*) p_chunkData) != SUCCESS) { + delete chunk; + chunk = NULL; } - return result; + + result = chunk; + break; + } } return result; @@ -403,6 +417,7 @@ void MxDSBuffer::AddRef(MxDSChunk* p_chunk) } // FUNCTION: LEGO1 0x100c6ef0 +// FUNCTION: BETA10 0x101580ad MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data) { MxResult result = FAILURE; @@ -412,11 +427,11 @@ MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data) MxU8* ptr; if (m_writeOffset == m_bytesRemaining) { - bytesRead = *(MxU32*) (p_data + 4) + 8; ptr = p_data; + bytesRead = *(MxU32*) (p_data + 4) + 8; } else { - ptr = &p_data[MxStreamChunk::GetHeaderSize() + 8]; + ptr = p_data + MxStreamChunk::GetHeaderSize() + 8; bytesRead = (*(MxU32*) (p_data + 4)) - MxStreamChunk::GetHeaderSize(); } From 3e427ab03e880807d3ebad18706c5194126d8ee0 Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:21:22 +0100 Subject: [PATCH 04/16] Improve `Helicopter::Animate()` (#1251) * Small improvements * More improvements * Small drive-by refactor * Do not inline `UnknownMx4DPointFloat::FUN_10004520()` * Fix `Act3Brickster::Animate` * Fixes --------- Co-authored-by: jonschz Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 35 ++++++++++--------- LEGO1/mxgeometry/mxgeometry3d.h | 8 ++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 1d7f78e3..8d88e6bf 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -386,36 +386,34 @@ void Helicopter::VTable0x74(Matrix4& p_transform) // FUNCTION: LEGO1 0x10003ee0 void Helicopter::Animate(float p_time) { - MxU32 state = m_state->GetUnkown8(); - switch (state) { - default: - LegoPathActor::Animate(p_time); - return; - case 4: - case 5: - float f = m_unk0x1f0 - p_time + 3000; + if (m_state->m_unk0x08 == 4 || m_state->m_unk0x08 == 5) { + float f = m_unk0x1f0 - p_time + 3000.0f; if (f >= 0) { - float f2 = f / 3000 + 1; + float f2 = f / -3000.0f + 1; if (f2 < 0) { f2 = 0; } - if (1.0f < f2) { + if (f2 > 1.0f) { f2 = 1.0f; } - Vector3 v(m_unk0x160[3]); + MxMatrix mat; - Vector3 v2(m_unk0x1a8[3]); - float* loc = m_unk0x1a8[3]; + Vector3 v1(m_unk0x160[3]); + Vector3 v2(mat[3]); + Vector3 v3(m_unk0x1a8[3]); + mat.SetIdentity(); m_unk0x1f4.BETA_1004aaa0(mat, f2); - v2.SetVector(loc); - v2 -= v; + + v2 = v3; + v2 -= v1; v2 *= f2; - v2 += v; + v2 += v1; + m_world->GetCamera()->FUN_100123e0(mat, 0); } else { - if (state == 4) { + if (m_state->m_unk0x08 == 4) { ((Act3*) m_world)->FUN_10073400(); } else { @@ -425,6 +423,9 @@ void Helicopter::Animate(float p_time) LegoPathActor::m_actorState = c_disabled; } } + else { + LegoPathActor::Animate(p_time); + } } // FUNCTION: LEGO1 0x100042a0 diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 15fd1ab0..d7c19b76 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -156,7 +156,7 @@ class UnknownMx4DPointFloat { }; // FUNCTION: BETA10 0x1004aaa0 -int UnknownMx4DPointFloat::BETA_1004aaa0(Matrix4& p_matrix, float p_f) +inline int UnknownMx4DPointFloat::BETA_1004aaa0(Matrix4& p_matrix, float p_f) { float data[4]; Vector4 v(data); @@ -196,17 +196,17 @@ inline long UnknownMx4DPointFloat::FUN_10004520() // FUNCTION: BETA10 0x1004ab10 inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) { - if (m_unk0x30 == 1) { + if (m_unk0x30 == c_bit1) { p_v = m_unk0x00; p_v[3] = (1.0 - p_f) * acos((double) p_v[3]) * 2.0; return p_v.NormalizeQuaternion(); } - else if (m_unk0x30 == 2) { + else if (m_unk0x30 == c_bit2) { p_v = m_unk0x18; p_v[3] = p_f * acos((double) p_v[3]) * 2.0; return p_v.NormalizeQuaternion(); } - else if (m_unk0x30 == 3) { + else if (m_unk0x30 == (c_bit1 | c_bit2)) { int i; double d1 = p_v.Dot(&m_unk0x00, &m_unk0x18); double a; From bcc41256f8c7183d0f6183ce4e5f4c212722ed01 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 21 Dec 2024 10:08:55 -0700 Subject: [PATCH 05/16] Add `LegoOmni::World` enum (#1252) --- .../legoomni/include/legoanimationmanager.h | 5 +- LEGO1/lego/legoomni/include/legomain.h | 37 +++++++++--- .../lego/legoomni/include/legoplantmanager.h | 19 ++++--- LEGO1/lego/legoomni/include/legoworld.h | 7 ++- .../src/common/legoanimationmanager.cpp | 12 ++-- .../legoomni/src/common/legoplantmanager.cpp | 12 ++-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 10 ++-- .../src/entity/legoworldpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/main/legomain.cpp | 57 +++++++++---------- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 2 +- 10 files changed, 93 insertions(+), 70 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index f09c8dae..24850f0e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -3,6 +3,7 @@ #include "decomp.h" #include "legolocations.h" +#include "legomain.h" #include "legostate.h" #include "legotraninfolist.h" #include "mxcore.h" @@ -151,7 +152,7 @@ class LegoAnimationManager : public MxCore { void Resume(); void FUN_1005f6d0(MxBool p_unk0x400); void EnableCamAnims(MxBool p_enableCamAnims); - MxResult LoadWorldInfo(MxS32 p_worldId); + MxResult LoadWorldInfo(LegoOmni::World p_worldId); MxBool FindVehicle(const char* p_name, MxU32& p_index); MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info); MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info); @@ -247,7 +248,7 @@ class LegoAnimationManager : public MxCore { void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404); void FUN_10064b50(MxLong p_time); - MxS32 m_worldId; // 0x08 + LegoOmni::World m_worldId; // 0x08 MxU16 m_animCount; // 0x0c MxU16 m_unk0x0e; // 0x0e MxU16 m_unk0x10; // 0x10 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index f0443bd6..58780b7e 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -37,16 +37,39 @@ class LegoOmni : public MxOmni { c_clearScreen = 0x04 }; + enum World { + e_undefined = -1, + e_act1 = 0, + e_imain, + e_icube, + e_ireg, + e_ielev, + e_iisle, + e_hosp, + e_police, + e_gmain, + e_bldh, + e_bldd, + e_bldj, + e_bldr, + e_racc, + e_racj, + e_act2, + e_act3, + e_test, + e_numWorlds = e_test + 2 // count e_undefined + }; + // SIZE 0x1c struct WorldContainer { // FUNCTION: LEGO1 0x1005ac40 WorldContainer() { - m_id = -1; + m_id = e_undefined; m_atomId = NULL; } - WorldContainer(MxS32 p_id, const char* p_key, MxAtomId* p_atomId) + WorldContainer(World p_id, const char* p_key, MxAtomId* p_atomId) { m_id = p_id; @@ -66,10 +89,10 @@ class LegoOmni : public MxOmni { return *this; } - MxS32 GetId() { return m_id; } + World GetId() { return m_id; } const char* GetKey() { return m_key; } - MxS32 m_id; // 0x00 + World m_id; // 0x00 char m_key[20]; // 0x04 MxAtomId* m_atomId; // 0x18 }; @@ -111,9 +134,9 @@ class LegoOmni : public MxOmni { void CreateBackgroundAudio(); void RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId); MxResult RegisterWorlds(); - const char* GetWorldName(MxU32 p_id); - MxAtomId* GetWorldAtom(MxU32 p_id); - MxS32 GetWorldId(const char* p_key); + const char* GetWorldName(LegoOmni::World p_id); + MxAtomId* GetWorldAtom(LegoOmni::World p_id); + World GetWorldId(const char* p_key); void DeleteAction(); static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index dcb87ffb..3b3bb976 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -2,6 +2,7 @@ #define LEGOPLANTMANAGER_H #include "decomp.h" +#include "legomain.h" #include "mxcore.h" class LegoEntity; @@ -35,8 +36,8 @@ class LegoPlantManager : public MxCore { } void Init(); - void LoadWorldInfo(MxS32 p_worldId); - void Reset(MxS32 p_worldId); + void LoadWorldInfo(LegoOmni::World p_worldId); + void Reset(LegoOmni::World p_worldId); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); MxBool SwitchColor(LegoEntity* p_entity); @@ -60,8 +61,8 @@ class LegoPlantManager : public MxCore { // LegoPlantManager::`scalar deleting destructor' private: - LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId); - void RemovePlant(MxS32 p_index, MxS32 p_worldId); + LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId); + void RemovePlant(MxS32 p_index, LegoOmni::World p_worldId); void FUN_10026860(MxS32 p_index); LegoPlantInfo* GetInfo(LegoEntity* p_entity); MxBool FUN_10026c80(MxS32 p_index); @@ -71,11 +72,11 @@ class LegoPlantManager : public MxCore { static MxS32 g_maxMove[4]; static MxU32 g_maxSound; - MxS32 m_worldId; // 0x08 - undefined m_unk0x0c; // 0x0c - AnimEntry* m_entries[5]; // 0x10 - MxS8 m_numEntries; // 0x24 - LegoWorld* m_world; // 0x28 + LegoOmni::World m_worldId; // 0x08 + undefined m_unk0x0c; // 0x0c + AnimEntry* m_entries[5]; // 0x10 + MxS8 m_numEntries; // 0x24 + LegoWorld* m_world; // 0x28 }; #endif // LEGOPLANTMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 7a3e6d76..52ef3baf 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -2,6 +2,7 @@ #define LEGOWORLD_H #include "legoentity.h" +#include "legomain.h" #include "legopathcontrollerlist.h" #include "mxpresenterlist.h" #include "roi/legoroi.h" @@ -104,12 +105,12 @@ class LegoWorld : public LegoEntity { LegoCameraController* GetCamera() { return m_cameraController; } LegoEntityList* GetEntityList() { return m_entityList; } - MxS32 GetWorldId() { return m_worldId; } + LegoOmni::World GetWorldId() { return m_worldId; } MxBool GetUnknown0xd0Empty() { return m_set0xd0.empty(); } list& GetROIList() { return m_roiList; } LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnim; } - void SetWorldId(MxS32 p_worldId) { m_worldId = p_worldId; } + void SetWorldId(LegoOmni::World p_worldId) { m_worldId = p_worldId; } // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' @@ -125,7 +126,7 @@ class LegoWorld : public LegoEntity { MxPresenterList m_controlPresenters; // 0xb8 MxCoreSet m_set0xd0; // 0xd0 list m_roiList; // 0xe0 - MxS32 m_worldId; // 0xec + LegoOmni::World m_worldId; // 0xec // name verified by BETA10 0x100c7f59 LegoHideAnimPresenter* m_hideAnim; // 0xf0 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index ec73ba08..379101f1 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -416,7 +416,7 @@ void LegoAnimationManager::Suspend() m_animState = (AnimState*) GameState()->CreateState("AnimState"); } - if (m_worldId == 0) { + if (m_worldId == LegoOmni::e_act1) { m_animState->InitFromAnims(m_animCount, m_anims, m_lastExtraCharacterId); } @@ -495,7 +495,7 @@ void LegoAnimationManager::Resume() void LegoAnimationManager::Init() { m_unk0x402 = FALSE; - m_worldId = -1; + m_worldId = LegoOmni::e_undefined; m_animCount = 0; m_anims = NULL; m_unk0x18 = 0; @@ -580,7 +580,7 @@ void LegoAnimationManager::EnableCamAnims(MxBool p_enableCamAnims) } // FUNCTION: LEGO1 0x1005f720 -MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) +MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId) { MxResult result = FAILURE; MxS32 i, j, k; @@ -615,7 +615,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) m_animState = (AnimState*) GameState()->CreateState("AnimState"); } - if (m_worldId == 0) { + if (m_worldId == LegoOmni::e_act1) { m_animState->InitFromAnims(m_animCount, m_anims, m_lastExtraCharacterId); } @@ -623,7 +623,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) LegoFile file; - if (p_worldId == -1) { + if (p_worldId == LegoOmni::e_undefined) { result = SUCCESS; goto done; } @@ -961,7 +961,7 @@ MxResult LegoAnimationManager::FUN_100605e0( { MxResult result = FAILURE; - if (m_worldId != -1 && p_index < m_animCount && m_tranInfoList != NULL) { + if (m_worldId != LegoOmni::e_undefined && p_index < m_animCount && m_tranInfoList != NULL) { PurgeExtra(FALSE); FUN_10062770(); diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 7544b63e..401d0782 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -78,14 +78,14 @@ void LegoPlantManager::Init() g_plantInfo[i] = g_plantInfoInit[i]; } - m_worldId = -1; + m_worldId = LegoOmni::e_undefined; m_unk0x0c = 0; m_numEntries = 0; } // FUNCTION: LEGO1 0x10026360 // FUNCTION: BETA10 0x100c5032 -void LegoPlantManager::LoadWorldInfo(MxS32 p_worldId) +void LegoPlantManager::LoadWorldInfo(LegoOmni::World p_worldId) { m_worldId = p_worldId; LegoWorld* world = CurrentWorld(); @@ -98,7 +98,7 @@ void LegoPlantManager::LoadWorldInfo(MxS32 p_worldId) } // FUNCTION: LEGO1 0x100263a0 -void LegoPlantManager::Reset(MxS32 p_worldId) +void LegoPlantManager::Reset(LegoOmni::World p_worldId) { MxU32 i; DeleteObjects(g_sndAnimScript, SndanimScript::c_AnimC1, SndanimScript::c_AnimBld18); @@ -113,7 +113,7 @@ void LegoPlantManager::Reset(MxS32 p_worldId) RemovePlant(i, p_worldId); } - m_worldId = -1; + m_worldId = LegoOmni::e_undefined; m_unk0x0c = 0; } @@ -205,7 +205,7 @@ LegoPlantInfo* LegoPlantManager::GetInfoArray(MxS32& p_length) // FUNCTION: LEGO1 0x10026590 // FUNCTION: BETA10 0x100c561e -LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId) +LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId) { LegoEntity* entity = NULL; @@ -244,7 +244,7 @@ LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS // FUNCTION: LEGO1 0x100266c0 // FUNCTION: BETA10 0x100c5859 -void LegoPlantManager::RemovePlant(MxS32 p_index, MxS32 p_worldId) +void LegoPlantManager::RemovePlant(MxS32 p_index, LegoOmni::World p_worldId) { if (p_index < sizeOfArray(g_plantInfo)) { MxU32 world = 1 << (MxU8) p_worldId; diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 2dbcce2e..ee144513 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -12,7 +12,6 @@ #include "legogamestate.h" #include "legoinputmanager.h" #include "legolocomotionanimpresenter.h" -#include "legomain.h" #include "legonavcontroller.h" #include "legoplantmanager.h" #include "legosoundmanager.h" @@ -102,8 +101,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) } SetIsWorldActive(TRUE); - m_worldId = -1; - + m_worldId = LegoOmni::e_undefined; return SUCCESS; } @@ -180,7 +178,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } } - if (m_worldId != -1 && m_set0xd0.empty()) { + if (m_worldId != LegoOmni::e_undefined && m_set0xd0.empty()) { PlantManager()->Reset(m_worldId); BuildingManager()->Reset(); } @@ -701,7 +699,7 @@ void LegoWorld::Enable(MxBool p_enable) Lego()->SetNavController(m_cameraController->GetNavController()); } - if (m_worldId != -1) { + if (m_worldId != LegoOmni::e_undefined) { PlantManager()->LoadWorldInfo(m_worldId); AnimationManager()->LoadWorldInfo(m_worldId); BuildingManager()->LoadWorldInfo(); @@ -724,7 +722,7 @@ void LegoWorld::Enable(MxBool p_enable) AnimationManager()->Reset(FALSE); m_set0xd0.insert(this); - if (m_worldId != -1) { + if (m_worldId != LegoOmni::e_undefined) { PlantManager()->Reset(m_worldId); BuildingManager()->Reset(); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index c4b8c52e..3a8842a5 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -54,7 +54,7 @@ LegoWorldPresenter::~LegoWorldPresenter() { MxBool result = FALSE; if (m_entity) { - MxS32 worldId = ((LegoWorld*) m_entity)->GetWorldId(); + LegoOmni::World worldId = ((LegoWorld*) m_entity)->GetWorldId(); PlantManager()->LoadWorldInfo(worldId); AnimationManager()->LoadWorldInfo(worldId); BuildingManager()->LoadWorldInfo(); diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 4a751ab7..b065c6e4 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -266,32 +266,31 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) // FUNCTION: LEGO1 0x1005a5f0 MxResult LegoOmni::RegisterWorlds() { - m_worlds = new WorldContainer[19]; + m_worlds = new WorldContainer[e_numWorlds]; if (!m_worlds) { return FAILURE; } m_worlds[0] = WorldContainer(); - m_worlds[1] = WorldContainer(0, "ACT1", g_isleScript); - m_worlds[2] = WorldContainer(1, "IMAIN", g_infomainScript); - m_worlds[3] = WorldContainer(2, "ICUBE", g_infoscorScript); - m_worlds[4] = WorldContainer(3, "IREG", g_regbookScript); - m_worlds[5] = WorldContainer(4, "IELEV", g_elevbottScript); - m_worlds[6] = WorldContainer(5, "IISLE", g_infodoorScript); - m_worlds[7] = WorldContainer(6, "HOSP", g_hospitalScript); - m_worlds[8] = WorldContainer(7, "POLICE", g_policeScript); - m_worlds[9] = WorldContainer(8, "GMAIN", g_garageScript); - m_worlds[10] = WorldContainer(9, "BLDH", g_copterScript); - m_worlds[11] = WorldContainer(10, "BLDD", g_dunecarScript); - m_worlds[12] = WorldContainer(11, "BLDJ", g_jetskiScript); - m_worlds[13] = WorldContainer(12, "BLDR", g_racecarScript); - m_worlds[14] = WorldContainer(13, "RACC", g_carraceScript); - m_worlds[15] = WorldContainer(14, "RACJ", g_jetraceScript); - m_worlds[16] = WorldContainer(15, "ACT2", g_act2mainScript); - m_worlds[17] = WorldContainer(16, "ACT3", g_act3Script); - m_worlds[18] = WorldContainer(17, "TEST", g_testScript); - + m_worlds[1] = WorldContainer(e_act1, "ACT1", g_isleScript); + m_worlds[2] = WorldContainer(e_imain, "IMAIN", g_infomainScript); + m_worlds[3] = WorldContainer(e_icube, "ICUBE", g_infoscorScript); + m_worlds[4] = WorldContainer(e_ireg, "IREG", g_regbookScript); + m_worlds[5] = WorldContainer(e_ielev, "IELEV", g_elevbottScript); + m_worlds[6] = WorldContainer(e_iisle, "IISLE", g_infodoorScript); + m_worlds[7] = WorldContainer(e_hosp, "HOSP", g_hospitalScript); + m_worlds[8] = WorldContainer(e_police, "POLICE", g_policeScript); + m_worlds[9] = WorldContainer(e_gmain, "GMAIN", g_garageScript); + m_worlds[10] = WorldContainer(e_bldh, "BLDH", g_copterScript); + m_worlds[11] = WorldContainer(e_bldd, "BLDD", g_dunecarScript); + m_worlds[12] = WorldContainer(e_bldj, "BLDJ", g_jetskiScript); + m_worlds[13] = WorldContainer(e_bldr, "BLDR", g_racecarScript); + m_worlds[14] = WorldContainer(e_racc, "RACC", g_carraceScript); + m_worlds[15] = WorldContainer(e_racj, "RACJ", g_jetraceScript); + m_worlds[16] = WorldContainer(e_act2, "ACT2", g_act2mainScript); + m_worlds[17] = WorldContainer(e_act3, "ACT3", g_act3Script); + m_worlds[18] = WorldContainer(e_test, "TEST", g_testScript); return SUCCESS; } @@ -476,10 +475,10 @@ MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) } // FUNCTION: LEGO1 0x1005b430 -const char* LegoOmni::GetWorldName(MxU32 p_id) +const char* LegoOmni::GetWorldName(LegoOmni::World p_worldId) { - for (MxS32 i = 0; i < 19; i++) { - if (m_worlds[i].m_id == p_id) { + for (MxS32 i = 0; i < e_numWorlds; i++) { + if (m_worlds[i].m_id == p_worldId) { return m_worlds[i].m_key; } } @@ -489,10 +488,10 @@ const char* LegoOmni::GetWorldName(MxU32 p_id) // FUNCTION: LEGO1 0x1005b460 // FUNCTION: BETA10 0x1008edd8 -MxAtomId* LegoOmni::GetWorldAtom(MxU32 p_id) +MxAtomId* LegoOmni::GetWorldAtom(LegoOmni::World p_worldId) { - for (MxS32 i = 0; i < 19; i++) { - if (m_worlds[i].m_id == p_id) { + for (MxS32 i = 0; i < e_numWorlds; i++) { + if (m_worlds[i].m_id == p_worldId) { return m_worlds[i].m_atomId; } } @@ -503,15 +502,15 @@ MxAtomId* LegoOmni::GetWorldAtom(MxU32 p_id) } // FUNCTION: LEGO1 0x1005b490 -MxS32 LegoOmni::GetWorldId(const char* p_key) +LegoOmni::World LegoOmni::GetWorldId(const char* p_key) { - for (MxS32 i = 0; i < 19; i++) { + for (MxS32 i = 0; i < e_numWorlds; i++) { if ((MxS32) &m_worlds[i] != -4 && !strcmpi(m_worlds[i].GetKey(), p_key)) { return m_worlds[i].GetId(); } } - return -1; + return e_undefined; } // FUNCTION: LEGO1 0x1005b4f0 diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 2543d727..6397ac66 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1111,7 +1111,7 @@ MxResult LegoAct2::FUN_10052560( action.SetObjectId(p_objectId); // World index: see LegoOmni::RegisterWorlds - action.SetAtomId(*Lego()->GetWorldAtom(15)); + action.SetAtomId(*Lego()->GetWorldAtom(LegoOmni::e_act2)); if (p_location) { action.SetUp(Mx3DPointFloat(0.0f, 1.0f, 0.0f)); From fe2a65c8dad45bdee854b3afe242a4f6dbe89c2f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 21 Dec 2024 14:41:47 -0700 Subject: [PATCH 06/16] Implement/match `LegoNavController::Notify` (#1253) * Implement/match `LegoNavController::Notify` * Move function * Add to total function count * Add OPT:REF to lego1 --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 2 + .../legoomni/include/legoanimationmanager.h | 8 +- .../legoomni/include/legocharactermanager.h | 2 + .../lego/legoomni/include/legoplantmanager.h | 3 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 6 +- LEGO1/lego/legoomni/src/actors/bike.cpp | 13 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 13 +- .../legoomni/src/actors/islepathactor.cpp | 3 +- LEGO1/lego/legoomni/src/actors/jetski.cpp | 13 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 13 +- LEGO1/lego/legoomni/src/actors/pizza.cpp | 3 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 13 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 6 +- .../src/common/legoanimationmanager.cpp | 6 +- .../src/common/legocharactermanager.cpp | 18 + .../legoomni/src/common/legoplantmanager.cpp | 8 + .../legoomni/src/entity/legonavcontroller.cpp | 371 +++++++++++++++--- LEGO1/lego/legoomni/src/race/carrace.cpp | 18 +- LEGO1/lego/legoomni/src/worlds/act3.cpp | 3 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 6 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 26 +- 22 files changed, 467 insertions(+), 89 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a946f005..1a50eda6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -139,7 +139,7 @@ jobs: run: | reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT - reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4354 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT + reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4357 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT - name: Compare Accuracy With Current Master shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index e8cd185e..c78d6312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -561,6 +561,8 @@ if (MSVC_FOR_DECOMP) set_property(TARGET isle ${lego1_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() + target_link_options(lego1 PRIVATE "/OPT:REF") + # Equivalent to target_compile_options(... PRIVATE "/MT$<$:d>") set_property(TARGET lego1 ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 24850f0e..788b8fe8 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -128,6 +128,12 @@ class LegoAnimationManager : public MxCore { MxBool m_unk0x14; // 0x14 }; + enum PlayMode { + e_unk0 = 0, + e_unk1, + e_unk2 + }; + LegoAnimationManager(); ~LegoAnimationManager() override; @@ -166,7 +172,7 @@ class LegoAnimationManager : public MxCore { MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_param3, - MxBool p_param4, + MxU8 p_param4, LegoROI* p_roi, MxBool p_param6, MxBool p_param7, diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 117b9f82..b96f2e66 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -53,6 +53,8 @@ class LegoCharacterManager { MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); + const char* GetActorName(MxS32 p_index); + MxU32 GetNumActors(); LegoROI* GetActorROI(const char* p_name, MxBool p_createEntity); void Init(); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 3b3bb976..ed83763b 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -40,6 +40,7 @@ class LegoPlantManager : public MxCore { void Reset(LegoOmni::World p_worldId); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); + MxS32 GetNumPlants(); MxBool SwitchColor(LegoEntity* p_entity); MxBool SwitchVariant(LegoEntity* p_entity); MxBool SwitchSound(LegoEntity* p_entity); @@ -48,6 +49,7 @@ class LegoPlantManager : public MxCore { MxU32 GetAnimationId(LegoEntity* p_entity); MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); LegoPlantInfo* GetInfoArray(MxS32& p_length); + LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId); MxBool FUN_10026c50(LegoEntity* p_entity); void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length); MxResult FUN_10026410(); @@ -61,7 +63,6 @@ class LegoPlantManager : public MxCore { // LegoPlantManager::`scalar deleting destructor' private: - LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId); void RemovePlant(MxS32 p_index, LegoOmni::World p_worldId); void FUN_10026860(MxS32 p_index); LegoPlantInfo* GetInfo(LegoEntity* p_entity); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index f89610b8..c2234f0a 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -595,7 +595,8 @@ void Ambulance::FUN_10037250() // FUNCTION: BETA10 0x100241a0 void Ambulance::PlayAnimation(IsleScript::Script p_objectId) { - AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, TRUE); + AnimationManager() + ->FUN_10060dc0(p_objectId, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, FALSE, FALSE, TRUE); m_lastAnimation = p_objectId; } @@ -603,7 +604,8 @@ void Ambulance::PlayAnimation(IsleScript::Script p_objectId) // FUNCTION: BETA10 0x10024440 void Ambulance::PlayFinalAnimation(IsleScript::Script p_objectId) { - AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, TRUE); + AnimationManager() + ->FUN_10060dc0(p_objectId, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, FALSE, TRUE, TRUE); m_lastAnimation = p_objectId; } diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 4793a2a2..d395c6d9 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -117,7 +117,16 @@ void Bike::ActivateSceneActions() MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5); - AnimationManager() - ->FUN_10060dc0(IsleScript::c_sns006in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager()->FUN_10060dc0( + IsleScript::c_sns006in_RunAnim, + &mat, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + TRUE, + TRUE + ); } } diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 59890fed..d01f8352 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -195,7 +195,16 @@ void DuneBuggy::ActivateSceneActions() MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5); - AnimationManager() - ->FUN_10060dc0(IsleScript::c_sns005in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager()->FUN_10060dc0( + IsleScript::c_sns005in_RunAnim, + &mat, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + TRUE, + TRUE + ); } } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 470839d4..f1d13949 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -582,7 +582,8 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 } if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) { - if (AnimationManager()->FUN_10060dc0(anim, NULL, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE) == + if (AnimationManager() + ->FUN_10060dc0(anim, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, TRUE, TRUE) == SUCCESS) { state->m_unk0x4e = TRUE; camAnim = FALSE; diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 4db9d119..e1163ff0 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -155,8 +155,17 @@ void Jetski::ActivateSceneActions() MxMatrix mat(user->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.6, mat[2][2] * 2.5); - AnimationManager() - ->FUN_10060dc0(IsleScript::c_sjs007in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager()->FUN_10060dc0( + IsleScript::c_sjs007in_RunAnim, + &mat, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + TRUE, + TRUE + ); } } } diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 1c8c73db..333f43d4 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -157,7 +157,16 @@ void Motocycle::ActivateSceneActions() MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5); - AnimationManager() - ->FUN_10060dc0(IsleScript::c_sns006in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager()->FUN_10060dc0( + IsleScript::c_sns006in_RunAnim, + &mat, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + TRUE, + TRUE + ); } } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index fad6c10a..01ca5eb3 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -586,7 +586,8 @@ void Pizza::PlayAction(MxU32 p_objectId, MxBool p_param7) InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x8c, NULL); } - AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, p_param7, TRUE, TRUE); + AnimationManager() + ->FUN_10060dc0(p_objectId, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, p_param7, TRUE, TRUE); } // FUNCTION: LEGO1 0x10039030 diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index cc577c30..9174a004 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -157,8 +157,17 @@ void SkateBoard::ActivateSceneActions() MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5); - AnimationManager() - ->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager()->FUN_10060dc0( + IsleScript::c_sns008in_RunAnim, + &mat, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + TRUE, + TRUE + ); } } } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 08da9727..de2cb291 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -565,7 +565,8 @@ void TowTrack::FUN_1004dbe0() // FUNCTION: BETA10 0x100f86a0 void TowTrack::PlayFinalAnimation(IsleScript::Script p_objectId) { - AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, TRUE); + AnimationManager() + ->FUN_10060dc0(p_objectId, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, FALSE, FALSE, TRUE); m_lastAnimation = p_objectId; } @@ -573,7 +574,8 @@ void TowTrack::PlayFinalAnimation(IsleScript::Script p_objectId) void TowTrack::FUN_1004dcb0(IsleScript::Script p_objectId) { AnimationManager()->FUN_1005f6d0(TRUE); - AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, TRUE, NULL, FALSE, TRUE, TRUE, TRUE); + AnimationManager() + ->FUN_10060dc0(p_objectId, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, TRUE, TRUE, TRUE); m_lastAnimation = p_objectId; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 379101f1..5c5400a7 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1138,7 +1138,7 @@ MxResult LegoAnimationManager::FUN_10060dc0( MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_param3, - MxBool p_param4, + MxU8 p_param4, LegoROI* p_roi, MxBool p_param6, MxBool p_param7, @@ -1159,10 +1159,10 @@ MxResult LegoAnimationManager::FUN_10060dc0( MxBool unk0x0a; switch (p_param4) { - case FALSE: + case e_unk0: unk0x0a = m_anims[i].m_unk0x0a; break; - case TRUE: + case e_unk1: unk0x0a = TRUE; break; default: diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 57c4aa42..f0ab9f53 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -221,6 +221,24 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) return result; } +// FUNCTION: LEGO1 0x100834d0 +// FUNCTION: BETA10 0x100742eb +const char* LegoCharacterManager::GetActorName(MxS32 p_index) +{ + if (p_index < sizeOfArray(g_actorInfo)) { + return g_actorInfo[p_index].m_name; + } + + return NULL; +} + +// FUNCTION: LEGO1 0x100834f0 +// FUNCTION: BETA10 0x1007432a +MxU32 LegoCharacterManager::GetNumActors() +{ + return sizeOfArray(g_actorInfo); +} + // FUNCTION: LEGO1 0x10083500 // FUNCTION: BETA10 0x10074345 LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEntity) diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 401d0782..4fc1abd8 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -98,6 +98,7 @@ void LegoPlantManager::LoadWorldInfo(LegoOmni::World p_worldId) } // FUNCTION: LEGO1 0x100263a0 +// FUNCTION: BETA10 0x100c5093 void LegoPlantManager::Reset(LegoOmni::World p_worldId) { MxU32 i; @@ -344,6 +345,13 @@ void LegoPlantManager::FUN_10026860(MxS32 p_index) } } +// FUNCTION: LEGO1 0x100268d0 +// FUNCTION: BETA10 0x100c5c7a +MxS32 LegoPlantManager::GetNumPlants() +{ + return sizeOfArray(g_plantInfo); +} + // FUNCTION: LEGO1 0x100268e0 // FUNCTION: BETA10 0x100c5c95 LegoPlantInfo* LegoPlantManager::GetInfo(LegoEntity* p_entity) diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index d3474ced..290820b7 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -1,25 +1,30 @@ #include "legonavcontroller.h" #include "3dmanager/lego3dmanager.h" +#include "act3.h" #include "infocenter.h" #include "legoanimationmanager.h" #include "legocameracontroller.h" +#include "legocharactermanager.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legolocations.h" #include "legomain.h" +#include "legoplantmanager.h" #include "legosoundmanager.h" #include "legoutils.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" +#include "mxdebug.h" #include "mxmisc.h" #include "mxtimer.h" #include "mxtransitionmanager.h" #include "mxutilities.h" #include "realtime/realtime.h" #include "realtime/realtimeview.h" +#include "viewmanager/viewmanager.h" #include @@ -74,19 +79,28 @@ float LegoNavController::g_defrotSensitivity = 0.4f; MxBool LegoNavController::g_defuseRotationalVel = FALSE; // GLOBAL: LEGO1 0x100f66a0 -MxBool g_unk0x100f66a0 = FALSE; +MxU32 g_changeLight = FALSE; // GLOBAL: LEGO1 0x100f66a4 -MxBool g_unk0x100f66a4 = FALSE; +MxU32 g_locationCalcStep = 0; + +// GLOBAL: LEGO1 0x100f66a8 +MxU32 g_nextLocation = 0; + +// GLOBAL: LEGO1 0x100f66ac +MxBool g_resetPlants = FALSE; // GLOBAL: LEGO1 0x100f66b0 -undefined4 g_unk0x100f66b0 = 0; +MxU32 g_animationCalcStep = 0; // GLOBAL: LEGO1 0x100f66b4 -undefined4 g_unk0x100f66b4 = 0; +MxS32 g_nextAnimation = 0; + +// GLOBAL: LEGO1 0x100f66b8 +MxU32 g_switchAct = FALSE; // GLOBAL: LEGO1 0x100f66bc -undefined4 g_unk0x100f66bc = 2; +LegoAnimationManager::PlayMode g_unk0x100f66bc = LegoAnimationManager::e_unk2; // GLOBAL: LEGO1 0x100f66c0 char g_debugPassword[] = "OGEL"; @@ -94,11 +108,14 @@ char g_debugPassword[] = "OGEL"; // GLOBAL: LEGO1 0x100f66c8 char* g_currentInput = g_debugPassword; +// GLOBAL: LEGO1 0x100f66cc +MxS32 g_unk0x100f66cc = -1; + // GLOBAL: LEGO1 0x100f66d0 -MxBool g_musicEnabled = TRUE; +MxBool g_enableMusic = TRUE; // GLOBAL: LEGO1 0x100f66d4 -undefined4 g_unk0x100f66d4 = 1; +MxU32 g_fpsEnabled = TRUE; // FUNCTION: LEGO1 0x10054ac0 LegoNavController::LegoNavController() @@ -608,14 +625,16 @@ MxResult LegoNavController::ProcessKeyboardInput() return SUCCESS; } -// STUB: LEGO1 0x10055a60 +// FUNCTION: LEGO1 0x10055a60 +// FUNCTION: BETA10 0x1009c712 MxLong LegoNavController::Notify(MxParam& p_param) { if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) { m_unk0x5d = TRUE; + MxU8 key = ((LegoEventNotificationParam&) p_param).GetKey(); - switch (((LegoEventNotificationParam&) p_param).GetKey()) { - case VK_PAUSE: + switch (key) { + case VK_PAUSE: // Pause game if (Lego()->IsPaused()) { Lego()->Resume(); } @@ -623,32 +642,95 @@ MxLong LegoNavController::Notify(MxParam& p_param) Lego()->Pause(); } break; - case VK_ESCAPE: { + case VK_ESCAPE: { // Return to infocenter LegoWorld* currentWorld = CurrentWorld(); + if (currentWorld != NULL) { + InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); + assert(state); - if (currentWorld) { - InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); - if (infocenterState && infocenterState->GetUnknown0x74() != 8 && currentWorld->Escape()) { + if (state != NULL && state->m_unk0x74 != 8 && currentWorld->Escape()) { BackgroundAudioManager()->Stop(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - infocenterState->SetUnknown0x74(8); + state->m_unk0x74 = 8; } } break; } - case VK_SPACE: + case VK_SPACE: // Interrupt/end animations or free navigation AnimationManager()->FUN_10061010(TRUE); break; - case 'Z': - // TODO + case 'Z': { // Make nearby plants "dance" + LegoOmni* omni = Lego(); + + if (omni->GetCurrentWorld() != NULL && omni->GetCurrentWorld()->GetWorldId() == LegoOmni::e_act1) { + LegoVideoManager* videoMgr = LegoOmni::GetInstance()->GetVideoManager(); + ViewROI* roi = videoMgr->GetViewROI(); + ViewManager* view = videoMgr->Get3DManager()->GetLego3DView()->GetViewManager(); + LegoPlantManager* plantMgr = LegoOmni::GetInstance()->GetPlantManager(); + Mx3DPointFloat viewPosition(roi->GetWorldPosition()); + MxS32 numPlants = plantMgr->GetNumPlants(); + + for (MxS32 i = 0; i < numPlants; i++) { + LegoEntity* entity = plantMgr->CreatePlant(i, NULL, LegoOmni::e_act1); + + if (entity != NULL && !entity->GetUnknown0x10IsSet(LegoEntity::c_altBit1)) { + LegoROI* roi = entity->GetROI(); + + if (roi != NULL && roi->GetVisibility()) { + const BoundingBox& box = roi->GetWorldBoundingBox(); + + if (view->IsBoundingBoxInFrustum(box)) { + Mx3DPointFloat roiPosition(roi->GetWorldPosition()); + roiPosition -= viewPosition; + + if (roiPosition.LenSquared() < 2000.0 || roi->GetUnknown0xe0() > 0) { + entity->ClickAnimation(); + } + } + } + } + } + } break; + } case 'k': - case 'm': - // TODO + case 'm': { // Keys need to be uppercased to trigger this code, but seems dysfunctional + if (g_unk0x100f66cc == -1) { + g_unk0x100f66cc = 0; + } + else { + CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_unk0x100f66cc)); + + if (key == 'k') { + g_unk0x100f66cc++; + if (g_unk0x100f66cc >= CharacterManager()->GetNumActors()) { + g_unk0x100f66cc = 0; + } + } + else { + g_unk0x100f66cc--; + if (g_unk0x100f66cc < 0) { + g_unk0x100f66cc = CharacterManager()->GetNumActors() - 1; + } + } + } + + LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE); + if (roi != NULL) { + MxMatrix mat; + ViewROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); + const float* position = roi->GetWorldPosition(); + const float* direction = roi->GetWorldDirection(); + const float* up = roi->GetWorldUp(); + CalcLocalTransform(position, direction, up, mat); + mat.TranslateBy(direction[0] * 2.0f, direction[1] - 1.0, direction[2] * 2.0f); + roi->UpdateTransformationRelativeToParent(mat); + } break; - case '{': { - InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); - if (infocenterState && infocenterState->HasRegistered()) { + } + case '{': { // Saves the game. Can't actually be triggered + InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); + if (state && state->HasRegistered()) { GameState()->Save(0); } break; @@ -659,14 +741,14 @@ MxLong LegoNavController::Notify(MxParam& p_param) // password "protected" debug shortcuts switch (((LegoEventNotificationParam&) p_param).GetKey()) { case VK_TAB: - VideoManager()->ToggleFPS(g_unk0x100f66d4); - if (g_unk0x100f66d4 == 0) { - g_unk0x100f66d4 = 1; + VideoManager()->ToggleFPS(g_fpsEnabled); + if (g_fpsEnabled) { + g_fpsEnabled = FALSE; m_unk0x5d = FALSE; - break; } else { - g_unk0x100f66d4 = 0; + g_fpsEnabled = TRUE; + m_unk0x5d = FALSE; } break; case '0': @@ -679,17 +761,130 @@ MxLong LegoNavController::Notify(MxParam& p_param) case '7': case '8': case '9': - // TODO + if (g_changeLight && key <= '1') { + LegoROI* roi = VideoManager()->GetViewROI(); + Tgl::FloatMatrix4 matrix; + Matrix4 in(matrix); + roi->GetLocalTransform(in); + VideoManager()->Get3DManager()->GetLego3DView()->SetLightTransform(key - '0', matrix); + g_changeLight = FALSE; + } + else if (g_locationCalcStep) { + if (g_locationCalcStep == 1) { + // Calculate base offset into g_locations + g_nextLocation = (key - '0') * 5; + g_locationCalcStep = 2; + } + else { + // Add to base g_locations offset + g_nextLocation += key - '0'; + g_locationCalcStep = 0; + UpdateLocation(g_nextLocation); + } + } + else if (g_animationCalcStep) { + if (g_animationCalcStep == 1) { + // Calculate base offset into possible animation object IDs (up to 999) + g_nextAnimation = (key - '0') * 100; + g_animationCalcStep = 2; + } + else if (g_animationCalcStep == 2) { + // Add to animation object ID offset + g_nextAnimation += (key - '0') * 10; + g_animationCalcStep = 3; + } + else { + // Add to animation object ID offset + g_nextAnimation += key - '0'; + g_animationCalcStep = 0; + AnimationManager()->FUN_10060dc0( + g_nextAnimation, + NULL, + TRUE, + g_unk0x100f66bc, + NULL, + TRUE, + TRUE, + TRUE, + TRUE + ); + + g_unk0x100f66bc = LegoAnimationManager::e_unk2; + } + } + + if (g_switchAct && key >= '1' && key <= '5') { + switch (GameState()->GetCurrentAct()) { + case LegoGameState::e_act1: + GameState()->m_currentArea = LegoGameState::e_isle; + break; + case LegoGameState::e_act2: + GameState()->m_currentArea = LegoGameState::e_act2main; + break; + case LegoGameState::e_act3: + GameState()->m_currentArea = LegoGameState::e_act3script; + break; + } + + switch (key) { + case '1': + GameState()->SetCurrentAct(LegoGameState::e_act1); + GameState()->SwitchArea(LegoGameState::e_isle); + break; + case '2': + GameState()->SwitchArea(LegoGameState::e_act2main); + break; + case '3': + GameState()->SwitchArea(LegoGameState::e_act3script); + break; + case '4': { + Act3State* act3State = (Act3State*) GameState()->GetState("Act3State"); + if (act3State == NULL) { + act3State = new Act3State(); + assert(act3State); + GameState()->RegisterState(act3State); + } + + GameState()->SetCurrentAct(LegoGameState::e_act3); + act3State->m_unk0x08 = 2; + GameState()->m_currentArea = LegoGameState::e_act3script; + GameState()->SwitchArea(LegoGameState::e_infomain); + break; + } + case '5': { + Act3State* act3State = (Act3State*) GameState()->GetState("Act3State"); + if (act3State == NULL) { + act3State = new Act3State(); + assert(act3State); + GameState()->RegisterState(act3State); + } + + GameState()->SetCurrentAct(LegoGameState::e_act3); + act3State->m_unk0x08 = 3; + GameState()->m_currentArea = LegoGameState::e_act3script; + GameState()->SwitchArea(LegoGameState::e_infomain); + break; + } + } + + g_switchAct = FALSE; + } + else { + MxDSAction action; + action.SetObjectId(key - '0'); + action.SetAtomId(MxAtomId("q:\\lego\\media\\model\\common\\common", e_lowerCase2)); + LegoOmni::GetInstance()->Start(&action); + } break; case 'A': - if (g_unk0x100f66b0 == 1) { - Lego()->SetUnknown13c(TRUE); - AnimationManager()->FUN_10060570(1); - g_unk0x100f66b0 = 0; + if (g_animationCalcStep == 1) { + Lego()->m_unk0x13c = TRUE; + AnimationManager()->FUN_10060570(TRUE); + g_animationCalcStep = 0; } else { LegoWorld* world = CurrentWorld(); - if (world) { + if (world != NULL) { MxDSAction action; action.SetObjectId(1); action.SetAtomId(world->GetAtomId()); @@ -698,7 +893,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) } break; case 'C': - g_unk0x100f66a4 = TRUE; + g_locationCalcStep = 1; break; case 'D': m_unk0x60 = -1.0; @@ -707,56 +902,121 @@ MxLong LegoNavController::Notify(MxParam& p_param) RealtimeView::SetUserMaxLOD(0.0); break; case 'G': - g_unk0x100f66b4 = 1; + g_switchAct = TRUE; break; case 'H': RealtimeView::SetUserMaxLOD(5.0); break; - case 'I': - // TODO + case 'I': { + LegoROI* roi = VideoManager()->GetViewROI(); + MxMatrix mat; + mat.SetIdentity(); + mat.RotateX(0.2618f); + roi->WrappedVTable0x24(mat); break; - case 'J': - // TODO + } + case 'J': { + LegoROI* roi = VideoManager()->GetViewROI(); + MxMatrix mat; + mat.SetIdentity(); + mat.RotateZ(0.2618f); + roi->WrappedVTable0x24(mat); break; - case 'K': - // TODO + } + case 'K': { + MxMatrix mat; + LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); + mat.SetIdentity(); + mat.RotateZ(-0.2618f); + roi->WrappedVTable0x24(mat); break; + } case 'L': - g_unk0x100f66a0 = TRUE; + g_changeLight = TRUE; break; - case 'M': - // TODO + case 'M': { + LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); + MxMatrix mat; + mat.SetIdentity(); + mat.RotateX(-0.2618f); + roi->WrappedVTable0x24(mat); break; + } case 'N': if (VideoManager()) { VideoManager()->SetRender3D(!VideoManager()->GetRender3D()); } break; case 'P': - // TODO + if (!g_resetPlants) { + PlantManager()->LoadWorldInfo(LegoOmni::e_act1); + g_resetPlants = TRUE; + } + else { + PlantManager()->Reset(LegoOmni::e_act1); + g_resetPlants = FALSE; + } break; case 'S': - BackgroundAudioManager()->Enable(!g_musicEnabled); + g_enableMusic = g_enableMusic == FALSE; + BackgroundAudioManager()->Enable(g_enableMusic); break; case 'U': m_unk0x60 = 1.0; break; case 'V': - // TODO - case 'W': - // TODO + if (g_nextAnimation > 0 && g_animationCalcStep == 0) { + AnimationManager()->FUN_10061010(FALSE); + } + + if (g_animationCalcStep != 0) { + g_unk0x100f66bc = LegoAnimationManager::e_unk2; + } + + g_nextAnimation = 0; + g_animationCalcStep = 1; break; + case 'W': { + MxMatrix mat; + LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); + const float* position = roi->GetWorldPosition(); + const float* direction = roi->GetWorldDirection(); + const float* up = roi->GetWorldUp(); + + MxTrace( + "pos: %f, %f, %f\ndir: %f, %f, %f\nup: %f, %f, %f\n", + EXPAND3(position), + EXPAND3(direction), + EXPAND3(up) + ); + break; + } case 'X': RealtimeView::SetUserMaxLOD(3.6); break; - case 'j': - // TODO + case 'j': { + MxU8 newActor = GameState()->GetActorId() + 1; + + if (newActor > LegoActor::c_laura) { + newActor = LegoActor::c_pepper; + } + + GameState()->SetActorId(newActor); break; + } case 'o': - GameState()->SetActorId(6); + GameState()->SetActorId(LegoActor::c_brickster); + break; + case 'z': + if (GameState()->m_isDirty) { + GameState()->m_isDirty = FALSE; + } + else { + GameState()->m_isDirty = TRUE; + } break; case 0xbd: - g_unk0x100f66bc = 1; + g_unk0x100f66bc = LegoAnimationManager::e_unk1; break; default: m_unk0x5d = FALSE; @@ -766,14 +1026,11 @@ MxLong LegoNavController::Notify(MxParam& p_param) else { if (*g_currentInput == ((LegoEventNotificationParam&) p_param).GetKey()) { g_currentInput++; - break; } else { g_currentInput = g_debugPassword; - break; } } - break; } } diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index c979db0b..9c5d6d4c 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -129,7 +129,8 @@ void CarRace::ReadyWorld() m_unk0x144 = g_unk0x100d5d10[rand() & 7]; - AnimationManager()->FUN_10060dc0(m_unk0x144, NULL, TRUE, FALSE, NULL, FALSE, TRUE, FALSE, TRUE); + AnimationManager() + ->FUN_10060dc0(m_unk0x144, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, FALSE, TRUE); m_unk0x128 = (MxStillPresenter*) Find("MxPresenter", "CarLocator2"); m_unk0x128->SetPosition(m_unk0x130.GetLeft(), m_unk0x130.GetTop()); @@ -162,7 +163,8 @@ MxLong CarRace::HandleEndAction(MxEndActionNotificationParam& p_param) result = 1; } else if (m_unk0x148 == objectId) { - AnimationManager()->FUN_10060dc0(m_unk0x14c, NULL, TRUE, FALSE, NULL, FALSE, TRUE, FALSE, TRUE); + AnimationManager() + ->FUN_10060dc0(m_unk0x14c, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, FALSE, TRUE); } else if (m_unk0x14c == objectId) { NotificationManager()->Send(this, MxNotificationParam()); @@ -253,7 +255,17 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param) raceState->m_score = position; } - AnimationManager()->FUN_10060dc0(m_unk0x148, NULL, TRUE, FALSE, NULL, FALSE, TRUE, FALSE, TRUE); + AnimationManager()->FUN_10060dc0( + m_unk0x148, + NULL, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + FALSE, + TRUE, + FALSE, + TRUE + ); } result = 1; diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 15b97913..48c68755 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -676,7 +676,8 @@ void Act3::ReadyWorld() VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f); m_unk0x426c = g_unk0x100d95e8[rand() % 3]; - AnimationManager()->FUN_10060dc0(m_unk0x426c, NULL, TRUE, FALSE, NULL, TRUE, FALSE, FALSE, FALSE); + AnimationManager() + ->FUN_10060dc0(m_unk0x426c, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, TRUE, FALSE, FALSE, FALSE); m_state->m_unk0x08 = 1; } diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 0a516043..604d514e 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -757,7 +757,8 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); + AnimationManager() + ->FUN_10060dc0(script, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; @@ -790,7 +791,8 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); + AnimationManager() + ->FUN_10060dc0(script, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 6397ac66..ea400a24 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1167,12 +1167,30 @@ MxResult LegoAct2::FUN_10052560( MxResult result; if (p_objectId == Act2mainScript::c_tja009ni_RunAnim) { - result = - AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE); + result = AnimationManager()->FUN_10060dc0( + p_objectId, + pmatrix, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + TRUE, + TRUE, + TRUE, + TRUE + ); } else { - result = - AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE); + result = AnimationManager()->FUN_10060dc0( + p_objectId, + pmatrix, + TRUE, + LegoAnimationManager::e_unk0, + NULL, + TRUE, + TRUE, + TRUE, + FALSE + ); } if (result == SUCCESS) { From a987533ba1afaf7471ab0f59f322ef2cf8227a29 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 21 Dec 2024 15:17:45 -0700 Subject: [PATCH 07/16] Fix a bug in `LegoNavController`, improve accuracy (#1254) * Fix a bug in `LegoNavController`, improve accuracy * Fix --- .../legoomni/src/entity/legonavcontroller.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 290820b7..717239ae 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -718,10 +718,10 @@ MxLong LegoNavController::Notify(MxParam& p_param) LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE); if (roi != NULL) { MxMatrix mat; - ViewROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); - const float* position = roi->GetWorldPosition(); - const float* direction = roi->GetWorldDirection(); - const float* up = roi->GetWorldUp(); + ViewROI* viewRoi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); + const float* position = viewRoi->GetWorldPosition(); + const float* direction = viewRoi->GetWorldDirection(); + const float* up = viewRoi->GetWorldUp(); CalcLocalTransform(position, direction, up, mat); mat.TranslateBy(direction[0] * 2.0f, direction[1] - 1.0, direction[2] * 2.0f); roi->UpdateTransformationRelativeToParent(mat); @@ -744,12 +744,12 @@ MxLong LegoNavController::Notify(MxParam& p_param) VideoManager()->ToggleFPS(g_fpsEnabled); if (g_fpsEnabled) { g_fpsEnabled = FALSE; - m_unk0x5d = FALSE; } else { g_fpsEnabled = TRUE; - m_unk0x5d = FALSE; } + default: + m_unk0x5d = FALSE; break; case '0': case '1': @@ -772,7 +772,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) else if (g_locationCalcStep) { if (g_locationCalcStep == 1) { // Calculate base offset into g_locations - g_nextLocation = (key - '0') * 5; + g_nextLocation = (key - '0') * 10; g_locationCalcStep = 2; } else { @@ -1018,9 +1018,6 @@ MxLong LegoNavController::Notify(MxParam& p_param) case 0xbd: g_unk0x100f66bc = LegoAnimationManager::e_unk1; break; - default: - m_unk0x5d = FALSE; - break; } } else { From b03de35e30a04a61a2771433d6440e9937968eaa Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 21 Dec 2024 15:38:22 -0700 Subject: [PATCH 08/16] Further accuracy improvement on `LegoNavController::Notify` (#1255) * Further accuracy improvement on `LegoNavController::Notify` * Use enum --- LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 717239ae..ddf7960d 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -82,16 +82,16 @@ MxBool LegoNavController::g_defuseRotationalVel = FALSE; MxU32 g_changeLight = FALSE; // GLOBAL: LEGO1 0x100f66a4 -MxU32 g_locationCalcStep = 0; +MxS32 g_locationCalcStep = 0; // GLOBAL: LEGO1 0x100f66a8 -MxU32 g_nextLocation = 0; +MxS32 g_nextLocation = 0; // GLOBAL: LEGO1 0x100f66ac MxBool g_resetPlants = FALSE; // GLOBAL: LEGO1 0x100f66b0 -MxU32 g_animationCalcStep = 0; +MxS32 g_animationCalcStep = 0; // GLOBAL: LEGO1 0x100f66b4 MxS32 g_nextAnimation = 0; @@ -607,8 +607,8 @@ MxResult LegoNavController::ProcessKeyboardInput() bool2 = TRUE; } - MxFloat val = keyFlags & 0x10 ? 1.0f : 4.0f; - MxFloat val2 = keyFlags & 0x10 ? 1.0f : 2.0f; + MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f; + MxFloat val2 = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 2.0f; if (!bool1) { m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel); From 1caf275fc49f398e54a9154523f022a114f58d97 Mon Sep 17 00:00:00 2001 From: Ramen2X Date: Sat, 21 Dec 2024 20:42:26 -0500 Subject: [PATCH 09/16] readme refresh 2 (#1256) [skip ci] * readme refresh 2 * typos * small status rewrite --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3293e97f..2240ae09 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,16 @@ This is a **work-in-progress** decompilation of LEGO Island (Version 1.1, Englis -Currently, `ISLE.EXE` is completely decompiled and behaves identically to the original. A handful of stubborn instructions are not yet matching; however, we anticipate they will as more of the overall codebase is implemented. +Currently, `ISLE.EXE` is completely decompiled and is functionally identical to the original, while `LEGO1.DLL` is complete in terms of gameplay features. However, work is still ongoing to improve the accuracy, naming, documentation, and structure of the source code. While there may still be unresolved bugs that are not present in retail, the game should be fully playable with the binaries derived from this source code. -`LEGO1.DLL` is still lacking some gameplay features but is generally workable. If you would like to use this, make sure to do so without interacting with save files created by the retail version, as there might still be some incompatibilities. +Due to various complexities with regard to the compiler, these binaries are not a byte-for-byte match of the original executables. We remain hopeful that this can be resolved at some point. ## Building This project uses the [CMake](https://cmake.org/) build system, which allows for a high degree of versatility regarding compilers and development environments. For the most accurate results, it is recommended to use Microsoft Visual C++ 4.20 (the same compiler used to build the original game). Since we're trying to match the output of this code to the original executables as closely as possible, all contributions will be graded with the output of this compiler. -These instructions will outline how to compile this repository into accurate instruction-matching binaries with Visual C++ 4.2. If you wish, you can try using other compilers, but this is at your own risk and won't be covered in this guide. +These instructions will outline how to compile this repository using Visual C++ 4.2 into highly-accurate binaries where the majority of functions are instruction-matching with retail. If you wish, you can try using other compilers, but this is at your own risk and won't be covered in this guide. #### Prerequisites From 276ad8d735b0f5e47a990ccf45074d40a6ed5637 Mon Sep 17 00:00:00 2001 From: MS Date: Sat, 21 Dec 2024 22:03:12 -0500 Subject: [PATCH 10/16] `MxDSBuffer::ParseChunk` to 100% (#1257) * MxDSBuffer::ParseChunk to 100% * Restore SUCCESS tests --- LEGO1/omni/include/mxdsaction.h | 1 + LEGO1/omni/include/mxdsbuffer.h | 3 +++ LEGO1/omni/include/mxdschunk.h | 16 +++++++++++++ LEGO1/omni/src/stream/mxdsbuffer.cpp | 32 +++++++++++-------------- LEGO1/omni/src/stream/mxdschunk.cpp | 5 +++- LEGO1/omni/src/stream/mxstreamchunk.cpp | 2 ++ 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index b678289a..807700c5 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -83,6 +83,7 @@ class MxDSAction : public MxDSObject { // FUNCTION: BETA10 0x1012be80 MxS32 GetLoopCount() { return m_loopCount; } + // FUNCTION: BETA10 0x100f27f0 void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } // FUNCTION: BETA10 0x1003db50 diff --git a/LEGO1/omni/include/mxdsbuffer.h b/LEGO1/omni/include/mxdsbuffer.h index e1db60a9..2e48e887 100644 --- a/LEGO1/omni/include/mxdsbuffer.h +++ b/LEGO1/omni/include/mxdsbuffer.h @@ -11,6 +11,7 @@ class MxStreamChunk; class MxDSChunk; // VTABLE: LEGO1 0x100dcca0 +// VTABLE: BETA10 0x101c2898 // SIZE 0x34 class MxDSBuffer : public MxCore { public: @@ -25,6 +26,7 @@ class MxDSBuffer : public MxCore { ~MxDSBuffer() override; // FUNCTION: LEGO1 0x100c6500 + // FUNCTION: BETA10 0x10158510 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025b8 @@ -87,6 +89,7 @@ class MxDSBuffer : public MxCore { void SetUnk30(MxDSStreamingAction* p_unk0x30) { m_unk0x30 = p_unk0x30; } // SYNTHETIC: LEGO1 0x100c6510 + // SYNTHETIC: BETA10 0x10158530 // MxDSBuffer::`scalar deleting destructor' private: diff --git a/LEGO1/omni/include/mxdschunk.h b/LEGO1/omni/include/mxdschunk.h index 2e5b512d..af41394a 100644 --- a/LEGO1/omni/include/mxdschunk.h +++ b/LEGO1/omni/include/mxdschunk.h @@ -12,6 +12,7 @@ #define DS_CHUNK_BIT16 0x8000 // VTABLE: LEGO1 0x100dc7f8 +// VTABLE: BETA10 0x101c23d0 // SIZE 0x1c class MxDSChunk : public MxCore { public: @@ -19,6 +20,7 @@ class MxDSChunk : public MxCore { ~MxDSChunk() override; // FUNCTION: LEGO1 0x100be0c0 + // FUNCTION: BETA10 0x10134580 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e6c @@ -26,6 +28,7 @@ class MxDSChunk : public MxCore { } // FUNCTION: LEGO1 0x100be0d0 + // FUNCTION: BETA10 0x10134520 MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name); @@ -39,14 +42,26 @@ class MxDSChunk : public MxCore { void SetChunkFlags(MxU16 p_flags) { m_flags = p_flags; } void SetObjectId(undefined4 p_objectid) { m_objectId = p_objectid; } + + // FUNCTION: BETA10 0x101343f0 void SetTime(MxLong p_time) { m_time = p_time; } + void SetLength(MxU32 p_length) { m_length = p_length; } void SetData(MxU8* p_data) { m_data = p_data; } + // FUNCTION: BETA10 0x1005ab90 MxU16 GetChunkFlags() { return m_flags; } + + // FUNCTION: BETA10 0x10159110 undefined4 GetObjectId() { return m_objectId; } + + // FUNCTION: BETA10 0x1005ab30 MxLong GetTime() { return m_time; } + + // FUNCTION: BETA10 0x1008d000 MxU32 GetLength() { return m_length; } + + // FUNCTION: BETA10 0x10056d60 MxU8* GetData() { return m_data; } void Release() @@ -57,6 +72,7 @@ class MxDSChunk : public MxCore { } // SYNTHETIC: LEGO1 0x100be150 + // SYNTHETIC: BETA10 0x101474c0 // MxDSChunk::`scalar deleting destructor' protected: diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 322fdd6b..0e424dfa 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -13,12 +13,13 @@ DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34); // FUNCTION: LEGO1 0x100c6470 +// FUNCTION: BETA10 0x10156f00 MxDSBuffer::MxDSBuffer() { - m_referenceCount = 0; m_pBuffer = NULL; m_pIntoBuffer = NULL; m_pIntoBuffer2 = NULL; + m_referenceCount = 0; m_unk0x14 = 0; m_unk0x18 = 0; m_unk0x1c = 0; @@ -29,6 +30,7 @@ MxDSBuffer::MxDSBuffer() } // FUNCTION: LEGO1 0x100c6530 +// FUNCTION: BETA10 0x10156ff7 MxDSBuffer::~MxDSBuffer() { assert(m_referenceCount == 0); @@ -54,6 +56,7 @@ MxDSBuffer::~MxDSBuffer() } // FUNCTION: LEGO1 0x100c6640 +// FUNCTION: BETA10 0x10157146 MxResult MxDSBuffer::AllocateBuffer(MxU32 p_bufferSize, Type p_mode) { MxResult result = FAILURE; @@ -233,6 +236,7 @@ MxResult MxDSBuffer::StartPresenterFromAction( } // FUNCTION: LEGO1 0x100c6a50 +// FUNCTION: BETA10 0x10157795 MxResult MxDSBuffer::ParseChunk( MxStreamController* p_controller, MxU32* p_data, @@ -254,26 +258,19 @@ MxResult MxDSBuffer::ParseChunk( MxU32 length = p_header->GetLength() + MxDSChunk::GetHeaderSize() + 8; MxDSBuffer* buffer = new MxDSBuffer(); - if (buffer && buffer->AllocateBuffer(length, e_allocate) == SUCCESS && - buffer->CalcBytesRemaining((MxU8*) p_data) == SUCCESS) { - *p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action); - - if (*p_streamingAction) { - MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer()); - *flags = p_header->GetChunkFlags() & ~DS_CHUNK_SPLIT; - - delete p_header; - (*p_streamingAction)->SetUnknowna0(buffer); - goto done; - } - } - - if (buffer) { + if (!buffer || buffer->AllocateBuffer(length, e_allocate) != SUCCESS || + buffer->CalcBytesRemaining((MxU8*) p_data) != SUCCESS || + (*p_streamingAction = new MxDSStreamingAction((MxDSStreamingAction&) *p_action)) == NULL) { delete buffer; + delete p_header; + return FAILURE; } + MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer()); + *flags = p_header->GetChunkFlags() & ~DS_CHUNK_SPLIT; + delete p_header; - return FAILURE; + (*p_streamingAction)->SetUnknowna0(buffer); } else { if (p_header->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { @@ -317,7 +314,6 @@ MxResult MxDSBuffer::ParseChunk( } } -done: return result; } diff --git a/LEGO1/omni/src/stream/mxdschunk.cpp b/LEGO1/omni/src/stream/mxdschunk.cpp index 60dfb10e..62b3b994 100644 --- a/LEGO1/omni/src/stream/mxdschunk.cpp +++ b/LEGO1/omni/src/stream/mxdschunk.cpp @@ -3,16 +3,18 @@ DECOMP_SIZE_ASSERT(MxDSChunk, 0x1c); // FUNCTION: LEGO1 0x100be050 +// FUNCTION: BETA10 0x10147290 MxDSChunk::MxDSChunk() { - m_flags = 0; m_data = NULL; + m_flags = 0; m_objectId = -1; m_time = 0; m_length = 0; } // FUNCTION: LEGO1 0x100be170 +// FUNCTION: BETA10 0x10147330 MxDSChunk::~MxDSChunk() { if (m_flags & DS_CHUNK_BIT1) { @@ -21,6 +23,7 @@ MxDSChunk::~MxDSChunk() } // FUNCTION: LEGO1 0x100be1e0 +// FUNCTION: BETA10 0x101473c5 MxU32 MxDSChunk::GetHeaderSize() { return 0x0e; diff --git a/LEGO1/omni/src/stream/mxstreamchunk.cpp b/LEGO1/omni/src/stream/mxstreamchunk.cpp index 98503096..4cf4fe4b 100644 --- a/LEGO1/omni/src/stream/mxstreamchunk.cpp +++ b/LEGO1/omni/src/stream/mxstreamchunk.cpp @@ -57,6 +57,7 @@ MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData) } // FUNCTION: LEGO1 0x100c30e0 +// FUNCTION: BETA10 0x10151517 MxResult MxStreamChunk::SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, MxBool p_append, MxS16 p_obj24val) { for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) { @@ -82,6 +83,7 @@ void MxStreamChunk::SetBuffer(MxDSBuffer* p_buffer) } // FUNCTION: LEGO1 0x100c3180 +// FUNCTION: BETA10 0x101515f1 MxU16* MxStreamChunk::IntoFlags(MxU8* p_buffer) { return (MxU16*) (p_buffer + 0x08); From 3e6d7893240254dca10f6cd7a519838a3e1c09af Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:13:34 +0100 Subject: [PATCH 11/16] Add all BETA10 `ClassName()` functions and vtables (#1258) * Add all BETA10 `ClassName()` functions and vtables * Run formatter, fix copy error * Fix copy error * Add BETA10 library functions --------- Co-authored-by: jonschz --- LEGO1/lego/legoomni/include/act2brick.h | 2 ++ .../lego/legoomni/include/act2policestation.h | 2 ++ LEGO1/lego/legoomni/include/act3.h | 4 ++++ LEGO1/lego/legoomni/include/act3actors.h | 3 +++ LEGO1/lego/legoomni/include/ambulance.h | 4 ++++ LEGO1/lego/legoomni/include/bike.h | 2 ++ LEGO1/lego/legoomni/include/buildingentity.h | 2 ++ LEGO1/lego/legoomni/include/buildings.h | 16 +++++++++++++ LEGO1/lego/legoomni/include/bumpbouy.h | 3 +++ LEGO1/lego/legoomni/include/doors.h | 2 ++ LEGO1/lego/legoomni/include/dunebuggy.h | 2 ++ LEGO1/lego/legoomni/include/elevatorbottom.h | 2 ++ LEGO1/lego/legoomni/include/gasstation.h | 4 ++++ LEGO1/lego/legoomni/include/helicopter.h | 2 ++ LEGO1/lego/legoomni/include/historybook.h | 2 ++ LEGO1/lego/legoomni/include/hospital.h | 4 ++++ LEGO1/lego/legoomni/include/infocenter.h | 4 ++++ LEGO1/lego/legoomni/include/infocenterdoor.h | 2 ++ LEGO1/lego/legoomni/include/isle.h | 2 ++ LEGO1/lego/legoomni/include/isleactor.h | 2 ++ LEGO1/lego/legoomni/include/islepathactor.h | 2 ++ LEGO1/lego/legoomni/include/jetski.h | 2 ++ LEGO1/lego/legoomni/include/jukebox.h | 4 ++++ LEGO1/lego/legoomni/include/jukeboxentity.h | 2 ++ LEGO1/lego/legoomni/include/legoact2.h | 2 ++ LEGO1/lego/legoomni/include/legoactor.h | 2 ++ .../legoomni/include/legoanimationmanager.h | 4 ++++ .../legoomni/include/legobuildingmanager.h | 1 + LEGO1/lego/legoomni/include/legocachsound.h | 1 + .../legoomni/include/legocameracontroller.h | 2 ++ LEGO1/lego/legoomni/include/legocarbuild.h | 3 +-- .../legoomni/include/legocontrolmanager.h | 1 + LEGO1/lego/legoomni/include/legoextraactor.h | 3 +++ LEGO1/lego/legoomni/include/legomain.h | 2 ++ LEGO1/lego/legoomni/include/legopathactor.h | 1 + .../legoomni/include/legopathcontroller.h | 2 ++ .../lego/legoomni/include/legoplantmanager.h | 4 ++++ LEGO1/lego/legoomni/include/legoracers.h | 6 +++++ LEGO1/lego/legoomni/include/motorcycle.h | 2 ++ .../include/mxbackgroundaudiomanager.h | 2 ++ .../include/mxcompositemediapresenter.h | 2 ++ .../legoomni/include/mxcontrolpresenter.h | 2 ++ .../legoomni/include/mxtransitionmanager.h | 2 ++ LEGO1/lego/legoomni/include/pizza.h | 4 ++++ LEGO1/lego/legoomni/include/pizzeria.h | 4 ++++ LEGO1/lego/legoomni/include/police.h | 4 ++++ LEGO1/lego/legoomni/include/racecar.h | 2 ++ LEGO1/lego/legoomni/include/radio.h | 4 ++++ .../lego/legoomni/include/registrationbook.h | 2 ++ LEGO1/lego/legoomni/include/score.h | 4 ++++ LEGO1/lego/legoomni/include/skateboard.h | 2 ++ LEGO1/lego/legoomni/include/towtrack.h | 4 ++++ LEGO1/lego/legoomni/src/actors/act3actors.cpp | 1 + .../legoomni/src/common/legoplantmanager.cpp | 4 ++++ LEGO1/lego/legoomni/src/main/legomain.cpp | 1 + .../legoomni/src/paths/legoextraactor.cpp | 1 + LEGO1/lego/legoomni/src/race/legoracers.cpp | 2 ++ .../legoomni/src/worlds/elevatorbottom.cpp | 1 + LEGO1/library_msvc.h | 24 +++++++++++++++++++ LEGO1/omni/include/mxdiskstreamcontroller.h | 2 ++ LEGO1/omni/include/mxdiskstreamprovider.h | 2 ++ LEGO1/omni/include/mxdsanim.h | 2 ++ LEGO1/omni/include/mxdsevent.h | 2 ++ LEGO1/omni/include/mxdsmultiaction.h | 2 ++ LEGO1/omni/include/mxdsobjectaction.h | 2 ++ LEGO1/omni/include/mxdsparallelaction.h | 2 ++ LEGO1/omni/include/mxdsselectaction.h | 2 ++ LEGO1/omni/include/mxdsserialaction.h | 2 ++ LEGO1/omni/include/mxdssound.h | 2 ++ LEGO1/omni/include/mxdssource.h | 2 ++ LEGO1/omni/include/mxdsstill.h | 2 ++ LEGO1/omni/include/mxdssubscriber.h | 2 ++ LEGO1/omni/include/mxnextactiondatastart.h | 2 ++ LEGO1/omni/include/mxobjectfactory.h | 1 + LEGO1/omni/include/mxramstreamcontroller.h | 2 ++ LEGO1/omni/include/mxramstreamprovider.h | 2 ++ LEGO1/omni/include/mxstreamchunk.h | 1 + LEGO1/omni/include/mxstreamcontroller.h | 2 ++ LEGO1/omni/include/mxstreamprovider.h | 2 ++ 79 files changed, 220 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act2brick.h b/LEGO1/lego/legoomni/include/act2brick.h index addc7261..55efc967 100644 --- a/LEGO1/lego/legoomni/include/act2brick.h +++ b/LEGO1/lego/legoomni/include/act2brick.h @@ -4,6 +4,7 @@ #include "legopathactor.h" // VTABLE: LEGO1 0x100d9b60 +// VTABLE: BETA10 0x101b85b8 // SIZE 0x194 class Act2Brick : public LegoPathActor { public: @@ -14,6 +15,7 @@ class Act2Brick : public LegoPathActor { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1007a360 + // FUNCTION: BETA10 0x10013290 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0438 diff --git a/LEGO1/lego/legoomni/include/act2policestation.h b/LEGO1/lego/legoomni/include/act2policestation.h index d370c51b..8a2068ed 100644 --- a/LEGO1/lego/legoomni/include/act2policestation.h +++ b/LEGO1/lego/legoomni/include/act2policestation.h @@ -4,12 +4,14 @@ #include "legoentity.h" // VTABLE: LEGO1 0x100d53a8 +// VTABLE: BETA10 0x101bd570 // SIZE 0x68 class Act2PoliceStation : public LegoEntity { public: MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1000e200 + // FUNCTION: BETA10 0x100a8e00 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03fc diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 44c220db..57012215 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -47,12 +47,14 @@ class Act3List : private list { }; // VTABLE: LEGO1 0x100d4fc8 +// VTABLE: BETA10 0x101b89b8 // SIZE 0x0c class Act3State : public LegoState { public: Act3State() { m_unk0x08 = 0; } // FUNCTION: LEGO1 0x1000e300 + // FUNCTION: BETA10 0x10017e10 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03f0 @@ -79,6 +81,7 @@ class Act3State : public LegoState { }; // VTABLE: LEGO1 0x100d9628 +// VTABLE: BETA10 0x101b8940 // SIZE 0x4274 class Act3 : public LegoWorld { public: @@ -89,6 +92,7 @@ class Act3 : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10072510 + // FUNCTION: BETA10 0x10017550 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f013c diff --git a/LEGO1/lego/legoomni/include/act3actors.h b/LEGO1/lego/legoomni/include/act3actors.h index e1a44ea3..2a9ceaa5 100644 --- a/LEGO1/lego/legoomni/include/act3actors.h +++ b/LEGO1/lego/legoomni/include/act3actors.h @@ -13,6 +13,7 @@ class LegoWorld; // VTABLE: LEGO1 0x100d7668 LegoPathActor // VTABLE: LEGO1 0x100d7738 LegoAnimActor // VTABLE: BETA10 0x101b8a98 LegoPathActor +// VTABLE: BETA10 0x101b8b88 LegoAnimActor // SIZE 0x178 class Act3Actor : public LegoAnimActor { public: @@ -30,6 +31,7 @@ class Act3Actor : public LegoAnimActor { Act3Actor(); // FUNCTION: LEGO1 0x100431b0 + // FUNCTION: BETA10 0x1001d320 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03ac @@ -145,6 +147,7 @@ class Act3Shark : public LegoAnimActor { // FUNCTION: LEGO1 0x100430d0 const char* ClassName() const override // vtable+0x0c { + // Does not exist in BETA10 // STRING: LEGO1 0x100f03a0 return "Act3Shark"; } diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 4908d55c..e6d2a4aa 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -7,12 +7,14 @@ class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d72a0 +// VTABLE: BETA10 0x101b91a8 // SIZE 0x24 class AmbulanceMissionState : public LegoState { public: AmbulanceMissionState(); // FUNCTION: LEGO1 0x10037600 + // FUNCTION: BETA10 0x100246c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00e8 @@ -100,6 +102,7 @@ class AmbulanceMissionState : public LegoState { }; // VTABLE: LEGO1 0x100d71a8 +// VTABLE: BETA10 0x101b8f70 // SIZE 0x184 class Ambulance : public IslePathActor { public: @@ -110,6 +113,7 @@ class Ambulance : public IslePathActor { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10035fa0 + // FUNCTION: BETA10 0x100240b0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03c4 diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index b69c0c67..dded37ba 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -5,12 +5,14 @@ #include "islepathactor.h" // VTABLE: LEGO1 0x100d9808 +// VTABLE: BETA10 0x101b91e8 // SIZE 0x164 class Bike : public IslePathActor { public: Bike(); // FUNCTION: LEGO1 0x100766f0 + // FUNCTION: BETA10 0x10024bd0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03d0 diff --git a/LEGO1/lego/legoomni/include/buildingentity.h b/LEGO1/lego/legoomni/include/buildingentity.h index 81bd2fba..aaab8302 100644 --- a/LEGO1/lego/legoomni/include/buildingentity.h +++ b/LEGO1/lego/legoomni/include/buildingentity.h @@ -6,6 +6,7 @@ class LegoEventNotificationParam; // VTABLE: LEGO1 0x100d5c88 +// VTABLE: BETA10 0x101b9320 // SIZE 0x68 class BuildingEntity : public LegoEntity { public: @@ -15,6 +16,7 @@ class BuildingEntity : public LegoEntity { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10014f20 + // FUNCTION: BETA10 0x10025f50 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07e8 diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h index 469a4936..71201a48 100644 --- a/LEGO1/lego/legoomni/include/buildings.h +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -6,9 +6,11 @@ class LegoEventNotificationParam; // VTABLE: LEGO1 0x100d48a8 +// VTABLE: BETA10 0x101bd818 // SIZE 0x68 class RaceStandsEntity : public BuildingEntity { // FUNCTION: LEGO1 0x1000efa0 + // FUNCTION: BETA10 0x100a9820 const char* ClassName() const override // vtable+0x0c { // at LEGO1 0x100f0300, needs no annotation @@ -28,10 +30,12 @@ class RaceStandsEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d4a18 +// VTABLE: BETA10 0x101bd7b0 // SIZE 0x68 class BeachHouseEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ee80 + // FUNCTION: BETA10 0x100a96f0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0314 @@ -51,10 +55,12 @@ class BeachHouseEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d4ab0 +// VTABLE: BETA10 0x101bd748 // SIZE 0x68 class PoliceEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ed60 + // FUNCTION: BETA10 0x100a95c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0328 @@ -74,10 +80,12 @@ class PoliceEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d4b90 +// VTABLE: BETA10 0x101bd610 // SIZE 0x68 class InfoCenterEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ea00 + // FUNCTION: BETA10 0x100a9230 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f035c @@ -97,10 +105,12 @@ class InfoCenterEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d5068 +// VTABLE: BETA10 0x101bd678 // SIZE 0x68 class HospitalEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ec40 + // FUNCTION: BETA10 0x100a9360 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0338 @@ -120,9 +130,11 @@ class HospitalEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d50c0 +// VTABLE: BETA10 0x101bd880 // SIZE 0x68 class CaveEntity : public BuildingEntity { // FUNCTION: LEGO1 0x1000f1e0 + // FUNCTION: BETA10 0x100a9950 const char* ClassName() const override // vtable+0x0c { // at LEGO1 0x100f0300, needs no annotation @@ -142,9 +154,11 @@ class CaveEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d5200 +// VTABLE: BETA10 0x101bd8e8 // SIZE 0x68 class JailEntity : public BuildingEntity { // FUNCTION: LEGO1 0x1000f0c0 + // FUNCTION: BETA10 0x100a9a80 const char* ClassName() const override // vtable+0x0c { // at LEGO1 0x100f0300, needs no annotation @@ -164,10 +178,12 @@ class JailEntity : public BuildingEntity { }; // VTABLE: LEGO1 0x100d5258 +// VTABLE: BETA10 0x101bd6e0 // SIZE 0x68 class GasStationEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000eb20 + // FUNCTION: BETA10 0x100a9490 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0348 diff --git a/LEGO1/lego/legoomni/include/bumpbouy.h b/LEGO1/lego/legoomni/include/bumpbouy.h index 0399ee9c..b2877034 100644 --- a/LEGO1/lego/legoomni/include/bumpbouy.h +++ b/LEGO1/lego/legoomni/include/bumpbouy.h @@ -6,6 +6,8 @@ // VTABLE: LEGO1 0x100d6790 LegoPathActor // VTABLE: LEGO1 0x100d6860 LegoAnimActor +// VTABLE: BETA10 0x101b9430 LegoPathActor +// VTABLE: BETA10 0x101b9520 LegoAnimActor // SIZE 0x174 class BumpBouy : public LegoAnimActor { public: @@ -14,6 +16,7 @@ class BumpBouy : public LegoAnimActor { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100274f0 + // FUNCTION: BETA10 0x10026790 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0394 diff --git a/LEGO1/lego/legoomni/include/doors.h b/LEGO1/lego/legoomni/include/doors.h index 3a987c9f..5aad2dba 100644 --- a/LEGO1/lego/legoomni/include/doors.h +++ b/LEGO1/lego/legoomni/include/doors.h @@ -6,12 +6,14 @@ class LegoROI; // VTABLE: LEGO1 0x100d4788 +// VTABLE: BETA10 0x101bcfb8 // SIZE 0x1f8 class Doors : public LegoPathActor { public: Doors() : m_unk0x154(0), m_ltDoor(NULL), m_rtDoor(NULL), m_unk0x1f4(0) {} // FUNCTION: LEGO1 0x1000e430 + // FUNCTION: BETA10 0x100a7f20 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03e8 diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index cfb8c729..f1b45a15 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -5,12 +5,14 @@ #include "islepathactor.h" // VTABLE: LEGO1 0x100d8f98 +// VTABLE: BETA10 0x101b95c0 // SIZE 0x16c class DuneBuggy : public IslePathActor { public: DuneBuggy(); // FUNCTION: LEGO1 0x10067c30 + // FUNCTION: BETA10 0x100278a0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0410 diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index ec7244c6..899a830a 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -8,6 +8,7 @@ class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d5f20 +// VTABLE: BETA10 0x101b96f0 // SIZE 0xfc class ElevatorBottom : public LegoWorld { public: @@ -17,6 +18,7 @@ class ElevatorBottom : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10017f20 + // FUNCTION: BETA10 0x10028130 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04ac diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index b53fc0f7..76b2d17c 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -10,6 +10,7 @@ class MxStillPresenter; // VTABLE: LEGO1 0x100d46e0 +// VTABLE: BETA10 0x101b9818 // SIZE 0x24 class GasStationState : public LegoState { public: @@ -21,6 +22,7 @@ class GasStationState : public LegoState { GasStationState(); // FUNCTION: LEGO1 0x100061d0 + // FUNCTION: BETA10 0x10029f50 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0174 @@ -54,6 +56,7 @@ class GasStationState : public LegoState { }; // VTABLE: LEGO1 0x100d4650 +// VTABLE: BETA10 0x101b97a0 // SIZE 0x128 class GasStation : public LegoWorld { public: @@ -64,6 +67,7 @@ class GasStation : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10004780 + // FUNCTION: BETA10 0x10029d40 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0168 diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 23285f1e..2f64238d 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -8,12 +8,14 @@ class Act3; // VTABLE: LEGO1 0x100d5418 +// VTABLE: BETA10 0x101bcf98 // SIZE 0x0c class HelicopterState : public LegoState { public: HelicopterState() : m_unk0x08(0) {} // FUNCTION: LEGO1 0x1000e0d0 + // FUNCTION: BETA10 0x100a7cc0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0144 diff --git a/LEGO1/lego/legoomni/include/historybook.h b/LEGO1/lego/legoomni/include/historybook.h index 3cc04679..38f174a0 100644 --- a/LEGO1/lego/legoomni/include/historybook.h +++ b/LEGO1/lego/legoomni/include/historybook.h @@ -8,6 +8,7 @@ class MxStillPresenter; // VTABLE: LEGO1 0x100da328 +// VTABLE: BETA10 0x101b99b0 // SIZE 0x3e4 class HistoryBook : public LegoWorld { public: @@ -17,6 +18,7 @@ class HistoryBook : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10082390 + // FUNCTION: BETA10 0x1002c1c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04bc diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 28c09ddc..41465550 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -12,6 +12,7 @@ class MxEndActionNotificationParam; class MxStillPresenter; // VTABLE: LEGO1 0x100d97a0 +// VTABLE: BETA10 0x101b9ad8 // SIZE 0x18 class HospitalState : public LegoState { public: @@ -24,6 +25,7 @@ class HospitalState : public LegoState { ~HospitalState() override {} // FUNCTION: LEGO1 0x10076400 + // FUNCTION: BETA10 0x1002e3c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0480 @@ -53,6 +55,7 @@ class HospitalState : public LegoState { }; // VTABLE: LEGO1 0x100d9730 +// VTABLE: BETA10 0x101b9a60 // SIZE 0x12c class Hospital : public LegoWorld { public: @@ -63,6 +66,7 @@ class Hospital : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x100746b0 + // FUNCTION: BETA10 0x1002e1a0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0490 diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 1738f3f5..90ec3ea3 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -13,6 +13,7 @@ class MxStillPresenter; class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d93a8 +// VTABLE: BETA10 0x101b9b88 // SIZE 0x94 class InfocenterState : public LegoState { public: @@ -20,6 +21,7 @@ class InfocenterState : public LegoState { ~InfocenterState() override; // FUNCTION: LEGO1 0x10071840 + // FUNCTION: BETA10 0x10031ee0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04dc @@ -73,6 +75,7 @@ struct InfocenterMapEntry { }; // VTABLE: LEGO1 0x100d9338 +// VTABLE: BETA10 0x101b9b10 // SIZE 0x1d8 class Infocenter : public LegoWorld { public: @@ -102,6 +105,7 @@ class Infocenter : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1006eb40 + // FUNCTION: BETA10 0x100316e0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04ec diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index 73e1c41b..10caba7d 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -7,6 +7,7 @@ class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d72d8 +// VTABLE: BETA10 0x101b9bc0 // SIZE 0xfc class InfocenterDoor : public LegoWorld { public: @@ -16,6 +17,7 @@ class InfocenterDoor : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100377b0 + // FUNCTION: BETA10 0x10032790 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f049c diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 9783e4ec..9eb7e760 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -24,6 +24,7 @@ class SkateBoard; class TowTrack; // VTABLE: LEGO1 0x100d7028 +// VTABLE: BETA10 0x101b9d40 // SIZE 0x26c class Act1State : public LegoState { public: @@ -36,6 +37,7 @@ class Act1State : public LegoState { Act1State(); // FUNCTION: LEGO1 0x100338a0 + // FUNCTION: BETA10 0x10036040 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0154 diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 5604c761..56df85f4 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -10,12 +10,14 @@ class MxEndActionNotificationParam; class MxNotificationParam; // VTABLE: LEGO1 0x100d5178 +// VTABLE: BETA10 0x101bd150 // SIZE 0x7c class IsleActor : public LegoActor { public: MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1000e660 + // FUNCTION: BETA10 0x100a8300 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07dc diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 767b1b1a..1aa5616a 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -12,6 +12,7 @@ class LegoWorld; class LegoPathStructNotificationParam; // VTABLE: LEGO1 0x100d4398 +// VTABLE: BETA10 0x101b9090 // SIZE 0x160 class IslePathActor : public LegoPathActor { public: @@ -91,6 +92,7 @@ class IslePathActor : public LegoPathActor { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10002ea0 + // FUNCTION: BETA10 0x10023fa0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0104 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 4dcdc36a..cf2139d5 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -7,12 +7,14 @@ class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d9ec8 +// VTABLE: BETA10 0x101ba540 // SIZE 0x164 class Jetski : public IslePathActor { public: Jetski(); // FUNCTION: LEGO1 0x1007e430 + // FUNCTION: BETA10 0x10037910 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03d8 diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 499fdd35..b3512503 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -9,6 +9,7 @@ class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d4a90 +// VTABLE: BETA10 0x101ba6e8 // SIZE 0x10 class JukeBoxState : public LegoState { public: @@ -24,6 +25,7 @@ class JukeBoxState : public LegoState { JukeBoxState() : m_music(e_pasquell), m_active(FALSE) {} // FUNCTION: LEGO1 0x1000f310 + // FUNCTION: BETA10 0x100389c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02bc @@ -47,6 +49,7 @@ class JukeBoxState : public LegoState { }; // VTABLE: LEGO1 0x100d8958 +// VTABLE: BETA10 0x101ba670 // SIZE 0x104 class JukeBox : public LegoWorld { public: @@ -57,6 +60,7 @@ class JukeBox : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005d6f0 + // FUNCTION: BETA10 0x100388d0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02cc diff --git a/LEGO1/lego/legoomni/include/jukeboxentity.h b/LEGO1/lego/legoomni/include/jukeboxentity.h index a465dd1b..bfccaf09 100644 --- a/LEGO1/lego/legoomni/include/jukeboxentity.h +++ b/LEGO1/lego/legoomni/include/jukeboxentity.h @@ -5,6 +5,7 @@ #include "legoentity.h" // VTABLE: LEGO1 0x100da8a0 +// VTABLE: BETA10 0x101ba728 // SIZE 0x6c class JukeBoxEntity : public LegoEntity { public: @@ -14,6 +15,7 @@ class JukeBoxEntity : public LegoEntity { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10085cc0 + // FUNCTION: BETA10 0x10039480 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02f0 diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 8788af3e..89da6c41 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -11,6 +11,7 @@ class LegoPathStructNotificationParam; class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d4a70 +// VTABLE: BETA10 0x101ba910 // SIZE 0x10 class LegoAct2State : public LegoState { public: @@ -22,6 +23,7 @@ class LegoAct2State : public LegoState { ~LegoAct2State() override {} // FUNCTION: LEGO1 0x1000df80 + // FUNCTION: BETA10 0x1003c7e0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0428 diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 75ea7e63..7c29ee6b 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -7,6 +7,7 @@ class LegoCacheSound; // VTABLE: LEGO1 0x100d6d68 +// VTABLE: BETA10 0x101ba970 // SIZE 0x78 class LegoActor : public LegoEntity { public: @@ -24,6 +25,7 @@ class LegoActor : public LegoEntity { ~LegoActor() override; // FUNCTION: LEGO1 0x1002d210 + // FUNCTION: BETA10 0x10012760 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0124 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 788b8fe8..49fd4155 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -49,6 +49,7 @@ struct AnimInfo { }; // VTABLE: LEGO1 0x100d8d80 +// VTABLE: BETA10 0x101bae58 // SIZE 0x1c class AnimState : public LegoState { public: @@ -56,6 +57,7 @@ class AnimState : public LegoState { ~AnimState() override; // vtable+0x00 // FUNCTION: LEGO1 0x10065070 + // FUNCTION: BETA10 0x1004afe0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0460 @@ -91,6 +93,7 @@ class AnimState : public LegoState { }; // VTABLE: LEGO1 0x100d8c18 +// VTABLE: BETA10 0x101bab60 // SIZE 0x500 class LegoAnimationManager : public MxCore { public: @@ -141,6 +144,7 @@ class LegoAnimationManager : public MxCore { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005ec80 + // FUNCTION: BETA10 0x100483d0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7508 diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 41b5a8fd..bac64396 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -58,6 +58,7 @@ class LegoBuildingManager : public MxCore { // FUNCTION: LEGO1 0x1002f930 const char* ClassName() const override // vtable+0x0c { + // not in BETA10 // STRING: LEGO1 0x100f37d0 return "LegoBuildingManager"; } diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 59834811..ea55d7fc 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -16,6 +16,7 @@ class LegoCacheSound : public MxCore { // FUNCTION: LEGO1 0x10006580 const char* ClassName() const override // vtable+0x0c { + // not in BETA10 // STRING: LEGO1 0x100f01c4 return "LegoCacheSound"; } diff --git a/LEGO1/lego/legoomni/include/legocameracontroller.h b/LEGO1/lego/legoomni/include/legocameracontroller.h index c4a10146..96934e4f 100644 --- a/LEGO1/lego/legoomni/include/legocameracontroller.h +++ b/LEGO1/lego/legoomni/include/legocameracontroller.h @@ -7,6 +7,7 @@ #include "mxpoint32.h" // VTABLE: LEGO1 0x100d57b0 +// VTABLE: BETA10 0x101bb748 // SIZE 0xc8 class LegoCameraController : public LegoPointOfViewController { public: @@ -16,6 +17,7 @@ class LegoCameraController : public LegoPointOfViewController { MxLong Notify(MxParam& p_param) override; // vtable+04 // FUNCTION: LEGO1 0x10011ec0 + // FUNCTION: BETA10 0x1006a950 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0850 diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 945d7d06..336f67de 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -45,8 +45,6 @@ class LegoVehicleBuildState : public LegoState { // 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: @@ -93,6 +91,7 @@ class LegoCarBuild : public LegoWorld { ~LegoCarBuild() override; // FUNCTION: LEGO1 0x10022940 + // FUNCTION: BETA10 0x10070090 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0504 diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 1daf82e2..233304cf 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -40,6 +40,7 @@ class LegoControlManagerNotificationParam : public LegoEventNotificationParam { // LegoControlManagerNotificationParam::~LegoControlManagerNotificationParam // VTABLE: LEGO1 0x100d6a80 +// VTABLE: BETA10 0x101bc610 class LegoControlManager : public MxCore { public: LegoControlManager(); diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index 5bc316a3..8c354a59 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -6,7 +6,9 @@ // VTABLE: LEGO1 0x100d6c00 LegoAnimActor // VTABLE: LEGO1 0x100d6c10 LegoPathActor // VTABLE: LEGO1 0x100d6cdc LegoExtraActor +// VTABLE: BETA10 0x101bc2a0 LegoAnimActor // VTABLE: BETA10 0x101bc2b8 LegoPathActor +// VTABLE: BETA10 0x101bc3a8 LegoExtraActor // SIZE 0x1dc class LegoExtraActor : public virtual LegoAnimActor { public: @@ -21,6 +23,7 @@ class LegoExtraActor : public virtual LegoAnimActor { ~LegoExtraActor() override; // FUNCTION: LEGO1 0x1002b7b0 + // FUNCTION: BETA10 0x100831a0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f3204 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 58780b7e..1ab6c2ee 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -28,6 +28,7 @@ class MxTransitionManager; class ViewLODListManager; // VTABLE: LEGO1 0x100d8638 +// VTABLE: BETA10 0x101bc8b8 // SIZE 0x140 class LegoOmni : public MxOmni { public: @@ -103,6 +104,7 @@ class LegoOmni : public MxOmni { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10058aa0 + // FUNCTION: BETA10 0x1008f830 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f671c diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index e9ef2af2..35dbbbe8 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -39,6 +39,7 @@ class LegoPathActor : public LegoActor { ~LegoPathActor() override; // FUNCTION: LEGO1 0x1000c430 + // FUNCTION: BETA10 0x10012790 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0114 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 37096cc2..01094fe6 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -34,6 +34,7 @@ struct LegoPathCtrlEdgeCompare { typedef set LegoPathCtrlEdgeSet; // VTABLE: LEGO1 0x100d7d60 +// VTABLE: BETA10 0x101bde20 // SIZE 0x40 class LegoPathController : public MxCore { public: @@ -69,6 +70,7 @@ class LegoPathController : public MxCore { MxResult Tickle() override; // vtable+08 // FUNCTION: LEGO1 0x10045110 + // FUNCTION: BETA10 0x100ba560 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f11b8 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index ed83763b..a7a821d1 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -31,6 +31,8 @@ class LegoPlantManager : public MxCore { // FUNCTION: LEGO1 0x10026290 const char* ClassName() const override // vtable+0x0c { + // While this class exists in BETA10, it didn't have a ClassName(). + // I suppose it did not inherit from MxCore back then and likely did not have a VTABLE. // STRING: LEGO1 0x100f318c return "LegoPlantManager"; } @@ -57,6 +59,8 @@ class LegoPlantManager : public MxCore { void FUN_10027200(); static void SetCustomizeAnimFile(const char* p_value); + + // FUNCTION: BETA10 0x1007ffa0 static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } // SYNTHETIC: LEGO1 0x100262a0 diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index 8c50bea2..3cc4df2e 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -105,6 +105,11 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { // VTABLE: LEGO1 0x100d5a30 LegoAnimActor // VTABLE: LEGO1 0x100d5a40 LegoPathActor // VTABLE: LEGO1 0x100d5b10 LegoRaceMap +// VTABLE: BETA10 0x101be8a0 LegoCarRaceActor +// VTABLE: BETA10 0x101be8c8 LegoRaceActor +// VTABLE: BETA10 0x101be8d0 LegoAnimActor +// VTABLE: BETA10 0x101be8e8 LegoPathActor +// VTABLE: BETA10 0x101be9d8 LegoRaceMap // SIZE 0x1dc class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { public: @@ -114,6 +119,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10013e90 + // FUNCTION: BETA10 0x100cd1f0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f053c diff --git a/LEGO1/lego/legoomni/include/motorcycle.h b/LEGO1/lego/legoomni/include/motorcycle.h index a95ba705..39567676 100644 --- a/LEGO1/lego/legoomni/include/motorcycle.h +++ b/LEGO1/lego/legoomni/include/motorcycle.h @@ -5,12 +5,14 @@ #include "islepathactor.h" // VTABLE: LEGO1 0x100d7090 +// VTABLE: BETA10 0x101bf3d8 // SIZE 0x16c class Motocycle : public IslePathActor { public: Motocycle(); // FUNCTION: LEGO1 0x10035840 + // FUNCTION: BETA10 0x100e83c0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f38e8 diff --git a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h index 210f646c..8cf18412 100644 --- a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h +++ b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h @@ -9,6 +9,7 @@ class MxAudioPresenter; // VTABLE: LEGO1 0x100d9fe8 +// VTABLE: BETA10 0x101bf508 // SIZE 0x150 class MxBackgroundAudioManager : public MxCore { public: @@ -19,6 +20,7 @@ class MxBackgroundAudioManager : public MxCore { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1007eb70 + // FUNCTION: BETA10 0x100e9af0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7ac4 diff --git a/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h b/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h index dcc0ac21..3ccc12d7 100644 --- a/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h +++ b/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h @@ -4,6 +4,7 @@ #include "mxcompositepresenter.h" // VTABLE: LEGO1 0x100d96b0 +// VTABLE: BETA10 0x101bf540 // SIZE 0x50 class MxCompositeMediaPresenter : public MxCompositePresenter { public: @@ -13,6 +14,7 @@ class MxCompositeMediaPresenter : public MxCompositePresenter { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10073f10 + // FUNCTION: BETA10 0x100ea920 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02d4 diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index 10473e84..3d42526f 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -8,6 +8,7 @@ class LegoControlManagerNotificationParam; class MxVideoPresenter; // VTABLE: LEGO1 0x100d7b88 +// VTABLE: BETA10 0x101bf5d0 // SIZE 0x5c class MxControlPresenter : public MxCompositePresenter { public: @@ -15,6 +16,7 @@ class MxControlPresenter : public MxCompositePresenter { ~MxControlPresenter() override; // FUNCTION: LEGO1 0x10044000 + // FUNCTION: BETA10 0x100ebf80 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0514 diff --git a/LEGO1/lego/legoomni/include/mxtransitionmanager.h b/LEGO1/lego/legoomni/include/mxtransitionmanager.h index 178b114a..2019430c 100644 --- a/LEGO1/lego/legoomni/include/mxtransitionmanager.h +++ b/LEGO1/lego/legoomni/include/mxtransitionmanager.h @@ -9,6 +9,7 @@ class MxVideoPresenter; // VTABLE: LEGO1 0x100d7ea0 +// VTABLE: BETA10 0x101bf670 // SIZE 0x900 class MxTransitionManager : public MxCore { public: @@ -20,6 +21,7 @@ class MxTransitionManager : public MxCore { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1004b950 + // FUNCTION: BETA10 0x100ed8e0 const char* ClassName() const override // vtable+0x0c { return "MxTransitionManager"; diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index a9457c24..771d1178 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -11,6 +11,7 @@ class PizzeriaState; class SkateBoard; // VTABLE: LEGO1 0x100d7408 +// VTABLE: BETA10 0x101bf750 // SIZE 0xb4 class PizzaMissionState : public LegoState { public: @@ -126,6 +127,7 @@ class PizzaMissionState : public LegoState { PizzaMissionState(); // FUNCTION: LEGO1 0x10039290 + // FUNCTION: BETA10 0x100efa20 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00d4 @@ -173,6 +175,7 @@ class PizzaMissionState : public LegoState { }; // VTABLE: LEGO1 0x100d7380 +// VTABLE: BETA10 0x101bf6b0 // SIZE 0x9c class Pizza : public IsleActor { public: @@ -182,6 +185,7 @@ class Pizza : public IsleActor { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10037f90 + // FUNCTION: BETA10 0x100ef300 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f038c diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 52bb9827..395dc1ca 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -9,12 +9,14 @@ class PizzaMissionState; // VTABLE: LEGO1 0x100d5ee8 +// VTABLE: BETA10 0x101bf788 // SIZE 0x58 class PizzeriaState : public LegoState { public: PizzeriaState(); // FUNCTION: LEGO1 0x10017c20 + // FUNCTION: BETA10 0x100f0020 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0370 @@ -46,12 +48,14 @@ class PizzeriaState : public LegoState { }; // VTABLE: LEGO1 0x100d5520 +// VTABLE: BETA10 0x101bd0b0 // SIZE 0x84 class Pizzeria : public IsleActor { public: Pizzeria() : m_pizzeriaState(NULL) {} // FUNCTION: LEGO1 0x1000e780 + // FUNCTION: BETA10 0x100a81f0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0380 diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 8524de9f..5f67d546 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -12,6 +12,7 @@ class LegoEventNotificationParam; class MxDSAction; // VTABLE: LEGO1 0x100d8af0 +// VTABLE: BETA10 0x101bf838 // SIZE 0x10 class PoliceState : public LegoState { public: @@ -19,6 +20,7 @@ class PoliceState : public LegoState { ~PoliceState() override {} // FUNCTION: LEGO1 0x1005e860 + // FUNCTION: BETA10 0x100f0d40 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0444 @@ -48,6 +50,7 @@ class PoliceState : public LegoState { }; // VTABLE: LEGO1 0x100d8a80 +// VTABLE: BETA10 0x101bf7c0 // SIZE 0x110 class Police : public LegoWorld { public: @@ -57,6 +60,7 @@ class Police : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1005e1e0 + // FUNCTION: BETA10 0x100f0c50 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0450 diff --git a/LEGO1/lego/legoomni/include/racecar.h b/LEGO1/lego/legoomni/include/racecar.h index ef2faa9d..2f616e90 100644 --- a/LEGO1/lego/legoomni/include/racecar.h +++ b/LEGO1/lego/legoomni/include/racecar.h @@ -5,6 +5,7 @@ #include "islepathactor.h" // VTABLE: LEGO1 0x100d6918 +// VTABLE: BETA10 0x101bf878 // SIZE 0x164 class RaceCar : public IslePathActor { public: @@ -12,6 +13,7 @@ class RaceCar : public IslePathActor { ~RaceCar() override; // vtable+0x00 // FUNCTION: LEGO1 0x10028270 + // FUNCTION: BETA10 0x100f1150 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03e0 diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 45354ffd..87934c47 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -9,12 +9,14 @@ class MxAtomId; class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d6d28 +// VTABLE: BETA10 0x101bfb08 // SIZE 0x30 class RadioState : public LegoState { public: RadioState(); // FUNCTION: LEGO1 0x1002cf60 + // FUNCTION: BETA10 0x100f2850 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04f8 @@ -47,6 +49,7 @@ class RadioState : public LegoState { }; // VTABLE: LEGO1 0x100d6d10 +// VTABLE: BETA10 0x101bfaf0 // SIZE 0x10 class Radio : public MxCore { public: @@ -56,6 +59,7 @@ class Radio : public MxCore { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1002c8e0 + // FUNCTION: BETA10 0x100f2670 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f328c diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index c405a06b..3e2cf367 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -11,6 +11,7 @@ class LegoControlManagerNotificationParam; class LegoPathStructNotificationParam; // VTABLE: LEGO1 0x100d9928 +// VTABLE: BETA10 0x101bfb48 // SIZE 0x2d0 class RegistrationBook : public LegoWorld { public: @@ -21,6 +22,7 @@ class RegistrationBook : public LegoWorld { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10076e10 + // FUNCTION: BETA10 0x100f4000 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04c8 diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 7ad505aa..0d1f9da5 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -9,12 +9,14 @@ class LegoControlManagerNotificationParam; class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d53f8 +// VTABLE: BETA10 0x101bcf78 // SIZE 0x0c class ScoreState : public LegoState { public: ScoreState() : m_playCubeTutorial(TRUE) {} // FUNCTION: LEGO1 0x1000de40 + // FUNCTION: BETA10 0x100a7a70 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0084 @@ -49,6 +51,7 @@ class ScoreState : public LegoState { }; // VTABLE: LEGO1 0x100d4018 +// VTABLE: BETA10 0x101bfbd8 // SIZE 0x104 class Score : public LegoWorld { public: @@ -57,6 +60,7 @@ class Score : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100010c0 + // FUNCTION: BETA10 0x100f4f20 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0050 diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 0bf691c1..1ac11709 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -7,6 +7,7 @@ class Act1State; // VTABLE: LEGO1 0x100d55f0 +// VTABLE: BETA10 0x101bfc70 // SIZE 0x168 class SkateBoard : public IslePathActor { public: @@ -14,6 +15,7 @@ class SkateBoard : public IslePathActor { ~SkateBoard() override; // FUNCTION: LEGO1 0x1000fdd0 + // FUNCTION: BETA10 0x100f55d0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f041c diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 822c4ecc..e20e098f 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -8,12 +8,14 @@ class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d7fd8 +// VTABLE: BETA10 0x101bfee0 // SIZE 0x28 class TowTrackMissionState : public LegoState { public: TowTrackMissionState(); // FUNCTION: LEGO1 0x1004dfa0 + // FUNCTION: BETA10 0x100f8920 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00bc @@ -102,6 +104,7 @@ class TowTrackMissionState : public LegoState { }; // VTABLE: LEGO1 0x100d7ee0 +// VTABLE: BETA10 0x101bfdc0 // SIZE 0x180 class TowTrack : public IslePathActor { public: @@ -109,6 +112,7 @@ class TowTrack : public IslePathActor { ~TowTrack() override; // FUNCTION: LEGO1 0x1004c7c0 + // FUNCTION: BETA10 0x100f8440 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03b8 diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index f09c691a..f5a5c5a4 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -92,6 +92,7 @@ Act3Actor::Act3CopDest g_copDest[5] = { Mx3DPointFloat Act3Actor::g_unk0x10104ef0 = Mx3DPointFloat(0.0, 5.0, 0.0); // FUNCTION: LEGO1 0x1003fa50 +// FUNCTION: BETA10 0x10017fb8 Act3Actor::Act3Actor() { m_unk0x1c = 0; diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 4fc1abd8..22b5cc80 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -52,6 +52,7 @@ MxS32 LegoPlantManager::g_maxMove[4] = {3, 3, 3, 3}; MxU32 g_plantAnimationId[4] = {30, 33, 36, 39}; // GLOBAL: LEGO1 0x100f3188 +// GLOBAL: BETA10 0x101f4e70 char* LegoPlantManager::g_customizeAnimFile = NULL; // GLOBAL: LEGO1 0x10103180 @@ -65,6 +66,7 @@ LegoPlantManager::LegoPlantManager() } // FUNCTION: LEGO1 0x100262c0 +// FUNCTION: BETA10 0x100c5002 LegoPlantManager::~LegoPlantManager() { delete[] g_customizeAnimFile; @@ -74,6 +76,8 @@ LegoPlantManager::~LegoPlantManager() // FUNCTION: BETA10 0x100c4f90 void LegoPlantManager::Init() { + // In BETA10 this appears to be LegoPlantManager::LegoPlantManager() + for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { g_plantInfo[i] = g_plantInfoInit[i]; } diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index b065c6e4..f69cc43c 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -153,6 +153,7 @@ void LegoOmni::Destroy() } // FUNCTION: LEGO1 0x10058e70 +// FUNCTION: BETA10 0x1008d6bf MxResult LegoOmni::Create(MxOmniCreateParam& p_param) { MxResult result = FAILURE; diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index b35f19f8..23d98359 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -28,6 +28,7 @@ MxS32 g_unk0x100f31dc = 0; Mx3DPointFloat g_unk0x10104c18 = Mx3DPointFloat(0.0f, 2.5f, 0.0f); // FUNCTION: LEGO1 0x1002a500 +// FUNCTION: BETA10 0x10080908 LegoExtraActor::LegoExtraActor() { m_unk0x70 = 0.0f; diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 15d6e66e..5ebfab2e 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -633,12 +633,14 @@ void LegoJetski::Animate(float p_time) } // FUNCTION: LEGO1 0x10013820 +// FUNCTION: BETA10 0x100cc335 LegoJetski::LegoJetski() { NotificationManager()->Register(this); } // FUNCTION: LEGO1 0x10013aa0 +// FUNCTION: BETA10 0x100cc58e LegoJetski::~LegoJetski() { NotificationManager()->Unregister(this); diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index d8f7a05b..d01c9f7c 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -65,6 +65,7 @@ MxLong ElevatorBottom::Notify(MxParam& p_param) ret = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: + assert(m_destLocation != LegoGameState::e_undefined); GameState()->SwitchArea(m_destLocation); break; } diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 94811d12..34f6941c 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -744,4 +744,28 @@ // LIBRARY: BETA10 0x100f9610 // rand +// LIBRARY: BETA10 0x100f9b90 +// _purecall + +// LIBRARY: BETA10 0x100fca70 +// _amsg_exit + +// LIBRARY: BETA10 0x1010ab30 +// _FF_MSGBANNER + +// LIBRARY: BETA10 0x1010ab90 +// _NMSG_WRITE + +// LIBRARY: BETA10 0x100fbdb0 +// _exit + +// LIBRARY: BETA10 0x10100bf0 +// _CrtDbgReport + +// GLOBAL: BETA10 0x101faf74 +// __error_mode + +// GLOBAL: BETA10 0x101faf78 +// __app_type + #endif diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index 83985a54..9a1ad22c 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -12,6 +12,7 @@ class MxDSStreamingAction; // VTABLE: LEGO1 0x100dccb8 +// VTABLE: BETA10 0x101c2818 // SIZE 0xc8 class MxDiskStreamController : public MxStreamController { public: @@ -21,6 +22,7 @@ class MxDiskStreamController : public MxStreamController { MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x100c7360 + // FUNCTION: BETA10 0x10155c00 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102144 diff --git a/LEGO1/omni/include/mxdiskstreamprovider.h b/LEGO1/omni/include/mxdiskstreamprovider.h index 2c95d9ae..aa5a9ada 100644 --- a/LEGO1/omni/include/mxdiskstreamprovider.h +++ b/LEGO1/omni/include/mxdiskstreamprovider.h @@ -23,6 +23,7 @@ class MxDiskStreamProviderThread : public MxThread { }; // VTABLE: LEGO1 0x100dd138 +// VTABLE: BETA10 0x101c2c40 // SIZE 0x60 class MxDiskStreamProvider : public MxStreamProvider { public: @@ -30,6 +31,7 @@ class MxDiskStreamProvider : public MxStreamProvider { ~MxDiskStreamProvider() override; // FUNCTION: LEGO1 0x100d1160 + // FUNCTION: BETA10 0x10164090 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x1010287c diff --git a/LEGO1/omni/include/mxdsanim.h b/LEGO1/omni/include/mxdsanim.h index d69adfab..68be4e12 100644 --- a/LEGO1/omni/include/mxdsanim.h +++ b/LEGO1/omni/include/mxdsanim.h @@ -4,6 +4,7 @@ #include "mxdsmediaaction.h" // VTABLE: LEGO1 0x100dcd88 +// VTABLE: BETA10 0x101c2b20 // SIZE 0xb8 class MxDSAnim : public MxDSMediaAction { public: @@ -14,6 +15,7 @@ class MxDSAnim : public MxDSMediaAction { MxDSAnim& operator=(MxDSAnim& p_dsAnim); // FUNCTION: LEGO1 0x100c9060 + // FUNCTION: BETA10 0x1015d890 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025d8 diff --git a/LEGO1/omni/include/mxdsevent.h b/LEGO1/omni/include/mxdsevent.h index 20943009..961a4bcf 100644 --- a/LEGO1/omni/include/mxdsevent.h +++ b/LEGO1/omni/include/mxdsevent.h @@ -4,6 +4,7 @@ #include "mxdsmediaaction.h" // VTABLE: LEGO1 0x100dce18 +// VTABLE: BETA10 0x101c2bb0 class MxDSEvent : public MxDSMediaAction { public: MxDSEvent(); @@ -13,6 +14,7 @@ class MxDSEvent : public MxDSMediaAction { MxDSEvent& operator=(MxDSEvent& p_dsEvent); // FUNCTION: LEGO1 0x100c9660 + // FUNCTION: BETA10 0x1015da10 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025f0 diff --git a/LEGO1/omni/include/mxdsmultiaction.h b/LEGO1/omni/include/mxdsmultiaction.h index 84ad1a4a..5267a792 100644 --- a/LEGO1/omni/include/mxdsmultiaction.h +++ b/LEGO1/omni/include/mxdsmultiaction.h @@ -5,6 +5,7 @@ #include "mxdsactionlist.h" // VTABLE: LEGO1 0x100dcef0 +// VTABLE: BETA10 0x101c28b0 // SIZE 0x9c class MxDSMultiAction : public MxDSAction { public: @@ -15,6 +16,7 @@ class MxDSMultiAction : public MxDSAction { MxDSMultiAction& operator=(MxDSMultiAction& p_dsMultiAction); // FUNCTION: LEGO1 0x100c9f50 + // FUNCTION: BETA10 0x1015b190 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101dbc diff --git a/LEGO1/omni/include/mxdsobjectaction.h b/LEGO1/omni/include/mxdsobjectaction.h index b4346f89..c734c2c3 100644 --- a/LEGO1/omni/include/mxdsobjectaction.h +++ b/LEGO1/omni/include/mxdsobjectaction.h @@ -4,6 +4,7 @@ #include "mxdsmediaaction.h" // VTABLE: LEGO1 0x100dccf8 +// VTABLE: BETA10 0x101c2a90 // SIZE 0xb8 class MxDSObjectAction : public MxDSMediaAction { public: @@ -13,6 +14,7 @@ class MxDSObjectAction : public MxDSMediaAction { MxDSObjectAction& operator=(MxDSObjectAction& p_dsObjectAction); // FUNCTION: LEGO1 0x100c88e0 + // FUNCTION: BETA10 0x1015c620 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025c4 diff --git a/LEGO1/omni/include/mxdsparallelaction.h b/LEGO1/omni/include/mxdsparallelaction.h index 0b6dfa8b..e96b46de 100644 --- a/LEGO1/omni/include/mxdsparallelaction.h +++ b/LEGO1/omni/include/mxdsparallelaction.h @@ -4,6 +4,7 @@ #include "mxdsmultiaction.h" // VTABLE: LEGO1 0x100dcf80 +// VTABLE: BETA10 0x101c2988 // SIZE 0x9c class MxDSParallelAction : public MxDSMultiAction { public: @@ -14,6 +15,7 @@ class MxDSParallelAction : public MxDSMultiAction { MxDSParallelAction& operator=(MxDSParallelAction& p_dsParallelAction); // FUNCTION: LEGO1 0x100caf00 + // FUNCTION: BETA10 0x1015b3a0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102608 diff --git a/LEGO1/omni/include/mxdsselectaction.h b/LEGO1/omni/include/mxdsselectaction.h index 3f3e4874..10605e66 100644 --- a/LEGO1/omni/include/mxdsselectaction.h +++ b/LEGO1/omni/include/mxdsselectaction.h @@ -6,6 +6,7 @@ #include "mxstringlist.h" // VTABLE: LEGO1 0x100dcfc8 +// VTABLE: BETA10 0x101c29d0 // SIZE 0xb0 class MxDSSelectAction : public MxDSParallelAction { public: @@ -16,6 +17,7 @@ class MxDSSelectAction : public MxDSParallelAction { MxDSSelectAction& operator=(MxDSSelectAction& p_dsSelectAction); // FUNCTION: LEGO1 0x100cb6f0 + // FUNCTION: BETA10 0x1015b460 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x1010261c diff --git a/LEGO1/omni/include/mxdsserialaction.h b/LEGO1/omni/include/mxdsserialaction.h index 9a494997..a95d226d 100644 --- a/LEGO1/omni/include/mxdsserialaction.h +++ b/LEGO1/omni/include/mxdsserialaction.h @@ -5,6 +5,7 @@ #include "mxdsmultiaction.h" // VTABLE: LEGO1 0x100dcf38 +// VTABLE: BETA10 0x101c2940 // SIZE 0xa8 class MxDSSerialAction : public MxDSMultiAction { public: @@ -15,6 +16,7 @@ class MxDSSerialAction : public MxDSMultiAction { MxDSSerialAction& operator=(MxDSSerialAction& p_dsSerialAction); // FUNCTION: LEGO1 0x100caad0 + // FUNCTION: BETA10 0x1015b2b0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f75dc diff --git a/LEGO1/omni/include/mxdssound.h b/LEGO1/omni/include/mxdssound.h index ae69e2d9..33fd42dd 100644 --- a/LEGO1/omni/include/mxdssound.h +++ b/LEGO1/omni/include/mxdssound.h @@ -4,6 +4,7 @@ #include "mxdsmediaaction.h" // VTABLE: LEGO1 0x100dcdd0 +// VTABLE: BETA10 0x101c2b68 // SIZE 0xc0 class MxDSSound : public MxDSMediaAction { public: @@ -14,6 +15,7 @@ class MxDSSound : public MxDSMediaAction { MxDSSound& operator=(MxDSSound& p_dsSound); // FUNCTION: LEGO1 0x100c9330 + // FUNCTION: BETA10 0x1015d950 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025e4 diff --git a/LEGO1/omni/include/mxdssource.h b/LEGO1/omni/include/mxdssource.h index 745c2656..30ba411a 100644 --- a/LEGO1/omni/include/mxdssource.h +++ b/LEGO1/omni/include/mxdssource.h @@ -5,6 +5,7 @@ #include "mxdsbuffer.h" // VTABLE: LEGO1 0x100dc8c8 +// VTABLE: BETA10 0x101c2450 // SIZE 0x14 class MxDSSource : public MxCore { public: @@ -14,6 +15,7 @@ class MxDSSource : public MxCore { ~MxDSSource() override { delete[] m_pBuffer; } // FUNCTION: LEGO1 0x100c0010 + // FUNCTION: BETA10 0x10148cc0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102588 diff --git a/LEGO1/omni/include/mxdsstill.h b/LEGO1/omni/include/mxdsstill.h index 2621e4a2..aee7a498 100644 --- a/LEGO1/omni/include/mxdsstill.h +++ b/LEGO1/omni/include/mxdsstill.h @@ -4,6 +4,7 @@ #include "mxdsmediaaction.h" // VTABLE: LEGO1 0x100dce60 +// VTABLE: BETA10 0x101c2bf8 // SIZE 0xb8 class MxDSStill : public MxDSMediaAction { public: @@ -14,6 +15,7 @@ class MxDSStill : public MxDSMediaAction { MxDSStill& operator=(MxDSStill& p_dsStill); // FUNCTION: LEGO1 0x100c9930 + // FUNCTION: BETA10 0x1015dad0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025fc diff --git a/LEGO1/omni/include/mxdssubscriber.h b/LEGO1/omni/include/mxdssubscriber.h index 54e426f2..e0334b56 100644 --- a/LEGO1/omni/include/mxdssubscriber.h +++ b/LEGO1/omni/include/mxdssubscriber.h @@ -8,6 +8,7 @@ class MxStreamController; // VTABLE: LEGO1 0x100dc698 +// VTABLE: BETA10 0x101c1d38 // SIZE 0x4c class MxDSSubscriber : public MxCore { public: @@ -15,6 +16,7 @@ class MxDSSubscriber : public MxCore { ~MxDSSubscriber() override; // FUNCTION: LEGO1 0x100b7d50 + // FUNCTION: BETA10 0x10135180 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101020f8 diff --git a/LEGO1/omni/include/mxnextactiondatastart.h b/LEGO1/omni/include/mxnextactiondatastart.h index 59891b65..311825fe 100644 --- a/LEGO1/omni/include/mxnextactiondatastart.h +++ b/LEGO1/omni/include/mxnextactiondatastart.h @@ -4,6 +4,7 @@ #include "mxcore.h" // VTABLE: LEGO1 0x100dc9a0 +// VTABLE: BETA10 0x101c26a8 // SIZE 0x14 class MxNextActionDataStart : public MxCore { public: @@ -16,6 +17,7 @@ class MxNextActionDataStart : public MxCore { } // FUNCTION: LEGO1 0x100c1900 + // FUNCTION: BETA10 0x1014f660 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025a0 diff --git a/LEGO1/omni/include/mxobjectfactory.h b/LEGO1/omni/include/mxobjectfactory.h index 4abdf766..4e1d8f85 100644 --- a/LEGO1/omni/include/mxobjectfactory.h +++ b/LEGO1/omni/include/mxobjectfactory.h @@ -25,6 +25,7 @@ class MxObjectFactory : public MxCore { MxObjectFactory(); // FUNCTION: LEGO1 0x10008f70 + // FUNCTION: BETA10 0x100a5d20 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0730 diff --git a/LEGO1/omni/include/mxramstreamcontroller.h b/LEGO1/omni/include/mxramstreamcontroller.h index 4d55a11f..c5dc547c 100644 --- a/LEGO1/omni/include/mxramstreamcontroller.h +++ b/LEGO1/omni/include/mxramstreamcontroller.h @@ -7,12 +7,14 @@ class MxDSStreamingAction; // VTABLE: LEGO1 0x100dc728 +// VTABLE: BETA10 0x101c2390 // SIZE 0x98 class MxRAMStreamController : public MxStreamController { public: MxRAMStreamController() {} // FUNCTION: LEGO1 0x100b9430 + // FUNCTION: BETA10 0x10146c10 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102118 diff --git a/LEGO1/omni/include/mxramstreamprovider.h b/LEGO1/omni/include/mxramstreamprovider.h index 29412900..50e38b35 100644 --- a/LEGO1/omni/include/mxramstreamprovider.h +++ b/LEGO1/omni/include/mxramstreamprovider.h @@ -4,6 +4,7 @@ #include "mxstreamprovider.h" // VTABLE: LEGO1 0x100dd0d0 +// VTABLE: BETA10 0x101c2ca8 // SIZE 0x24 class MxRAMStreamProvider : public MxStreamProvider { public: @@ -11,6 +12,7 @@ class MxRAMStreamProvider : public MxStreamProvider { ~MxRAMStreamProvider() override; // FUNCTION: LEGO1 0x100d0970 + // FUNCTION: BETA10 0x10164bf0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102864 diff --git a/LEGO1/omni/include/mxstreamchunk.h b/LEGO1/omni/include/mxstreamchunk.h index fb72ee82..72858cfe 100644 --- a/LEGO1/omni/include/mxstreamchunk.h +++ b/LEGO1/omni/include/mxstreamchunk.h @@ -17,6 +17,7 @@ class MxStreamChunk : public MxDSChunk { ~MxStreamChunk() override; // FUNCTION: LEGO1 0x100b1fe0 + // FUNCTION: BETA10 0x101344a0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e5c diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index be59c6cf..e77cd392 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -13,6 +13,7 @@ class MxDSStreamingAction; class MxStreamProvider; // VTABLE: LEGO1 0x100dc968 +// VTABLE: BETA10 0x101c26c0 // SIZE 0x64 class MxStreamController : public MxCore { public: @@ -20,6 +21,7 @@ class MxStreamController : public MxCore { ~MxStreamController() override; // vtable+0x00 // FUNCTION: LEGO1 0x100c0f10 + // FUNCTION: BETA10 0x10146cf0 const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102130 diff --git a/LEGO1/omni/include/mxstreamprovider.h b/LEGO1/omni/include/mxstreamprovider.h index e2960cf9..33cda8a1 100644 --- a/LEGO1/omni/include/mxstreamprovider.h +++ b/LEGO1/omni/include/mxstreamprovider.h @@ -9,12 +9,14 @@ class MxDSAction; class MxDSFile; // VTABLE: LEGO1 0x100dd100 +// VTABLE: BETA10 0x101c2c70 // SIZE 0x10 class MxStreamProvider : public MxCore { public: MxStreamProvider() : m_pLookup(NULL), m_pFile(NULL) {} // FUNCTION: LEGO1 0x100d07e0 + // FUNCTION: BETA10 0x10163d30 const char* ClassName() const override // vtable+0x0c { return "MxStreamProvider"; From cbc3d7227e91db07b3868a661f2da47d0e67762a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 22 Dec 2024 11:47:39 -0700 Subject: [PATCH 12/16] Implement/match `LegoWEGEdge` functions (#1259) * Implement/match `LegoWEGEdge::VTable0x04` * Implement/match `LegoWEGEdge::FUN_1009aea0` * Rename --- .github/workflows/build.yml | 2 +- .../legoomni/src/paths/legopathboundary.cpp | 6 +- .../legoomni/src/paths/legopathcontroller.cpp | 8 +- LEGO1/lego/sources/geom/legoedge.h | 6 + LEGO1/lego/sources/geom/legounkown100db7f4.h | 3 + LEGO1/lego/sources/geom/legoweedge.cpp | 4 +- LEGO1/lego/sources/geom/legoweedge.h | 2 +- LEGO1/lego/sources/geom/legowegedge.cpp | 247 +++++++++++++++++- LEGO1/lego/sources/geom/legowegedge.h | 6 +- 9 files changed, 266 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a50eda6..61736b13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -139,7 +139,7 @@ jobs: run: | reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT - reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4357 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT + reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4358 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT - name: Compare Accuracy With Current Master shell: bash diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 8c98dd87..87f1cbdc 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -48,7 +48,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa { Vector3* ccwV = NULL; - if (m_unk0x48 > 0 && m_unk0x50 != NULL) { + if (m_numTriggers > 0 && m_unk0x50 != NULL) { ccwV = m_edges[0]->CCWVertex(*this); Mx3DPointFloat v; @@ -61,7 +61,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa float dot2 = v.Dot(&v, m_unk0x50); if (dot2 > dot1) { - for (MxS32 i = 0; i < m_unk0x48; i++) { + for (MxS32 i = 0; i < m_numTriggers; i++) { LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) { @@ -70,7 +70,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa } } else if (dot2 < dot1) { - for (MxS32 i = 0; i < m_unk0x48; i++) { + for (MxS32 i = 0; i < m_numTriggers; i++) { LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 887d19f7..a36a9a53 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -673,15 +673,15 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } - if (p_storage->Read(&boundary.m_unk0x48, sizeof(boundary.m_unk0x48)) != SUCCESS) { + if (p_storage->Read(&boundary.m_numTriggers, sizeof(boundary.m_numTriggers)) != SUCCESS) { return FAILURE; } - if (boundary.m_unk0x48 > 0) { + if (boundary.m_numTriggers > 0) { boundary.m_unk0x50 = new Mx3DPointFloat; - boundary.m_pathTrigger = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48]; + boundary.m_pathTrigger = new LegoWEGEdge::PathWithTrigger[boundary.m_numTriggers]; - for (j = 0; j < boundary.m_unk0x48; j++) { + for (j = 0; j < boundary.m_numTriggers; j++) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index 43740bda..881f9325 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -19,6 +19,12 @@ struct LegoEdge { LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); + // FUNCTION: BETA10 0x10184170 + LegoWEEdge* GetFaceA() { return m_faceA; } + + // FUNCTION: BETA10 0x10184190 + LegoWEEdge* GetFaceB() { return m_faceB; } + // FUNCTION: BETA10 0x1001cb80 Vector3* GetPointA() { return m_pointA; } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index ef525932..1c9c266d 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -93,6 +93,9 @@ struct LegoUnknown100db7f4 : public LegoEdge { // FUNCTION: BETA10 0x1001cc60 LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); } + // FUNCTION: BETA10 0x101841b0 + void SetFlags(LegoU16 p_flags) { m_flags = p_flags; } + inline LegoU32 FUN_10048c40(const Vector3& p_position); // SYNTHETIC: LEGO1 0x1009a6c0 diff --git a/LEGO1/lego/sources/geom/legoweedge.cpp b/LEGO1/lego/sources/geom/legoweedge.cpp index a87072e9..862b247d 100644 --- a/LEGO1/lego/sources/geom/legoweedge.cpp +++ b/LEGO1/lego/sources/geom/legoweedge.cpp @@ -20,7 +20,7 @@ LegoWEEdge::~LegoWEEdge() } // FUNCTION: LEGO1 0x1009a5b0 -LegoResult LegoWEEdge::VTable0x04() +LegoS32 LegoWEEdge::VTable0x04() { for (LegoS32 i = 0; i < m_numEdges; i++) { LegoUnknown100db7f4* e1 = m_edges[i]; @@ -52,5 +52,5 @@ LegoResult LegoWEEdge::VTable0x04() } } - return SUCCESS; + return 0; } diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index bc0f6c3c..c2df2758 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -14,7 +14,7 @@ class LegoWEEdge { LegoWEEdge(); virtual ~LegoWEEdge(); // vtable+0x00 - virtual LegoResult VTable0x04(); // vtable+0x04 + virtual LegoS32 VTable0x04(); // vtable+0x04 // FUNCTION: BETA10 0x1001c980 LegoU8 GetNumEdges() { return m_numEdges; } diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index afbe9ddb..6de4fd17 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -1,9 +1,14 @@ #include "legowegedge.h" +#include "legounkown100db7f4.h" + +#include + DECOMP_SIZE_ASSERT(LegoWEGEdge, 0x54) DECOMP_SIZE_ASSERT(LegoWEGEdge::PathWithTrigger, 0x0c) // FUNCTION: LEGO1 0x1009a730 +// FUNCTION: BETA10 0x101830ec LegoWEGEdge::LegoWEGEdge() { m_unk0x0d = 0; @@ -11,7 +16,7 @@ LegoWEGEdge::LegoWEGEdge() m_unk0x14.Clear(); m_edgeNormals = NULL; m_flags = 0; - m_unk0x48 = 0; + m_numTriggers = 0; m_pathTrigger = NULL; m_unk0x50 = NULL; } @@ -37,9 +42,241 @@ LegoWEGEdge::~LegoWEGEdge() } } -// STUB: LEGO1 0x1009a8c0 -LegoResult LegoWEGEdge::VTable0x04() +// FUNCTION: LEGO1 0x1009a8c0 +// FUNCTION: BETA10 0x101832f7 +LegoS32 LegoWEGEdge::VTable0x04() { - // TODO - return SUCCESS; + LegoS32 result = 0; + m_unk0x30.Clear(); + LegoWEEdge::VTable0x04(); + + assert(m_numEdges > 1); + + Vector3* local20; + if (IsEqual(m_edges[0]->m_faceA)) { + local20 = m_edges[0]->m_pointB; + } + else { + assert(IsEqual(m_edges[0]->m_faceB)); + local20 = m_edges[0]->m_pointA; + } + + Vector3 *local1c, *local14; + if (IsEqual(m_edges[1]->m_faceA)) { + local1c = m_edges[1]->m_pointB; + local14 = m_edges[1]->m_pointA; + } + else { + assert(IsEqual(m_edges[1]->m_faceB)); + local1c = m_edges[1]->m_pointA; + local14 = m_edges[1]->m_pointB; + } + + result = FUN_1009aea0(); + if (result != 0) { + result = -2; + } + + assert(m_edgeNormals == NULL); + m_edgeNormals = new Mx4DPointFloat[m_numEdges]; + assert(m_edgeNormals); + + LegoUnknown100db7f4* edge; + LegoS32 i; + + for (i = 0; i < m_numEdges; i++) { + edge = m_edges[i]; + m_unk0x30 += *edge->m_pointA; + m_unk0x30 += *edge->m_pointB; + } + + m_unk0x30 /= m_numEdges * 2; + m_unk0x44 = 0.0f; + + for (i = 0; i < m_numEdges; i++) { + Mx3DPointFloat local44; + edge = m_edges[i]; + + local44 = *edge->m_pointA; + local44 -= m_unk0x30; + float length = local44.LenSquared(); + + if (m_unk0x44 < length) { + m_unk0x44 = length; + } + + local44 = *edge->m_pointB; + local44 -= m_unk0x30; + length = local44.LenSquared(); + + if (m_unk0x44 < length) { + m_unk0x44 = length; + } + } + + m_unk0x44 = sqrt((double) m_unk0x44); + + for (i = 0; i < m_numEdges; i++) { + edge = m_edges[i]; + Vector3& local5c = edge->m_unk0x28; + + if (edge->m_unk0x3c == 0) { + local5c = *m_edges[i]->m_pointB; + local5c -= *m_edges[i]->m_pointA; + edge->m_unk0x3c = local5c.LenSquared(); + + if (edge->m_unk0x3c <= 0.0f) { + assert(0); + if (result == 0) { + result = -1; + } + } + + edge->m_unk0x3c = sqrt((double) edge->m_unk0x3c); + local5c /= edge->m_unk0x3c; + } + + Mx3DPointFloat local58; + Vector3 local64(&m_edgeNormals[i][0]); + edge->FUN_1002ddc0(*this, local58); + local64.EqualsCross(&local58, &m_unk0x14); + + m_edgeNormals[i][3] = -local64.Dot(m_edges[i]->m_pointA, &local64); + if (m_edgeNormals[i][3] + m_unk0x30.Dot(&m_unk0x30, &local64) < 0.0f) { + m_edgeNormals[i] *= -1.0f; + } + + if (edge->GetFaceA() != NULL && edge->GetFaceB() != NULL) { + edge->SetFlags(LegoUnknown100db7f4::c_bit1 | LegoUnknown100db7f4::c_bit2); + } + } + + if (m_numTriggers > 0) { + Vector3* vTrig1 = m_edges[0]->CCWVertex(*this); + Vector3* vTrig2 = m_edges[1]->CCWVertex(*this); + assert(vTrig1 && vTrig2); + + m_unk0x50 = new Mx3DPointFloat(); + *m_unk0x50 = *vTrig2; + *m_unk0x50 -= *vTrig1; + + if (m_unk0x50->Unitize() < 0) { + assert(0); + delete m_unk0x50; + m_unk0x50 = NULL; + } + + if (GetNumEdges() == 4) { + float local98 = 0.0f; + Mx3DPointFloat localb8(*m_edges[0]->CWVertex(*this)); + Mx3DPointFloat local80(*m_edges[2]->CCWVertex(*this)); + Mx3DPointFloat local94(*vTrig2); + + local94 -= *vTrig1; + float local9c = sqrt(local94.LenSquared()); + + localb8 -= *vTrig1; + local80 -= *vTrig1; + + float locala4 = localb8.Dot(m_unk0x50, &localb8); + if (local98 < locala4) { + local98 = locala4; + } + + locala4 = local80.Dot(m_unk0x50, &local80); + if (locala4 < local9c) { + local9c = locala4; + } + + if (local9c < local98) { + result = -3; + } + if (local9c - local98 < 0.0025) { + result = -4; + } + + local98 += 0.001; + local9c -= 0.001; + + for (LegoS32 j = 0; j < m_numTriggers; j++) { + if (m_pathTrigger[j].m_unk0x08 < local98) { + m_pathTrigger[j].m_unk0x08 = local98; + } + + if (m_pathTrigger[j].m_unk0x08 > local9c) { + m_pathTrigger[j].m_unk0x08 = local9c; + } + } + } + else { + result = -5; + } + } + + return result; +} + +// FUNCTION: LEGO1 0x1009aea0 +// FUNCTION: BETA10 0x10183e2a +LegoS32 LegoWEGEdge::FUN_1009aea0() +{ + LegoU32 localc = FALSE; + Mx3DPointFloat local24; + + if (m_numEdges < 3) { + return -1; + } + + Vector3** local8 = new Vector3*[m_numEdges]; + LegoS32 i; + + for (i = 0; i < m_numEdges; i++) { + local8[i] = m_edges[i]->CWVertex(*this); + } + + for (i = 2; i < m_numEdges; i++) { + Mx3DPointFloat local3c; + Mx3DPointFloat local50; + float local28 = 0.0f; + + local3c = *local8[i]; + local3c -= *local8[i - 1]; + local50 = *local8[i - 2]; + local50 -= *local8[i - 1]; + + local24.EqualsCross(&local50, &local3c); + local28 = local24.LenSquared(); + + if (local28 < 0.00001f) { + continue; + } + + float local58 = sqrt((double) local28); + local24 /= local58; + + if (localc) { + float local54 = local24.Dot(&m_unk0x14, &local24); + if (local54 < 0.98) { + delete[] local8; + return -2; + } + } + else { + m_unk0x14[0] = local24[0]; + m_unk0x14[1] = local24[1]; + m_unk0x14[2] = local24[2]; + m_unk0x14[3] = -local8[i]->Dot(local8[i], &local24); + localc = TRUE; + } + } + + if (local8 != NULL) { + delete[] local8; + } + + if (!localc) { + return -1; + } + + return 0; } diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index ef29db9b..77567bfe 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -38,7 +38,7 @@ class LegoWEGEdge : public LegoWEEdge { LegoWEGEdge(); ~LegoWEGEdge() override; - LegoResult VTable0x04() override; // vtable+0x04 + LegoS32 VTable0x04() override; // vtable+0x04 // FUNCTION: BETA10 0x100270c0 LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; } @@ -72,6 +72,8 @@ class LegoWEGEdge : public LegoWEEdge { friend class LegoPathController; protected: + LegoS32 FUN_1009aea0(); + LegoU8 m_flags; // 0x0c LegoU8 m_unk0x0d; // 0x0d LegoChar* m_name; // 0x10 @@ -79,7 +81,7 @@ class LegoWEGEdge : public LegoWEEdge { Mx4DPointFloat* m_edgeNormals; // 0x2c Mx3DPointFloat m_unk0x30; // 0x30 float m_unk0x44; // 0x44 - LegoU8 m_unk0x48; // 0x48 + LegoU8 m_numTriggers; // 0x48 PathWithTrigger* m_pathTrigger; // 0x4c Mx3DPointFloat* m_unk0x50; // 0x50 }; From 1f582eb6106315654576475322640d98427ac0c5 Mon Sep 17 00:00:00 2001 From: MS Date: Sun, 22 Dec 2024 22:21:07 -0500 Subject: [PATCH 13/16] Implement `MxDisplaySurface::VTable0x24` (#1261) * MxDisplaySurface::VTable0x24 * Fix stride/length check in vtable24 and vtable28 --- LEGO1/omni/include/mxdisplaysurface.h | 16 +-- LEGO1/omni/src/video/mxdisplaysurface.cpp | 155 ++++++++++++++++++++-- 2 files changed, 153 insertions(+), 18 deletions(-) diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index 43606bd0..066e11d2 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -27,14 +27,14 @@ class MxDisplaySurface : public MxCore { virtual void Destroy(); // vtable+0x1c virtual void SetPalette(MxPalette* p_palette); // vtable+0x20 virtual void VTable0x24( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4 + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height ); // vtable+0x24 virtual void VTable0x28( MxBitmap* p_bitmap, diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 647de44a..d22c059b 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -398,7 +398,7 @@ void MxDisplaySurface::VTable0x28( MxU16* p16bitPal = m_16bitPal; MxS32 i; - if (stride || length) { + if (!stride && !length) { while (height--) { MxU8* surfaceBefore = surface; @@ -1063,18 +1063,153 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() return NULL; } -// STUB: LEGO1 0x100bc200 +// FUNCTION: LEGO1 0x100bc200 void MxDisplaySurface::VTable0x24( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4 + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height ) { + // DECOMP: Almost an exact copy of VTable0x28, except that it uses the argument DDSURFACEDESC + // instead of getting one from GetDisplayMode. + if (!GetRectIntersection( + p_bitmap->GetBmiWidth(), + p_bitmap->GetBmiHeightAbs(), + m_videoParam.GetRect().GetWidth(), + m_videoParam.GetRect().GetHeight(), + &p_left, + &p_top, + &p_right, + &p_bottom, + &p_width, + &p_height + )) { + return; + } + + MxU8* data = p_bitmap->GetStart(p_left, p_top); + + if (m_videoParam.Flags().GetF1bit3()) { + p_bottom *= 2; + p_right *= 2; + + switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { + case 8: { + MxU8* surface = (MxU8*) p_desc->lpSurface + p_right + (p_bottom * p_desc->lPitch); + MxLong stride = -p_width + GetAdjustedStride(p_bitmap); + + MxLong length = -2 * p_width + p_desc->lPitch; + while (p_height--) { + MxU8* surfaceBefore = surface; + + for (MxS32 i = 0; p_width > i; i++) { + *surface++ = *data; + *surface++ = *data++; + } + + data += stride; + surface += length; + + memcpy(surface, surfaceBefore, 2 * p_width); + surface += p_desc->lPitch; + } + break; + } + case 16: { + MxU8* surface = (MxU8*) p_desc->lpSurface + (2 * p_right) + (p_bottom * p_desc->lPitch); + MxLong stride = -p_width + GetAdjustedStride(p_bitmap); + + MxS32 length = -4 * p_width + p_desc->lPitch; + MxS32 height = p_height; + MxS32 width = p_width; + MxS32 copyWidth = width * 4; + MxU16* p16bitPal = m_16bitPal; + + MxS32 i; + if (!stride && !length) { + while (height--) { + MxU8* surfaceBefore = surface; + + for (i = 0; i < width; i++) { + MxU16 element = p16bitPal[*data]; + *(MxU16*) surface = element; + surface += 2; + *(MxU16*) surface = element; + + data++; + surface += 2; + } + + memcpy(surface, surfaceBefore, copyWidth); + surface += p_desc->lPitch; + } + } + else { + while (height--) { + MxU8* surfaceBefore = surface; + + for (i = 0; i < width; i++) { + MxU16 element = p16bitPal[*data]; + *(MxU16*) surface = element; + surface += 2; + *(MxU16*) surface = element; + + data++; + surface += 2; + } + + data += stride; + surface += length; + + memcpy(surface, surfaceBefore, p_width * 4); + surface += p_desc->lPitch; + } + } + break; + } + default: + break; + } + } + else { + switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { + case 8: { + MxU8* surface = (MxU8*) p_desc->lpSurface + p_right + (p_bottom * p_desc->lPitch); + MxLong stride = GetAdjustedStride(p_bitmap); + + MxLong length = p_desc->lPitch; + while (p_height--) { + memcpy(surface, data, p_width); + data += stride; + surface += length; + } + break; + } + case 16: { + MxU8* surface = (MxU8*) p_desc->lpSurface + (2 * p_right) + (p_bottom * p_desc->lPitch); + MxLong stride = -p_width + GetAdjustedStride(p_bitmap); + + MxLong length = -2 * p_width + p_desc->lPitch; + for (MxS32 i = 0; i < p_height; i++) { + for (MxS32 j = 0; j < p_width; j++) { + *(MxU16*) surface = m_16bitPal[*data++]; + surface += 2; + } + + data += stride; + surface += length; + } + break; + } + default: + break; + } + } } // STUB: LEGO1 0x100bc630 From 48c327ca5a0f06cdd3182b24938195f60e4a8f9c Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Mon, 23 Dec 2024 10:17:36 -0500 Subject: [PATCH 14/16] Implement MxDisplaySurface::VTable0x2c (#1262) * Implement MxDisplaySurface::VTable0x2c * fix header namespace * Incorporate improvements from @madebr branch * Naming * Naming --------- Co-authored-by: Christian Semmler Co-authored-by: Anonymous Maarten --- LEGO1/omni/include/mxdisplaysurface.h | 22 +++--- LEGO1/omni/src/video/mxdisplaysurface.cpp | 95 +++++++++++++++++++---- tools/ncc/skip.yml | 1 + 3 files changed, 92 insertions(+), 26 deletions(-) diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index 066e11d2..a6925e3d 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -45,16 +45,16 @@ class MxDisplaySurface : public MxCore { MxS32 p_width, MxS32 p_height ); // vtable+0x28 - virtual MxBool VTable0x2c( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - MxBool + virtual void VTable0x2c( + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height, + MxBool p_RLE ); // vtable+0x2c virtual void VTable0x30( MxBitmap* p_bitmap, @@ -64,7 +64,7 @@ class MxDisplaySurface : public MxCore { MxS32 p_bottom, MxS32 p_width, MxS32 p_height, - MxBool p_und + MxBool p_RLE ); // vtable+0x30 virtual undefined4 VTable0x34( undefined4, diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index d22c059b..2d179d01 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -491,7 +491,7 @@ void MxDisplaySurface::VTable0x30( MxS32 p_bottom, MxS32 p_width, MxS32 p_height, - MxBool p_und + MxBool p_RLE ) { if (!GetRectIntersection( @@ -527,7 +527,7 @@ void MxDisplaySurface::VTable0x30( switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { case 8: { MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch); - if (p_und) { + if (p_RLE) { MxS32 size = p_bitmap->GetBmiHeader()->biSizeImage; DrawTransparentRLE(data, surface, size, p_width, p_height, ddsd.lPitch, 8); } @@ -553,7 +553,7 @@ void MxDisplaySurface::VTable0x30( } case 16: { MxU8* surface = (MxU8*) ddsd.lpSurface + (2 * p_right) + (p_bottom * ddsd.lPitch); - if (p_und) { + if (p_RLE) { MxS32 size = p_bitmap->GetBmiHeader()->biSizeImage; DrawTransparentRLE(data, surface, size, p_width, p_height, ddsd.lPitch, 16); } @@ -1212,20 +1212,85 @@ void MxDisplaySurface::VTable0x24( } } -// STUB: LEGO1 0x100bc630 -MxBool MxDisplaySurface::VTable0x2c( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - MxBool +// FUNCTION: LEGO1 0x100bc630 +void MxDisplaySurface::VTable0x2c( + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height, + MxBool p_RLE ) { - return 0; + // DECOMP: Almost an exact copy of VTable0x28, except that it uses the argument DDSURFACEDESC + // instead of getting one from GetDisplayMode. + if (!GetRectIntersection( + p_bitmap->GetBmiWidth(), + p_bitmap->GetBmiHeightAbs(), + m_videoParam.GetRect().GetWidth(), + m_videoParam.GetRect().GetHeight(), + &p_left, + &p_top, + &p_right, + &p_bottom, + &p_width, + &p_height + )) { + return; + } + + MxU8* src = p_bitmap->GetStart(p_left, p_top); + + switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { + case 8: { + MxLong destStride = p_desc->lPitch; + MxU8* dest = (MxU8*) p_desc->lpSurface + p_right + (p_bottom * p_desc->lPitch); + + if (p_RLE) { + DrawTransparentRLE(src, dest, p_bitmap->GetBmiHeader()->biSizeImage, p_width, p_height, p_desc->lPitch, 8); + } + else { + MxLong srcSkip = GetAdjustedStride(p_bitmap) - p_width; + MxLong destSkip = destStride - p_width; + + for (MxS32 i = 0; i < p_height; i++, src += srcSkip, dest += destSkip) { + for (MxS32 j = 0; j < p_width; j++, src++, dest++) { + if (*src) { + *dest = *src; + } + } + } + } + break; + } + case 16: { + MxLong destStride = p_desc->lPitch; + MxU8* dest = (MxU8*) p_desc->lpSurface + (2 * p_right) + (p_bottom * p_desc->lPitch); + + if (p_RLE) { + DrawTransparentRLE(src, dest, p_bitmap->GetBmiHeader()->biSizeImage, p_width, p_height, p_desc->lPitch, 16); + } + else { + MxLong srcStride = GetAdjustedStride(p_bitmap); + MxLong srcSkip = srcStride - p_width; + MxLong destSkip = destStride - 2 * p_width; + + for (MxS32 i = 0; i < p_height; i++, src += srcSkip, dest += destSkip) { + for (MxS32 j = 0; j < p_width; j++, src++, dest += 2) { + if (*src != 0) { + *(MxU16*) dest = m_16bitPal[*src]; + } + } + } + } + break; + } + default: + break; + } } // FUNCTION: LEGO1 0x100bc8b0 diff --git a/tools/ncc/skip.yml b/tools/ncc/skip.yml index 4f39ddc8..06c6e0a5 100644 --- a/tools/ncc/skip.yml +++ b/tools/ncc/skip.yml @@ -13,6 +13,7 @@ m_HELDesc: 'Allow this variable name' p_HWDesc: 'Allow this variable name' p_HELDesc: 'Allow this variable name' e_RAMStream: 'Allow this enum constant' +p_RLE: 'Allow this parameter name' p_milliseconds: 'Probably a bug with function call' m_increaseAmount: "Can't currently detect member in union" m_increaseFactor: "Can't currently detect member in union" From 5b19d7953abf8202268d495daddc24bb725d051f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 23 Dec 2024 08:32:16 -0700 Subject: [PATCH 15/16] Refactor `MxStreamList` based lists (#1260) * Refactor stream lists * Fix naming * Fix header inclusion * Fix annotations * Move function definitions to header * Remove mxstreamprovider.cpp * Naming --- CMakeLists.txt | 2 - .../legoomni/src/video/legoanimpresenter.cpp | 10 +-- .../src/video/legohideanimpresenter.cpp | 8 +- .../legoomni/src/worlds/registrationbook.cpp | 8 +- LEGO1/omni/include/mxdiskstreamcontroller.h | 22 ++--- LEGO1/omni/include/mxdiskstreamprovider.h | 3 +- LEGO1/omni/include/mxdsobject.h | 18 ++++ LEGO1/omni/include/mxdssubscriber.h | 12 +++ LEGO1/omni/include/mxstreamchunk.h | 4 +- LEGO1/omni/include/mxstreamcontroller.h | 73 +++++++++------- LEGO1/omni/include/mxstreamlist.h | 69 --------------- LEGO1/omni/include/mxstreamprovider.h | 21 +++-- LEGO1/omni/include/mxutilitylist.h | 23 +++++ LEGO1/omni/src/action/mxdsobject.cpp | 35 +++++++- LEGO1/omni/src/main/mxomni.cpp | 6 +- .../src/stream/mxdiskstreamcontroller.cpp | 23 +++-- .../omni/src/stream/mxdiskstreamprovider.cpp | 52 ++++++------ LEGO1/omni/src/stream/mxdssubscriber.cpp | 18 +++- .../omni/src/stream/mxramstreamcontroller.cpp | 2 +- LEGO1/omni/src/stream/mxramstreamprovider.cpp | 3 +- LEGO1/omni/src/stream/mxstreamchunk.cpp | 6 +- LEGO1/omni/src/stream/mxstreamcontroller.cpp | 68 ++++++++------- LEGO1/omni/src/stream/mxstreamer.cpp | 1 + LEGO1/omni/src/stream/mxstreamlist.cpp | 83 ------------------- LEGO1/omni/src/stream/mxstreamprovider.cpp | 17 ---- LEGO1/omni/src/video/mxsmkpresenter.cpp | 6 +- 26 files changed, 281 insertions(+), 312 deletions(-) delete mode 100644 LEGO1/omni/include/mxstreamlist.h create mode 100644 LEGO1/omni/include/mxutilitylist.h delete mode 100644 LEGO1/omni/src/stream/mxstreamlist.cpp delete mode 100644 LEGO1/omni/src/stream/mxstreamprovider.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c78d6312..6415d39d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,8 +258,6 @@ function(add_lego_libraries NAME) LEGO1/omni/src/stream/mxstreamchunk.cpp LEGO1/omni/src/stream/mxstreamcontroller.cpp LEGO1/omni/src/stream/mxstreamer.cpp - LEGO1/omni/src/stream/mxstreamlist.cpp - LEGO1/omni/src/stream/mxstreamprovider.cpp LEGO1/omni/src/system/mxautolock.cpp LEGO1/omni/src/system/mxcriticalsection.cpp LEGO1/omni/src/system/mxscheduler.cpp diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index c827043f..05fbb6ec 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -404,13 +404,13 @@ LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar* p_und) // FUNCTION: LEGO1 0x10069b10 void LegoAnimPresenter::FUN_10069b10() { - LegoAnimStructMap map; + LegoAnimStructMap anims; if (m_unk0x8c != NULL) { memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c)); } - FUN_1006a3c0(map, m_anim->GetRoot(), NULL); + FUN_1006a3c0(anims, m_anim->GetRoot(), NULL); if (m_roiMap != NULL) { delete[] m_roiMap; @@ -418,10 +418,10 @@ void LegoAnimPresenter::FUN_10069b10() } m_roiMapSize = 0; - m_roiMap = new LegoROI*[map.size() + 1]; - memset(m_roiMap, 0, (map.size() + 1) * sizeof(*m_roiMap)); + m_roiMap = new LegoROI*[anims.size() + 1]; + memset(m_roiMap, 0, (anims.size() + 1) * sizeof(*m_roiMap)); - for (LegoAnimStructMap::iterator it = map.begin(); it != map.end();) { + for (LegoAnimStructMap::iterator it = anims.begin(); it != anims.end();) { MxU32 index = (*it).second.m_index; m_roiMap[index] = (*it).second.m_roi; diff --git a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp index 51e62448..67d49941 100644 --- a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp @@ -143,18 +143,18 @@ void LegoHideAnimPresenter::FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time) // FUNCTION: BETA10 0x100532fd void LegoHideAnimPresenter::FUN_1006dc10() { - LegoHideAnimStructMap map; + LegoHideAnimStructMap anims; - FUN_1006e3f0(map, m_anim->GetRoot()); + FUN_1006e3f0(anims, m_anim->GetRoot()); if (m_boundaryMap != NULL) { delete[] m_boundaryMap; } - m_boundaryMap = new LegoPathBoundary*[map.size() + 1]; + m_boundaryMap = new LegoPathBoundary*[anims.size() + 1]; m_boundaryMap[0] = NULL; - for (LegoHideAnimStructMap::iterator it = map.begin(); !(it == map.end()); it++) { + for (LegoHideAnimStructMap::iterator it = anims.begin(); !(it == anims.end()); it++) { m_boundaryMap[(*it).second.m_index] = (*it).second.m_boundary; delete[] const_cast((*it).first); } diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 950e0b2e..5ade0b3a 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -576,12 +576,12 @@ MxLong RegistrationBook::HandlePathStruct(LegoPathStructNotificationParam& p_par // FUNCTION: LEGO1 0x10078350 MxBool RegistrationBook::CreateSurface() { - MxCompositePresenterList* list = m_checkmark[0]->GetList(); + MxCompositePresenterList* presenters = m_checkmark[0]->GetList(); MxStillPresenter *presenter, *uninitialized; - if (list) { - if (list->begin() != list->end()) { - presenter = (MxStillPresenter*) list->front(); + if (presenters) { + if (presenters->begin() != presenters->end()) { + presenter = (MxStillPresenter*) presenters->front(); } else { presenter = uninitialized; // intentionally uninitialized variable diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index 9a1ad22c..d74ad211 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -53,15 +53,15 @@ class MxDiskStreamController : public MxStreamController { void FUN_100c8670(MxDSStreamingAction* p_streamingAction); private: - MxStreamListMxDSAction m_list0x64; // 0x64 - MxBool m_unk0x70; // 0x70 - list m_list0x74; // 0x74 - MxStreamListMxDSAction m_list0x80; // 0x80 - undefined2 m_unk0x8c; // 0x8c - MxStreamListMxDSAction m_list0x90; // 0x90 - MxCriticalSection m_critical9c; // 0x9c - MxStreamListMxDSAction m_list0xb8; // 0xb8 - MxBool m_unk0xc4; // 0xc4 + MxDSObjectList m_list0x64; // 0x64 + MxBool m_unk0x70; // 0x70 + list m_list0x74; // 0x74 + MxDSObjectList m_list0x80; // 0x80 + undefined2 m_unk0x8c; // 0x8c + MxDSObjectList m_list0x90; // 0x90 + MxCriticalSection m_critical9c; // 0x9c + MxDSObjectList m_list0xb8; // 0xb8 + MxBool m_unk0xc4; // 0xc4 void FUN_100c7970(); void FUN_100c7ce0(MxDSBuffer* p_buffer); @@ -74,10 +74,10 @@ class MxDiskStreamController : public MxStreamController { }; // TEMPLATE: LEGO1 0x100c14d0 -// list >::erase +// list >::erase // TEMPLATE: LEGO1 0x100c7330 -// list >::_Buynode +// list >::_Buynode // TEMPLATE: LEGO1 0x100c7420 // list >::~list > diff --git a/LEGO1/omni/include/mxdiskstreamprovider.h b/LEGO1/omni/include/mxdiskstreamprovider.h index aa5a9ada..f379ea00 100644 --- a/LEGO1/omni/include/mxdiskstreamprovider.h +++ b/LEGO1/omni/include/mxdiskstreamprovider.h @@ -5,7 +5,6 @@ #include "decomp.h" #include "mxcriticalsection.h" #include "mxdsaction.h" -#include "mxstreamlist.h" #include "mxstreamprovider.h" #include "mxthread.h" @@ -63,7 +62,7 @@ class MxDiskStreamProvider : public MxStreamProvider { MxBool m_remainingWork; // 0x34 MxBool m_unk0x35; // 0x35 MxCriticalSection m_criticalSection; // 0x38 - MxStreamListMxDSAction m_list; // 0x54 + MxDSObjectList m_list; // 0x54 }; // SYNTHETIC: LEGO1 0x100d10a0 diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index 6e3d2fc3..a0a5cb16 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -4,10 +4,25 @@ #include "decomp.h" #include "mxatom.h" #include "mxcore.h" +#include "mxutilitylist.h" class MxDSFile; +class MxDSObject; class MxPresenter; +// SIZE 0x0c +class MxDSObjectList : public MxUtilityList { +public: + // FUNCTION: BETA10 0x10150e30 + MxDSObject* FindAndErase(MxDSObject* p_action) { return FindInternal(p_action, TRUE); } + + // FUNCTION: BETA10 0x10150fc0 + MxDSObject* Find(MxDSObject* p_action) { return FindInternal(p_action, FALSE); } + +private: + MxDSObject* FindInternal(MxDSObject* p_action, MxBool p_delete); +}; + // VTABLE: LEGO1 0x100dc868 // VTABLE: BETA10 0x101c23f0 // SIZE 0x2c @@ -107,4 +122,7 @@ class MxDSObject : public MxCore { MxDSObject* DeserializeDSObjectDispatch(MxU8*&, MxS16); MxDSObject* CreateStreamObject(MxDSFile*, MxS16); +// TEMPLATE: BETA10 0x10150950 +// MxUtilityList::PopFront + #endif // MXDSOBJECT_H diff --git a/LEGO1/omni/include/mxdssubscriber.h b/LEGO1/omni/include/mxdssubscriber.h index e0334b56..072a88bb 100644 --- a/LEGO1/omni/include/mxdssubscriber.h +++ b/LEGO1/omni/include/mxdssubscriber.h @@ -4,9 +4,18 @@ #include "decomp.h" #include "mxcore.h" #include "mxstreamchunklist.h" +#include "mxutilitylist.h" +class MxDSObject; +class MxDSSubscriber; class MxStreamController; +// SIZE 0x0c +class MxDSSubscriberList : public MxUtilityList { +public: + MxDSSubscriber* Find(MxDSObject* p_object); +}; + // VTABLE: LEGO1 0x100dc698 // VTABLE: BETA10 0x101c1d38 // SIZE 0x4c @@ -58,4 +67,7 @@ class MxDSSubscriber : public MxCore { // TEMPLATE: LEGO1 0x100b7d00 // MxStreamChunkList::~MxStreamChunkList +// TEMPLATE: BETA10 0x10150a70 +// MxUtilityList::PopFront + #endif // MXDSSUBSCRIBER_H diff --git a/LEGO1/omni/include/mxstreamchunk.h b/LEGO1/omni/include/mxstreamchunk.h index 72858cfe..e68566ab 100644 --- a/LEGO1/omni/include/mxstreamchunk.h +++ b/LEGO1/omni/include/mxstreamchunk.h @@ -4,7 +4,7 @@ #include "mxdschunk.h" class MxDSBuffer; -class MxStreamListMxDSSubscriber; +class MxDSSubscriberList; // VTABLE: LEGO1 0x100dc2a8 // VTABLE: BETA10 0x101c1d20 @@ -34,7 +34,7 @@ class MxStreamChunk : public MxDSChunk { MxResult ReadChunk(MxDSBuffer* p_buffer, MxU8* p_chunkData); MxU32 ReadChunkHeader(MxU8* p_chunkData); - MxResult SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, MxBool p_append, MxS16 p_obj24val); + MxResult SendChunk(MxDSSubscriberList& p_subscriberList, MxBool p_append, MxS16 p_obj24val); void SetBuffer(MxDSBuffer* p_buffer); static MxU16* IntoFlags(MxU8* p_buffer); diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index e77cd392..d0328908 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -5,13 +5,22 @@ #include "mxatom.h" #include "mxcore.h" #include "mxcriticalsection.h" +#include "mxdsobject.h" #include "mxdssubscriber.h" +#include "mxnextactiondatastart.h" #include "mxstl/stlcompat.h" -#include "mxstreamlist.h" +class MxDSAction; class MxDSStreamingAction; class MxStreamProvider; +// SIZE 0x0c +class MxNextActionDataStartList : public MxUtilityList { +public: + MxNextActionDataStart* Find(MxU32 p_id, MxS16 p_value); + MxNextActionDataStart* FindAndErase(MxU32 p_id, MxS16 p_value); +}; + // VTABLE: LEGO1 0x100dc968 // VTABLE: BETA10 0x101c26c0 // SIZE 0x64 @@ -34,12 +43,20 @@ class MxStreamController : public MxCore { return !strcmp(p_name, MxStreamController::ClassName()) || MxCore::IsA(p_name); } - virtual MxResult Open(const char* p_filename); // vtable+0x14 - virtual MxResult VTable0x18(undefined4, undefined4); // vtable+0x18 - virtual MxResult VTable0x1c(undefined4, undefined4); // vtable+0x1c - virtual MxResult VTable0x20(MxDSAction* p_action); // vtable+0x20 - virtual MxResult VTable0x24(MxDSAction* p_action); // vtable+0x24 - virtual MxDSStreamingAction* VTable0x28(); // vtable+0x28 + virtual MxResult Open(const char* p_filename); // vtable+0x14 + + // FUNCTION: LEGO1 0x100b9400 + virtual MxResult VTable0x18(undefined4, undefined4) { return FAILURE; } // vtable+0x18 + + // FUNCTION: LEGO1 0x100b9410 + virtual MxResult VTable0x1c(undefined4, undefined4) { return FAILURE; } // vtable+0x1c + + virtual MxResult VTable0x20(MxDSAction* p_action); // vtable+0x20 + virtual MxResult VTable0x24(MxDSAction* p_action); // vtable+0x24 + + // FUNCTION: LEGO1 0x100b9420 + virtual MxDSStreamingAction* VTable0x28() { return NULL; } // vtable+0x28 + virtual MxResult VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval); // vtable+0x2c virtual MxResult VTable0x30(MxDSAction* p_action); // vtable+0x30 @@ -55,24 +72,24 @@ class MxStreamController : public MxCore { MxAtomId& GetAtom() { return m_atom; } MxStreamProvider* GetProvider() { return m_provider; } - MxStreamListMxDSAction& GetUnk0x3c() { return m_unk0x3c; } - MxStreamListMxDSAction& GetUnk0x54() { return m_unk0x54; } - MxStreamListMxDSSubscriber& GetSubscriberList() { return m_subscriberList; } + MxDSObjectList& GetUnk0x3c() { return m_unk0x3c; } + MxDSObjectList& GetUnk0x54() { return m_unk0x54; } + MxDSSubscriberList& GetSubscriberList() { return m_subscriberList; } protected: - MxCriticalSection m_criticalSection; // 0x08 - MxAtomId m_atom; // 0x24 - MxStreamProvider* m_provider; // 0x28 - undefined4* m_unk0x2c; // 0x2c - MxStreamListMxDSSubscriber m_subscriberList; // 0x30 - MxStreamListMxDSAction m_unk0x3c; // 0x3c - MxStreamListMxNextActionDataStart m_nextActionList; // 0x48 - MxStreamListMxDSAction m_unk0x54; // 0x54 - MxDSAction* m_action0x60; // 0x60 + MxCriticalSection m_criticalSection; // 0x08 + MxAtomId m_atom; // 0x24 + MxStreamProvider* m_provider; // 0x28 + undefined4* m_unk0x2c; // 0x2c + MxDSSubscriberList m_subscriberList; // 0x30 + MxDSObjectList m_unk0x3c; // 0x3c + MxNextActionDataStartList m_nextActionList; // 0x48 + MxDSObjectList m_unk0x54; // 0x54 + MxDSAction* m_action0x60; // 0x60 }; // TEMPLATE: LEGO1 0x100c0d60 -// list >::~list > +// list >::~list > // TEMPLATE: LEGO1 0x100c0dd0 // list >::~list > @@ -92,33 +109,33 @@ class MxStreamController : public MxCore { // MxStreamController::`scalar deleting destructor' // FUNCTION: LEGO1 0x100c0fc0 -// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber +// MxDSSubscriberList::~MxDSSubscriberList // FUNCTION: LEGO1 0x100c1010 -// MxStreamListMxDSAction::~MxStreamListMxDSAction +// MxDSObjectList::~MxDSObjectList // FUNCTION: LEGO1 0x100c1060 -// MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart +// MxNextActionDataStartList::~MxNextActionDataStartList // TEMPLATE: LEGO1 0x100c10b0 -// MxStreamList::~MxStreamList +// MxUtilityList::~MxUtilityList // TEMPLATE: LEGO1 0x100c1100 -// MxStreamList::~MxStreamList +// MxUtilityList::~MxUtilityList // TEMPLATE: LEGO1 0x100c1150 -// MxStreamList::~MxStreamList +// MxUtilityList::~MxUtilityList // TEMPLATE: LEGO1 0x100c11a0 // List::~List // TEMPLATE: LEGO1 0x100c11f0 -// List::~List +// List::~List // TEMPLATE: LEGO1 0x100c1240 // List::~List // TEMPLATE: LEGO1 0x100c1bc0 -// list >::insert +// list >::insert #endif // MXSTREAMCONTROLLER_H diff --git a/LEGO1/omni/include/mxstreamlist.h b/LEGO1/omni/include/mxstreamlist.h deleted file mode 100644 index 36a9350a..00000000 --- a/LEGO1/omni/include/mxstreamlist.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef MXSTREAMLIST_H -#define MXSTREAMLIST_H - -#include "mxdsstreamingaction.h" -#include "mxdssubscriber.h" -#include "mxnextactiondatastart.h" -#include "mxstl/stlcompat.h" - -template -class MxStreamList : public list { -public: - MxBool PopFront(T& p_obj) - { - if (this->empty()) { - return FALSE; - } - - p_obj = this->front(); - this->pop_front(); - return TRUE; - } -}; - -// SIZE 0x0c -class MxStreamListMxDSAction : public MxStreamList { -public: - // FUNCTION: BETA10 0x10150e30 - MxDSAction* FindAndErase(MxDSAction* p_action) { return FindInternal(p_action, TRUE); } - - // FUNCTION: BETA10 0x10150fc0 - MxDSAction* Find(MxDSAction* p_action) { return FindInternal(p_action, FALSE); } - - // There chance this list actually holds MxDSStreamingListAction - // instead of MxDSAction. Until then, we use this helper. - MxBool PopFrontStreamingAction(MxDSStreamingAction*& p_obj) - { - if (empty()) { - return FALSE; - } - - p_obj = (MxDSStreamingAction*) front(); - pop_front(); - return TRUE; - } - -private: - MxDSAction* FindInternal(MxDSAction* p_action, MxBool p_delete); -}; - -// SIZE 0x0c -class MxStreamListMxNextActionDataStart : public MxStreamList { -public: - MxNextActionDataStart* Find(MxU32 p_id, MxS16 p_value); - MxNextActionDataStart* FindAndErase(MxU32 p_id, MxS16 p_value); -}; - -// SIZE 0x0c -class MxStreamListMxDSSubscriber : public MxStreamList { -public: - MxDSSubscriber* Find(MxDSObject* p_object); -}; - -// TEMPLATE: BETA10 0x10150950 -// MxStreamList::PopFront - -// TEMPLATE: BETA10 0x10150a70 -// MxStreamList::PopFront - -#endif // MXSTREAMLIST_H diff --git a/LEGO1/omni/include/mxstreamprovider.h b/LEGO1/omni/include/mxstreamprovider.h index 33cda8a1..f7ea1819 100644 --- a/LEGO1/omni/include/mxstreamprovider.h +++ b/LEGO1/omni/include/mxstreamprovider.h @@ -28,12 +28,21 @@ class MxStreamProvider : public MxCore { return !strcmp(p_name, MxStreamProvider::ClassName()) || MxCore::IsA(p_name); } - virtual MxResult SetResourceToGet(MxStreamController* p_resource); // vtable+0x14 - virtual MxU32 GetFileSize() = 0; // vtable+0x18 - virtual MxS32 GetStreamBuffersNum() = 0; // vtable+0x1c - virtual void VTable0x20(MxDSAction* p_action); // vtable+0x20 - virtual MxU32 GetLengthInDWords() = 0; // vtable+0x24 - virtual MxU32* GetBufferForDWords() = 0; // vtable+0x28 + // FUNCTION: LEGO1 0x100d07c0 + virtual MxResult SetResourceToGet(MxStreamController* p_pLookup) + { + m_pLookup = p_pLookup; + return SUCCESS; + } // vtable+0x14 + + virtual MxU32 GetFileSize() = 0; // vtable+0x18 + virtual MxS32 GetStreamBuffersNum() = 0; // vtable+0x1c + + // FUNCTION: LEGO1 0x100d07d0 + virtual void VTable0x20(MxDSAction* p_action) {} // vtable+0x20 + + virtual MxU32 GetLengthInDWords() = 0; // vtable+0x24 + virtual MxU32* GetBufferForDWords() = 0; // vtable+0x28 protected: MxStreamController* m_pLookup; // 0x08 diff --git a/LEGO1/omni/include/mxutilitylist.h b/LEGO1/omni/include/mxutilitylist.h new file mode 100644 index 00000000..92b7eba5 --- /dev/null +++ b/LEGO1/omni/include/mxutilitylist.h @@ -0,0 +1,23 @@ +#ifndef MXUTILITYLIST_H +#define MXUTILITYLIST_H + +#include "mxstl/stlcompat.h" + +// Probably should be defined somewhere else + +template +class MxUtilityList : public list { +public: + MxBool PopFront(T& p_obj) + { + if (this->empty()) { + return FALSE; + } + + p_obj = this->front(); + this->pop_front(); + return TRUE; + } +}; + +#endif // MXUTILITYLIST_H diff --git a/LEGO1/omni/src/action/mxdsobject.cpp b/LEGO1/omni/src/action/mxdsobject.cpp index 3bb189c7..6cea1ea0 100644 --- a/LEGO1/omni/src/action/mxdsobject.cpp +++ b/LEGO1/omni/src/action/mxdsobject.cpp @@ -17,7 +17,8 @@ #include #include -DECOMP_SIZE_ASSERT(MxDSObject, 0x2c); +DECOMP_SIZE_ASSERT(MxDSObject, 0x2c) +DECOMP_SIZE_ASSERT(MxDSObjectList, 0x0c) // FUNCTION: LEGO1 0x100bf6a0 // FUNCTION: BETA10 0x101478c0 @@ -172,6 +173,38 @@ void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) m_unk0x24 = p_unk0x24; } +// FUNCTION: LEGO1 0x100bfa80 +// FUNCTION: BETA10 0x10147e02 +MxDSObject* MxDSObjectList::FindInternal(MxDSObject* p_action, MxBool p_delete) +{ + // DECOMP ALPHA 0x1008b99d ? + + MxDSObject* found = NULL; + +#ifdef COMPAT_MODE + iterator it; + for (it = begin(); it != end(); it++) { +#else + for (iterator it = begin(); it != end(); it++) { +#endif + if (p_action->GetObjectId() == -1 || p_action->GetObjectId() == (*it)->GetObjectId()) { + if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 || + p_action->GetUnknown24() == (*it)->GetUnknown24()) { + found = *it; + if (p_action->GetUnknown24() != -3) { + break; + } + } + } + } + + if (p_delete && found != NULL) { + erase(it); + } + + return found; +} + // FUNCTION: LEGO1 0x100bfb30 // FUNCTION: BETA10 0x10147f35 MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index 883aa008..d7e79bb0 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -340,7 +340,7 @@ MxLong MxOmni::HandleEndAction(MxParam& p_param) MxStreamController* controller = Streamer()->GetOpenStream(action->GetAtomId().GetInternal()); if (controller != NULL) { - action = controller->GetUnk0x54().Find(action); + action = (MxDSAction*) controller->GetUnk0x54().Find(action); if (action) { if (ActionSourceEquals(action, "LegoLoopingAnimPresenter") == FALSE) { delete controller->GetUnk0x54().FindAndErase(action); @@ -399,9 +399,9 @@ void MxOmni::SetSound3D(MxBool p_use3dSound) MxBool MxOmni::DoesEntityExist(MxDSAction& p_dsAction) { if (m_streamer->FUN_100b9b30(p_dsAction)) { - MxNotificationPtrList* queue = m_notificationManager->GetQueue(); + MxNotificationPtrList* notifications = m_notificationManager->GetQueue(); - if (!queue || queue->size() == 0) { + if (!notifications || notifications->size() == 0) { return TRUE; } } diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index 2e740764..c1341877 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -35,9 +35,9 @@ MxDiskStreamController::~MxDiskStreamController() #endif } - MxDSAction* action; - while (m_unk0x3c.PopFront(action)) { - delete action; + MxDSObject* object; + while (m_unk0x3c.PopFront(object)) { + delete object; } if (m_provider) { @@ -47,12 +47,12 @@ MxDiskStreamController::~MxDiskStreamController() FUN_100c8720(); - while (m_list0x80.PopFront(action)) { - FUN_100c7cb0((MxDSStreamingAction*) action); + while (m_list0x80.PopFront(object)) { + FUN_100c7cb0((MxDSStreamingAction*) object); } - while (m_list0x64.PopFront(action)) { - FUN_100c7cb0((MxDSStreamingAction*) action); + while (m_list0x64.PopFront(object)) { + FUN_100c7cb0((MxDSStreamingAction*) object); } while (!m_list0x74.empty()) { @@ -162,7 +162,7 @@ void MxDiskStreamController::FUN_100c7980() MxDSStreamingAction* MxDiskStreamController::VTable0x28() { AUTOLOCK(m_criticalSection); - MxDSAction* oldAction; + MxDSObject* oldAction; MxDSStreamingAction* result = NULL; MxU32 filesize = m_provider->GetFileSize(); @@ -252,10 +252,9 @@ MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0() { AUTOLOCK(m_criticalSection); - for (MxStreamListMxNextActionDataStart::iterator it = m_nextActionList.begin(); it != m_nextActionList.end(); - it++) { + for (MxNextActionDataStartList::iterator it = m_nextActionList.begin(); it != m_nextActionList.end(); it++) { MxNextActionDataStart* data = *it; - for (MxStreamListMxDSAction::iterator it2 = m_list0x64.begin(); it2 != m_list0x64.end(); it2++) { + for (MxDSObjectList::iterator it2 = m_list0x64.begin(); it2 != m_list0x64.end(); it2++) { MxDSStreamingAction* streamingAction = (MxDSStreamingAction*) *it2; if (streamingAction->GetObjectId() == data->GetObjectId() && streamingAction->GetUnknown24() == data->GetUnknown24() && @@ -320,7 +319,7 @@ void MxDiskStreamController::FUN_100c8120(MxDSAction* p_action) } while (TRUE) { - MxDSAction* found = m_unk0x54.FindAndErase(p_action); + MxDSObject* found = m_unk0x54.FindAndErase(p_action); if (!found) { break; } diff --git a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp index 1f7dba15..eb6cbc54 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp @@ -38,15 +38,15 @@ MxResult MxDiskStreamProviderThread::StartWithTarget(MxDiskStreamProvider* p_tar // FUNCTION: LEGO1 0x100d0f70 MxDiskStreamProvider::MxDiskStreamProvider() { - this->m_pFile = NULL; - this->m_remainingWork = FALSE; - this->m_unk0x35 = FALSE; + m_pFile = NULL; + m_remainingWork = FALSE; + m_unk0x35 = FALSE; } // FUNCTION: LEGO1 0x100d1240 MxDiskStreamProvider::~MxDiskStreamProvider() { - MxDSStreamingAction* action; + MxDSObject* action; m_unk0x35 = FALSE; do { @@ -54,18 +54,18 @@ MxDiskStreamProvider::~MxDiskStreamProvider() { AUTOLOCK(m_criticalSection); - m_list.PopFrontStreamingAction(action); + m_list.PopFront(action); } if (!action) { break; } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { + if (((MxDSStreamingAction*) action)->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; } - ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); + ((MxDiskStreamController*) m_pLookup)->FUN_100c8670((MxDSStreamingAction*) action); } while (action); if (m_remainingWork) { @@ -116,7 +116,7 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource) // FUNCTION: LEGO1 0x100d15e0 void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) { - MxDSStreamingAction* action; + MxDSObject* action; if (p_action->GetObjectId() == -1) { m_unk0x35 = FALSE; @@ -126,18 +126,18 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); - m_list.PopFrontStreamingAction(action); + m_list.PopFront(action); } if (!action) { return; } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { + if (((MxDSStreamingAction*) action)->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; } - ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); + ((MxDiskStreamController*) m_pLookup)->FUN_100c8670((MxDSStreamingAction*) action); } while (action); } else { @@ -151,11 +151,11 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) return; } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { + if (((MxDSStreamingAction*) action)->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; } - ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); + ((MxDiskStreamController*) m_pLookup)->FUN_100c8670((MxDSStreamingAction*) action); } while (action); } } @@ -213,14 +213,14 @@ MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action) void MxDiskStreamProvider::PerformWork() { MxDiskStreamController* controller = (MxDiskStreamController*) m_pLookup; - MxDSStreamingAction* streamingAction = NULL; + MxDSObject* streamingAction = NULL; { AUTOLOCK(m_criticalSection); if (!m_list.empty()) { - streamingAction = (MxDSStreamingAction*) m_list.front(); + streamingAction = m_list.front(); - if (streamingAction && !FUN_100d1af0(streamingAction)) { + if (streamingAction && !FUN_100d1af0((MxDSStreamingAction*) streamingAction)) { m_thread.Sleep(500); m_busySemaphore.Release(1); return; @@ -233,33 +233,33 @@ void MxDiskStreamProvider::PerformWork() { AUTOLOCK(m_criticalSection); - if (!m_list.PopFrontStreamingAction(streamingAction)) { + if (!m_list.PopFront(streamingAction)) { goto done; } } - if (streamingAction->GetUnknowna0()->GetWriteOffset() < 0x20000) { + if (((MxDSStreamingAction*) streamingAction)->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; } - buffer = streamingAction->GetUnknowna0(); + buffer = ((MxDSStreamingAction*) streamingAction)->GetUnknowna0(); - if (m_pFile->GetPosition() == streamingAction->GetBufferOffset() || - m_pFile->Seek(streamingAction->GetBufferOffset(), SEEK_SET) == 0) { + if (m_pFile->GetPosition() == ((MxDSStreamingAction*) streamingAction)->GetBufferOffset() || + m_pFile->Seek(((MxDSStreamingAction*) streamingAction)->GetBufferOffset(), SEEK_SET) == 0) { buffer->SetUnknown14(m_pFile->GetPosition()); if (m_pFile->ReadToBuffer(buffer) == SUCCESS) { buffer->SetUnknown1c(m_pFile->GetPosition()); - if (streamingAction->GetUnknown9c() > 0) { - FUN_100d1b20(streamingAction); + if (((MxDSStreamingAction*) streamingAction)->GetUnknown9c() > 0) { + FUN_100d1b20(((MxDSStreamingAction*) streamingAction)); } else { if (m_pLookup == NULL || !((MxDiskStreamController*) m_pLookup)->GetUnk0xc4()) { - controller->FUN_100c8670(streamingAction); + controller->FUN_100c8670(((MxDSStreamingAction*) streamingAction)); } else { - controller->FUN_100c7f40(streamingAction); + controller->FUN_100c7f40(((MxDSStreamingAction*) streamingAction)); } } @@ -269,7 +269,7 @@ void MxDiskStreamProvider::PerformWork() done: if (streamingAction) { - controller->FUN_100c8670(streamingAction); + controller->FUN_100c8670(((MxDSStreamingAction*) streamingAction)); } m_thread.Sleep(0); diff --git a/LEGO1/omni/src/stream/mxdssubscriber.cpp b/LEGO1/omni/src/stream/mxdssubscriber.cpp index 8900ff69..36051667 100644 --- a/LEGO1/omni/src/stream/mxdssubscriber.cpp +++ b/LEGO1/omni/src/stream/mxdssubscriber.cpp @@ -2,7 +2,8 @@ #include "mxstreamcontroller.h" -DECOMP_SIZE_ASSERT(MxDSSubscriber, 0x4c); +DECOMP_SIZE_ASSERT(MxDSSubscriber, 0x4c) +DECOMP_SIZE_ASSERT(MxDSSubscriberList, 0x0c) // FUNCTION: LEGO1 0x100b7bb0 MxDSSubscriber::MxDSSubscriber() @@ -135,3 +136,18 @@ void MxDSSubscriber::FreeDataChunk(MxStreamChunk* p_chunk) } } } + +// FUNCTION: LEGO1 0x100b8450 +// FUNCTION: BETA10 0x10134c1d +MxDSSubscriber* MxDSSubscriberList::Find(MxDSObject* p_object) +{ + for (iterator it = begin(); it != end(); it++) { + if (p_object->GetObjectId() == -1 || p_object->GetObjectId() == (*it)->GetObjectId()) { + if (p_object->GetUnknown24() == -2 || p_object->GetUnknown24() == (*it)->GetUnknown48()) { + return *it; + } + } + } + + return NULL; +} diff --git a/LEGO1/omni/src/stream/mxramstreamcontroller.cpp b/LEGO1/omni/src/stream/mxramstreamcontroller.cpp index 46d11196..c856d695 100644 --- a/LEGO1/omni/src/stream/mxramstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxramstreamcontroller.cpp @@ -43,7 +43,7 @@ MxResult MxRAMStreamController::VTable0x20(MxDSAction* p_action) if (p_action->GetUnknown24() == -1) { p_action->SetUnknown24(-3); - MxDSAction* action = m_unk0x54.Find(p_action); + MxDSObject* action = m_unk0x54.Find(p_action); if (action != NULL) { unk0x24 = action->GetUnknown24() + 1; } diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index d655c16f..2b062504 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -6,7 +6,8 @@ #include "mxomni.h" #include "mxstreamcontroller.h" -DECOMP_SIZE_ASSERT(MxRAMStreamProvider, 0x24); +DECOMP_SIZE_ASSERT(MxStreamProvider, 0x10) +DECOMP_SIZE_ASSERT(MxRAMStreamProvider, 0x24) // FUNCTION: LEGO1 0x100d0730 MxRAMStreamProvider::MxRAMStreamProvider() diff --git a/LEGO1/omni/src/stream/mxstreamchunk.cpp b/LEGO1/omni/src/stream/mxstreamchunk.cpp index 4cf4fe4b..24c13445 100644 --- a/LEGO1/omni/src/stream/mxstreamchunk.cpp +++ b/LEGO1/omni/src/stream/mxstreamchunk.cpp @@ -1,7 +1,7 @@ #include "mxstreamchunk.h" #include "mxdsbuffer.h" -#include "mxstreamlist.h" +#include "mxdssubscriber.h" #include "mxutilities.h" // FUNCTION: LEGO1 0x100c2fe0 @@ -58,9 +58,9 @@ MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData) // FUNCTION: LEGO1 0x100c30e0 // FUNCTION: BETA10 0x10151517 -MxResult MxStreamChunk::SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, MxBool p_append, MxS16 p_obj24val) +MxResult MxStreamChunk::SendChunk(MxDSSubscriberList& p_subscriberList, MxBool p_append, MxS16 p_obj24val) { - for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) { + for (MxDSSubscriberList::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) { if ((*it)->GetObjectId() == m_objectId && (*it)->GetUnknown48() == p_obj24val) { if (m_flags & DS_CHUNK_END_OF_STREAM && m_buffer) { m_buffer->ReleaseRef(this); diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index 35b1315c..af0dd84b 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -14,24 +14,7 @@ DECOMP_SIZE_ASSERT(MxStreamController, 0x64) DECOMP_SIZE_ASSERT(MxNextActionDataStart, 0x14) - -// FUNCTION: LEGO1 0x100b9400 -MxResult MxStreamController::VTable0x18(undefined4, undefined4) -{ - return FAILURE; -} - -// FUNCTION: LEGO1 0x100b9410 -MxResult MxStreamController::VTable0x1c(undefined4, undefined4) -{ - return FAILURE; -} - -// FUNCTION: LEGO1 0x100b9420 -MxDSStreamingAction* MxStreamController::VTable0x28() -{ - return NULL; -} +DECOMP_SIZE_ASSERT(MxNextActionDataStartList, 0x0c) // FUNCTION: LEGO1 0x100c0b90 MxStreamController::MxStreamController() @@ -53,7 +36,7 @@ MxStreamController::~MxStreamController() delete subscriber; } - MxDSAction* action; + MxDSObject* action; while (m_unk0x3c.PopFront(action)) { delete action; } @@ -135,7 +118,7 @@ MxResult MxStreamController::VTable0x24(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); VTable0x30(p_action); - m_action0x60 = m_unk0x54.FindAndErase(p_action); + m_action0x60 = (MxDSAction*) m_unk0x54.FindAndErase(p_action); if (m_action0x60 == NULL) { return FAILURE; } @@ -166,8 +149,8 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) MxS16 newUnknown24 = -1; // These loops might be a template function in the list classes - for (MxStreamListMxDSAction::iterator it = m_unk0x54.begin(); it != m_unk0x54.end(); it++) { - MxDSAction* action = *it; + for (MxDSObjectList::iterator it = m_unk0x54.begin(); it != m_unk0x54.end(); it++) { + MxDSObject* action = *it; if (action->GetObjectId() == p_action->GetObjectId()) { newUnknown24 = Max(newUnknown24, action->GetUnknown24()); @@ -175,8 +158,8 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) } if (newUnknown24 == -1) { - for (MxStreamListMxDSAction::iterator it = m_unk0x3c.begin(); it != m_unk0x3c.end(); it++) { - MxDSAction* action = *it; + for (MxDSObjectList::iterator it = m_unk0x3c.begin(); it != m_unk0x3c.end(); it++) { + MxDSObject* action = *it; if (action->GetObjectId() == p_action->GetObjectId()) { newUnknown24 = Max(newUnknown24, action->GetUnknown24()); @@ -184,8 +167,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) } if (newUnknown24 == -1) { - for (MxStreamListMxDSSubscriber::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); - it++) { + for (MxDSSubscriberList::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); it++) { MxDSSubscriber* subscriber = *it; if (subscriber->GetObjectId() == p_action->GetObjectId()) { @@ -235,7 +217,7 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); MxResult result = FAILURE; - MxDSAction* action = m_unk0x3c.FindAndErase(p_action); + MxDSObject* action = m_unk0x3c.FindAndErase(p_action); if (action != NULL) { MxNextActionDataStart* data = m_nextActionList.FindAndErase(action->GetObjectId(), action->GetUnknown24()); delete action; @@ -266,7 +248,7 @@ MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) AUTOLOCK(m_criticalSection); MxPresenter* result = NULL; if (p_action.GetObjectId() != -1) { - MxDSAction* action = m_unk0x3c.Find(&p_action); + MxDSObject* action = m_unk0x3c.Find(&p_action); if (action != NULL) { result = action->GetUnknown28(); } @@ -344,3 +326,33 @@ MxBool MxStreamController::IsStoped(MxDSObject* p_obj) return TRUE; } + +// FUNCTION: LEGO1 0x100c21e0 +// FUNCTION: BETA10 0x1014f4e6 +MxNextActionDataStart* MxNextActionDataStartList::Find(MxU32 p_id, MxS16 p_value) +{ + for (iterator it = begin(); it != end(); it++) { + if (p_id == (*it)->GetObjectId() && p_value == (*it)->GetUnknown24()) { + return *it; + } + } + + return NULL; +} + +// FUNCTION: LEGO1 0x100c2240 +// FUNCTION: BETA10 0x1014f58c +MxNextActionDataStart* MxNextActionDataStartList::FindAndErase(MxU32 p_id, MxS16 p_value) +{ + MxNextActionDataStart* match = NULL; + + for (iterator it = begin(); it != end(); it++) { + if (p_id == (*it)->GetObjectId() && (p_value == -2 || p_value == (*it)->GetUnknown24())) { + match = *it; + erase(it); + break; + } + } + + return match; +} diff --git a/LEGO1/omni/src/stream/mxstreamer.cpp b/LEGO1/omni/src/stream/mxstreamer.cpp index c3a64cf9..bb5f1cb5 100644 --- a/LEGO1/omni/src/stream/mxstreamer.cpp +++ b/LEGO1/omni/src/stream/mxstreamer.cpp @@ -2,6 +2,7 @@ #include "mxdebug.h" #include "mxdiskstreamcontroller.h" +#include "mxdsaction.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxramstreamcontroller.h" diff --git a/LEGO1/omni/src/stream/mxstreamlist.cpp b/LEGO1/omni/src/stream/mxstreamlist.cpp deleted file mode 100644 index 37e59463..00000000 --- a/LEGO1/omni/src/stream/mxstreamlist.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "mxstreamlist.h" - -// Wrappers around STL list that are used by the MxStream* classes. -DECOMP_SIZE_ASSERT(MxStreamListMxDSAction, 0x0c); -DECOMP_SIZE_ASSERT(MxStreamListMxNextActionDataStart, 0x0c); -DECOMP_SIZE_ASSERT(MxStreamListMxDSSubscriber, 0x0c); - -// FUNCTION: LEGO1 0x100b8450 -// FUNCTION: BETA10 0x10134c1d -MxDSSubscriber* MxStreamListMxDSSubscriber::Find(MxDSObject* p_object) -{ - for (iterator it = begin(); it != end(); it++) { - if (p_object->GetObjectId() == -1 || p_object->GetObjectId() == (*it)->GetObjectId()) { - if (p_object->GetUnknown24() == -2 || p_object->GetUnknown24() == (*it)->GetUnknown48()) { - return *it; - } - } - } - - return NULL; -} - -// FUNCTION: LEGO1 0x100bfa80 -// FUNCTION: BETA10 0x10147e02 -MxDSAction* MxStreamListMxDSAction::FindInternal(MxDSAction* p_action, MxBool p_delete) -{ - // DECOMP ALPHA 0x1008b99d ? - - MxDSAction* found = NULL; - -#ifdef COMPAT_MODE - iterator it; - for (it = begin(); it != end(); it++) { -#else - for (iterator it = begin(); it != end(); it++) { -#endif - if (p_action->GetObjectId() == -1 || p_action->GetObjectId() == (*it)->GetObjectId()) { - if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 || - p_action->GetUnknown24() == (*it)->GetUnknown24()) { - found = *it; - if (p_action->GetUnknown24() != -3) { - break; - } - } - } - } - - if (p_delete && found != NULL) { - erase(it); - } - - return found; -} - -// FUNCTION: LEGO1 0x100c21e0 -// FUNCTION: BETA10 0x1014f4e6 -MxNextActionDataStart* MxStreamListMxNextActionDataStart::Find(MxU32 p_id, MxS16 p_value) -{ - for (iterator it = begin(); it != end(); it++) { - if (p_id == (*it)->GetObjectId() && p_value == (*it)->GetUnknown24()) { - return *it; - } - } - - return NULL; -} - -// FUNCTION: LEGO1 0x100c2240 -// FUNCTION: BETA10 0x1014f58c -MxNextActionDataStart* MxStreamListMxNextActionDataStart::FindAndErase(MxU32 p_id, MxS16 p_value) -{ - MxNextActionDataStart* match = NULL; - - for (iterator it = begin(); it != end(); it++) { - if (p_id == (*it)->GetObjectId() && (p_value == -2 || p_value == (*it)->GetUnknown24())) { - match = *it; - erase(it); - break; - } - } - - return match; -} diff --git a/LEGO1/omni/src/stream/mxstreamprovider.cpp b/LEGO1/omni/src/stream/mxstreamprovider.cpp deleted file mode 100644 index 740b2c65..00000000 --- a/LEGO1/omni/src/stream/mxstreamprovider.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "mxstreamprovider.h" - -#include "decomp.h" - -DECOMP_SIZE_ASSERT(MxStreamProvider, 0x10); - -// FUNCTION: LEGO1 0x100d07c0 -MxResult MxStreamProvider::SetResourceToGet(MxStreamController* p_resource) -{ - m_pLookup = p_resource; - return SUCCESS; -} - -// FUNCTION: LEGO1 0x100d07d0 -void MxStreamProvider::VTable0x20(MxDSAction* p_action) -{ -} diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index 1ac6bd1e..6e38c43d 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -72,15 +72,15 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) m_currentFrame++; VTable0x88(); - MxRectList list(TRUE); - MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, &list); + MxRectList rects(TRUE); + MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, &rects); if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) { RealizePalette(); } MxRect32 invalidateRect; - MxRectListCursor cursor(&list); + MxRectListCursor cursor(&rects); MxRect32* rect; while (cursor.Next(rect)) { From 1b99d7554353f6570c551a927d007fc4a9a3f7c5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 23 Dec 2024 09:25:23 -0700 Subject: [PATCH 16/16] Refactor `geom` library into `geom` and `shape` (#1263) * Refactor `geom` library into `geom` and `util` * Rename to `shape` --- CMakeLists.txt | 34 +++++++++++++++---- LEGO1/lego/sources/roi/legolod.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.cpp | 4 +-- .../lego/sources/{geom => shape}/legobox.cpp | 1 + LEGO1/lego/sources/{geom => shape}/legobox.h | 0 .../sources/{misc => shape}/legocolor.cpp | 2 +- .../lego/sources/{misc => shape}/legocolor.h | 2 +- .../lego/sources/{geom => shape}/legomesh.cpp | 0 LEGO1/lego/sources/{geom => shape}/legomesh.h | 2 +- .../sources/{geom => shape}/legosphere.cpp | 0 .../lego/sources/{geom => shape}/legosphere.h | 0 .../sources/{geom => shape}/legovertex.cpp | 0 .../lego/sources/{geom => shape}/legovertex.h | 0 13 files changed, 35 insertions(+), 12 deletions(-) rename LEGO1/lego/sources/{geom => shape}/legobox.cpp (92%) rename LEGO1/lego/sources/{geom => shape}/legobox.h (100%) rename LEGO1/lego/sources/{misc => shape}/legocolor.cpp (94%) rename LEGO1/lego/sources/{misc => shape}/legocolor.h (95%) rename LEGO1/lego/sources/{geom => shape}/legomesh.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legomesh.h (98%) rename LEGO1/lego/sources/{geom => shape}/legosphere.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legosphere.h (100%) rename LEGO1/lego/sources/{geom => shape}/legovertex.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legovertex.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6415d39d..fddedcab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,12 +153,8 @@ function(add_lego_libraries NAME) target_link_libraries(roi${ARG_SUFFIX} PRIVATE viewmanager${ARG_SUFFIX} Vec::Vec) add_library(geom${ARG_SUFFIX} STATIC - LEGO1/lego/sources/geom/legobox.cpp LEGO1/lego/sources/geom/legoedge.cpp - LEGO1/lego/sources/geom/legomesh.cpp - LEGO1/lego/sources/geom/legosphere.cpp LEGO1/lego/sources/geom/legounkown100db7f4.cpp - LEGO1/lego/sources/geom/legovertex.cpp LEGO1/lego/sources/geom/legoweedge.cpp LEGO1/lego/sources/geom/legowegedge.cpp ) @@ -167,6 +163,18 @@ function(add_lego_libraries NAME) target_include_directories(geom${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") target_link_libraries(geom${ARG_SUFFIX} PRIVATE) + add_library(shape${ARG_SUFFIX} STATIC + LEGO1/lego/sources/shape/legocolor.cpp + LEGO1/lego/sources/shape/legobox.cpp + LEGO1/lego/sources/shape/legomesh.cpp + LEGO1/lego/sources/shape/legosphere.cpp + LEGO1/lego/sources/shape/legovertex.cpp + ) + list(APPEND list_targets shape${ARG_SUFFIX}) + set_property(TARGET shape${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "shape$<$:d>${ARG_SUFFIX}") + target_include_directories(shape${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") + target_link_libraries(shape${ARG_SUFFIX} PRIVATE) + add_library(anim${ARG_SUFFIX} STATIC LEGO1/lego/sources/anim/legoanim.cpp ) @@ -175,7 +183,6 @@ function(add_lego_libraries NAME) target_include_directories(anim${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") add_library(misc${ARG_SUFFIX} STATIC - LEGO1/lego/sources/misc/legocolor.cpp LEGO1/lego/sources/misc/legocontainer.cpp LEGO1/lego/sources/misc/legoimage.cpp LEGO1/lego/sources/misc/legostorage.cpp @@ -422,7 +429,22 @@ function(add_lego_libraries NAME) target_include_directories(${NAME} PUBLIC "${PROJECT_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions") # Link libraries - target_link_libraries(${NAME} PRIVATE tglrl${ARG_SUFFIX} viewmanager${ARG_SUFFIX} realtime${ARG_SUFFIX} mxdirectx${ARG_SUFFIX} roi${ARG_SUFFIX} geom${ARG_SUFFIX} anim${ARG_SUFFIX} Vec::Vec dinput dxguid misc${ARG_SUFFIX} 3dmanager${ARG_SUFFIX} omni${ARG_SUFFIX}) + target_link_libraries(${NAME} PRIVATE + tglrl${ARG_SUFFIX} + viewmanager${ARG_SUFFIX} + realtime${ARG_SUFFIX} + mxdirectx${ARG_SUFFIX} + roi${ARG_SUFFIX} + geom${ARG_SUFFIX} + anim${ARG_SUFFIX} + Vec::Vec + dinput + dxguid + misc${ARG_SUFFIX} + 3dmanager${ARG_SUFFIX} + omni${ARG_SUFFIX} + shape${ARG_SUFFIX} + ) foreach(tgt IN LISTS list_targets) target_link_libraries(${tgt} PRIVATE ${ARG_LINK_LIBRARIES}) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 45f0f864..7db2a0a9 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -1,10 +1,10 @@ #include "legolod.h" -#include "geom/legomesh.h" #include "legoroi.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" +#include "shape/legomesh.h" #include "tgl/d3drm/impl.h" DECOMP_SIZE_ASSERT(LODObject, 0x04) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index f9a8549b..50a26113 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -1,12 +1,12 @@ #include "legoroi.h" #include "anim/legoanim.h" -#include "geom/legobox.h" -#include "geom/legosphere.h" #include "legolod.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "realtime/realtime.h" +#include "shape/legobox.h" +#include "shape/legosphere.h" #include #include diff --git a/LEGO1/lego/sources/geom/legobox.cpp b/LEGO1/lego/sources/shape/legobox.cpp similarity index 92% rename from LEGO1/lego/sources/geom/legobox.cpp rename to LEGO1/lego/sources/shape/legobox.cpp index 0a5f2bdb..0f7654d6 100644 --- a/LEGO1/lego/sources/geom/legobox.cpp +++ b/LEGO1/lego/sources/shape/legobox.cpp @@ -6,6 +6,7 @@ DECOMP_SIZE_ASSERT(LegoBox, 0x18) // FUNCTION: LEGO1 0x100d3740 +// FUNCTION: BETA10 0x1018f83c LegoResult LegoBox::Read(LegoStorage* p_storage) { LegoResult result; diff --git a/LEGO1/lego/sources/geom/legobox.h b/LEGO1/lego/sources/shape/legobox.h similarity index 100% rename from LEGO1/lego/sources/geom/legobox.h rename to LEGO1/lego/sources/shape/legobox.h diff --git a/LEGO1/lego/sources/misc/legocolor.cpp b/LEGO1/lego/sources/shape/legocolor.cpp similarity index 94% rename from LEGO1/lego/sources/misc/legocolor.cpp rename to LEGO1/lego/sources/shape/legocolor.cpp index 1dc1dce4..146e8818 100644 --- a/LEGO1/lego/sources/misc/legocolor.cpp +++ b/LEGO1/lego/sources/shape/legocolor.cpp @@ -1,7 +1,7 @@ #include "legocolor.h" #include "decomp.h" -#include "legostorage.h" +#include "misc/legostorage.h" DECOMP_SIZE_ASSERT(LegoColor, 0x03) diff --git a/LEGO1/lego/sources/misc/legocolor.h b/LEGO1/lego/sources/shape/legocolor.h similarity index 95% rename from LEGO1/lego/sources/misc/legocolor.h rename to LEGO1/lego/sources/shape/legocolor.h index 027362ce..ac0f2ec0 100644 --- a/LEGO1/lego/sources/misc/legocolor.h +++ b/LEGO1/lego/sources/shape/legocolor.h @@ -1,7 +1,7 @@ #ifndef __LEGOCOLOR_H #define __LEGOCOLOR_H -#include "legotypes.h" +#include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legomesh.cpp b/LEGO1/lego/sources/shape/legomesh.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legomesh.cpp rename to LEGO1/lego/sources/shape/legomesh.cpp diff --git a/LEGO1/lego/sources/geom/legomesh.h b/LEGO1/lego/sources/shape/legomesh.h similarity index 98% rename from LEGO1/lego/sources/geom/legomesh.h rename to LEGO1/lego/sources/shape/legomesh.h index 1832ae7b..da1b1a27 100644 --- a/LEGO1/lego/sources/geom/legomesh.h +++ b/LEGO1/lego/sources/shape/legomesh.h @@ -2,7 +2,7 @@ #define __LEGOMESH_H #include "decomp.h" -#include "misc/legocolor.h" +#include "legocolor.h" #include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legosphere.cpp b/LEGO1/lego/sources/shape/legosphere.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.cpp rename to LEGO1/lego/sources/shape/legosphere.cpp diff --git a/LEGO1/lego/sources/geom/legosphere.h b/LEGO1/lego/sources/shape/legosphere.h similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.h rename to LEGO1/lego/sources/shape/legosphere.h diff --git a/LEGO1/lego/sources/geom/legovertex.cpp b/LEGO1/lego/sources/shape/legovertex.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.cpp rename to LEGO1/lego/sources/shape/legovertex.cpp diff --git a/LEGO1/lego/sources/geom/legovertex.h b/LEGO1/lego/sources/shape/legovertex.h similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.h rename to LEGO1/lego/sources/shape/legovertex.h