diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..189ddf5a --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,6 @@ +Checks: > + -*, + readability-braces-around-statements, + modernize-use-override +WarningsAsErrors: '-*,readability-braces-around-statements,modernize-use-override' +HeaderFilterRegex: ".*" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3f81642..9a21e56e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,18 +14,20 @@ jobs: matrix: toolchain: - { name: 'MSVC', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true } - - { name: 'msys2 mingw32', shell: 'msys2 {0}', setup-msys2: true } + - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true } + - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, no-dx5-libs: true } steps: - name: Set up MSYS2 - if: matrix.toolchain.setup-msys2 + if: ${{ !!matrix.toolchain.msystem }} uses: msys2/setup-msys2@v2 with: - msystem: mingw32 + msystem: ${{ matrix.toolchain.msystem }} install: >- - mingw-w64-i686-cc - mingw-w64-i686-cmake - mingw-w64-i686-ninja + ${{ matrix.toolchain.msys-env }}-cc + ${{ matrix.toolchain.msys-env }}-cmake + ${{ matrix.toolchain.msys-env }}-ninja + ${{ matrix.toolchain.msys-env }}-clang-tools-extra - name: Setup cmake if: matrix.toolchain.setup-cmake @@ -45,8 +47,13 @@ jobs: - name: Build run: | - cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -GNinja -Werror=dev - cmake --build build + cmake -S . -B build -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DISLE_USE_DX5_LIBS=${{ !matrix.toolchain.no-dx5-libs }} \ + -DENABLE_CLANG_TIDY=${{ !!matrix.toolchain.clang-tidy }} \ + -DISLE_WERROR=${{ !!matrix.toolchain.werror }} \ + -Werror=dev + cmake --build build -- -k0 build: name: 'MSVC 4.20' diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 10e85e0d..4cfb5d9e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -14,10 +14,9 @@ jobs: run: | find LEGO1 ISLE -iname '*.h' -o -iname '*.cpp' | xargs \ pipx run "clang-format>=17,<18" \ - --Werror \ - --dry-run \ --style=file \ -i + git diff --exit-code python-format: name: 'Python' diff --git a/CMakeLists.txt b/CMakeLists.txt index eeee76d5..53963915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,18 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) project(isle CXX) +include(CheckCXXSourceCompiles) +include(CMakeDependentOption) +include(CMakePushCheckState) + +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) +option(ENABLE_CLANG_TIDY "Enable clang-tidy") +if (ENABLE_CLANG_TIDY) + find_program(CLANG_TIDY_BIN NAMES "clang-tidy") + set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_BIN}") + set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_BIN}") +endif() + math(EXPR bits "8 * ${CMAKE_SIZEOF_VOID_P}") message(STATUS "Building ${bits}-bit LEGO Island") if (NOT bits EQUAL 32) @@ -21,15 +33,44 @@ macro(register_lego1_target __target) list(APPEND lego1_targets ${__target}) endmacro() +function(add_cxx_warning WARNING) + if(ISLE_WERROR) + set(compiler_option "-Werror=${WARNING}") + else() + set(compiler_option "-W${WARNING}") + endif() + string(MAKE_C_IDENTIFIER "COMPILER_SUPPORTS${compiler_option}" varname) + + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS "${compiler_option} ") + if(MSVC) + string(APPEND CMAKE_REQUIRED_FLAGS "/WX") + else() + string(APPEND CMAKE_REQUIRED_FLAGS "-Werror") + endif() + check_cxx_source_compiles("int main() { return 0; }" ${varname}) + cmake_pop_check_state() + + if(${varname}) + add_compile_options(${compiler_option}) + endif() +endfunction() + message(STATUS "MSVC for decompilation: ${MSVC_FOR_DECOMP}") +option(ISLE_WERROR "Treat warnings as errors" OFF) option(ISLE_BUILD_APP "Build ISLE.EXE application" ON) option(ISLE_USE_SMARTHEAP "Build with SmartHeap" ${MSVC_FOR_DECOMP}) option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON) +cmake_dependent_option(ISLE_USE_DX5_LIBS "Build with internal DirectX 5 SDK Libraries" ON ISLE_USE_DX5 OFF) + +add_cxx_warning(parentheses) add_library(DirectX5::DirectX5 INTERFACE IMPORTED) target_include_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/inc") -target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/lib") +if(ISLE_USE_DX5_LIBS) + target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/lib") +endif() add_library(Smacker::Smacker STATIC IMPORTED) set_property(TARGET Smacker::Smacker PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/3rdparty/smacker/smack.lib") @@ -110,7 +151,7 @@ add_library(misc STATIC ) register_lego1_target(misc) set_property(TARGET misc PROPERTY ARCHIVE_OUTPUT_NAME "misc$<$:d>") -target_include_directories(misc PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/util") +target_include_directories(misc PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/realtime" "${CMAKE_SOURCE_DIR}/util") target_link_libraries(misc PRIVATE) add_library(3dmanager STATIC @@ -208,7 +249,7 @@ add_library(omni STATIC ) register_lego1_target(omni) set_property(TARGET omni PROPERTY ARCHIVE_OUTPUT_NAME "omni$<$:d>") -target_include_directories(omni PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") +target_include_directories(omni PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_link_libraries(omni PRIVATE dsound winmm FLIC::FLIC Smacker::Smacker) add_library(lego1 SHARED @@ -352,6 +393,7 @@ target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1") target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1/omni/include") target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources") target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include") +target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1/realtime") # Link libraries target_link_libraries(lego1 PRIVATE tglrl viewmanager realtime mxdirectx roi FLIC::FLIC Vec::Vec dinput dxguid misc 3dmanager omni) @@ -377,6 +419,8 @@ if (ISLE_BUILD_APP) ISLE/define.cpp ) + target_compile_definitions(isle PRIVATE ISLE_APP) + # Use internal DirectX 5 if required target_link_libraries(isle PRIVATE $<$:DirectX5::DirectX5>) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d2c6894..23e25faf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,10 @@ # Contributing -## Learning Decompilation +## Important Note -Generally, decompilation is a fairly advanced skill. If you aren't already familiar with it, it will likely take you months, or even years, to learn the skills necessary to do it (depending on your current proficiency with C/C++ and x86 assembly). If you're still interested, [part 1 of the decompilation vlog](https://www.youtube.com/watch?v=MToTEqoVv3I) covers the overall process and should give you a starting point that you can dive in from. +While we're thrilled that there is so much interest in reverse engineering LEGO Island and are happy to accept contributions from anyone who would like to help progress us further to our goal of a complete codebase, proposed changes to this repository must adhere to a certain degree of engineering quality. While the established contributors here are more than happy to provide code reviews and constructive criticism, it is not their job to teach potential contributors C++ or decompilation fundamentals. As a project that is largely an artifact of the free time of its contributors, the more of that (often scarce) resource that can be dedicated to efficient work, the faster the decompilation will progress. Unfortunately, this results in well-intentioned but poorly constructed contributions actually hurting progress in the long-term. While we are greatly appreciative of the sentiment, if you aren't very confident in your decompilation abilities, it is generally in the project's best interest that you return when you have a better grasp over the process. + +Generally, decompilation is a fairly advanced skill. Depending on your current proficiency with C/C++ and x86 assembly, it could take you months or even years to learn the skills necessary to do it adequately. If you're still interested in learning, [part 1 of the decompilation vlog](https://www.youtube.com/watch?v=MToTEqoVv3I) covers the overall process and should give you a starting point that you can dive in from. Once again, please make yourself familiar with this process before attempting to contribute code to this project. ## Ghidra Server @@ -15,7 +17,7 @@ To access the Ghidra repository, use the following details: ## General Guidelines -If you have contributions, feel free to create a pull request! Someone will review and merge it (or provide feedback) as soon as possible. +If you feel fit to contribute, feel free to create a pull request! Someone will review and merge it (or provide feedback) as soon as possible. Please keep your pull requests small and understandable; you may be able to shoot ahead and make a lot of progress in a short amount of time, but this is a collaborative project, so you must allow others to catch up and follow along. Large pull requests become significantly more unwieldy to review, and as such make it exponentially more likely for a mistake or error to go undetected. They also make it harder to merge other pull requests because the more files you modify, the more likely it is for a merge conflict to occur. A general guideline is to keep submissions limited to one class at a time. Sometimes two or more classes may be too interlinked for this to be feasible, so this is not a hard rule, however if your PR is starting to modify more than 10 or so files, it's probably getting too big. diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 32b19164..c4897a2b 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -770,12 +770,15 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame) return; } - if (!Lego()) + if (!Lego()) { return; - if (!TickleManager()) + } + if (!TickleManager()) { return; - if (!Timer()) + } + if (!Timer()) { return; + } MxLong currentTime = Timer()->GetRealTime(); if (currentTime < g_lastFrameTime) { @@ -828,8 +831,9 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame) this->m_gameStarted = 1; } } - else if (sleepIfNotNextFrame != 0) + else if (sleepIfNotNextFrame != 0) { Sleep(0); + } } // FUNCTION: ISLE 0x402e80 diff --git a/LEGO1/LegoOmni.mingw.def b/LEGO1/LegoOmni.mingw.def index d5d9e052..e2c4ce5f 100644 --- a/LEGO1/LegoOmni.mingw.def +++ b/LEGO1/LegoOmni.mingw.def @@ -1,6 +1,6 @@ ; LegoOmni.def : Declares the module paarameters for the LEGO1.DLL. -DESCRIPTION " Lego OMNI Windows Dynamic Link Library" +; DESCRIPTION " Lego OMNI Windows Dynamic Link Library" EXPORTS @@ -42,9 +42,6 @@ _Z5Timerv _Z7PickROIii _Z8Streamerv _Z9GameStatev -_ZN10LegoEntityD0Ev -_ZN10LegoEntityD1Ev -_ZN10LegoEntityD2Ev _ZN10MxDSActionC1Ev _ZN10MxDSActionC2Ev _ZN10MxDSActionD0Ev @@ -60,9 +57,6 @@ _ZN11MxPresenter4InitEv _ZN11MxPresenter6EnableEh _ZN11MxPresenter6TickleEv _ZN11MxPresenter9EndActionEv -_ZN11MxPresenterD0Ev -_ZN11MxPresenterD1Ev -_ZN11MxPresenterD2Ev _ZN11MxScheduler11GetInstanceEv _ZN11MxScheduler17StartMultiTaskingEj _ZN11ViewManager9RemoveAllEP7ViewROI diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index 324d7195..8b1a09b1 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -2,49 +2,124 @@ #define ACT1STATE_H #include "legostate.h" +#include "legoutil.h" +#include "roi/legoroi.h" // VTABLE: LEGO1 0x100d7028 // SIZE 0x26c class Act1State : public LegoState { public: + enum { + e_unk953 = 953, + e_unk954 = 954, + e_unk955 = 955, + }; + Act1State(); // FUNCTION: LEGO1 0x100338a0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0154 return "Act1State"; } // FUNCTION: LEGO1 0x100338b0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool SetFlag() override; // vtable+0x18 - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxBool SetFlag() override; // vtable+0x18 + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c - inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x18 = p_unk0x18; } - inline MxU32 GetUnknown18() { return m_unk0x18; } - inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x21 = p_unk0x21; } - inline MxS16 GetUnknown21() { return m_unk0x21; } + inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } + inline MxU32 GetUnknown18() { return m_unk0x018; } + inline MxU32 GetUnknown1c() { return m_unk0x01c; } + inline MxS16 GetUnknown21() { return m_unk0x021; } + + inline void SetUnknown1c(MxU32 p_unk0x1c) { m_unk0x01c = p_unk0x1c; } + inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x021 = p_unk0x21; } void FUN_10034d00(); // SYNTHETIC: LEGO1 0x10033960 // Act1State::`scalar deleting destructor' + // SIZE 0x4c + class NamedPlane { + public: + // FUNCTION: LEGO1 0x10033800 + NamedPlane() {} + + inline void SetName(const char* p_name) { m_name = p_name; } + inline const MxString* GetName() const { return &m_name; } + + // FUNCTION: LEGO1 0x100344d0 + MxResult Serialize(LegoFile* p_file) + { + if (p_file->IsWriteMode()) { + p_file->FUN_10006030(m_name); + p_file->WriteVector3(m_point1); + p_file->WriteVector3(m_point2); + p_file->WriteVector3(m_point3); + } + else if (p_file->IsReadMode()) { + p_file->ReadString(m_name); + p_file->ReadVector3(m_point1); + p_file->ReadVector3(m_point2); + p_file->ReadVector3(m_point3); + } + + return SUCCESS; + } + + private: + MxString m_name; // 0x00 + Mx3DPointFloat m_point1; // 0x10 + Mx3DPointFloat m_point2; // 0x24 + Mx3DPointFloat m_point3; // 0x38 + }; + protected: - undefined m_unk0x08[0x10]; // 0x08 - MxU32 m_unk0x18; // 0x18 - undefined2 m_unk0x1c; // 0x1c - undefined m_unk0x1e; // 0x1e - undefined m_unk0x1f; // 0x1f - undefined m_unk0x20; // 0x20 - MxBool m_unk0x21; // 0x21 - undefined m_unk0x22; // 0x22 - // TODO + MxS32* m_unk0x008; // 0x008 + // FIXME: count for m_unk0x008 + MxS16 m_unk0x00c; // 0x00c + undefined2 m_unk0x00e; // 0x00e + undefined2 m_unk0x010; // 0x010 + undefined m_unk0x012; // 0x012 + MxS32 m_unk0x014; // 0x014 + MxU32 m_unk0x018; // 0x018 + MxU16 m_unk0x01c; // 0x01c + undefined m_unk0x01e; // 0x01e + undefined m_unk0x01f; // 0x01f + undefined m_unk0x020; // 0x020 + undefined m_unk0x021; // 0x021 + undefined m_unk0x022; // 0x022 + undefined m_unk0x023; // 0x023 + NamedPlane m_unk0x024; // 0x024 + NamedPlane m_unk0x070; // 0x070 + NamedPlane m_unk0x0bc; // 0x0bc + NamedPlane m_unk0x108; // 0x108 + NamedTexture* m_unk0x154; // 0x154 + NamedTexture* m_unk0x158; // 0x158 + NamedTexture* m_unk0x15c; // 0x15c + MxCore* m_unk0x160; // 0x160 + NamedPlane m_unk0x164; // 0x164 + NamedTexture* m_unk0x1b0; // 0x1b0 + NamedTexture* m_unk0x1b4; // 0x1b4 + MxCore* m_unk0x1b8; // 0x1b8 + NamedPlane m_unk0x1bc; // 0x1bc + NamedTexture* m_unk0x208; // 0x208 + MxCore* m_unk0x20c; // 0x20c + NamedPlane m_unk0x210; // 0x210 + NamedTexture* m_unk0x25c; // 0x25c + NamedTexture* m_unk0x260; // 0x260 + NamedTexture* m_unk0x264; // 0x264 + MxCore* m_unk0x268; // 0x268 }; +// FUNCTION: LEGO1 0x10033a70 +// Act1State::NamedPlane::~NamedPlane + #endif // ACT1STATE_H diff --git a/LEGO1/lego/legoomni/include/act2brick.h b/LEGO1/lego/legoomni/include/act2brick.h index 635fac2d..32856732 100644 --- a/LEGO1/lego/legoomni/include/act2brick.h +++ b/LEGO1/lego/legoomni/include/act2brick.h @@ -8,25 +8,25 @@ class Act2Brick : public LegoPathActor { public: Act2Brick(); - virtual ~Act2Brick() override; // vtable+0x00 + ~Act2Brick() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1007a360 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0438 return "Act2Brick"; } // FUNCTION: LEGO1 0x1007a370 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name); } - virtual MxS32 VTable0x94() override; // vtable+0x94 + MxS32 VTable0x94() override; // vtable+0x94 // SYNTHETIC: LEGO1 0x1007a450 // Act2Brick::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/act2policestation.h b/LEGO1/lego/legoomni/include/act2policestation.h index 3fa7ebb4..02d95e5b 100644 --- a/LEGO1/lego/legoomni/include/act2policestation.h +++ b/LEGO1/lego/legoomni/include/act2policestation.h @@ -7,17 +7,17 @@ // SIZE 0x68 class Act2PoliceStation : public LegoEntity { public: - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1000e200 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03fc return "Act2PoliceStation"; } // FUNCTION: LEGO1 0x1000e210 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act2PoliceStation::ClassName()) || LegoEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index fe27b743..46ae4e4f 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -9,31 +9,31 @@ class Act3 : public LegoWorld { public: Act3(); - virtual ~Act3() override; // vtable+00 + ~Act3() override; // vtable+00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10072510 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f013c return "Act3"; } // FUNCTION: LEGO1 0x10072520 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act3::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual void VTable0x60() override; // vtable+0x60 - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + void VTable0x60() override; // vtable+0x60 + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 inline void SetUnkown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } inline void SetUnkown4270(MxU32 p_unk0x4270) { m_unk0x4270 = p_unk0x4270; } diff --git a/LEGO1/lego/legoomni/include/act3actor.h b/LEGO1/lego/legoomni/include/act3actor.h index 00d06495..3d146cb7 100644 --- a/LEGO1/lego/legoomni/include/act3actor.h +++ b/LEGO1/lego/legoomni/include/act3actor.h @@ -8,7 +8,7 @@ class Act3Actor : public MxCore { public: // FUNCTION: LEGO1 0x100431b0 - inline virtual const char* ClassName() const override + inline const char* ClassName() const override { // STRING: LEGO1 0x100f03ac return "Act3Actor"; diff --git a/LEGO1/lego/legoomni/include/act3shark.h b/LEGO1/lego/legoomni/include/act3shark.h index 5ba5a6f2..b0b26a48 100644 --- a/LEGO1/lego/legoomni/include/act3shark.h +++ b/LEGO1/lego/legoomni/include/act3shark.h @@ -7,22 +7,22 @@ class Act3Shark : public LegoAnimActor { public: // FUNCTION: LEGO1 0x100430c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03a0 return "Act3Shark"; } // FUNCTION: LEGO1 0x1001a130 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act3Shark::ClassName()) || LegoAnimActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + void ParseAction(char*) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 // SYNTHETIC: LEGO1 0x10043020 // Act3Shark::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/act3state.h b/LEGO1/lego/legoomni/include/act3state.h index 1c8643f7..d1c83e48 100644 --- a/LEGO1/lego/legoomni/include/act3state.h +++ b/LEGO1/lego/legoomni/include/act3state.h @@ -10,19 +10,19 @@ class Act3State : public LegoState { inline Act3State() { m_unk0x08 = 0; } // FUNCTION: LEGO1 0x1000e300 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03f0 return "Act3State"; } // FUNCTION: LEGO1 0x1000e310 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; + MxBool VTable0x14() override; // SYNTHETIC: LEGO1 0x1000e3c0 // Act3State::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 5429cc66..17175b03 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -9,29 +9,29 @@ class Ambulance : public IslePathActor { public: Ambulance(); - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10035fa0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03c4 return "Ambulance"; } // FUNCTION: LEGO1 0x10035fb0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10036130 // Ambulance::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/ambulancemissionstate.h b/LEGO1/lego/legoomni/include/ambulancemissionstate.h index cefc3c21..aca6120b 100644 --- a/LEGO1/lego/legoomni/include/ambulancemissionstate.h +++ b/LEGO1/lego/legoomni/include/ambulancemissionstate.h @@ -10,19 +10,19 @@ class AmbulanceMissionState : public LegoState { AmbulanceMissionState(); // FUNCTION: LEGO1 0x10037600 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00e8 return "AmbulanceMissionState"; } // FUNCTION: LEGO1 0x10037610 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c inline MxU16 GetColor(MxU8 p_id) { diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index 8d785b11..63b884d8 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -8,23 +8,23 @@ class AnimState : public LegoState { public: AnimState(); - virtual ~AnimState() override; // vtable+0x00 + ~AnimState() override; // vtable+0x00 // FUNCTION: LEGO1 0x10065070 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0460 return "AnimState"; } // FUNCTION: LEGO1 0x10065080 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool SetFlag() override; // vtable+0x18 - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C + MxBool SetFlag() override; // vtable+0x18 + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C // SYNTHETIC: LEGO1 0x10065130 // AnimState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/beachhouseentity.h b/LEGO1/lego/legoomni/include/beachhouseentity.h index 1c92fc17..0910f49e 100644 --- a/LEGO1/lego/legoomni/include/beachhouseentity.h +++ b/LEGO1/lego/legoomni/include/beachhouseentity.h @@ -8,14 +8,14 @@ class BeachHouseEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ee80 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0314 return "BeachHouseEntity"; } // FUNCTION: LEGO1 0x1000ee90 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index 3e3f1359..bfc634b4 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -11,22 +11,22 @@ class Bike : public IslePathActor { Bike(); // FUNCTION: LEGO1 0x100766f0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03d0 return "Bike"; } // FUNCTION: LEGO1 0x10076700 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10076880 // Bike::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/buildingentity.h b/LEGO1/lego/legoomni/include/buildingentity.h index 490c6a0d..d07d9f5d 100644 --- a/LEGO1/lego/legoomni/include/buildingentity.h +++ b/LEGO1/lego/legoomni/include/buildingentity.h @@ -8,19 +8,19 @@ class BuildingEntity : public LegoEntity { public: BuildingEntity(); - virtual ~BuildingEntity() override; // vtable+0x00 + ~BuildingEntity() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10014f20 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07e8 return "BuildingEntity"; } // FUNCTION: LEGO1 0x10014f30 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, BuildingEntity::ClassName()) || LegoEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/bumpbouy.h b/LEGO1/lego/legoomni/include/bumpbouy.h index 7dc02c82..c6308d57 100644 --- a/LEGO1/lego/legoomni/include/bumpbouy.h +++ b/LEGO1/lego/legoomni/include/bumpbouy.h @@ -7,25 +7,25 @@ // VTABLE: LEGO1 0x100d6790 class BumpBouy : public LegoAnimActor { public: - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100274e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0394 return "BumpBouy"; } // FUNCTION: LEGO1 0x10027500 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, BumpBouy::ClassName()) || LegoAnimActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + void ParseAction(char*) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 // SYNTHETIC: LEGO1 0x10027490 // BumpBouy::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index 42a981bc..c5af66e8 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -11,25 +11,25 @@ class CarRace : public LegoRace { CarRace(); // FUNCTION: LEGO1 0x10016b20 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0528 return "CarRace"; } // FUNCTION: LEGO1 0x10016b30 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual undefined4 VTable0x6c(undefined4) override; // vtable+0x6c - virtual undefined4 VTable0x70(undefined4) override; // vtable+0x70 - virtual undefined4 VTable0x74(undefined4) override; // vtable+0x74 - virtual undefined4 VTable0x78(undefined4) override; // vtable+0x78 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x64() override; // vtable+0x64 + undefined4 VTable0x6c(undefined4) override; // vtable+0x6c + undefined4 VTable0x70(undefined4) override; // vtable+0x70 + undefined4 VTable0x74(undefined4) override; // vtable+0x74 + undefined4 VTable0x78(undefined4) override; // vtable+0x78 // SYNTHETIC: LEGO1 0x10016c70 // CarRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/carracestate.h b/LEGO1/lego/legoomni/include/carracestate.h index 490900dd..c7a1e376 100644 --- a/LEGO1/lego/legoomni/include/carracestate.h +++ b/LEGO1/lego/legoomni/include/carracestate.h @@ -8,14 +8,14 @@ class CarRaceState : public RaceState { public: // FUNCTION: LEGO1 0x1000dd30 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f009c return "CarRaceState"; } // FUNCTION: LEGO1 0x1000dd40 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, CarRaceState::ClassName()) || RaceState::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/doors.h b/LEGO1/lego/legoomni/include/doors.h index dc98a866..35958455 100644 --- a/LEGO1/lego/legoomni/include/doors.h +++ b/LEGO1/lego/legoomni/include/doors.h @@ -8,21 +8,21 @@ class Doors : public LegoPathActor { public: // FUNCTION: LEGO1 0x1000e430 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03e8 return "Doors"; } // FUNCTION: LEGO1 0x1000e440 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Doors::ClassName()) || LegoPathActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxS32 VTable0x94() override; // vtable+0x94 + void ParseAction(char*) override; // vtable+0x20 + void VTable0x70(float p_float) override; // vtable+0x70 + MxS32 VTable0x94() override; // vtable+0x94 // SYNTHETIC: LEGO1 0x1000e580 // Doors::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 3aaf7a87..27c0cdb5 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -11,24 +11,24 @@ class DuneBuggy : public IslePathActor { DuneBuggy(); // FUNCTION: LEGO1 0x10067c30 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0410 return "DuneBuggy"; } // FUNCTION: LEGO1 0x10067c40 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, DuneBuggy::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10067dc0 // DuneBuggy::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index e52f5556..8057b993 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -4,36 +4,38 @@ #include "decomp.h" #include "legoworld.h" +class LegoControlManagerEvent; + // VTABLE: LEGO1 0x100d5f20 // SIZE: 0xfc (from inlined ctor at 0x1000a8aa) class ElevatorBottom : public LegoWorld { public: ElevatorBottom(); - virtual ~ElevatorBottom() override; // vtable+0x00 + ~ElevatorBottom() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10017f20 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04ac return "ElevatorBottom"; } // FUNCTION: LEGO1 0x10017f30 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, ElevatorBottom::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 // FUNCTION: LEGO1 0x10017f10 - virtual MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10018040 // ElevatorBottom::`scalar deleting destructor' @@ -41,7 +43,7 @@ class ElevatorBottom : public LegoWorld { private: undefined4 m_unk0xf8; // 0xf8 - MxLong HandleNotification17(MxParam& p_param); + MxLong HandleClick(LegoControlManagerEvent& p_param); }; #endif // ELEVATORBOTTOM_H diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index baa42ab2..2d32bd81 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -11,29 +11,29 @@ class GasStation : public LegoWorld { public: GasStation(); - virtual ~GasStation() override; // vtable+0x00 + ~GasStation() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10004780 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0168 return "GasStation"; } // FUNCTION: LEGO1 0x10004790 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, GasStation::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x100048a0 // GasStation::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/gasstationentity.h b/LEGO1/lego/legoomni/include/gasstationentity.h index 7ab807cd..0b271d46 100644 --- a/LEGO1/lego/legoomni/include/gasstationentity.h +++ b/LEGO1/lego/legoomni/include/gasstationentity.h @@ -8,14 +8,14 @@ class GasStationEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000eb20 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0348 return "GasStationEntity"; } // FUNCTION: LEGO1 0x1000eb30 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/gasstationstate.h b/LEGO1/lego/legoomni/include/gasstationstate.h index a756e783..e9bbd0df 100644 --- a/LEGO1/lego/legoomni/include/gasstationstate.h +++ b/LEGO1/lego/legoomni/include/gasstationstate.h @@ -10,19 +10,19 @@ class GasStationState : public LegoState { GasStationState(); // FUNCTION: LEGO1 0x100061d0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0174 return "GasStationState"; } // FUNCTION: LEGO1 0x100061e0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10006290 // GasStationState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/gifmanager.h b/LEGO1/lego/legoomni/include/gifmanager.h index 1d424fb7..ce600a62 100644 --- a/LEGO1/lego/legoomni/include/gifmanager.h +++ b/LEGO1/lego/legoomni/include/gifmanager.h @@ -77,7 +77,7 @@ class GifManagerBase { class GifManager : public GifManagerBase { public: GifManager() { m_ownership = TRUE; } - virtual ~GifManager() override; + ~GifManager() override; // SYNTHETIC: LEGO1 0x1005a580 // GifManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 74670324..6c917aec 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -22,28 +22,28 @@ class HelicopterSubclass { class Helicopter : public IslePathActor { public: Helicopter(); - virtual ~Helicopter() override; // vtable+0x00 + ~Helicopter() override; // vtable+0x00 // FUNCTION: LEGO1 0x10003070 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0130 return "Helicopter"; } // FUNCTION: LEGO1 0x10003080 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/helicopterstate.h b/LEGO1/lego/legoomni/include/helicopterstate.h index a1562157..993b8f7c 100644 --- a/LEGO1/lego/legoomni/include/helicopterstate.h +++ b/LEGO1/lego/legoomni/include/helicopterstate.h @@ -9,23 +9,23 @@ class HelicopterState : public LegoState { public: // FUNCTION: LEGO1 0x1000e0d0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0144 return "HelicopterState"; } // FUNCTION: LEGO1 0x1000e0e0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); } // FUNCTION: LEGO1 0x1000e0b0 - virtual MxBool VTable0x14() override { return FALSE; } // vtable+0x14 + MxBool VTable0x14() override { return FALSE; } // vtable+0x14 // FUNCTION: LEGO1 0x1000e0c0 - virtual MxBool SetFlag() override + MxBool SetFlag() override { m_unk0x08 = 0; return TRUE; diff --git a/LEGO1/lego/legoomni/include/historybook.h b/LEGO1/lego/legoomni/include/historybook.h index 9152e07a..862be059 100644 --- a/LEGO1/lego/legoomni/include/historybook.h +++ b/LEGO1/lego/legoomni/include/historybook.h @@ -8,26 +8,26 @@ class HistoryBook : public LegoWorld { public: HistoryBook(); - virtual ~HistoryBook() override; // vtable+0x00 + ~HistoryBook() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10082390 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04bc return "HistoryBook"; } // FUNCTION: LEGO1 0x100823a0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, HistoryBook::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x64() override; // vtable+0x64 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x64() override; // vtable+0x64 // SYNTHETIC: LEGO1 0x100824b0 // HistoryBook::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index ad8bd137..809e64e2 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -9,29 +9,29 @@ class Hospital : public LegoWorld { public: Hospital(); - virtual ~Hospital() override; // vtable+0x00 + ~Hospital() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x100746b0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0490 return "Hospital"; } // FUNCTION: LEGO1 0x100746c0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Hospital::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x100747d0 // Hospital::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/hospitalentity.h b/LEGO1/lego/legoomni/include/hospitalentity.h index fea461d8..a837bd7b 100644 --- a/LEGO1/lego/legoomni/include/hospitalentity.h +++ b/LEGO1/lego/legoomni/include/hospitalentity.h @@ -8,14 +8,14 @@ class HospitalEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ec40 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0338 return "HospitalEntity"; } // FUNCTION: LEGO1 0x1000ec50 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/hospitalstate.h b/LEGO1/lego/legoomni/include/hospitalstate.h index a6ccd77a..980007e3 100644 --- a/LEGO1/lego/legoomni/include/hospitalstate.h +++ b/LEGO1/lego/legoomni/include/hospitalstate.h @@ -9,22 +9,22 @@ class HospitalState : public LegoState { public: HospitalState(); - virtual ~HospitalState() override {} + ~HospitalState() override {} // FUNCTION: LEGO1 0x10076400 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0480 return "HospitalState"; } // FUNCTION: LEGO1 0x10076410 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x100764c0 // HospitalState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index b46099cd..46e6b463 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -2,10 +2,12 @@ #define INFOCENTER_H #include "legoworld.h" +#include "mxrect32.h" #include "radio.h" class InfocenterState; class MxStillPresenter; +class LegoControlManagerEvent; // SIZE 0x18 struct InfocenterMapEntry { @@ -14,10 +16,7 @@ struct InfocenterMapEntry { MxStillPresenter* m_presenter; // 0x00 undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 + MxRect32 m_area; // 0x08 }; // VTABLE: LEGO1 0x100d9338 @@ -40,12 +39,15 @@ class Infocenter : public LegoWorld { c_leftArrowCtl = 1, c_rightArrowCtl = 2, c_infoCtl = 3, + c_doorCtl = 4, c_boatCtl = 10, c_raceCtl = 11, c_pizzaCtl = 12, c_gasCtl = 13, c_medCtl = 14, c_copCtl = 15, + c_bigInfoCtl = 16, + c_bookCtl = 17, c_radioCtl = 18, c_mamaCtl = 21, c_papaCtl = 22, @@ -53,6 +55,23 @@ class Infocenter : public LegoWorld { c_nickCtl = 24, c_lauraCtl = 25, + c_mamaSelected = 30, + c_papaSelected = 31, + c_pepperSelected = 32, + c_nickSelected = 33, + c_lauraSelected = 34, + + c_mamaMovie = 40, + c_papaMovie = 41, + c_pepperMovie = 42, + c_nickMovie = 43, + c_lauraMovie = 44, + + c_goToRegBook = 70, + c_goToRegBookRed = 71, + + c_unk499 = 499, + c_welcomeDialogue = 500, c_goodJobDialogue = 501, @@ -114,11 +133,28 @@ class Infocenter : public LegoWorld { c_noCDDialogueUnused1 = 552, c_noCDDialogueUnused2 = 553, + c_gasCtlDescription = 555, + c_medCtlDescription = 556, + c_unk557 = 557, + c_boatCtlDescription = 558, + c_copCtlDescription = 559, + c_pizzaCtlDescription = 560, + c_raceCtlDescription = 561, + c_leaveInfoCenterDialogue1 = 562, c_leaveInfoCenterDialogue2 = 563, c_leaveInfoCenterDialogue3 = 564, c_leaveInfoCenterDialogue4 = 565, + c_unk566 = 566, + c_unk567 = 567, + c_unk568 = 568, + + c_unk569 = 569, + c_unk570 = 570, + c_unk571 = 571, + c_unk572 = 572, + c_registerToContinueDialogue = 573, c_bricksterDialogue = 574, @@ -130,29 +166,29 @@ class Infocenter : public LegoWorld { }; Infocenter(); - virtual ~Infocenter() override; + ~Infocenter() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1006eb40 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04ec return "Infocenter"; } // FUNCTION: LEGO1 0x1006eb50 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Infocenter::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1006ec60 // Infocenter::`scalar deleting destructor' @@ -163,16 +199,18 @@ class Infocenter : public LegoWorld { MxLong HandleKeyPress(MxS8 p_key); MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y); MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y); - MxU8 HandleNotification17(MxParam&); - MxLong HandleEndAction(MxParam& p_param); - MxLong HandleNotification0(MxParam&); + MxU8 HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleNotification0(MxNotificationParam& p_param); - void FUN_10070dc0(MxBool); + void UpdateFrameHot(MxBool p_display); void FUN_10070e90(); void PlayCutscene(Cutscene p_entityId, MxBool p_scale); void StopCutscene(); + void FUN_10070d10(MxS32 p_x, MxS32 p_y); + void StartCredits(); void StopCredits(); @@ -185,10 +223,10 @@ class Infocenter : public LegoWorld { InfomainScript m_currentInfomainScript; // 0xf8 MxS16 m_unk0xfc; // 0xfc InfocenterState* m_infocenterState; // 0x100 - undefined4 m_unk0x104; // 0x104 + undefined4 m_transitionDestination; // 0x104 Cutscene m_currentCutscene; // 0x108 Radio m_radio; // 0x10c - undefined4 m_unk0x11c; // 0x11c + MxStillPresenter* m_unk0x11c; // 0x11c InfocenterMapEntry m_mapAreas[7]; // 0x120 MxS16 m_unk0x1c8; // 0x1c8 MxStillPresenter* m_frameHotBitmap; // 0x1cc diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index 1d7b361d..84be246a 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -3,42 +3,46 @@ #include "legoworld.h" +class LegoControlManagerEvent; + // VTABLE: LEGO1 0x100d72d8 // SIZE 0xfc class InfocenterDoor : public LegoWorld { public: InfocenterDoor(); - virtual ~InfocenterDoor(); // vtable+0x00 + ~InfocenterDoor() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100377b0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f049c return "InfocenterDoor"; } // FUNCTION: LEGO1 0x100377c0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, InfocenterDoor::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 // FUNCTION: LEGO1 0x100377a0 - virtual MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x100378d0 // InfocenterDoor::`scalar deleting destructor' private: MxS32 m_unk0xf8; // 0xf8 + + MxLong HandleClick(LegoControlManagerEvent& p_param); }; #endif // INFOCENTERDOOR_H diff --git a/LEGO1/lego/legoomni/include/infocenterentity.h b/LEGO1/lego/legoomni/include/infocenterentity.h index 91fe03ff..85bcbce5 100644 --- a/LEGO1/lego/legoomni/include/infocenterentity.h +++ b/LEGO1/lego/legoomni/include/infocenterentity.h @@ -8,14 +8,14 @@ class InfoCenterEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ea00 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f035c return "InfoCenterEntity"; } // FUNCTION: LEGO1 0x1000ea10 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h index 9399f8f4..171e3c0b 100644 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ b/LEGO1/lego/legoomni/include/infocenterstate.h @@ -10,27 +10,31 @@ class InfocenterState : public LegoState { public: InfocenterState(); - virtual ~InfocenterState() override; + ~InfocenterState() override; // FUNCTION: LEGO1 0x10071840 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04dc return "InfocenterState"; } // FUNCTION: LEGO1 0x10071850 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, InfocenterState::ClassName()) || LegoState::IsA(p_name); } // FUNCTION: LEGO1 0x10071830 - virtual MxBool VTable0x14() override { return FALSE; } // vtable+0x14 + MxBool VTable0x14() override { return FALSE; } // vtable+0x14 inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); } inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; } + inline Playlist& GetUnknown0x08() { return m_unk0x08; } + inline Playlist& GetUnknown0x14() { return m_unk0x14; } + inline Playlist& GetUnknown0x68() { return m_unk0x68; } inline MxU32 GetUnknown0x74() { return m_unk0x74; } + inline Playlist* GetUnknown0x44() { return m_unk0x44; } inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } @@ -38,35 +42,11 @@ class InfocenterState : public LegoState { // InfocenterState::`scalar deleting destructor' private: - // Members should be renamed with their offsets before use - /* - struct UnkStruct - { - undefined4 unk1; - undefined2 unk2; - undefined2 unk3; - undefined2 unk4; - }; - - undefined2 unk1; - undefined2 unk2; - undefined4 unk3; - undefined4 padding1; - void *unk4; - undefined2 unk5; - undefined2 unk6; - undefined2 unk7; - undefined2 padding2; - void *unk8; - undefined2 unk9; - undefined2 unk10; - undefined2 unk11; - undefined2 padding3; - UnkStruct unk12[6]; - undefined4 unk13; - */ - - undefined m_pad[0x6c]; + Playlist m_unk0x08; // 0x08 + Playlist m_unk0x14; // 0x14 + Playlist m_unk0x20[3]; // 0x20 + Playlist m_unk0x44[3]; // 0x44 + Playlist m_unk0x68; // 0x68 MxU32 m_unk0x74; // 0x74 MxStillPresenter* m_buffer[7]; // 0x78 }; diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 04871028..f94e6832 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -23,31 +23,31 @@ class Act1State; class Isle : public LegoWorld { public: Isle(); - virtual ~Isle() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + ~Isle() override; + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10030910 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0458 return "Isle"; } // FUNCTION: LEGO1 0x10030920 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+50 - virtual void Add(MxCore* p_object) override; // vtable+58 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+50 + void Add(MxCore* p_object) override; // vtable+58 // FUNCTION: LEGO1 0x10030900 - virtual MxBool VTable0x5c() override { return TRUE; } // vtable+5c + MxBool VTable0x5c() override { return TRUE; } // vtable+5c // FUNCTION: LEGO1 0x10033170 - virtual void VTable0x60() override {} // vtable+60 - virtual MxBool VTable0x64() override; // vtable+64 - virtual void VTable0x68(MxBool p_add) override; // vtable+68 + void VTable0x60() override {} // vtable+60 + MxBool VTable0x64() override; // vtable+64 + void Enable(MxBool p_enable) override; // vtable+68 virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; } diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index d8253821..c51946d3 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -6,22 +6,22 @@ // VTABLE: LEGO1 0x100d5178 class IsleActor : public LegoActor { public: - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1000e660 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07dc return "IsleActor"; } // FUNCTION: LEGO1 0x1000e670 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, IsleActor::ClassName()) || LegoActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 }; // SYNTHETIC: LEGO1 0x1000e940 diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 2770b457..a7fabbfa 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -15,25 +15,25 @@ class IslePathActor : public LegoPathActor { IslePathActor(); // FUNCTION: LEGO1 0x10002e10 - inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); } // vtable+0x00 + inline ~IslePathActor() override { IslePathActor::Destroy(TRUE); } // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10002ea0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0104 return "IslePathActor"; } // FUNCTION: LEGO1 0x10002eb0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c // FUNCTION: LEGO1 0x10002e70 virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc // FUNCTION: LEGO1 0x10002df0 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 91de4b91..b71e43cf 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -12,23 +12,23 @@ class Jetski : public IslePathActor { Jetski(); // FUNCTION: LEGO1 0x1007e430 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03d8 return "Jetski"; } // FUNCTION: LEGO1 0x1007e440 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Jetski::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent&) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent&) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x1007e5c0 // Jetski::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 9b16d9a7..d926e871 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -8,14 +8,14 @@ class JetskiRace : public LegoRace { public: // FUNCTION: LEGO1 0x1000daf0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0530 return "JetskiRace"; } // FUNCTION: LEGO1 0x1000db00 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/jetskiracestate.h b/LEGO1/lego/legoomni/include/jetskiracestate.h index ccb60112..812a0a0f 100644 --- a/LEGO1/lego/legoomni/include/jetskiracestate.h +++ b/LEGO1/lego/legoomni/include/jetskiracestate.h @@ -8,14 +8,14 @@ class JetskiRaceState : public RaceState { public: // FUNCTION: LEGO1 0x1000dc40 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00ac return "JetskiRaceState"; } // FUNCTION: LEGO1 0x1000dc50 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index f760641d..94728ee2 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -10,30 +10,31 @@ class JukeBox : public LegoWorld { public: JukeBox(); - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005d6f0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02cc return "JukeBox"; } // FUNCTION: LEGO1 0x1005d700 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, JukeBox::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1005d810 // JukeBox::`scalar deleting destructor' + enum JukeBoxScript { e_mamaPapaBrickolini, e_jailUnused, @@ -65,29 +66,18 @@ class JukeBox : public LegoWorld { e_legoRadioReminder2, e_legoRadioRacingAd, - e_legoRadioNews1, e_legoRadioNews2, - e_legoRadioPizzaAd1, - e_legoRadioBricksterPSA, - e_legoRadioSports1, - e_legoRadioIntermission1, e_legoRadioIntermission2, - e_legoRadioPizzaAd2, - e_legoRadioWeatherReport, - e_legoRadioSports2, - e_legoRadioPizzaAd3, - e_legoRadioIntermission3, - e_legoRadioSuperStoreAd, e_legoRadioLuckyYou, diff --git a/LEGO1/lego/legoomni/include/jukeboxentity.h b/LEGO1/lego/legoomni/include/jukeboxentity.h index 38691ba6..8afee4b5 100644 --- a/LEGO1/lego/legoomni/include/jukeboxentity.h +++ b/LEGO1/lego/legoomni/include/jukeboxentity.h @@ -8,19 +8,19 @@ class JukeBoxEntity : public LegoEntity { public: JukeBoxEntity(); - virtual ~JukeBoxEntity() override; // vtable+0x00 + ~JukeBoxEntity() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10085cc0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02f0 return "JukeBoxEntity"; } // FUNCTION: LEGO1 0x10085cd0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, JukeBoxEntity::ClassName()) || LegoEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h index 8263e97c..7f157bd0 100644 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ b/LEGO1/lego/legoomni/include/jukeboxstate.h @@ -8,19 +8,19 @@ class JukeBoxState : public LegoState { public: // FUNCTION: LEGO1 0x1000f310 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02bc return "JukeBoxState"; } // FUNCTION: LEGO1 0x1000f320 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; // vtable+0x14 + MxBool VTable0x14() override; // vtable+0x14 // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h index bf771d45..22b39156 100644 --- a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h +++ b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h @@ -8,22 +8,22 @@ class Lego3DWavePresenter : public MxWavePresenter { public: // FUNCTION: LEGO1 0x1000d890 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f058c return "Lego3DWavePresenter"; } // FUNCTION: LEGO1 0x1000d8a0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Lego3DWavePresenter::ClassName()) || MxWavePresenter::IsA(p_name); } - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 // SYNTHETIC: LEGO1 0x1000f4b0 // Lego3DWavePresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 0ac22875..dfedc85d 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -9,14 +9,14 @@ // SIZE 0x1154 class LegoAct2 : public LegoWorld { - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual void VTable0x60() override; // vtable+0x60 - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + void VTable0x60() override; // vtable+0x60 + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1004fe20 // LegoAct2::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoact2state.h b/LEGO1/lego/legoomni/include/legoact2state.h index e37af2dc..78101599 100644 --- a/LEGO1/lego/legoomni/include/legoact2state.h +++ b/LEGO1/lego/legoomni/include/legoact2state.h @@ -7,22 +7,22 @@ // SIZE 0x10 class LegoAct2State : public LegoState { public: - virtual ~LegoAct2State() override {} + ~LegoAct2State() override {} // FUNCTION: LEGO1 0x1000df80 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0428 return "LegoAct2State"; } // FUNCTION: LEGO1 0x1000df90 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; // vtable+0x14 + MxBool VTable0x14() override; // vtable+0x14 // SYNTHETIC: LEGO1 0x1000e040 // LegoAct2State::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h index 633fc5eb..3dcbfecb 100644 --- a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h @@ -10,25 +10,25 @@ class LegoActionControlPresenter : public MxMediaPresenter { public: inline LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; } - virtual ~LegoActionControlPresenter() override { Destroy(TRUE); } // vtable+0x00 + ~LegoActionControlPresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: LEGO1 0x1000d0e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f05bc return "LegoActionControlPresenter"; } // FUNCTION: LEGO1 0x1000d0f0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoActionControlPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 + void ReadyTickle() override; // vtable+0x18 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 virtual void Destroy(MxBool p_fromDestructor); // vtable+0x5c private: diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 76beb249..0f048619 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -9,23 +9,23 @@ class LegoActor : public LegoEntity { public: LegoActor(); - virtual ~LegoActor() override; + ~LegoActor() override; // FUNCTION: LEGO1 0x1002d210 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0124 return "LegoActor"; } // FUNCTION: LEGO1 0x1002d220 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 + void ParseAction(char*) override; // vtable+0x20 + void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 // FUNCTION: LEGO1 0x10002cc0 virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50 diff --git a/LEGO1/lego/legoomni/include/legoactorpresenter.h b/LEGO1/lego/legoomni/include/legoactorpresenter.h index a9b8ae7e..9c3b35bf 100644 --- a/LEGO1/lego/legoomni/include/legoactorpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactorpresenter.h @@ -7,24 +7,24 @@ // SIZE 0x50 class LegoActorPresenter : public LegoEntityPresenter { public: - virtual ~LegoActorPresenter() override{}; + ~LegoActorPresenter() override{}; // FUNCTION: LEGO1 0x1000cb10 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f06a4 return "LegoActorPresenter"; } // FUNCTION: LEGO1 0x1000cb20 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoActorPresenter::ClassName()) || LegoEntityPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void ParseExtra() override; // vtable+0x30 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void ParseExtra() override; // vtable+0x30 }; // SYNTHETIC: LEGO1 0x1000cc30 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index c8ad60cd..94cb5b86 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -9,27 +9,30 @@ class LegoAnimationManager : public MxCore { public: LegoAnimationManager(); - virtual ~LegoAnimationManager() override; // vtable+0x00 + ~LegoAnimationManager() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005ec80 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7508 return "LegoAnimationManager"; } // FUNCTION: LEGO1 0x1005ec90 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name); } + void FUN_1005ee80(MxBool); void FUN_1005ef10(); + void FUN_1005f0b0(); void FUN_1005f6d0(MxBool); void FUN_1005f720(undefined4); + void FUN_10061010(undefined4); void FUN_10064670(MxBool); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 790ee92c..c79c8043 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -9,30 +9,30 @@ class LegoAnimMMPresenter : public MxCompositePresenter { public: LegoAnimMMPresenter(); - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1004a950 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f046c return "LegoAnimMMPresenter"; } // FUNCTION: LEGO1 0x1004a960 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoAnimMMPresenter::ClassName()) || MxCompositePresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void DoneTickle() override; // vtable+0x2c - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - virtual void EndAction() override; // vtable+0x40 - virtual void VTable0x60(MxPresenter* p_presenter) override; // vtable+0x60 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void VTable0x60(MxPresenter* p_presenter) override; // vtable+0x60 // SYNTHETIC: LEGO1 0x1004aa40 // LegoAnimMMPresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 2a2845cf..221dfeb0 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -14,32 +14,32 @@ class LegoAnimClass; class LegoAnimPresenter : public MxVideoPresenter { public: LegoAnimPresenter(); - virtual ~LegoAnimPresenter() override; + ~LegoAnimPresenter() override; // FUNCTION: LEGO1 0x10068530 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f071c return "LegoAnimPresenter"; } // FUNCTION: LEGO1 0x10068540 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoAnimPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - virtual void EndAction() override; // vtable+0x40 - virtual void PutFrame() override; // vtable+0x6c - virtual MxResult VTable0x88(MxStreamChunk* p_chunk); // vtable+0x88 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c + virtual MxResult VTable0x88(MxStreamChunk* p_chunk); // vtable+0x88 inline LegoAnimClass* GetUnknown0x64() { return m_unk0x64; } @@ -81,11 +81,11 @@ class LegoAnimPresenter : public MxVideoPresenter { class LegoAnimClass : public LegoTree { public: LegoAnimClass(); - virtual ~LegoAnimClass() override; + ~LegoAnimClass() override; - virtual LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08 - virtual LegoTreeNodeData* CreateData() override; // vtable+0x0c - virtual MxResult VTable0x10(LegoMemory* p_stream, MxS32); // vtable+0x10 + LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08 + LegoTreeNodeData* CreateData() override; // vtable+0x0c + virtual MxResult VTable0x10(LegoMemory* p_stream, MxS32); // vtable+0x10 inline MxLong GetUnknown0x8() { return m_unk0x08; } diff --git a/LEGO1/lego/legoomni/include/legobackgroundcolor.h b/LEGO1/lego/legoomni/include/legobackgroundcolor.h index 5d05618b..672e39be 100644 --- a/LEGO1/lego/legoomni/include/legobackgroundcolor.h +++ b/LEGO1/lego/legoomni/include/legobackgroundcolor.h @@ -8,7 +8,7 @@ class LegoBackgroundColor : public MxVariable { public: LegoBackgroundColor(const char* p_key, const char* p_value); - virtual void SetValue(const char* p_colorString) override; + void SetValue(const char* p_colorString) override; private: float m_h; diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 7bde7ad9..4559d41d 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -8,12 +8,12 @@ class LegoBuildingManager : public MxCore { public: LegoBuildingManager(); - virtual ~LegoBuildingManager() override; + ~LegoBuildingManager() override; - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1002f930 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f37d0 return "LegoBuildingManager"; diff --git a/LEGO1/lego/legoomni/include/legocachesound.h b/LEGO1/lego/legoomni/include/legocachesound.h index 44ddb859..2d7c932c 100644 --- a/LEGO1/lego/legoomni/include/legocachesound.h +++ b/LEGO1/lego/legoomni/include/legocachesound.h @@ -9,17 +9,17 @@ class LegoCacheSound : public MxCore { public: LegoCacheSound(); - virtual ~LegoCacheSound() override; // vtable+0x00 + ~LegoCacheSound() override; // vtable+0x00 // FUNCTION: LEGO1 0x10006580 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f01c4 return "LegoCacheSound"; } // FUNCTION: LEGO1 0x10006590 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoCacheSound::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/legocachesoundlist.h b/LEGO1/lego/legoomni/include/legocachesoundlist.h index 2080ae14..25459911 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundlist.h +++ b/LEGO1/lego/legoomni/include/legocachesoundlist.h @@ -22,7 +22,7 @@ class LegoCacheSoundList : public MxPtrList { LegoCacheSoundList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x1001e650 - virtual MxS8 Compare(LegoCacheSound* p_a, LegoCacheSound* p_b) override + MxS8 Compare(LegoCacheSound* p_a, LegoCacheSound* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 diff --git a/LEGO1/lego/legoomni/include/legocameracontroller.h b/LEGO1/lego/legoomni/include/legocameracontroller.h index a3ef12a7..0032092b 100644 --- a/LEGO1/lego/legoomni/include/legocameracontroller.h +++ b/LEGO1/lego/legoomni/include/legocameracontroller.h @@ -12,19 +12,19 @@ class LegoCameraController : public LegoPointOfViewController { public: LegoCameraController(); - virtual ~LegoCameraController() override; // vtable+0x00 + ~LegoCameraController() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+04 + MxLong Notify(MxParam& p_param) override; // vtable+04 // FUNCTION: LEGO1 0x10011ec0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0850 return "LegoCameraController"; } // FUNCTION: LEGO1 0x10011ed0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 3ce04e02..03d0484d 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -8,29 +8,29 @@ class LegoCarBuild : public LegoWorld { public: LegoCarBuild(); - virtual ~LegoCarBuild() override; + ~LegoCarBuild() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10022940 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0504 return "LegoCarBuild"; } // FUNCTION: LEGO1 0x10022950 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoCarBuild::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10022a60 // LegoCarBuild::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h index d15e2f19..fd5f8148 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h @@ -8,26 +8,26 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { public: LegoCarBuildAnimPresenter(); - virtual ~LegoCarBuildAnimPresenter() override; // vtable+0x00 + ~LegoCarBuildAnimPresenter() override; // vtable+0x00 // FUNCTION: LEGO1 0x10078510 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f05ec return "LegoCarBuildAnimPresenter"; } // FUNCTION: LEGO1 0x10078520 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoCarBuildAnimPresenter::ClassName()) || LegoAnimPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void EndAction() override; // vtable+0x40 - virtual void PutFrame() override; // vtable+0x6c + void ReadyTickle() override; // vtable+0x18 + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c // SYNTHETIC: LEGO1 0x10078660 // LegoCarBuildAnimPresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocarraceactor.h b/LEGO1/lego/legoomni/include/legocarraceactor.h index 5f2756a3..3905be16 100644 --- a/LEGO1/lego/legoomni/include/legocarraceactor.h +++ b/LEGO1/lego/legoomni/include/legocarraceactor.h @@ -7,25 +7,25 @@ class LegoCarRaceActor : public LegoRaceActor { public: // FUNCTION: LEGO1 0x10081650 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0568 return "LegoCarRaceActor"; } // FUNCTION: LEGO1 0x10081670 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoCarRaceActor::ClassName()) || LegoRaceActor::IsA(p_name); } - virtual void VTable0x68() override; // vtable+0x68 - virtual void VTable0x6c() override; // vtable+0x6c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxS32 VTable0x90() override; // vtable+0x90 - virtual MxS32 VTable0x94() override; // vtable+0x94 - virtual void VTable0x98() override; // vtable+0x98 - virtual void VTable0x9c() override; // vtable+0x9c + void VTable0x68() override; // vtable+0x68 + void VTable0x6c() override; // vtable+0x6c + void VTable0x70(float p_float) override; // vtable+0x70 + MxS32 VTable0x90() override; // vtable+0x90 + MxS32 VTable0x94() override; // vtable+0x94 + void VTable0x98() override; // vtable+0x98 + void VTable0x9c() override; // vtable+0x9c // SYNTHETIC: LEGO1 0x10081610 // LegoCarRaceActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 0206c520..46719167 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -6,6 +6,8 @@ #include "mxcore.h" #include "mxpresenterlist.h" +class MxControlPresenter; + // VTABLE: LEGO1 0x100d6a98 // SIZE 0x2c class LegoControlManagerEvent : public LegoEventNotificationParam { @@ -40,19 +42,19 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { class LegoControlManager : public MxCore { public: LegoControlManager(); - virtual ~LegoControlManager() override; // vtable+0x00 + ~LegoControlManager() override; // vtable+0x00 - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10028cb0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f31b8 return "LegoControlManager"; } // FUNCTION: LEGO1 0x10028cc0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoControlManager::ClassName()) || MxCore::IsA(p_name); } @@ -62,7 +64,7 @@ class LegoControlManager : public MxCore { void Unregister(MxCore* p_listener); MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter); void FUN_100293c0(undefined4, const char*, undefined2); - void FUN_100294e0(MxS32 p_x, MxS32 p_y); + MxControlPresenter* FUN_100294e0(MxS32 p_x, MxS32 p_y); MxBool FUN_10029630(); MxBool FUN_10029750(); void FUN_100292e0(); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index c5088097..e132a113 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -20,9 +20,9 @@ class LegoEntity : public MxEntity { inline LegoEntity() { Init(); } // FUNCTION: LEGO1 0x1000c290 - virtual ~LegoEntity() override { Destroy(TRUE); } + ~LegoEntity() override { Destroy(TRUE); } - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1000c2f0 inline const char* ClassName() const override // vtable+0x0c diff --git a/LEGO1/lego/legoomni/include/legoentitylist.h b/LEGO1/lego/legoomni/include/legoentitylist.h index d1c1383f..938c85d4 100644 --- a/LEGO1/lego/legoomni/include/legoentitylist.h +++ b/LEGO1/lego/legoomni/include/legoentitylist.h @@ -22,7 +22,7 @@ class LegoEntityList : public MxPtrList { LegoEntityList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x1001e2d0 - virtual MxS8 Compare(LegoEntity* p_a, LegoEntity* p_b) override + MxS8 Compare(LegoEntity* p_a, LegoEntity* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 @@ -74,7 +74,7 @@ class LegoEntityListCursor : public MxPtrListCursor { // SYNTHETIC: LEGO1 0x1001f110 // LegoEntityListCursor::`scalar deleting destructor' -// FUNCTION: LEGO1 0x1001f180 +// TEMPLATE: LEGO1 0x1001f180 // MxPtrListCursor::~MxPtrListCursor // SYNTHETIC: LEGO1 0x1001f1d0 @@ -83,7 +83,7 @@ class LegoEntityListCursor : public MxPtrListCursor { // SYNTHETIC: LEGO1 0x1001f240 // MxPtrListCursor::`scalar deleting destructor' -// FUNCTION: LEGO1 0x1001f2b0 +// TEMPLATE: LEGO1 0x1001f2b0 // MxListCursor::~MxListCursor // FUNCTION: LEGO1 0x1001f300 diff --git a/LEGO1/lego/legoomni/include/legoentitypresenter.h b/LEGO1/lego/legoomni/include/legoentitypresenter.h index 291809ab..565e7878 100644 --- a/LEGO1/lego/legoomni/include/legoentitypresenter.h +++ b/LEGO1/lego/legoomni/include/legoentitypresenter.h @@ -10,7 +10,7 @@ class LegoEntity; class LegoEntityPresenter : public MxCompositePresenter { public: LegoEntityPresenter(); - virtual ~LegoEntityPresenter() override; // vtable+0x00 + ~LegoEntityPresenter() override; // vtable+0x00 // FUNCTION: LEGO1 0x100534b0 inline const char* ClassName() const override // vtable+0x0c @@ -25,13 +25,13 @@ class LegoEntityPresenter : public MxCompositePresenter { return !strcmp(p_name, LegoEntityPresenter::ClassName()) || MxCompositePresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 - virtual void Destroy() override; // vtable+0x38 - virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - virtual void Init(); // vtable+0x68 - virtual undefined4 SetEntity(LegoEntity* p_entity); // vtable+0x6c + void ReadyTickle() override; // vtable+0x18 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 + void Destroy() override; // vtable+0x38 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + virtual void Init(); // vtable+0x68 + virtual undefined4 SetEntity(LegoEntity* p_entity); // vtable+0x6c void SetEntityLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direction, Mx3DPointFloat& p_up); diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index 650ef8f6..a9c13632 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -12,7 +12,7 @@ class LegoEventNotificationParam : public MxNotificationParam { public: // FUNCTION: LEGO1 0x10028690 - virtual MxNotificationParam* Clone() override + MxNotificationParam* Clone() override { LegoEventNotificationParam* clone = new LegoEventNotificationParam(m_type, m_sender, m_modifier, m_x, m_y, m_key); diff --git a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h index f86cf448..70f8a309 100644 --- a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h +++ b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h @@ -17,9 +17,9 @@ class LegoFlcTexturePresenter : public MxFlcPresenter { return "LegoFlcTexturePresenter"; } - virtual void StartingTickle() override; // vtable+0x1c - virtual void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 - virtual void PutFrame() override; // vtable+0x6c + void StartingTickle() override; // vtable+0x1c + void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 + void PutFrame() override; // vtable+0x6c // SYNTHETIC: LEGO1 0x1005df00 // LegoFlcTexturePresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legofullscreenmovie.h b/LEGO1/lego/legoomni/include/legofullscreenmovie.h index f2cdaae4..2f2f7614 100644 --- a/LEGO1/lego/legoomni/include/legofullscreenmovie.h +++ b/LEGO1/lego/legoomni/include/legofullscreenmovie.h @@ -8,7 +8,7 @@ class LegoFullScreenMovie : public MxVariable { public: LegoFullScreenMovie(const char* p_key, const char* p_value); - virtual void SetValue(const char* p_option) override; + void SetValue(const char* p_option) override; }; #endif // LEGOFULLSCREENMOVIE_H diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 318aa7a3..0b45f11c 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -32,19 +32,25 @@ class LegoGameState { LegoState* CreateState(const char* p_stateName); void GetFileSavePath(MxString* p_outPath, MxULong p_slotn); - void FUN_1003a720(MxU32); - void HandleAction(MxU32); + void StopArea(MxU32 p_area = 0); + void SwitchArea(MxU32 p_area); inline MxU8 GetUnknownC() { return m_unk0x0c; } inline MxU32 GetUnknown10() { return m_unk0x10; } inline MxS32 GetCurrentAct() { return m_currentAct; } - inline undefined4 GetUnknown424() { return m_unk0x424; } + inline MxU32 GetCurrentArea() { return m_currentArea; } + inline MxU32 GetPreviousArea() { return m_previousArea; } + inline MxU32 GetUnknown0x42c() { return m_unk0x42c; } + inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; } - inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; } + inline void SetCurrentArea(MxU32 p_currentArea) { m_currentArea = p_currentArea; } + inline void SetPreviousArea(MxU32 p_previousArea) { m_previousArea = p_previousArea; } + inline void SetUnknown0x0c(MxU8 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } void SetSomeEnumState(undefined4 p_state); void FUN_1003ceb0(); void FUN_10039780(MxU8); + void FUN_10039940(); struct ScoreStruct { void WriteScoreHistory(); @@ -75,8 +81,8 @@ class LegoGameState { ScoreStruct m_unk0xa6; // 0xa6 undefined m_unk0x41a[8]; // 0x41a - might be part of the structure at 0xa6 MxBool m_isDirty; // 0x420 - undefined4 m_unk0x424; // 0x424 - undefined4 m_prevArea; // 0x428 + MxU32 m_currentArea; // 0x424 + MxU32 m_previousArea; // 0x428 undefined4 m_unk0x42c; // 0x42c }; diff --git a/LEGO1/lego/legoomni/include/legohideanimpresenter.h b/LEGO1/lego/legoomni/include/legohideanimpresenter.h index 29232923..37b8c475 100644 --- a/LEGO1/lego/legoomni/include/legohideanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legohideanimpresenter.h @@ -9,7 +9,7 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { public: LegoHideAnimPresenter(); - virtual ~LegoHideAnimPresenter() override; + ~LegoHideAnimPresenter() override; // FUNCTION: LEGO1 0x1006d880 inline const char* ClassName() const override // vtable+0x0c @@ -24,12 +24,12 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { return !strcmp(p_name, ClassName()) || LegoAnimPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x18 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual void EndAction() override; // vtable+0x40 - virtual void PutFrame() override; // vtable+0x6c + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x18 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c private: void Init(); diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index e872eff6..69a9dc64 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -42,7 +42,7 @@ class LegoEventQueue : public MxQueue {}; class LegoNotifyList : public MxPtrList { protected: // FUNCTION: LEGO1 0x10028830 - virtual MxS8 Compare(MxCore* p_element1, MxCore* p_element2) override + MxS8 Compare(MxCore* p_element1, MxCore* p_element2) override { return p_element1 == p_element2 ? 0 : p_element1 < p_element2 ? -1 : 1; } // vtable+0x14 @@ -69,19 +69,19 @@ class LegoNotifyListCursor : public MxPtrListCursor { class LegoInputManager : public MxPresenter { public: LegoInputManager(); - virtual ~LegoInputManager() override; + ~LegoInputManager() override; void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key); void Register(MxCore*); void UnRegister(MxCore*); - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1005b8c0 - virtual MxResult PutData() override { return SUCCESS; } // vtable+0x4c + MxResult PutData() override { return SUCCESS; } // vtable+0x4c MxResult Create(HWND p_hwnd); - void Destroy(); + void Destroy() override; void CreateAndAcquireKeyboard(HWND p_hwnd); void ReleaseDX(); MxResult GetJoystickId(); diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h index a4699945..1ec0b9bb 100644 --- a/LEGO1/lego/legoomni/include/legojetski.h +++ b/LEGO1/lego/legoomni/include/legojetski.h @@ -6,7 +6,7 @@ // VTABLE: LEGO1 0x100d5a40 class LegoJetski : public LegoJetskiRaceActor { public: - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10013e80 inline const char* ClassName() const override // vtable+0x0c @@ -21,13 +21,13 @@ class LegoJetski : public LegoJetskiRaceActor { return !strcmp(p_name, LegoJetski::ClassName()) || LegoJetskiRaceActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - virtual void VTable0x6c() override; // vtable+0x6c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxS32 VTable0x94() override; // vtable+0x94 - virtual void VTable0x98() override; // vtable+0x98 - virtual void VTable0x9c() override; // vtable+0x9c + void ParseAction(char*) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void VTable0x6c() override; // vtable+0x6c + void VTable0x70(float p_float) override; // vtable+0x70 + MxS32 VTable0x94() override; // vtable+0x94 + void VTable0x98() override; // vtable+0x98 + void VTable0x9c() override; // vtable+0x9c // SYNTHETIC: LEGO1 0x10013e20 // LegoJetski::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h index 149b7011..fd7d88bb 100644 --- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h +++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h @@ -19,10 +19,10 @@ class LegoJetskiRaceActor : public LegoCarRaceActor { return !strcmp(p_name, LegoJetskiRaceActor::ClassName()) || LegoCarRaceActor::IsA(p_name); } - virtual void VTable0x6c() override; // vtable+0x6c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual void VTable0x98() override; // vtable+0x98 - virtual void VTable0x9c() override; // vtable+0x9c + void VTable0x6c() override; // vtable+0x6c + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x98() override; // vtable+0x98 + void VTable0x9c() override; // vtable+0x9c // SYNTHETIC: LEGO1 0x10081d40 // LegoJetskiRaceActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h index b0fc9db9..cb6ad80a 100644 --- a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h @@ -11,7 +11,7 @@ class LegoCacheSound; class LegoLoadCacheSoundPresenter : public MxWavePresenter { public: LegoLoadCacheSoundPresenter(); - virtual ~LegoLoadCacheSoundPresenter() override; + ~LegoLoadCacheSoundPresenter() override; // FUNCTION: LEGO1 0x10018450 inline const char* ClassName() const override // vtable+0x0c @@ -20,10 +20,10 @@ class LegoLoadCacheSoundPresenter : public MxWavePresenter { return "LegoLoadCacheSoundPresenter"; } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual MxResult PutData() override; // vtable+0x4c + void ReadyTickle() override; // vtable+0x18 + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + MxResult PutData() override; // vtable+0x4c private: void Init(); diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index 34b6ed2e..2a78176d 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -8,7 +8,7 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { public: LegoLocomotionAnimPresenter(); - virtual ~LegoLocomotionAnimPresenter() override; + ~LegoLocomotionAnimPresenter() override; // FUNCTION: LEGO1 0x1006ce50 inline const char* ClassName() const override // vtable+0x0c @@ -23,22 +23,23 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { return !strcmp(p_name, ClassName()) || LegoLoopingAnimPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual void EndAction() override; // vtable+0x40 - virtual void PutFrame() override; // vtable+0x6c - virtual MxResult VTable0x88(MxStreamChunk* p_chunk) override; // vtable+0x88 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c + MxResult VTable0x88(MxStreamChunk* p_chunk) override; // vtable+0x88 // SYNTHETIC: LEGO1 0x1006cfe0 // LegoLocomotionAnimPresenter::`scalar deleting destructor' inline void DecrementUnknown0xd4() { - if (m_unk0xd4) + if (m_unk0xd4) { --m_unk0xd4; + } } inline undefined2 GetUnknown0xd4() { return m_unk0xd4; } diff --git a/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h b/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h index 22bdffc9..50815015 100644 --- a/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h @@ -20,8 +20,8 @@ class LegoLoopingAnimPresenter : public LegoAnimPresenter { return !strcmp(p_name, ClassName()) || LegoAnimPresenter::IsA(p_name); } - virtual void StreamingTickle() override; // vtable+0x20 - virtual void PutFrame() override; // vtable+0x6c + void StreamingTickle() override; // vtable+0x20 + void PutFrame() override; // vtable+0x6c }; // SYNTHETIC: LEGO1 0x1006d000 diff --git a/LEGO1/lego/legoomni/include/legometerpresenter.h b/LEGO1/lego/legoomni/include/legometerpresenter.h index 33c7aa37..378c0574 100644 --- a/LEGO1/lego/legoomni/include/legometerpresenter.h +++ b/LEGO1/lego/legoomni/include/legometerpresenter.h @@ -8,13 +8,13 @@ class LegoMeterPresenter : public MxStillPresenter { public: LegoMeterPresenter(); - virtual ~LegoMeterPresenter() override; + ~LegoMeterPresenter() override; // MxStillPresenter's `::ClassName` and `::IsA` are used. - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 private: void FUN_10043a50(); diff --git a/LEGO1/lego/legoomni/include/legomodelpresenter.h b/LEGO1/lego/legoomni/include/legomodelpresenter.h index e0480d23..c94be713 100644 --- a/LEGO1/lego/legoomni/include/legomodelpresenter.h +++ b/LEGO1/lego/legoomni/include/legomodelpresenter.h @@ -24,9 +24,9 @@ class LegoModelPresenter : public MxVideoPresenter { return !strcmp(p_name, ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void ParseExtra() override; // vtable+0x30 - virtual void Destroy() override; // vtable+0x38 + void ReadyTickle() override; // vtable+0x18 + void ParseExtra() override; // vtable+0x30 + void Destroy() override; // vtable+0x38 // SYNTHETIC: LEGO1 0x1000cdd0 // LegoModelPresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 5e251563..58ace217 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -37,8 +37,8 @@ class LegoNavController : public MxCore { ); LegoNavController(); - virtual ~LegoNavController() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + ~LegoNavController() override; // vtable+0x00 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10054b80 inline const char* ClassName() const override // vtable+0x0c diff --git a/LEGO1/lego/legoomni/include/legoobjectfactory.h b/LEGO1/lego/legoomni/include/legoobjectfactory.h index 9357ce34..66006588 100644 --- a/LEGO1/lego/legoomni/include/legoobjectfactory.h +++ b/LEGO1/lego/legoomni/include/legoobjectfactory.h @@ -105,8 +105,8 @@ class LegoObjectFactory : public MxObjectFactory { public: LegoObjectFactory(); - virtual MxCore* Create(const char* p_name) override; // vtable 0x14 - virtual void Destroy(MxCore* p_object) override; // vtable 0x18 + MxCore* Create(const char* p_name) override; // vtable 0x14 + void Destroy(MxCore* p_object) override; // vtable 0x18 // SYNTHETIC: LEGO1 0x10009000 // LegoObjectFactory::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index f27bf140..ff973f95 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -28,6 +28,7 @@ class MxBackgroundAudioManager; class MxDSFile; class MxTransitionManager; class ViewLODListManager; +class ViewManager; extern MxAtomId* g_copterScript; extern MxAtomId* g_dunecarScript; @@ -75,33 +76,33 @@ class LegoOmni : public MxOmni { static LegoOmni* GetInstance(); LegoOmni(); - virtual ~LegoOmni(); // vtable+00 + ~LegoOmni() override; // vtable+00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+04 + MxLong Notify(MxParam& p_param) override; // vtable+04 // FUNCTION: LEGO1 0x10058aa0 - inline virtual const char* ClassName() const override // vtable+0c + inline const char* ClassName() const override // vtable+0c { // STRING: LEGO1 0x100f671c return "LegoOmni"; } // FUNCTION: LEGO1 0x10058ab0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+10 + inline MxBool IsA(const char* p_name) const override // vtable+10 { return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name); } - virtual void Init() override; // vtable+14 - virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 - virtual void Destroy() override; // vtable+1c - virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 - virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 - virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 - virtual MxEntity* AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 - virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 - virtual void StartTimer() override; // vtable+38 - virtual void StopTimer() override; // vtable+3c + void Init() override; // vtable+14 + MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 + void Destroy() override; // vtable+1c + MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 + void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 + MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 + MxEntity* AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 + void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 + void StartTimer() override; // vtable+38 + void StopTimer() override; // vtable+3c LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); void AddWorld(LegoWorld* p_world); @@ -125,7 +126,7 @@ class LegoOmni : public MxOmni { LegoUnkSaveDataWriter* GetUnkSaveDataWriter() { return m_saveDataWriter; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } - inline void SetWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } + inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; } inline void CloseMainWindow() { PostMessageA(m_windowHandle, WM_CLOSE, 0, 0); } @@ -164,14 +165,15 @@ LegoROI* PickROI(MxLong, MxLong); LegoSoundManager* SoundManager(); MxTransitionManager* TransitionManager(); LegoVideoManager* VideoManager(); - LegoAnimationManager* AnimationManager(); +LegoNavController* NavController(); LegoBuildingManager* BuildingManager(); LegoControlManager* ControlManager(); -IslePathActor* GetCurrentVehicle(); +IslePathActor* CurrentVehicle(); +ViewManager* GetViewManager(); LegoPlantManager* PlantManager(); -LegoWorld* GetCurrentWorld(); -LegoUnkSaveDataWriter* GetUnkSaveDataWriter(); +LegoWorld* CurrentWorld(); +LegoUnkSaveDataWriter* UnkSaveDataWriter(); GifManager* GetGifManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); void FUN_10015860(const char*, MxU8); diff --git a/LEGO1/lego/legoomni/include/legopalettepresenter.h b/LEGO1/lego/legoomni/include/legopalettepresenter.h index 04ee620b..c9e7fb81 100644 --- a/LEGO1/lego/legoomni/include/legopalettepresenter.h +++ b/LEGO1/lego/legoomni/include/legopalettepresenter.h @@ -10,7 +10,7 @@ class LegoPalettePresenter : public MxVideoPresenter { public: LegoPalettePresenter(); - virtual ~LegoPalettePresenter() override; // vtable+0x00 + ~LegoPalettePresenter() override; // vtable+0x00 // FUNCTION: LEGO1 0x10079f30 inline const char* ClassName() const override // vtable+0x0c @@ -25,8 +25,8 @@ class LegoPalettePresenter : public MxVideoPresenter { return !strcmp(p_name, ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void Destroy() override; // vtable+0x38 + void ReadyTickle() override; // vtable+0x18 + void Destroy() override; // vtable+0x38 MxResult ParsePalette(MxStreamChunk* p_chunk); diff --git a/LEGO1/lego/legoomni/include/legopartpresenter.h b/LEGO1/lego/legoomni/include/legopartpresenter.h index 8f14633d..ab27b0e9 100644 --- a/LEGO1/lego/legoomni/include/legopartpresenter.h +++ b/LEGO1/lego/legoomni/include/legopartpresenter.h @@ -20,9 +20,9 @@ class LegoPartPresenter : public MxMediaPresenter { return !strcmp(p_name, LegoPartPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + void ReadyTickle() override; // vtable+0x18 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 static void configureLegoPartPresenter(MxS32, MxS32); diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index adc1c392..c2a2026c 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -10,7 +10,7 @@ class LegoPathActor : public LegoActor { public: LegoPathActor(); - virtual ~LegoPathActor() override; + ~LegoPathActor() override; // FUNCTION: LEGO1 0x1000c430 inline const char* ClassName() const override // vtable+0x0c @@ -25,7 +25,7 @@ class LegoPathActor : public LegoActor { return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 + void ParseAction(char*) override; // vtable+0x20 virtual void VTable0x68(); // vtable+0x68 virtual void VTable0x6c(); // vtable+0x6c virtual void VTable0x70(float p_float); // vtable+0x70 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 86298726..4ad0b03f 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -8,9 +8,9 @@ class LegoPathController : public MxCore { public: LegoPathController(); - virtual ~LegoPathController() override { Destroy(); } + ~LegoPathController() override { Destroy(); } - virtual MxResult Tickle() override; // vtable+08 + MxResult Tickle() override; // vtable+08 // FUNCTION: LEGO1 0x10045110 inline const char* ClassName() const override // vtable+0x0c @@ -30,6 +30,8 @@ class LegoPathController : public MxCore { virtual void VTable0x14(); // vtable+0x14 virtual void Destroy(); // vtable+0x18 + + void Enable(MxBool p_enable); }; #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/include/legopathcontrollerlist.h b/LEGO1/lego/legoomni/include/legopathcontrollerlist.h index a13557b8..af2642a2 100644 --- a/LEGO1/lego/legoomni/include/legopathcontrollerlist.h +++ b/LEGO1/lego/legoomni/include/legopathcontrollerlist.h @@ -5,6 +5,12 @@ #include "mxlist.h" #include "mxtypes.h" +// VTABLE: LEGO1 0x100d6380 +// class MxCollection + +// VTABLE: LEGO1 0x100d6398 +// class MxList + // VTABLE: LEGO1 0x100d6320 // class MxPtrList @@ -15,20 +21,24 @@ class LegoPathControllerList : public MxPtrList { LegoPathControllerList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x1001d210 - virtual MxS8 Compare(LegoPathController* p_a, LegoPathController* p_b) override + MxS8 Compare(LegoPathController* p_a, LegoPathController* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1001d3d0 - // LegoPathControllerList::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d6380 -// class MxCollection +// VTABLE: LEGO1 0x100d6578 +// class MxListCursor -// VTABLE: LEGO1 0x100d6398 -// class MxList +// VTABLE: LEGO1 0x100d6548 +// class MxPtrListCursor + +// VTABLE: LEGO1 0x100d6560 +// SIZE 0x10 +class LegoPathControllerListCursor : public MxPtrListCursor { +public: + LegoPathControllerListCursor(LegoPathControllerList* p_list) : MxPtrListCursor(p_list){}; +}; // TEMPLATE: LEGO1 0x1001d230 // MxCollection::Compare @@ -48,6 +58,9 @@ class LegoPathControllerList : public MxPtrList { // TEMPLATE: LEGO1 0x1001d3c0 // MxPtrList::Destroy +// SYNTHETIC: LEGO1 0x1001d3d0 +// LegoPathControllerList::`scalar deleting destructor' + // TEMPLATE: LEGO1 0x1001d440 // MxPtrList::~MxPtrList @@ -63,4 +76,22 @@ class LegoPathControllerList : public MxPtrList { // SYNTHETIC: LEGO1 0x1001d620 // LegoPathControllerList::~LegoPathControllerList +// SYNTHETIC: LEGO1 0x1001f830 +// LegoPathControllerListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001f8a0 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x1001f8f0 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001f960 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001f9d0 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x1001fa20 +// LegoPathControllerListCursor::~LegoPathControllerListCursor + #endif // LEGOPATHCONTROLLERLIST_H diff --git a/LEGO1/lego/legoomni/include/legopathpresenter.h b/LEGO1/lego/legoomni/include/legopathpresenter.h index ab66a5df..e6c5da14 100644 --- a/LEGO1/lego/legoomni/include/legopathpresenter.h +++ b/LEGO1/lego/legoomni/include/legopathpresenter.h @@ -8,7 +8,7 @@ class LegoPathPresenter : public MxMediaPresenter { public: LegoPathPresenter(); - virtual ~LegoPathPresenter() override; + ~LegoPathPresenter() override; // FUNCTION: LEGO1 0x100449a0 inline const char* ClassName() const override // vtable+0x0c @@ -23,12 +23,12 @@ class LegoPathPresenter : public MxMediaPresenter { return !strcmp(p_name, LegoPathPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + void ReadyTickle() override; // vtable+0x18 + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 // SYNTHETIC: LEGO1 0x10044a90 // LegoPathPresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legophonemepresenter.h b/LEGO1/lego/legoomni/include/legophonemepresenter.h index 2a2ec497..db86a1e5 100644 --- a/LEGO1/lego/legoomni/include/legophonemepresenter.h +++ b/LEGO1/lego/legoomni/include/legophonemepresenter.h @@ -11,7 +11,7 @@ class LegoPhonemePresenter : public MxFlcPresenter { public: LegoPhonemePresenter(); - virtual ~LegoPhonemePresenter() override; // vtable+0x00 + ~LegoPhonemePresenter() override; // vtable+0x00 // FUNCTION: LEGO1 0x1004e310 inline const char* ClassName() const override // vtable+0x0c @@ -20,10 +20,10 @@ class LegoPhonemePresenter : public MxFlcPresenter { return "LegoPhonemePresenter"; } - virtual void StartingTickle() override; // vtable+0x1c - virtual void EndAction() override; // vtable+0x40 - virtual void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 - virtual void PutFrame() override; // vtable+0x6c + void StartingTickle() override; // vtable+0x1c + void EndAction() override; // vtable+0x40 + void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 + void PutFrame() override; // vtable+0x6c // SYNTHETIC: LEGO1 0x1004e320 // LegoPhonemePresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index e1335e33..bc96de5a 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -9,9 +9,9 @@ class LegoPlantManager : public MxCore { public: LegoPlantManager(); - virtual ~LegoPlantManager() override; // vtable+0x00 + ~LegoPlantManager() override; // vtable+0x00 - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10026290 inline const char* ClassName() const override // vtable+0x0c diff --git a/LEGO1/lego/legoomni/include/legopointofviewcontroller.h b/LEGO1/lego/legoomni/include/legopointofviewcontroller.h index 27a58291..b6db3014 100644 --- a/LEGO1/lego/legoomni/include/legopointofviewcontroller.h +++ b/LEGO1/lego/legoomni/include/legopointofviewcontroller.h @@ -20,7 +20,7 @@ class LegoNavController; class LegoMouseController : public MxCore { public: LegoMouseController(); - virtual ~LegoMouseController() override; + ~LegoMouseController() override; virtual void LeftDown(int, int); // vtable+0x14 virtual void LeftDrag(int, int); // vtable+0x18 @@ -44,14 +44,14 @@ class LegoMouseController : public MxCore { class LegoPointOfViewController : public LegoMouseController { public: LegoPointOfViewController(); - virtual ~LegoPointOfViewController() override; + ~LegoPointOfViewController() override; - virtual MxResult Tickle() override; // vtable+0x08 - virtual void LeftDown(int p_x, int p_y) override; // vtable+0x0c - virtual void LeftDrag(int p_x, int p_y) override; // vtable+0x10 + MxResult Tickle() override; // vtable+0x08 + void LeftDown(int p_x, int p_y) override; // vtable+0x0c + void LeftDrag(int p_x, int p_y) override; // vtable+0x10 // FUNCTION: LEGO1 0x10011e40 - virtual void LeftUp(int p_x, int p_y) override + void LeftUp(int p_x, int p_y) override { LegoMouseController::LeftUp(p_x, p_y); AffectPointOfView(); @@ -59,7 +59,7 @@ class LegoPointOfViewController : public LegoMouseController { // vtable+0x14 // FUNCTION: LEGO1 0x10011e60 - virtual void RightDown(int p_x, int p_y) override + void RightDown(int p_x, int p_y) override { LegoMouseController::RightDown(p_x, p_y); AffectPointOfView(); @@ -67,7 +67,7 @@ class LegoPointOfViewController : public LegoMouseController { // vtable+0x20 // FUNCTION: LEGO1 0x10011e80 - virtual void RightDrag(int p_x, int p_y) override + void RightDrag(int p_x, int p_y) override { LegoMouseController::RightDrag(p_x, p_y); AffectPointOfView(); @@ -75,7 +75,7 @@ class LegoPointOfViewController : public LegoMouseController { // vtable+0x24 // FUNCTION: LEGO1 0x10011ea0 - virtual void RightUp(int p_x, int p_y) override + void RightUp(int p_x, int p_y) override { LegoMouseController::RightUp(p_x, p_y); AffectPointOfView(); @@ -86,6 +86,7 @@ class LegoPointOfViewController : public LegoMouseController { void OnViewSize(int p_width, int p_height); inline LegoEntity* GetEntity() { return m_entity; } + inline LegoNavController* GetNavController() { return m_nav; } protected: void AffectPointOfView(); diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 1ebf015a..c8b02f2e 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -11,9 +11,9 @@ class LegoRace : public LegoWorld { public: LegoRace(); - virtual ~LegoRace() override; // vtable+0x00 + ~LegoRace() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10015ba0 inline const char* ClassName() const override // vtable+0x0c @@ -28,15 +28,15 @@ class LegoRace : public LegoWorld { return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 - virtual undefined4 VTable0x6c(undefined4) = 0; // vtable+0x6c - virtual undefined4 VTable0x70(undefined4); // vtable+0x70 - virtual undefined4 VTable0x74(undefined4); // vtable+0x74 - virtual undefined4 VTable0x78(undefined4); // vtable+0x78 - virtual void VTable0x7c(undefined4, undefined4); // vtable+0x7c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 + virtual undefined4 VTable0x6c(undefined4) = 0; // vtable+0x6c + virtual undefined4 VTable0x70(undefined4); // vtable+0x70 + virtual undefined4 VTable0x74(undefined4); // vtable+0x74 + virtual undefined4 VTable0x78(undefined4); // vtable+0x78 + virtual void VTable0x7c(undefined4, undefined4); // vtable+0x7c // SYNTHETIC: LEGO1 0x10015cc0 // LegoRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoraceactor.h b/LEGO1/lego/legoomni/include/legoraceactor.h index 40eb6ef6..48f66b26 100644 --- a/LEGO1/lego/legoomni/include/legoraceactor.h +++ b/LEGO1/lego/legoomni/include/legoraceactor.h @@ -20,13 +20,13 @@ class LegoRaceActor : public LegoAnimActor { return !strcmp(p_name, LegoRaceActor::ClassName()) || LegoAnimActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - virtual void VTable0x68() override; // vtable+0x68 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - virtual MxS32 VTable0x90() override; // vtable+0x90 - virtual MxS32 VTable0x94() override; // vtable+0x94 + void ParseAction(char*) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void VTable0x68() override; // vtable+0x68 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + MxS32 VTable0x90() override; // vtable+0x90 + MxS32 VTable0x94() override; // vtable+0x94 // SYNTHETIC: LEGO1 0x10014ab0 // LegoRaceActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index beb70632..f90c4cad 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -8,7 +8,7 @@ // SIZE 0x200 class LegoRaceCar : public LegoCarRaceActor { public: - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x10014290 inline const char* ClassName() const override // vtable+0x0c @@ -23,13 +23,13 @@ class LegoRaceCar : public LegoCarRaceActor { return !strcmp(p_name, LegoCarRaceActor::ClassName()) || LegoCarRaceActor::IsA(p_name); } - virtual void ParseAction(char*) override; // vtable+0x20 - virtual void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - virtual void VTable0x6c() override; // vtable+0x6c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxS32 VTable0x94() override; // vtable+0x94 - virtual void VTable0x98() override; // vtable+0x98 - virtual void VTable0x9c() override; // vtable+0x9c + void ParseAction(char*) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + void VTable0x6c() override; // vtable+0x6c + void VTable0x70(float p_float) override; // vtable+0x70 + MxS32 VTable0x94() override; // vtable+0x94 + void VTable0x98() override; // vtable+0x98 + void VTable0x9c() override; // vtable+0x9c // SYNTHETIC: LEGO1 0x10014230 // LegoRaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legosoundmanager.h b/LEGO1/lego/legoomni/include/legosoundmanager.h index b1afffe3..89e51165 100644 --- a/LEGO1/lego/legoomni/include/legosoundmanager.h +++ b/LEGO1/lego/legoomni/include/legosoundmanager.h @@ -9,11 +9,11 @@ class LegoSoundManager : public MxSoundManager { public: LegoSoundManager(); - virtual ~LegoSoundManager() override; + ~LegoSoundManager() override; - virtual MxResult Tickle() override; // vtable+08 - virtual void Destroy() override; // vtable+18 - virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x30 + MxResult Tickle() override; // vtable+08 + void Destroy() override; // vtable+18 + MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x30 // SYNTHETIC: LEGO1 0x10029920 // LegoSoundManager::`scalar deleting destructor' @@ -24,8 +24,11 @@ class LegoSoundManager : public MxSoundManager { void Init(); void Destroy(MxBool p_fromDestructor); - undefined4 m_unk0x3c; // 0x3c - LegoUnknown100d6b4c* m_unk0x40; // 0x40 + LPDIRECTSOUND3DLISTENER m_listener; // 0x3c + LegoUnknown100d6b4c* m_unk0x40; // 0x40 }; +// GLOBAL: LEGO1 0x100db6d0 +// IID_IDirectSound3DListener + #endif // LEGOSOUNDMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index 41942312..2ed94a3e 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -11,17 +11,17 @@ class LegoState : public MxCore { public: // FUNCTION: LEGO1 0x10005f40 - virtual ~LegoState() override {} + ~LegoState() override {} // FUNCTION: LEGO1 0x100060d0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f01b8 return "LegoState"; } // FUNCTION: LEGO1 0x100060e0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); } @@ -43,6 +43,55 @@ class LegoState : public MxCore { // SYNTHETIC: LEGO1 0x10006160 // LegoState::`scalar deleting destructor' + + // SIZE 0x0c + class Playlist { + public: + enum Mode { + e_loop, + e_once, + e_random, + e_loopSkipFirst + }; + + // FUNCTION: LEGO1 0x10017c00 + Playlist() + { + m_objectIds = NULL; + m_length = 0; + m_mode = e_loop; + m_nextIndex = 0; + } + + Playlist(MxU32* p_objectIds, MxS16 p_length) + { + m_objectIds = p_objectIds; + m_length = p_length; + m_mode = e_loop; + m_nextIndex = 0; + } + + // FUNCTION: LEGO1 0x10071800 + Playlist& operator=(const Playlist& p_shuffle) + { + m_objectIds = p_shuffle.m_objectIds; + m_length = p_shuffle.m_length; + m_nextIndex = p_shuffle.m_nextIndex; + m_mode = p_shuffle.m_mode; + return *this; + } + + MxU32 Next(); + MxBool Contains(MxU32 p_objectId); + + inline void SetUnknown0x08(MxS16 p_unk0x08) { m_nextIndex = p_unk0x08; } + + private: + MxU32* m_objectIds; // 0x00 + MxS16 m_length; // 0x04 + MxS16 m_mode; // 0x06 + MxS16 m_nextIndex; // 0x08 + }; }; #endif // LEGOSTATE_H diff --git a/LEGO1/lego/legoomni/include/legotexturepresenter.h b/LEGO1/lego/legoomni/include/legotexturepresenter.h index ca6541df..472c5828 100644 --- a/LEGO1/lego/legoomni/include/legotexturepresenter.h +++ b/LEGO1/lego/legoomni/include/legotexturepresenter.h @@ -7,24 +7,24 @@ // SIZE 0x54 (from inlined construction at 0x10009bb5) class LegoTexturePresenter : public MxMediaPresenter { public: - virtual ~LegoTexturePresenter() override; + ~LegoTexturePresenter() override; // FUNCTION: LEGO1 0x1000ce50 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0664 return "LegoTexturePresenter"; } // FUNCTION: LEGO1 0x1000ce60 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoTexturePresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void DoneTickle() override; // vtable+0x2c - virtual MxResult AddToManager() override; // vtable+0x34 - virtual MxResult PutData() override; // vtable+0x4c + void DoneTickle() override; // vtable+0x2c + MxResult AddToManager() override; // vtable+0x34 + MxResult PutData() override; // vtable+0x4c // SYNTHETIC: LEGO1 0x1000cf40 // LegoTexturePresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legounknown100d6b4c.h b/LEGO1/lego/legoomni/include/legounknown100d6b4c.h index 9b10bd50..18192f9a 100644 --- a/LEGO1/lego/legoomni/include/legounknown100d6b4c.h +++ b/LEGO1/lego/legoomni/include/legounknown100d6b4c.h @@ -2,6 +2,7 @@ #define LEGOUNKNOWN100D6B4C_H #include "decomp.h" +#include "mxtypes.h" class LegoCacheSound; @@ -9,7 +10,15 @@ class LegoCacheSound; // SIZE 0x20 class LegoUnknown100d6b4c { public: + LegoUnknown100d6b4c(); + ~LegoUnknown100d6b4c(); + + virtual MxResult Tickle(); // vtable+0x00 + void FUN_1003dc40(LegoCacheSound** p_und); + +private: + undefined m_pad[0x1c]; }; #endif // LEGOUNKNOWN100D6B4C_H diff --git a/LEGO1/lego/legoomni/include/legounknown100d9d00.h b/LEGO1/lego/legoomni/include/legounknown100d9d00.h index 394ffbbd..0c567b17 100644 --- a/LEGO1/lego/legoomni/include/legounknown100d9d00.h +++ b/LEGO1/lego/legoomni/include/legounknown100d9d00.h @@ -18,7 +18,7 @@ class LegoUnknown100d9d00 : public MxList { LegoUnknown100d9d00() { SetDestroy(Destroy); } // STUB: LEGO1 0x1007b210 - virtual MxS8 Compare(LegoUnknown100d7c88* p_a, LegoUnknown100d7c88* p_b) override { return -1; } // vtable+0x14 + MxS8 Compare(LegoUnknown100d7c88* p_a, LegoUnknown100d7c88* p_b) override { return -1; } // vtable+0x14 // FUNCTION: LEGO1 0x1007b2e0 static void Destroy(LegoUnknown100d7c88* p_element) { delete p_element; } diff --git a/LEGO1/lego/legoomni/include/legoutil.h b/LEGO1/lego/legoomni/include/legoutil.h index 75e51c20..696a1cc4 100644 --- a/LEGO1/lego/legoomni/include/legoutil.h +++ b/LEGO1/lego/legoomni/include/legoutil.h @@ -2,6 +2,9 @@ #define LEGOUTIL_H #include "extra.h" +#include "misc/legostorage.h" +#include "misc/legotexture.h" +#include "mxstring.h" #include "mxtypes.h" #include "mxutil.h" @@ -11,6 +14,23 @@ class MxAtomId; class LegoEntity; class LegoAnimPresenter; +class LegoTexture; + +// SIZE 0x14 +class NamedTexture { +public: + ~NamedTexture() { delete m_texture; } + + // FUNCTION: LEGO1 0x1003f920 + const MxString* GetName() const { return &m_name; } + + LegoTexture* GetTexture() { return m_texture; } + +private: + MxString m_name; // 0x00 + LegoTexture* m_texture; // 0x04 +}; + void FUN_1003e050(LegoAnimPresenter* p_presenter); Extra::ActionType MatchActionString(const char*); void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender); @@ -19,5 +39,12 @@ MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool); void SetAppCursor(WPARAM p_wparam); MxBool FUN_1003ef60(); +MxBool RemoveFromWorld(MxAtomId& p_atomId1, MxS32 p_id1, MxAtomId& p_atomId2, MxS32 p_id2); +NamedTexture* ReadNamedTexture(LegoFile* p_file); +void FUN_1003f540(LegoFile* p_file, const char* p_filename); +void WriteNamedTexture(LegoFile* p_file, NamedTexture* p_texture); + +// SYNTHETIC: LEGO1 0x10034b40 +// LegoTexture::`scalar deleting destructor' #endif // LEGOUTIL_H diff --git a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h index b0463448..229fdcfb 100644 --- a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h +++ b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h @@ -12,34 +12,24 @@ class LegoVehicleBuildState : public LegoState { LegoVehicleBuildState(char* p_classType); // FUNCTION: LEGO1 0x10025ff0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { return this->m_className.GetData(); } // FUNCTION: LEGO1 0x10026000 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x100260a0 // LegoVehicleBuildState::`scalar deleting destructor' -public: - struct UnkStruct { - undefined4 m_unk0x00; // 0x00 - undefined2 m_unk0x04; // 0x04 - undefined2 m_unk0x06; // 0x06 - undefined2 m_unk0x08; // 0x08 - - UnkStruct(); - }; - private: - UnkStruct m_unk0x08[4]; // 0x08 + Playlist m_unk0x08[4]; // 0x08 // This can be one of the following: // * LegoRaceCarBuildState diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index 42a065b9..bb43c05c 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -17,7 +17,7 @@ class LegoROI; class LegoVideoManager : public MxVideoManager { public: LegoVideoManager(); - virtual ~LegoVideoManager() override; + ~LegoVideoManager() override; int EnableRMDevice(); int DisableRMDevice(); @@ -25,13 +25,12 @@ class LegoVideoManager : public MxVideoManager { void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale); void MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY); - virtual MxResult Tickle() override; // vtable+0x08 - virtual void Destroy() override; // vtable+0x18 - virtual MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread) - override; // vtable+0x2c - virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30 - virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34 - virtual MxPresenter* GetPresenterAt(MxS32 p_x, MxS32 p_y); // vtable+0x38 + MxResult Tickle() override; // vtable+0x08 + void Destroy() override; // vtable+0x18 + MxResult Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x2c + MxResult RealizePalette(MxPalette*) override; // vtable+0x30 + void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34 + virtual MxPresenter* GetPresenterAt(MxS32 p_x, MxS32 p_y); // vtable+0x38 // FUNCTION: LEGO1 0x1007ab10 virtual LegoUnknown100d9d00* VTable0x3c() { return m_unk0x100d9d00; } // vtable+0x3c diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 7e995e73..98dbbd5c 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -33,36 +33,36 @@ class LegoWorld : public LegoEntity { }; LegoWorld(); - virtual ~LegoWorld() override; // vtable+0x00 + ~LegoWorld() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1001d690 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0058 return "LegoWorld"; } // FUNCTION: LEGO1 0x1001d6a0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoWorld::ClassName()) || LegoEntity::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - virtual void ReadyWorld(); // vtable+0x50 - virtual LegoCameraController* VTable0x54(); // vtable+0x54 - virtual void Add(MxCore* p_object); // vtable+0x58 - virtual MxBool VTable0x5c(); // vtable+0x5c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + virtual void ReadyWorld(); // vtable+0x50 + virtual LegoCameraController* VTable0x54(); // vtable+0x54 + virtual void Add(MxCore* p_object); // vtable+0x58 + virtual MxBool VTable0x5c(); // vtable+0x5c // FUNCTION: LEGO1 0x100010a0 virtual void VTable0x60() {} // vtable+0x60 - virtual MxBool VTable0x64(); // vtable+0x64 - virtual void VTable0x68(MxBool p_add); // vtable+0x68 + virtual MxBool VTable0x64(); // vtable+0x64 + virtual void Enable(MxBool p_enable); // vtable+0x68 inline LegoCameraController* GetCamera() { return m_cameraController; } inline undefined4 GetUnknown0xec() { return m_unk0xec; } diff --git a/LEGO1/lego/legoomni/include/legoworldlist.h b/LEGO1/lego/legoomni/include/legoworldlist.h index 6467859c..bd8197bc 100644 --- a/LEGO1/lego/legoomni/include/legoworldlist.h +++ b/LEGO1/lego/legoomni/include/legoworldlist.h @@ -22,10 +22,7 @@ class LegoWorldList : public MxPtrList { LegoWorldList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x100598d0 - virtual MxS8 Compare(LegoWorld* p_a, LegoWorld* p_b) override - { - return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; - } // vtable+0x14 + MxS8 Compare(LegoWorld* p_a, LegoWorld* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 // SYNTHETIC: LEGO1 0x10059a00 // LegoWorldList::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoworldpresenter.h b/LEGO1/lego/legoomni/include/legoworldpresenter.h index 3d0fba37..a9a7f324 100644 --- a/LEGO1/lego/legoomni/include/legoworldpresenter.h +++ b/LEGO1/lego/legoomni/include/legoworldpresenter.h @@ -8,28 +8,28 @@ class LegoWorldPresenter : public LegoEntityPresenter { public: LegoWorldPresenter(); - virtual ~LegoWorldPresenter() override; // vtable+0x00 + ~LegoWorldPresenter() override; // vtable+0x00 static void configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality); // FUNCTION: LEGO1 0x10066630 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0608 return "LegoWorldPresenter"; } // FUNCTION: LEGO1 0x10066640 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoWorldPresenter::ClassName()) || LegoEntityPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - virtual void VTable0x60(MxPresenter* p_presenter) override; // vtable+0x60 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void ParseExtra() override; // vtable+0x30 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void VTable0x60(MxPresenter* p_presenter) override; // vtable+0x60 // SYNTHETIC: LEGO1 0x10066750 // LegoWorldPresenter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index 6505f35b..cf3f376f 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -11,24 +11,24 @@ class Motocycle : public IslePathActor { Motocycle(); // FUNCTION: LEGO1 0x10035840 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f38e8 return "Motorcycle"; } // FUNCTION: LEGO1 0x10035850 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x100359d0 // Motocycle::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h index 787484b0..3e7793f6 100644 --- a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h +++ b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h @@ -13,24 +13,26 @@ class MxBackgroundAudioManager : public MxCore { public: MxBackgroundAudioManager(); - virtual ~MxBackgroundAudioManager() override; + ~MxBackgroundAudioManager() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1007eb70 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7ac4 return "MxBackgroundAudioManager"; } // FUNCTION: LEGO1 0x1007eb80 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxBackgroundAudioManager::ClassName()) || MxCore::IsA(p_name); } + inline MxBool GetMusicEnabled() { return m_musicEnabled; } + void StartAction(MxParam& p_param); void StopAction(MxParam& p_param); MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c); @@ -54,16 +56,16 @@ class MxBackgroundAudioManager : public MxCore { MxResult OpenMusic(MxAtomId& p_script); void DestroyMusic(); - MxBool m_musicEnabled; // 0x08 - MxDSAction m_action1; // 0x0c - MxAudioPresenter* m_unk0xa0; - MxDSAction m_action2; // 0xa4 - MxAudioPresenter* m_unk0x138; - MxS32 m_unk0x13c; - MxS32 m_unk0x140; - MxS32 m_targetVolume; - MxS16 m_unk0x148; - MxAtomId m_script; + MxBool m_musicEnabled; // 0x08 + MxDSAction m_action1; // 0x0c + MxAudioPresenter* m_unk0xa0; // 0xa0 + MxDSAction m_action2; // 0xa4 + MxAudioPresenter* m_unk0x138; // 0x138 + MxS32 m_unk0x13c; // 0x13c + MxS32 m_unk0x140; // 0x140 + MxS32 m_targetVolume; // 0x144 + MxS16 m_unk0x148; // 0x148 + MxAtomId m_script; // 0x14c }; #endif // MXBACKGROUNDAUDIOMANAGER_H diff --git a/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h b/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h index ed6f1335..efba804f 100644 --- a/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h +++ b/LEGO1/lego/legoomni/include/mxcompositemediapresenter.h @@ -8,26 +8,26 @@ class MxCompositeMediaPresenter : public MxCompositePresenter { public: MxCompositeMediaPresenter(); - virtual ~MxCompositeMediaPresenter() override; + ~MxCompositeMediaPresenter() override; - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10073f10 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f02d4 return "MxCompositeMediaPresenter"; } // FUNCTION: LEGO1 0x10073f20 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxCompositeMediaPresenter::ClassName()) || MxCompositePresenter::IsA(p_name); } - virtual void StartingTickle() override; // vtable+0x1c - virtual MxResult StartAction(MxStreamController*, MxDSAction* p_action) override; // vtable+0x3c - virtual MxResult PutData() override; // vtable+0x4c + void StartingTickle() override; // vtable+0x1c + MxResult StartAction(MxStreamController*, MxDSAction* p_action) override; // vtable+0x3c + MxResult PutData() override; // vtable+0x4c private: MxS16 m_unk0x4c; // 0x4c diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index 0903f557..e12c1a25 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -12,39 +12,37 @@ class MxVideoPresenter; class MxControlPresenter : public MxCompositePresenter { public: MxControlPresenter(); - virtual ~MxControlPresenter() override; + ~MxControlPresenter() override; // FUNCTION: LEGO1 0x10044000 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0514 return "MxControlPresenter"; } // FUNCTION: LEGO1 0x10044010 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxControlPresenter::ClassName()) || MxCompositePresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c - virtual void EndAction() override; // vtable+0x40 - virtual MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48 - virtual void Enable(MxBool p_enable) override; // vtable+0x54 - virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 - virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 - virtual void VTable0x6c(MxS16); // vtable+0x6c + void ReadyTickle() override; // vtable+0x18 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 + MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48 + void Enable(MxBool p_enable) override; // vtable+0x54 + MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 + virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 + virtual void VTable0x6c(MxS16); // vtable+0x6c MxBool FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter); + MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter); private: - MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter); - void FUN_10044540(undefined2); - undefined2 m_unk0x4c; // 0x4c MxS16 m_unk0x4e; // 0x4e MxBool m_unk0x50; // 0x50 diff --git a/LEGO1/lego/legoomni/include/mxtransitionmanager.h b/LEGO1/lego/legoomni/include/mxtransitionmanager.h index ab673b11..89f0d73b 100644 --- a/LEGO1/lego/legoomni/include/mxtransitionmanager.h +++ b/LEGO1/lego/legoomni/include/mxtransitionmanager.h @@ -11,20 +11,20 @@ class MxTransitionManager : public MxCore { public: MxTransitionManager(); - virtual ~MxTransitionManager() override; // vtable+0x00 + ~MxTransitionManager() override; // vtable+0x00 void SetWaitIndicator(MxVideoPresenter* p_waitIndicator); - virtual MxResult Tickle(); // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1004b950 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { return "MxTransitionManager"; } // FUNCTION: LEGO1 0x1004b960 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxTransitionManager::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index b2679fd1..5ba1da94 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -13,12 +13,12 @@ class Pizza : public IsleActor { public: Pizza(); - virtual ~Pizza() override; + ~Pizza() override; - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10037f90 - inline const char* ClassName() const // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f038c return "Pizza"; @@ -30,7 +30,7 @@ class Pizza : public IsleActor { return !strcmp(p_name, Pizza::ClassName()) || IsleActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 // SYNTHETIC: LEGO1 0x100380e0 // Pizza::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/pizzamissionstate.h b/LEGO1/lego/legoomni/include/pizzamissionstate.h index e8668544..1b111c43 100644 --- a/LEGO1/lego/legoomni/include/pizzamissionstate.h +++ b/LEGO1/lego/legoomni/include/pizzamissionstate.h @@ -18,19 +18,19 @@ struct PizzaMissionStateEntry { class PizzaMissionState : public LegoState { public: // FUNCTION: LEGO1 0x10039290 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00d4 return "PizzaMissionState"; } // FUNCTION: LEGO1 0x100392a0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; } diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index f75cf0a7..49c4960a 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -8,19 +8,19 @@ class Pizzeria : public IsleActor { public: // FUNCTION: LEGO1 0x1000e780 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0380 return "Pizzeria"; } // FUNCTION: LEGO1 0x1000e790 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Pizzeria::ClassName()) || IsleActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 // SYNTHETIC: LEGO1 0x1000e8d0 // Pizzeria::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/pizzeriastate.h b/LEGO1/lego/legoomni/include/pizzeriastate.h index 1e9da6d3..b4d6b0fe 100644 --- a/LEGO1/lego/legoomni/include/pizzeriastate.h +++ b/LEGO1/lego/legoomni/include/pizzeriastate.h @@ -10,19 +10,19 @@ class PizzeriaState : public LegoState { PizzeriaState(); // FUNCTION: LEGO1 0x10017c20 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0370 return "PizzeriaState"; } // FUNCTION: LEGO1 0x10017c30 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10017ce0 // PizzeriaState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index cb82ee35..798fc0a2 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -13,36 +13,40 @@ class Police : public LegoWorld { public: Police(); - virtual ~Police() override; // vtable+0x00 + ~Police() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1005e1e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0450 return "Police"; } // FUNCTION: LEGO1 0x1005e1f0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Police::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x5c() override; // vtable+0x5c - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1005e300 // Police::`scalar deleting destructor' private: - Radio m_radio; // 0xf8 - PoliceState* m_policeState; // 0x108 - undefined4 m_unk0x10c; // 0x10c + MxLong HandleNotification11(MxNotificationParam& p_param); + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleKeyPress(LegoEventNotificationParam& p_param); + + Radio m_radio; // 0xf8 + PoliceState* m_policeState; // 0x108 + undefined4 m_transitionDestination; // 0x10c }; #endif // POLICE_H diff --git a/LEGO1/lego/legoomni/include/policeentity.h b/LEGO1/lego/legoomni/include/policeentity.h index 490e35a3..acf0937b 100644 --- a/LEGO1/lego/legoomni/include/policeentity.h +++ b/LEGO1/lego/legoomni/include/policeentity.h @@ -8,14 +8,14 @@ class PoliceEntity : public BuildingEntity { public: // FUNCTION: LEGO1 0x1000ed60 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0328 return "PoliceEntity"; } // FUNCTION: LEGO1 0x1000ed70 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/policestate.h b/LEGO1/lego/legoomni/include/policestate.h index 33799092..551d83c4 100644 --- a/LEGO1/lego/legoomni/include/policestate.h +++ b/LEGO1/lego/legoomni/include/policestate.h @@ -9,22 +9,22 @@ class PoliceState : public LegoState { public: PoliceState(); - virtual ~PoliceState() override {} + ~PoliceState() override {} // FUNCTION: LEGO1 0x1005e860 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0444 return "PoliceState"; } // FUNCTION: LEGO1 0x1005e870 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x1005e920 // PoliceState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/racecar.h b/LEGO1/lego/legoomni/include/racecar.h index 596473b4..462c2dbe 100644 --- a/LEGO1/lego/legoomni/include/racecar.h +++ b/LEGO1/lego/legoomni/include/racecar.h @@ -9,23 +9,23 @@ class RaceCar : public IslePathActor { public: RaceCar(); - virtual ~RaceCar() override; // vtable+0x00 + ~RaceCar() override; // vtable+0x00 // FUNCTION: LEGO1 0x10028270 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03e0 return "RaceCar"; } // FUNCTION: LEGO1 0x10028280 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, RaceCar::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxU32 VTable0xcc() override; // vtable+0xcc + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxU32 VTable0xcc() override; // vtable+0xcc // SYNTHETIC: LEGO1 0x10028400 // RaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/racestandsentity.h b/LEGO1/lego/legoomni/include/racestandsentity.h index b2ca8ef3..5b5b83e5 100644 --- a/LEGO1/lego/legoomni/include/racestandsentity.h +++ b/LEGO1/lego/legoomni/include/racestandsentity.h @@ -7,14 +7,14 @@ // SIZE 0x68 class RaceStandsEntity : public BuildingEntity { // FUNCTION: LEGO1 0x1000efa0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0300 return "RaceStandsEntity"; } // FUNCTION: LEGO1 0x1000efb0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); } diff --git a/LEGO1/lego/legoomni/include/racestate.h b/LEGO1/lego/legoomni/include/racestate.h index 3bbb86f6..987d3a69 100644 --- a/LEGO1/lego/legoomni/include/racestate.h +++ b/LEGO1/lego/legoomni/include/racestate.h @@ -18,19 +18,19 @@ class RaceState : public LegoState { RaceState(); // FUNCTION: LEGO1 0x10016010 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07d0 return "RaceState"; } // FUNCTION: LEGO1 0x10016020 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; } diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 4edf734f..23ddb276 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -1,40 +1,51 @@ #ifndef RADIO_H #define RADIO_H +#include "legocontrolmanager.h" +#include "mxactionnotificationparam.h" #include "mxcore.h" #include "radiostate.h" // VTABLE: LEGO1 0x100d6d10 +// SIZE 0x10 class Radio : public MxCore { public: Radio(); - virtual ~Radio() override; + ~Radio() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x1002c8e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f328c return "Radio"; } // FUNCTION: LEGO1 0x1002c8f0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Radio::ClassName()) || MxCore::IsA(p_name); } void Initialize(MxBool p_und); + void Play(); + void Stop(); + + inline RadioState* GetState() { return m_state; } // SYNTHETIC: LEGO1 0x1002c970 // Radio::`scalar deleting destructor' private: - RadioState* m_state; // 0x08 - MxBool m_unk0x0c; // 0x0c - void CreateRadioState(); + + RadioState* m_state; // 0x08 + MxBool m_unk0x0c; // 0x0c + MxBool m_bgAudioPreviouslyEnabled; // 0x0d + + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleClick(LegoControlManagerEvent& p_param); }; #endif // RADIO_H diff --git a/LEGO1/lego/legoomni/include/radiostate.h b/LEGO1/lego/legoomni/include/radiostate.h index 68dc154a..6dcdafd9 100644 --- a/LEGO1/lego/legoomni/include/radiostate.h +++ b/LEGO1/lego/legoomni/include/radiostate.h @@ -2,6 +2,7 @@ #define RADIOSTATE_H #include "legostate.h" +#include "mxdsaction.h" // VTABLE: LEGO1 0x100d6d28 // SIZE 0x30 @@ -10,22 +11,34 @@ class RadioState : public LegoState { RadioState(); // FUNCTION: LEGO1 0x1002cf60 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04f8 return "RadioState"; } // FUNCTION: LEGO1 0x1002cf70 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, RadioState::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; // vtable+0x14 + MxBool VTable0x14() override; // vtable+0x14 // SYNTHETIC: LEGO1 0x1002d020 // RadioState::`scalar deleting destructor' + + inline MxBool IsActive() { return m_active; } + + inline void SetActive(MxBool p_active) { m_active = p_active; } + + undefined4 FUN_1002d090(); + MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId); + +private: + Playlist m_unk0x08[3]; // 0x08 + MxS16 m_unk0x2c; // 0x2c + MxBool m_active; // 0x2e }; #endif // RADIOSTATE_H diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index 123fea45..70239505 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -8,28 +8,28 @@ class RegistrationBook : public LegoWorld { public: RegistrationBook(); - virtual ~RegistrationBook() override; // vtable+0x00 + ~RegistrationBook() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Tickle() override; // vtable+0x08 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x10076e10 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f04c8 return "RegistrationBook"; } // FUNCTION: LEGO1 0x10076e20 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, RegistrationBook::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void ReadyWorld() override; // vtable+0x50 - virtual MxBool VTable0x64() override; // vtable+0x64 - virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x64() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10076f30 // RegistrationBook::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 03d69eb8..2f03abe5 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -12,18 +12,18 @@ class Score : public LegoWorld { public: Score(); - virtual ~Score() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + ~Score() override; // vtable+0x00 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100010c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0050 return "Score"; } // FUNCTION: LEGO1 0x100010d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, Score::ClassName()) || LegoWorld::IsA(p_name); } @@ -31,11 +31,11 @@ class Score : public LegoWorld { // SYNTHETIC: LEGO1 0x100011e0 // Score::`scalar deleting destructor' - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+18 - virtual void ReadyWorld() override; // vtable+50 - virtual MxBool VTable0x5c() override; // vtable+5c - virtual MxBool VTable0x64() override; // vtable+64 - virtual void VTable0x68(MxBool p_add) override; // vtable+68 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+18 + void ReadyWorld() override; // vtable+50 + MxBool VTable0x5c() override; // vtable+5c + MxBool VTable0x64() override; // vtable+64 + void Enable(MxBool p_enable) override; // vtable+68 void Paint(); MxLong FUN_10001510(MxEndActionNotificationParam& p_param); diff --git a/LEGO1/lego/legoomni/include/scorestate.h b/LEGO1/lego/legoomni/include/scorestate.h index e02c2e56..78609c02 100644 --- a/LEGO1/lego/legoomni/include/scorestate.h +++ b/LEGO1/lego/legoomni/include/scorestate.h @@ -8,20 +8,20 @@ class ScoreState : public LegoState { public: // FUNCTION: LEGO1 0x1000de40 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0084 return "ScoreState"; } // FUNCTION: LEGO1 0x1000de50 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; // vtable+0x14 - virtual MxBool SetFlag() override; // vtable+0x18 + MxBool VTable0x14() override; // vtable+0x14 + MxBool SetFlag() override; // vtable+0x18 inline MxBool GetTutorialFlag() { return m_playCubeTutorial; } inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 4f97d87c..628e26f5 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -11,23 +11,23 @@ class SkateBoard : public IslePathActor { SkateBoard(); // FUNCTION: LEGO1 0x1000fdd0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f041c return "SkateBoard"; } // FUNCTION: LEGO1 0x1000fde0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd0() override; // vtable+0xd0 - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd0() override; // vtable+0xd0 + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x1000ff60 // SkateBoard::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index a79f75fb..85e54e6b 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -11,26 +11,26 @@ class TowTrack : public IslePathActor { TowTrack(); // FUNCTION: LEGO1 0x1004c7c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f03b8 return "TowTrack"; } // FUNCTION: LEGO1 0x1004c7d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 - virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 + MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x1004c950 // TowTrack::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/towtrackmissionstate.h b/LEGO1/lego/legoomni/include/towtrackmissionstate.h index 9e3b78f3..e96e87be 100644 --- a/LEGO1/lego/legoomni/include/towtrackmissionstate.h +++ b/LEGO1/lego/legoomni/include/towtrackmissionstate.h @@ -10,19 +10,19 @@ class TowTrackMissionState : public LegoState { TowTrackMissionState(); // FUNCTION: LEGO1 0x1004dfa0 - inline virtual const char* ClassName() const // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f00bc return "TowTrackMissionState"; } // FUNCTION: LEGO1 0x1004dfb0 - inline virtual MxBool IsA(const char* p_name) const // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); } - virtual MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C inline MxU16 GetColor(MxU8 p_id) { diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index cd39f1e2..b4696e2e 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -1,30 +1,268 @@ #include "act1state.h" +DECOMP_SIZE_ASSERT(Act1State, 0x26c) +DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c) + +// GLOBAL: ISLE 0x100f37f0 +MxS32 g_unk0x100f37f0[] = { + Act1State::e_unk953, + Act1State::e_unk954, + Act1State::e_unk955, +}; + // STUB: LEGO1 0x100334b0 -Act1State::Act1State() +Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0) { - // TODO - m_unk0x1e = 0; - m_unk0x18 = 1; - m_unk0x20 = 0; - m_unk0x1f = 0; - m_unk0x21 = TRUE; - m_unk0x22 = 0; - m_unk0x1c = 1; + m_unk0x01e = 0; + m_unk0x018 = 1; + m_unk0x010 = 0; + m_unk0x020 = 0; + m_unk0x00e = 0; + m_unk0x01f = 0; + m_unk0x008 = g_unk0x100f37f0; + m_unk0x014 = -1; + m_unk0x022 = 0; + m_unk0x154 = NULL; + m_unk0x158 = NULL; + m_unk0x15c = NULL; + m_unk0x160 = NULL; + m_unk0x1b0 = NULL; + m_unk0x021 = 1; + m_unk0x01c = 1; + m_unk0x00c = _countof(g_unk0x100f37f0); + m_unk0x1b4 = NULL; + m_unk0x1b8 = NULL; + m_unk0x208 = NULL; + m_unk0x20c = NULL; + m_unk0x25c = NULL; + m_unk0x260 = NULL; + m_unk0x264 = NULL; + m_unk0x268 = NULL; + SetFlag(); } -// STUB: LEGO1 0x10033ac0 +// FUNCTION: LEGO1 0x10033ac0 MxResult Act1State::VTable0x1c(LegoFile* p_legoFile) { + if (p_legoFile->IsWriteMode()) { + p_legoFile->FUN_10006030(ClassName()); + } + + m_unk0x024.Serialize(p_legoFile); + m_unk0x070.Serialize(p_legoFile); + m_unk0x0bc.Serialize(p_legoFile); + m_unk0x108.Serialize(p_legoFile); + m_unk0x164.Serialize(p_legoFile); + m_unk0x1bc.Serialize(p_legoFile); + m_unk0x210.Serialize(p_legoFile); + + if (p_legoFile->IsWriteMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + if (m_unk0x154) { + WriteNamedTexture(p_legoFile, m_unk0x154); + } + else { + FUN_1003f540(p_legoFile, "chwind.gif"); + } + if (m_unk0x158) { + WriteNamedTexture(p_legoFile, m_unk0x158); + } + else { + FUN_1003f540(p_legoFile, "chjetl.gif"); + } + if (m_unk0x15c) { + WriteNamedTexture(p_legoFile, m_unk0x15c); + } + else { + FUN_1003f540(p_legoFile, "chjetr.gif"); + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + if (m_unk0x1b0) { + WriteNamedTexture(p_legoFile, m_unk0x1b0); + } + else { + FUN_1003f540(p_legoFile, "jsfrnt.gif"); + } + if (m_unk0x1b4) { + WriteNamedTexture(p_legoFile, m_unk0x1b4); + } + else { + FUN_1003f540(p_legoFile, "jswnsh.gif"); + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + if (m_unk0x208) { + WriteNamedTexture(p_legoFile, m_unk0x208); + } + else { + FUN_1003f540(p_legoFile, "dbfrfn.gif"); + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + if (m_unk0x25c) { + WriteNamedTexture(p_legoFile, m_unk0x25c); + } + else { + FUN_1003f540(p_legoFile, "rcfrnt.gif"); + } + if (m_unk0x260) { + WriteNamedTexture(p_legoFile, m_unk0x260); + } + else { + FUN_1003f540(p_legoFile, "rcback.gif"); + } + if (m_unk0x264) { + WriteNamedTexture(p_legoFile, m_unk0x264); + } + else { + FUN_1003f540(p_legoFile, "rctail.gif"); + } + } + + p_legoFile->Write(&m_unk0x010, sizeof(undefined2)); + p_legoFile->Write(&m_unk0x022, sizeof(undefined)); + } + else if (p_legoFile->IsReadMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + m_unk0x154 = ReadNamedTexture(p_legoFile); + if (m_unk0x154 == NULL) { + return FAILURE; + } + + m_unk0x158 = ReadNamedTexture(p_legoFile); + if (m_unk0x158 == NULL) { + return FAILURE; + } + + m_unk0x15c = ReadNamedTexture(p_legoFile); + if (m_unk0x15c == NULL) { + return FAILURE; + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + m_unk0x1b0 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b0 == NULL) { + return FAILURE; + } + + m_unk0x1b4 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b4 == NULL) { + return FAILURE; + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + m_unk0x208 = ReadNamedTexture(p_legoFile); + if (m_unk0x208 == NULL) { + return FAILURE; + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + m_unk0x25c = ReadNamedTexture(p_legoFile); + if (m_unk0x25c == NULL) { + return FAILURE; + } + + m_unk0x260 = ReadNamedTexture(p_legoFile); + if (m_unk0x260 == NULL) { + return FAILURE; + } + + m_unk0x264 = ReadNamedTexture(p_legoFile); + if (m_unk0x264 == NULL) { + return FAILURE; + } + } + + p_legoFile->Read(&m_unk0x010, sizeof(undefined2)); + p_legoFile->Read(&m_unk0x022, sizeof(undefined)); + } + // TODO return SUCCESS; } -// STUB: LEGO1 0x100346d0 +// FUNCTION: LEGO1 0x100346d0 MxBool Act1State::SetFlag() { - // TODO - return FALSE; + m_unk0x024.SetName(""); + m_unk0x070.SetName(""); + m_unk0x0bc.SetName(""); + m_unk0x022 = 0; + m_unk0x108.SetName(""); + + if (m_unk0x154) { + delete m_unk0x154; + m_unk0x154 = NULL; + } + + if (m_unk0x158) { + delete m_unk0x158; + m_unk0x158 = NULL; + } + + if (m_unk0x15c) { + delete m_unk0x15c; + m_unk0x15c = NULL; + } + + if (m_unk0x160) { + delete m_unk0x160; + m_unk0x160 = NULL; + } + + m_unk0x164.SetName(""); + + if (m_unk0x1b0) { + delete m_unk0x1b0; + m_unk0x1b0 = NULL; + } + + if (m_unk0x1b4) { + delete m_unk0x1b4; + m_unk0x1b4 = NULL; + } + + if (m_unk0x1b8) { + delete m_unk0x1b8; + m_unk0x1b8 = NULL; + } + + m_unk0x1bc.SetName(""); + + if (m_unk0x208) { + delete m_unk0x208; + m_unk0x208 = NULL; + } + + if (m_unk0x20c) { + delete m_unk0x20c; + m_unk0x20c = NULL; + } + + m_unk0x210.SetName(""); + + if (m_unk0x25c) { + delete m_unk0x25c; + m_unk0x25c = NULL; + } + + if (m_unk0x260) { + delete m_unk0x260; + m_unk0x260 = NULL; + } + + if (m_unk0x264) { + delete m_unk0x264; + m_unk0x264 = NULL; + } + + if (m_unk0x268) { + delete m_unk0x268; + m_unk0x268 = NULL; + } + + return TRUE; } // STUB: LEGO1 0x10034d00 diff --git a/LEGO1/lego/legoomni/src/act2/legoact2.cpp b/LEGO1/lego/legoomni/src/act2/legoact2.cpp index 3aafe018..c32f407c 100644 --- a/LEGO1/lego/legoomni/src/act2/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/act2/legoact2.cpp @@ -35,7 +35,7 @@ void LegoAct2::ReadyWorld() } // STUB: LEGO1 0x10050cf0 -void LegoAct2::VTable0x68(MxBool p_add) +void LegoAct2::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/act3/act3.cpp b/LEGO1/lego/legoomni/src/act3/act3.cpp index 02a13c60..b0971ec4 100644 --- a/LEGO1/lego/legoomni/src/act3/act3.cpp +++ b/LEGO1/lego/legoomni/src/act3/act3.cpp @@ -77,7 +77,7 @@ void Act3::FUN_10073430() } // STUB: LEGO1 0x10073a90 -void Act3::VTable0x68(MxBool p_add) +void Act3::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp index 580f3405..96fa7f2d 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp @@ -1,26 +1,43 @@ #include "lego3dwavepresenter.h" -// STUB: LEGO1 0x1004a7c0 +#include "mxomni.h" + +// FUNCTION: LEGO1 0x1004a7c0 MxResult Lego3DWavePresenter::AddToManager() { - // TODO - return SUCCESS; + MxResult result = MxWavePresenter::AddToManager(); + MxWavePresenter::Init(); + if (MxOmni::IsSound3D()) { + m_is3d = TRUE; + } + return result; } -// STUB: LEGO1 0x1004a7f0 +// FUNCTION: LEGO1 0x1004a7f0 void Lego3DWavePresenter::Destroy() { - // TODO + MxWavePresenter::Destroy(); + MxWavePresenter::Init(); + + if (MxOmni::IsSound3D()) { + m_is3d = TRUE; + } } // STUB: LEGO1 0x1004a810 void Lego3DWavePresenter::StartingTickle() { + if (MxOmni::IsSound3D()) { + m_is3d = TRUE; + } + MxWavePresenter::StartingTickle(); + // TODO } // STUB: LEGO1 0x1004a8b0 void Lego3DWavePresenter::StreamingTickle() { + MxWavePresenter::StreamingTickle(); // TODO } diff --git a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp index d31e5d1c..748eecdb 100644 --- a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp @@ -18,18 +18,64 @@ LegoSoundManager::~LegoSoundManager() void LegoSoundManager::Init() { m_unk0x40 = 0; - m_unk0x3c = 0; + m_listener = NULL; } -// STUB: LEGO1 0x100299b0 +// FUNCTION: LEGO1 0x100299b0 void LegoSoundManager::Destroy(MxBool p_fromDestructor) { + delete m_unk0x40; + Init(); + + if (!p_fromDestructor) { + MxSoundManager::Destroy(); + } } -// STUB: LEGO1 0x100299f0 +// FUNCTION: LEGO1 0x100299f0 MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) { - return MxSoundManager::Create(p_frequencyMS, p_createThread); + MxBool locked = FALSE; + MxResult result = FAILURE; + + if (MxSoundManager::Create(10, FALSE) == SUCCESS) { + m_criticalSection.Enter(); + locked = TRUE; + + if (MxOmni::IsSound3D()) { + if (m_dsBuffer->QueryInterface(IID_IDirectSound3DListener, (LPVOID*) &m_listener) != S_OK) { + goto done; + } + + MxOmni* omni = MxOmni::GetInstance(); + LPDIRECTSOUND sound; + + if (omni && omni->GetSoundManager() && (sound = omni->GetSoundManager()->GetDirectSound())) { + DSCAPS caps; + memset(&caps, 0, sizeof(DSCAPS)); + caps.dwSize = sizeof(DSCAPS); + + if (sound->GetCaps(&caps) == S_OK && caps.dwMaxHw3DAllBuffers == 0) { + m_listener->SetDistanceFactor(0.026315790f, 0); + m_listener->SetRolloffFactor(10, 0); + } + } + } + + m_unk0x40 = new LegoUnknown100d6b4c; + result = SUCCESS; + } + +done: + if (result != SUCCESS) { + Destroy(); + } + + if (locked) { + m_criticalSection.Leave(); + } + + return result; } // FUNCTION: LEGO1 0x1002a390 @@ -38,11 +84,11 @@ void LegoSoundManager::Destroy() Destroy(FALSE); } -// STUB: LEGO1 0x1002a3a0 +// FUNCTION: LEGO1 0x1002a3a0 MxResult LegoSoundManager::Tickle() { MxMediaManager::Tickle(); - MxAutoLocker lock(&this->m_criticalSection); - return 0; // TODO: call something in unk0x40 + MxAutoLocker lock(&m_criticalSection); + return m_unk0x40->Tickle(); } diff --git a/LEGO1/lego/legoomni/src/audio/legounknown100d6b4c.cpp b/LEGO1/lego/legoomni/src/audio/legounknown100d6b4c.cpp index 2ed5f178..3497458a 100644 --- a/LEGO1/lego/legoomni/src/audio/legounknown100d6b4c.cpp +++ b/LEGO1/lego/legoomni/src/audio/legounknown100d6b4c.cpp @@ -1,5 +1,23 @@ #include "legounknown100d6b4c.h" +// Inline constructor at 0x10029adb +LegoUnknown100d6b4c::LegoUnknown100d6b4c() +{ + // TODO +} + +// STUB: LEGO1 0x1003cf20 +LegoUnknown100d6b4c::~LegoUnknown100d6b4c() +{ + // TODO +} + +// STUB: LEGO1 0x1003d050 +MxResult LegoUnknown100d6b4c::Tickle() +{ + return SUCCESS; +} + // STUB: LEGO1 0x1003dc40 void LegoUnknown100d6b4c::FUN_1003dc40(LegoCacheSound** p_und) { diff --git a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp index 74f8c146..581d97c5 100644 --- a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp @@ -47,8 +47,9 @@ MxResult MxBackgroundAudioManager::Create(MxAtomId& p_script, MxU32 p_frequencyM // FUNCTION: LEGO1 0x1007ed20 MxResult MxBackgroundAudioManager::OpenMusic(MxAtomId& p_script) { - if (m_script.GetInternal()) + if (m_script.GetInternal()) { DestroyMusic(); + } MxResult result = FAILURE; @@ -79,16 +80,15 @@ MxResult MxBackgroundAudioManager::Tickle() switch (m_unk0x13c) { case MxPresenter::e_starting: FadeInOrFadeOut(); - return SUCCESS; + break; case MxPresenter::e_streaming: FUN_1007ee70(); - return SUCCESS; + break; case MxPresenter::e_repeating: FUN_1007ef40(); - return SUCCESS; - default: - return SUCCESS; } + + return SUCCESS; } // FUNCTION: LEGO1 0x1007ee70 @@ -111,19 +111,23 @@ void MxBackgroundAudioManager::FUN_1007ee70() // FUNCTION: LEGO1 0x1007ef40 void MxBackgroundAudioManager::FUN_1007ef40() { - MxU32 compare; - MxU32 volume; + MxS32 compare, volume; + if (m_unk0xa0 == NULL) { if (m_unk0x138) { - compare = 30; - if (m_unk0x148 == 0) { - compare = m_unk0x148; + if (m_unk0x148 != 0) { + compare = 30; } + else { + compare = m_targetVolume; + } + volume = m_unk0x138->GetVolume(); if (volume < compare) { if (m_unk0x140 + m_unk0x138->GetVolume() <= compare) { - compare = m_unk0x140 + compare; + compare = m_unk0x140 + m_unk0x138->GetVolume(); } + m_unk0x138->SetVolume(compare); } else { @@ -142,12 +146,14 @@ void MxBackgroundAudioManager::FUN_1007ef40() DeleteObject(*m_unk0xa0->GetAction()); } else { - compare = m_unk0xa0->GetVolume(); - volume = 0; - if (compare != m_unk0x140 && -1 < compare - m_unk0x140) { + if (m_unk0xa0->GetVolume() - m_unk0x140 > 0) { volume = m_unk0xa0->GetVolume() - m_unk0x140; } - m_unk0x138->SetVolume(volume); + else { + volume = 0; + } + + m_unk0xa0->SetVolume(volume); } } } @@ -264,15 +270,17 @@ MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_ // FUNCTION: LEGO1 0x1007f470 void MxBackgroundAudioManager::Stop() { - if (m_action2.GetObjectId() != -1) + if (m_action2.GetObjectId() != -1) { DeleteObject(m_action2); + } m_unk0x138 = 0; m_action2.SetAtomId(MxAtomId()); m_action2.SetObjectId(-1); - if (m_action1.GetObjectId() != -1) + if (m_action1.GetObjectId() != -1) { DeleteObject(m_action1); + } m_unk0xa0 = 0; m_action1.SetAtomId(MxAtomId()); diff --git a/LEGO1/lego/legoomni/src/build/helicopter.cpp b/LEGO1/lego/legoomni/src/build/helicopter.cpp index 0f099228..7e836fcf 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -34,14 +34,15 @@ Helicopter::~Helicopter() MxResult Helicopter::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); - LegoWorld* world = GetCurrentWorld(); + LegoWorld* world = CurrentWorld(); SetWorld(world); if (world->IsA("Act3")) { ((Act3*) GetWorld())->SetUnkown420c(this); } world = GetWorld(); - if (world) + if (world) { world->Add(this); + } GetState(); return result; } @@ -50,8 +51,9 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) void Helicopter::GetState() { m_state = (HelicopterState*) GameState()->GetState("HelicopterState"); - if (!m_state) + if (!m_state) { m_state = (HelicopterState*) GameState()->CreateState("HelicopterState"); + } } // FUNCTION: LEGO1 0x10003360 @@ -62,10 +64,10 @@ void Helicopter::VTable0xe4() } IslePathActor::VTable0xe4(); if (!GameState()->GetUnknown10()) { - GameState()->SetUnknown424(0x3c); - if (GetCurrentVehicle()) { - if (GetCurrentVehicle()->IsA("IslePathActor")) { - ((IslePathActor*) GetCurrentVehicle())->VTable0xe8(0x37, TRUE, 7); + GameState()->SetCurrentArea(0x3c); + if (CurrentVehicle()) { + if (CurrentVehicle()->IsA("IslePathActor")) { + ((IslePathActor*) CurrentVehicle())->VTable0xe8(0x37, TRUE, 7); } } } @@ -87,14 +89,16 @@ void Helicopter::VTable0xe4() // FUNCTION: LEGO1 0x10003480 MxU32 Helicopter::VTable0xcc() { - if (!FUN_1003ef60()) + if (!FUN_1003ef60()) { return 1; - if (!m_world) - m_world = GetCurrentWorld(); + } + if (!m_world) { + m_world = CurrentWorld(); + } AnimationManager()->FUN_1005f6d0(FALSE); - if (GetCurrentVehicle()) { - if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { - GetCurrentVehicle()->VTable0xe4(); + if (CurrentVehicle()) { + if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { + CurrentVehicle()->VTable0xe4(); } } switch (GameState()->GetUnknown10()) { @@ -102,7 +106,7 @@ MxU32 Helicopter::VTable0xcc() m_script = *g_isleScript; AnimationManager()->FUN_10064670(FALSE); VTable0xe8(0x29, TRUE, 7); - ((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c); + ((Isle*) CurrentWorld())->SetUnknown13c(0x3c); FUN_10015820(TRUE, 0); TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, TRUE); SetUnknownDC(4); @@ -142,18 +146,20 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) switch (p_param.GetClickedObjectId()) { case 0x17: if (*g_act3Script == script) { - ((Act3*) GetCurrentWorld())->SetUnkown4270(2); + ((Act3*) CurrentWorld())->SetUnkown4270(2); TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); } - else if (m_state->GetUnkown8() != 0) + else if (m_state->GetUnkown8() != 0) { break; + } VTable0xe4(); - GameState()->SetUnknown424(0x42); + GameState()->SetCurrentArea(0x42); ret = 1; break; case 0x18: { - if (*g_act3Script == script) + if (*g_act3Script == script) { break; + } Act1State* state = (Act1State*) GameState()->GetState("Act1State"); if (m_state->GetUnkown8() == 0) { state->SetUnknown18(4); @@ -166,8 +172,9 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) break; } case 0x19: - if (*g_act3Script == script) + if (*g_act3Script == script) { break; + } if (m_state->GetUnkown8() == 2) { m_state->SetUnknown8(3); m_world->FUN_1001fc80(this); @@ -177,13 +184,15 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) ret = 1; break; case 0x1a: - if (*g_act3Script != script) + if (*g_act3Script != script) { break; + } ret = 1; /* fall through */ case 0x1b: - if (*g_act3Script != script) + if (*g_act3Script != script) { break; + } if (m_world && m_world->GetCamera()) { Mx3DPointFloat loc, dir, lookat; loc.CopyFrom(m_world->GetCamera()->GetWorldLocation()); @@ -196,17 +205,20 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) v68.CopyFrom(m_world->GetCamera()->GetWorldUp()); va4.EqualsCross(v68, dir); v7c.EqualsCross(va4, v90); - if (ret) - if (((Act3*) m_world)->FUN_100727e0(m_unk0x138, loc, dir, v7c)) + if (ret) { + if (((Act3*) m_world)->FUN_100727e0(m_unk0x138, loc, dir, v7c)) { break; - else if (((Act3*) m_world)->FUN_10072980(m_unk0x138, loc, dir, v7c)) + } + else if (((Act3*) m_world)->FUN_10072980(m_unk0x138, loc, dir, v7c)) { break; + } + } } ret = 1; break; case 0x1c: if (GameState()->GetUnknown10() == 0) { - ((Isle*) GetCurrentWorld())->SetUnknown13c(2); + ((Isle*) CurrentWorld())->SetUnknown13c(2); TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); VTable0xe4(); } @@ -231,8 +243,9 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); VTable0xe8(0x2a, TRUE, 7); } - else + else { VTable0xe8(0x31, TRUE, 7); + } m_state->SetUnknown8(2); @@ -267,8 +280,9 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); VTable0xe8(0x29, TRUE, 7); } - else + else { VTable0xe8(0x30, TRUE, 7); + } m_state->SetUnknown8(0); ret = 1; @@ -289,8 +303,9 @@ void Helicopter::VTable0x74(Matrix4& p_transform) else { m_roi->FUN_100a58f0(p_transform); m_roi->VTable0x14(); - if (m_cameraFlag) + if (m_cameraFlag) { FUN_10010c30(); + } } } @@ -307,10 +322,12 @@ void Helicopter::VTable0x70(float p_float) float f = m_unk0x1f0 - p_float + 3000; if (f >= 0) { float f2 = f / 3000 + 1; - if (f2 < 0) + if (f2 < 0) { f2 = 0; - if (1.0f < f2) + } + if (1.0f < f2) { f2 = 1.0f; + } Vector3 v(m_unk0x160[3]); MxMatrix mat; Vector3 v2(m_unk0x1a8[3]); @@ -328,10 +345,12 @@ void Helicopter::VTable0x70(float p_float) m_world->GetCamera()->FUN_100123e0(mat, 0); } else { - if (state == 4) + if (state == 4) { ((Act3*) m_world)->FUN_10073400(); - else + } + else { ((Act3*) m_world)->FUN_10073430(); + } m_unk0xdc = 4; } } @@ -380,6 +399,7 @@ MxResult HelicopterSubclass::FUN_100040a0(Vector4& p_v, float p_f) } return SUCCESS; } - else + else { return FAILURE; + } } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 9aba409b..09651ba2 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -49,7 +49,7 @@ void LegoCarBuild::ReadyWorld() } // STUB: LEGO1 0x100256c0 -void LegoCarBuild::VTable0x68(MxBool p_add) +void LegoCarBuild::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp index f950c429..8cf60edd 100644 --- a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp +++ b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp @@ -2,17 +2,7 @@ #include "decomp.h" -DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50); // 1000acd7 -DECOMP_SIZE_ASSERT(LegoVehicleBuildState::UnkStruct, 0x0c); - -// FUNCTION: LEGO1 0x10017c00 -LegoVehicleBuildState::UnkStruct::UnkStruct() -{ - m_unk0x04 = 0; - m_unk0x00 = 0; - m_unk0x06 = 0; - m_unk0x08 = 0; -} +DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) // FUNCTION: LEGO1 0x10025f30 LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) diff --git a/LEGO1/lego/legoomni/src/common/gifmanager.cpp b/LEGO1/lego/legoomni/src/common/gifmanager.cpp index 821a97d2..09e25c5e 100644 --- a/LEGO1/lego/legoomni/src/common/gifmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/gifmanager.cpp @@ -37,8 +37,9 @@ GifManager::~GifManager() // FUNCTION: LEGO1 0x10099cc0 void GifManager::FUN_10099cc0(GifData* p_data) { - if (p_data == NULL) + if (p_data == NULL) { return; + } #ifdef COMPAT_MODE GifList::iterator it; diff --git a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp index 1407de1b..370b54c7 100644 --- a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp @@ -80,8 +80,9 @@ void LegoActionControlPresenter::ParseExtra() { MxU32 len = m_action->GetExtraLength(); - if (len == 0) + if (len == 0) { return; + } len &= MAXWORD; diff --git a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp index 5d594eaa..461e84db 100644 --- a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp +++ b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp @@ -34,8 +34,9 @@ void LegoBackgroundColor::SetValue(const char* p_colorString) m_value.ToLowerCase(); LegoVideoManager* videomanager = VideoManager(); - if (!videomanager || !p_colorString) + if (!videomanager || !p_colorString) { return; + } float convertedR, convertedG, convertedB; char* colorStringCopy = strcpy(new char[strlen(p_colorString) + 1], p_colorString); @@ -43,14 +44,17 @@ void LegoBackgroundColor::SetValue(const char* p_colorString) if (!strcmp(colorStringSplit, g_set)) { colorStringSplit = strtok(0, g_delimiter); - if (colorStringSplit) + if (colorStringSplit) { m_h = (float) (atoi(colorStringSplit) * 0.01); + } colorStringSplit = strtok(0, g_delimiter); - if (colorStringSplit) + if (colorStringSplit) { m_s = (float) (atoi(colorStringSplit) * 0.01); + } colorStringSplit = strtok(0, g_delimiter); - if (colorStringSplit) + if (colorStringSplit) { m_v = (float) (atoi(colorStringSplit) * 0.01); + } ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB); videomanager->SetSkyColor(convertedR, convertedG, convertedB); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index af5e8dac..864bb258 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -6,6 +6,7 @@ #include "legostate.h" #include "legoutil.h" #include "legovideomanager.h" +#include "legoworld.h" #include "mxbackgroundaudiomanager.h" #include "mxobjectfactory.h" #include "mxstring.h" @@ -69,8 +70,8 @@ LegoGameState::LegoGameState() this->m_stateCount = 0; this->m_unk0x0c = 0; this->m_savePath = NULL; - this->m_unk0x424 = 0; - this->m_prevArea = 0; + this->m_currentArea = 0; + this->m_previousArea = 0; this->m_unk0x42c = 0; this->m_isDirty = FALSE; this->m_currentAct = -1; @@ -96,8 +97,9 @@ LegoGameState::~LegoGameState() if (m_stateCount) { for (MxS16 i = 0; i < m_stateCount; i++) { LegoState* state = m_stateArray[i]; - if (state) + if (state) { delete state; + } } delete[] m_stateArray; @@ -112,14 +114,21 @@ void LegoGameState::FUN_10039780(MxU8) // TODO } +// STUB: LEGO1 0x10039940 +void LegoGameState::FUN_10039940() +{ + // TODO +} + // FUNCTION: LEGO1 0x10039980 MxResult LegoGameState::Save(MxULong p_slot) { MxResult result; InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); - if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL) + if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL) { result = SUCCESS; + } else { result = FAILURE; MxVariableTable* variableTable = VariableTable(); @@ -134,8 +143,9 @@ MxResult LegoGameState::Save(MxULong p_slot) fileStream.Write(&m_unk0x0c, 1); for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) { - if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) + if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) { return result; + } } if (WriteVariable(&fileStream, variableTable, "backgroundcolor") != FAILURE) { @@ -161,15 +171,17 @@ MxResult LegoGameState::Load(MxULong) // FUNCTION: LEGO1 0x10039f00 void LegoGameState::SetSavePath(char* p_savePath) { - if (m_savePath != NULL) + if (m_savePath != NULL) { delete[] m_savePath; + } if (p_savePath) { m_savePath = new char[strlen(p_savePath) + 1]; strcpy(m_savePath, p_savePath); } - else + else { m_savePath = NULL; + } } // FUNCTION: LEGO1 0x10039f70 @@ -183,8 +195,9 @@ MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_ if (p_stream->Write((char*) &length, 1) == SUCCESS) { if (p_stream->Write(p_variableName, length) == SUCCESS) { length = strlen(variableValue); - if (p_stream->Write((char*) &length, 1) == SUCCESS) + if (p_stream->Write((char*) &length, 1) == SUCCESS) { result = p_stream->Write((char*) variableValue, length); + } } } } @@ -195,8 +208,9 @@ MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_ MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_stream) { MxU8 len = strlen(g_endOfVariables); - if (p_stream->Write(&len, 1) == SUCCESS) + if (p_stream->Write(&len, 1) == SUCCESS) { return p_stream->Write(g_endOfVariables, len); + } return FAILURE; } @@ -212,9 +226,10 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to) char nameBuffer[256]; if (p_stream->Read(nameBuffer, length) == SUCCESS) { nameBuffer[length] = '\0'; - if (strcmp(nameBuffer, g_endOfVariables) == 0) + if (strcmp(nameBuffer, g_endOfVariables) == 0) { // 2 -> "This was the last entry, done reading." result = 2; + } else { if (p_stream->Read((char*) &length, 1) == SUCCESS) { char valueBuffer[256]; @@ -237,8 +252,9 @@ void LegoGameState::GetFileSavePath(MxString* p_outPath, MxULong p_slotn) char path[1024] = ""; // Save path base - if (m_savePath != NULL) + if (m_savePath != NULL) { strcpy(path, m_savePath); + } // Slot: "G0", "G1", ... strcat(path, "\\G"); @@ -256,32 +272,224 @@ void LegoGameState::SerializePlayersInfo(MxS16) // TODO } -// STUB: LEGO1 0x1003a720 -void LegoGameState::FUN_1003a720(MxU32) +// FUNCTION: LEGO1 0x1003a720 +void LegoGameState::StopArea(MxU32 p_area) { - // TODO + if (p_area == 0) { + p_area = m_previousArea; + } + + switch (p_area) { + case 1: + InvokeAction(Extra::e_stop, *g_isleScript, 0, NULL); + InvokeAction(Extra::e_close, *g_isleScript, 0, NULL); + InvokeAction(Extra::e_close, *g_sndAnimScript, 0, NULL); + break; + case 2: + InvokeAction(Extra::e_stop, *g_infomainScript, 0, NULL); + InvokeAction(Extra::e_close, *g_infomainScript, 0, NULL); + break; + case 3: + InvokeAction(Extra::e_stop, *g_infodoorScript, 0, NULL); + InvokeAction(Extra::e_close, *g_infodoorScript, 0, NULL); + break; + case 5: + InvokeAction(Extra::e_stop, *g_elevbottScript, 0, NULL); + InvokeAction(Extra::e_close, *g_elevbottScript, 0, NULL); + break; + case 6: + case 7: + RemoveFromWorld(*g_isleScript, 0x41b, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 1052, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x41d, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x41e, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x420, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x422, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x424, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x426, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x428, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x42a, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x42b, *g_isleScript, 0); + break; + case 8: + RemoveFromWorld(*g_isleScript, 0x45b, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x45c, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x45d, *g_isleScript, 0); + break; + case 9: + RemoveFromWorld(*g_isleScript, 0x475, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x476, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x477, *g_isleScript, 0); + break; + case 10: + RemoveFromWorld(*g_isleScript, 0x45f, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x460, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x461, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x462, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x463, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x464, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x465, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x466, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x467, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x469, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x468, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46a, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46b, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46c, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46d, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46e, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x46f, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x471, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x472, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x12, *g_isleScript, 0); + break; + case 0xb: + RemoveFromWorld(*g_isleScript, 0x47a, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x47b, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x47c, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x47d, *g_isleScript, 0); + break; + case 0xc: + InvokeAction(Extra::e_stop, *g_regbookScript, 0, NULL); + InvokeAction(Extra::e_close, *g_regbookScript, 0, NULL); + break; + case 0xd: + InvokeAction(Extra::e_stop, *g_infoscorScript, 0, NULL); + InvokeAction(Extra::e_close, *g_infoscorScript, 0, NULL); + break; + case 0xe: + InvokeAction(Extra::e_stop, *g_jetraceScript, 0, NULL); + InvokeAction(Extra::e_close, *g_jetraceScript, 0, NULL); + InvokeAction(Extra::e_close, *g_jetracerScript, 0, NULL); + break; + case 0x12: + InvokeAction(Extra::e_stop, *g_carraceScript, 0, NULL); + InvokeAction(Extra::e_close, *g_carraceScript, 0, NULL); + InvokeAction(Extra::e_close, *g_carracerScript, 0, NULL); + break; + case 0x1a: + Lego()->RemoveWorld(*g_garageScript, 0); + InvokeAction(Extra::e_stop, *g_garageScript, 0, NULL); + InvokeAction(Extra::e_close, *g_garageScript, 0, NULL); + break; + case 0x1b: + RemoveFromWorld(*g_isleScript, 0x489, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x48a, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x48b, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x48c, *g_isleScript, 0); + break; + case 0x1e: + InvokeAction(Extra::e_stop, *g_hospitalScript, 0, NULL); + InvokeAction(Extra::e_close, *g_hospitalScript, 0, NULL); + break; + case 0x22: + InvokeAction(Extra::e_stop, *g_policeScript, 0, NULL); + InvokeAction(Extra::e_close, *g_policeScript, 0, NULL); + break; + case 0x23: + RemoveFromWorld(*g_isleScript, 0x47f, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x480, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x481, *g_isleScript, 0); + RemoveFromWorld(*g_isleScript, 0x482, *g_isleScript, 0); + break; + case 0x24: + InvokeAction(Extra::e_stop, *g_jukeboxScript, 0x2f, NULL); + InvokeAction(Extra::e_stop, *g_copterScript, 0, NULL); + InvokeAction(Extra::e_close, *g_copterScript, 0, NULL); + break; + case 0x25: + InvokeAction(Extra::e_stop, *g_jukeboxScript, 0x31, NULL); + InvokeAction(Extra::e_stop, *g_dunecarScript, 0, NULL); + InvokeAction(Extra::e_close, *g_dunecarScript, 0, NULL); + break; + case 0x26: + InvokeAction(Extra::e_stop, *g_jukeboxScript, 0x33, NULL); + InvokeAction(Extra::e_stop, *g_jetskiScript, 0, NULL); + InvokeAction(Extra::e_close, *g_jetskiScript, 0, NULL); + break; + case 0x27: + InvokeAction(Extra::e_stop, *g_jukeboxScript, 0x35, NULL); + InvokeAction(Extra::e_stop, *g_racecarScript, 0, NULL); + InvokeAction(Extra::e_close, *g_racecarScript, 0, NULL); + break; + case 0x2e: + if (m_currentArea != 2) { + InvokeAction(Extra::e_stop, *g_act2mainScript, 0, NULL); + InvokeAction(Extra::e_close, *g_act2mainScript, 0, NULL); + } + break; + case 0x2f: + if (m_currentArea != 2) { + InvokeAction(Extra::e_stop, *g_act3Script, 0, NULL); + InvokeAction(Extra::e_close, *g_act3Script, 0, NULL); + } + break; + case 0x35: + InvokeAction(Extra::e_stop, *g_jukeboxwScript, 0, NULL); + InvokeAction(Extra::e_close, *g_jukeboxwScript, 0, NULL); + break; + case 0x38: + InvokeAction(Extra::e_disable, *g_histbookScript, 0, NULL); + InvokeAction(Extra::e_stop, *g_histbookScript, 0, NULL); + InvokeAction(Extra::e_close, *g_histbookScript, 0, NULL); + break; + } } // STUB: LEGO1 0x1003b060 -void LegoGameState::HandleAction(MxU32 p_area) +void LegoGameState::SwitchArea(MxU32 p_area) { - m_prevArea = p_area; + m_previousArea = m_currentArea; + m_currentArea = p_area; + BackgroundAudioManager()->Stop(); AnimationManager()->FUN_1005ef10(); - VideoManager()->SetUnk0x554(0); + VideoManager()->SetUnk0x554(FALSE); MxAtomId* script = g_isleScript; + LegoWorld* world; + switch (p_area) { case 1: break; case 2: - VideoManager()->SetUnk0x554(1); + VideoManager()->SetUnk0x554(TRUE); script = g_infomainScript; break; case 3: - VideoManager()->SetUnk0x554(1); + VideoManager()->SetUnk0x554(TRUE); script = g_infodoorScript; break; + // TODO + case 5: + script = g_elevbottScript; + break; + case 6: + case 7: + world = FindWorld(*g_isleScript, 0); + + if (world == NULL) { + InvokeAction(Extra::ActionType::e_opendisk, *g_isleScript, 0, NULL); + } + else { +#ifdef COMPAT_MODE + { + MxNotificationParam param(c_notificationType20, NULL); + NotificationManager()->Send(world, ¶m); + } +#else + NotificationManager()->Send(world, &MxNotificationParam(c_notificationType20, NULL)); +#endif + } + break; + case 12: + VideoManager()->SetUnk0x554(TRUE); + script = g_regbookScript; + break; + case 13: + VideoManager()->SetUnk0x554(TRUE); + script = g_infoscorScript; + break; // TODO: implement other cases } @@ -319,9 +527,11 @@ MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen) // FUNCTION: LEGO1 0x1003bbb0 LegoState* LegoGameState::GetState(const char* p_stateName) { - for (MxS32 i = 0; i < m_stateCount; ++i) - if (m_stateArray[i]->IsA(p_stateName)) + for (MxS32 i = 0; i < m_stateCount; ++i) { + if (m_stateArray[i]->IsA(p_stateName)) { return m_stateArray[i]; + } + } return NULL; } @@ -338,9 +548,11 @@ LegoState* LegoGameState::CreateState(const char* p_stateName) void LegoGameState::RegisterState(LegoState* p_state) { MxS32 targetIndex; - for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex) - if (m_stateArray[targetIndex]->IsA(p_state->ClassName())) + for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex) { + if (m_stateArray[targetIndex]->IsA(p_state->ClassName())) { break; + } + } if (targetIndex == m_stateCount) { LegoState** newBuffer = new LegoState*[m_stateCount + 1]; @@ -355,8 +567,9 @@ void LegoGameState::RegisterState(LegoState* p_state) return; } - if (m_stateArray[targetIndex]) + if (m_stateArray[targetIndex]) { delete m_stateArray[targetIndex]; + } m_stateArray[targetIndex] = p_state; } diff --git a/LEGO1/lego/legoomni/src/common/legostate.cpp b/LEGO1/lego/legoomni/src/common/legostate.cpp index c9946492..a8c2cc6b 100644 --- a/LEGO1/lego/legoomni/src/common/legostate.cpp +++ b/LEGO1/lego/legoomni/src/common/legostate.cpp @@ -1,3 +1,59 @@ #include "legostate.h" +#include + DECOMP_SIZE_ASSERT(LegoState, 0x08) +DECOMP_SIZE_ASSERT(LegoState::Playlist, 0x0c) + +// FUNCTION: LEGO1 0x10014d00 +MxU32 LegoState::Playlist::Next() +{ + MxU32 objectId; + + switch (m_mode) { + case e_loop: + objectId = m_objectIds[m_nextIndex]; + if (m_nextIndex - m_length == -1) { + m_nextIndex = 0; + } + else { + m_nextIndex++; + } + break; + + case e_once: + objectId = m_objectIds[m_nextIndex]; + if (m_length > m_nextIndex + 1) { + m_nextIndex++; + } + break; + + case e_random: + m_nextIndex = rand() % m_length; + objectId = m_objectIds[m_nextIndex]; + break; + + case e_loopSkipFirst: + objectId = m_objectIds[m_nextIndex]; + if (m_nextIndex - m_length == -1) { + m_nextIndex = 1; + } + else { + m_nextIndex++; + } + } + + return objectId; +} + +// FUNCTION: LEGO1 0x10014de0 +MxBool LegoState::Playlist::Contains(MxU32 p_objectId) +{ + for (MxS16 i = 0; i < m_length; i++) { + if (m_objectIds[i] == p_objectId) { + return TRUE; + } + } + + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp index 551dea32..c7154155 100644 --- a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp +++ b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp @@ -19,26 +19,36 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream) const LegoSaveDataEntry3* end = &g_saveData3[66]; while (TRUE) { - if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS) + if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS) { break; - if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS) + } + if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS) { break; + } if (++entry >= end) { result = SUCCESS; break; diff --git a/LEGO1/lego/legoomni/src/common/legoutil.cpp b/LEGO1/lego/legoomni/src/common/legoutil.cpp index dfb4b740..c6d0c22e 100644 --- a/LEGO1/lego/legoomni/src/common/legoutil.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutil.cpp @@ -10,6 +10,8 @@ #include #include +DECOMP_SIZE_ASSERT(NamedTexture, 0x14) + // STUB: LEGO1 0x1003e050 void FUN_1003e050(LegoAnimPresenter* p_presenter) { @@ -21,26 +23,36 @@ Extra::ActionType MatchActionString(const char* p_str) { Extra::ActionType result = Extra::ActionType::e_unknown; - if (!strcmpi("openram", p_str)) + if (!strcmpi("openram", p_str)) { result = Extra::ActionType::e_openram; - else if (!strcmpi("opendisk", p_str)) + } + else if (!strcmpi("opendisk", p_str)) { result = Extra::ActionType::e_opendisk; - else if (!strcmpi("close", p_str)) + } + else if (!strcmpi("close", p_str)) { result = Extra::ActionType::e_close; - else if (!strcmpi("start", p_str)) + } + else if (!strcmpi("start", p_str)) { result = Extra::ActionType::e_start; - else if (!strcmpi("stop", p_str)) + } + else if (!strcmpi("stop", p_str)) { result = Extra::ActionType::e_stop; - else if (!strcmpi("run", p_str)) + } + else if (!strcmpi("run", p_str)) { result = Extra::ActionType::e_run; - else if (!strcmpi("exit", p_str)) + } + else if (!strcmpi("exit", p_str)) { result = Extra::ActionType::e_exit; - else if (!strcmpi("enable", p_str)) + } + else if (!strcmpi("enable", p_str)) { result = Extra::ActionType::e_enable; - else if (!strcmpi("disable", p_str)) + } + else if (!strcmpi("disable", p_str)) { result = Extra::ActionType::e_disable; - else if (!strcmpi("notify", p_str)) + } + else if (!strcmpi("notify", p_str)) { result = Extra::ActionType::e_notify; + } return result; } @@ -108,7 +120,7 @@ MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_enti LegoWorld* world = FindWorld(MxAtomId(p_filename, e_lowerCase2), p_entityId); if (world) { - world->VTable0x68(p_enable); + world->Enable(p_enable); return TRUE; } else { @@ -133,10 +145,12 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO double sDbl = p_s; - if (p_s > 0.5f) + if (p_s > 0.5f) { calc = (1.0f - p_v) * p_s + p_v; - else + } + else { calc = (p_v + 1.0) * sDbl; + } if (calc <= 0.0) { *p_gOut = 0.0f; *p_bOut = 0.0f; @@ -195,6 +209,35 @@ MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id) return TRUE; } +// FUNCTION: LEGO1 0x1003ee80 +MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId) +{ + LegoWorld* world = FindWorld(p_worldAtom, p_worldEntityId); + + if (world) { + MxCore* object = world->Find(p_entityAtom, p_entityId); + + if (object) { + world->Remove(object); + + if (!object->IsA("MxPresenter")) { + delete object; + } + else { + if (((MxPresenter*) object)->GetAction()) { + FUN_100b7220(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE); + } + + ((MxPresenter*) object)->EndAction(); + } + + return TRUE; + } + } + + return FALSE; +} + // STUB: LEGO1 0x1003ef00 void FUN_1003ef00(MxBool) { @@ -212,3 +255,21 @@ MxBool FUN_1003ef60() { return TRUE; } + +// STUB: LEGO1 0x1003f3b0 +NamedTexture* ReadNamedTexture(LegoFile* p_file) +{ + return NULL; +} + +// STUB: LEGO1 0x1003f540 +void FUN_1003f540(LegoFile* p_file, const char* p_filename) +{ +} + +// FUNCTION: LEGO1 0x1003f8a0 +void WriteNamedTexture(LegoFile* p_file, NamedTexture* p_texture) +{ + p_file->FUN_10006030(*p_texture->GetName()); + p_texture->GetTexture()->Write(p_file); +} diff --git a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp index d3971150..fe1543a2 100644 --- a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp @@ -57,10 +57,12 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller if (presenter->StartAction(p_controller, action) == SUCCESS) { presenter->SetTickleState(e_idle); - if (presenter->IsA("MxVideoPresenter")) + if (presenter->IsA("MxVideoPresenter")) { VideoManager()->UnregisterPresenter(*presenter); - else if (presenter->IsA("MxAudioPresenter")) + } + else if (presenter->IsA("MxAudioPresenter")) { SoundManager()->UnregisterPresenter(*presenter); + } success = TRUE; } @@ -70,8 +72,9 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller action->SetOrigin(this); m_list.push_back(presenter); } - else if (presenter) + else if (presenter) { delete presenter; + } } if (!m_compositePresenter) { @@ -97,8 +100,9 @@ void MxCompositeMediaPresenter::StartingTickle() (*it)->Tickle(); if ((*it)->GetCurrentTickleState() == e_streaming || - ((*it)->GetAction() && (*it)->GetAction()->GetStartTime())) + ((*it)->GetAction() && (*it)->GetAction()->GetStartTime())) { m_unk0x4c++; + } } } @@ -107,8 +111,9 @@ void MxCompositeMediaPresenter::StartingTickle() m_unk0x4c = 0; for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { - if (!(*it)->GetAction()->GetStartTime()) + if (!(*it)->GetAction()->GetStartTime()) { m_unk0x4c++; + } } } } @@ -145,8 +150,9 @@ MxResult MxCompositeMediaPresenter::Tickle() case e_repeating: case e_unk5: case e_done: { - for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) + for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { (*it)->Tickle(); + } break; } default: @@ -162,8 +168,9 @@ MxResult MxCompositeMediaPresenter::PutData() MxAutoLocker lock(&m_criticalSection); if (m_currentTickleState >= e_streaming && m_currentTickleState <= e_done) { - for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) + for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { (*it)->PutData(); + } } return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index e296ad91..01d5bb3a 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -1,6 +1,8 @@ #include "legocontrolmanager.h" #include "legoeventnotificationparam.h" +#include "legoomni.h" +#include "legovideomanager.h" #include "mxcontrolpresenter.h" #include "mxpresenter.h" #include "mxticklemanager.h" @@ -43,8 +45,9 @@ void LegoControlManager::Register(MxCore* p_listener) void LegoControlManager::Unregister(MxCore* p_listener) { LegoNotifyListCursor cursor(&m_notifyList); - if (cursor.Find(p_listener)) + if (cursor.Find(p_listener)) { cursor.Detach(); + } } // FUNCTION: LEGO1 0x10029210 @@ -120,9 +123,24 @@ void LegoControlManager::FUN_100293c0(undefined4, const char*, undefined2) { } -// STUB: LEGO1 0x100294e0 -void LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y) +// FUNCTION: LEGO1 0x100294e0 +MxControlPresenter* LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y) { + if (m_presenterList) { + MxPresenterListCursor cursor(m_presenterList); + MxPresenter* control; + MxVideoPresenter* presenter = (MxVideoPresenter*) VideoManager()->GetPresenterAt(p_x, p_y); + + if (presenter) { + while (cursor.Next(control)) { + if (((MxControlPresenter*) control)->FUN_10044270(p_x, p_y, presenter)) { + return (MxControlPresenter*) control; + } + } + } + } + + return NULL; } // FUNCTION: LEGO1 0x10029600 diff --git a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp index ae0288f7..ae131445 100644 --- a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp @@ -58,8 +58,9 @@ void MxControlPresenter::VTable0x68(MxBool p_unk0x50) // FUNCTION: LEGO1 0x10044110 MxControlPresenter::~MxControlPresenter() { - if (m_unk0x58) + if (m_unk0x58) { delete m_unk0x58; + } } // FUNCTION: LEGO1 0x10044180 @@ -108,13 +109,13 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* if (m_unk0x4c == 3) { MxVideoPresenter* frontPresenter = (MxVideoPresenter*) m_list.front(); - if (p_presenter == frontPresenter || frontPresenter->GetDisplayZ() < frontPresenter->GetDisplayZ()) { + if (p_presenter == frontPresenter || frontPresenter->GetDisplayZ() < p_presenter->GetDisplayZ()) { if (p_presenter->VTable0x7c()) { MxS32 height = frontPresenter->GetHeight(); MxS32 width = frontPresenter->GetWidth(); if (frontPresenter->GetLocation().GetX() <= p_x && - p_x < width - 1 + frontPresenter->GetLocation().GetY() && + p_x < width - 1 + frontPresenter->GetLocation().GetX() && frontPresenter->GetLocation().GetY() <= p_y && p_y < height - 1 + frontPresenter->GetLocation().GetY()) { MxU8* start; @@ -198,7 +199,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(0); - p_event->SetType(c_notificationType17); + p_event->SetType(c_notificationClick); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } @@ -208,7 +209,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(m_unk0x56); - p_event->SetType(c_notificationType17); + p_event->SetType(c_notificationClick); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } @@ -238,7 +239,7 @@ void MxControlPresenter::VTable0x6c(MxS16 p_val) MxS16 i = 0; for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { - (*it)->Enable((m_unk0x4c == 3 && m_unk0x4e == 0 || !IsEnabled()) ? FALSE : m_unk0x4e == i); + (*it)->Enable(((m_unk0x4c == 3 && m_unk0x4e == 0) || !IsEnabled()) ? FALSE : m_unk0x4e == i); i++; } } @@ -322,8 +323,9 @@ void MxControlPresenter::Enable(MxBool p_enable) MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState) { MxCompositePresenterList::iterator it = m_list.begin(); - for (MxS16 i = m_unk0x4e; i > 0; i--, it++) + for (MxS16 i = m_unk0x4e; i > 0; i--, it++) { ; + } return (*it)->HasTickleStatePassed(p_tickleState); } diff --git a/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp index 927677fe..076333a6 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp @@ -6,7 +6,7 @@ // FUNCTION: LEGO1 0x10076c30 void LegoActorPresenter::ReadyTickle() { - if (GetCurrentWorld()) { + if (CurrentWorld()) { m_entity = (LegoEntity*) CreateEntity("LegoActor"); if (m_entity) { SetEntityLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp()); diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index d48d22ff..b68d0a01 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -64,10 +64,12 @@ void LegoCameraController::OnRButtonUp(MxPoint32 p_point) // FUNCTION: LEGO1 0x10012230 void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point) { - if (p_modifier & c_lButtonState) + if (p_modifier & c_lButtonState) { LeftDrag(p_point.GetX(), p_point.GetY()); - else if (p_modifier & c_rButtonState) + } + else if (p_modifier & c_rButtonState) { RightDrag(p_point.GetX(), p_point.GetY()); + } } // FUNCTION: LEGO1 0x10012260 @@ -90,8 +92,9 @@ Mx3DPointFloat LegoCameraController::GetWorldUp() vec = m_lego3DView->GetPointOfView()->GetWorldUp(); return Mx3DPointFloat(vec[0], vec[1], vec[2]); } - else + else { return Mx3DPointFloat(0, 0, 0); + } } // FUNCTION: LEGO1 0x100127f0 @@ -102,8 +105,9 @@ Mx3DPointFloat LegoCameraController::GetWorldLocation() vec = m_lego3DView->GetPointOfView()->GetWorldPosition(); return Mx3DPointFloat(vec[0], vec[1] - m_entityOffsetUp, vec[2]); } - else + else { return Mx3DPointFloat(0, 0, 0); + } } // FUNCTION: LEGO1 0x100128a0 @@ -114,6 +118,7 @@ Mx3DPointFloat LegoCameraController::GetWorldDirection() vec = m_lego3DView->GetPointOfView()->GetWorldDirection(); return Mx3DPointFloat(vec[0], vec[1], vec[2]); } - else + else { return Mx3DPointFloat(0, 0, 0); + } } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 8ad66afb..86ccf923 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -51,10 +51,11 @@ void LegoEntity::Destroy(MxBool p_fromDestructor) { if (m_roi) { if (m_flags & c_bit1) { - if (m_roi->GetUnknown0x104() == this) + if (m_roi->GetUnknown0x104() == this) { m_roi->SetUnknown0x104(NULL); + } - GetUnkSaveDataWriter()->FUN_10083db0(m_roi); + UnkSaveDataWriter()->FUN_10083db0(m_roi); } else { VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); @@ -69,7 +70,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor) // FUNCTION: LEGO1 0x10010880 void LegoEntity::SetWorld() { - LegoWorld* world = GetCurrentWorld(); + LegoWorld* world = CurrentWorld(); if (world != NULL && world != (LegoWorld*) this) { world->Add(this); } @@ -90,10 +91,11 @@ void LegoEntity::SetLocation(Mx3DPointFloat& p_location, Mx3DPointFloat& p_direc // FUNCTION: LEGO1 0x10010c30 void LegoEntity::FUN_10010c30() { - LegoWorld* world = GetCurrentWorld(); + LegoWorld* world = CurrentWorld(); - if (m_cameraFlag && world && world->GetCamera() && m_roi) + if (m_cameraFlag && world && world->GetCamera() && m_roi) { world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1); + } } // FUNCTION: LEGO1 0x10010e10 diff --git a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp index 0da082cd..f43f1aa9 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp @@ -62,7 +62,7 @@ MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDS // FUNCTION: LEGO1 0x100536c0 void LegoEntityPresenter::ReadyTickle() { - if (GetCurrentWorld()) { + if (CurrentWorld()) { m_entity = (LegoEntity*) MxPresenter::CreateEntity("LegoEntity"); if (m_entity) { m_entity->Create(*m_action); diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 6a6a035c..8a9ec812 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -148,8 +148,9 @@ void LegoNavController::SetDefaults( // FUNCTION: LEGO1 0x10054e40 void LegoNavController::SetTargets(int p_hPos, int p_vPos, MxBool p_accel) { - if (this->m_trackDefault != FALSE) + if (this->m_trackDefault != FALSE) { ResetToDefault(); + } if (p_accel != FALSE) { this->m_targetTurnSpeed = CalculateNewTargetSpeed(p_hPos, this->m_hMax / 2, this->m_turnMaxSpeed); @@ -178,12 +179,15 @@ float LegoNavController::CalculateNewTargetSpeed(int p_pos, int p_center, float float result; int diff = p_pos - p_center; - if (diff > this->m_mouseDeadzone) + if (diff > this->m_mouseDeadzone) { result = (diff - m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone); - else if (diff < -m_mouseDeadzone) + } + else if (diff < -m_mouseDeadzone) { result = (diff + m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone); - else + } + else { result = 0.0f; + } return result; } @@ -196,8 +200,9 @@ float LegoNavController::CalculateNewAccel(int p_pos, int p_center, float p_maxA result = Abs(diff) * p_maxAccel / p_center; - if (result < p_minAccel) + if (result < p_minAccel) { result = (float) p_minAccel; + } return result; } @@ -214,10 +219,12 @@ float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel, float deltaVel = p_accel * p_time; newVel = p_currentVel + (deltaVel * vSign); - if (vSign > 0) + if (vSign > 0) { newVel = Min(newVel, p_targetVel); - else + } + else { newVel = Max(newVel, p_targetVel); + } } return newVel; diff --git a/LEGO1/lego/legoomni/src/entity/legorace.cpp b/LEGO1/lego/legoomni/src/entity/legorace.cpp index 79565966..7c65c4da 100644 --- a/LEGO1/lego/legoomni/src/entity/legorace.cpp +++ b/LEGO1/lego/legoomni/src/entity/legorace.cpp @@ -82,7 +82,7 @@ MxLong LegoRace::Notify(MxParam& p_param) } // STUB: LEGO1 0x10015ed0 -void LegoRace::VTable0x68(MxBool p_add) +void LegoRace::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index deaf0ce7..f9c0b63c 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -1,10 +1,13 @@ #include "legoworld.h" +#include "legoanimationmanager.h" #include "legoanimpresenter.h" #include "legobuildingmanager.h" #include "legocontrolmanager.h" +#include "legogamestate.h" #include "legoinputmanager.h" #include "legolocomotionanimpresenter.h" +#include "legonavcontroller.h" #include "legoomni.h" #include "legoplantmanager.h" #include "legosoundmanager.h" @@ -65,20 +68,23 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) m_entityList = new LegoEntityList(TRUE); - if (!m_entityList) + if (!m_entityList) { return FAILURE; + } m_cacheSoundList = new LegoCacheSoundList(TRUE); - if (!m_cacheSoundList) + if (!m_cacheSoundList) { return FAILURE; + } - if (!VTable0x54()) + if (!VTable0x54()) { return FAILURE; + } if (p_dsAction.GetFlags() & MxDSAction::c_enabled) { - if (GetCurrentWorld()) { - GetCurrentWorld()->VTable0x68(0); + if (CurrentWorld()) { + CurrentWorld()->Enable(0); } SetCurrentWorld(this); @@ -96,7 +102,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) { m_destroyed = TRUE; - if (GetCurrentWorld() == this) { + if (CurrentWorld() == this) { ControlManager()->FUN_10028df0(NULL); SetCurrentWorld(NULL); } @@ -146,8 +152,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) presenter->EndAction(); } } - else + else { delete object; + } } MxPresenterListCursor controlPresenterCursor(&m_controlPresenters); @@ -174,8 +181,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) while (cursor.First(entity)) { cursor.Detach(); - if (!(entity->GetFlags() & LegoEntity::c_bit2)) + if (!(entity->GetFlags() & LegoEntity::c_bit2)) { delete entity; + } } delete m_entityList; @@ -201,8 +209,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) delete roi; } - if (!p_fromDestructor) + if (!p_fromDestructor) { LegoEntity::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x1001f5e0 @@ -284,42 +293,48 @@ void LegoWorld::Add(MxCore* p_object) if (p_object->IsA("MxControlPresenter")) { MxPresenterListCursor cursor(&m_controlPresenters); - if (cursor.Find((MxPresenter*) p_object)) + if (cursor.Find((MxPresenter*) p_object)) { return; + } m_controlPresenters.Append((MxPresenter*) p_object); } else if (p_object->IsA("MxEntity")) { LegoEntityListCursor cursor(m_entityList); - if (cursor.Find((LegoEntity*) p_object)) + if (cursor.Find((LegoEntity*) p_object)) { return; + } m_entityList->Append((LegoEntity*) p_object); } else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) { MxPresenterListCursor cursor(&m_animPresenters); - if (cursor.Find((MxPresenter*) p_object)) + if (cursor.Find((MxPresenter*) p_object)) { return; + } ((MxPresenter*) p_object)->SendToCompositePresenter(Lego()); m_animPresenters.Append(((MxPresenter*) p_object)); - if (p_object->IsA("LegoHideAnimPresenter")) + if (p_object->IsA("LegoHideAnimPresenter")) { m_hideAnimPresenter = (LegoHideAnimPresenter*) p_object; + } } else if (p_object->IsA("LegoCacheSound")) { LegoCacheSoundListCursor cursor(m_cacheSoundList); - if (cursor.Find((LegoCacheSound*) p_object)) + if (cursor.Find((LegoCacheSound*) p_object)) { return; + } m_cacheSoundList->Append((LegoCacheSound*) p_object); } else { - if (m_set0xa8.find(p_object) == m_set0xa8.end()) + if (m_set0xa8.find(p_object) == m_set0xa8.end()) { m_set0xa8.insert(p_object); + } } if (!m_set0xd0.empty() && p_object->IsA("MxPresenter")) { @@ -349,38 +364,45 @@ void LegoWorld::Remove(MxCore* p_object) else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) { MxPresenterListCursor cursor(&m_animPresenters); - if (cursor.Find((MxPresenter*) p_object)) + if (cursor.Find((MxPresenter*) p_object)) { cursor.Detach(); + } - if (p_object->IsA("LegoHideAnimPresenter")) + if (p_object->IsA("LegoHideAnimPresenter")) { m_hideAnimPresenter = NULL; + } } else if (p_object->IsA("MxEntity")) { - if (p_object->IsA("LegoPathActor")) + if (p_object->IsA("LegoPathActor")) { FUN_1001fc80((IslePathActor*) p_object); + } if (m_entityList) { LegoEntityListCursor cursor(m_entityList); - if (cursor.Find((LegoEntity*) p_object)) + if (cursor.Find((LegoEntity*) p_object)) { cursor.Detach(); + } } } else if (p_object->IsA("LegoCacheSound")) { LegoCacheSoundListCursor cursor(m_cacheSoundList); - if (cursor.Find((LegoCacheSound*) p_object)) + if (cursor.Find((LegoCacheSound*) p_object)) { cursor.Detach(); + } } else { it = m_set0xa8.find(p_object); - if (it != m_set0xa8.end()) + if (it != m_set0xa8.end()) { m_set0xa8.erase(it); + } } it = m_set0xd0.find(p_object); - if (it != m_set0xd0.end()) + if (it != m_set0xd0.end()) { m_set0xd0.erase(it); + } } } @@ -393,8 +415,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) while (cursor.Next(presenter)) { MxDSAction* action = presenter->GetAction(); - if (!strcmp(action->GetObjectName(), p_name)) + if (!strcmp(action->GetObjectName(), p_name)) { return presenter; + } } return NULL; @@ -404,12 +427,14 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) LegoEntity* entity; while (cursor.Next(entity)) { - if (!p_name) + if (!p_name) { return entity; + } LegoROI* roi = entity->GetROI(); - if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) + if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) { return entity; + } } return NULL; @@ -419,8 +444,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) MxPresenter* presenter; while (cursor.Next(presenter)) { - if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) + if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) { return presenter; + } } return NULL; @@ -431,8 +457,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) MxPresenter* presenter = (MxPresenter*) *it; MxDSAction* action = presenter->GetAction(); - if (!strcmp(action->GetObjectName(), p_name)) + if (!strcmp(action->GetObjectName(), p_name)) { return *it; + } } } @@ -447,8 +474,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) LegoEntity* entity; while (entityCursor.Next(entity)) { - if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) + if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) { return entity; + } } MxPresenterListCursor controlPresenterCursor(&m_controlPresenters); @@ -457,8 +485,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) while (controlPresenterCursor.Next(presenter)) { MxDSAction* action = presenter->GetAction(); - if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) { return presenter; + } } MxPresenterListCursor animPresenterCursor(&m_animPresenters); @@ -466,8 +495,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) while (animPresenterCursor.Next(presenter)) { MxDSAction* action = presenter->GetAction(); - if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) { return presenter; + } } for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { @@ -477,18 +507,128 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) MxPresenter* presenter = (MxPresenter*) *it; MxDSAction* action = presenter->GetAction(); - if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) { return *it; + } } } return NULL; } -// STUB: LEGO1 0x10021a70 -void LegoWorld::VTable0x68(MxBool p_add) +// FUNCTION: LEGO1 0x10021a70 +void LegoWorld::Enable(MxBool p_enable) { - // TODO + if (p_enable && !m_set0xd0.empty()) { + if (CurrentWorld() != this) { + if (CurrentWorld()) { + AnimationManager()->FUN_10061010(0); + CurrentWorld()->Enable(FALSE); + + LegoEntityListCursor cursor(m_entityList); + LegoEntity* entity; + + while (cursor.Next(entity)) { + if (entity->GetROI()) { + entity->GetROI()->SetUnknown0x104(entity); + GetViewManager()->AddToUnknown0x08(entity->GetROI()); + } + } + } + + while (!m_set0xd0.empty()) { + MxCoreSet::iterator it = m_set0xd0.begin(); + + if ((*it)->IsA("MxPresenter")) { + ((MxPresenter*) *it)->Enable(TRUE); + } + else if ((*it)->IsA("LegoPathController")) { + ((LegoPathController*) *it)->Enable(TRUE); + } + + m_set0xd0.erase(it); + } + + SetCurrentWorld(this); + ControlManager()->FUN_10028df0(&m_controlPresenters); + InputManager()->SetCamera(m_cameraController); + + if (m_cameraController) { + InputManager()->Register(m_cameraController->GetNavController()); + Lego()->SetNavController(m_cameraController->GetNavController()); + } + + if (m_unk0xec != -1) { + PlantManager()->FUN_10026360(m_unk0xec); + AnimationManager()->FUN_1005f720(m_unk0xec); + BuildingManager()->FUN_1002fa00(); + AnimationManager()->FUN_1005f0b0(); + } + + GameState()->FUN_10039940(); + SetIsWorldActive(TRUE); + } + } + else if (!p_enable && m_set0xd0.empty()) { + MxPresenter* presenter; + LegoPathController* controller; + IslePathActor* vehicle = CurrentVehicle(); + + if (vehicle) { + FUN_1001fc80(vehicle); + } + + AnimationManager()->FUN_1005ee80(FALSE); + m_set0xd0.insert(this); + + if (m_unk0xec != -1) { + PlantManager()->FUN_100263a0(m_unk0xec); + BuildingManager()->FUN_1002fb30(); + } + + MxPresenterListCursor controlPresenterCursor(&m_controlPresenters); + + while (controlPresenterCursor.Next(presenter)) { + if (presenter->IsEnabled()) { + m_set0xd0.insert(presenter); + presenter->Enable(FALSE); + } + } + + for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + if ((*it)->IsA("LegoActionControlPresenter") || + ((*it)->IsA("MxPresenter") && ((MxPresenter*) *it)->IsEnabled())) { + m_set0xd0.insert(*it); + ((MxPresenter*) *it)->Enable(FALSE); + } + } + + if (CurrentWorld() && CurrentWorld() == this) { + ControlManager()->FUN_10028df0(NULL); + Lego()->SetCurrentWorld(NULL); + } + + if (InputManager()->GetCamera() == m_cameraController) { + InputManager()->ClearCamera(); + } + + if (m_cameraController) { + InputManager()->UnRegister(m_cameraController->GetNavController()); + + if (NavController() == m_cameraController->GetNavController()) { + Lego()->SetNavController(NULL); + } + } + + LegoPathControllerListCursor pathControllerCursor(&m_list0x68); + + while (pathControllerCursor.Next(controller)) { + controller->Enable(FALSE); + m_set0xd0.insert(controller); + } + + GetViewManager()->RemoveAll(NULL); + } } // FUNCTION: LEGO1 0x10022080 @@ -502,8 +642,9 @@ MxResult LegoWorld::Tickle() ReadyWorld(); return TRUE; case e_two: - if (PresentersPending()) + if (PresentersPending()) { break; + } default: m_startupTicks--; } @@ -519,8 +660,9 @@ MxBool LegoWorld::PresentersPending() MxPresenter* presenter; while (controlPresenterCursor.Next(presenter)) { - if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) + if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) { return TRUE; + } } MxPresenterListCursor animPresenterCursor(&m_animPresenters); @@ -528,12 +670,14 @@ MxBool LegoWorld::PresentersPending() while (animPresenterCursor.Next(presenter)) { if (presenter->IsEnabled()) { if (presenter->IsA("LegoLocomotionAnimPresenter")) { - if (!presenter->HasTickleStatePassed(MxPresenter::e_ready)) + if (!presenter->HasTickleStatePassed(MxPresenter::e_ready)) { return TRUE; + } } else { - if (!presenter->HasTickleStatePassed(MxPresenter::e_starting)) + if (!presenter->HasTickleStatePassed(MxPresenter::e_starting)) { return TRUE; + } } } } @@ -542,8 +686,9 @@ MxBool LegoWorld::PresentersPending() if ((*it)->IsA("MxPresenter")) { presenter = (MxPresenter*) *it; - if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) + if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) { return TRUE; + } } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 072da137..d4e002de 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -100,8 +100,9 @@ MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSA action->SetOrigin(this); m_list.push_back(presenter); } - else if (presenter) + else if (presenter) { delete presenter; + } } VideoManager()->RegisterPresenter(*this); diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstation.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstation.cpp index 76e0f771..36e48f56 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstation.cpp @@ -54,7 +54,7 @@ void GasStation::ReadyWorld() } // STUB: LEGO1 0x10005c40 -void GasStation::VTable0x68(MxBool p_add) +void GasStation::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/hospital/hospital.cpp b/LEGO1/lego/legoomni/src/hospital/hospital.cpp index b141956d..8412cee5 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospital.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospital.cpp @@ -58,7 +58,7 @@ void Hospital::ReadyWorld() } // STUB: LEGO1 0x10076220 -void Hospital::VTable0x68(MxBool p_add) +void Hospital::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp index 697ce5f1..d8a87fa4 100644 --- a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp @@ -1,5 +1,6 @@ #include "elevatorbottom.h" +#include "act1state.h" #include "jukebox.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -7,9 +8,14 @@ #include "legoomni.h" #include "mxnotificationmanager.h" #include "mxomni.h" +#include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) +// STRING: LEGO1 0x100f0d34 +// GLOBAL: LEGO1 0x100f3a44 +const char* g_cameraLoc = "CAMERA_LOCATION"; + // FUNCTION: LEGO1 0x10017e90 ElevatorBottom::ElevatorBottom() { @@ -38,8 +44,8 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction) SetIsWorldActive(FALSE); - GameState()->SetUnknown424(5); - GameState()->FUN_1003a720(0); + GameState()->SetCurrentArea(5); + GameState()->StopArea(); return result; } @@ -52,11 +58,11 @@ MxLong ElevatorBottom::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetType()) { - case c_notificationType17: - ret = HandleNotification17(p_param); + case c_notificationClick: + ret = HandleClick((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: - GameState()->HandleAction(m_unk0xf8); + GameState()->SwitchArea(m_unk0xf8); break; } } @@ -72,18 +78,49 @@ void ElevatorBottom::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } -// STUB: LEGO1 0x100181d0 -MxLong ElevatorBottom::HandleNotification17(MxParam& p_param) +// FUNCTION: LEGO1 0x100181d0 +MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param) { - return 0; + MxLong result = 0; + + if (p_param.GetUnknown0x28() == 1) { + switch (p_param.GetClickedObjectId()) { + case 1: + m_unk0xf8 = 3; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + result = 1; + break; + case 2: + m_unk0xf8 = 2; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + result = 1; + break; + case 3: + LegoGameState* gs = GameState(); + Act1State* state = (Act1State*) gs->GetState("Act1State"); + + if (state == NULL) { + state = (Act1State*) gs->CreateState("Act1State"); + } + + state->SetUnknown1c(1); + m_unk0xf8 = 6; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + VariableTable()->SetVariable(g_cameraLoc, "LCAMZI1,90"); + result = 1; + break; + } + } + + return result; } // FUNCTION: LEGO1 0x100182c0 -void ElevatorBottom::VTable0x68(MxBool p_add) +void ElevatorBottom::Enable(MxBool p_enable) { - LegoWorld::VTable0x68(p_add); + LegoWorld::Enable(p_enable); - if (p_add) { + if (p_enable) { InputManager()->SetWorld(this); SetIsWorldActive(FALSE); } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 651f06a6..38af048d 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -10,6 +10,7 @@ #include "legovideomanager.h" #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" +#include "mxcontrolpresenter.h" #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxticklemanager.h" @@ -28,11 +29,10 @@ const char* g_object2x4grn = "2x4grn"; Infocenter::Infocenter() { m_unk0xfc = 0; - m_unk0x11c = 0; + m_unk0x11c = NULL; m_infocenterState = NULL; - m_frameHotBitmap = 0; - m_unk0x11c = 0; - m_unk0x104 = 0; + m_frameHotBitmap = NULL; + m_transitionDestination = 0; m_currentInfomainScript = c_noInfomain; m_currentCutscene = e_noIntro; @@ -73,28 +73,54 @@ Infocenter::~Infocenter() TickleManager()->UnregisterClient(this); } -// STUB: LEGO1 0x1006ed90 +// FUNCTION: LEGO1 0x1006ed90 MxResult Infocenter::Create(MxDSAction& p_dsAction) { - if (LegoWorld::Create(p_dsAction) == SUCCESS) { + MxResult result = LegoWorld::Create(p_dsAction); + if (result == SUCCESS) { InputManager()->SetWorld(this); ControlManager()->Register(this); } - LegoGameState* gs = GameState(); - m_infocenterState = (InfocenterState*) gs->GetState("InfocenterState"); + m_infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); if (!m_infocenterState) { - m_infocenterState = (InfocenterState*) gs->CreateState("InfocenterState"); + m_infocenterState = (InfocenterState*) GameState()->CreateState("InfocenterState"); m_infocenterState->SetUnknown0x74(3); } else { - // TODO + if (m_infocenterState->GetUnknown0x74() != 8 && m_infocenterState->GetUnknown0x74() != 4 && + m_infocenterState->GetUnknown0x74() != 15) { + m_infocenterState->SetUnknown0x74(2); + } + + MxS16 count, i; + for (count = 0; count < m_infocenterState->GetInfocenterBufferSize(); count++) { + if (m_infocenterState->GetInfocenterBufferElement(count) == NULL) { + break; + } + } + + for (i = 0; i < count; i++) { + if (m_infocenterState->GetInfocenterBufferElement(i)) { + m_infocenterState->GetInfocenterBufferElement(i)->Enable(TRUE); + m_infocenterState->GetInfocenterBufferElement(i)->SetTickleState(MxPresenter::e_repeating); + m_infocenterState->GetInfocenterBufferElement(i)->VTable0x88(((7 - count) / 2 + i) * 29 + 223, 45); + } + } + } + + GameState()->SetCurrentArea(2); + GameState()->StopArea(0); + + if (m_infocenterState->GetUnknown0x74() == 4) { + LegoGameState* state = GameState(); + state->SetPreviousArea(GameState()->GetUnknown0x42c()); } - // TODO InputManager()->Register(this); SetIsWorldActive(FALSE); - return SUCCESS; + + return result; } // FUNCTION: LEGO1 0x1006ef10 @@ -106,10 +132,10 @@ MxLong Infocenter::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationType0: - result = HandleNotification0(p_param); + result = HandleNotification0((MxNotificationParam&) p_param); break; case c_notificationEndAction: - result = HandleEndAction(p_param); + result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; case c_notificationKeyPress: result = HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey()); @@ -126,8 +152,8 @@ MxLong Infocenter::Notify(MxParam& p_param) ((LegoEventNotificationParam&) p_param).GetY() ); break; - case c_notificationType17: - result = HandleNotification17(p_param); + case c_notificationClick: + result = HandleClick((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: StopBookAnimation(); @@ -137,10 +163,10 @@ MxLong Infocenter::Notify(MxParam& p_param) StartCredits(); m_infocenterState->SetUnknown0x74(0xd); } - else if (m_unk0x104 != 0) { + else if (m_transitionDestination != 0) { BackgroundAudioManager()->RaiseVolume(); - GameState()->HandleAction(m_unk0x104); - m_unk0x104 = 0; + GameState()->SwitchArea(m_transitionDestination); + m_transitionDestination = 0; } break; } @@ -150,17 +176,18 @@ MxLong Infocenter::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x1006f080 -MxLong Infocenter::HandleEndAction(MxParam& p_param) +MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) { - MxDSAction* action = ((MxEndActionNotificationParam&) p_param).GetAction(); - if (action->GetAtomId() == *g_creditsScript && action->GetObjectId() == 499) { + MxDSAction* action = p_param.GetAction(); + if (action->GetAtomId() == *g_creditsScript && action->GetObjectId() == c_unk499) { Lego()->CloseMainWindow(); return 1; } if (action->GetAtomId() == m_atom && - (action->GetObjectId() == 40 || action->GetObjectId() == 41 || action->GetObjectId() == 42 || - action->GetObjectId() == 43 || action->GetObjectId() == 44)) { + (action->GetObjectId() == c_mamaMovie || action->GetObjectId() == c_papaMovie || + action->GetObjectId() == c_pepperMovie || action->GetObjectId() == c_nickMovie || + action->GetObjectId() == c_lauraMovie)) { if (m_unk0x1d4) { m_unk0x1d4--; } @@ -189,14 +216,15 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) break; } - FUN_10070dc0(TRUE); + UpdateFrameHot(TRUE); } } MxLong result = m_radio.Notify(p_param); - if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript)) + if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript)) { return result; + } if (action->GetObjectId() == c_returnBackGuidanceDialogue2) { ControlManager()->FUN_100293c0(0x10, action->GetAtomId().GetInternal(), 0); @@ -259,7 +287,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) BackgroundAudioManager()->RaiseVolume(); return 1; case 4: - if (action->GetObjectId() == 70 || action->GetObjectId() == 71) { + if (action->GetObjectId() == c_goToRegBook || action->GetObjectId() == c_goToRegBookRed) { TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); m_infocenterState->SetUnknown0x74(14); return 1; @@ -383,63 +411,82 @@ void Infocenter::InitializeBitmaps() ((MxPresenter*) Find(m_atom, c_radioCtl))->Enable(TRUE); m_mapAreas[0].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap"); - m_mapAreas[0].m_unk0x08 = 391; - m_mapAreas[0].m_unk0x0c = 182; - m_mapAreas[0].m_unk0x10 = 427; - m_mapAreas[0].m_unk0x14 = 230; + m_mapAreas[0].m_area.SetLeft(391); + m_mapAreas[0].m_area.SetTop(182); + m_mapAreas[0].m_area.SetRight(427); + m_mapAreas[0].m_area.SetBottom(230); m_mapAreas[0].m_unk0x04 = 3; m_mapAreas[1].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap"); - m_mapAreas[1].m_unk0x08 = 304; - m_mapAreas[1].m_unk0x0c = 225; - m_mapAreas[1].m_unk0x10 = 350; - m_mapAreas[1].m_unk0x14 = 268; + m_mapAreas[1].m_area.SetLeft(304); + m_mapAreas[1].m_area.SetTop(225); + m_mapAreas[1].m_area.SetRight(350); + m_mapAreas[1].m_area.SetBottom(268); m_mapAreas[1].m_unk0x04 = 10; m_mapAreas[2].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap"); - m_mapAreas[2].m_unk0x08 = 301; - m_mapAreas[2].m_unk0x0c = 133; - m_mapAreas[2].m_unk0x10 = 347; - m_mapAreas[2].m_unk0x14 = 181; + m_mapAreas[2].m_area.SetLeft(301); + m_mapAreas[2].m_area.SetTop(133); + m_mapAreas[2].m_area.SetRight(347); + m_mapAreas[2].m_area.SetBottom(181); m_mapAreas[2].m_unk0x04 = 11; m_mapAreas[3].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap"); - m_mapAreas[3].m_unk0x08 = 289; - m_mapAreas[3].m_unk0x0c = 182; - m_mapAreas[3].m_unk0x10 = 335; - m_mapAreas[3].m_unk0x14 = 225; + m_mapAreas[3].m_area.SetLeft(289); + m_mapAreas[3].m_area.SetTop(182); + m_mapAreas[3].m_area.SetRight(335); + m_mapAreas[3].m_area.SetBottom(225); m_mapAreas[3].m_unk0x04 = 12; m_mapAreas[4].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap"); - m_mapAreas[4].m_unk0x10 = 391; - m_mapAreas[4].m_unk0x08 = 350; - m_mapAreas[4].m_unk0x0c = 161; - m_mapAreas[4].m_unk0x14 = 209; + m_mapAreas[4].m_area.SetLeft(350); + m_mapAreas[4].m_area.SetTop(161); + m_mapAreas[4].m_area.SetRight(391); + m_mapAreas[4].m_area.SetBottom(209); m_mapAreas[4].m_unk0x04 = 13; m_mapAreas[5].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap"); - m_mapAreas[5].m_unk0x08 = 392; - m_mapAreas[5].m_unk0x0c = 130; - m_mapAreas[5].m_unk0x10 = 438; - m_mapAreas[5].m_unk0x14 = 176; + m_mapAreas[5].m_area.SetLeft(392); + m_mapAreas[5].m_area.SetTop(130); + m_mapAreas[5].m_area.SetRight(438); + m_mapAreas[5].m_area.SetBottom(176); m_mapAreas[5].m_unk0x04 = 14; m_mapAreas[6].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap"); - m_mapAreas[6].m_unk0x08 = 396; - m_mapAreas[6].m_unk0x0c = 229; - m_mapAreas[6].m_unk0x10 = 442; - m_mapAreas[6].m_unk0x14 = 272; + m_mapAreas[6].m_area.SetLeft(396); + m_mapAreas[6].m_area.SetTop(229); + m_mapAreas[6].m_area.SetRight(442); + m_mapAreas[6].m_area.SetBottom(272); m_mapAreas[6].m_unk0x04 = 15; m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap"); - FUN_10070dc0(TRUE); + UpdateFrameHot(TRUE); } -// STUB: LEGO1 0x1006fd00 +// FUNCTION: LEGO1 0x1006fd00 MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y) { - return 1; + if (m_unk0x11c) { + if (!m_unk0x11c->IsEnabled()) { + MxS32 oldDisplayZ = m_unk0x11c->GetDisplayZ(); + + m_unk0x11c->SetDisplayZ(1000); + VideoManager()->SortPresenterList(); + m_unk0x11c->Enable(TRUE); + m_unk0x11c->VTable0x88(p_x, p_y); + + m_unk0x11c->SetDisplayZ(oldDisplayZ); + } + else { + m_unk0x11c->VTable0x88(p_x, p_y); + } + + FUN_10070d10(p_x, p_y); + return 1; + } + + return 0; } // FUNCTION: LEGO1 0x1006fda0 @@ -489,30 +536,396 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key) return result; } -// STUB: LEGO1 0x1006feb0 +// FUNCTION: LEGO1 0x1006feb0 MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) { + if (m_unk0x11c) { + MxControlPresenter* control = InputManager()->GetControlManager()->FUN_100294e0(p_x - 1, p_y - 1); + + switch (m_unk0x11c->GetAction()->GetObjectId()) { + case c_mamaSelected: + m_unk0xfc = 2; + break; + case c_papaSelected: + m_unk0xfc = 3; + break; + case c_pepperSelected: + m_unk0xfc = 1; + break; + case c_nickSelected: + m_unk0xfc = 4; + break; + case c_lauraSelected: + m_unk0xfc = 5; + break; + } + + if (control != NULL) { + m_infoManDialogueTimer = 0; + + switch (control->GetAction()->GetObjectId()) { + case c_mamaCtl: + if (m_unk0xfc == 2) { + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + PlayAction(c_mamaMovie); + m_unk0x1d4++; + } + break; + case c_papaCtl: + if (m_unk0xfc == 3) { + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + PlayAction(c_papaMovie); + m_unk0x1d4++; + } + break; + case c_pepperCtl: + if (m_unk0xfc == 1) { + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + PlayAction(c_pepperMovie); + m_unk0x1d4++; + } + break; + case c_nickCtl: + if (m_unk0xfc == 4) { + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + PlayAction(c_nickMovie); + m_unk0x1d4++; + } + break; + case c_lauraCtl: + if (m_unk0xfc == 5) { + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + PlayAction(c_lauraMovie); + m_unk0x1d4++; + } + break; + } + } + else { + if (m_unk0x1c8 != -1) { + m_infoManDialogueTimer = 0; + + switch (m_mapAreas[m_unk0x1c8].m_unk0x04) { + case 3: + GameState()->FUN_10039780(m_unk0xfc); + + switch (m_unk0xfc) { + case 1: + PlayAction(c_pepperCharacterSelect); + break; + case 2: + PlayAction(c_mamaCharacterSelect); + break; + case 3: + PlayAction(c_papaCharacterSelect); + break; + case 4: + PlayAction(c_nickCharacterSelect); + break; + case 5: + PlayAction(c_lauraCharacterSelect); + break; + } + break; + case 10: + if (m_unk0xfc) { + m_transitionDestination = 16; + m_infocenterState->SetUnknown0x74(5); + } + break; + case 11: + if (m_unk0xfc) { + m_transitionDestination = 19; + m_infocenterState->SetUnknown0x74(5); + } + break; + case 12: + if (m_unk0xfc) { + m_transitionDestination = 22; + m_infocenterState->SetUnknown0x74(5); + } + break; + case 13: + if (m_unk0xfc) { + m_transitionDestination = 25; + m_infocenterState->SetUnknown0x74(5); + } + break; + case 14: + if (m_unk0xfc) { + m_transitionDestination = 29; + m_infocenterState->SetUnknown0x74(5); + } + break; + case 15: + if (m_unk0xfc) { + m_transitionDestination = 32; + m_infocenterState->SetUnknown0x74(5); + } + break; + } + } + } + + m_unk0x11c->Enable(FALSE); + m_unk0x11c = NULL; + + if (m_infocenterState->GetUnknown0x74() == 5) { + InfomainScript dialogueToPlay; + + if (GameState()->GetUnknown10() == 0) { + if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) { + m_infocenterState->SetUnknown0x74(2); + m_transitionDestination = 0; + dialogueToPlay = c_registerToContinueDialogue; + } + else { + switch (m_unk0xfc) { + case 1: + dialogueToPlay = c_pepperCharacterSelect; + break; + case 2: + dialogueToPlay = c_mamaCharacterSelect; + break; + case 3: + dialogueToPlay = c_papaCharacterSelect; + break; + case 4: + dialogueToPlay = c_nickCharacterSelect; + break; + case 5: + dialogueToPlay = c_lauraCharacterSelect; + GameState()->SetUnknown0x0c(m_unk0xfc); + break; + default: + dialogueToPlay = + (InfomainScript) m_infocenterState->GetUnknown0x44()[GameState()->GetUnknown10()].Next(); + break; + } + + InputManager()->DisableInputProcessing(); + InputManager()->SetUnknown336(TRUE); + } + } + else { + dialogueToPlay = + (InfomainScript) m_infocenterState->GetUnknown0x44()[GameState()->GetUnknown10()].Next(); + } + + PlayAction(dialogueToPlay); + } + + UpdateFrameHot(TRUE); + FUN_10070d10(0, 0); + } + + return FALSE; +} + +// FUNCTION: LEGO1 0x10070370 +MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param) +{ + if (p_param.GetUnknown0x28() == 1) { + m_infoManDialogueTimer = 0; + + InfomainScript actionToPlay = c_noInfomain; + StopCurrentAction(); + InfomainScript characterBitmap = c_noInfomain; + + GameState(); + + switch (p_param.GetClickedObjectId()) { + case c_leftArrowCtl: + m_infocenterState->SetUnknown0x74(14); + StopCurrentAction(); + + if (GameState()->GetUnknown10() == 0) { + m_radio.Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + m_transitionDestination = 5; + } + else { + MxU32 objectId = m_infocenterState->GetUnknown0x68().Next(); + PlayAction((InfomainScript) objectId); + } + + break; + case c_rightArrowCtl: + m_infocenterState->SetUnknown0x74(14); + StopCurrentAction(); + + if (GameState()->GetUnknown10() == 0) { + m_radio.Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + m_transitionDestination = 13; + } + else { + MxU32 objectId = m_infocenterState->GetUnknown0x68().Next(); + PlayAction((InfomainScript) objectId); + } + + break; + case c_infoCtl: + m_radio.Stop(); + break; + case c_doorCtl: + if (m_infocenterState->GetUnknown0x74() != 8) { + actionToPlay = c_exitConfirmationDialogue; + m_radio.Stop(); + m_infocenterState->SetUnknown0x74(8); + } + + break; + case c_boatCtl: + actionToPlay = c_boatCtlDescription; + m_radio.Stop(); + break; + case c_raceCtl: + actionToPlay = c_raceCtlDescription; + m_radio.Stop(); + break; + case c_pizzaCtl: + actionToPlay = c_pizzaCtlDescription; + m_radio.Stop(); + break; + case c_gasCtl: + actionToPlay = c_gasCtlDescription; + m_radio.Stop(); + break; + case c_medCtl: + actionToPlay = c_medCtlDescription; + m_radio.Stop(); + break; + case c_copCtlDescription: + actionToPlay = c_copCtlDescription; + m_radio.Stop(); + break; + case c_bigInfoCtl: + // TODO + break; + case c_bookCtl: + m_transitionDestination = 12; + m_infocenterState->SetUnknown0x74(4); + actionToPlay = GameState()->GetUnknown10() ? c_goToRegBookRed : c_goToRegBook; + m_radio.Stop(); + GameState()->SetCurrentArea(GameState()->GetPreviousArea()); + InputManager()->DisableInputProcessing(); + break; + case c_mamaCtl: + characterBitmap = c_mamaSelected; + UpdateFrameHot(FALSE); + break; + case c_papaCtl: + characterBitmap = c_papaSelected; + UpdateFrameHot(FALSE); + break; + case c_pepperCtl: + characterBitmap = c_pepperSelected; + UpdateFrameHot(FALSE); + break; + case c_nickCtl: + characterBitmap = c_nickSelected; + UpdateFrameHot(FALSE); + break; + case c_lauraCtl: + characterBitmap = c_lauraSelected; + UpdateFrameHot(FALSE); + break; + } + + if (actionToPlay != c_noInfomain) { + PlayAction(actionToPlay); + } + + if (characterBitmap != c_noInfomain) { + m_unk0x11c = (MxStillPresenter*) Find(m_atom, characterBitmap); + } + } + return 1; } -// STUB: LEGO1 0x10070370 -MxU8 Infocenter::HandleNotification17(MxParam&) +// FUNCTION: LEGO1 0x10070870 +MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param) { - return 1; -} + // MxLong result + MxCore* sender = p_param.GetSender(); + + if (sender == NULL) { + if (m_infocenterState->GetUnknown0x74() == 8) { + m_infoManDialogueTimer = 0; + StopCutscene(); + PlayAction(c_exitConfirmationDialogue); + } + } + else if (sender->IsA("MxEntity") && m_infocenterState->GetUnknown0x74() != 5 && m_infocenterState->GetUnknown0x74() != 12) { + switch (((MxEntity*) sender)->GetEntityId()) { + case 5: { + m_infoManDialogueTimer = 0; + + InfomainScript objectId; + if (GameState()->GetUnknown10()) { + objectId = (InfomainScript) m_infocenterState->GetUnknown0x14().Next(); + } + else { + objectId = (InfomainScript) m_infocenterState->GetUnknown0x08().Next(); + } + + PlayAction(objectId); + FUN_10015860(g_object2x4red, 0); + FUN_10015860(g_object2x4grn, 0); + return 1; + } + case 6: + if (m_infocenterState->GetUnknown0x74() == 8) { + StopCurrentAction(); + FUN_10015860(g_object2x4red, 0); + FUN_10015860(g_object2x4grn, 0); + m_infocenterState->SetUnknown0x74(2); + PlayAction(c_infomanSneeze); + return 1; + } + case 7: + if (m_infocenterState->GetUnknown0x74() == 8) { + if (m_infocenterState->GetInfocenterBufferElement(0)) { + GameState()->Save(0); + } + + m_infocenterState->SetUnknown0x74(12); + PlayAction(c_exitGameDialogue); + InputManager()->DisableInputProcessing(); + InputManager()->SetUnknown336(TRUE); + return 1; + } + } + } + else { + if (sender->IsA("Radio") && m_radio.GetState()->IsActive()) { + if (m_currentInfomainScript == c_mamaMovie || m_currentInfomainScript == c_papaMovie || + m_currentInfomainScript == c_pepperMovie || m_currentInfomainScript == c_nickMovie || + m_currentInfomainScript == c_lauraMovie || m_currentInfomainScript == c_unk557 || + m_currentInfomainScript == c_boatCtlDescription || m_currentInfomainScript == c_raceCtlDescription || + m_currentInfomainScript == c_pizzaCtlDescription || m_currentInfomainScript == c_gasCtlDescription || + m_currentInfomainScript == c_medCtlDescription || m_currentInfomainScript == c_copCtlDescription) { + StopCurrentAction(); + } + } + } -// STUB: LEGO1 0x10070870 -MxLong Infocenter::HandleNotification0(MxParam&) -{ return 1; } // FUNCTION: LEGO1 0x10070aa0 -void Infocenter::VTable0x68(MxBool p_add) +void Infocenter::Enable(MxBool p_enable) { - LegoWorld::VTable0x68(p_add); + LegoWorld::Enable(p_enable); - if (p_add) { + if (p_enable) { InputManager()->SetWorld(this); SetIsWorldActive(FALSE); } @@ -601,9 +1014,82 @@ MxBool Infocenter::VTable0x5c() return TRUE; } -// STUB: LEGO1 0x10070dc0 -void Infocenter::FUN_10070dc0(MxBool) +// FUNCTION: LEGO1 0x10070d10 +void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) { + MxS16 i; + for (i = 0; i < (MxS32) (sizeof(m_mapAreas) / sizeof(m_mapAreas[0])); i++) { + MxS32 right = m_mapAreas[i].m_area.GetRight(); + MxS32 bottom = m_mapAreas[i].m_area.GetBottom(); + MxS32 left = m_mapAreas[i].m_area.GetLeft(); + MxS32 top = m_mapAreas[i].m_area.GetTop(); + + if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom) { + break; + } + } + + if (i == 7) { + i = -1; + } + + if (i != m_unk0x1c8) { + if (m_unk0x1c8 != -1) { + m_mapAreas[m_unk0x1c8].m_presenter->Enable(FALSE); + } + + m_unk0x1c8 = i; + if (i != -1) { + m_mapAreas[i].m_presenter->Enable(TRUE); + } + } +} + +// FUNCTION: LEGO1 0x10070dc0 +void Infocenter::UpdateFrameHot(MxBool p_display) +{ + if (p_display) { + MxS32 x, y; + + switch (GameState()->GetUnknownC()) { + case 1: + x = 302; + y = 81; + break; + case 2: + x = 204; + y = 81; + break; + case 3: + x = 253; + y = 81; + break; + case 4: + x = 353; + y = 81; + break; + case 5: + x = 399; + y = 81; + break; + default: + return; + } + + MxS32 originalDisplayZ = m_frameHotBitmap->GetDisplayZ(); + + m_frameHotBitmap->SetDisplayZ(1000); + VideoManager()->SortPresenterList(); + + m_frameHotBitmap->Enable(TRUE); + m_frameHotBitmap->VTable0x88(x, y); + m_frameHotBitmap->SetDisplayZ(originalDisplayZ); + } + else { + if (m_frameHotBitmap) { + m_frameHotBitmap->Enable(FALSE); + } + } } // STUB: LEGO1 0x10070e90 @@ -611,9 +1097,33 @@ void Infocenter::FUN_10070e90() { } -// STUB: LEGO1 0x10070f60 +// FUNCTION: LEGO1 0x10070f60 MxBool Infocenter::VTable0x64() { + if (m_infocenterState != NULL) { + MxU32 val = m_infocenterState->GetUnknown0x74(); + + if (val == 0) { + StopCutscene(); + m_infocenterState->SetUnknown0x74(1); + } + else if (val == 13) { + StopCredits(); + } + else if (val != 8) { + m_infocenterState->SetUnknown0x74(8); + +#ifdef COMPAT_MODE + { + MxNotificationParam param(c_notificationType0, NULL); + Notify(param); + } +#else + Notify(MxNotificationParam(c_notificationType0, NULL)); +#endif + } + } + return FALSE; } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp index 599096b2..325b5eb0 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp @@ -1,11 +1,15 @@ #include "infocenterdoor.h" +#include "infocenterstate.h" #include "jukebox.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legoomni.h" +#include "mxactionnotificationparam.h" +#include "mxbackgroundaudiomanager.h" #include "mxnotificationmanager.h" +#include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc) @@ -39,17 +43,37 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction) SetIsWorldActive(FALSE); - GameState()->SetUnknown424(3); - GameState()->FUN_1003a720(0); + GameState()->SetCurrentArea(3); + GameState()->StopArea(); return result; } -// STUB: LEGO1 0x100379e0 +// FUNCTION: LEGO1 0x100379e0 MxLong InfocenterDoor::Notify(MxParam& p_param) { - // TODO - return LegoWorld::Notify(p_param); + MxLong result = 0; + LegoWorld::Notify(p_param); + + if (m_worldStarted) { + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationEndAction: + if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) { + BackgroundAudioManager()->RaiseVolume(); + result = 1; + } + break; + case c_notificationClick: + result = HandleClick((LegoControlManagerEvent&) p_param); + break; + case c_notificationTransitioned: + GameState()->SwitchArea(m_unk0xf8); + result = 1; + break; + } + } + + return result; } // FUNCTION: LEGO1 0x10037a70 @@ -60,12 +84,71 @@ void InfocenterDoor::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } -// FUNCTION: LEGO1 0x10037c80 -void InfocenterDoor::VTable0x68(MxBool p_add) +// FUNCTION: LEGO1 0x10037a90 +MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param) { - LegoWorld::VTable0x68(p_add); + MxLong result = 0; - if (p_add) { + if (p_param.GetUnknown0x28() == 1) { + DeleteObjects(&m_atom, 500, 510); + + switch (p_param.GetClickedObjectId()) { + case 1: + m_unk0xf8 = 13; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + result = 1; + break; + case 2: + m_unk0xf8 = 5; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + result = 1; + break; + case 3: + m_unk0xf8 = 2; + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + result = 1; + break; + case 4: + if (GameState()->GetUnknownC()) { + InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); + if (state->GetInfocenterBufferElement(0) != NULL) { + m_unk0xf8 = 4; + } + else { + MxDSAction action; + action.SetObjectId(503); + action.SetAtomId(*g_infodoorScript); + BackgroundAudioManager()->LowerVolume(); + Start(&action); + goto done; + } + } + else { + MxDSAction action; + action.SetObjectId(500); + action.SetAtomId(*g_infodoorScript); + BackgroundAudioManager()->LowerVolume(); + Start(&action); + goto done; + } + + TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); + + done: + result = 1; + break; + } + } + + return result; +} + +// FUNCTION: LEGO1 0x10037c80 +void InfocenterDoor::Enable(MxBool p_enable) +{ + LegoWorld::Enable(p_enable); + + if (p_enable) { InputManager()->SetWorld(this); SetIsWorldActive(FALSE); } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp index 76ffd3ea..55f4f4d8 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp @@ -1,11 +1,110 @@ #include "infocenterstate.h" +#include "infocenter.h" + DECOMP_SIZE_ASSERT(InfocenterState, 0x94); +// GLOBAL: LEGO1 0x100f76a8 +Infocenter::InfomainScript g_unk0x100f76a8[14] = { + Infocenter::c_clickOnObjectsGuidanceDialogue, + Infocenter::c_arrowNavigationGuidanceDialogue, + Infocenter::c_elevatorGuidanceDialogue, + Infocenter::c_radioGuidanceDialogue, + Infocenter::c_exitGuidanceDialogue1, + Infocenter::c_goOutsideGuidanceDialogue, + Infocenter::c_experimentGuidanceDialogue, + Infocenter::c_returnBackGuidanceDialogue1, + Infocenter::c_bricksterWarningDialogue, + Infocenter::c_infomanHiccup, + Infocenter::c_infomanSneeze, + Infocenter::c_infomanLaughs, + Infocenter::c_newGameGuidanceDialogue, + Infocenter::c_returnBackGuidanceDialogue3 +}; + +// GLOBAL: LEGO1 0x100f76e0 +Infocenter::InfomainScript g_unk0x100f76e0[6] = { + Infocenter::c_bricksterWarningDialogue, + Infocenter::c_newGameGuidanceDialogue, + Infocenter::c_bricksterEscapedDialogue1, + Infocenter::c_bricksterEscapedDialogue5, + Infocenter::c_exitGuidanceDialogue2 + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f76f8 +Infocenter::InfomainScript g_unk0x100f76f8[6] = { + Infocenter::c_returnBackGuidanceDialogue2, + Infocenter::c_reenterInfoCenterDialogue1, + Infocenter::c_reenterInfoCenterDialogue2, + Infocenter::c_reenterInfoCenterDialogue3, + Infocenter::c_reenterInfoCenterDialogue4 + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7710 +Infocenter::InfomainScript g_unk0x100f7710[4] = { + Infocenter::c_bricksterEscapedDialogue1, + Infocenter::c_bricksterEscapedDialogue2, + Infocenter::c_bricksterEscapedDialogue3, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7720 +Infocenter::InfomainScript g_unk0x100f7720[4] = { + Infocenter::c_bricksterEscapedDialogue4, + Infocenter::c_bricksterEscapedDialogue5, + Infocenter::c_bricksterEscapedDialogue6, + Infocenter::c_bricksterEscapedDialogue7 +}; + +// GLOBAL: LEGO1 0x100f7730 +Infocenter::InfomainScript g_unk0x100f7730[4] = { + Infocenter::c_leaveInfoCenterDialogue1, + Infocenter::c_leaveInfoCenterDialogue2, + Infocenter::c_leaveInfoCenterDialogue3, + Infocenter::c_leaveInfoCenterDialogue4 +}; + +// GLOBAL: LEGO1 0x100f7740 +Infocenter::InfomainScript g_unk0x100f7740[4] = + {Infocenter::c_unk569, Infocenter::c_unk570, Infocenter::c_unk571, Infocenter::c_unk572}; + +// GLOBAL: LEGO1 0x100f7750 +Infocenter::InfomainScript g_unk0x100f7750[4] = { + Infocenter::c_unk566, + Infocenter::c_unk567, + Infocenter::c_unk568, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7760 +Infocenter::InfomainScript g_unk0x100f7760[2] = {Infocenter::c_bricksterDialogue, Infocenter::c_bricksterLaughs}; + // FUNCTION: LEGO1 0x10071600 InfocenterState::InfocenterState() { - // TODO + m_unk0x08 = LegoState::Playlist((MxU32*) g_unk0x100f76a8, sizeof(g_unk0x100f76a8) / sizeof(g_unk0x100f76a8[0])); + + m_unk0x14 = LegoState::Playlist((MxU32*) g_unk0x100f76e0, sizeof(g_unk0x100f76e0) / sizeof(g_unk0x100f76e0[0]) - 1); + + m_unk0x20[0] = + LegoState::Playlist((MxU32*) g_unk0x100f76f8, sizeof(g_unk0x100f76f8) / sizeof(g_unk0x100f76f8[0]) - 1); + + m_unk0x20[1] = + LegoState::Playlist((MxU32*) g_unk0x100f7710, sizeof(g_unk0x100f7710) / sizeof(g_unk0x100f7710[0]) - 1); + + m_unk0x20[2] = LegoState::Playlist((MxU32*) g_unk0x100f7720, sizeof(g_unk0x100f7720) / sizeof(g_unk0x100f7720[0])); + + m_unk0x44[0] = LegoState::Playlist((MxU32*) g_unk0x100f7730, sizeof(g_unk0x100f7730) / sizeof(g_unk0x100f7730[0])); + + m_unk0x44[1] = LegoState::Playlist((MxU32*) g_unk0x100f7740, sizeof(g_unk0x100f7740) / sizeof(g_unk0x100f7740[0])); + + m_unk0x44[2] = + LegoState::Playlist((MxU32*) g_unk0x100f7750, sizeof(g_unk0x100f7750) / sizeof(g_unk0x100f7750[0]) - 1); + + m_unk0x68 = LegoState::Playlist((MxU32*) g_unk0x100f7760, sizeof(g_unk0x100f7760) / sizeof(g_unk0x100f7760[0])); + memset(m_buffer, 0, sizeof(m_buffer)); } diff --git a/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp b/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp index 6f08b53e..41a7aeca 100644 --- a/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp @@ -57,7 +57,7 @@ MxResult RegistrationBook::Tickle() } // STUB: LEGO1 0x10078180 -void RegistrationBook::VTable0x68(MxBool p_add) +void RegistrationBook::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/infocenter/score.cpp b/LEGO1/lego/legoomni/src/infocenter/score.cpp index 181553d4..74744fbf 100644 --- a/LEGO1/lego/legoomni/src/infocenter/score.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/score.cpp @@ -32,8 +32,9 @@ MxBool Score::VTable0x5c() // FUNCTION: LEGO1 0x10001200 Score::~Score() { - if (InputManager()->GetWorld() == this) + if (InputManager()->GetWorld() == this) { InputManager()->ClearWorld(); + } InputManager()->UnRegister(this); ControlManager()->Unregister(this); NotificationManager()->Unregister(this); @@ -52,8 +53,8 @@ MxResult Score::Create(MxDSAction& p_dsAction) LegoGameState* gs = GameState(); ScoreState* state = (ScoreState*) gs->GetState("ScoreState"); m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState"); - GameState()->SetUnknown424(0xd); - GameState()->FUN_1003a720(0); + GameState()->SetCurrentArea(0xd); + GameState()->StopArea(); } return result; @@ -87,17 +88,19 @@ MxLong Score::Notify(MxParam& p_param) ret = FUN_10001510((MxEndActionNotificationParam&) p_param); break; case c_notificationKeyPress: - if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20) + if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20) { DeleteScript(); // Shutting down + } ret = 1; break; - case c_notificationType17: + case c_notificationClick: ret = FUN_100016d0((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: DeleteObjects(g_infoscorScript, 7, 9); - if (m_unk0xf8) - GameState()->HandleAction(m_unk0xf8); + if (m_unk0xf8) { + GameState()->SwitchArea(m_unk0xf8); + } ret = 1; break; default: @@ -145,8 +148,9 @@ void Score::ReadyWorld() action.SetAtomId(*g_infoscorScript); Start(&action); } - else + else { PlayMusic(JukeBox::e_informationCenter); + } FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } @@ -213,16 +217,17 @@ MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10001980 -void Score::VTable0x68(MxBool p_add) +void Score::Enable(MxBool p_enable) { - LegoWorld::VTable0x68(p_add); + LegoWorld::Enable(p_enable); - if (p_add) { + if (p_enable) { InputManager()->SetWorld(this); SetIsWorldActive(FALSE); } - else if (InputManager()->GetWorld() == this) + else if (InputManager()->GetWorld() == this) { InputManager()->ClearWorld(); + } } // FUNCTION: LEGO1 0x100019d0 @@ -249,25 +254,30 @@ void Score::Paint() for (MxU8 id = 1; id <= 5; id++) { m_surface = (MxU8*) desc.lpSurface; MxU16 color = 0; - if (l70) + if (l70) { color = l70->GetColor(id); + } MxU32 row = id - 1; FillArea(0, row, color); color = 0; - if (l78) + if (l78) { color = l78->GetColor(id); + } FillArea(1, row, color); color = 0; - if (l74) + if (l74) { color = l74->GetColor(id); + } FillArea(2, row, color); color = 0; - if (lesi) + if (lesi) { color = lesi->GetColor(id); + } FillArea(3, row, color); color = 0; - if (lebp) + if (lebp) { color = lebp->GetColor(id); + } FillArea(4, row, color); } diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 783bbfe3..45801476 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -64,11 +64,13 @@ MxResult LegoInputManager::Create(HWND p_hwnd) m_controlManager = new LegoControlManager; - if (!m_keyboardNotifyList) + if (!m_keyboardNotifyList) { m_keyboardNotifyList = new LegoNotifyList; + } - if (!m_eventQueue) + if (!m_eventQueue) { m_eventQueue = new LegoEventQueue; + } CreateAndAcquireKeyboard(p_hwnd); GetJoystickId(); @@ -86,16 +88,19 @@ void LegoInputManager::Destroy() { ReleaseDX(); - if (m_keyboardNotifyList) + if (m_keyboardNotifyList) { delete m_keyboardNotifyList; + } m_keyboardNotifyList = NULL; - if (m_eventQueue) + if (m_eventQueue) { delete m_eventQueue; + } m_eventQueue = NULL; - if (m_controlManager) + if (m_controlManager) { delete m_controlManager; + } } // FUNCTION: LEGO1 0x1005c030 @@ -183,8 +188,9 @@ MxResult LegoInputManager::GetJoystickState( if ((capabilities & JOYCAPS_HASPOV) != 0) { joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS; - if ((capabilities & JOYCAPS_POVCTS) != 0) + if ((capabilities & JOYCAPS_POVCTS) != 0) { joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS | JOY_RETURNPOVCTS; + } } MMRESULT mmresult = joyGetPosEx(m_joyid, &joyinfoex); @@ -220,8 +226,9 @@ void LegoInputManager::Register(MxCore* p_notify) MxAutoLocker lock(&m_criticalSection); LegoNotifyListCursor cursor(m_keyboardNotifyList); - if (!cursor.Find(p_notify)) + if (!cursor.Find(p_notify)) { m_keyboardNotifyList->Append(p_notify); + } } // FUNCTION: LEGO1 0x1005c5c0 @@ -230,8 +237,9 @@ void LegoInputManager::UnRegister(MxCore* p_notify) MxAutoLocker lock(&m_criticalSection); LegoNotifyListCursor cursor(m_keyboardNotifyList); - if (cursor.Find(p_notify)) + if (cursor.Find(p_notify)) { cursor.Detach(); + } } // FUNCTION: LEGO1 0x1005c700 @@ -276,8 +284,9 @@ void LegoInputManager::ProcessEvents() LegoEventNotificationParam event; while (m_eventQueue->Dequeue(event)) { - if (ProcessOneEvent(event)) + if (ProcessOneEvent(event)) { break; + } } } @@ -379,8 +388,9 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) p_param.SetROI(roi); if (roi && roi->GetUnk0x0c() == 1) { - for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) + for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) { roi = (LegoROI*) oroi; + } LegoEntity* entity = roi->GetUnknown0x104(); if (entity && entity->Notify(p_param) != 0) { @@ -415,8 +425,9 @@ void LegoInputManager::StartAutoDragTimer() // FUNCTION: LEGO1 0x1005cfd0 void LegoInputManager::StopAutoDragTimer() { - if (m_autoDragTimerID) + if (m_autoDragTimerID) { ::KillTimer(LegoOmni::GetInstance()->GetWindowHandle(), m_autoDragTimerID); + } } // FUNCTION: LEGO1 0x1005cff0 diff --git a/LEGO1/lego/legoomni/src/isle/isle.cpp b/LEGO1/lego/legoomni/src/isle/isle.cpp index 40e07fa1..c5c9ae1f 100644 --- a/LEGO1/lego/legoomni/src/isle/isle.cpp +++ b/LEGO1/lego/legoomni/src/isle/isle.cpp @@ -46,8 +46,8 @@ Isle::~Isle() InputManager()->ClearWorld(); } - if (GetCurrentVehicle() != NULL) { - VTable0x6c(GetCurrentVehicle()); + if (CurrentVehicle() != NULL) { + VTable0x6c(CurrentVehicle()); } NotificationManager()->Unregister(this); @@ -62,21 +62,21 @@ MxResult Isle::Create(MxDSAction& p_dsAction) if (result == SUCCESS) { ControlManager()->Register(this); InputManager()->SetWorld(this); - GameState()->FUN_1003a720(0); + GameState()->StopArea(); switch (GameState()->GetCurrentAct()) { case 1: - GameState()->FUN_1003a720(0x2e); + GameState()->StopArea(0x2e); break; case 2: - GameState()->FUN_1003a720(0x2e); + GameState()->StopArea(0x2e); break; case -1: m_unk0x13c = 2; } - if (GameState()->GetUnknown424() == 1) { - GameState()->SetUnknown424(0); + if (GameState()->GetCurrentArea() == 1) { + GameState()->SetCurrentArea(0); } LegoGameState* gameState = GameState(); @@ -115,13 +115,13 @@ MxLong Isle::Notify(MxParam& p_param) break; } break; - case c_notificationType17: + case c_notificationClick: result = HandleType17Notification(p_param); break; case c_notificationType18: switch (m_act1state->GetUnknown18()) { case 4: - result = GetCurrentVehicle()->Notify(p_param); + result = CurrentVehicle()->Notify(p_param); break; case 8: result = m_towtrack->Notify(p_param); @@ -135,7 +135,7 @@ MxLong Isle::Notify(MxParam& p_param) result = HandleType19Notification(p_param); break; case c_notificationType20: - VTable0x68(TRUE); + Enable(TRUE); break; case c_notificationTransitioned: result = HandleTransitionEnd(); @@ -158,7 +158,7 @@ void Isle::ReadyWorld() LegoWorld::ReadyWorld(); if (m_act1state->GetUnknown21()) { - GameState()->HandleAction(2); + GameState()->SwitchArea(2); m_act1state->SetUnknown18(0); m_act1state->SetUnknown21(0); } @@ -183,9 +183,23 @@ MxLong Isle::HandleType19Notification(MxParam& p_param) } // STUB: LEGO1 0x10031820 -void Isle::VTable0x68(MxBool p_add) +void Isle::Enable(MxBool p_enable) { - // TODO + if (m_set0xd0.empty() == p_enable) { + return; + } + + LegoWorld::Enable(p_enable); + m_radio.Initialize(p_enable); + + if (p_enable) { + // TODO + } + else { + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + } } // STUB: LEGO1 0x10032620 diff --git a/LEGO1/lego/legoomni/src/isle/islepathactor.cpp b/LEGO1/lego/legoomni/src/isle/islepathactor.cpp index b93535f6..55ef5b71 100644 --- a/LEGO1/lego/legoomni/src/isle/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/isle/islepathactor.cpp @@ -20,8 +20,9 @@ MxResult IslePathActor::Create(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x1001a2a0 void IslePathActor::Destroy(MxBool p_fromDestructor) { - if (!p_fromDestructor) + if (!p_fromDestructor) { LegoPathActor::Destroy(FALSE); + } } // STUB: LEGO1 0x1001a2c0 diff --git a/LEGO1/lego/legoomni/src/isle/jukebox.cpp b/LEGO1/lego/legoomni/src/isle/jukebox.cpp index c969754f..ed937aeb 100644 --- a/LEGO1/lego/legoomni/src/isle/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/isle/jukebox.cpp @@ -41,7 +41,7 @@ void JukeBox::ReadyWorld() } // STUB: LEGO1 0x1005dde0 -void JukeBox::VTable0x68(MxBool p_add) +void JukeBox::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/isle/radio.cpp b/LEGO1/lego/legoomni/src/isle/radio.cpp index c0182a1c..52bda8f2 100644 --- a/LEGO1/lego/legoomni/src/isle/radio.cpp +++ b/LEGO1/lego/legoomni/src/isle/radio.cpp @@ -3,6 +3,8 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoomni.h" +#include "mxbackgroundaudiomanager.h" +#include "mxcontrolpresenter.h" #include "mxnotificationmanager.h" DECOMP_SIZE_ASSERT(Radio, 0x10); @@ -17,16 +19,120 @@ Radio::Radio() CreateRadioState(); } -// STUB: LEGO1 0x1002c990 +// FUNCTION: LEGO1 0x1002c990 Radio::~Radio() { - // TODO + if (m_state->IsActive()) { + BackgroundAudioManager()->Stop(); + m_state->SetActive(FALSE); + } + + ControlManager()->Unregister(this); + NotificationManager()->Unregister(this); } -// STUB: LEGO1 0x1002ca30 +// FUNCTION: LEGO1 0x1002ca30 MxLong Radio::Notify(MxParam& p_param) { - // TODO + MxLong result = 0; + + if (m_unk0x0c) { + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationClick: + result = HandleClick((LegoControlManagerEvent&) p_param); + break; + } + } + + return result; +} + +// FUNCTION: LEGO1 0x1002ca70 +void Radio::Play() +{ + if (!m_state->IsActive()) { + CurrentWorld(); + + MxDSAction action; + action.SetObjectId(m_state->FUN_1002d090()); + action.SetAtomId(*g_jukeboxScript); + action.SetLoopCount(1); + + m_bgAudioPreviouslyEnabled = BackgroundAudioManager()->GetMusicEnabled(); + if (!m_bgAudioPreviouslyEnabled) { + BackgroundAudioManager()->Enable(TRUE); + } + + BackgroundAudioManager()->PlayMusic(action, 3, 4); + m_state->SetActive(TRUE); + } +} + +// FUNCTION: LEGO1 0x1002cb70 +void Radio::Stop() +{ + if (m_state->IsActive()) { + LegoWorld* world = CurrentWorld(); + + MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), 18); + + if (presenter) { + presenter->VTable0x6c(0); + } + + BackgroundAudioManager()->Stop(); + BackgroundAudioManager()->Enable(m_bgAudioPreviouslyEnabled); + m_state->SetActive(FALSE); + } +} + +// FUNCTION: LEGO1 0x1002cbc0 +MxLong Radio::HandleClick(LegoControlManagerEvent& p_param) +{ + MxDSAction action; // Unused + MxS32 objectId = p_param.GetClickedObjectId(); + + if (objectId == 18) { + if (m_state->IsActive()) { + Stop(); + } + else { + Play(); + } + + if (CurrentWorld()) { +#ifdef COMPAT_MODE + MxNotificationParam param(c_notificationEndAction, this); + CurrentWorld()->Notify(param); +#else + CurrentWorld()->Notify(MxNotificationParam(c_notificationType0, this)); +#endif + } + + return 1; + } + + return 0; +} + +// FUNCTION: LEGO1 0x1002ccc0 +MxLong Radio::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + if (m_state->IsActive() && + m_state->FUN_1002d0c0(p_param.GetAction()->GetAtomId(), p_param.GetAction()->GetObjectId())) { + + MxDSAction action; + action.SetAtomId(*g_jukeboxScript); + action.SetObjectId(m_state->FUN_1002d090()); + action.SetLoopCount(1); + + BackgroundAudioManager()->PlayMusic(action, 3, 4); + return 1; + } + return 0; } diff --git a/LEGO1/lego/legoomni/src/isle/radiostate.cpp b/LEGO1/lego/legoomni/src/isle/radiostate.cpp index 08aa91fa..077864a7 100644 --- a/LEGO1/lego/legoomni/src/isle/radiostate.cpp +++ b/LEGO1/lego/legoomni/src/isle/radiostate.cpp @@ -1,14 +1,99 @@ #include "radiostate.h" -// STUB: LEGO1 0x1002ce10 +#include "jukebox.h" +#include "legoomni.h" +#include "mxtimer.h" + +// GLOBAL: LEGO1 0x100f3218 +JukeBox::JukeBoxScript g_unk0x100f3218[6] = { + JukeBox::e_legoRadioReminder1, + JukeBox::e_legoRadioJingle1, + JukeBox::e_legoRadioJingle2, + JukeBox::e_legoRadioJingle3, + JukeBox::e_legoRadioJingle4, + JukeBox::e_legoRadioReminder2 +}; + +// GLOBAL: LEGO1 0x100f3230 +JukeBox::JukeBoxScript g_unk0x100f3230[14] = { + JukeBox::e_legoRadioRacingAd, + JukeBox::e_legoRadioNews1, + JukeBox::e_legoRadioNews2, + JukeBox::e_legoRadioPizzaAd1, + JukeBox::e_legoRadioBricksterPSA, + JukeBox::e_legoRadioSports1, + JukeBox::e_legoRadioIntermission1, + JukeBox::e_legoRadioIntermission2, + JukeBox::e_legoRadioPizzaAd2, + JukeBox::e_legoRadioWeatherReport, + JukeBox::e_legoRadioSports2, + JukeBox::e_legoRadioPizzaAd3, + JukeBox::e_legoRadioIntermission3, + JukeBox::e_legoRadioSuperStoreAd, +}; + +// GLOBAL: LEGO1 0x100f3268 +JukeBox::JukeBoxScript g_unk0x100f3268[9] = { + JukeBox::e_centralRoads, + JukeBox::e_beachBlvd, + JukeBox::e_residentialArea, + JukeBox::e_legoRadioLuckyYou, + JukeBox::e_legoRadioJazzInterlude, + JukeBox::e_legoRadioPianoInterlude1, + JukeBox::e_legoRadioPoliceStation, + JukeBox::e_legoRadioPianoInterlude2, + JukeBox::e_legoRadioCredits, +}; + +// FUNCTION: LEGO1 0x1002ce10 RadioState::RadioState() { - // TODO + srand(Timer()->GetTime()); + + MxS32 random = rand(); + m_unk0x2c = random % 3; + + m_unk0x08[0] = LegoState::Playlist((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])); + m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]))); + + m_unk0x08[1] = LegoState::Playlist((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])); + m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]))); + + m_unk0x08[2] = LegoState::Playlist((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])); + m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]))); + + m_active = FALSE; } -// STUB: LEGO1 0x1002cf50 +// FUNCTION: LEGO1 0x1002cf50 MxBool RadioState::VTable0x14() { - // TODO + return FALSE; +} + +// FUNCTION: LEGO1 0x1002d090 +MxU32 RadioState::FUN_1002d090() +{ + if (m_unk0x2c == 2) { + m_unk0x2c = 0; + } + else { + m_unk0x2c++; + } + + return m_unk0x08[m_unk0x2c].Next(); +} + +// FUNCTION: LEGO1 0x1002d0c0 +MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId) +{ + if (*g_jukeboxScript == p_atom) { + for (MxS16 i = 0; i < 3; i++) { + if (m_unk0x08[i].Contains(p_objectId)) { + return TRUE; + } + } + } + return FALSE; } diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index 743489a0..7384da72 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -22,6 +22,7 @@ #include "mxstreamer.h" #include "mxticklemanager.h" #include "mxtransitionmanager.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(LegoWorldList, 0x18); DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10); @@ -172,23 +173,29 @@ LegoNavController* NavController() } // FUNCTION: LEGO1 0x10015790 -IslePathActor* GetCurrentVehicle() +IslePathActor* CurrentVehicle() { return LegoOmni::GetInstance()->GetCurrentVehicle(); } // FUNCTION: LEGO1 0x100157a0 -LegoWorld* GetCurrentWorld() +LegoWorld* CurrentWorld() { return LegoOmni::GetInstance()->GetCurrentWorld(); } // FUNCTION: LEGO1 0x100157b0 -LegoUnkSaveDataWriter* GetUnkSaveDataWriter() +LegoUnkSaveDataWriter* UnkSaveDataWriter() { return LegoOmni::GetInstance()->GetUnkSaveDataWriter(); } +// FUNCTION: LEGO1 0x100157c0 +ViewManager* GetViewManager() +{ + return VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager(); +} + // FUNCTION: LEGO1 0x100157e0 LegoPlantManager* PlantManager() { @@ -234,7 +241,7 @@ MxDSAction& GetCurrentAction() // FUNCTION: LEGO1 0x100158f0 void SetCurrentWorld(LegoWorld* p_world) { - LegoOmni::GetInstance()->SetWorld(p_world); + LegoOmni::GetInstance()->SetCurrentWorld(p_world); } // FUNCTION: LEGO1 0x10015900 @@ -257,8 +264,9 @@ void PlayMusic(MxU32 p_index) // FUNCTION: LEGO1 0x100159c0 void SetIsWorldActive(MxBool p_isWorldActive) { - if (!p_isWorldActive) + if (!p_isWorldActive) { LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL); + } g_isWorldActive = p_isWorldActive; } @@ -523,17 +531,20 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) p_param.CreateFlags().CreateSoundManager(FALSE); p_param.CreateFlags().CreateTickleManager(FALSE); - if (!(m_tickleManager = new MxTickleManager())) + if (!(m_tickleManager = new MxTickleManager())) { return FAILURE; + } - if (MxOmni::Create(p_param) != SUCCESS) + if (MxOmni::Create(p_param) != SUCCESS) { return FAILURE; + } m_objectFactory = new LegoObjectFactory(); - if (m_objectFactory == NULL) + if (m_objectFactory == NULL) { return FAILURE; + } - if (m_soundManager = new LegoSoundManager()) { + if ((m_soundManager = new LegoSoundManager())) { if (m_soundManager->Create(10, 0) != SUCCESS) { delete m_soundManager; m_soundManager = NULL; @@ -541,14 +552,14 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) } } - if (m_videoManager = new LegoVideoManager()) { + if ((m_videoManager = new LegoVideoManager())) { if (m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) { delete m_videoManager; m_videoManager = NULL; } } - if (m_inputMgr = new LegoInputManager()) { + if ((m_inputMgr = new LegoInputManager())) { if (m_inputMgr->Create(p_param.GetWindowHandle()) != SUCCESS) { delete m_inputMgr; m_inputMgr = NULL; @@ -657,8 +668,9 @@ LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) while (cursor.Next(world)) { if ((p_entityid == -1 || world->GetEntityId() == p_entityid) && - (!p_atom.GetInternal() || world->GetAtom() == p_atom)) + (!p_atom.GetInternal() || world->GetAtom() == p_atom)) { return world; + } } } @@ -716,8 +728,9 @@ MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* // FUNCTION: LEGO1 0x1005b3a0 void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param) { - if (m_currentWorld) + if (m_currentWorld) { NotificationManager()->Send(m_currentWorld, p_param); + } } // FUNCTION: LEGO1 0x1005b3c0 @@ -734,11 +747,11 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x1005b400 MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) { - if (::GetCurrentWorld() == NULL) { + if (::CurrentWorld() == NULL) { return -1; } - return ::GetCurrentWorld()->GetCurrPathInfo(p_path, p_value); + return ::CurrentWorld()->GetCurrPathInfo(p_path, p_value); } // FUNCTION: LEGO1 0x1005b4f0 @@ -767,8 +780,9 @@ void LegoOmni::FUN_1005b4f0(MxBool p_disable, MxU16 p_flags) // FUNCTION: LEGO1 0x1005b560 void LegoOmni::CreateBackgroundAudio() { - if (m_bkgAudioManager) + if (m_bkgAudioManager) { m_bkgAudioManager->Create(*g_jukeboxScript, 100); + } } // FUNCTION: LEGO1 0x1005b580 diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index c187344c..f2b4d0bb 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -24,3 +24,9 @@ MxResult LegoPathController::Tickle() // TODO return SUCCESS; } + +// STUB: LEGO1 0x10046be0 +void LegoPathController::Enable(MxBool p_enable) +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index 48d592a3..f0ff859f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -39,16 +39,18 @@ MxResult LegoPathPresenter::AddToManager() // FUNCTION: LEGO1 0x10044b70 void LegoPathPresenter::Destroy(MxBool p_fromDestructor) { - if (VideoManager()) + if (VideoManager()) { VideoManager()->UnregisterPresenter(*this); + } { MxAutoLocker lock(&this->m_criticalSection); Init(); } - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x10044c10 @@ -81,8 +83,9 @@ void LegoPathPresenter::StreamingTickle() // FUNCTION: LEGO1 0x10044d40 void LegoPathPresenter::RepeatingTickle() { - if (this->m_action->GetDuration() == -1) + if (this->m_action->GetDuration() == -1) { return; + } EndAction(); } diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp index 6d1cac49..c1804a4f 100644 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp +++ b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp @@ -13,8 +13,10 @@ MxResult PizzaMissionState::VTable0x1c(LegoFile* p_legoFile) // FUNCTION: LEGO1 0x10039510 PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id) { - for (MxS16 i = 0; i < 5; i++) - if (m_state[i].m_id == p_id) + for (MxS16 i = 0; i < 5; i++) { + if (m_state[i].m_id == p_id) { return m_state + i; + } + } return NULL; } diff --git a/LEGO1/lego/legoomni/src/police/police.cpp b/LEGO1/lego/legoomni/src/police/police.cpp index aac86238..059d4473 100644 --- a/LEGO1/lego/legoomni/src/police/police.cpp +++ b/LEGO1/lego/legoomni/src/police/police.cpp @@ -13,15 +13,14 @@ DECOMP_SIZE_ASSERT(Police, 0x110) Police::Police() { m_policeState = NULL; - m_unk0x10c = 0; + m_transitionDestination = 0; NotificationManager()->Register(this); } -// STUB: LEGO1 0x1005e1d0 +// FUNCTION: LEGO1 0x1005e1d0 MxBool Police::VTable0x5c() { - // TODO - return FALSE; + return TRUE; } // FUNCTION: LEGO1 0x1005e320 @@ -55,17 +54,35 @@ MxResult Police::Create(MxDSAction& p_dsAction) } m_policeState = policeState; - GameState()->SetUnknown424(0x22); - GameState()->FUN_1003a720(0); + GameState()->SetCurrentArea(0x22); + GameState()->StopArea(); return ret; } -// STUB: LEGO1 0x1005e480 +// FUNCTION: LEGO1 0x1005e480 MxLong Police::Notify(MxParam& p_param) { - // TODO + MxLong result = 0; + LegoWorld::Notify(p_param); - return 0; + if (m_worldStarted) { + switch (((MxNotificationParam&) p_param).GetNotification()) { + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationKeyPress: + result = HandleKeyPress(((LegoEventNotificationParam&) p_param)); + break; + case c_notificationType11: + result = HandleNotification11((MxNotificationParam&) p_param); + break; + case c_notificationTransitioned: + GameState()->SwitchArea(m_transitionDestination); + break; + } + } + + return result; } // FUNCTION: LEGO1 0x1005e530 @@ -76,8 +93,29 @@ void Police::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } +// STUB: LEGO1 0x1005e550 +MxLong Police::HandleNotification11(MxNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x1005e6a0 +MxLong Police::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x1005e6f0 +MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param) +{ + // TODO + return 0; +} + // STUB: LEGO1 0x1005e740 -void Police::VTable0x68(MxBool p_add) +void Police::Enable(MxBool p_enable) { // TODO } diff --git a/LEGO1/lego/legoomni/src/race/racestate.cpp b/LEGO1/lego/legoomni/src/race/racestate.cpp index db6d96dc..39e6c51c 100644 --- a/LEGO1/lego/legoomni/src/race/racestate.cpp +++ b/LEGO1/lego/legoomni/src/race/racestate.cpp @@ -22,9 +22,11 @@ MxResult RaceState::VTable0x1c(LegoFile* p_legoFile) RaceStateEntry* RaceState::GetState(MxU8 p_id) { for (MxS16 i = 0;; i++) { - if (i >= 5) + if (i >= 5) { return NULL; - if (m_state[i].m_id == p_id) + } + if (m_state[i].m_id == p_id) { return m_state + i; + } } } diff --git a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp index 476c6291..0b10ed24 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp @@ -21,9 +21,22 @@ LegoAnimationManager::~LegoAnimationManager() // TODO } +// STUB: LEGO1 0x1005ee80 +void LegoAnimationManager::FUN_1005ee80(MxBool) +{ + // TODO +} + // STUB: LEGO1 0x1005ef10 void LegoAnimationManager::FUN_1005ef10() { + // TODO +} + +// STUB: LEGO1 0x1005f0b0 +void LegoAnimationManager::FUN_1005f0b0() +{ + // TODO } // STUB: LEGO1 0x1005f130 @@ -44,6 +57,12 @@ void LegoAnimationManager::FUN_1005f720(undefined4) // TODO } +// STUB: LEGO1 0x10061010 +void LegoAnimationManager::FUN_10061010(undefined4) +{ + // TODO +} + // STUB: LEGO1 0x100619f0 MxLong LegoAnimationManager::Notify(MxParam& p_param) { diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index f01d3ae1..68c664de 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -102,7 +102,7 @@ void LegoAnimPresenter::PutFrame() // FUNCTION: LEGO1 0x1006b550 void LegoAnimPresenter::ReadyTickle() { - m_currentWorld = GetCurrentWorld(); + m_currentWorld = CurrentWorld(); if (m_currentWorld) { MxStreamChunk* chunk = m_subscriber->CurrentChunk(); diff --git a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp index 07035332..5bb59615 100644 --- a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp @@ -25,22 +25,23 @@ void LegoHideAnimPresenter::Destroy(MxBool p_fromDestructor) { m_criticalSection.Enter(); - if (m_unk0xc0) + if (m_unk0xc0) { delete m_unk0xc0; + } Init(); m_criticalSection.Leave(); // This appears to be a bug, since it results in an endless loop - if (!p_fromDestructor) + if (!p_fromDestructor) { LegoHideAnimPresenter::Destroy(); + } } -// STUB: LEGO1 0x1006dab0 +// FUNCTION: LEGO1 0x1006dab0 MxResult LegoHideAnimPresenter::AddToManager() { - // TODO - return SUCCESS; + return LegoAnimPresenter::AddToManager(); } // FUNCTION: LEGO1 0x1006dac0 diff --git a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp index 545d2f65..d74640d7 100644 --- a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp @@ -1,5 +1,8 @@ #include "legopartpresenter.h" +#include "legoomni.h" +#include "legovideomanager.h" + // GLOBAL: LEGO1 0x100f7aa0 int g_partPresenterConfig1 = 1; @@ -19,10 +22,10 @@ void LegoPartPresenter::configureLegoPartPresenter(MxS32 p_partPresenterConfig1, g_partPresenterConfig2 = p_partPresenterConfig2; } -// STUB: LEGO1 0x1007c9b0 +// FUNCTION: LEGO1 0x1007c9b0 MxResult LegoPartPresenter::AddToManager() { - // TODO + VideoManager()->RegisterPresenter(*this); return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index cbb68b79..e80b7eed 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -50,8 +50,9 @@ LegoVideoManager::~LegoVideoManager() // FUNCTION: LEGO1 0x1007abb0 MxResult LegoVideoManager::CreateDirect3D() { - if (!m_direct3d) + if (!m_direct3d) { m_direct3d = new MxDirect3D; + } return m_direct3d ? SUCCESS : FAILURE; } @@ -77,25 +78,29 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM MxPalette* palette = new MxPalette; p_videoParam.SetPalette(palette); - if (!palette) + if (!palette) { goto done; + } paletteCreated = TRUE; } PALETTEENTRY paletteEntries[256]; p_videoParam.GetPalette()->GetEntries(paletteEntries); - if (CreateDirect3D() != SUCCESS) + if (CreateDirect3D() != SUCCESS) { goto done; + } - if (deviceEnumerate.DoEnumerate() != SUCCESS) + if (deviceEnumerate.DoEnumerate() != SUCCESS) { goto done; + } if (p_videoParam.GetDeviceName()) { deviceNum = deviceEnumerate.ParseDeviceName(p_videoParam.GetDeviceName()); if (deviceNum >= 0) { - if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS) + if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS) { deviceNum = -1; + } } } @@ -107,10 +112,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM m_direct3d->SetDevice(deviceEnumerate, driver, device); - if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2) + if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2) { p_videoParam.Flags().SetF2bit0(TRUE); - else + } + else { p_videoParam.Flags().SetF2bit0(FALSE); + } ViewROI::SetUnk101013d8(p_videoParam.Flags().GetF2bit0() == FALSE); @@ -124,8 +131,9 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM bits, paletteEntries, sizeof(paletteEntries) / sizeof(paletteEntries[0]) - )) + )) { goto done; + } if (MxVideoManager::VTable0x28( p_videoParam, @@ -136,18 +144,21 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM m_direct3d->GetClipper(), p_frequencyMS, p_createThread - ) != SUCCESS) + ) != SUCCESS) { goto done; + } m_renderer = Tgl::CreateRenderer(); - if (!m_renderer) + if (!m_renderer) { goto done; + } m_3dManager = new Lego3DManager; - if (!m_3dManager) + if (!m_3dManager) { goto done; + } Lego3DManager::CreateStruct createStruct; memset(&createStruct, 0, sizeof(createStruct)); @@ -161,13 +172,15 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM createStruct.m_direct3d = m_direct3d->GetDirect3D(); createStruct.m_d3dDevice = m_direct3d->GetDirect3DDevice(); - if (!m_3dManager->Create(createStruct)) + if (!m_3dManager->Create(createStruct)) { goto done; + } ViewLODList* pLODList; - if (ConfigureD3DRM() != SUCCESS) + if (ConfigureD3DRM() != SUCCESS) { goto done; + } pLODList = m_3dManager->GetViewLODListManager()->Create("CameraROI", 1); m_viewROI = new LegoROI(m_renderer, pLODList, Timer()->GetTime()); @@ -219,19 +232,22 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY) m_cursorY = p_cursorY; m_drawCursor = TRUE; - if (623 < p_cursorX) + if (623 < p_cursorX) { m_cursorX = 623; + } - if (463 < p_cursorY) + if (463 < p_cursorY) { m_cursorY = 463; + } } // FUNCTION: LEGO1 0x1007b770 MxResult LegoVideoManager::Tickle() { if (m_unk0x554 && !m_videoParam.Flags().GetFlipSurfaces() && - TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning) + TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning) { Sleep(30); + } m_stopWatch->Stop(); m_elapsedSeconds = m_stopWatch->ElapsedSeconds(); @@ -245,11 +261,13 @@ MxResult LegoVideoManager::Tickle() MxPresenter* presenter; MxPresenterListCursor cursor(m_presenters); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->Tickle(); + } - if (m_render3d && !m_paused) + if (m_render3d && !m_paused) { m_3dManager->GetLego3DView()->GetView()->Clear(); + } MxRect32 rect(0, 0, m_videoParam.GetRect().GetWidth() - 1, m_videoParam.GetRect().GetHeight() - 1); InvalidateRect(rect); @@ -257,8 +275,9 @@ MxResult LegoVideoManager::Tickle() if (!m_paused && (m_render3d || m_unk0xe5)) { cursor.Reset(); - while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0) + while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0) { presenter->PutData(); + } if (!m_unk0xe5) { m_3dManager->Render(0.0); @@ -267,21 +286,25 @@ MxResult LegoVideoManager::Tickle() cursor.Prev(); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->PutData(); + } - if (m_drawCursor) + if (m_drawCursor) { DrawCursor(); + } - if (m_drawFPS) + if (m_drawFPS) { DrawFPS(); + } } else if (m_fullScreenMovie) { MxPresenter* presenter; MxPresenterListCursor cursor(m_presenters); - if (cursor.Last(presenter)) + if (cursor.Last(presenter)) { presenter->PutData(); + } } if (!m_paused) { @@ -316,8 +339,9 @@ inline void LegoVideoManager::DrawCursor() m_cursorRect.right = 16; m_cursorSurface = MxDisplaySurface::CreateCursorSurface(); - if (!m_cursorSurface) + if (!m_cursorSurface) { m_drawCursor = FALSE; + } } ddSurface2 @@ -467,19 +491,22 @@ MxResult LegoVideoManager::ConfigureD3DRM() IDirect3DRMDevice2* d3drm = ((TglImpl::DeviceImpl*) m_3dManager->GetLego3DView()->GetDevice())->ImplementationData(); - if (!d3drm) + if (!d3drm) { return FAILURE; + } MxAssignedDevice* assignedDevice = m_direct3d->GetAssignedDevice(); if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) { - if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) + if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) { d3drm->SetTextureQuality(D3DRMTEXTURE_LINEAR); + } d3drm->SetDither(TRUE); - if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND) + if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND) { d3drm->SetRenderMode(D3DRMRENDERMODE_BLENDEDTRANSPARENCY); + } } return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp index 677837bf..8672cdaa 100644 --- a/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp @@ -137,7 +137,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld) TickleManager()->UnregisterClient(this); if (p_notifyWorld) { - LegoWorld* world = GetCurrentWorld(); + LegoWorld* world = CurrentWorld(); if (world) { #ifdef COMPAT_MODE @@ -209,11 +209,13 @@ void MxTransitionManager::TransitionDissolve() for (MxS32 col = 0; col < 640; col++) { // Select 16 columns on each tick - if (m_animationTimer * 16 > m_columnOrder[col]) + if (m_animationTimer * 16 > m_columnOrder[col]) { continue; + } - if (m_animationTimer * 16 + 15 < m_columnOrder[col]) + if (m_animationTimer * 16 + 15 < m_columnOrder[col]) { continue; + } for (MxS32 row = 0; row < 480; row++) { // Shift the chosen column a different amount at each scanline. @@ -223,10 +225,12 @@ void MxTransitionManager::TransitionDissolve() // Set the chosen pixel to black if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) { - ((MxU8*) ddsd.lpSurface)[row * ddsd.lPitch + xShift] = 0; + MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift; + *surf = 0; } else { - ((MxU16*) ddsd.lpSurface)[row * ddsd.lPitch + xShift] = 0; + MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift * 2; + *(MxU16*) surf = 0; } } } @@ -289,60 +293,47 @@ void MxTransitionManager::TransitionPixelation() for (MxS32 col = 0; col < 64; col++) { // Select 4 columns on each tick - if (m_animationTimer * 4 > m_columnOrder[col]) + if (m_animationTimer * 4 > m_columnOrder[col]) { continue; + } - if (m_animationTimer * 4 + 3 < m_columnOrder[col]) + if (m_animationTimer * 4 + 3 < m_columnOrder[col]) { continue; + } for (MxS32 row = 0; row < 48; row++) { - MxS32 xShift = 10 * ((m_randomShift[row] + col) % 64); - // To do the pixelation, we subdivide the 640x480 surface into // 10x10 pixel blocks. At the chosen block, we sample the top-leftmost // color and set the other 99 pixels to that value. - // Find the pixel to sample - MxS32 sampleOfs = 10 * row * ddsd.lPitch + xShift; + // First, get the offset of the 10x10 block that we will sample for this row. + MxS32 xShift = 10 * ((m_randomShift[row] + col) % 64); + + // Combine xShift with this value to target the correct location in the buffer. MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8; - // Save this cast from void* to save time. - // Seems to help accuracy doing it this way. - MxU8* surface = (MxU8*) ddsd.lpSurface; - MxU8* source = surface + sampleOfs * bytesPerPixel; + // Seek to the sample position. + MxU8* source = (MxU8*) ddsd.lpSurface + 10 * row * ddsd.lPitch + bytesPerPixel * xShift; + // Sample byte or word depending on display mode. MxU32 sample = bytesPerPixel == 1 ? *source : *(MxU16*) source; + // For each of the 10 rows in the 10x10 square: for (MxS32 k = 10 * row; k < 10 * row + 10; k++) { if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) { - // TODO: This block and the next don't match, but they are - // hopefully correct in principle. - MxU16 colorWord = MAKEWORD(LOBYTE(sample), LOBYTE(sample)); - MxU32 newColor = MAKELONG(colorWord, colorWord); + MxU8* pos = (MxU8*) ddsd.lpSurface + k * ddsd.lPitch + xShift; - MxU8* pos = surface + k * ddsd.lPitch + xShift; - MxU32* dest = (MxU32*) pos; - - // Sets 10 pixels (10 bytes) - dest[0] = newColor; - dest[1] = newColor; - MxU16* half = (MxU16*) (dest + 2); - *half = newColor; + for (MxS32 tt = 0; tt < 10; tt++) { + pos[tt] = sample; + } } else { - MxU32 newColor = MAKELONG(sample, sample); + // Need to double xShift because it measures pixels not bytes + MxU16* pos = (MxU16*) ((MxU8*) ddsd.lpSurface + k * ddsd.lPitch + 2 * xShift); - // You might expect a cast to MxU16* instead, but lPitch is - // bytes/scanline, not pixels/scanline. Therefore, we just - // need to double the xShift to get to the right spot. - MxU8* pos = surface + k * ddsd.lPitch + 2 * xShift; - MxU32* dest = (MxU32*) pos; - // Sets 10 pixels (20 bytes) - dest[0] = newColor; - dest[1] = newColor; - dest[2] = newColor; - dest[3] = newColor; - dest[4] = newColor; + for (MxS32 tt = 0; tt < 10; tt++) { + pos[tt] = sample; + } } } } @@ -562,8 +553,9 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc) (const MxU8*) p_ddsc->lpSurface + m_copyRect.top * p_ddsc->lPitch + bytesPerPixel * m_copyRect.left; m_copyBuffer = new MxU8[bytesPerPixel * width * height]; - if (!m_copyBuffer) + if (!m_copyBuffer) { return; + } // Copy into the copy buffer MxU8* dst = m_copyBuffer; diff --git a/LEGO1/lego/sources/3dmanager/lego3dview.cpp b/LEGO1/lego/sources/3dmanager/lego3dview.cpp index cfa274f6..34f699d8 100644 --- a/LEGO1/lego/sources/3dmanager/lego3dview.cpp +++ b/LEGO1/lego/sources/3dmanager/lego3dview.cpp @@ -29,8 +29,9 @@ Lego3DView::~Lego3DView() BOOL Lego3DView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer) { double viewAngle = 45; - if (rCreateStruct.m_isWideViewAngle) + if (rCreateStruct.m_isWideViewAngle) { viewAngle = 90; + } float frontClippingDistance = 0.1; float backClippingDistance = 500; diff --git a/LEGO1/lego/sources/3dmanager/lego3dview.h b/LEGO1/lego/sources/3dmanager/lego3dview.h index 7e68bdcb..cbbde4a8 100644 --- a/LEGO1/lego/sources/3dmanager/lego3dview.h +++ b/LEGO1/lego/sources/3dmanager/lego3dview.h @@ -13,10 +13,10 @@ class Lego3DView : public LegoView1 { public: Lego3DView(); - virtual ~Lego3DView() override; + ~Lego3DView() override; BOOL Create(const CreateStruct&, Tgl::Renderer*); - virtual void Destroy() override; // vtable+0x08 + void Destroy() override; // vtable+0x08 BOOL Add(ViewROI&); BOOL Remove(ViewROI&); diff --git a/LEGO1/lego/sources/3dmanager/legoview1.cpp b/LEGO1/lego/sources/3dmanager/legoview1.cpp index 97114469..28ffb911 100644 --- a/LEGO1/lego/sources/3dmanager/legoview1.cpp +++ b/LEGO1/lego/sources/3dmanager/legoview1.cpp @@ -42,8 +42,9 @@ LegoView::~LegoView() BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer) { float viewAngle = 45; - if (rCreateStruct.m_isWideViewAngle) + if (rCreateStruct.m_isWideViewAngle) { viewAngle = 90; + } float frontClippingDistance = 0.1; float backClippingDistance = 500; diff --git a/LEGO1/lego/sources/3dmanager/legoview1.h b/LEGO1/lego/sources/3dmanager/legoview1.h index 4060e54f..34b8f026 100644 --- a/LEGO1/lego/sources/3dmanager/legoview1.h +++ b/LEGO1/lego/sources/3dmanager/legoview1.h @@ -18,16 +18,16 @@ class Camera; class LegoView : public TglSurface { public: LegoView(); - virtual ~LegoView() override; + ~LegoView() override; BOOL Create(const CreateStruct&, Tgl::Renderer*); - virtual void Destroy() override; // vtable+0x08 + void Destroy() override; // vtable+0x08 Tgl::Group* GetScene() const; Tgl::Camera* GetCamera() const; protected: - virtual Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*); // vtable+0x10 + Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*) override; // vtable+0x10 private: Tgl::Group* m_pScene; // 0x70 @@ -58,11 +58,11 @@ inline Tgl::Camera* LegoView::GetCamera() const class LegoView1 : public LegoView { public: LegoView1(); - virtual ~LegoView1() override; + ~LegoView1() override; BOOL AddLightsToViewport(); BOOL Create(const TglSurface::CreateStruct&, Tgl::Renderer*); - virtual void Destroy() override; // vtable+0x08 + void Destroy() override; // vtable+0x08 private: Tgl::Light* m_pSunLight; // 0x78 diff --git a/LEGO1/lego/sources/misc/legostorage.cpp b/LEGO1/lego/sources/misc/legostorage.cpp index d8749dc1..8fa71553 100644 --- a/LEGO1/lego/sources/misc/legostorage.cpp +++ b/LEGO1/lego/sources/misc/legostorage.cpp @@ -109,14 +109,17 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode) strcat(mode, "r"); } if (p_mode & c_write) { - if (m_mode != c_read) + if (m_mode != c_read) { m_mode = c_write; + } strcat(mode, "w"); } - if ((p_mode & c_text) != 0) + if ((p_mode & c_text) != 0) { strcat(mode, "t"); - else + } + else { strcat(mode, "b"); + } if (!(m_file = fopen(p_name, mode))) { return FAILURE; diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index 5bd6ea67..e975c347 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -2,6 +2,7 @@ #define __LEGOSTORAGE_H #include "legotypes.h" +#include "mxgeometry/mxgeometry3d.h" #include "mxstring.h" #include @@ -44,10 +45,10 @@ class LegoStorage { class LegoMemory : public LegoStorage { public: LegoMemory(void* p_buffer); - virtual LegoResult Read(void* p_buffer, LegoU32 p_size); - virtual LegoResult Write(const void* p_buffer, LegoU32 p_size); - virtual LegoResult GetPosition(LegoU32& p_position); - virtual LegoResult SetPosition(LegoU32 p_position); + LegoResult Read(void* p_buffer, LegoU32 p_size) override; + LegoResult Write(const void* p_buffer, LegoU32 p_size) override; + LegoResult GetPosition(LegoU32& p_position) override; + LegoResult SetPosition(LegoU32 p_position) override; // SYNTHETIC: LEGO1 0x10045a80 // LegoMemory::~LegoMemory @@ -65,13 +66,52 @@ class LegoMemory : public LegoStorage { class LegoFile : public LegoStorage { public: LegoFile(); - virtual ~LegoFile() override; - virtual LegoResult Read(void* p_buffer, LegoU32 p_size); - virtual LegoResult Write(const void* p_buffer, LegoU32 p_size); - virtual LegoResult GetPosition(LegoU32& p_position); - virtual LegoResult SetPosition(LegoU32 p_position); + ~LegoFile() override; + LegoResult Read(void* p_buffer, LegoU32 p_size) override; + LegoResult Write(const void* p_buffer, LegoU32 p_size) override; + LegoResult GetPosition(LegoU32& p_position) override; + LegoResult SetPosition(LegoU32 p_position) override; LegoResult Open(const char* p_name, LegoU32 p_mode); + // FUNCTION: LEGO1 0x100343d0 + LegoStorage* WriteVector3(Mx3DPointFloat p_vec3) + { + float data = p_vec3[0]; + Write(&data, sizeof(float)); + + data = p_vec3[1]; + Write(&data, sizeof(float)); + + data = p_vec3[2]; + Write(&data, sizeof(float)); + return this; + } + + // FUNCTION: LEGO1 0x10034430 + LegoStorage* ReadVector3(Mx3DPointFloat& p_vec3) + { + Read(&p_vec3[0], sizeof(float)); + Read(&p_vec3[1], sizeof(float)); + Read(&p_vec3[2], sizeof(float)); + return this; + } + + // FUNCTION: LEGO1 0x10034470 + LegoStorage* ReadString(MxString& p_str) + { + MxS16 len; + Read(&len, sizeof(MxS16)); + + char* text = new char[len + 1]; + Read(text, len); + + text[len] = '\0'; + p_str = text; + delete[] text; + + return this; + } + // FUNCTION: LEGO1 0x10006030 LegoStorage* FUN_10006030(MxString p_str) { diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 8dab4657..e54696a8 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -75,13 +75,15 @@ unsigned char LegoROI::CallTheHandlerFunction( ) { // TODO - if (p_param == NULL) + if (p_param == NULL) { return FALSE; + } if (g_someHandlerFunction) { char buf[32]; - if (g_someHandlerFunction(p_param, buf, 32)) + if (g_someHandlerFunction(p_param, buf, 32)) { p_param = buf; + } } return ColorAliasLookup(p_param, p_red, p_green, p_blue, p_other); diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index a750b949..cfaa21c0 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -19,9 +19,9 @@ class LegoROI : public ViewROI { public: LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, int p_time); - virtual float IntrinsicImportance() const override; // vtable+0x04 + float IntrinsicImportance() const override; // vtable+0x04 // Note: Actually part of parent class (doesn't exist yet) - virtual void UpdateWorldBoundingVolumes() override; // vtable+0x18 + void UpdateWorldBoundingVolumes() override; // vtable+0x18 void SetDisplayBB(int p_displayBB); static void configureLegoROI(int p_roi); diff --git a/LEGO1/mxdirectx/mxdirect3d.cpp b/LEGO1/mxdirectx/mxdirect3d.cpp index b2166ca1..be3f6bba 100644 --- a/LEGO1/mxdirectx/mxdirect3d.cpp +++ b/LEGO1/mxdirectx/mxdirect3d.cpp @@ -50,11 +50,13 @@ BOOL MxDirect3D::Create( paletteEntryCount ); - if (ret && CreateIDirect3D() && D3DSetMode()) + if (ret && CreateIDirect3D() && D3DSetMode()) { success = TRUE; + } - if (!success) + if (!success) { FUN_1009d920(); + } return success; } @@ -77,8 +79,9 @@ void MxDirect3D::Destroy() this->m_assignedDevice = NULL; } - if (m_pCurrentDeviceModesList) + if (m_pCurrentDeviceModesList) { m_pCurrentDeviceModesList = NULL; + } MxDirectDraw::Destroy(); } @@ -119,24 +122,30 @@ BOOL MxDirect3D::D3DSetMode() return FALSE; } - if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) + if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) { m_unk0x88c = FALSE; - else + } + else { m_unk0x88c = TRUE; + } DWORD bitDepth = GetZBufferBitDepth(m_assignedDevice); - if (!CreateZBuffer(DDSCAPS_VIDEOMEMORY, bitDepth)) + if (!CreateZBuffer(DDSCAPS_VIDEOMEMORY, bitDepth)) { return FALSE; + } } else { - if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) + if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) { m_unk0x88c = FALSE; - else + } + else { m_unk0x88c = TRUE; + } DWORD bitDepth = GetZBufferBitDepth(m_assignedDevice); - if (!CreateZBuffer(DDSCAPS_SYSTEMMEMORY, bitDepth)) + if (!CreateZBuffer(DDSCAPS_SYSTEMMEMORY, bitDepth)) { return FALSE; + } } HRESULT result = m_pDirect3d->CreateDevice(m_assignedDevice->m_guid, m_pBackBuffer, &m_pDirect3dDevice); @@ -201,19 +210,25 @@ DWORD MxDirect3D::GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice) { DWORD bitDepth; - if (p_assignedDevice->m_desc.dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) + if (p_assignedDevice->m_desc.dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) { bitDepth = p_assignedDevice->m_desc.dwDeviceZBufferBitDepth; - else + } + else { bitDepth = 0; + } - if (bitDepth & DDBD_32) + if (bitDepth & DDBD_32) { return 32; - if (bitDepth & DDBD_24) + } + if (bitDepth & DDBD_24) { return 24; - if (bitDepth & DDBD_16) + } + if (bitDepth & DDBD_16) { return 16; - if (bitDepth & DDBD_8) + } + if (bitDepth & DDBD_8) { return 8; + } return -1; } @@ -264,13 +279,15 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri sizeof(assignedDevice->m_deviceInfo->m_ddcaps) ); - if (i == 0) + if (i == 0) { assignedDevice->m_flags |= MxAssignedDevice::c_primaryDevice; + } for (list::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) { MxDevice& device = *it2; - if (&device != p_device) + if (&device != p_device) { continue; + } memcpy(&assignedDevice->m_guid, device.m_guid, sizeof(assignedDevice->m_guid)); @@ -279,8 +296,9 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri assignedDevice->m_flags |= MxAssignedDevice::c_hardwareMode; desc = &device.m_HWDesc; } - else + else { desc = &device.m_HELDesc; + } memcpy(&assignedDevice->m_desc, desc, sizeof(assignedDevice->m_desc)); m_assignedDevice = assignedDevice; @@ -329,12 +347,15 @@ MxDriver::MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName) // FUNCTION: LEGO1 0x1009bb80 MxDriver::~MxDriver() { - if (m_guid) + if (m_guid) { delete m_guid; - if (m_driverDesc) + } + if (m_driverDesc) { delete[] m_driverDesc; - if (m_driverName) + } + if (m_driverName) { delete[] m_driverName; + } } // FUNCTION: LEGO1 0x1009bc30 @@ -383,12 +404,15 @@ MxDevice::MxDevice( // FUNCTION: LEGO1 0x1009bd60 MxDevice::~MxDevice() { - if (m_guid) + if (m_guid) { delete m_guid; - if (m_deviceDesc) + } + if (m_deviceDesc) { delete[] m_deviceDesc; - if (m_deviceName) + } + if (m_deviceName) { delete[] m_deviceName; + } } // FUNCTION: LEGO1 0x1009bda0 @@ -425,11 +449,13 @@ void MxDevice::Init( strcpy(m_deviceName, p_deviceName); } - if (p_HWDesc) + if (p_HWDesc) { memcpy(&m_HWDesc, p_HWDesc, sizeof(m_HWDesc)); + } - if (p_HELDesc) + if (p_HELDesc) { memcpy(&m_HELDesc, p_HELDesc, sizeof(m_HELDesc)); + } } // FUNCTION: LEGO1 0x1009bec0 @@ -456,25 +482,29 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc MxDriver& newDevice = m_list.back(); HRESULT result = DirectDrawCreate(newDevice.m_guid, &lpDD, NULL); - if (result != DD_OK) + if (result != DD_OK) { BuildErrorString("DirectDraw Create failed: %s\n", EnumerateErrorToString(result)); + } else { lpDD->EnumDisplayModes(0, NULL, this, DisplayModesEnumerateCallback); newDevice.m_ddCaps.dwSize = sizeof(newDevice.m_ddCaps); result = lpDD->GetCaps(&newDevice.m_ddCaps, NULL); - if (result != DD_OK) + if (result != DD_OK) { BuildErrorString("GetCaps failed: %s\n", EnumerateErrorToString(result)); + } else { result = lpDD->QueryInterface(IID_IDirect3D2, (LPVOID*) &lpDirect3d2); - if (result != DD_OK) + if (result != DD_OK) { BuildErrorString("D3D creation failed: %s\n", EnumerateErrorToString(result)); + } else { result = lpDirect3d2->EnumDevices(DevicesEnumerateCallback, this); - if (result != DD_OK) + if (result != DD_OK) { BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result)); + } else { if (newDevice.m_devices.empty()) { m_list.pop_back(); @@ -484,11 +514,13 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc } } - if (lpDirect3d2) + if (lpDirect3d2) { lpDirect3d2->Release(); + } - if (lpDD) + if (lpDD) { lpDD->Release(); + } return DDENUMRET_OK; } @@ -557,8 +589,9 @@ HRESULT MxDeviceEnumerate::EnumDevicesCallback( // FUNCTION: LEGO1 0x1009c6c0 int MxDeviceEnumerate::DoEnumerate() { - if (m_initialized) + if (m_initialized) { return -1; + } HRESULT ret = DirectDrawEnumerate(DirectDrawEnumerateCallback, this); if (ret != DD_OK) { @@ -578,45 +611,245 @@ MxDeviceEnumerate::DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc return deviceEnumerate->EnumDirectDrawCallback(p_guid, p_driverDesc, p_driverName); } -// STUB: LEGO1 0x1009c730 +// FUNCTION: LEGO1 0x1009c730 const char* MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error) { - // TODO: This is a list of error messages, similar to the function in - // MxDirectDraw, except that this one now contains the Direct3D errors. - // Probably just copied from a sample file in the dx5 sdk. - return ""; + switch (p_error) { + case DD_OK: + return "No error."; + case DDERR_GENERIC: + return "Generic failure."; + case DDERR_UNSUPPORTED: + return "Action not supported."; + case DDERR_INVALIDPARAMS: + return "One or more of the parameters passed to the function are incorrect."; + case DDERR_OUTOFMEMORY: + return "DirectDraw does not have enough memory to perform the operation."; + case DDERR_CANNOTATTACHSURFACE: + return "This surface can not be attached to the requested surface."; + case DDERR_ALREADYINITIALIZED: + return "This object is already initialized."; + case DDERR_CURRENTLYNOTAVAIL: + return "Support is currently not available."; + case DDERR_CANNOTDETACHSURFACE: + return "This surface can not be detached from the requested surface."; + case DDERR_HEIGHTALIGN: + return "Height of rectangle provided is not a multiple of reqd alignment."; + case DDERR_EXCEPTION: + return "An exception was encountered while performing the requested operation."; + case DDERR_INVALIDCAPS: + return "One or more of the caps bits passed to the callback are incorrect."; + case DDERR_INCOMPATIBLEPRIMARY: + return "Unable to match primary surface creation request with existing primary surface."; + case DDERR_INVALIDMODE: + return "DirectDraw does not support the requested mode."; + case DDERR_INVALIDCLIPLIST: + return "DirectDraw does not support the provided cliplist."; + case DDERR_INVALIDPIXELFORMAT: + return "The pixel format was invalid as specified."; + case DDERR_INVALIDOBJECT: + return "DirectDraw received a pointer that was an invalid DIRECTDRAW object."; + case DDERR_LOCKEDSURFACES: + return "Operation could not be carried out because one or more surfaces are locked."; + case DDERR_INVALIDRECT: + return "Rectangle provided was invalid."; + case DDERR_NOALPHAHW: + return "Operation could not be carried out because there is no alpha accleration hardware present or " + "available."; + case DDERR_NO3D: + return "There is no 3D present."; + case DDERR_NOCOLORCONVHW: + return "Operation could not be carried out because there is no color conversion hardware present or available."; + case DDERR_NOCLIPLIST: + return "No cliplist available."; + case DDERR_NOCOLORKEY: + return "Surface doesn't currently have a color key"; + case DDERR_NOCOOPERATIVELEVELSET: + return "Create function called without DirectDraw object method SetCooperativeLevel being called."; + case DDERR_NOEXCLUSIVEMODE: + return "Operation requires the application to have exclusive mode but the application does not have exclusive " + "mode."; + case DDERR_NOCOLORKEYHW: + return "Operation could not be carried out because there is no hardware support of the destination color key."; + case DDERR_NOGDI: + return "There is no GDI present."; + case DDERR_NOFLIPHW: + return "Flipping visible surfaces is not supported."; + case DDERR_NOTFOUND: + return "Requested item was not found."; + case DDERR_NOMIRRORHW: + return "Operation could not be carried out because there is no hardware present or available."; + case DDERR_NORASTEROPHW: + return "Operation could not be carried out because there is no appropriate raster op hardware present or " + "available."; + case DDERR_NOOVERLAYHW: + return "Operation could not be carried out because there is no overlay hardware present or available."; + case DDERR_NOSTRETCHHW: + return "Operation could not be carried out because there is no hardware support for stretching."; + case DDERR_NOROTATIONHW: + return "Operation could not be carried out because there is no rotation hardware present or available."; + case DDERR_NOTEXTUREHW: + return "Operation could not be carried out because there is no texture mapping hardware present or available."; + case DDERR_NOT4BITCOLOR: + return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color " + "palette."; + case DDERR_NOT4BITCOLORINDEX: + return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color " + "index palette."; + case DDERR_NOT8BITCOLOR: + return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color."; + case DDERR_NOZBUFFERHW: + return "Operation could not be carried out because there is no hardware support for zbuffer blitting."; + case DDERR_NOVSYNCHW: + return "Operation could not be carried out because there is no hardware support for vertical blank " + "synchronized operations."; + case DDERR_OUTOFCAPS: + return "The hardware needed for the requested operation has already been allocated."; + case DDERR_NOZOVERLAYHW: + return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support " + "z layering of overlays."; + case DDERR_COLORKEYNOTSET: + return "No src color key specified for this operation."; + case DDERR_OUTOFVIDEOMEMORY: + return "DirectDraw does not have enough memory to perform the operation."; + case DDERR_OVERLAYCANTCLIP: + return "The hardware does not support clipped overlays."; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + return "Can only have ony color key active at one time for overlays."; + case DDERR_PALETTEBUSY: + return "Access to this palette is being refused because the palette is already locked by another thread."; + case DDERR_SURFACEALREADYDEPENDENT: + return "This surface is already a dependency of the surface it is being made a dependency of."; + case DDERR_SURFACEALREADYATTACHED: + return "This surface is already attached to the surface it is being attached to."; + case DDERR_SURFACEISOBSCURED: + return "Access to surface refused because the surface is obscured."; + case DDERR_SURFACEBUSY: + return "Access to this surface is being refused because the surface is already locked by another thread."; + case DDERR_SURFACENOTATTACHED: + return "The requested surface is not attached."; + case DDERR_SURFACELOST: + return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface " + "object representing this surface should have Restore called on it."; + case DDERR_TOOBIGSIZE: + return "Size requested by DirectDraw is too large, but the individual height and width are OK."; + case DDERR_TOOBIGHEIGHT: + return "Height requested by DirectDraw is too large."; + case DDERR_UNSUPPORTEDFORMAT: + return "FOURCC format requested is unsupported by DirectDraw."; + case DDERR_TOOBIGWIDTH: + return "Width requested by DirectDraw is too large."; + case DDERR_VERTICALBLANKINPROGRESS: + return "Vertical blank is in progress."; + case DDERR_UNSUPPORTEDMASK: + return "Bitmask in the pixel format requested is unsupported by DirectDraw."; + case DDERR_XALIGN: + return "Rectangle provided was not horizontally aligned on required boundary."; + case DDERR_WASSTILLDRAWING: + return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is " + "incomplete."; + case DDERR_INVALIDDIRECTDRAWGUID: + return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier."; + case DDERR_DIRECTDRAWALREADYCREATED: + return "A DirectDraw object representing this driver has already been created for this process."; + case DDERR_NODIRECTDRAWHW: + return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware."; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + return "This process already has created a primary surface."; + case DDERR_NOEMULATION: + return "Software emulation not available."; + case DDERR_REGIONTOOSMALL: + return "Region passed to Clipper::GetClipList is too small."; + case DDERR_CLIPPERISUSINGHWND: + return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd."; + case DDERR_NOCLIPPERATTACHED: + return "No clipper object attached to surface object."; + case DDERR_NOHWND: + return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND."; + case DDERR_HWNDSUBCLASSED: + return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring " + "state."; + case DDERR_HWNDALREADYSET: + return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or " + "palettes created."; + case DDERR_NOPALETTEATTACHED: + return "No palette object attached to this surface."; + case DDERR_NOPALETTEHW: + return "No hardware support for 16 or 256 color palettes."; + case DDERR_BLTFASTCANTCLIP: + return "Return if a clipper object is attached to the source surface passed into a BltFast call."; + case DDERR_NOBLTHW: + return "No blitter hardware present."; + case DDERR_NODDROPSHW: + return "No DirectDraw ROP hardware."; + case DDERR_OVERLAYNOTVISIBLE: + return "Returned when GetOverlayPosition is called on a hidden overlay."; + case DDERR_NOOVERLAYDEST: + return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on " + "to establish a destination."; + case DDERR_INVALIDPOSITION: + return "Returned when the position of the overlay on the destination is no longer legal for that destination."; + case DDERR_NOTAOVERLAYSURFACE: + return "Returned when an overlay member is called for a non-overlay surface."; + case DDERR_EXCLUSIVEMODEALREADYSET: + return "An attempt was made to set the cooperative level when it was already set to exclusive."; + case DDERR_NOTFLIPPABLE: + return "An attempt has been made to flip a surface that is not flippable."; + case DDERR_CANTDUPLICATE: + return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created."; + case DDERR_NOTLOCKED: + return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this " + "process, has been attempted."; + case DDERR_CANTCREATEDC: + return "Windows can not create any more DCs."; + case DDERR_NODC: + return "No DC was ever created for this surface."; + case DDERR_WRONGMODE: + return "This surface can not be restored because it was created in a different mode."; + case DDERR_IMPLICITLYCREATED: + return "This surface can not be restored because it is an implicitly created surface."; + case DDERR_NOTPALETTIZED: + return "The surface being used is not a palette-based surface."; + default: + return "Unrecognized error value."; + } } // FUNCTION: LEGO1 0x1009ce60 int MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId) { - if (!m_initialized) + if (!m_initialized) { return -1; + } int num = -1; int hex[4]; - if (sscanf(p_deviceId, "%d 0x%x 0x%x 0x%x 0x%x", &num, &hex[0], &hex[1], &hex[2], &hex[3]) != 5) + if (sscanf(p_deviceId, "%d 0x%x 0x%x 0x%x 0x%x", &num, &hex[0], &hex[1], &hex[2], &hex[3]) != 5) { return -1; + } - if (num < 0) + if (num < 0) { return -1; + } GUID guid; memcpy(&guid, hex, sizeof(guid)); int result = ProcessDeviceBytes(num, guid); - if (result < 0) + if (result < 0) { return ProcessDeviceBytes(-1, guid); + } return result; } // FUNCTION: LEGO1 0x1009cf20 int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid) { - if (!m_initialized) + if (!m_initialized) { return -1; + } int i = 0; int j = 0; @@ -634,8 +867,9 @@ int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid) memcpy(&deviceGuid, &p_guid, sizeof(GUID4)); for (list::iterator it = m_list.begin(); it != m_list.end(); it++) { - if (p_deviceNum >= 0 && p_deviceNum < i) + if (p_deviceNum >= 0 && p_deviceNum < i) { return -1; + } GUID4 compareGuid; MxDriver& driver = *it; @@ -644,8 +878,9 @@ int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid) if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 && compareGuid.m_data3 == deviceGuid.m_data3 && compareGuid.m_data4 == deviceGuid.m_data4 && - i == p_deviceNum) + i == p_deviceNum) { return j; + } j++; } @@ -683,28 +918,33 @@ int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice* // FUNCTION: LEGO1 0x1009d0d0 int MxDeviceEnumerate::FUN_1009d0d0() { - if (!m_initialized) + if (!m_initialized) { return -1; + } - if (m_list.empty()) + if (m_list.empty()) { return -1; + } int i = 0; int j = 0; int k = -1; - unsigned int und = FUN_1009d1a0(); + int cpu_mmx = SupportsMMX(); for (list::iterator it = m_list.begin();; it++) { - if (it == m_list.end()) + if (it == m_list.end()) { return k; + } for (list::iterator it2 = (*it).m_devices.begin(); it2 != (*it).m_devices.end(); it2++) { - if ((*it2).m_HWDesc.dcmColorModel) + if ((*it2).m_HWDesc.dcmColorModel) { return j; + } - if ((und && (*it2).m_HELDesc.dcmColorModel == D3DCOLOR_RGB && i == 0) || - (*it2).m_HELDesc.dcmColorModel == D3DCOLOR_MONO && i == 0 && k < 0) + if ((cpu_mmx && (*it2).m_HELDesc.dcmColorModel == D3DCOLOR_RGB && i == 0) || + ((*it2).m_HELDesc.dcmColorModel == D3DCOLOR_MONO && i == 0 && k < 0)) { k = j; + } j++; } @@ -715,43 +955,109 @@ int MxDeviceEnumerate::FUN_1009d0d0() return -1; } -// STUB: LEGO1 0x1009d1a0 -undefined4 MxDeviceEnumerate::FUN_1009d1a0() +// FUNCTION: LEGO1 0x1009d1a0 +int MxDeviceEnumerate::SupportsMMX() { - return 1; + int supports_mmx = SupportsCPUID(); + if (supports_mmx) { +#ifdef _MSC_VER + __asm { + mov eax, 0x0 ; EAX=0: Highest Function Parameter and Manufacturer ID +#if _MSC_VER > 1100 + cpuid ; Run CPUID +#else + __emit 0x0f + __emit 0xa2 +#endif + mov eax, 0x1 ; EAX=1: Processor Info and Feature Bits (unused) +#if _MSC_VER > 1100 + cpuid ; Run CPUID +#else + __emit 0x0f + __emit 0xa2 +#endif + xor eax, eax ; Zero EAX register + bt edx, 0x17 ; Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) + adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF + mov supports_mmx, eax ; Save eax into C variable + } +#else + __asm__("movl $0x0, %%eax\n\t" // EAX=0: Highest Function Parameter and Manufacturer ID + "cpuid\n\t" // Run CPUID\n" + "mov $0x1, %%eax\n\t" // EAX=1: Processor Info and Feature Bits (unused) + "cpuid\n\t" // Run CPUID + "xorl %%eax, %%eax\n\t" // Zero EAX register + "btl $0x15, %%edx\n\t" // Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) + "adc %%eax, %%eax" // Add with carry: EAX = EAX + EAX + CF = CF + : "=a"(supports_mmx) // supports_mmx == EAX + ); +#endif + } + return supports_mmx; } -// STUB: LEGO1 0x1009d1e0 -undefined4 MxDeviceEnumerate::FUN_1009d1e0() +// FUNCTION: LEGO1 0x1009d1e0 +int MxDeviceEnumerate::SupportsCPUID() { - return 1; + int has_cpuid; +#ifdef _MSC_VER + __asm { + xor eax, eax ; Zero EAX register + pushfd ; Push EFLAGS register value on the stack + or dword ptr[esp], 0x200000 ; Set bit 0x200000: Able to use CPUID instruction (Pentium+) + popfd ; Write the updated value into the EFLAGS register + pushfd ; Push EFLAGS register value on the stack (again) + btr dword ptr[esp], 0x15 ; Test bit 0x15 (21) and reset (set CF) + adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF + popfd ; Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) + mov has_cpuid, eax ; Save eax into C variable + } +#else + __asm__("xorl %%eax, %%eax\n\t" // Zero EAX register + "pushfl\n\t" // Push EFLAGS register value on the stack + "orl $0x200000, (%%esp)\n\t" // Set bit 0x200000: Able to use CPUID instruction (Pentium+) + "popfl\n\t" // Write the updated value into the EFLAGS register + "pushfl\n\t" // Push EFLAGS register value on the stack (again) + "btrl $0x15, (%%esp)\n\t" // Test bit 0x15 (21) and reset (set CF) + "adc %%eax, %%eax\n\t" // Add with carry: EAX = EAX + EAX + CF = CF + "popfl" // Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) + : "=a"(has_cpuid) // has_cpuid == EAX + ); +#endif + return has_cpuid; } // FUNCTION: LEGO1 0x1009d210 int MxDeviceEnumerate::FUN_1009d210() { - if (!m_initialized) + if (!m_initialized) { return -1; + } for (list::iterator it = m_list.begin(); it != m_list.end();) { MxDriver& driver = *it; - if (!FUN_1009d370(driver)) + if (!FUN_1009d370(driver)) { m_list.erase(it++); + } else { for (list::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end();) { MxDevice& device = *it2; - if (!FUN_1009d3d0(device)) + if (!FUN_1009d3d0(device)) { driver.m_devices.erase(it2++); - else + } + else { it2++; + } } - if (driver.m_devices.empty()) + if (driver.m_devices.empty()) { m_list.erase(it++); - else + } + else { it++; + } } } @@ -764,8 +1070,9 @@ unsigned char MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver) for (list::iterator it = p_driver.m_displayModes.begin(); it != p_driver.m_displayModes.end(); it++) { if ((*it).m_width == 640 && (*it).m_height == 480) { - if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16) + if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16) { return TRUE; + } } } @@ -775,15 +1082,18 @@ unsigned char MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver) // FUNCTION: LEGO1 0x1009d3d0 unsigned char MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device) { - if (m_list.size() <= 0) + if (m_list.size() <= 0) { return FALSE; + } - if (p_device.m_HWDesc.dcmColorModel) + if (p_device.m_HWDesc.dcmColorModel) { return p_device.m_HWDesc.dwDeviceZBufferBitDepth & DDBD_16 && p_device.m_HWDesc.dpcTriCaps.dwTextureCaps & 1; + } for (list::iterator it = m_list.front().m_devices.begin(); it != m_list.front().m_devices.end(); it++) { - if ((&*it) == &p_device) + if ((&*it) == &p_device) { return TRUE; + } } return FALSE; diff --git a/LEGO1/mxdirectx/mxdirect3d.h b/LEGO1/mxdirectx/mxdirect3d.h index 4de9f058..e884c741 100644 --- a/LEGO1/mxdirectx/mxdirect3d.h +++ b/LEGO1/mxdirectx/mxdirect3d.h @@ -41,9 +41,9 @@ struct MxDevice; class MxDirect3D : public MxDirectDraw { public: MxDirect3D(); - virtual ~MxDirect3D(); + ~MxDirect3D() override; - virtual BOOL Create( + BOOL Create( HWND hWnd, BOOL fullscreen_1, BOOL surface_fullscreen, @@ -53,9 +53,9 @@ class MxDirect3D : public MxDirectDraw { int bpp, const PALETTEENTRY* pPaletteEntries, int paletteEntryCount - ) override; // vtable+0x04 - virtual void Destroy() override; // vtable+0x08 - virtual void DestroyButNotDirectDraw() override; // vtable+0x0c + ) override; // vtable+0x04 + void Destroy() override; // vtable+0x08 + void DestroyButNotDirectDraw() override; // vtable+0x0c BOOL CreateIDirect3D(); BOOL D3DSetMode(); @@ -216,8 +216,8 @@ class MxDeviceEnumerate { LPD3DDEVICEDESC p_HELDesc, LPVOID p_context ); - static undefined4 FUN_1009d1a0(); - static undefined4 FUN_1009d1e0(); + static int SupportsMMX(); + static int SupportsCPUID(); friend class MxDirect3D; diff --git a/LEGO1/mxdirectx/mxdirectdraw.cpp b/LEGO1/mxdirectx/mxdirectdraw.cpp index 7e78cf69..7b64afe3 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.cpp +++ b/LEGO1/mxdirectx/mxdirectdraw.cpp @@ -510,8 +510,9 @@ BOOL MxDirectDraw::DDCreateSurfaces() ddsd.dwWidth = m_currentMode.width; ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; - if (m_bOnlySystemMemory) + if (m_bOnlySystemMemory) { ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY; + } result = CreateDDSurface(&ddsd, &m_pBackBuffer, NULL); if (result != DD_OK) { Error("CreateSurface for window back buffer failed", result); @@ -666,8 +667,9 @@ BOOL MxDirectDraw::CreateTextSurfaces() ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - if (m_bOnlySystemMemory) + if (m_bOnlySystemMemory) { ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; + } ddsd.dwHeight = m_text1SizeOnSurface.cy; ddsd.dwWidth = m_text1SizeOnSurface.cx; @@ -687,8 +689,9 @@ BOOL MxDirectDraw::CreateTextSurfaces() ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - if (m_bOnlySystemMemory) + if (m_bOnlySystemMemory) { ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; + } ddsd.dwHeight = m_text2SizeOnSurface.cy; ddsd.dwWidth = m_text2SizeOnSurface.cx; diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index d96d302a..bdb3f191 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -15,6 +15,9 @@ class Mx3DPointFloat : public Vector3 { m_elements[2] = p_z; } + // FUNCTION: LEGO1 0x100343a0 + inline Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } + // SYNTHETIC: LEGO1 0x1001d170 // Mx3DPointFloat::Mx3DPointFloat @@ -28,8 +31,9 @@ class Mx3DPointFloat : public Vector3 { float* dest = m_elements; const float* src = p_other.m_elements; - for (size_t i = sizeof(m_elements) / sizeof(float); i > 0; --i) + for (size_t i = sizeof(m_elements) / sizeof(float); i > 0; --i) { *dest++ = *src++; + } } inline void EqualsCross(Mx3DPointFloat& p_a, Mx3DPointFloat& p_b) { EqualsCrossImpl(p_a.m_data, p_b.m_data); } diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 3ae03404..81cdaa2c 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -11,7 +11,7 @@ class MxMatrix : public Matrix4 { inline MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } // FUNCTION: LEGO1 0x10002850 - virtual void operator=(const Matrix4& p_matrix) { Equals(p_matrix); } // vtable+0x28 + void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 // No idea why there's another equals. Maybe to some other type like the // DirectX Retained Mode Matrix type which is also a float* alias? diff --git a/LEGO1/omni/include/mxactionnotificationparam.h b/LEGO1/omni/include/mxactionnotificationparam.h index f53ac728..96c44a93 100644 --- a/LEGO1/omni/include/mxactionnotificationparam.h +++ b/LEGO1/omni/include/mxactionnotificationparam.h @@ -21,8 +21,9 @@ class MxActionNotificationParam : public MxNotificationParam { MxDSAction* oldAction = p_action; this->m_realloc = p_reallocAction; - if (p_reallocAction) + if (p_reallocAction) { this->m_action = new MxDSAction(); + } else { this->m_action = oldAction; return; @@ -34,17 +35,19 @@ class MxActionNotificationParam : public MxNotificationParam { } // FUNCTION: LEGO1 0x10051050 - inline virtual ~MxActionNotificationParam() override + inline ~MxActionNotificationParam() override { - if (!this->m_realloc) + if (!this->m_realloc) { return; + } - if (this->m_action) + if (this->m_action) { delete this->m_action; + } } // FUNCTION: LEGO1 0x100510c0 - virtual MxNotificationParam* Clone() override + MxNotificationParam* Clone() override { return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc); } // vtable+0x04 @@ -70,7 +73,7 @@ class MxStartActionNotificationParam : public MxActionNotificationParam { { } - virtual MxNotificationParam* Clone() override; // vtable+0x04 + MxNotificationParam* Clone() override; // vtable+0x04 }; // VTABLE: LEGO1 0x100d8358 @@ -88,7 +91,7 @@ class MxEndActionNotificationParam : public MxActionNotificationParam { } // FUNCTION: LEGO1 0x10051270 - virtual MxNotificationParam* Clone() override + MxNotificationParam* Clone() override { return new MxEndActionNotificationParam( c_notificationEndAction, @@ -109,7 +112,7 @@ class MxType4NotificationParam : public MxActionNotificationParam { m_unk0x14 = p_unk0x14; } - virtual MxNotificationParam* Clone() override; // vtable+0x04 + MxNotificationParam* Clone() override; // vtable+0x04 private: MxPresenter* m_unk0x14; // 0x14 diff --git a/LEGO1/omni/include/mxaudiomanager.h b/LEGO1/omni/include/mxaudiomanager.h index d2b97d1a..020bda54 100644 --- a/LEGO1/omni/include/mxaudiomanager.h +++ b/LEGO1/omni/include/mxaudiomanager.h @@ -9,10 +9,10 @@ class MxAudioManager : public MxMediaManager { public: MxAudioManager(); - virtual ~MxAudioManager() override; + ~MxAudioManager() override; - virtual MxResult InitPresenters() override; // vtable+14 - virtual void Destroy() override; // vtable+18 + MxResult InitPresenters() override; // vtable+14 + void Destroy() override; // vtable+18 // FUNCTION: LEGO1 0x10029910 virtual MxS32 GetVolume() { return this->m_volume; } // vtable+28 diff --git a/LEGO1/omni/include/mxaudiopresenter.h b/LEGO1/omni/include/mxaudiopresenter.h index bf127d2b..873871ec 100644 --- a/LEGO1/omni/include/mxaudiopresenter.h +++ b/LEGO1/omni/include/mxaudiopresenter.h @@ -11,14 +11,14 @@ class MxAudioPresenter : public MxMediaPresenter { MxAudioPresenter() { m_volume = 100; } // FUNCTION: LEGO1 0x1000d280 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f078c return "MxAudioPresenter"; } // FUNCTION: LEGO1 0x1000d290 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxAudioPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index 7045c01e..465b2026 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -35,7 +35,7 @@ struct MxBITMAPINFO { class MxBitmap : public MxCore { public: MxBitmap(); - virtual ~MxBitmap(); // vtable+00 + ~MxBitmap() override; // vtable+00 virtual MxResult ImportBitmap(MxBitmap* p_bitmap); // vtable+14 virtual MxResult ImportBitmapInfo(MxBITMAPINFO* p_info); // vtable+18 @@ -102,30 +102,37 @@ class MxBitmap : public MxCore { } inline MxLong GetAdjustedStride() { - if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) + if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) { return GetBmiStride(); - else + } + else { return -GetBmiStride(); + } } inline MxLong GetLine(MxS32 p_top) { MxS32 height; - if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) + if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) { height = p_top; - else + } + else { height = GetBmiHeightAbs() - p_top - 1; + } return GetBmiStride() * height; } inline MxU8* GetStart(MxS32 p_left, MxS32 p_top) { - if (m_bmiHeader->biCompression == BI_RGB) + if (m_bmiHeader->biCompression == BI_RGB) { return GetLine(p_top) + m_data + p_left; - else if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) + } + else if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) { return m_data; - else + } + else { return GetLine(0) + m_data; + } } // SYNTHETIC: LEGO1 0x100bc9f0 diff --git a/LEGO1/omni/include/mxcollection.h b/LEGO1/omni/include/mxcollection.h index 58647ed4..84acdeef 100644 --- a/LEGO1/omni/include/mxcollection.h +++ b/LEGO1/omni/include/mxcollection.h @@ -16,7 +16,7 @@ class MxCollection : public MxCore { void SetDestroy(void (*p_customDestructor)(T)) { this->m_customDestructor = p_customDestructor; } - virtual ~MxCollection() {} + ~MxCollection() override {} virtual MxS8 Compare(T, T) { return 0; } protected: diff --git a/LEGO1/omni/include/mxcompositepresenter.h b/LEGO1/omni/include/mxcompositepresenter.h index 122778d6..a39507c0 100644 --- a/LEGO1/omni/include/mxcompositepresenter.h +++ b/LEGO1/omni/include/mxcompositepresenter.h @@ -12,37 +12,38 @@ class MxCompositePresenterList : public list {}; class MxCompositePresenter : public MxPresenter { public: MxCompositePresenter(); - virtual ~MxCompositePresenter() override; // vtable+0x00 + ~MxCompositePresenter() override; // vtable+0x00 - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100b6210 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0774 return "MxCompositePresenter"; } // FUNCTION: LEGO1 0x100b6220 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxCompositePresenter::ClassName()) || MxPresenter::IsA(p_name); } - virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - virtual void EndAction() override; // vtable+0x40 - virtual void SetTickleState(TickleState p_tickleState) override; // vtable+0x44 - virtual MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48 - virtual void Enable(MxBool p_enable) override; // vtable+0x54 - virtual void VTable0x58(MxEndActionNotificationParam& p_param); // vtable+0x58 - virtual void VTable0x5c(MxNotificationParam& p_param); // vtable+0x5c - virtual void VTable0x60(MxPresenter* p_presenter); // vtable+0x60 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void SetTickleState(TickleState p_tickleState) override; // vtable+0x44 + MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48 + void Enable(MxBool p_enable) override; // vtable+0x54 + virtual void VTable0x58(MxEndActionNotificationParam& p_param); // vtable+0x58 + virtual void VTable0x5c(MxNotificationParam& p_param); // vtable+0x5c + virtual void VTable0x60(MxPresenter* p_presenter); // vtable+0x60 // FUNCTION: LEGO1 0x1000caf0 virtual MxBool VTable0x64(undefined4 p_undefined) { - if (m_compositePresenter) + if (m_compositePresenter) { return m_compositePresenter->VTable0x64(p_undefined); + } return TRUE; } // vtable+0x64 diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index c571882a..ab13c73d 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -15,30 +15,30 @@ class MxDiskStreamController : public MxStreamController { public: MxDiskStreamController(); - virtual ~MxDiskStreamController() override; + ~MxDiskStreamController() override; - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x100c7360 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102144 return "MxDiskStreamController"; } // FUNCTION: LEGO1 0x100c7370 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDiskStreamController::ClassName()) || MxStreamController::IsA(p_name); } - virtual MxResult Open(const char* p_filename) override; // vtable+0x14 - virtual MxResult VTable0x18(undefined4, undefined4) override; // vtable+0x18 - virtual MxResult VTable0x20(MxDSAction* p_action) override; // vtable+0x20 - virtual MxResult VTable0x24(MxDSAction* p_action) override; // vtable+0x24 - virtual MxDSStreamingAction* VTable0x28() override; // vtable+0x28 - virtual MxResult VTable0x30(MxDSAction* p_action) override; // vtable+0x30 - virtual MxResult VTable0x34(undefined4); // vtable+0x34 + MxResult Open(const char* p_filename) override; // vtable+0x14 + MxResult VTable0x18(undefined4, undefined4) override; // vtable+0x18 + MxResult VTable0x20(MxDSAction* p_action) override; // vtable+0x20 + MxResult VTable0x24(MxDSAction* p_action) override; // vtable+0x24 + MxDSStreamingAction* VTable0x28() override; // vtable+0x28 + MxResult VTable0x30(MxDSAction* p_action) override; // vtable+0x30 + virtual MxResult VTable0x34(undefined4); // vtable+0x34 inline MxBool GetUnk0xc4() const { return m_unk0xc4; } diff --git a/LEGO1/omni/include/mxdiskstreamprovider.h b/LEGO1/omni/include/mxdiskstreamprovider.h index 517fa463..7bac3a0b 100644 --- a/LEGO1/omni/include/mxdiskstreamprovider.h +++ b/LEGO1/omni/include/mxdiskstreamprovider.h @@ -27,17 +27,17 @@ class MxDiskStreamProviderThread : public MxThread { class MxDiskStreamProvider : public MxStreamProvider { public: MxDiskStreamProvider(); - virtual ~MxDiskStreamProvider() override; + ~MxDiskStreamProvider() override; // FUNCTION: LEGO1 0x100d1160 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x1010287c return "MxDiskStreamProvider"; } // FUNCTION: LEGO1 0x100d1170 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDiskStreamProvider::ClassName()) || MxStreamProvider::IsA(p_name); } @@ -48,12 +48,12 @@ class MxDiskStreamProvider : public MxStreamProvider { static MxBool FUN_100d1af0(MxDSStreamingAction* p_action); MxResult FUN_100d1b20(MxDSStreamingAction* p_action); - virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 - virtual MxU32 GetFileSize() override; // vtable+0x18 - virtual MxS32 GetStreamBuffersNum() override; // vtable+0x1c - virtual void VTable0x20(MxDSAction* p_action) override; // vtable+0x20 - virtual MxU32 GetLengthInDWords() override; // vtable+0x24 - virtual MxU32* GetBufferForDWords() override; // vtable+0x28 + MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 + MxU32 GetFileSize() override; // vtable+0x18 + MxS32 GetStreamBuffersNum() override; // vtable+0x1c + void VTable0x20(MxDSAction* p_action) override; // vtable+0x20 + MxU32 GetLengthInDWords() override; // vtable+0x24 + MxU32* GetBufferForDWords() override; // vtable+0x28 private: MxDiskStreamProviderThread m_thread; // 0x10 diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index 69706126..4e107f60 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -14,7 +14,7 @@ class MxDisplaySurface : public MxCore { public: MxDisplaySurface(); - virtual ~MxDisplaySurface() override; + ~MxDisplaySurface() override; virtual MxResult Init( MxVideoParam& p_videoParam, diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index 75b3cc2c..0146ba04 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -25,35 +25,35 @@ class MxDSAction : public MxDSObject { }; MxDSAction(); - virtual ~MxDSAction(); + ~MxDSAction() override; void CopyFrom(MxDSAction& p_dsAction); MxDSAction& operator=(MxDSAction& p_dsAction); // FUNCTION: LEGO1 0x100ad980 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101013f4 return "MxDSAction"; } // FUNCTION: LEGO1 0x100ad990 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSAction::ClassName()) || MxDSObject::IsA(p_name); } - virtual undefined4 VTable0x14() override; // vtable+14; - virtual MxU32 GetSizeOnDisk() override; // vtable+18; - virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; - virtual MxLong GetDuration(); // vtable+24; - virtual void SetDuration(MxLong p_duration); // vtable+28; - virtual MxDSAction* Clone(); // vtable+2c; - virtual void MergeFrom(MxDSAction& p_dsAction); // vtable+30; - virtual MxBool HasId(MxU32 p_objectId); // vtable+34; - virtual void SetUnknown90(MxLong p_unk0x90); // vtable+38; - virtual MxLong GetUnknown90(); // vtable+3c; - virtual MxLong GetElapsedTime(); // vtable+40; + undefined4 VTable0x14() override; // vtable+14; + MxU32 GetSizeOnDisk() override; // vtable+18; + void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; + virtual MxLong GetDuration(); // vtable+24; + virtual void SetDuration(MxLong p_duration); // vtable+28; + virtual MxDSAction* Clone(); // vtable+2c; + virtual void MergeFrom(MxDSAction& p_dsAction); // vtable+30; + virtual MxBool HasId(MxU32 p_objectId); // vtable+34; + virtual void SetUnknown90(MxLong p_unk0x90); // vtable+38; + virtual MxLong GetUnknown90(); // vtable+3c; + virtual MxLong GetElapsedTime(); // vtable+40; void AppendData(MxU16 p_extraLength, const char* p_extraData); @@ -77,10 +77,12 @@ class MxDSAction : public MxDSObject { inline void CopyFlags(MxU32 p_flags) { - if (p_flags & MxDSAction::c_looping) + if (p_flags & MxDSAction::c_looping) { SetFlags(GetFlags() | MxDSAction::c_looping); - else if (p_flags & MxDSAction::c_bit3) + } + else if (p_flags & MxDSAction::c_bit3) { SetFlags(GetFlags() | MxDSAction::c_bit3); + } } // SYNTHETIC: LEGO1 0x100ada60 diff --git a/LEGO1/omni/include/mxdsactionlist.h b/LEGO1/omni/include/mxdsactionlist.h index 75d96842..b413cd2b 100644 --- a/LEGO1/omni/include/mxdsactionlist.h +++ b/LEGO1/omni/include/mxdsactionlist.h @@ -19,7 +19,7 @@ class MxDSActionList : public MxList { MxDSActionList() { this->m_unk0x18 = 0; } // FUNCTION: LEGO1 0x100c9c90 - virtual MxS8 Compare(MxDSAction* p_a, MxDSAction* p_b) override + MxS8 Compare(MxDSAction* p_a, MxDSAction* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 diff --git a/LEGO1/omni/include/mxdsanim.h b/LEGO1/omni/include/mxdsanim.h index 0e5b9a0c..09f9c72c 100644 --- a/LEGO1/omni/include/mxdsanim.h +++ b/LEGO1/omni/include/mxdsanim.h @@ -8,25 +8,25 @@ class MxDSAnim : public MxDSMediaAction { public: MxDSAnim(); - virtual ~MxDSAnim() override; + ~MxDSAnim() override; void CopyFrom(MxDSAnim& p_dsAnim); MxDSAnim& operator=(MxDSAnim& p_dsAnim); // FUNCTION: LEGO1 0x100c9060 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025d8 return "MxDSAnim"; } // FUNCTION: LEGO1 0x100c9070 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSAnim::ClassName()) || MxDSMediaAction::IsA(p_name); } - virtual MxDSAction* Clone() override; // vtable+2c; + MxDSAction* Clone() override; // vtable+2c; // SYNTHETIC: LEGO1 0x100c9180 // MxDSAnim::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxdsbuffer.h b/LEGO1/omni/include/mxdsbuffer.h index 01696471..79dee7d7 100644 --- a/LEGO1/omni/include/mxdsbuffer.h +++ b/LEGO1/omni/include/mxdsbuffer.h @@ -22,10 +22,10 @@ class MxDSBuffer : public MxCore { }; MxDSBuffer(); - virtual ~MxDSBuffer() override; + ~MxDSBuffer() override; // FUNCTION: LEGO1 0x100c6500 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025b8 return "MxDSBuffer"; diff --git a/LEGO1/omni/include/mxdschunk.h b/LEGO1/omni/include/mxdschunk.h index 1933df93..c21816e6 100644 --- a/LEGO1/omni/include/mxdschunk.h +++ b/LEGO1/omni/include/mxdschunk.h @@ -18,17 +18,17 @@ class MxDSChunk : public MxCore { }; MxDSChunk(); - virtual ~MxDSChunk() override; + ~MxDSChunk() override; // FUNCTION: LEGO1 0x100be0c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e6c return "MxDSChunk"; } // FUNCTION: LEGO1 0x100be0d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSChunk::ClassName()) || MxCore::IsA(p_name); } @@ -53,8 +53,9 @@ class MxDSChunk : public MxCore { inline void Release() { - if (m_data) + if (m_data) { delete[] m_data; + } } // SYNTHETIC: LEGO1 0x100be150 diff --git a/LEGO1/omni/include/mxdsevent.h b/LEGO1/omni/include/mxdsevent.h index 1a197496..492cfd10 100644 --- a/LEGO1/omni/include/mxdsevent.h +++ b/LEGO1/omni/include/mxdsevent.h @@ -7,25 +7,25 @@ class MxDSEvent : public MxDSMediaAction { public: MxDSEvent(); - virtual ~MxDSEvent() override; + ~MxDSEvent() override; void CopyFrom(MxDSEvent& p_dsEvent); MxDSEvent& operator=(MxDSEvent& p_dsEvent); // FUNCTION: LEGO1 0x100c9660 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025f0 return "MxDSEvent"; } // FUNCTION: LEGO1 0x100c9670 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSEvent::ClassName()) || MxDSMediaAction::IsA(p_name); } - virtual MxDSAction* Clone() override; // vtable+2c; + MxDSAction* Clone() override; // vtable+2c; // SYNTHETIC: LEGO1 0x100c9780 // MxDSEvent::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxdsfile.h b/LEGO1/omni/include/mxdsfile.h index 4242fe0d..b635c896 100644 --- a/LEGO1/omni/include/mxdsfile.h +++ b/LEGO1/omni/include/mxdsfile.h @@ -9,30 +9,39 @@ #include // VTABLE: LEGO1 0x100dc890 +// SIZE 0x7c class MxDSFile : public MxDSSource { public: MxDSFile(const char* p_filename, MxULong p_skipReadingChunks); - virtual ~MxDSFile(); // vtable+0x00 + +#ifdef ISLE_APP + ~MxDSFile() override { Close(); } +#else + // We have to explicitly use dllexport, otherwise this function cannot be exported, + // since it is inlined everywhere in LEGO1.DLL + // FUNCTION: LEGO1 0x100bfed0 + __declspec(dllexport) ~MxDSFile() override { Close(); } +#endif // FUNCTION: LEGO1 0x100c0120 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102594 return "MxDSFile"; } // FUNCTION: LEGO1 0x100c0130 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSFile::ClassName()) || MxDSSource::IsA(p_name); } - virtual MxLong Open(MxULong); // vtable+0x14 - virtual MxLong Close(); // vtable+0x18 - virtual MxResult Read(unsigned char*, MxULong); // vtable+0x20 - virtual MxLong Seek(MxLong, int); // vtable+0x24 - virtual MxULong GetBufferSize(); // vtable+0x28 - virtual MxULong GetStreamBuffersNum(); // vtable+0x2c + MxLong Open(MxULong) override; // vtable+0x14 + MxLong Close() override; // vtable+0x18 + MxResult Read(unsigned char*, MxULong) override; // vtable+0x20 + MxLong Seek(MxLong, int) override; // vtable+0x24 + MxULong GetBufferSize() override; // vtable+0x28 + MxULong GetStreamBuffersNum() override; // vtable+0x2c inline void SetFileName(const char* p_filename) { m_filename = p_filename; } @@ -41,25 +50,27 @@ class MxDSFile : public MxDSSource { // SYNTHETIC: LEGO1 0x100c01e0 // MxDSFile::`scalar deleting destructor' -private: - MxLong ReadChunks(); + // SIZE 0x0c struct ChunkHeader { ChunkHeader() : m_majorVersion(0), m_minorVersion(0), m_bufferSize(0), m_streamBuffersNum(0) {} - MxU16 m_majorVersion; - MxU16 m_minorVersion; - MxULong m_bufferSize; - MxS16 m_streamBuffersNum; - MxS16 m_reserved; + MxU16 m_majorVersion; // 0x00 + MxU16 m_minorVersion; // 0x02 + MxULong m_bufferSize; // 0x04 + MxS16 m_streamBuffersNum; // 0x08 + MxS16 m_reserved; // 0x0a }; - MxString m_filename; - MXIOINFO m_io; - ChunkHeader m_header; +private: + MxLong ReadChunks(); + + MxString m_filename; // 0x14 + MXIOINFO m_io; // 0x24 + ChunkHeader m_header; // 0x6c // If false, read chunks immediately on open, otherwise // skip reading chunks until ReadChunks is explicitly called. - MxULong m_skipReadingChunks; + MxULong m_skipReadingChunks; // 0x78 }; #endif // MXDSFILE_H diff --git a/LEGO1/omni/include/mxdsmediaaction.h b/LEGO1/omni/include/mxdsmediaaction.h index 7422ec2d..32664156 100644 --- a/LEGO1/omni/include/mxdsmediaaction.h +++ b/LEGO1/omni/include/mxdsmediaaction.h @@ -10,20 +10,20 @@ class MxDSMediaAction : public MxDSAction { public: MxDSMediaAction(); - virtual ~MxDSMediaAction() override; + ~MxDSMediaAction() override; void CopyFrom(MxDSMediaAction& p_dsMediaAction); MxDSMediaAction& operator=(MxDSMediaAction& p_dsMediaAction); // FUNCTION: LEGO1 0x100c8be0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7624 return "MxDSMediaAction"; } // FUNCTION: LEGO1 0x100c8bf0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSMediaAction::ClassName()) || MxDSAction::IsA(p_name); } @@ -31,10 +31,10 @@ class MxDSMediaAction : public MxDSAction { // SYNTHETIC: LEGO1 0x100c8cd0 // MxDSMediaAction::`scalar deleting destructor' - virtual undefined4 VTable0x14(); // vtable+14; - virtual MxU32 GetSizeOnDisk() override; // vtable+18; - virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; - virtual MxDSAction* Clone() override; // vtable+2c; + undefined4 VTable0x14() override; // vtable+14; + MxU32 GetSizeOnDisk() override; // vtable+18; + void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; + MxDSAction* Clone() override; // vtable+2c; void CopyMediaSrcPath(const char* p_mediaSrcPath); diff --git a/LEGO1/omni/include/mxdsmultiaction.h b/LEGO1/omni/include/mxdsmultiaction.h index 22a04feb..d97e6116 100644 --- a/LEGO1/omni/include/mxdsmultiaction.h +++ b/LEGO1/omni/include/mxdsmultiaction.h @@ -9,32 +9,32 @@ class MxDSMultiAction : public MxDSAction { public: MxDSMultiAction(); - virtual ~MxDSMultiAction() override; + ~MxDSMultiAction() override; void CopyFrom(MxDSMultiAction& p_dsMultiAction); MxDSMultiAction& operator=(MxDSMultiAction& p_dsMultiAction); // FUNCTION: LEGO1 0x100c9f50 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101dbc return "MxDSMultiAction"; } // FUNCTION: LEGO1 0x100c9f60 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSMultiAction::ClassName()) || MxDSAction::IsA(p_name); } - virtual undefined4 VTable0x14() override; // vtable+14; - virtual MxU32 GetSizeOnDisk() override; // vtable+18; - virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; - virtual void SetAtomId(MxAtomId p_atomId) override; // vtable+20; - virtual MxDSAction* Clone() override; // vtable+2c; - virtual void MergeFrom(MxDSAction& p_dsAction) override; // vtable+30; - virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34; - virtual void SetUnknown90(MxLong p_unk0x90) override; // vtable+38; + undefined4 VTable0x14() override; // vtable+14; + MxU32 GetSizeOnDisk() override; // vtable+18; + void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; + void SetAtomId(MxAtomId p_atomId) override; // vtable+20; + MxDSAction* Clone() override; // vtable+2c; + void MergeFrom(MxDSAction& p_dsAction) override; // vtable+30; + MxBool HasId(MxU32 p_objectId) override; // vtable+34; + void SetUnknown90(MxLong p_unk0x90) override; // vtable+38; inline MxDSActionList* GetActionList() const { return m_actions; } diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index 9ede2f11..c7156004 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -27,7 +27,7 @@ class MxDSObject : public MxCore { }; MxDSObject(); - virtual ~MxDSObject() override; + ~MxDSObject() override; void CopyFrom(MxDSObject& p_dsObject); MxDSObject& operator=(MxDSObject& p_dsObject); @@ -36,10 +36,10 @@ class MxDSObject : public MxCore { void SetSourceName(const char* p_sourceName); // FUNCTION: LEGO1 0x100bf730 - inline virtual const char* ClassName() const override { return "MxDSObject"; } // vtable+0c + inline const char* ClassName() const override { return "MxDSObject"; } // vtable+0c // FUNCTION: LEGO1 0x100bf740 - inline virtual MxBool IsA(const char* p_name) const override + inline MxBool IsA(const char* p_name) const override { return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name); } // vtable+10; diff --git a/LEGO1/omni/include/mxdsobjectaction.h b/LEGO1/omni/include/mxdsobjectaction.h index 77480452..205c6d81 100644 --- a/LEGO1/omni/include/mxdsobjectaction.h +++ b/LEGO1/omni/include/mxdsobjectaction.h @@ -8,24 +8,24 @@ class MxDSObjectAction : public MxDSMediaAction { public: MxDSObjectAction(); - virtual ~MxDSObjectAction() override; + ~MxDSObjectAction() override; MxDSObjectAction& operator=(MxDSObjectAction& p_dsObjectAction); // FUNCTION: LEGO1 0x100c88e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025c4 return "MxDSObjectAction"; } // FUNCTION: LEGO1 0x100c88f0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSObjectAction::ClassName()) || MxDSMediaAction::IsA(p_name); } - virtual MxDSAction* Clone() override; // vtable+2c; + MxDSAction* Clone() override; // vtable+2c; virtual void CopyFrom(MxDSObjectAction& p_dsObjectAction); // vtable+44; // SYNTHETIC: LEGO1 0x100c8a00 diff --git a/LEGO1/omni/include/mxdsparallelaction.h b/LEGO1/omni/include/mxdsparallelaction.h index 0386de7f..212fb8f0 100644 --- a/LEGO1/omni/include/mxdsparallelaction.h +++ b/LEGO1/omni/include/mxdsparallelaction.h @@ -8,20 +8,20 @@ class MxDSParallelAction : public MxDSMultiAction { public: MxDSParallelAction(); - virtual ~MxDSParallelAction() override; + ~MxDSParallelAction() override; void CopyFrom(MxDSParallelAction& p_dsParallelAction); MxDSParallelAction& operator=(MxDSParallelAction& p_dsParallelAction); // FUNCTION: LEGO1 0x100caf00 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102608 return "MxDSParallelAction"; } // FUNCTION: LEGO1 0x100caf10 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSParallelAction::ClassName()) || MxDSMultiAction::IsA(p_name); } @@ -29,12 +29,12 @@ class MxDSParallelAction : public MxDSMultiAction { // SYNTHETIC: LEGO1 0x100cb020 // MxDSParallelAction::`scalar deleting destructor' - virtual MxLong GetDuration() override; // vtable+24; + MxLong GetDuration() override; // vtable+24; // FUNCTION: LEGO1 0x100caef0 - virtual void SetDuration(MxLong p_duration) override { m_duration = p_duration; } // vtable+0x28 + void SetDuration(MxLong p_duration) override { m_duration = p_duration; } // vtable+0x28 - virtual MxDSAction* Clone() override; // vtable+2c; + MxDSAction* Clone() override; // vtable+2c; }; #endif // MXDSPARALLELACTION_H diff --git a/LEGO1/omni/include/mxdsselectaction.h b/LEGO1/omni/include/mxdsselectaction.h index f7c6a148..ab2e6609 100644 --- a/LEGO1/omni/include/mxdsselectaction.h +++ b/LEGO1/omni/include/mxdsselectaction.h @@ -10,27 +10,27 @@ class MxDSSelectAction : public MxDSParallelAction { public: MxDSSelectAction(); - virtual ~MxDSSelectAction() override; + ~MxDSSelectAction() override; void CopyFrom(MxDSSelectAction& p_dsSelectAction); MxDSSelectAction& operator=(MxDSSelectAction& p_dsSelectAction); // FUNCTION: LEGO1 0x100cb6f0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x1010261c return "MxDSSelectAction"; } // FUNCTION: LEGO1 0x100cb700 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSSelectAction::ClassName()) || MxDSParallelAction::IsA(p_name); } - virtual MxU32 GetSizeOnDisk() override; // vtable+18; - virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; - virtual MxDSAction* Clone() override; // vtable+2c; + MxU32 GetSizeOnDisk() override; // vtable+18; + void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; + MxDSAction* Clone() override; // vtable+2c; // SYNTHETIC: LEGO1 0x100cb840 // MxDSSelectAction::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxdsserialaction.h b/LEGO1/omni/include/mxdsserialaction.h index 694c9afa..b1c2a695 100644 --- a/LEGO1/omni/include/mxdsserialaction.h +++ b/LEGO1/omni/include/mxdsserialaction.h @@ -9,27 +9,27 @@ class MxDSSerialAction : public MxDSMultiAction { public: MxDSSerialAction(); - virtual ~MxDSSerialAction() override; + ~MxDSSerialAction() override; void CopyFrom(MxDSSerialAction& p_dsSerialAction); MxDSSerialAction& operator=(MxDSSerialAction& p_dsSerialAction); // FUNCTION: LEGO1 0x100caad0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f75dc return "MxDSSerialAction"; } // FUNCTION: LEGO1 0x100caae0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSSerialAction::ClassName()) || MxDSMultiAction::IsA(p_name); } - virtual MxLong GetDuration() override; // vtable+24; - virtual void SetDuration(MxLong p_duration) override; // vtable+28; - virtual MxDSAction* Clone() override; // vtable+2c; + MxLong GetDuration() override; // vtable+24; + void SetDuration(MxLong p_duration) override; // vtable+28; + MxDSAction* Clone() override; // vtable+2c; // SYNTHETIC: LEGO1 0x100cabf0 // MxDSSerialAction::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxdssound.h b/LEGO1/omni/include/mxdssound.h index 3d1fa31d..193fde3a 100644 --- a/LEGO1/omni/include/mxdssound.h +++ b/LEGO1/omni/include/mxdssound.h @@ -8,27 +8,27 @@ class MxDSSound : public MxDSMediaAction { public: MxDSSound(); - virtual ~MxDSSound() override; + ~MxDSSound() override; void CopyFrom(MxDSSound& p_dsSound); MxDSSound& operator=(MxDSSound& p_dsSound); // FUNCTION: LEGO1 0x100c9330 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025e4 return "MxDSSound"; } // FUNCTION: LEGO1 0x100c9340 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSSound::ClassName()) || MxDSMediaAction::IsA(p_name); } - virtual MxU32 GetSizeOnDisk() override; // vtable+18; - virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; - virtual MxDSAction* Clone() override; // vtable+2c; + MxU32 GetSizeOnDisk() override; // vtable+18; + void Deserialize(MxU8** p_source, MxS16 p_unk0x24) override; // vtable+1c; + MxDSAction* Clone() override; // vtable+2c; inline MxS32 GetVolume() const { return m_volume; } diff --git a/LEGO1/omni/include/mxdssource.h b/LEGO1/omni/include/mxdssource.h index 143b9c78..d3b9474b 100644 --- a/LEGO1/omni/include/mxdssource.h +++ b/LEGO1/omni/include/mxdssource.h @@ -12,17 +12,17 @@ class MxDSSource : public MxCore { MxDSSource() : m_lengthInDWords(0), m_pBuffer(NULL), m_position(-1) {} // FUNCTION: LEGO1 0x100bff60 - virtual ~MxDSSource() override { delete[] m_pBuffer; } + ~MxDSSource() override { delete[] m_pBuffer; } // FUNCTION: LEGO1 0x100c0010 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102588 return "MxDSSource"; } // FUNCTION: LEGO1 0x100c0020 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSSource::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxdsstill.h b/LEGO1/omni/include/mxdsstill.h index 4de69475..f46fff32 100644 --- a/LEGO1/omni/include/mxdsstill.h +++ b/LEGO1/omni/include/mxdsstill.h @@ -8,25 +8,25 @@ class MxDSStill : public MxDSMediaAction { public: MxDSStill(); - virtual ~MxDSStill() override; + ~MxDSStill() override; void CopyFrom(MxDSStill& p_dsStill); MxDSStill& operator=(MxDSStill& p_dsStill); // FUNCTION: LEGO1 0x100c9930 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025fc return "MxDSStill"; } // FUNCTION: LEGO1 0x100c9940 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSStill::ClassName()) || MxDSMediaAction::IsA(p_name); } - virtual MxDSAction* Clone() override; // vtable+2c; + MxDSAction* Clone() override; // vtable+2c; // SYNTHETIC: LEGO1 0x100c9a50 // MxDSStill::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxdsstreamingaction.h b/LEGO1/omni/include/mxdsstreamingaction.h index 074bd5ed..94e652ae 100644 --- a/LEGO1/omni/include/mxdsstreamingaction.h +++ b/LEGO1/omni/include/mxdsstreamingaction.h @@ -11,7 +11,7 @@ class MxDSStreamingAction : public MxDSAction { public: MxDSStreamingAction(MxDSAction& p_dsAction, MxU32 p_offset); MxDSStreamingAction(MxDSStreamingAction& p_dsStreamingAction); - virtual ~MxDSStreamingAction(); + ~MxDSStreamingAction() override; MxDSStreamingAction* CopyFrom(MxDSStreamingAction& p_dsStreamingAction); MxDSStreamingAction& operator=(MxDSAction& p_dsAction) @@ -25,7 +25,7 @@ class MxDSStreamingAction : public MxDSAction { return *this; } - virtual MxBool HasId(MxU32 p_objectId) override; // vtable+34; + MxBool HasId(MxU32 p_objectId) override; // vtable+34; MxResult Init(); void SetInternalAction(MxDSAction* p_dsAction); diff --git a/LEGO1/omni/include/mxdssubscriber.h b/LEGO1/omni/include/mxdssubscriber.h index 1156be36..4f8d0843 100644 --- a/LEGO1/omni/include/mxdssubscriber.h +++ b/LEGO1/omni/include/mxdssubscriber.h @@ -14,17 +14,17 @@ class MxStreamController; class MxDSSubscriber : public MxCore { public: MxDSSubscriber(); - virtual ~MxDSSubscriber() override; + ~MxDSSubscriber() override; // FUNCTION: LEGO1 0x100b7d50 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101020f8 return "MxDSSubscriber"; } // FUNCTION: LEGO1 0x100b7d60 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSSubscriber::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxentity.h b/LEGO1/omni/include/mxentity.h index df36ea37..ed75d148 100644 --- a/LEGO1/omni/include/mxentity.h +++ b/LEGO1/omni/include/mxentity.h @@ -15,17 +15,17 @@ class MxEntity : public MxCore { MxEntity() { this->m_mxEntityId = -1; } // FUNCTION: LEGO1 0x1000c110 - virtual ~MxEntity() override{}; + ~MxEntity() override{}; // FUNCTION: LEGO1 0x1000c180 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0070 return "MxEntity"; } // FUNCTION: LEGO1 0x1000c190 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxEntity::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxeventmanager.h b/LEGO1/omni/include/mxeventmanager.h index c21e92bc..b23a2ad0 100644 --- a/LEGO1/omni/include/mxeventmanager.h +++ b/LEGO1/omni/include/mxeventmanager.h @@ -9,9 +9,9 @@ class MxEventManager : public MxMediaManager { public: MxEventManager(); - virtual ~MxEventManager() override; + ~MxEventManager() override; - virtual void Destroy() override; // vtable+18 + void Destroy() override; // vtable+18 virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+28 // SYNTHETIC: LEGO1 0x100c03d0 diff --git a/LEGO1/omni/include/mxeventpresenter.h b/LEGO1/omni/include/mxeventpresenter.h index 06599693..1812280f 100644 --- a/LEGO1/omni/include/mxeventpresenter.h +++ b/LEGO1/omni/include/mxeventpresenter.h @@ -9,26 +9,26 @@ class MxEventPresenter : public MxMediaPresenter { public: MxEventPresenter(); - virtual ~MxEventPresenter() override; + ~MxEventPresenter() override; // FUNCTION: LEGO1 0x100c2c30 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101dcc return "MxEventPresenter"; } // FUNCTION: LEGO1 0x100c2c40 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxEventPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual MxResult PutData() override; // vtable+0x4c + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + MxResult PutData() override; // vtable+0x4c virtual void CopyData(MxStreamChunk* p_chunk); // vtable+0x5c // SYNTHETIC: LEGO1 0x100c2d20 diff --git a/LEGO1/omni/include/mxflcpresenter.h b/LEGO1/omni/include/mxflcpresenter.h index 2c4063f9..569fa06c 100644 --- a/LEGO1/omni/include/mxflcpresenter.h +++ b/LEGO1/omni/include/mxflcpresenter.h @@ -11,25 +11,25 @@ class MxFlcPresenter : public MxVideoPresenter { public: MxFlcPresenter(); - virtual ~MxFlcPresenter() override; + ~MxFlcPresenter() override; // FUNCTION: LEGO1 0x1004e200 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxFlcPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } // FUNCTION: LEGO1 0x100b33f0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f43c8 return "MxFlcPresenter"; } - virtual void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c - virtual void CreateBitmap() override; // vtable+0x60 - virtual void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 - virtual void RealizePalette() override; // vtable+0x70 + void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c + void CreateBitmap() override; // vtable+0x60 + void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 + void RealizePalette() override; // vtable+0x70 // SYNTHETIC: LEGO1 0x100b3400 // MxFlcPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxhashtable.h b/LEGO1/omni/include/mxhashtable.h index 056ff402..f2506758 100644 --- a/LEGO1/omni/include/mxhashtable.h +++ b/LEGO1/omni/include/mxhashtable.h @@ -46,7 +46,7 @@ class MxHashTable : protected MxCollection { m_resizeOption = e_noExpand; } - virtual ~MxHashTable() override; + ~MxHashTable() override; void Resize(); void Add(T); @@ -99,8 +99,9 @@ MxBool MxHashTableCursor::Find(T p_obj) MxHashTableNode* t = m_table->m_slots[bucket]; while (t) { - if (t->m_hash == hash && !m_table->Compare(t->m_obj, p_obj)) + if (t->m_hash == hash && !m_table->Compare(t->m_obj, p_obj)) { m_match = t; + } t = t->m_next; } @@ -122,8 +123,9 @@ void MxHashTableCursor::DeleteMatch() { // Cut the matching node out of the linked list // by updating pointer references. - if (m_match == NULL) + if (m_match == NULL) { return; + } if (m_match->m_prev) { m_match->m_prev->m_next = m_match->m_next; @@ -134,8 +136,9 @@ void MxHashTableCursor::DeleteMatch() m_table->m_slots[bucket] = m_match->m_next; } - if (m_match->m_next) + if (m_match->m_next) { m_match->m_next->m_prev = m_match->m_prev; + } m_table->m_customDestructor(m_match->m_obj); delete m_match; @@ -210,8 +213,9 @@ inline void MxHashTable::NodeInsert(MxHashTableNode* p_node) p_node->m_next = m_slots[bucket]; - if (m_slots[bucket]) + if (m_slots[bucket]) { m_slots[bucket]->m_prev = p_node; + } m_slots[bucket] = p_node; this->m_count++; @@ -220,8 +224,9 @@ inline void MxHashTable::NodeInsert(MxHashTableNode* p_node) template inline void MxHashTable::Add(T p_newobj) { - if (m_resizeOption && ((this->m_count + 1) / m_numSlots) > m_autoResizeRatio) + if (m_resizeOption && ((this->m_count + 1) / m_numSlots) > m_autoResizeRatio) { MxHashTable::Resize(); + } MxU32 hash = Hash(p_newobj); MxHashTableNode* node = new MxHashTableNode(p_newobj, hash); diff --git a/LEGO1/omni/include/mxioinfo.h b/LEGO1/omni/include/mxioinfo.h index 94901c4a..7fc3c343 100644 --- a/LEGO1/omni/include/mxioinfo.h +++ b/LEGO1/omni/include/mxioinfo.h @@ -9,6 +9,7 @@ #include // clang-format on +// SIZE 0x48 class MXIOINFO { public: MXIOINFO(); diff --git a/LEGO1/omni/include/mxlist.h b/LEGO1/omni/include/mxlist.h index b25c1ce2..5ad02492 100644 --- a/LEGO1/omni/include/mxlist.h +++ b/LEGO1/omni/include/mxlist.h @@ -51,7 +51,7 @@ class MxList : protected MxCollection { m_first = NULL; } - virtual ~MxList() override; + ~MxList() override; void Append(T p_obj) { InsertEntry(p_obj, this->m_last, NULL); } void Prepend(T p_obj) { InsertEntry(p_obj, NULL, this->m_first); } @@ -121,8 +121,9 @@ class MxListCursor : public MxCore { // TODO: Probably shouldn't exist void NextFragment() { - if (m_match) + if (m_match) { m_match = m_match->GetNext(); + } } private: @@ -147,13 +148,15 @@ template inline void MxList::DeleteAll(MxBool p_destroy) { for (MxListEntry* t = m_first;;) { - if (!t) + if (!t) { break; + } MxListEntry* next = t->GetNext(); - if (p_destroy) + if (p_destroy) { this->m_customDestructor(t->GetValue()); + } delete t; t = next; @@ -169,15 +172,19 @@ inline MxListEntry* MxList::InsertEntry(T p_newobj, MxListEntry* p_prev { MxListEntry* newEntry = new MxListEntry(p_newobj, p_prev, p_next); - if (p_prev) + if (p_prev) { p_prev->SetNext(newEntry); - else + } + else { this->m_first = newEntry; + } - if (p_next) + if (p_next) { p_next->SetPrev(newEntry); - else + } + else { this->m_last = newEntry; + } this->m_count++; return newEntry; @@ -186,15 +193,19 @@ inline MxListEntry* MxList::InsertEntry(T p_newobj, MxListEntry* p_prev template inline void MxList::DeleteEntry(MxListEntry* p_match) { - if (p_match->GetPrev()) + if (p_match->GetPrev()) { p_match->GetPrev()->SetNext(p_match->GetNext()); - else + } + else { m_first = p_match->GetNext(); + } - if (p_match->GetNext()) + if (p_match->GetNext()) { p_match->GetNext()->SetPrev(p_match->GetPrev()); - else + } + else { m_last = p_match->GetPrev(); + } delete p_match; this->m_count--; @@ -204,8 +215,9 @@ template inline MxBool MxListCursor::Find(T p_obj) { for (m_match = m_list->m_first; m_match && m_list->Compare(m_match->GetValue(), p_obj); - m_match = m_match->GetNext()) + m_match = m_match->GetNext()) { ; + } return m_match != NULL; } @@ -232,10 +244,12 @@ inline void MxListCursor::Destroy() template inline MxBool MxListCursor::Next() { - if (!m_match) + if (!m_match) { m_match = m_list->m_first; - else + } + else { m_match = m_match->GetNext(); + } return m_match != NULL; } @@ -243,13 +257,16 @@ inline MxBool MxListCursor::Next() template inline MxBool MxListCursor::Next(T& p_obj) { - if (!m_match) + if (!m_match) { m_match = m_list->m_first; - else + } + else { m_match = m_match->GetNext(); + } - if (m_match) + if (m_match) { p_obj = m_match->GetValue(); + } return m_match != NULL; } @@ -257,10 +274,12 @@ inline MxBool MxListCursor::Next(T& p_obj) template inline MxBool MxListCursor::Prev() { - if (!m_match) + if (!m_match) { m_match = m_list->m_last; - else + } + else { m_match = m_match->GetPrev(); + } return m_match != NULL; } @@ -268,13 +287,16 @@ inline MxBool MxListCursor::Prev() template inline MxBool MxListCursor::Prev(T& p_obj) { - if (!m_match) + if (!m_match) { m_match = m_list->m_last; - else + } + else { m_match = m_match->GetPrev(); + } - if (m_match) + if (m_match) { p_obj = m_match->GetValue(); + } return m_match != NULL; } @@ -282,8 +304,9 @@ inline MxBool MxListCursor::Prev(T& p_obj) template inline MxBool MxListCursor::Current(T& p_obj) { - if (m_match) + if (m_match) { p_obj = m_match->GetValue(); + } return m_match != NULL; } @@ -292,8 +315,9 @@ template inline MxBool MxListCursor::First(T& p_obj) { m_match = m_list->m_first; - if (m_match) + if (m_match) { p_obj = m_match->GetValue(); + } return m_match != NULL; } @@ -302,8 +326,9 @@ template inline MxBool MxListCursor::Last(T& p_obj) { m_match = m_list->m_last; - if (m_match) + if (m_match) { p_obj = m_match->GetValue(); + } return m_match != NULL; } @@ -311,15 +336,17 @@ inline MxBool MxListCursor::Last(T& p_obj) template inline void MxListCursor::SetValue(T p_obj) { - if (m_match) + if (m_match) { m_match->SetValue(p_obj); + } } template inline void MxListCursor::Prepend(T p_newobj) { - if (m_match) + if (m_match) { m_list->InsertEntry(p_newobj, m_match->GetPrev(), m_match); + } } #endif // MXLIST_H diff --git a/LEGO1/omni/include/mxloopingflcpresenter.h b/LEGO1/omni/include/mxloopingflcpresenter.h index e9cfac1a..1bc76e18 100644 --- a/LEGO1/omni/include/mxloopingflcpresenter.h +++ b/LEGO1/omni/include/mxloopingflcpresenter.h @@ -9,20 +9,20 @@ class MxLoopingFlcPresenter : public MxFlcPresenter { public: MxLoopingFlcPresenter(); - virtual ~MxLoopingFlcPresenter() override; + ~MxLoopingFlcPresenter() override; // FUNCTION: LEGO1 0x100b4380 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e20 return "MxLoopingFlcPresenter"; } - virtual void RepeatingTickle() override; // vtable+0x24 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual void NextFrame() override; // vtable+0x64 - virtual void VTable0x88(); // vtable+0x88 + void RepeatingTickle() override; // vtable+0x24 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void NextFrame() override; // vtable+0x64 + virtual void VTable0x88(); // vtable+0x88 // SYNTHETIC: LEGO1 0x100b4390 // MxLoopingFlcPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxloopingmidipresenter.h b/LEGO1/omni/include/mxloopingmidipresenter.h index 81ccab74..1a9eff73 100644 --- a/LEGO1/omni/include/mxloopingmidipresenter.h +++ b/LEGO1/omni/include/mxloopingmidipresenter.h @@ -8,21 +8,21 @@ class MxLoopingMIDIPresenter : public MxMIDIPresenter { public: // FUNCTION: LEGO1 0x100b1830 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101de0 return "MxLoopingMIDIPresenter"; } // FUNCTION: LEGO1 0x100b1840 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxLoopingMIDIPresenter::ClassName()) || MxMIDIPresenter::IsA(p_name); } - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual MxResult PutData() override; // vtable+0x4c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + MxResult PutData() override; // vtable+0x4c }; // SYNTHETIC: LEGO1 0x100b19c0 diff --git a/LEGO1/omni/include/mxloopingsmkpresenter.h b/LEGO1/omni/include/mxloopingsmkpresenter.h index 832b4263..de0f506f 100644 --- a/LEGO1/omni/include/mxloopingsmkpresenter.h +++ b/LEGO1/omni/include/mxloopingsmkpresenter.h @@ -9,21 +9,21 @@ class MxLoopingSmkPresenter : public MxSmkPresenter { public: MxLoopingSmkPresenter(); - virtual ~MxLoopingSmkPresenter() override; // vtable+0x00 + ~MxLoopingSmkPresenter() override; // vtable+0x00 // FUNCTION: LEGO1 0x100b4920 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e08 return "MxLoopingSmkPresenter"; } - virtual void RepeatingTickle() override; // vtable+0x24 - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual void NextFrame() override; // vtable+0x64 - virtual void VTable0x88() override; // vtable+0x88 - virtual void VTable0x8c(); // vtable+0x8c + void RepeatingTickle() override; // vtable+0x24 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void NextFrame() override; // vtable+0x64 + void VTable0x88() override; // vtable+0x88 + virtual void VTable0x8c(); // vtable+0x8c private: void Init(); diff --git a/LEGO1/omni/include/mxmediamanager.h b/LEGO1/omni/include/mxmediamanager.h index d531e5c7..77720bf3 100644 --- a/LEGO1/omni/include/mxmediamanager.h +++ b/LEGO1/omni/include/mxmediamanager.h @@ -12,9 +12,9 @@ class MxMediaManager : public MxCore { public: MxMediaManager(); - virtual ~MxMediaManager() override; + ~MxMediaManager() override; - virtual MxResult Tickle() override; // vtable+08 + MxResult Tickle() override; // vtable+08 virtual MxResult InitPresenters(); // vtable+14 virtual void Destroy(); // vtable+18 virtual void RegisterPresenter(MxPresenter& p_presenter); // vtable+1c diff --git a/LEGO1/omni/include/mxmediapresenter.h b/LEGO1/omni/include/mxmediapresenter.h index f73cf2bf..fba44880 100644 --- a/LEGO1/omni/include/mxmediapresenter.h +++ b/LEGO1/omni/include/mxmediapresenter.h @@ -13,34 +13,34 @@ class MxMediaPresenter : public MxPresenter { inline MxMediaPresenter() { Init(); } // FUNCTION: LEGO1 0x1000c550 - virtual ~MxMediaPresenter() override { Destroy(TRUE); } + ~MxMediaPresenter() override { Destroy(TRUE); } - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1000c5c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f074c return "MxMediaPresenter"; } // FUNCTION: LEGO1 0x1000c5d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxMediaPresenter::ClassName()) || MxPresenter::IsA(p_name); } - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void DoneTickle() override; // vtable+0x2c + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void DoneTickle() override; // vtable+0x2c // FUNCTION: LEGO1 0x1000c5b0 - virtual void Destroy() override { Destroy(FALSE); } // vtable+0x38 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 - virtual MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c - virtual void EndAction() override; // vtable+0x40 - virtual void Enable(MxBool p_enable) override; // vtable+0x54 - virtual void LoopChunk(MxStreamChunk* p_chunk); // vtable+0x58 + MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void Enable(MxBool p_enable) override; // vtable+0x54 + virtual void LoopChunk(MxStreamChunk* p_chunk); // vtable+0x58 // SYNTHETIC: LEGO1 0x1000c680 // MxMediaPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxmidipresenter.h b/LEGO1/omni/include/mxmidipresenter.h index 1abab9d1..3dabbc0e 100644 --- a/LEGO1/omni/include/mxmidipresenter.h +++ b/LEGO1/omni/include/mxmidipresenter.h @@ -9,29 +9,29 @@ class MxMIDIPresenter : public MxMusicPresenter { public: MxMIDIPresenter(); - virtual ~MxMIDIPresenter() override; + ~MxMIDIPresenter() override; // FUNCTION: LEGO1 0x100c2650 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101df8 return "MxMIDIPresenter"; } // FUNCTION: LEGO1 0x100c2660 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxMIDIPresenter::ClassName()) || MxMusicPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual void Destroy() override; // vtable+0x38 - virtual void EndAction() override; // vtable+0x40 - virtual MxResult PutData() override; // vtable+0x4c - virtual void SetVolume(MxS32 p_volume) override; // vtable+0x60 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void Destroy() override; // vtable+0x38 + void EndAction() override; // vtable+0x40 + MxResult PutData() override; // vtable+0x4c + void SetVolume(MxS32 p_volume) override; // vtable+0x60 // SYNTHETIC: LEGO1 0x100c27a0 // MxMIDIPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxmusicmanager.h b/LEGO1/omni/include/mxmusicmanager.h index 2a8b30e5..1107e7e3 100644 --- a/LEGO1/omni/include/mxmusicmanager.h +++ b/LEGO1/omni/include/mxmusicmanager.h @@ -11,10 +11,10 @@ class MxMusicManager : public MxAudioManager { public: MxMusicManager(); - virtual ~MxMusicManager() override; + ~MxMusicManager() override; - virtual void Destroy() override; // vtable+18 - virtual void SetVolume(MxS32 p_volume) override; // vtable+2c + void Destroy() override; // vtable+18 + void SetVolume(MxS32 p_volume) override; // vtable+2c virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+30 inline MxBool GetMIDIInitialized() { return m_midiInitialized; } diff --git a/LEGO1/omni/include/mxmusicpresenter.h b/LEGO1/omni/include/mxmusicpresenter.h index 7b8948cd..a66afa78 100644 --- a/LEGO1/omni/include/mxmusicpresenter.h +++ b/LEGO1/omni/include/mxmusicpresenter.h @@ -8,23 +8,23 @@ class MxMusicPresenter : public MxAudioPresenter { public: MxMusicPresenter(); - virtual ~MxMusicPresenter() override; + ~MxMusicPresenter() override; // FUNCTION: LEGO1 0x100c23a0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e48 return "MxMusicPresenter"; } // FUNCTION: LEGO1 0x100c23b0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxMusicPresenter::ClassName()) || MxAudioPresenter::IsA(p_name); } - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 // SYNTHETIC: LEGO1 0x100c24c0 // MxMusicPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxnextactiondatastart.h b/LEGO1/omni/include/mxnextactiondatastart.h index de425989..0f08ec75 100644 --- a/LEGO1/omni/include/mxnextactiondatastart.h +++ b/LEGO1/omni/include/mxnextactiondatastart.h @@ -16,14 +16,14 @@ class MxNextActionDataStart : public MxCore { } // FUNCTION: LEGO1 0x100c1900 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101025a0 return "MxNextActionDataStart"; } // FUNCTION: LEGO1 0x100c1910 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxNextActionDataStart::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxnotificationmanager.h b/LEGO1/omni/include/mxnotificationmanager.h index 829473b8..287ae40b 100644 --- a/LEGO1/omni/include/mxnotificationmanager.h +++ b/LEGO1/omni/include/mxnotificationmanager.h @@ -36,9 +36,9 @@ class MxNotificationManager : public MxCore { public: MxNotificationManager(); - virtual ~MxNotificationManager(); // vtable+0x00 (scalar deleting destructor) + ~MxNotificationManager() override; // vtable+0x00 (scalar deleting destructor) - virtual MxResult Tickle(); // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // TODO: Where does this method come from? virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x14 void Register(MxCore* p_listener); diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index 9fe01c18..d0ad675f 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -23,7 +23,7 @@ enum NotificationId { c_notificationDragStart = 13, c_notificationDrag = 14, c_notificationTimer = 15, // 100d6aa0 - c_notificationType17 = 17, + c_notificationClick = 17, c_notificationType18 = 18, // 100d7e80 c_notificationType19 = 19, // 100d6230 c_notificationType20 = 20, diff --git a/LEGO1/omni/include/mxobjectfactory.h b/LEGO1/omni/include/mxobjectfactory.h index 3f74f1c4..aed354c4 100644 --- a/LEGO1/omni/include/mxobjectfactory.h +++ b/LEGO1/omni/include/mxobjectfactory.h @@ -24,14 +24,14 @@ class MxObjectFactory : public MxCore { MxObjectFactory(); // FUNCTION: LEGO1 0x10008f70 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0730 return "MxObjectFactory"; } // FUNCTION: LEGO1 0x10008f80 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxObjectFactory::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index a2092168..7f0a0362 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -38,9 +38,9 @@ class MxOmni : public MxCore { static void SetSound3D(MxBool p_use3dSound); MxOmni(); - virtual ~MxOmni() override; + ~MxOmni() override; - virtual MxLong Notify(MxParam& p_param) override; // vtable+04 + MxLong Notify(MxParam& p_param) override; // vtable+04 virtual void Init(); // vtable+14 virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18 virtual void Destroy(); // vtable+1c diff --git a/LEGO1/omni/include/mxpalette.h b/LEGO1/omni/include/mxpalette.h index 4a1eebf0..4f38c91b 100644 --- a/LEGO1/omni/include/mxpalette.h +++ b/LEGO1/omni/include/mxpalette.h @@ -15,7 +15,7 @@ class MxPalette : public MxCore { MxPalette(); MxPalette(const RGBQUAD*); - virtual ~MxPalette(); + ~MxPalette() override; void ApplySystemEntriesToPalette(LPPALETTEENTRY p_entries); MxPalette* Clone(); diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index 3d9dd355..cd403949 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -29,19 +29,19 @@ class MxPresenter : public MxCore { MxPresenter() { Init(); } // FUNCTION: LEGO1 0x1000bf00 - virtual ~MxPresenter() override{}; // vtable+0x00 + ~MxPresenter() override{}; // vtable+0x00 - virtual MxResult Tickle() override; // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: LEGO1 0x1000bfe0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0740 return "MxPresenter"; } // FUNCTION: LEGO1 0x1000bff0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxPresenter::ClassName()) || MxCore::IsA(p_name); } @@ -121,6 +121,8 @@ class MxPresenter : public MxCore { m_compositePresenter = p_compositePresenter; } + inline void SetDisplayZ(MxS32 p_displayZ) { m_displayZ = p_displayZ; } + // SYNTHETIC: LEGO1 0x1000c070 // MxPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxpresenterlist.h b/LEGO1/omni/include/mxpresenterlist.h index dd119621..1c52f360 100644 --- a/LEGO1/omni/include/mxpresenterlist.h +++ b/LEGO1/omni/include/mxpresenterlist.h @@ -14,7 +14,7 @@ class MxPresenterList : public MxPtrList { MxPresenterList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} // FUNCTION: LEGO1 0x1001cd00 - virtual MxS8 Compare(MxPresenter* p_a, MxPresenter* p_b) override + MxS8 Compare(MxPresenter* p_a, MxPresenter* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 diff --git a/LEGO1/omni/include/mxramstreamcontroller.h b/LEGO1/omni/include/mxramstreamcontroller.h index 00e1b06d..820fc3f7 100644 --- a/LEGO1/omni/include/mxramstreamcontroller.h +++ b/LEGO1/omni/include/mxramstreamcontroller.h @@ -12,22 +12,22 @@ class MxRAMStreamController : public MxStreamController { inline MxRAMStreamController() {} // FUNCTION: LEGO1 0x100b9430 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102118 return "MxRAMStreamController"; } // FUNCTION: LEGO1 0x100b9440 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxRAMStreamController::ClassName()) || !strcmp(p_name, MxStreamController::ClassName()) || MxCore::IsA(p_name); } - virtual MxResult Open(const char* p_filename) override; - virtual MxResult VTable0x20(MxDSAction* p_action) override; - virtual MxResult VTable0x24(MxDSAction* p_action) override; + MxResult Open(const char* p_filename) override; + MxResult VTable0x20(MxDSAction* p_action) override; + MxResult VTable0x24(MxDSAction* p_action) override; private: MxDSBuffer m_buffer; // 0x64 diff --git a/LEGO1/omni/include/mxramstreamprovider.h b/LEGO1/omni/include/mxramstreamprovider.h index c994b848..08c1ea95 100644 --- a/LEGO1/omni/include/mxramstreamprovider.h +++ b/LEGO1/omni/include/mxramstreamprovider.h @@ -8,26 +8,26 @@ class MxRAMStreamProvider : public MxStreamProvider { public: MxRAMStreamProvider(); - virtual ~MxRAMStreamProvider() override; + ~MxRAMStreamProvider() override; // FUNCTION: LEGO1 0x100d0970 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102864 return "MxRAMStreamProvider"; } // FUNCTION: LEGO1 0x100d0980 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxRAMStreamProvider::ClassName()) || MxStreamProvider::IsA(p_name); } - virtual MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 - virtual MxU32 GetFileSize() override; // vtable+0x18 - virtual MxS32 GetStreamBuffersNum() override; // vtable+0x1c - virtual MxU32 GetLengthInDWords() override; // vtable+0x24 - virtual MxU32* GetBufferForDWords() override; // vtable+0x28 + MxResult SetResourceToGet(MxStreamController* p_resource) override; // vtable+0x14 + MxU32 GetFileSize() override; // vtable+0x18 + MxS32 GetStreamBuffersNum() override; // vtable+0x1c + MxU32 GetLengthInDWords() override; // vtable+0x24 + MxU32* GetBufferForDWords() override; // vtable+0x28 inline MxU8* GetBufferOfFileSize() { return m_pBufferOfFileSize; } diff --git a/LEGO1/omni/include/mxrect32.h b/LEGO1/omni/include/mxrect32.h index 20e1706e..207d93fa 100644 --- a/LEGO1/omni/include/mxrect32.h +++ b/LEGO1/omni/include/mxrect32.h @@ -65,6 +65,7 @@ class MxRect32 { } inline MxBool IsValid() const { return m_left < m_right && m_top < m_bottom; } + inline MxBool IntersectsWith(const MxRect32& p_rect) const { return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom; diff --git a/LEGO1/omni/include/mxregion.h b/LEGO1/omni/include/mxregion.h index 5659ba81..3bf639e1 100644 --- a/LEGO1/omni/include/mxregion.h +++ b/LEGO1/omni/include/mxregion.h @@ -11,7 +11,7 @@ class MxRegion : public MxCore { public: MxRegion(); - virtual ~MxRegion() override; + ~MxRegion() override; virtual void Reset(); // vtable+0x14 virtual void VTable0x18(MxRect32& p_rect); // vtable+0x18 diff --git a/LEGO1/omni/include/mxregioncursor.h b/LEGO1/omni/include/mxregioncursor.h index 5f4a24b8..e114c7ed 100644 --- a/LEGO1/omni/include/mxregioncursor.h +++ b/LEGO1/omni/include/mxregioncursor.h @@ -8,7 +8,7 @@ class MxRegionCursor : public MxCore { public: MxRegionCursor(MxRegion* p_region); - virtual ~MxRegionCursor() override; + ~MxRegionCursor() override; virtual MxRect32* VTable0x14(MxRect32& p_rect); // vtable+0x14 virtual MxRect32* VTable0x18(); // vtable+0x18 diff --git a/LEGO1/omni/include/mxsmkpresenter.h b/LEGO1/omni/include/mxsmkpresenter.h index b9dcc341..d17ce59d 100644 --- a/LEGO1/omni/include/mxsmkpresenter.h +++ b/LEGO1/omni/include/mxsmkpresenter.h @@ -10,28 +10,28 @@ class MxSmkPresenter : public MxVideoPresenter { public: MxSmkPresenter(); - virtual ~MxSmkPresenter() override; + ~MxSmkPresenter() override; // FUNCTION: LEGO1 0x100b3730 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e38 return "MxSmkPresenter"; } // FUNCTION: LEGO1 0x100b3740 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxSmkPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual MxResult AddToManager() override; // vtable+0x34 - virtual void Destroy() override; // vtable+0x38 - virtual void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c - virtual void CreateBitmap() override; // vtable+0x60 - virtual void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 - virtual void RealizePalette() override; // vtable+0x70 - virtual void VTable0x88(); // vtable+0x88 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c + void CreateBitmap() override; // vtable+0x60 + void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 + void RealizePalette() override; // vtable+0x70 + virtual void VTable0x88(); // vtable+0x88 // SYNTHETIC: LEGO1 0x100b3850 // MxSmkPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxsoundmanager.h b/LEGO1/omni/include/mxsoundmanager.h index c0bec1bb..6dde7d5c 100644 --- a/LEGO1/omni/include/mxsoundmanager.h +++ b/LEGO1/omni/include/mxsoundmanager.h @@ -12,10 +12,10 @@ class MxSoundManager : public MxAudioManager { public: MxSoundManager(); - virtual ~MxSoundManager() override; // vtable+0x00 + ~MxSoundManager() override; // vtable+0x00 - virtual void Destroy() override; // vtable+0x18 - virtual void SetVolume(MxS32 p_volume) override; // vtable+0x2c + void Destroy() override; // vtable+0x18 + void SetVolume(MxS32 p_volume) override; // vtable+0x2c virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x30 virtual void Pause(); // vtable+0x34 virtual void Resume(); // vtable+0x38 @@ -24,7 +24,7 @@ class MxSoundManager : public MxAudioManager { MxS32 FUN_100aecf0(MxU32 p_undefined); -private: +protected: void Init(); void Destroy(MxBool p_fromDestructor); MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId); diff --git a/LEGO1/omni/include/mxsoundpresenter.h b/LEGO1/omni/include/mxsoundpresenter.h index 4d1ab300..1281b2be 100644 --- a/LEGO1/omni/include/mxsoundpresenter.h +++ b/LEGO1/omni/include/mxsoundpresenter.h @@ -9,25 +9,25 @@ class MxSoundPresenter : public MxAudioPresenter { public: // FUNCTION: LEGO1 0x1000d430 - virtual ~MxSoundPresenter() override { Destroy(TRUE); } + ~MxSoundPresenter() override { Destroy(TRUE); } // FUNCTION: LEGO1 0x1000d4a0 - inline virtual const char* ClassName() const // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07a0 return "MxSoundPresenter"; } // FUNCTION: LEGO1 0x1000d4b0 - inline virtual MxBool IsA(const char* p_name) const // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxSoundPresenter::ClassName()) || MxAudioPresenter::IsA(p_name); } - virtual MxResult AddToManager() override; // vtable+0x34 + MxResult AddToManager() override; // vtable+0x34 // FUNCTION: LEGO1 0x1000d490 - virtual void Destroy() override { Destroy(FALSE); } // vtable+0x38 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 // SYNTHETIC: LEGO1 0x1000d5c0 // MxSoundPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxstillpresenter.h b/LEGO1/omni/include/mxstillpresenter.h index a559b7e5..2a64aa09 100644 --- a/LEGO1/omni/include/mxstillpresenter.h +++ b/LEGO1/omni/include/mxstillpresenter.h @@ -11,37 +11,37 @@ class MxStillPresenter : public MxVideoPresenter { MxStillPresenter() { m_bitmapInfo = NULL; } // FUNCTION: LEGO1 0x10043550 - virtual ~MxStillPresenter() override { Destroy(TRUE); } // vtable+0x00 + ~MxStillPresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: LEGO1 0x100435c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0184 return "MxStillPresenter"; } // FUNCTION: LEGO1 0x100435d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxStillPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void ParseExtra() override; // vtable+0x30 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void ParseExtra() override; // vtable+0x30 // FUNCTION: LEGO1 0x100435b0 - virtual void Destroy() override { Destroy(FALSE); } // vtable+0x38 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 - virtual void Enable(MxBool p_enable) override; // vtable+0x54 - virtual void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c - virtual void CreateBitmap() override; // vtable+0x60 - virtual void NextFrame() override; // vtable+0x64 - virtual void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 - virtual void RealizePalette() override; // vtable+0x70 - virtual void VTable0x88(MxS32 p_x, MxS32 p_y); // vtable+0x88 - virtual MxStillPresenter* Clone(); // vtable+0x8c + void Enable(MxBool p_enable) override; // vtable+0x54 + void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c + void CreateBitmap() override; // vtable+0x60 + void NextFrame() override; // vtable+0x64 + void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 + void RealizePalette() override; // vtable+0x70 + virtual void VTable0x88(MxS32 p_x, MxS32 p_y); // vtable+0x88 + virtual MxStillPresenter* Clone(); // vtable+0x8c private: void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/omni/include/mxstreamchunk.h b/LEGO1/omni/include/mxstreamchunk.h index baa5edda..00e242d0 100644 --- a/LEGO1/omni/include/mxstreamchunk.h +++ b/LEGO1/omni/include/mxstreamchunk.h @@ -12,17 +12,17 @@ class MxStreamListMxDSSubscriber; class MxStreamChunk : public MxDSChunk { public: inline MxStreamChunk() : m_buffer(NULL) {} - virtual ~MxStreamChunk() override; + ~MxStreamChunk() override; // FUNCTION: LEGO1 0x100b1fe0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10101e5c return "MxStreamChunk"; } // FUNCTION: LEGO1 0x100b1ff0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxStreamChunk::ClassName()) || MxDSChunk::IsA(p_name); } diff --git a/LEGO1/omni/include/mxstreamchunklist.h b/LEGO1/omni/include/mxstreamchunklist.h index 9d8aec0e..defdd4a0 100644 --- a/LEGO1/omni/include/mxstreamchunklist.h +++ b/LEGO1/omni/include/mxstreamchunklist.h @@ -19,7 +19,7 @@ class MxStreamChunkList : public MxList { MxStreamChunkList() { m_customDestructor = Destroy; } // FUNCTION: LEGO1 0x100b5900 - virtual MxS8 Compare(MxStreamChunk* p_a, MxStreamChunk* p_b) override + MxS8 Compare(MxStreamChunk* p_a, MxStreamChunk* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14 diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index a23c2537..f4bd328f 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -19,17 +19,17 @@ class MxDSStreamingAction; class MxStreamController : public MxCore { public: MxStreamController(); - virtual ~MxStreamController() override; // vtable+0x00 + ~MxStreamController() override; // vtable+0x00 // FUNCTION: LEGO1 0x100c0f10 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x10102130 return "MxStreamController"; } // FUNCTION: LEGO1 0x100c0f20 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxStreamController::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxstreamer.h b/LEGO1/omni/include/mxstreamer.h index 86c8956e..2308981d 100644 --- a/LEGO1/omni/include/mxstreamer.h +++ b/LEGO1/omni/include/mxstreamer.h @@ -58,7 +58,7 @@ class MxStreamerNotification : public MxNotificationParam { m_controller = p_ctrlr; } - virtual MxNotificationParam* Clone() override; + MxNotificationParam* Clone() override; MxStreamController* GetController() { return m_controller; } @@ -76,22 +76,22 @@ class MxStreamer : public MxCore { }; MxStreamer(); - virtual ~MxStreamer() override; // vtable+0x00 + ~MxStreamer() override; // vtable+0x00 MxStreamController* Open(const char* p_name, MxU16 p_openMode); MxLong Close(const char* p_name); - virtual MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 // FUNCTION: LEGO1 0x100b9000 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x1010210c return "MxStreamer"; } // FUNCTION: LEGO1 0x100b9010 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxStreamer::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxstreamlist.h b/LEGO1/omni/include/mxstreamlist.h index 08cee5bc..0e0f1e9f 100644 --- a/LEGO1/omni/include/mxstreamlist.h +++ b/LEGO1/omni/include/mxstreamlist.h @@ -11,8 +11,9 @@ class MxStreamList : public list { public: MxBool PopFront(T& p_obj) { - if (this->empty()) + if (this->empty()) { return FALSE; + } p_obj = this->front(); this->pop_front(); @@ -29,8 +30,9 @@ class MxStreamListMxDSAction : public MxStreamList { // instead of MxDSAction. Until then, we use this helper. MxBool PopFrontStreamingAction(MxDSStreamingAction*& p_obj) { - if (empty()) + if (empty()) { return FALSE; + } p_obj = (MxDSStreamingAction*) front(); pop_front(); diff --git a/LEGO1/omni/include/mxstreamprovider.h b/LEGO1/omni/include/mxstreamprovider.h index 803038e3..1082fffe 100644 --- a/LEGO1/omni/include/mxstreamprovider.h +++ b/LEGO1/omni/include/mxstreamprovider.h @@ -15,13 +15,13 @@ class MxStreamProvider : public MxCore { inline MxStreamProvider() : m_pLookup(NULL), m_pFile(NULL) {} // FUNCTION: LEGO1 0x100d07e0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { return "MxStreamProvider"; } // FUNCTION: LEGO1 0x100d07f0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxStreamProvider::ClassName()) || MxCore::IsA(p_name); } diff --git a/LEGO1/omni/include/mxstring.h b/LEGO1/omni/include/mxstring.h index 1c745845..3ad5ac4e 100644 --- a/LEGO1/omni/include/mxstring.h +++ b/LEGO1/omni/include/mxstring.h @@ -8,7 +8,7 @@ class MxString : public MxCore { public: MxString(const MxString& p_str); - virtual ~MxString(); + ~MxString() override; const MxString& operator=(const char* p_data); MxString(); diff --git a/LEGO1/omni/include/mxthread.h b/LEGO1/omni/include/mxthread.h index 5ab80041..93b14fb1 100644 --- a/LEGO1/omni/include/mxthread.h +++ b/LEGO1/omni/include/mxthread.h @@ -47,7 +47,7 @@ class MxThread { class MxTickleThread : public MxThread { public: MxTickleThread(MxCore* p_target, MxS32 p_frequencyMS); - virtual ~MxTickleThread() {} + ~MxTickleThread() override {} MxResult Run() override; diff --git a/LEGO1/omni/include/mxticklemanager.h b/LEGO1/omni/include/mxticklemanager.h index dba9b029..f07d0dc3 100644 --- a/LEGO1/omni/include/mxticklemanager.h +++ b/LEGO1/omni/include/mxticklemanager.h @@ -36,9 +36,9 @@ typedef list MxTickleClientPtrList; class MxTickleManager : public MxCore { public: inline MxTickleManager() {} - virtual ~MxTickleManager(); // vtable+0x00 (scalar deleting destructor) + ~MxTickleManager() override; // vtable+0x00 (scalar deleting destructor) - virtual MxResult Tickle(); // vtable+0x08 + MxResult Tickle() override; // vtable+0x08 virtual void RegisterClient(MxCore* p_client, MxTime p_interval); // vtable+0x14 virtual void UnregisterClient(MxCore* p_client); // vtable+0x18 virtual void SetClientTickleInterval(MxCore* p_client, MxTime p_interval); // vtable+0x1c diff --git a/LEGO1/omni/include/mxtimer.h b/LEGO1/omni/include/mxtimer.h index f9851c44..468cd602 100644 --- a/LEGO1/omni/include/mxtimer.h +++ b/LEGO1/omni/include/mxtimer.h @@ -16,10 +16,12 @@ class MxTimer : public MxCore { inline MxLong GetTime() { - if (this->m_isRunning) + if (this->m_isRunning) { return g_lastTimeTimerStarted; - else + } + else { return g_lastTimeCalculated - this->m_startTime; + } } // SYNTHETIC: LEGO1 0x100ae0d0 diff --git a/LEGO1/omni/include/mxvariabletable.h b/LEGO1/omni/include/mxvariabletable.h index 1eec195f..81059f9d 100644 --- a/LEGO1/omni/include/mxvariabletable.h +++ b/LEGO1/omni/include/mxvariabletable.h @@ -16,8 +16,8 @@ class MxVariableTable : public MxHashTable { static void Destroy(MxVariable* p_obj) { p_obj->Destroy(); } - virtual MxS8 Compare(MxVariable*, MxVariable*) override; // vtable+0x14 - virtual MxU32 Hash(MxVariable*) override; // vtable+0x18 + MxS8 Compare(MxVariable*, MxVariable*) override; // vtable+0x14 + MxU32 Hash(MxVariable*) override; // vtable+0x18 // SYNTHETIC: LEGO1 0x100afdd0 // MxVariableTable::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxvideomanager.h b/LEGO1/omni/include/mxvideomanager.h index b2719529..a915f5f5 100644 --- a/LEGO1/omni/include/mxvideomanager.h +++ b/LEGO1/omni/include/mxvideomanager.h @@ -14,10 +14,10 @@ class MxVideoManager : public MxMediaManager { public: MxVideoManager(); - virtual ~MxVideoManager() override; + ~MxVideoManager() override; - virtual MxResult Tickle() override; // vtable+0x08 - virtual void Destroy() override; // vtable+0x18 + MxResult Tickle() override; // vtable+0x08 + void Destroy() override; // vtable+0x18 virtual MxResult VTable0x28( MxVideoParam& p_videoParam, LPDIRECTDRAW p_pDirectDraw, diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 2fc3b1f4..06436163 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -13,34 +13,34 @@ class MxVideoPresenter : public MxMediaPresenter { MxVideoPresenter() { Init(); } // FUNCTION: LEGO1 0x1000c740 - virtual ~MxVideoPresenter() override { Destroy(TRUE); } // vtable+0x00 + ~MxVideoPresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: LEGO1 0x1000c820 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0760 return "MxVideoPresenter"; } // FUNCTION: LEGO1 0x1000c830 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxVideoPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void RepeatingTickle() override; // vtable+0x24 - virtual void Unk5Tickle() override; // vtable+0x28 - virtual MxResult AddToManager() override; // vtable+0x34 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void Unk5Tickle() override; // vtable+0x28 + MxResult AddToManager() override; // vtable+0x34 // FUNCTION: LEGO1 0x1000c7a0 - virtual void Destroy() override { Destroy(FALSE); } // vtable+0x38 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 - virtual void EndAction() override; // vtable+0x40 - virtual MxResult PutData() override; // vtable+0x4c - virtual MxBool IsHit(MxS32 p_x, MxS32 p_y) override; // vtable+0x50 + void EndAction() override; // vtable+0x40 + MxResult PutData() override; // vtable+0x4c + MxBool IsHit(MxS32 p_x, MxS32 p_y) override; // vtable+0x50 // FUNCTION: LEGO1 0x1000c700 virtual void LoadHeader(MxStreamChunk* p_chunk){}; // vtable+0x5c diff --git a/LEGO1/omni/include/mxwavepresenter.h b/LEGO1/omni/include/mxwavepresenter.h index 8976b458..27bd1824 100644 --- a/LEGO1/omni/include/mxwavepresenter.h +++ b/LEGO1/omni/include/mxwavepresenter.h @@ -13,38 +13,38 @@ class MxWavePresenter : public MxSoundPresenter { MxWavePresenter() { Init(); } // FUNCTION: LEGO1 0x1000d640 - virtual ~MxWavePresenter() override { Destroy(TRUE); } // vtable+0x00 + ~MxWavePresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: LEGO1 0x1000d6c0 - inline virtual const char* ClassName() const override // vtable+0x0c + inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f07b4 return "MxWavePresenter"; } // FUNCTION: LEGO1 0x1000d6d0 - inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxWavePresenter::ClassName()) || MxSoundPresenter::IsA(p_name); } - virtual void ReadyTickle() override; // vtable+0x18 - virtual void StartingTickle() override; // vtable+0x1c - virtual void StreamingTickle() override; // vtable+0x20 - virtual void DoneTickle() override; // vtable+0x2c - virtual void ParseExtra() override; // vtable+0x30 - virtual MxResult AddToManager() override; // vtable+0x34 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 // FUNCTION: LEGO1 0x1000d6a0 - virtual void Destroy() override { Destroy(FALSE); } // vtable+0x38 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 - virtual void EndAction() override; // vtable+0x40 - virtual MxResult PutData() override; // vtable+0x4c - virtual void Enable(MxBool p_enable) override; // vtable+0x54 - virtual void LoopChunk(MxStreamChunk* p_chunk) override; // vtable+0x58 - virtual void SetVolume(MxS32 p_volume) override; // vtable+0x60 - virtual void Pause(); // vtable+0x64 - virtual void Resume(); // vtable+0x68 + void EndAction() override; // vtable+0x40 + MxResult PutData() override; // vtable+0x4c + void Enable(MxBool p_enable) override; // vtable+0x54 + void LoopChunk(MxStreamChunk* p_chunk) override; // vtable+0x58 + void SetVolume(MxS32 p_volume) override; // vtable+0x60 + virtual void Pause(); // vtable+0x64 + virtual void Resume(); // vtable+0x68 // FUNCTION: LEGO1 0x1000d6b0 virtual MxBool IsPaused() { return m_paused; } // vtable+0x6c @@ -60,10 +60,9 @@ class MxWavePresenter : public MxSoundPresenter { // MxWavePresenter::`scalar deleting destructor' protected: + void Init(); void Destroy(MxBool p_fromDestructor); -private: - void Init(); MxS8 GetPlayedChunks(); MxBool FUN_100b1ba0(); void WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length); @@ -74,7 +73,7 @@ class MxWavePresenter : public MxSoundPresenter { MxU32 m_lockSize; // 0x60 MxU8 m_writtenChunks; // 0x64 MxBool m_started; // 0x65 - MxBool m_unk0x66; // 0x66 + MxBool m_is3d; // 0x66 MxS8 m_silenceData; // 0x67 MxBool m_paused; // 0x68 }; diff --git a/LEGO1/omni/src/action/mxdsaction.cpp b/LEGO1/omni/src/action/mxdsaction.cpp index cea02696..49f40561 100644 --- a/LEGO1/omni/src/action/mxdsaction.cpp +++ b/LEGO1/omni/src/action/mxdsaction.cpp @@ -108,8 +108,9 @@ MxU32 MxDSAction::GetSizeOnDisk() // FUNCTION: LEGO1 0x100adc10 MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction) { - if (this == &p_dsAction) + if (this == &p_dsAction) { return *this; + } MxDSObject::operator=(p_dsAction); this->CopyFrom(p_dsAction); @@ -121,8 +122,9 @@ MxDSAction* MxDSAction::Clone() { MxDSAction* clone = new MxDSAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -136,35 +138,47 @@ MxLong MxDSAction::GetElapsedTime() // FUNCTION: LEGO1 0x100add00 void MxDSAction::MergeFrom(MxDSAction& p_dsAction) { - if (p_dsAction.m_startTime != INT_MIN) + if (p_dsAction.m_startTime != INT_MIN) { this->m_startTime = p_dsAction.m_startTime; + } - if (p_dsAction.GetDuration() != INT_MIN) + if (p_dsAction.GetDuration() != INT_MIN) { this->m_duration = p_dsAction.GetDuration(); + } - if (p_dsAction.m_loopCount != -1) + if (p_dsAction.m_loopCount != -1) { this->m_loopCount = p_dsAction.m_loopCount; + } - if (p_dsAction.m_location[0] != FLT_MAX) + if (p_dsAction.m_location[0] != FLT_MAX) { this->m_location[0] = p_dsAction.m_location[0]; - if (p_dsAction.m_location[1] != FLT_MAX) + } + if (p_dsAction.m_location[1] != FLT_MAX) { this->m_location[1] = p_dsAction.m_location[1]; - if (p_dsAction.m_location[2] != FLT_MAX) + } + if (p_dsAction.m_location[2] != FLT_MAX) { this->m_location[2] = p_dsAction.m_location[2]; + } - if (p_dsAction.m_direction[0] != FLT_MAX) + if (p_dsAction.m_direction[0] != FLT_MAX) { this->m_direction[0] = p_dsAction.m_direction[0]; - if (p_dsAction.m_direction[1] != FLT_MAX) + } + if (p_dsAction.m_direction[1] != FLT_MAX) { this->m_direction[1] = p_dsAction.m_direction[1]; - if (p_dsAction.m_direction[2] != FLT_MAX) + } + if (p_dsAction.m_direction[2] != FLT_MAX) { this->m_direction[2] = p_dsAction.m_up[2]; // This is correct + } - if (p_dsAction.m_up[0] != FLT_MAX) + if (p_dsAction.m_up[0] != FLT_MAX) { this->m_up[0] = p_dsAction.m_up[0]; - if (p_dsAction.m_up[1] != FLT_MAX) + } + if (p_dsAction.m_up[1] != FLT_MAX) { this->m_up[1] = p_dsAction.m_up[1]; - if (p_dsAction.m_up[2] != FLT_MAX) + } + if (p_dsAction.m_up[2] != FLT_MAX) { this->m_up[2] = p_dsAction.m_up[2]; + } MxU16 extraLength = p_dsAction.m_extraLength; char* extraData = p_dsAction.m_extraData; @@ -185,8 +199,9 @@ void MxDSAction::MergeFrom(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x100ade60 void MxDSAction::AppendData(MxU16 p_extraLength, const char* p_extraData) { - if (this->m_extraData == p_extraData || !p_extraData) + if (this->m_extraData == p_extraData || !p_extraData) { return; + } if (this->m_extraLength) { char* concat = new char[p_extraLength + this->m_extraLength + sizeof(g_sep)]; diff --git a/LEGO1/omni/src/action/mxdsanim.cpp b/LEGO1/omni/src/action/mxdsanim.cpp index cef2321c..c90933b1 100644 --- a/LEGO1/omni/src/action/mxdsanim.cpp +++ b/LEGO1/omni/src/action/mxdsanim.cpp @@ -21,8 +21,9 @@ void MxDSAnim::CopyFrom(MxDSAnim& p_dsAnim) // FUNCTION: LEGO1 0x100c9200 MxDSAnim& MxDSAnim::operator=(MxDSAnim& p_dsAnim) { - if (this == &p_dsAnim) + if (this == &p_dsAnim) { return *this; + } MxDSMediaAction::operator=(p_dsAnim); this->CopyFrom(p_dsAnim); @@ -34,8 +35,9 @@ MxDSAction* MxDSAnim::Clone() { MxDSAnim* clone = new MxDSAnim(); - if (clone) + if (clone) { *clone = *this; + } return clone; } diff --git a/LEGO1/omni/src/action/mxdsevent.cpp b/LEGO1/omni/src/action/mxdsevent.cpp index bc925369..64702e65 100644 --- a/LEGO1/omni/src/action/mxdsevent.cpp +++ b/LEGO1/omni/src/action/mxdsevent.cpp @@ -21,8 +21,9 @@ void MxDSEvent::CopyFrom(MxDSEvent& p_dsEvent) // FUNCTION: LEGO1 0x100c9800 MxDSEvent& MxDSEvent::operator=(MxDSEvent& p_dsEvent) { - if (this == &p_dsEvent) + if (this == &p_dsEvent) { return *this; + } MxDSMediaAction::operator=(p_dsEvent); this->CopyFrom(p_dsEvent); @@ -34,8 +35,9 @@ MxDSAction* MxDSEvent::Clone() { MxDSEvent* clone = new MxDSEvent(); - if (clone) + if (clone) { *clone = *this; + } return clone; } diff --git a/LEGO1/omni/src/action/mxdsmediaaction.cpp b/LEGO1/omni/src/action/mxdsmediaaction.cpp index fda2721a..c563b380 100644 --- a/LEGO1/omni/src/action/mxdsmediaaction.cpp +++ b/LEGO1/omni/src/action/mxdsmediaaction.cpp @@ -39,8 +39,9 @@ void MxDSMediaAction::CopyFrom(MxDSMediaAction& p_dsMediaAction) // FUNCTION: LEGO1 0x100c8dc0 MxDSMediaAction& MxDSMediaAction::operator=(MxDSMediaAction& p_dsMediaAction) { - if (this == &p_dsMediaAction) + if (this == &p_dsMediaAction) { return *this; + } MxDSAction::operator=(p_dsMediaAction); this->CopyFrom(p_dsMediaAction); @@ -52,8 +53,9 @@ MxDSAction* MxDSMediaAction::Clone() { MxDSMediaAction* clone = new MxDSMediaAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -61,18 +63,21 @@ MxDSAction* MxDSMediaAction::Clone() // FUNCTION: LEGO1 0x100c8e80 void MxDSMediaAction::CopyMediaSrcPath(const char* p_mediaSrcPath) { - if (this->m_mediaSrcPath == p_mediaSrcPath) + if (this->m_mediaSrcPath == p_mediaSrcPath) { return; + } delete[] this->m_mediaSrcPath; if (p_mediaSrcPath) { this->m_mediaSrcPath = new char[strlen(p_mediaSrcPath) + 1]; - if (this->m_mediaSrcPath) + if (this->m_mediaSrcPath) { strcpy(this->m_mediaSrcPath, p_mediaSrcPath); + } } - else + else { this->m_mediaSrcPath = NULL; + } } // FUNCTION: LEGO1 0x100c8f00 @@ -86,10 +91,12 @@ MxU32 MxDSMediaAction::GetSizeOnDisk() { MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk(); - if (this->m_mediaSrcPath) + if (this->m_mediaSrcPath) { totalSizeOnDisk += strlen(this->m_mediaSrcPath) + 1; - else + } + else { totalSizeOnDisk++; + } totalSizeOnDisk += 24; this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk(); diff --git a/LEGO1/omni/src/action/mxdsmultiaction.cpp b/LEGO1/omni/src/action/mxdsmultiaction.cpp index 64e20a55..40216ae7 100644 --- a/LEGO1/omni/src/action/mxdsmultiaction.cpp +++ b/LEGO1/omni/src/action/mxdsmultiaction.cpp @@ -15,8 +15,9 @@ MxDSMultiAction::MxDSMultiAction() // FUNCTION: LEGO1 0x100ca060 MxDSMultiAction::~MxDSMultiAction() { - if (this->m_actions) + if (this->m_actions) { delete this->m_actions; + } } // FUNCTION: LEGO1 0x100ca0d0 @@ -26,15 +27,17 @@ void MxDSMultiAction::CopyFrom(MxDSMultiAction& p_dsMultiAction) MxDSActionListCursor cursor(p_dsMultiAction.m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { this->m_actions->Append(action->Clone()); + } } // FUNCTION: LEGO1 0x100ca260 MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction) { - if (this == &p_dsMultiAction) + if (this == &p_dsMultiAction) { return *this; + } MxDSAction::operator=(p_dsMultiAction); this->CopyFrom(p_dsMultiAction); @@ -48,8 +51,9 @@ void MxDSMultiAction::SetUnknown90(MxLong p_unk0x90) MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { action->SetUnknown90(p_unk0x90); + } } // FUNCTION: LEGO1 0x100ca370 @@ -59,21 +63,24 @@ void MxDSMultiAction::MergeFrom(MxDSAction& p_dsMultiAction) MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { action->MergeFrom(p_dsMultiAction); + } } // FUNCTION: LEGO1 0x100ca450 MxBool MxDSMultiAction::HasId(MxU32 p_objectId) { - if (this->GetObjectId() == p_objectId) + if (this->GetObjectId() == p_objectId) { return TRUE; + } MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; while (cursor.Next(action)) { - if (action->HasId(p_objectId)) + if (action->HasId(p_objectId)) { return TRUE; + } } return FALSE; @@ -84,8 +91,9 @@ MxDSAction* MxDSMultiAction::Clone() { MxDSMultiAction* clone = new MxDSMultiAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -97,8 +105,9 @@ undefined4 MxDSMultiAction::VTable0x14() MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { result += action->VTable0x14(); + } return result; } @@ -110,8 +119,9 @@ MxU32 MxDSMultiAction::GetSizeOnDisk() MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { totalSizeOnDisk += action->GetSizeOnDisk(); + } this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk(); @@ -151,6 +161,7 @@ void MxDSMultiAction::SetAtomId(MxAtomId p_atomId) MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; - while (cursor.Next(action)) + while (cursor.Next(action)) { action->SetAtomId(p_atomId); + } } diff --git a/LEGO1/omni/src/action/mxdsobject.cpp b/LEGO1/omni/src/action/mxdsobject.cpp index 6d11476d..9bbdf195 100644 --- a/LEGO1/omni/src/action/mxdsobject.cpp +++ b/LEGO1/omni/src/action/mxdsobject.cpp @@ -52,8 +52,9 @@ void MxDSObject::CopyFrom(MxDSObject& p_dsObject) // FUNCTION: LEGO1 0x100bf8c0 MxDSObject& MxDSObject::operator=(MxDSObject& p_dsObject) { - if (this == &p_dsObject) + if (this == &p_dsObject) { return *this; + } this->CopyFrom(p_dsObject); return *this; @@ -108,17 +109,21 @@ MxU32 MxDSObject::GetSizeOnDisk() { MxU32 sizeOnDisk; - if (this->m_sourceName) + if (this->m_sourceName) { sizeOnDisk = strlen(this->m_sourceName) + 3; - else + } + else { sizeOnDisk = 3; + } sizeOnDisk += 4; - if (this->m_objectName) + if (this->m_objectName) { sizeOnDisk += strlen(this->m_objectName) + 1; - else + } + else { sizeOnDisk++; + } sizeOnDisk += 4; this->m_sizeOnDisk = sizeOnDisk; diff --git a/LEGO1/omni/src/action/mxdsobjectaction.cpp b/LEGO1/omni/src/action/mxdsobjectaction.cpp index db8b149f..40eadec3 100644 --- a/LEGO1/omni/src/action/mxdsobjectaction.cpp +++ b/LEGO1/omni/src/action/mxdsobjectaction.cpp @@ -21,8 +21,9 @@ void MxDSObjectAction::CopyFrom(MxDSObjectAction& p_dsObjectAction) // FUNCTION: LEGO1 0x100c8a80 MxDSObjectAction& MxDSObjectAction::operator=(MxDSObjectAction& p_dsObjectAction) { - if (this == &p_dsObjectAction) + if (this == &p_dsObjectAction) { return *this; + } MxDSMediaAction::operator=(p_dsObjectAction); this->CopyFrom(p_dsObjectAction); @@ -34,8 +35,9 @@ MxDSAction* MxDSObjectAction::Clone() { MxDSObjectAction* clone = new MxDSObjectAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } diff --git a/LEGO1/omni/src/action/mxdsparallelaction.cpp b/LEGO1/omni/src/action/mxdsparallelaction.cpp index a14a326f..f4e61245 100644 --- a/LEGO1/omni/src/action/mxdsparallelaction.cpp +++ b/LEGO1/omni/src/action/mxdsparallelaction.cpp @@ -23,8 +23,9 @@ void MxDSParallelAction::CopyFrom(MxDSParallelAction& p_dsParallelAction) // FUNCTION: LEGO1 0x100cb0a0 MxDSParallelAction& MxDSParallelAction::operator=(MxDSParallelAction& p_dsParallelAction) { - if (this == &p_dsParallelAction) + if (this == &p_dsParallelAction) { return *this; + } MxDSMultiAction::operator=(p_dsParallelAction); this->CopyFrom(p_dsParallelAction); @@ -36,8 +37,9 @@ MxDSAction* MxDSParallelAction::Clone() { MxDSParallelAction* clone = new MxDSParallelAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -45,15 +47,17 @@ MxDSAction* MxDSParallelAction::Clone() // FUNCTION: LEGO1 0x100cb160 MxLong MxDSParallelAction::GetDuration() { - if (this->m_duration) + if (this->m_duration) { return this->m_duration; + } MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; while (cursor.Next(action)) { - if (!action) + if (!action) { continue; + } MxLong duration = action->GetDuration(); if (duration == -1) { @@ -65,10 +69,12 @@ MxLong MxDSParallelAction::GetDuration() if (action->IsA("MxDSMediaAction")) { MxLong sustainTime = ((MxDSMediaAction*) action)->GetSustainTime(); - if (sustainTime == -1) + if (sustainTime == -1) { duration = -1; - else if (sustainTime) + } + else if (sustainTime) { duration += sustainTime; + } } if (duration == -1) { @@ -76,12 +82,14 @@ MxLong MxDSParallelAction::GetDuration() break; } - if (this->m_duration < duration) + if (this->m_duration < duration) { this->m_duration = duration; + } } - if (this->IsBit3()) + if (this->IsBit3()) { this->m_duration *= this->m_loopCount; + } return this->m_duration; } diff --git a/LEGO1/omni/src/action/mxdsselectaction.cpp b/LEGO1/omni/src/action/mxdsselectaction.cpp index ddadde84..97e9ff73 100644 --- a/LEGO1/omni/src/action/mxdsselectaction.cpp +++ b/LEGO1/omni/src/action/mxdsselectaction.cpp @@ -19,8 +19,9 @@ MxDSSelectAction::MxDSSelectAction() // FUNCTION: LEGO1 0x100cb8d0 MxDSSelectAction::~MxDSSelectAction() { - if (this->m_unk0xac) + if (this->m_unk0xac) { delete this->m_unk0xac; + } } // FUNCTION: LEGO1 0x100cb950 @@ -32,8 +33,9 @@ void MxDSSelectAction::CopyFrom(MxDSSelectAction& p_dsSelectAction) MxStringListCursor cursor(p_dsSelectAction.m_unk0xac); MxString string; - while (cursor.Next(string)) + while (cursor.Next(string)) { this->m_unk0xac->Append(string); + } } // FUNCTION: LEGO1 0x100cbd50 @@ -51,8 +53,9 @@ MxDSAction* MxDSSelectAction::Clone() { MxDSSelectAction* clone = new MxDSSelectAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -66,8 +69,9 @@ MxU32 MxDSSelectAction::GetSizeOnDisk() MxStringListCursor cursor(this->m_unk0xac); MxString string; - while (cursor.Next(string)) + while (cursor.Next(string)) { totalSizeOnDisk += strlen(string.GetData()) + 1; + } // Note: unlike the other classes, MxDSSelectAction does not have its own // sizeOnDisk member. Instead, it overrides the one from MxDSMultiAction. @@ -95,8 +99,9 @@ void MxDSSelectAction::Deserialize(MxU8** p_source, MxS16 p_unk0x24) MxS32 random = rand() % value; string = itoa((MxS16) random, buffer, 10); } - else + else { string = VariableTable()->GetVariable((char*) *p_source); + } *p_source += strlen((char*) *p_source) + 1; @@ -109,8 +114,9 @@ void MxDSSelectAction::Deserialize(MxU8** p_source, MxS16 p_unk0x24) MxU32 i; for (i = 0; i < count; i++) { - if (!strcmp(string.GetData(), (char*) *p_source)) + if (!strcmp(string.GetData(), (char*) *p_source)) { index = i; + } this->m_unk0xac->Append((char*) *p_source); *p_source += strlen((char*) *p_source) + 1; @@ -122,10 +128,12 @@ void MxDSSelectAction::Deserialize(MxU8** p_source, MxS16 p_unk0x24) MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24); - if (index == i) + if (index == i) { this->m_actions->Append(action); - else + } + else { delete action; + } *p_source += extraFlag; } diff --git a/LEGO1/omni/src/action/mxdsserialaction.cpp b/LEGO1/omni/src/action/mxdsserialaction.cpp index 24513f48..b03efdf0 100644 --- a/LEGO1/omni/src/action/mxdsserialaction.cpp +++ b/LEGO1/omni/src/action/mxdsserialaction.cpp @@ -21,8 +21,9 @@ void MxDSSerialAction::SetDuration(MxLong p_duration) // FUNCTION: LEGO1 0x100cac10 MxDSSerialAction::~MxDSSerialAction() { - if (this->m_cursor) + if (this->m_cursor) { delete this->m_cursor; + } this->m_cursor = NULL; } @@ -35,8 +36,9 @@ void MxDSSerialAction::CopyFrom(MxDSSerialAction& p_dsSerialAction) // FUNCTION: LEGO1 0x100caca0 MxDSSerialAction& MxDSSerialAction::operator=(MxDSSerialAction& p_dsSerialAction) { - if (this == &p_dsSerialAction) + if (this == &p_dsSerialAction) { return *this; + } MxDSMultiAction::operator=(p_dsSerialAction); this->CopyFrom(p_dsSerialAction); @@ -48,8 +50,9 @@ MxDSAction* MxDSSerialAction::Clone() { MxDSSerialAction* clone = new MxDSSerialAction(); - if (clone) + if (clone) { *clone = *this; + } return clone; } @@ -57,23 +60,26 @@ MxDSAction* MxDSSerialAction::Clone() // FUNCTION: LEGO1 0x100cad60 MxLong MxDSSerialAction::GetDuration() { - if (this->m_duration) + if (this->m_duration) { return this->m_duration; + } MxDSActionListCursor cursor(this->m_actions); MxDSAction* action; while (cursor.Next(action)) { - if (!action) + if (!action) { continue; + } this->m_duration += action->GetDuration() + action->GetStartTime(); if (action->IsA("MxDSMediaAction")) { MxLong sustainTime = ((MxDSMediaAction*) action)->GetSustainTime(); - if (sustainTime && sustainTime != -1) + if (sustainTime && sustainTime != -1) { this->m_duration += sustainTime; + } } } diff --git a/LEGO1/omni/src/action/mxdssound.cpp b/LEGO1/omni/src/action/mxdssound.cpp index 61022cab..e75ad0c9 100644 --- a/LEGO1/omni/src/action/mxdssound.cpp +++ b/LEGO1/omni/src/action/mxdssound.cpp @@ -26,8 +26,9 @@ void MxDSSound::CopyFrom(MxDSSound& p_dsSound) // FUNCTION: LEGO1 0x100c94e0 MxDSSound& MxDSSound::operator=(MxDSSound& p_dsSound) { - if (this == &p_dsSound) + if (this == &p_dsSound) { return *this; + } MxDSMediaAction::operator=(p_dsSound); this->CopyFrom(p_dsSound); @@ -39,8 +40,9 @@ MxDSAction* MxDSSound::Clone() { MxDSSound* clone = new MxDSSound(); - if (clone) + if (clone) { *clone = *this; + } return clone; } diff --git a/LEGO1/omni/src/action/mxdsstill.cpp b/LEGO1/omni/src/action/mxdsstill.cpp index 59a78ffc..c044a2e6 100644 --- a/LEGO1/omni/src/action/mxdsstill.cpp +++ b/LEGO1/omni/src/action/mxdsstill.cpp @@ -21,8 +21,9 @@ void MxDSStill::CopyFrom(MxDSStill& p_dsStill) // FUNCTION: LEGO1 0x100c9ad0 MxDSStill& MxDSStill::operator=(MxDSStill& p_dsStill) { - if (this == &p_dsStill) + if (this == &p_dsStill) { return *this; + } MxDSMediaAction::operator=(p_dsStill); this->CopyFrom(p_dsStill); @@ -34,8 +35,9 @@ MxDSAction* MxDSStill::Clone() { MxDSStill* clone = new MxDSStill(); - if (clone) + if (clone) { *clone = *this; + } return clone; } diff --git a/LEGO1/omni/src/action/mxdsstreamingaction.cpp b/LEGO1/omni/src/action/mxdsstreamingaction.cpp index e8eb4dc1..85759897 100644 --- a/LEGO1/omni/src/action/mxdsstreamingaction.cpp +++ b/LEGO1/omni/src/action/mxdsstreamingaction.cpp @@ -17,8 +17,9 @@ MxDSStreamingAction::MxDSStreamingAction(MxDSAction& p_dsAction, MxU32 p_offset) // FUNCTION: LEGO1 0x100cd090 MxBool MxDSStreamingAction::HasId(MxU32 p_objectId) { - if (this->m_internalAction) + if (this->m_internalAction) { return this->m_internalAction->HasId(p_objectId); + } return FALSE; } @@ -32,12 +33,15 @@ MxDSStreamingAction::MxDSStreamingAction(MxDSStreamingAction& p_dsStreamingActio // FUNCTION: LEGO1 0x100cd150 MxDSStreamingAction::~MxDSStreamingAction() { - if (this->m_unk0xa0) + if (this->m_unk0xa0) { delete this->m_unk0xa0; - if (this->m_unk0xa4) + } + if (this->m_unk0xa4) { delete this->m_unk0xa4; - if (this->m_internalAction) + } + if (this->m_internalAction) { delete this->m_internalAction; + } } // FUNCTION: LEGO1 0x100cd1e0 @@ -73,16 +77,18 @@ MxDSStreamingAction* MxDSStreamingAction::CopyFrom(MxDSStreamingAction& p_dsStre // FUNCTION: LEGO1 0x100cd2a0 void MxDSStreamingAction::SetInternalAction(MxDSAction* p_dsAction) { - if (this->m_internalAction) + if (this->m_internalAction) { delete this->m_internalAction; + } this->m_internalAction = p_dsAction; } // FUNCTION: LEGO1 0x100cd2d0 void MxDSStreamingAction::FUN_100cd2d0() { - if (this->m_duration == -1) + if (this->m_duration == -1) { return; + } MxLong duration = this->m_duration / this->m_loopCount; this->m_loopCount--; diff --git a/LEGO1/omni/src/audio/mxaudiomanager.cpp b/LEGO1/omni/src/audio/mxaudiomanager.cpp index a2d6072a..0be79a24 100644 --- a/LEGO1/omni/src/audio/mxaudiomanager.cpp +++ b/LEGO1/omni/src/audio/mxaudiomanager.cpp @@ -31,8 +31,9 @@ void MxAudioManager::Destroy(MxBool p_fromDestructor) Init(); this->m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaManager::Destroy(); + } } // FUNCTION: LEGO1 0x100b8e40 @@ -48,11 +49,13 @@ MxResult MxAudioManager::InitPresenters() g_count++; } - if (result) + if (result) { Destroy(); + } - if (success) + if (success) { this->m_criticalSection.Leave(); + } return result; } diff --git a/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp b/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp index 77b32506..c7f4ea1c 100644 --- a/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp +++ b/LEGO1/omni/src/audio/mxloopingmidipresenter.cpp @@ -20,17 +20,20 @@ void MxLoopingMIDIPresenter::StreamingTickle() return; } - if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) + if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) { ProgressTickleState(e_done); + } } // FUNCTION: LEGO1 0x100c2ae0 void MxLoopingMIDIPresenter::DoneTickle() { - if (m_action->GetLoopCount()) + if (m_action->GetLoopCount()) { MxMIDIPresenter::DoneTickle(); - else + } + else { EndAction(); + } } // FUNCTION: LEGO1 0x100c2b00 diff --git a/LEGO1/omni/src/audio/mxmidipresenter.cpp b/LEGO1/omni/src/audio/mxmidipresenter.cpp index 5796fb67..b281ac64 100644 --- a/LEGO1/omni/src/audio/mxmidipresenter.cpp +++ b/LEGO1/omni/src/audio/mxmidipresenter.cpp @@ -34,14 +34,16 @@ void MxMIDIPresenter::Destroy(MxBool p_fromDestructor) m_criticalSection.Enter(); - if (m_subscriber && m_chunk) + if (m_subscriber && m_chunk) { m_subscriber->DestroyChunk(m_chunk); + } Init(); m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMusicPresenter::Destroy(); + } } // FUNCTION: LEGO1 0x100c2890 @@ -61,24 +63,28 @@ void MxMIDIPresenter::StartingTickle() { MxStreamChunk* chunk = CurrentChunk(); - if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) + if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { ProgressTickleState(e_streaming); + } } // FUNCTION: LEGO1 0x100c2910 void MxMIDIPresenter::StreamingTickle() { - if (m_chunk) + if (m_chunk) { ProgressTickleState(e_done); - else + } + else { m_chunk = NextChunk(); + } } // FUNCTION: LEGO1 0x100c2940 void MxMIDIPresenter::DoneTickle() { - if (!MusicManager()->GetMIDIInitialized()) + if (!MusicManager()->GetMIDIInitialized()) { EndAction(); + } } // FUNCTION: LEGO1 0x100c2960 @@ -95,8 +101,9 @@ MxResult MxMIDIPresenter::PutData() if (m_currentTickleState == e_streaming && m_chunk && !MusicManager()->GetMIDIInitialized()) { SetVolume(((MxDSSound*) m_action)->GetVolume()); - if (MusicManager()->InitializeMIDI(m_chunk->GetData(), 1) != SUCCESS) + if (MusicManager()->InitializeMIDI(m_chunk->GetData(), 1) != SUCCESS) { EndAction(); + } } m_criticalSection.Leave(); diff --git a/LEGO1/omni/src/audio/mxmusicmanager.cpp b/LEGO1/omni/src/audio/mxmusicmanager.cpp index 7a0684f8..23562678 100644 --- a/LEGO1/omni/src/audio/mxmusicmanager.cpp +++ b/LEGO1/omni/src/audio/mxmusicmanager.cpp @@ -82,8 +82,9 @@ MxResult MxMusicManager::ResetStream() } if (m_midiHdrP->dwFlags & MHDR_DONE || m_midiHdrP->dwFlags & MHDR_PREPARED) { - if (midiOutUnprepareHeader((HMIDIOUT) m_midiStreamH, m_midiHdrP, sizeof(MIDIHDR)) != MMSYSERR_NOERROR) + if (midiOutUnprepareHeader((HMIDIOUT) m_midiStreamH, m_midiHdrP, sizeof(MIDIHDR)) != MMSYSERR_NOERROR) { goto done; + } memset(m_midiHdrP, 0, sizeof(MIDIHDR)); } @@ -131,8 +132,9 @@ void MxMusicManager::SetMIDIVolume() // FUNCTION: LEGO1 0x100c0820 void CALLBACK MxMusicManager::MidiCallbackProc(HDRVR p_hdrvr, UINT p_uMsg, DWORD p_dwUser, DWORD p_dw1, DWORD p_dw2) { - if (p_uMsg == MOM_DONE) + if (p_uMsg == MOM_DONE) { ((MxMusicManager*) p_dwUser)->ResetStream(); + } } // FUNCTION: LEGO1 0x100c0840 @@ -147,21 +149,25 @@ MxResult MxMusicManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) locked = TRUE; m_thread = new MxTickleThread(this, p_frequencyMS); - if (!m_thread || m_thread->Start(0, 0) != SUCCESS) + if (!m_thread || m_thread->Start(0, 0) != SUCCESS) { goto done; + } } - else + else { TickleManager()->RegisterClient(this, p_frequencyMS); + } status = SUCCESS; } done: - if (status != SUCCESS) + if (status != SUCCESS) { Destroy(); + } - if (locked) + if (locked) { m_criticalSection.Leave(); + } return status; } @@ -211,22 +217,26 @@ MxResult MxMusicManager::InitializeMIDI(MxU8* p_data, MxS32 p_loopCount) for (; device < total; device++) { MIDIOUTCAPSA caps; midiOutGetDevCapsA(device, &caps, sizeof(MIDIOUTCAPSA)); - if (caps.wTechnology == MOD_FMSYNTH) + if (caps.wTechnology == MOD_FMSYNTH) { break; + } } - if (device >= total) + if (device >= total) { device = -1; + } if (midiStreamOpen(&m_midiStreamH, &device, 1, (DWORD) MidiCallbackProc, (DWORD) this, CALLBACK_FUNCTION) != - MMSYSERR_NOERROR) + MMSYSERR_NOERROR) { goto done; + } GetMIDIVolume(m_midiVolume); m_midiHdrP = new MIDIHDR(); - if (!m_midiHdrP) + if (!m_midiHdrP) { goto done; + } memset(m_midiHdrP, 0, sizeof(MIDIHDR)); @@ -236,8 +246,9 @@ MxResult MxMusicManager::InitializeMIDI(MxU8* p_data, MxS32 p_loopCount) m_bufferOffset += 0x14; timediv.dwTimeDiv = *((DWORD*) m_bufferOffset); - if (midiStreamProperty(m_midiStreamH, (LPBYTE) &timediv, MIDIPROP_SET | MIDIPROP_TIMEDIV) != MMSYSERR_NOERROR) + if (midiStreamProperty(m_midiStreamH, (LPBYTE) &timediv, MIDIPROP_SET | MIDIPROP_TIMEDIV) != MMSYSERR_NOERROR) { goto done; + } m_bufferOffset += 0x14; m_bufferSize = *((MxU32*) m_bufferOffset); @@ -246,12 +257,14 @@ MxResult MxMusicManager::InitializeMIDI(MxU8* p_data, MxS32 p_loopCount) m_midiInitialized = TRUE; ResetBuffer(); - if (ResetStream() != SUCCESS) + if (ResetStream() != SUCCESS) { goto done; + } SetMIDIVolume(); - if (midiStreamRestart(m_midiStreamH) != MMSYSERR_NOERROR) + if (midiStreamRestart(m_midiStreamH) != MMSYSERR_NOERROR) { goto done; + } result = SUCCESS; } diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index b06c5e37..55055107 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -59,46 +59,55 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) MxResult status = FAILURE; MxBool locked = FALSE; - if (MxAudioManager::InitPresenters() != SUCCESS) + if (MxAudioManager::InitPresenters() != SUCCESS) { goto done; + } m_criticalSection.Enter(); locked = TRUE; - if (DirectSoundCreate(NULL, &m_directSound, NULL) != DS_OK) + if (DirectSoundCreate(NULL, &m_directSound, NULL) != DS_OK) { goto done; + } - if (m_directSound->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DSSCL_PRIORITY) != DS_OK) + if (m_directSound->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DSSCL_PRIORITY) != DS_OK) { goto done; + } DSBUFFERDESC desc; memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); - if (MxOmni::IsSound3D()) + if (MxOmni::IsSound3D()) { desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D; - else + } + else { desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME; + } if (m_directSound->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) { - if (!MxOmni::IsSound3D()) + if (!MxOmni::IsSound3D()) { goto done; + } MxOmni::SetSound3D(FALSE); desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME; - if (m_directSound->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) + if (m_directSound->CreateSoundBuffer(&desc, &m_dsBuffer, NULL) != DS_OK) { goto done; + } } WAVEFORMATEX format; format.wFormatTag = WAVE_FORMAT_PCM; - if (MxOmni::IsSound3D()) + if (MxOmni::IsSound3D()) { format.nChannels = 2; - else + } + else { format.nChannels = 1; + } format.nSamplesPerSec = 11025; // KHz format.wBitsPerSample = 16; @@ -111,20 +120,24 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) if (p_createThread) { m_thread = new MxTickleThread(this, p_frequencyMS); - if (!m_thread || m_thread->Start(0, 0) != SUCCESS) + if (!m_thread || m_thread->Start(0, 0) != SUCCESS) { goto done; + } } - else + else { TickleManager()->RegisterClient(this, p_frequencyMS); + } status = SUCCESS; done: - if (status != SUCCESS) + if (status != SUCCESS) { Destroy(); + } - if (locked) + if (locked) { m_criticalSection.Leave(); + } return status; } @@ -144,8 +157,9 @@ void MxSoundManager::SetVolume(MxS32 p_volume) MxPresenter* presenter; MxPresenterListCursor cursor(m_presenters); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { ((MxAudioPresenter*) presenter)->SetVolume(((MxAudioPresenter*) presenter)->GetVolume()); + } m_criticalSection.Leave(); } @@ -160,8 +174,9 @@ MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_obje while (cursor.Next(presenter)) { if (presenter->GetAction()->GetAtomId().GetInternal() == p_atomId.GetInternal() && - presenter->GetAction()->GetObjectId() == p_objectId) + presenter->GetAction()->GetObjectId() == p_objectId) { return presenter; + } } return NULL; @@ -170,8 +185,9 @@ MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_obje // FUNCTION: LEGO1 0x100aecf0 MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_undefined) { - if (!p_undefined) + if (!p_undefined) { return -10000; + } return g_mxcoreCount[p_undefined]; } @@ -183,9 +199,11 @@ void MxSoundManager::Pause() MxPresenter* presenter; MxPresenterListCursor cursor(m_presenters); - while (cursor.Next(presenter)) - if (presenter->IsA("MxWavePresenter")) + while (cursor.Next(presenter)) { + if (presenter->IsA("MxWavePresenter")) { ((MxWavePresenter*) presenter)->Pause(); + } + } } // FUNCTION: LEGO1 0x100aee10 @@ -196,7 +214,9 @@ void MxSoundManager::Resume() MxPresenter* presenter; MxPresenterListCursor cursor(m_presenters); - while (cursor.Next(presenter)) - if (presenter->IsA("MxWavePresenter")) + while (cursor.Next(presenter)) { + if (presenter->IsA("MxWavePresenter")) { ((MxWavePresenter*) presenter)->Resume(); + } + } } diff --git a/LEGO1/omni/src/audio/mxsoundpresenter.cpp b/LEGO1/omni/src/audio/mxsoundpresenter.cpp index b0376331..60459d2c 100644 --- a/LEGO1/omni/src/audio/mxsoundpresenter.cpp +++ b/LEGO1/omni/src/audio/mxsoundpresenter.cpp @@ -8,15 +8,17 @@ DECOMP_SIZE_ASSERT(MxSoundPresenter, 0x54) // FUNCTION: LEGO1 0x100b1a50 void MxSoundPresenter::Destroy(MxBool p_fromDestructor) { - if (MSoundManager()) + if (MSoundManager()) { MSoundManager()->UnregisterPresenter(*this); + } this->m_criticalSection.Enter(); MxMediaPresenter::Init(); this->m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x100b1aa0 diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index c0aaca7c..853441a7 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -20,7 +20,7 @@ void MxWavePresenter::Init() m_lockSize = 0; m_writtenChunks = 0; m_started = FALSE; - m_unk0x66 = FALSE; + m_is3d = FALSE; m_paused = FALSE; } @@ -40,13 +40,15 @@ void MxWavePresenter::Destroy(MxBool p_fromDestructor) m_dsBuffer->Release(); } - if (m_waveFormat) + if (m_waveFormat) { delete[] ((MxU8*) m_waveFormat); + } Init(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxSoundPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x100b1b60 @@ -55,8 +57,9 @@ MxS8 MxWavePresenter::GetPlayedChunks() DWORD dwCurrentPlayCursor, dwCurrentWriteCursor; MxS8 playedChunks = -1; - if (m_dsBuffer->GetCurrentPosition(&dwCurrentPlayCursor, &dwCurrentWriteCursor) == DS_OK) + if (m_dsBuffer->GetCurrentPosition(&dwCurrentPlayCursor, &dwCurrentWriteCursor) == DS_OK) { playedChunks = dwCurrentPlayCursor / m_chunkLength; + } return playedChunks; } @@ -141,26 +144,32 @@ void MxWavePresenter::StartingTickle() waveFormatEx.nBlockAlign = m_waveFormat->m_pcmWaveFormat.wf.nBlockAlign; waveFormatEx.wBitsPerSample = m_waveFormat->m_pcmWaveFormat.wBitsPerSample; - if (waveFormatEx.wBitsPerSample == 8) + if (waveFormatEx.wBitsPerSample == 8) { m_silenceData = 0x7F; + } - if (waveFormatEx.wBitsPerSample == 16) + if (waveFormatEx.wBitsPerSample == 16) { m_silenceData = 0; + } DSBUFFERDESC desc; memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); - if (m_unk0x66) + if (m_is3d) { desc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRL3D | DSBCAPS_CTRLVOLUME; - else + } + else { desc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME; + } - if (m_action->GetFlags() & MxDSAction::c_looping) + if (m_action->GetFlags() & MxDSAction::c_looping) { desc.dwBufferBytes = m_waveFormat->m_pcmWaveFormat.wf.nAvgBytesPerSec * (m_action->GetDuration() / m_action->GetLoopCount()) / 1000; - else + } + else { desc.dwBufferBytes = 2 * length; + } desc.lpwfxFormat = &waveFormatEx; @@ -209,19 +218,22 @@ void MxWavePresenter::DoneTickle() MxS8 playedChunks = dwCurrentPlayCursor / m_chunkLength; if (m_action->GetFlags() & MxDSAction::c_bit7 || m_action->GetFlags() & MxDSAction::c_looping || - m_writtenChunks != playedChunks || m_lockSize + (m_chunkLength * playedChunks) <= dwCurrentPlayCursor) + m_writtenChunks != playedChunks || m_lockSize + (m_chunkLength * playedChunks) <= dwCurrentPlayCursor) { MxMediaPresenter::DoneTickle(); + } } - else + else { MxMediaPresenter::DoneTickle(); + } } // FUNCTION: LEGO1 0x100b2130 void MxWavePresenter::LoopChunk(MxStreamChunk* p_chunk) { WriteToSoundBuffer(p_chunk->GetData(), p_chunk->GetLength()); - if (IsEnabled()) + if (IsEnabled()) { m_subscriber->DestroyChunk(p_chunk); + } } // FUNCTION: LEGO1 0x100b2160 @@ -241,18 +253,21 @@ MxResult MxWavePresenter::PutData() if (!m_started) { m_dsBuffer->SetCurrentPosition(0); - if (m_dsBuffer->Play(0, 0, DSBPLAY_LOOPING) == DS_OK) + if (m_dsBuffer->Play(0, 0, DSBPLAY_LOOPING) == DS_OK) { m_started = TRUE; + } } break; case e_repeating: - if (m_started) + if (m_started) { break; + } m_dsBuffer->SetCurrentPosition(0); - if (m_dsBuffer->Play(0, 0, m_action->GetLoopCount() > 1) == DS_OK) + if (m_dsBuffer->Play(0, 0, m_action->GetLoopCount() > 1) == DS_OK) { m_started = TRUE; + } } } @@ -266,8 +281,9 @@ void MxWavePresenter::EndAction() MxAutoLocker lock(&m_criticalSection); MxMediaPresenter::EndAction(); - if (m_dsBuffer) + if (m_dsBuffer) { m_dsBuffer->Stop(); + } } } @@ -296,8 +312,9 @@ void MxWavePresenter::Enable(MxBool p_enable) m_writtenChunks = 0; m_started = FALSE; } - else if (m_dsBuffer) + else if (m_dsBuffer) { m_dsBuffer->Stop(); + } } } @@ -317,8 +334,9 @@ void MxWavePresenter::ParseExtra() char soundValue[512]; if (KeyValueStringParse(soundValue, g_strSOUND, extraCopy)) { - if (!strcmpi(soundValue, "FALSE")) + if (!strcmpi(soundValue, "FALSE")) { Enable(FALSE); + } } } } @@ -327,8 +345,9 @@ void MxWavePresenter::ParseExtra() void MxWavePresenter::Pause() { if (!m_paused && m_started) { - if (m_dsBuffer) + if (m_dsBuffer) { m_dsBuffer->Stop(); + } m_paused = TRUE; } } diff --git a/LEGO1/omni/src/common/mxatomid.cpp b/LEGO1/omni/src/common/mxatomid.cpp index 6c400eed..c5b7412c 100644 --- a/LEGO1/omni/src/common/mxatomid.cpp +++ b/LEGO1/omni/src/common/mxatomid.cpp @@ -5,11 +5,13 @@ // FUNCTION: LEGO1 0x100acf90 MxAtomId::MxAtomId(const char* p_str, LookupMode p_mode) { - if (!MxOmni::GetInstance()) + if (!MxOmni::GetInstance()) { return; + } - if (!AtomIdCounterSet()) + if (!AtomIdCounterSet()) { return; + } MxAtomIdCounter* counter = GetCounter(p_str, p_mode); m_internal = counter->GetKey()->GetData(); @@ -25,14 +27,17 @@ MxAtomId::~MxAtomId() // FUNCTION: LEGO1 0x100acfe0 void MxAtomId::Destroy() { - if (!m_internal) + if (!m_internal) { return; + } - if (!MxOmni::GetInstance()) + if (!MxOmni::GetInstance()) { return; + } - if (!AtomIdCounterSet()) + if (!AtomIdCounterSet()) { return; + } #ifdef COMPAT_MODE MxAtomIdCounterSet::iterator it; @@ -51,8 +56,9 @@ void MxAtomId::Destroy() // FUNCTION: LEGO1 0x100ad1c0 MxAtomId& MxAtomId::operator=(const MxAtomId& p_atomId) { - if (m_internal) + if (m_internal) { Destroy(); + } if (p_atomId.m_internal && MxOmni::GetInstance() && AtomIdCounterSet()) { MxAtomIdCounter* counter = GetCounter(p_atomId.m_internal, e_exact); diff --git a/LEGO1/omni/src/common/mxatomidcounter.cpp b/LEGO1/omni/src/common/mxatomidcounter.cpp index f3be8764..cfec47b1 100644 --- a/LEGO1/omni/src/common/mxatomidcounter.cpp +++ b/LEGO1/omni/src/common/mxatomidcounter.cpp @@ -14,6 +14,7 @@ void MxAtomIdCounter::Inc() // FUNCTION: LEGO1 0x100ad800 void MxAtomIdCounter::Dec() { - if (m_value) + if (m_value) { m_value--; + } } diff --git a/LEGO1/omni/src/common/mxcompositepresenter.cpp b/LEGO1/omni/src/common/mxcompositepresenter.cpp index 5c5b612e..5996f634 100644 --- a/LEGO1/omni/src/common/mxcompositepresenter.cpp +++ b/LEGO1/omni/src/common/mxcompositepresenter.cpp @@ -50,16 +50,18 @@ MxResult MxCompositePresenter::StartAction(MxStreamController* p_controller, MxD if (presenter && presenter->AddToManager() == SUCCESS) { presenter->SetCompositePresenter(this); - if (presenter->StartAction(p_controller, action) == SUCCESS) + if (presenter->StartAction(p_controller, action) == SUCCESS) { success = TRUE; + } } if (success) { action->SetOrigin(this); m_list.push_back(presenter); } - else if (presenter) + else if (presenter) { delete presenter; + } } result = SUCCESS; @@ -73,8 +75,9 @@ void MxCompositePresenter::EndAction() { MxAutoLocker lock(&m_criticalSection); - if (!m_action) + if (!m_action) { return; + } ((MxDSMultiAction*) m_action)->GetActionList()->DeleteAll(FALSE); @@ -139,15 +142,18 @@ void MxCompositePresenter::VTable0x58(MxEndActionNotificationParam& p_param) MxDSActionList* actions = ((MxDSMultiAction*) m_action)->GetActionList(); MxDSActionListCursor cursor(actions); - if (cursor.Find(action)) + if (cursor.Find(action)) { cursor.Detach(); + } } - if (presenter) + if (presenter) { delete presenter; + } - if (action) + if (action) { delete action; + } if (m_list.empty()) { EndAction(); @@ -155,8 +161,9 @@ void MxCompositePresenter::VTable0x58(MxEndActionNotificationParam& p_param) else { if (m_action->IsA("MxDSSerialAction") && it != m_list.end()) { MxPresenter* presenter = *it; - if (presenter->GetCurrentTickleState() == e_idle) + if (presenter->GetCurrentTickleState() == e_idle) { presenter->SetTickleState(e_ready); + } } } } @@ -171,14 +178,16 @@ void MxCompositePresenter::VTable0x5c(MxNotificationParam& p_param) if (*it == presenter) { m_list.erase(it++); - if (presenter->GetCurrentTickleState() == e_idle) + if (presenter->GetCurrentTickleState() == e_idle) { presenter->SetTickleState(e_ready); + } MxDSActionList* actions = ((MxDSMultiAction*) m_action)->GetActionList(); MxDSActionListCursor cursor(actions); - if (cursor.Find(presenter->GetAction())) + if (cursor.Find(presenter->GetAction())) { cursor.Detach(); + } if (m_list.empty()) { EndAction(); @@ -186,8 +195,9 @@ void MxCompositePresenter::VTable0x5c(MxNotificationParam& p_param) else { if (m_action->IsA("MxDSSerialAction")) { MxPresenter* presenter = *it; - if (presenter->GetCurrentTickleState() == e_idle) + if (presenter->GetCurrentTickleState() == e_idle) { presenter->SetTickleState(e_ready); + } } } @@ -205,13 +215,15 @@ void MxCompositePresenter::VTable0x60(MxPresenter* p_presenter) for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { if (*it == p_presenter) { if (++it == m_list.end()) { - if (m_compositePresenter) + if (m_compositePresenter) { m_compositePresenter->VTable0x60(this); + } } else if (m_action->IsA("MxDSSerialAction")) { MxPresenter* presenter = *it; - if (presenter->GetCurrentTickleState() == e_idle) + if (presenter->GetCurrentTickleState() == e_idle) { presenter->SetTickleState(e_ready); + } } return; } @@ -227,8 +239,9 @@ void MxCompositePresenter::SetTickleState(TickleState p_tickleState) MxPresenter* presenter = *it; presenter->SetTickleState(p_tickleState); - if (m_action->IsA("MxDSSerialAction") && p_tickleState == e_ready) + if (m_action->IsA("MxDSSerialAction") && p_tickleState == e_ready) { return; + } } } @@ -248,8 +261,9 @@ MxBool MxCompositePresenter::HasTickleStatePassed(TickleState p_tickleState) { for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { MxPresenter* presenter = *it; - if (!presenter->HasTickleStatePassed(p_tickleState)) + if (!presenter->HasTickleStatePassed(p_tickleState)) { return FALSE; + } } return TRUE; diff --git a/LEGO1/omni/src/common/mxmediamanager.cpp b/LEGO1/omni/src/common/mxmediamanager.cpp index 778d7f86..6a9d99c5 100644 --- a/LEGO1/omni/src/common/mxmediamanager.cpp +++ b/LEGO1/omni/src/common/mxmediamanager.cpp @@ -50,8 +50,9 @@ void MxMediaManager::Destroy() { MxAutoLocker lock(&this->m_criticalSection); - if (this->m_presenters) + if (this->m_presenters) { delete this->m_presenters; + } Init(); } @@ -63,13 +64,15 @@ MxResult MxMediaManager::Tickle() MxPresenter* presenter; MxPresenterListCursor cursor(this->m_presenters); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->Tickle(); + } cursor.Reset(); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->PutData(); + } return SUCCESS; } @@ -88,8 +91,9 @@ void MxMediaManager::UnregisterPresenter(MxPresenter& p_presenter) MxAutoLocker lock(&this->m_criticalSection); MxPresenterListCursor cursor(this->m_presenters); - if (cursor.Find(&p_presenter)) + if (cursor.Find(&p_presenter)) { cursor.Detach(); + } } // FUNCTION: LEGO1 0x100b8ac0 @@ -99,6 +103,7 @@ void MxMediaManager::StopPresenters() MxPresenter* presenter; MxPresenterListCursor cursor(this->m_presenters); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->EndAction(); + } } diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index 2abc5007..48450b58 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -26,21 +26,25 @@ void MxMediaPresenter::Destroy(MxBool p_fromDestructor) { MxAutoLocker lock(&m_criticalSection); - if (m_currentChunk && m_subscriber) + if (m_currentChunk && m_subscriber) { m_subscriber->DestroyChunk(m_currentChunk); + } - if (m_subscriber) + if (m_subscriber) { delete m_subscriber; + } - if (m_loopingChunkCursor) + if (m_loopingChunkCursor) { delete m_loopingChunkCursor; + } if (m_loopingChunks) { MxStreamChunkListCursor cursor(m_loopingChunks); MxStreamChunk* chunk; - while (cursor.Next(chunk)) + while (cursor.Next(chunk)) { chunk->Release(); + } delete m_loopingChunks; } @@ -48,8 +52,9 @@ void MxMediaPresenter::Destroy(MxBool p_fromDestructor) Init(); } - if (!p_fromDestructor) + if (!p_fromDestructor) { MxPresenter::Destroy(); + } } // FUNCTION: LEGO1 0x100b5650 @@ -102,16 +107,18 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct m_loopingChunks = new MxStreamChunkList; m_loopingChunkCursor = new MxStreamChunkListCursor(m_loopingChunks); - if (!m_loopingChunks && !m_loopingChunkCursor) + if (!m_loopingChunks && !m_loopingChunkCursor) { goto done; + } } if (p_controller) { m_subscriber = new MxDSSubscriber; if (!m_subscriber || - m_subscriber->Create(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS) + m_subscriber->Create(p_controller, p_action->GetObjectId(), p_action->GetUnknown24()) != SUCCESS) { goto done; + } } result = SUCCESS; @@ -126,8 +133,9 @@ void MxMediaPresenter::EndAction() { MxAutoLocker lock(&m_criticalSection); - if (!m_action) + if (!m_action) { return; + } m_currentChunk = NULL; @@ -198,18 +206,22 @@ void MxMediaPresenter::StreamingTickle() void MxMediaPresenter::RepeatingTickle() { if (IsEnabled() && !m_currentChunk) { - if (m_loopingChunkCursor) - if (!m_loopingChunkCursor->Next(m_currentChunk)) + if (m_loopingChunkCursor) { + if (!m_loopingChunkCursor->Next(m_currentChunk)) { m_loopingChunkCursor->Next(m_currentChunk); + } + } if (m_currentChunk) { MxLong time = m_currentChunk->GetTime(); - if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) + if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) { ProgressTickleState(e_unk5); + } } else { - if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) + if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { ProgressTickleState(e_unk5); + } } } } @@ -217,8 +229,7 @@ void MxMediaPresenter::RepeatingTickle() // FUNCTION: LEGO1 0x100b5ef0 void MxMediaPresenter::DoneTickle() { - m_previousTickleStates |= 1 << m_currentTickleState; - m_currentTickleState = e_idle; + ProgressTickleState(e_idle); EndAction(); } @@ -248,8 +259,9 @@ void MxMediaPresenter::Enable(MxBool p_enable) SetTickleState(e_repeating); } else { - if (m_loopingChunkCursor) + if (m_loopingChunkCursor) { m_loopingChunkCursor->Reset(); + } m_currentChunk = NULL; SetTickleState(e_done); } diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index ab803493..794d1227 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -49,8 +49,9 @@ MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) // FUNCTION: LEGO1 0x100b4e40 void MxPresenter::EndAction() { - if (this->m_action == NULL) + if (this->m_action == NULL) { return; + } MxAutoLocker lock(&this->m_criticalSection); @@ -98,8 +99,9 @@ void MxPresenter::ParseExtra() m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_world); - if (result) + if (result) { SendToCompositePresenter(MxOmni::GetInstance()); + } } } } @@ -133,28 +135,33 @@ MxResult MxPresenter::Tickle() case e_ready: this->ReadyTickle(); - if (m_currentTickleState != e_starting) + if (m_currentTickleState != e_starting) { break; + } case e_starting: this->StartingTickle(); - if (m_currentTickleState != e_streaming) + if (m_currentTickleState != e_streaming) { break; + } case e_streaming: this->StreamingTickle(); - if (m_currentTickleState != e_repeating) + if (m_currentTickleState != e_repeating) { break; + } case e_repeating: this->RepeatingTickle(); - if (m_currentTickleState != e_unk5) + if (m_currentTickleState != e_unk5) { break; + } case e_unk5: this->Unk5Tickle(); - if (m_currentTickleState != e_done) + if (m_currentTickleState != e_done) { break; + } case e_done: this->DoneTickle(); default: @@ -170,10 +177,12 @@ void MxPresenter::Enable(MxBool p_enable) if (this->m_action && this->IsEnabled() != p_enable) { MxU32 flags = this->m_action->GetFlags(); - if (p_enable) + if (p_enable) { this->m_action->SetFlags(flags | MxDSAction::c_enabled); - else + } + else { this->m_action->SetFlags(flags & ~MxDSAction::c_enabled); + } } } diff --git a/LEGO1/omni/src/common/mxticklemanager.cpp b/LEGO1/omni/src/common/mxticklemanager.cpp index 667902c8..e8b0d410 100644 --- a/LEGO1/omni/src/common/mxticklemanager.cpp +++ b/LEGO1/omni/src/common/mxticklemanager.cpp @@ -45,8 +45,9 @@ MxResult MxTickleManager::Tickle() else { it++; - if (client->GetLastUpdateTime() > time) + if (client->GetLastUpdateTime() > time) { client->SetLastUpdateTime(-client->GetTickleInterval()); + } if ((client->GetTickleInterval() + client->GetLastUpdateTime()) < time) { client->GetClient()->Tickle(); @@ -64,8 +65,9 @@ void MxTickleManager::RegisterClient(MxCore* p_client, MxTime p_interval) MxTime interval = GetClientTickleInterval(p_client); if (interval == TICKLE_MANAGER_NOT_FOUND) { MxTickleClient* client = new MxTickleClient(p_client, p_interval); - if (client != NULL) + if (client != NULL) { m_clients.push_back(client); + } } } @@ -102,8 +104,9 @@ MxTime MxTickleManager::GetClientTickleInterval(MxCore* p_client) MxTickleClientPtrList::iterator it = m_clients.begin(); while (it != m_clients.end()) { MxTickleClient* client = *it; - if ((client->GetClient() == p_client) && ((client->GetFlags() & TICKLE_MANAGER_FLAG_DESTROY) == 0)) + if ((client->GetClient() == p_client) && ((client->GetFlags() & TICKLE_MANAGER_FLAG_DESTROY) == 0)) { return client->GetTickleInterval(); + } it++; } diff --git a/LEGO1/omni/src/common/mxutil.cpp b/LEGO1/omni/src/common/mxutil.cpp index d06b2653..5ffab77c 100644 --- a/LEGO1/omni/src/common/mxutil.cpp +++ b/LEGO1/omni/src/common/mxutil.cpp @@ -35,15 +35,17 @@ MxBool GetRectIntersection( MxRect32 rect(0, 0, *p_width, *p_height); rect.AddPoint(rect1Origin); - if (!rect.IntersectsWith(rect1)) + if (!rect.IntersectsWith(rect1)) { return FALSE; + } rect.Intersect(rect1); rect.SubtractPoint(rect1Origin); rect.AddPoint(rect2Origin); - if (!rect.IntersectsWith(rect2)) + if (!rect.IntersectsWith(rect2)) { return FALSE; + } rect.Intersect(rect2); rect.SubtractPoint(rect2Origin); @@ -93,8 +95,9 @@ MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p char* cur = &token[strlen(p_key)]; cur++; while (*cur != ',') { - if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r') + if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r') { break; + } *p_outputValue++ = *cur++; } *p_outputValue = '\0'; @@ -115,8 +118,8 @@ MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p MxBool ContainsPresenter(MxCompositePresenterList& p_presenterList, MxPresenter* p_presenter) { for (MxCompositePresenterList::iterator it = p_presenterList.begin(); it != p_presenterList.end(); it++) { - if (p_presenter == *it || (*it)->IsA("MxCompositePresenter") && - ContainsPresenter(((MxCompositePresenter*) *it)->GetList(), p_presenter)) { + if (p_presenter == *it || ((*it)->IsA("MxCompositePresenter") && + ContainsPresenter(((MxCompositePresenter*) *it)->GetList(), p_presenter))) { return TRUE; } } diff --git a/LEGO1/omni/src/common/mxvariabletable.cpp b/LEGO1/omni/src/common/mxvariabletable.cpp index 9503ee5e..94bdbacb 100644 --- a/LEGO1/omni/src/common/mxvariabletable.cpp +++ b/LEGO1/omni/src/common/mxvariabletable.cpp @@ -41,8 +41,9 @@ void MxVariableTable::SetVariable(MxVariable* p_var) MxHashTableCursor cursor(this); MxBool found = cursor.Find(p_var); - if (found) + if (found) { cursor.DeleteMatch(); + } MxHashTable::Add(p_var); } diff --git a/LEGO1/omni/src/event/mxeventmanager.cpp b/LEGO1/omni/src/event/mxeventmanager.cpp index 7819c38f..c0ee3229 100644 --- a/LEGO1/omni/src/event/mxeventmanager.cpp +++ b/LEGO1/omni/src/event/mxeventmanager.cpp @@ -30,11 +30,13 @@ void MxEventManager::Destroy(MxBool p_fromDestructor) m_thread->Terminate(); delete m_thread; } - else + else { TickleManager()->UnregisterClient(this); + } - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaManager::Destroy(); + } } // FUNCTION: LEGO1 0x100c04a0 @@ -50,21 +52,25 @@ MxResult MxEventManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) locked = TRUE; this->m_thread = new MxTickleThread(this, p_frequencyMS); - if (!this->m_thread || this->m_thread->Start(0, 0) != SUCCESS) + if (!this->m_thread || this->m_thread->Start(0, 0) != SUCCESS) { goto done; + } } - else + else { TickleManager()->RegisterClient(this, p_frequencyMS); + } status = SUCCESS; } done: - if (status != SUCCESS) + if (status != SUCCESS) { Destroy(); + } - if (locked) + if (locked) { this->m_criticalSection.Leave(); + } return status; } diff --git a/LEGO1/omni/src/event/mxeventpresenter.cpp b/LEGO1/omni/src/event/mxeventpresenter.cpp index 03b0de14..6072bdd5 100644 --- a/LEGO1/omni/src/event/mxeventpresenter.cpp +++ b/LEGO1/omni/src/event/mxeventpresenter.cpp @@ -42,13 +42,15 @@ MxResult MxEventPresenter::AddToManager() // FUNCTION: LEGO1 0x100c2de0 void MxEventPresenter::Destroy() { - if (EventManager()) + if (EventManager()) { EventManager()->UnregisterPresenter(*this); + } m_criticalSection.Enter(); - if (m_data) + if (m_data) { delete[] m_data; + } Init(); @@ -80,8 +82,9 @@ void MxEventPresenter::StartingTickle() { MxStreamChunk* chunk = CurrentChunk(); - if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) + if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) { ProgressTickleState(e_streaming); + } } // FUNCTION: LEGO1 0x100c2ef0 @@ -103,8 +106,9 @@ MxResult MxEventPresenter::PutData() variableTable->SetVariable(key, value); } - if (m_currentTickleState == e_streaming) + if (m_currentTickleState == e_streaming) { m_subscriber->DestroyChunk(m_currentChunk); + } m_currentChunk = NULL; } } diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index 2b266b3b..c04425b1 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -158,48 +158,56 @@ MxResult MxOmni::Create(MxOmniCreateParam& p_param) { MxResult result = FAILURE; - if (!(m_atomIdCounterSet = new MxAtomIdCounterSet())) + if (!(m_atomIdCounterSet = new MxAtomIdCounterSet())) { goto done; + } m_mediaPath = p_param.GetMediaPath(); m_windowHandle = p_param.GetWindowHandle(); if (p_param.CreateFlags().CreateObjectFactory()) { - if (!(m_objectFactory = new MxObjectFactory())) + if (!(m_objectFactory = new MxObjectFactory())) { goto done; + } } if (p_param.CreateFlags().CreateVariableTable()) { - if (!(m_variableTable = new MxVariableTable())) + if (!(m_variableTable = new MxVariableTable())) { goto done; + } } if (p_param.CreateFlags().CreateTimer()) { - if (!(m_timer = new MxTimer())) + if (!(m_timer = new MxTimer())) { goto done; + } } if (p_param.CreateFlags().CreateTickleManager()) { - if (!(m_tickleManager = new MxTickleManager())) + if (!(m_tickleManager = new MxTickleManager())) { goto done; + } } if (p_param.CreateFlags().CreateNotificationManager()) { - if (m_notificationManager = new MxNotificationManager()) { - if (m_notificationManager->Create(100, 0) != SUCCESS) + if ((m_notificationManager = new MxNotificationManager())) { + if (m_notificationManager->Create(100, 0) != SUCCESS) { goto done; + } } - else + else { goto done; + } } if (p_param.CreateFlags().CreateStreamer()) { - if (!(m_streamer = new MxStreamer()) || m_streamer->Create() != SUCCESS) + if (!(m_streamer = new MxStreamer()) || m_streamer->Create() != SUCCESS) { goto done; + } } if (p_param.CreateFlags().CreateVideoManager()) { - if (m_videoManager = new MxVideoManager()) { + if ((m_videoManager = new MxVideoManager())) { if (m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) { delete m_videoManager; m_videoManager = NULL; @@ -208,7 +216,7 @@ MxResult MxOmni::Create(MxOmniCreateParam& p_param) } if (p_param.CreateFlags().CreateSoundManager()) { - if (m_soundManager = new MxSoundManager()) { + if ((m_soundManager = new MxSoundManager())) { if (m_soundManager->Create(10, 0) != SUCCESS) { delete m_soundManager; m_soundManager = NULL; @@ -217,7 +225,7 @@ MxResult MxOmni::Create(MxOmniCreateParam& p_param) } if (p_param.CreateFlags().CreateMusicManager()) { - if (m_musicManager = new MxMusicManager()) { + if ((m_musicManager = new MxMusicManager())) { if (m_musicManager->Create(50, 0) != SUCCESS) { delete m_musicManager; m_musicManager = NULL; @@ -226,7 +234,7 @@ MxResult MxOmni::Create(MxOmniCreateParam& p_param) } if (p_param.CreateFlags().CreateEventManager()) { - if (m_eventManager = new MxEventManager()) { + if ((m_eventManager = new MxEventManager())) { if (m_eventManager->Create(50, 0) != SUCCESS) { delete m_eventManager; m_eventManager = NULL; @@ -235,9 +243,11 @@ MxResult MxOmni::Create(MxOmniCreateParam& p_param) } result = SUCCESS; + done: - if (result != SUCCESS) + if (result != SUCCESS) { Destroy(); + } return result; } @@ -255,8 +265,9 @@ void MxOmni::Destroy() // TODO: private members if (m_notificationManager) { while (m_notificationManager->GetQueue()) { - if (m_notificationManager->GetQueue()->size() == 0) + if (m_notificationManager->GetQueue()->size() == 0) { break; + } m_notificationManager->Tickle(); } @@ -317,16 +328,18 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p if (object) { if (object->AddToManager() == SUCCESS) { MxPresenter* sender = p_action.GetUnknown28(); - if (!sender) + if (!sender) { sender = p_controller->FUN_100c1e70(p_action); + } if (sender) { p_action.SetOrigin(sender); object->SetCompositePresenter((MxCompositePresenter*) sender); } else { - if (!p_action.GetOrigin()) + if (!p_action.GetOrigin()) { p_action.SetOrigin(this); + } object->SetCompositePresenter(NULL); } @@ -381,16 +394,18 @@ void MxOmni::DestroyInstance() // FUNCTION: LEGO1 0x100b06b0 MxBool MxOmni::ActionSourceEquals(MxDSAction* p_action, const char* p_name) { - if (!strcmp(p_action->GetSourceName(), p_name)) + if (!strcmp(p_action->GetSourceName(), p_name)) { return TRUE; + } if (p_action->IsA("MxDSMultiAction")) { MxDSActionListCursor cursor(((MxDSMultiAction*) p_action)->GetActionList()); MxDSAction* action; while (cursor.Next(action)) { - if (ActionSourceEquals(action, p_name)) + if (ActionSourceEquals(action, p_name)) { return TRUE; + } } } @@ -402,8 +417,9 @@ MxLong MxOmni::Notify(MxParam& p_param) { MxAutoLocker lock(&this->m_criticalsection); - if (((MxNotificationParam&) p_param).GetNotification() != c_notificationEndAction) + if (((MxNotificationParam&) p_param).GetNotification() != c_notificationEndAction) { return 0; + } return HandleActionEnd(p_param); } @@ -476,8 +492,9 @@ MxBool MxOmni::DoesEntityExist(MxDSAction& p_dsAction) if (m_streamer->FUN_100b9b30(p_dsAction)) { MxNotificationPtrList* queue = m_notificationManager->GetQueue(); - if (!queue || queue->size() == 0) + if (!queue || queue->size() == 0) { return TRUE; + } } return FALSE; } diff --git a/LEGO1/omni/src/notify/mxnotificationmanager.cpp b/LEGO1/omni/src/notify/mxnotificationmanager.cpp index 9e4858df..fe10a82c 100644 --- a/LEGO1/omni/src/notify/mxnotificationmanager.cpp +++ b/LEGO1/omni/src/notify/mxnotificationmanager.cpp @@ -128,9 +128,9 @@ void MxNotificationManager::FlushPending(MxCore* p_listener) MxNotificationPtrList::iterator it = m_sendList->begin(); while (it != m_sendList->end()) { notif = *it; - if ((notif->GetTarget()->GetId() == p_listener->GetId()) || - (notif->GetParam()->GetSender()) && - (notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) { + if (notif->GetTarget()->GetId() == p_listener->GetId() || + (notif->GetParam()->GetSender() && notif->GetParam()->GetSender()->GetId() == p_listener->GetId() + )) { m_sendList->erase(it++); pending.push_back(notif); } @@ -143,8 +143,8 @@ void MxNotificationManager::FlushPending(MxCore* p_listener) MxNotificationPtrList::iterator it = m_queue->begin(); while (it != m_queue->end()) { notif = *it; - if ((notif->GetTarget()->GetId() == p_listener->GetId()) || - (notif->GetParam()->GetSender()) && (notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) { + if (notif->GetTarget()->GetId() == p_listener->GetId() || + (notif->GetParam()->GetSender() && notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) { m_queue->erase(it++); pending.push_back(notif); } @@ -169,8 +169,9 @@ void MxNotificationManager::Register(MxCore* p_listener) MxAutoLocker lock(&m_lock); MxIdList::iterator it = find(m_listenerIds.begin(), m_listenerIds.end(), p_listener->GetId()); - if (it != m_listenerIds.end()) + if (it != m_listenerIds.end()) { return; + } m_listenerIds.push_back(p_listener->GetId()); } diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index 5833d18f..a2b2edf9 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -35,8 +35,9 @@ MxDiskStreamController::~MxDiskStreamController() } MxDSAction* action; - while (m_unk0x3c.PopFront(action)) + while (m_unk0x3c.PopFront(action)) { delete action; + } if (m_provider) { delete m_provider; @@ -45,11 +46,13 @@ MxDiskStreamController::~MxDiskStreamController() FUN_100c8720(); - while (m_list0x80.PopFront(action)) + while (m_list0x80.PopFront(action)) { FUN_100c7cb0((MxDSStreamingAction*) action); + } - while (m_list0x64.PopFront(action)) + while (m_list0x64.PopFront(action)) { FUN_100c7cb0((MxDSStreamingAction*) action); + } while (!m_list0x74.empty()) { MxDSBuffer* buffer = m_list0x74.front(); @@ -130,15 +133,17 @@ void MxDiskStreamController::FUN_100c7980() buffer = new MxDSBuffer(); if (buffer->AllocateBuffer(m_provider->GetFileSize(), MxDSBuffer::e_chunk) != SUCCESS) { - if (buffer) + if (buffer) { delete buffer; + } return; } action = VTable0x28(); if (!action) { - if (buffer) + if (buffer) { delete buffer; + } return; } @@ -228,8 +233,9 @@ MxResult MxDiskStreamController::FUN_100c7d10() MxAutoLocker lock(&this->m_criticalSection); MxDSStreamingAction* action = FUN_100c7db0(); - if (!action) + if (!action) { return FAILURE; + } if (FUN_100c8360(action) != SUCCESS) { VTable0x24(action); @@ -290,11 +296,13 @@ MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action) FUN_100c7f40(action); - if (VTable0x2c(p_action, entry->GetUnknown94()) != SUCCESS) + if (VTable0x2c(p_action, entry->GetUnknown94()) != SUCCESS) { return FAILURE; + } } - else if (MxStreamController::VTable0x20(p_action) != SUCCESS) + else if (MxStreamController::VTable0x20(p_action) != SUCCESS) { return FAILURE; + } m_unk0x70 = TRUE; m_unk0xc4 = TRUE; @@ -312,8 +320,9 @@ void MxDiskStreamController::FUN_100c8120(MxDSAction* p_action) while (TRUE) { MxDSAction* found = m_unk0x54.Find(p_action, TRUE); - if (!found) + if (!found) { break; + } delete found; } } @@ -408,8 +417,9 @@ void MxDiskStreamController::FUN_100c8540() m_list0x74.erase(it++); FUN_100c7ce0(buf); } - else + else { it++; + } } if (m_nextActionList.empty()) { diff --git a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp index 7b4b6ef5..88f70c7d 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp @@ -19,8 +19,9 @@ MxU32 g_unk0x10102878 = 0; // FUNCTION: LEGO1 0x100d0f30 MxResult MxDiskStreamProviderThread::Run() { - if (m_target) + if (m_target) { ((MxDiskStreamProvider*) m_target)->WaitForWorkToComplete(); + } MxThread::Run(); // They should probably have writen "return MxThread::Run()" but they didn't. return SUCCESS; @@ -55,11 +56,13 @@ MxDiskStreamProvider::~MxDiskStreamProvider() m_list.PopFrontStreamingAction(action); } - if (!action) + if (!action) { break; + } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) + if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; + } ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); } while (action); @@ -70,8 +73,9 @@ MxDiskStreamProvider::~MxDiskStreamProvider() m_thread.Terminate(); } - if (m_pFile) + if (m_pFile) { delete m_pFile; + } m_pFile = NULL; } @@ -91,8 +95,9 @@ MxResult MxDiskStreamProvider::SetResourceToGet(MxStreamController* p_resource) path = MxString(MxOmni::GetCD()) + p_resource->GetAtom().GetInternal() + ".si"; m_pFile->SetFileName(path.GetData()); - if (m_pFile->Open(0) != 0) + if (m_pFile->Open(0) != 0) { goto done; + } } m_remainingWork = TRUE; @@ -123,11 +128,13 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) m_list.PopFrontStreamingAction(action); } - if (!action) + if (!action) { return; + } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) + if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; + } ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); } while (action); @@ -139,11 +146,13 @@ void MxDiskStreamProvider::VTable0x20(MxDSAction* p_action) action = (MxDSStreamingAction*) m_list.Find(p_action, TRUE); } - if (!action) + if (!action) { return; + } - if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) + if (action->GetUnknowna0()->GetWriteOffset() < 0x20000) { g_unk0x10102878--; + } ((MxDiskStreamController*) m_pLookup)->FUN_100c8670(action); } while (action); @@ -155,8 +164,9 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete() { while (m_remainingWork) { m_busySemaphore.Wait(INFINITE); - if (m_unk0x35) + if (m_unk0x35) { PerformWork(); + } } return SUCCESS; @@ -165,14 +175,16 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete() // FUNCTION: LEGO1 0x100d1780 MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action) { - if (!m_remainingWork) + if (!m_remainingWork) { return FAILURE; + } if (p_action->GetUnknown9c() > 0 && !p_action->GetUnknowna0()) { MxDSBuffer* buffer = new MxDSBuffer(); - if (!buffer) + if (!buffer) { return FAILURE; + } if (buffer->AllocateBuffer(GetFileSize(), MxDSBuffer::e_allocate) != SUCCESS) { delete buffer; @@ -220,8 +232,9 @@ void MxDiskStreamProvider::PerformWork() { MxAutoLocker lock(&m_criticalSection); - if (!m_list.PopFrontStreamingAction(streamingAction)) + if (!m_list.PopFrontStreamingAction(streamingAction)) { goto done; + } } if (streamingAction->GetUnknowna0()->GetWriteOffset() < 0x20000) { @@ -276,15 +289,17 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) { MxDSBuffer* buffer = new MxDSBuffer(); - if (!buffer) + if (!buffer) { return FAILURE; + } MxU32 size = p_action->GetUnknowna0()->GetWriteOffset() - p_action->GetUnknown94() + p_action->GetBufferOffset() + (p_action->GetUnknowna4() ? p_action->GetUnknowna4()->GetWriteOffset() : 0); if (buffer->AllocateBuffer(size, MxDSBuffer::e_allocate) != SUCCESS) { - if (!buffer) + if (!buffer) { return FAILURE; + } delete buffer; return FAILURE; @@ -327,8 +342,9 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) size = ReadData(*pdata, buffer->GetWriteOffset()); MxDSBuffer* buffer3 = new MxDSBuffer(); - if (!buffer3) + if (!buffer3) { return FAILURE; + } if (buffer3->AllocateBuffer(size, MxDSBuffer::e_allocate) == SUCCESS) { memcpy(buffer3->GetBuffer(), p_action->GetUnknowna4()->GetBuffer(), size); @@ -342,8 +358,9 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) MxU8* data2 = buffer4->GetBuffer(); while (TRUE) { - if (*MxStreamChunk::IntoTime(data2) > p_action->GetUnknown9c()) + if (*MxStreamChunk::IntoTime(data2) > p_action->GetUnknown9c()) { break; + } data += MxDSChunk::Size(*MxDSChunk::IntoLength(data)); unk0x14 += MxDSChunk::Size(*MxDSChunk::IntoLength(data)); diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 380cc1e0..697984e0 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -56,7 +56,7 @@ MxDSBuffer::~MxDSBuffer() } case 0x80: { MxU32 a = - (m_pBuffer - streamer->GetSubclass1().GetBuffer()) / (streamer->GetSubclass1().GetSize() << 10); + (m_pBuffer - streamer->GetSubclass2().GetBuffer()) / (streamer->GetSubclass2().GetSize() << 10); MxU32 bit = 1 << ((MxU8) a & 0x1f); MxU32 index = (a & ~0x18u) >> 3; @@ -164,19 +164,22 @@ MxResult MxDSBuffer::FUN_100c67b0( MxResult result = FAILURE; m_unk0x30 = (MxDSStreamingAction*) p_controller->GetUnk0x3c().Find(p_action, FALSE); - if (m_unk0x30 == NULL) + if (m_unk0x30 == NULL) { return FAILURE; + } MxU8* data; - while (data = (MxU8*) SkipToData()) { + while ((data = (MxU8*) SkipToData())) { if (*p_streamingAction == NULL) { result = CreateObject(p_controller, (MxU32*) data, p_action, p_streamingAction); - if (result == FAILURE) + if (result == FAILURE) { return result; + } // TODO: Not a MxResult value? - if (result == 1) + if (result == 1) { break; + } } else { MxDSBuffer* buffer = (*p_streamingAction)->GetUnknowna0(); @@ -226,8 +229,9 @@ MxResult MxDSBuffer::CreateObject( return FAILURE; } - if (*p_data == FOURCC('M', 'x', 'O', 'b')) + if (*p_data == FOURCC('M', 'x', 'O', 'b')) { return StartPresenterFromAction(p_controller, p_action, (MxDSAction*) header); + } else if (*p_data == FOURCC('M', 'x', 'C', 'h')) { MxStreamChunk* chunk = (MxStreamChunk*) header; if (!m_unk0x30->HasId((chunk)->GetObjectId())) { @@ -316,8 +320,9 @@ MxResult MxDSBuffer::ParseChunk( } } - if (buffer) + if (buffer) { delete buffer; + } delete p_header; return FAILURE; @@ -337,8 +342,9 @@ MxResult MxDSBuffer::ParseChunk( MxNextActionDataStart* data = p_controller->FindNextActionDataStartFromStreamingAction(m_unk0x30); - if (data) + if (data) { data->SetData(m_unk0x30->GetBufferOffset()); + } m_unk0x30->FUN_100cd2d0(); } @@ -472,8 +478,9 @@ MxResult MxDSBuffer::CalcBytesRemaining(MxU8* p_data) if (bytesRead <= m_bytesRemaining) { memcpy(m_pBuffer + m_writeOffset - m_bytesRemaining, ptr, bytesRead); - if (m_writeOffset == m_bytesRemaining) + if (m_writeOffset == m_bytesRemaining) { *(MxU32*) (m_pBuffer + 4) = *MxStreamChunk::IntoLength(m_pBuffer) + MxStreamChunk::GetHeaderSize(); + } m_bytesRemaining -= bytesRead; result = SUCCESS; @@ -510,14 +517,17 @@ MxU8* MxDSBuffer::FUN_100c6fa0(MxU8* p_data) break; case FOURCC('M', 'x', 'O', 'b'): case FOURCC('M', 'x', 'C', 'h'): - if (current != p_data) + if (current != p_data) { return current; + } current = ((MxU32) current & 1) + current; current += 8; break; case FOURCC('M', 'x', 'H', 'd'): current += (((MxU32*) current)[1] + 8); break; + default: + return NULL; } } diff --git a/LEGO1/omni/src/stream/mxdschunk.cpp b/LEGO1/omni/src/stream/mxdschunk.cpp index fede0762..a964d0fa 100644 --- a/LEGO1/omni/src/stream/mxdschunk.cpp +++ b/LEGO1/omni/src/stream/mxdschunk.cpp @@ -15,8 +15,9 @@ MxDSChunk::MxDSChunk() // FUNCTION: LEGO1 0x100be170 MxDSChunk::~MxDSChunk() { - if (m_flags & c_bit1) + if (m_flags & c_bit1) { delete[] m_data; + } } // FUNCTION: LEGO1 0x100be1e0 diff --git a/LEGO1/omni/src/stream/mxdsfile.cpp b/LEGO1/omni/src/stream/mxdsfile.cpp index 33b85929..9b6fa661 100644 --- a/LEGO1/omni/src/stream/mxdsfile.cpp +++ b/LEGO1/omni/src/stream/mxdsfile.cpp @@ -1,15 +1,14 @@ #include "mxdsfile.h" +#include "decomp.h" + #include #define SI_MAJOR_VERSION 2 #define SI_MINOR_VERSION 2 -// FUNCTION: LEGO1 0x100bfed0 -MxDSFile::~MxDSFile() -{ - Close(); -} +DECOMP_SIZE_ASSERT(MxDSFile::ChunkHeader, 0x0c) +DECOMP_SIZE_ASSERT(MxDSFile, 0x7c) // FUNCTION: LEGO1 0x100cc4b0 MxDSFile::MxDSFile(const char* p_filename, MxULong p_skipReadingChunks) @@ -37,10 +36,10 @@ MxLong MxDSFile::Open(MxULong p_uStyle) } if (longResult != 0) { - Close(); // vtable + 0x18 + Close(); } else { - Seek(0, 0); // vtable + 0x24 + Seek(0, 0); } return longResult; @@ -98,8 +97,9 @@ MxLong MxDSFile::Close() // FUNCTION: LEGO1 0x100cc780 MxResult MxDSFile::Read(unsigned char* p_buf, MxULong p_nbytes) { - if (m_io.Read(p_buf, p_nbytes) != p_nbytes) + if (m_io.Read(p_buf, p_nbytes) != p_nbytes) { return FAILURE; + } m_position += p_nbytes; return SUCCESS; diff --git a/LEGO1/omni/src/stream/mxdssubscriber.cpp b/LEGO1/omni/src/stream/mxdssubscriber.cpp index 82ca1730..488ff02c 100644 --- a/LEGO1/omni/src/stream/mxdssubscriber.cpp +++ b/LEGO1/omni/src/stream/mxdssubscriber.cpp @@ -16,17 +16,20 @@ MxDSSubscriber::MxDSSubscriber() // FUNCTION: LEGO1 0x100b7e00 MxDSSubscriber::~MxDSSubscriber() { - if (m_controller) + if (m_controller) { m_controller->RemoveSubscriber(this); + } DeleteChunks(); - if (m_pendingChunkCursor) + if (m_pendingChunkCursor) { delete m_pendingChunkCursor; + } m_pendingChunkCursor = NULL; - if (m_consumedChunkCursor) + if (m_consumedChunkCursor) { delete m_consumedChunkCursor; + } m_consumedChunkCursor = NULL; } @@ -36,17 +39,20 @@ MxResult MxDSSubscriber::Create(MxStreamController* p_controller, MxU32 p_object m_objectId = p_objectId; m_unk0x48 = p_unk0x48; - if (!p_controller) + if (!p_controller) { return FAILURE; + } m_controller = p_controller; m_pendingChunkCursor = new MxStreamChunkListCursor(&m_pendingChunks); - if (!m_pendingChunkCursor) + if (!m_pendingChunkCursor) { return FAILURE; + } m_consumedChunkCursor = new MxStreamChunkListCursor(&m_consumedChunks); - if (!m_consumedChunkCursor) + if (!m_consumedChunkCursor) { return FAILURE; + } m_controller->AddSubscriber(this); return SUCCESS; @@ -74,10 +80,12 @@ void MxDSSubscriber::DeleteChunks() MxResult MxDSSubscriber::AddChunk(MxStreamChunk* p_chunk, MxBool p_append) { if (m_pendingChunkCursor) { - if (p_append) + if (p_append) { m_pendingChunks.Append(p_chunk); - else + } + else { m_pendingChunks.Prepend(p_chunk); + } } return SUCCESS; @@ -88,8 +96,9 @@ MxStreamChunk* MxDSSubscriber::NextChunk() { MxStreamChunk* chunk = NULL; - if (m_pendingChunkCursor) + if (m_pendingChunkCursor) { m_pendingChunkCursor->First(chunk); + } if (chunk) { m_pendingChunkCursor->Detach(); @@ -104,8 +113,9 @@ MxStreamChunk* MxDSSubscriber::CurrentChunk() { MxStreamChunk* chunk = NULL; - if (m_pendingChunkCursor) + if (m_pendingChunkCursor) { m_pendingChunkCursor->First(chunk); + } return chunk; } @@ -116,10 +126,12 @@ void MxDSSubscriber::DestroyChunk(MxStreamChunk* p_chunk) if (p_chunk) { if (m_consumedChunkCursor->Find(p_chunk)) { m_consumedChunkCursor->Detach(); - if (p_chunk) + if (p_chunk) { delete p_chunk; + } } - else if (p_chunk->GetFlags() & MxDSChunk::c_bit1 && p_chunk) + else if (p_chunk->GetFlags() & MxDSChunk::c_bit1 && p_chunk) { delete p_chunk; + } } } diff --git a/LEGO1/omni/src/stream/mxioinfo.cpp b/LEGO1/omni/src/stream/mxioinfo.cpp index 9951c174..ec666c31 100644 --- a/LEGO1/omni/src/stream/mxioinfo.cpp +++ b/LEGO1/omni/src/stream/mxioinfo.cpp @@ -72,8 +72,9 @@ MxU16 MXIOINFO::Close(MxLong p_unused) _lclose((HFILE) m_info.hmmio); m_info.hmmio = 0; - if (m_info.dwFlags & MMIO_ALLOCBUF) + if (m_info.dwFlags & MMIO_ALLOCBUF) { delete[] m_info.pchBuffer; + } m_info.pchEndWrite = 0; m_info.pchEndRead = 0; @@ -95,8 +96,9 @@ MxLong MXIOINFO::Read(void* p_buf, MxLong p_len) while (p_len > 0) { if (bytesLeft > 0) { - if (p_len < bytesLeft) + if (p_len < bytesLeft) { bytesLeft = p_len; + } memcpy(p_buf, m_info.pchNext, bytesLeft); p_len -= bytesLeft; @@ -105,12 +107,14 @@ MxLong MXIOINFO::Read(void* p_buf, MxLong p_len) bytesRead += bytesLeft; } - if (p_len <= 0 || Advance(0)) + if (p_len <= 0 || Advance(0)) { break; + } bytesLeft = m_info.pchEndRead - m_info.pchNext; - if (bytesLeft <= 0) + if (bytesLeft <= 0) { break; + } } } else if (m_info.hmmio && p_len > 0) { @@ -334,6 +338,7 @@ MxU16 MXIOINFO::Advance(MxU16 p_option) m_info.pchNext = m_info.pchBuffer; m_info.pchEndRead = m_info.pchBuffer; m_info.dwFlags &= ~MMIO_DIRTY; + goto skipSeek; } else { result = MMIOERR_CANNOTWRITE; @@ -343,6 +348,7 @@ MxU16 MXIOINFO::Advance(MxU16 p_option) m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); } + skipSeek: m_info.lBufOffset += cch; if ((!rwmode || rwmode == MMIO_READWRITE) && cch > 0) { if (m_info.lBufOffset != m_info.lDiskOffset) { @@ -381,8 +387,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU { MxU16 result = 0; - if (!p_chunkInfo) + if (!p_chunkInfo) { return MMIOERR_BASE; // ? + } if (!p_descend) { p_chunkInfo->dwFlags = 0; @@ -406,8 +413,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU else { MxULong ofs = MAXLONG; - if (p_parentInfo) + if (p_parentInfo) { ofs = p_parentInfo->cksize + p_parentInfo->dwDataOffset; + } BOOL running = TRUE; BOOL readOk = FALSE; @@ -452,8 +460,9 @@ MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU } } - if (!result) + if (!result) { memcpy(p_chunkInfo, &tmp, sizeof(MMCKINFO)); + } } return result; diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index ca091d12..472930c7 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -71,8 +71,9 @@ MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource) path = MxString(MxOmni::GetCD()) + p_resource->GetAtom().GetInternal() + ".si"; m_pFile->SetFileName(path.GetData()); - if (m_pFile->Open(0) != 0) + if (m_pFile->Open(0) != 0) { goto done; + } } m_fileSize = m_pFile->CalcFileSize(); @@ -131,23 +132,27 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size) MxDSBuffer::Append(data2, data3); continue; } - else + else { *MxStreamChunk::IntoFlags(data2) &= ~MxDSChunk::c_split; + } } data2 += MxDSChunk::Size(*MxDSChunk::IntoLength(data2)); memcpy(data2, data3, MxDSChunk::Size(*psize)); if (*MxStreamChunk::IntoObjectId(data2) == id && - (*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_end)) + (*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_end)) { break; + } } - else + else { data++; + } } } - else + else { data++; + } } while (data < end); } diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index 204bdab8..977db130 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -45,12 +45,14 @@ MxStreamController::~MxStreamController() MxAutoLocker lock(&m_criticalSection); MxDSSubscriber* subscriber; - while (m_subscriberList.PopFront(subscriber)) + while (m_subscriberList.PopFront(subscriber)) { delete subscriber; + } MxDSAction* action; - while (m_unk0x3c.PopFront(action)) + while (m_unk0x3c.PopFront(action)) { delete action; + } if (m_provider) { MxStreamProvider* provider = m_provider; @@ -71,8 +73,9 @@ MxStreamController::~MxStreamController() m_unk0x2c = NULL; } - while (m_unk0x54.PopFront(action)) + while (m_unk0x54.PopFront(action)) { delete action; + } } // FUNCTION: LEGO1 0x100c1520 @@ -109,13 +112,16 @@ MxResult MxStreamController::VTable0x20(MxDSAction* p_action) MxS32 objectId = p_action->GetObjectId(); MxStreamProvider* provider = m_provider; - if ((MxS32) provider->GetLengthInDWords() > objectId) + if ((MxS32) provider->GetLengthInDWords() > objectId) { offset = provider->GetBufferForDWords()[objectId]; + } - if (offset) + if (offset) { result = VTable0x2c(p_action, offset); - else + } + else { result = FAILURE; + } return result; } @@ -159,16 +165,18 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) for (MxStreamListMxDSAction::iterator it = m_unk0x54.begin(); it != m_unk0x54.end(); it++) { MxDSAction* action = *it; - if (action->GetObjectId() == p_action->GetObjectId()) + if (action->GetObjectId() == p_action->GetObjectId()) { newUnknown24 = Max(newUnknown24, action->GetUnknown24()); + } } if (newUnknown24 == -1) { for (MxStreamListMxDSAction::iterator it = m_unk0x3c.begin(); it != m_unk0x3c.end(); it++) { MxDSAction* action = *it; - if (action->GetObjectId() == p_action->GetObjectId()) + if (action->GetObjectId() == p_action->GetObjectId()) { newUnknown24 = Max(newUnknown24, action->GetUnknown24()); + } } if (newUnknown24 == -1) { @@ -176,8 +184,9 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) it++) { MxDSSubscriber* subscriber = *it; - if (subscriber->GetObjectId() == p_action->GetObjectId()) + if (subscriber->GetObjectId() == p_action->GetObjectId()) { newUnknown24 = Max(newUnknown24, subscriber->GetUnknown48()); + } } } } @@ -185,14 +194,16 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) p_action->SetUnknown24(newUnknown24 + 1); } else { - if (m_unk0x3c.Find(p_action, FALSE)) + if (m_unk0x3c.Find(p_action, FALSE)) { return FAILURE; + } } MxDSStreamingAction* streamingAction = new MxDSStreamingAction(*p_action, p_offset); - if (!streamingAction) + if (!streamingAction) { return FAILURE; + } MxU32 fileSize = m_provider->GetFileSize(); streamingAction->SetBufferOffset(fileSize * (p_offset / fileSize)); @@ -268,14 +279,16 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) MxU32 objectId = p_action->GetObjectId(); MxStreamChunk* chunk = new MxStreamChunk; - if (!chunk) + if (!chunk) { return FAILURE; + } chunk->SetFlags(MxDSChunk::c_bit3); chunk->SetObjectId(objectId); - if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) + if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) { delete chunk; + } if (p_action->IsA("MxDSMultiAction")) { MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList(); @@ -283,8 +296,9 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) MxDSAction* action; while (cursor.Next(action)) { - if (FUN_100c1f00(action) != SUCCESS) + if (FUN_100c1f00(action) != SUCCESS) { return FAILURE; + } } } @@ -300,8 +314,9 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA // FUNCTION: LEGO1 0x100c20d0 MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj) { - if (m_subscriberList.Find(&p_obj)) + if (m_subscriberList.Find(&p_obj)) { return FALSE; + } if (p_obj.IsA("MxDSMultiAction")) { MxDSActionList* actions = ((MxDSMultiAction&) p_obj).GetActionList(); @@ -309,8 +324,9 @@ MxBool MxStreamController::FUN_100c20d0(MxDSObject& p_obj) MxDSAction* action; while (cursor.Next(action)) { - if (!FUN_100c20d0(*action)) + if (!FUN_100c20d0(*action)) { return FALSE; + } } } diff --git a/LEGO1/omni/src/stream/mxstreamer.cpp b/LEGO1/omni/src/stream/mxstreamer.cpp index d8d64fb5..76aa7862 100644 --- a/LEGO1/omni/src/stream/mxstreamer.cpp +++ b/LEGO1/omni/src/stream/mxstreamer.cpp @@ -79,8 +79,9 @@ MxLong MxStreamer::Close(const char* p_name) if (!p_name || !strcmp(p_name, c->GetAtom().GetInternal())) { m_openStreams.erase(it); - if (c->FUN_100c20d0(ds)) + if (c->FUN_100c20d0(ds)) { delete c; + } else { #ifdef COMPAT_MODE { @@ -185,8 +186,9 @@ MxResult MxStreamer::DeleteObject(MxDSAction* p_dsAction) MxBool MxStreamer::FUN_100b9b30(MxDSObject& p_dsObject) { MxStreamController* controller = GetOpenStream(p_dsObject.GetAtomId().GetInternal()); - if (controller) + if (controller) { return controller->FUN_100c20d0(p_dsObject); + } return TRUE; } @@ -200,8 +202,9 @@ MxLong MxStreamer::Notify(MxParam& p_param) MxStreamController* c = static_cast(p_param).GetController(); - if (c->FUN_100c20d0(ds)) + if (c->FUN_100c20d0(ds)) { delete c; + } else { #ifdef COMPAT_MODE { diff --git a/LEGO1/omni/src/stream/mxstreamlist.cpp b/LEGO1/omni/src/stream/mxstreamlist.cpp index 531d0446..effa987a 100644 --- a/LEGO1/omni/src/stream/mxstreamlist.cpp +++ b/LEGO1/omni/src/stream/mxstreamlist.cpp @@ -36,8 +36,9 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete) if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 || p_action->GetUnknown24() == (*it)->GetUnknown24()) { found = *it; - if (p_action->GetUnknown24() != -3) + if (p_action->GetUnknown24() != -3) { break; + } } } } @@ -53,8 +54,9 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete) 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()) + if (p_id == (*it)->GetObjectId() && p_value == (*it)->GetUnknown24()) { return *it; + } } return NULL; diff --git a/LEGO1/omni/src/system/mxautolocker.cpp b/LEGO1/omni/src/system/mxautolocker.cpp index d5749ad5..3c5a2afb 100644 --- a/LEGO1/omni/src/system/mxautolocker.cpp +++ b/LEGO1/omni/src/system/mxautolocker.cpp @@ -4,13 +4,15 @@ MxAutoLocker::MxAutoLocker(MxCriticalSection* p_criticalSection) { this->m_criticalSection = p_criticalSection; - if (this->m_criticalSection != 0) + if (this->m_criticalSection != 0) { this->m_criticalSection->Enter(); + } } // FUNCTION: LEGO1 0x100b8ef0 MxAutoLocker::~MxAutoLocker() { - if (this->m_criticalSection != 0) + if (this->m_criticalSection != 0) { this->m_criticalSection->Leave(); + } } diff --git a/LEGO1/omni/src/system/mxsemaphore.cpp b/LEGO1/omni/src/system/mxsemaphore.cpp index 5692a888..daba60f4 100644 --- a/LEGO1/omni/src/system/mxsemaphore.cpp +++ b/LEGO1/omni/src/system/mxsemaphore.cpp @@ -15,8 +15,9 @@ MxSemaphore::MxSemaphore() MxResult MxSemaphore::Init(MxU32 p_initialCount, MxU32 p_maxCount) { MxResult result = FAILURE; - if (m_hSemaphore = CreateSemaphoreA(NULL, p_initialCount, p_maxCount, NULL)) + if ((m_hSemaphore = CreateSemaphoreA(NULL, p_initialCount, p_maxCount, NULL))) { result = SUCCESS; + } return result; } diff --git a/LEGO1/omni/src/system/mxthread.cpp b/LEGO1/omni/src/system/mxthread.cpp index 158c0cf6..14c4ea82 100644 --- a/LEGO1/omni/src/system/mxthread.cpp +++ b/LEGO1/omni/src/system/mxthread.cpp @@ -51,8 +51,9 @@ MxThread::MxThread() // FUNCTION: LEGO1 0x100bf5a0 MxThread::~MxThread() { - if (m_hThread) + if (m_hThread) { CloseHandle((HANDLE) m_hThread); + } } typedef unsigned(__stdcall* ThreadFunc)(void*); @@ -62,9 +63,10 @@ MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag) { MxResult result = FAILURE; if (m_semaphore.Init(0, 1) == SUCCESS) { - if (m_hThread = - _beginthreadex(NULL, p_stack << 2, (ThreadFunc) &MxThread::ThreadProc, this, p_flag, &m_threadId)) + if ((m_hThread = + _beginthreadex(NULL, p_stack << 2, (ThreadFunc) &MxThread::ThreadProc, this, p_flag, &m_threadId))) { result = SUCCESS; + } } return result; } diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index 0d83bba2..98f1f6b2 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -25,12 +25,15 @@ MxBitmap::MxBitmap() // FUNCTION: LEGO1 0x100bca10 MxBitmap::~MxBitmap() { - if (this->m_info) + if (this->m_info) { delete m_info; - if (this->m_data) + } + if (this->m_data) { delete m_data; - if (this->m_palette) + } + if (this->m_palette) { delete m_palette; + } } // FUNCTION: LEGO1 0x100bcaa0 @@ -152,11 +155,13 @@ MxLong MxBitmap::Read(const char* p_filename) HANDLE handle = CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle)) + if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle)) { result = SUCCESS; + } - if (handle) + if (handle) { CloseHandle(handle); + } return result; } @@ -280,8 +285,9 @@ void MxBitmap::BitBltTransparent( for (MxS32 h = 0; h < p_height; h++) { for (MxS32 w = 0; w < p_width; w++) { - if (*srcStart) + if (*srcStart) { *dstStart = *srcStart; + } srcStart++; dstStart++; } @@ -302,15 +308,17 @@ MxPalette* MxBitmap::CreatePalette() case FALSE: palette = new MxPalette(this->m_paletteData); - if (!palette) + if (!palette) { goto done; + } break; case TRUE: palette = this->m_palette->Clone(); - if (!palette) + if (!palette) { goto done; + } break; default: @@ -361,8 +369,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) switch (p_isHighColor) { case FALSE: ImportColorsToPalette(m_paletteData, m_palette); - if (m_palette) + if (m_palette) { delete m_palette; + } m_palette = NULL; break; @@ -370,8 +379,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) pal = NULL; pal = new MxPalette(m_paletteData); - if (!pal) + if (!pal) { goto done; + } m_palette = pal; @@ -392,8 +402,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) done: // If we were unsuccessful overall but did manage to alloc // the MxPalette, free it. - if (ret && pal) + if (ret && pal) { delete pal; + } return ret; } @@ -438,13 +449,15 @@ MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palett PALETTEENTRY entries[256]; if (p_palette) { - if (p_palette->GetEntries(entries)) + if (p_palette->GetEntries(entries)) { goto done; + } } else { MxPalette palette; - if (palette.GetEntries(entries)) + if (palette.GetEntries(entries)) { goto done; + } } MxS32 i; diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index e2965826..0cb88f6d 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -81,8 +81,9 @@ MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param) { MxU8 count = 0; - for (; p_param; p_param >>= 1) + for (; p_param; p_param >>= 1) { count += ((MxU8) p_param & 1); + } return count; } @@ -92,8 +93,9 @@ MxU8 MxDisplaySurface::CountContiguousBitsSetTo1(MxU32 p_param) { MxU8 count = 0; - for (; (p_param & 1) == 0; p_param >>= 1) + for (; (p_param & 1) == 0; p_param >>= 1) { count++; + } return count; } @@ -117,8 +119,9 @@ MxResult MxDisplaySurface::Init( memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc)); this->m_surfaceDesc.dwSize = sizeof(this->m_surfaceDesc); - if (this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc)) + if (this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc)) { result = FAILURE; + } return result; } @@ -134,8 +137,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) this->m_initialized = TRUE; this->m_videoParam = p_videoParam; - if (!this->m_videoParam.Flags().GetFullScreen()) + if (!this->m_videoParam.Flags().GetFullScreen()) { this->m_videoParam.Flags().SetFlipSurfaces(FALSE); + } if (!this->m_videoParam.Flags().GetFlipSurfaces()) { this->m_videoParam.SetBackBuffers(1); @@ -143,10 +147,12 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) else { MxU32 backBuffers = this->m_videoParam.GetBackBuffers(); - if (backBuffers < 1) + if (backBuffers < 1) { this->m_videoParam.SetBackBuffers(1); - else if (backBuffers > 2) + } + else if (backBuffers > 2) { this->m_videoParam.SetBackBuffers(2); + } this->m_videoParam.Flags().SetBackBuffers(TRUE); } @@ -155,20 +161,23 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) MxS32 width = this->m_videoParam.GetRect().GetWidth(); MxS32 height = this->m_videoParam.GetRect().GetHeight(); - if (lpDirectDraw->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)) + if (lpDirectDraw->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)) { goto done; + } memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); - if (lpDirectDraw->GetDisplayMode(&ddsd)) + if (lpDirectDraw->GetDisplayMode(&ddsd)) { goto done; + } MxS32 bitdepth = !this->m_videoParam.Flags().Get16Bit() ? 8 : 16; if (ddsd.dwWidth != width || ddsd.dwHeight != height || ddsd.ddpfPixelFormat.dwRGBBitCount != bitdepth) { - if (lpDirectDraw->SetDisplayMode(width, height, bitdepth)) + if (lpDirectDraw->SetDisplayMode(width, height, bitdepth)) { goto done; + } } } @@ -179,13 +188,15 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) + if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) { goto done; + } ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; - if (this->m_ddSurface1->GetAttachedSurface(&ddsd.ddsCaps, &this->m_ddSurface2)) + if (this->m_ddSurface1->GetAttachedSurface(&ddsd.ddsCaps, &this->m_ddSurface2)) { goto done; + } } else { memset(&ddsd, 0, sizeof(ddsd)); @@ -193,8 +204,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) + if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface1, NULL)) { goto done; + } memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -203,11 +215,13 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) ddsd.dwHeight = this->m_videoParam.GetRect().GetHeight(); ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN; - if (!this->m_videoParam.Flags().GetBackBuffers()) + if (!this->m_videoParam.Flags().GetBackBuffers()) { ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; + } - if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL)) + if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL)) { goto done; + } } memset(&this->m_surfaceDesc, 0, sizeof(this->m_surfaceDesc)); @@ -215,8 +229,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) if (!this->m_ddSurface2->GetSurfaceDesc(&this->m_surfaceDesc)) { if (!lpDirectDraw->CreateClipper(0, &this->m_ddClipper, NULL) && !this->m_ddClipper->SetHWnd(0, hWnd) && - !this->m_ddSurface1->SetClipper(this->m_ddClipper)) + !this->m_ddSurface1->SetClipper(this->m_ddClipper)) { result = SUCCESS; + } } done: @@ -227,18 +242,22 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) void MxDisplaySurface::Destroy() { if (this->m_initialized) { - if (this->m_ddSurface2) + if (this->m_ddSurface2) { this->m_ddSurface2->Release(); + } - if (this->m_ddSurface1) + if (this->m_ddSurface1) { this->m_ddSurface1->Release(); + } - if (this->m_ddClipper) + if (this->m_ddClipper) { this->m_ddClipper->Release(); + } } - if (this->m_16bitPal) + if (this->m_16bitPal) { delete[] this->m_16bitPal; + } this->Init(); } @@ -273,8 +292,9 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette) } if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount == 16) { - if (!m_16bitPal) + if (!m_16bitPal) { m_16bitPal = new MxU16[256]; + } PALETTEENTRY palette[256]; p_palette->GetEntries(palette); @@ -287,9 +307,9 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette) MxU8 totalBitsBlue = CountTotalBitsSetTo1(m_surfaceDesc.ddpfPixelFormat.dwBBitMask); for (MxS32 i = 0; i < 256; i++) { - m_16bitPal[i] = (((palette[i].peRed >> (8 - totalBitsRed & 0x1f)) << (contiguousBitsRed & 0x1f))) | - (((palette[i].peGreen >> (8 - totalBitsGreen & 0x1f)) << (contiguousBitsGreen & 0x1f))) | - (((palette[i].peBlue >> (8 - totalBitsBlue & 0x1f)) << (contiguousBitsBlue & 0x1f))); + m_16bitPal[i] = (((palette[i].peRed >> ((8 - totalBitsRed) & 0x1f)) << (contiguousBitsRed & 0x1f))) | + (((palette[i].peGreen >> ((8 - totalBitsGreen) & 0x1f)) << (contiguousBitsGreen & 0x1f))) | + (((palette[i].peBlue >> ((8 - totalBitsBlue) & 0x1f)) << (contiguousBitsBlue & 0x1f))); } } } @@ -528,8 +548,9 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p // FUNCTION: LEGO1 0x100bbc10 void MxDisplaySurface::GetDC(HDC* p_hdc) { - if (this->m_ddSurface2 && !this->m_ddSurface2->GetDC(p_hdc)) + if (this->m_ddSurface2 && !this->m_ddSurface2->GetDC(p_hdc)) { return; + } *p_hdc = NULL; } @@ -537,8 +558,9 @@ void MxDisplaySurface::GetDC(HDC* p_hdc) // FUNCTION: LEGO1 0x100bbc40 void MxDisplaySurface::ReleaseDC(HDC p_hdc) { - if (this->m_ddSurface2 && p_hdc) + if (this->m_ddSurface2 && p_hdc) { this->m_ddSurface2->ReleaseDC(p_hdc); + } } // FUNCTION: LEGO1 0x100bbc60 @@ -557,8 +579,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); - if (draw->GetDisplayMode(&ddsd)) + if (draw->GetDisplayMode(&ddsd)) { return NULL; + } ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; ddsd.dwWidth = p_bitmap->GetBmiWidth(); @@ -579,8 +602,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( surface = NULL; } } - else + else { surface = NULL; + } } if (surface) { @@ -604,8 +628,9 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( // TODO: Probably p_bitmap->GetAdjustedStride() MxS32 rowSeek = p_bitmap->GetBmiStride(); - if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0) + if (p_bitmap->GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap->GetBmiHeight() >= 0) { rowSeek = -rowSeek; + } MxLong newPitch = ddsd.lPitch; switch (ddsd.ddpfPixelFormat.dwRGBBitCount) { @@ -714,15 +739,17 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK) + if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK) { goto done; + } } memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); - if (newSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) != DD_OK) + if (newSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) != DD_OK) { goto done; + } else { MxU16* surface = (MxU16*) ddsd.lpSurface; MxLong pitch = ddsd.lPitch; @@ -732,10 +759,12 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() MxU16* surface2 = surface; for (MxS32 y = 0; y < 16; y++) { if ((y > 10 || x) && (x > 10 || y) && x + y != 10) { - if (x + y > 10) + if (x + y > 10) { *surface2 = 31775; - else + } + else { *surface2 = -1; + } } else { *surface2 = 0; diff --git a/LEGO1/omni/src/video/mxflcpresenter.cpp b/LEGO1/omni/src/video/mxflcpresenter.cpp index ff82aa60..5cc4ee6a 100644 --- a/LEGO1/omni/src/video/mxflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxflcpresenter.cpp @@ -35,8 +35,9 @@ void MxFlcPresenter::LoadHeader(MxStreamChunk* p_chunk) // FUNCTION: LEGO1 0x100b34d0 void MxFlcPresenter::CreateBitmap() { - if (m_bitmap) + if (m_bitmap) { delete m_bitmap; + } m_bitmap = new MxBitmap; m_bitmap->SetSize(m_flcHeader->width, m_flcHeader->height, NULL, FALSE); @@ -62,8 +63,9 @@ void MxFlcPresenter::LoadFrame(MxStreamChunk* p_chunk) &decodedColorMap ); - if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && decodedColorMap) + if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && decodedColorMap) { RealizePalette(); + } for (MxS32 i = 0; i < rectCount; i++) { MxRect32 rect(rects[i]); diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index cc36792d..6d70842c 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -31,8 +31,9 @@ void MxLoopingFlcPresenter::Destroy(MxBool p_fromDestructor) Init(); m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxFlcPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x100b4470 @@ -40,8 +41,9 @@ void MxLoopingFlcPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::c_end) + if (chunk->GetFlags() & MxDSChunk::c_end) { ProgressTickleState(e_repeating); + } else { LoadFrame(chunk); LoopChunk(chunk); @@ -54,8 +56,9 @@ void MxLoopingFlcPresenter::NextFrame() // FUNCTION: LEGO1 0x100b44c0 void MxLoopingFlcPresenter::VTable0x88() { - if (m_action->GetDuration() < m_elapsedDuration) + if (m_action->GetDuration() < m_elapsedDuration) { ProgressTickleState(e_unk5); + } else { MxStreamChunk* chunk; m_loopingChunkCursor->Current(chunk); @@ -81,8 +84,9 @@ void MxLoopingFlcPresenter::RepeatingTickle() time += m_flcHeader->speed; cursor.Reset(); - while (cursor.Next(chunk)) + while (cursor.Next(chunk)) { chunk->SetTime(chunk->GetTime() + time); + } m_loopingChunkCursor->Next(); } @@ -90,15 +94,17 @@ void MxLoopingFlcPresenter::RepeatingTickle() MxStreamChunk* chunk; m_loopingChunkCursor->Current(chunk); - if (m_action->GetElapsedTime() < chunk->GetTime()) + if (m_action->GetElapsedTime() < chunk->GetTime()) { break; + } VTable0x88(); m_loopingChunkCursor->Next(chunk); - if (m_currentTickleState != e_repeating) + if (m_currentTickleState != e_repeating) { break; + } } } @@ -114,8 +120,9 @@ MxResult MxLoopingFlcPresenter::AddToManager() result = SUCCESS; } - if (locked) + if (locked) { m_criticalSection.Leave(); + } return result; } diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index 86b93544..2f4a5087 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -32,8 +32,9 @@ void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor) Init(); m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxSmkPresenter::Destroy(); + } } // FUNCTION: LEGO1 0x100b4a00 @@ -51,8 +52,9 @@ void MxLoopingSmkPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::c_end) + if (chunk->GetFlags() & MxDSChunk::c_end) { ProgressTickleState(e_repeating); + } else { LoadFrame(chunk); LoopChunk(chunk); @@ -65,8 +67,9 @@ void MxLoopingSmkPresenter::NextFrame() // FUNCTION: LEGO1 0x100b4a90 void MxLoopingSmkPresenter::VTable0x8c() { - if (m_action->GetDuration() < m_elapsedDuration) + if (m_action->GetDuration() < m_elapsedDuration) { ProgressTickleState(e_unk5); + } else { MxStreamChunk* chunk; m_loopingChunkCursor->Current(chunk); @@ -92,8 +95,9 @@ void MxLoopingSmkPresenter::RepeatingTickle() time += 1000 / ((MxDSMediaAction*) m_action)->GetFramesPerSecond(); cursor.Reset(); - while (cursor.Next(chunk)) + while (cursor.Next(chunk)) { chunk->SetTime(chunk->GetTime() + time); + } m_loopingChunkCursor->Next(); } @@ -101,15 +105,17 @@ void MxLoopingSmkPresenter::RepeatingTickle() MxStreamChunk* chunk; m_loopingChunkCursor->Current(chunk); - if (m_action->GetElapsedTime() < chunk->GetTime()) + if (m_action->GetElapsedTime() < chunk->GetTime()) { break; + } VTable0x8c(); m_loopingChunkCursor->Next(chunk); - if (m_currentTickleState != e_repeating) + if (m_currentTickleState != e_repeating) { break; + } } } diff --git a/LEGO1/omni/src/video/mxpalette.cpp b/LEGO1/omni/src/video/mxpalette.cpp index 8431fb76..76b9a779 100644 --- a/LEGO1/omni/src/video/mxpalette.cpp +++ b/LEGO1/omni/src/video/mxpalette.cpp @@ -110,18 +110,23 @@ LPDIRECTDRAWPALETTE MxPalette::CreateNativePalette() { MxS32 i; if (this->m_palette == NULL) { - for (i = 0; i < 10; i++) + for (i = 0; i < 10; i++) { this->m_entries[i].peFlags = 0x80; - for (i = 10; i < 136; i++) + } + for (i = 10; i < 136; i++) { this->m_entries[i].peFlags = 0x44; - for (i = 136; i < 140; i++) + } + for (i = 136; i < 140; i++) { this->m_entries[i].peFlags = 0x84; + } this->m_entries[140].peFlags = 0x84; this->m_entries[141].peFlags = 0x44; - for (i = 142; i < 246; i++) + for (i = 142; i < 246; i++) { this->m_entries[i].peFlags = 0x84; - for (i = 246; i < 256; i++) + } + for (i = 246; i < 256; i++) { this->m_entries[i].peFlags = 0x80; + } if (MVideoManager() && MVideoManager()->GetDirectDraw()) { MVideoManager()->GetDirectDraw()->CreatePalette(4, this->m_entries, &this->m_palette, NULL); @@ -154,8 +159,9 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries) MxResult status = SUCCESS; if (this->m_palette) { - for (i = 0; i < 10; i++) + for (i = 0; i < 10; i++) { this->m_entries[i].peFlags = 0x80; + } for (i = 10; i < 136; i++) { this->m_entries[i].peFlags = 68; this->m_entries[i].peRed = p_entries[i].peRed; @@ -186,11 +192,13 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries) this->m_entries[i].peBlue = p_entries[i].peBlue; } - for (i = 246; i < 256; i++) + for (i = 246; i < 256; i++) { this->m_entries[i].peFlags = 0x80; + } - if (this->m_palette->SetEntries(0, 0, 256, this->m_entries)) + if (this->m_palette->SetEntries(0, 0, 256, this->m_entries)) { status = FAILURE; + } } return status; @@ -222,12 +230,15 @@ void MxPalette::Detach() MxBool MxPalette::operator==(MxPalette& p_other) { for (MxS32 i = 0; i < 256; i++) { - if (this->m_entries[i].peRed != p_other.m_entries[i].peRed) + if (this->m_entries[i].peRed != p_other.m_entries[i].peRed) { return FALSE; - if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen) + } + if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen) { return FALSE; - if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue) + } + if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue) { return FALSE; + } } return TRUE; } diff --git a/LEGO1/omni/src/video/mxregion.cpp b/LEGO1/omni/src/video/mxregion.cpp index ea7fab55..ca3698e9 100644 --- a/LEGO1/omni/src/video/mxregion.cpp +++ b/LEGO1/omni/src/video/mxregion.cpp @@ -22,8 +22,9 @@ MxBool MxRegion::VTable0x20() // FUNCTION: LEGO1 0x100c3690 MxRegion::~MxRegion() { - if (m_list) + if (m_list) { delete m_list; + } } // FUNCTION: LEGO1 0x100c3700 @@ -88,17 +89,20 @@ void MxRegion::VTable0x18(MxRect32& p_rect) // FUNCTION: LEGO1 0x100c3e20 MxBool MxRegion::VTable0x1c(MxRect32& p_rect) { - if (!m_rect.IntersectsWith(p_rect)) + if (!m_rect.IntersectsWith(p_rect)) { return FALSE; + } MxRegionTopBottomListCursor cursor(m_list); MxRegionTopBottom* topBottom; while (cursor.Next(topBottom)) { - if (topBottom->GetTop() >= p_rect.GetBottom()) + if (topBottom->GetTop() >= p_rect.GetBottom()) { return FALSE; - if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->FUN_100c57b0(p_rect)) + } + if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->FUN_100c57b0(p_rect)) { return TRUE; + } } return FALSE; @@ -130,27 +134,31 @@ void MxRegionTopBottom::FUN_100c5280(MxS32 p_left, MxS32 p_right) MxRegionLeftRightListCursor b(m_leftRightList); MxRegionLeftRight* leftRight; - while (a.Next(leftRight) && leftRight->GetRight() < p_left) + while (a.Next(leftRight) && leftRight->GetRight() < p_left) { ; + } if (!a.HasMatch()) { MxRegionLeftRight* copy = new MxRegionLeftRight(p_left, p_right); m_leftRightList->Append(copy); } else { - if (p_left > leftRight->GetLeft()) + if (p_left > leftRight->GetLeft()) { p_left = leftRight->GetLeft(); + } while (leftRight->GetLeft() < p_right) { - if (p_right < leftRight->GetRight()) + if (p_right < leftRight->GetRight()) { p_right = leftRight->GetRight(); + } b = a; b.Next(); a.Destroy(); - if (!b.Current(leftRight)) + if (!b.Current(leftRight)) { break; + } a = b; } @@ -174,8 +182,9 @@ MxRegionTopBottom* MxRegionTopBottom::Clone() MxRegionLeftRightListCursor cursor(m_leftRightList); MxRegionLeftRight* leftRight; - while (cursor.Next(leftRight)) + while (cursor.Next(leftRight)) { clone->m_leftRightList->Append(leftRight->Clone()); + } return clone; } @@ -187,10 +196,12 @@ MxBool MxRegionTopBottom::FUN_100c57b0(MxRect32& p_rect) MxRegionLeftRight* leftRight; while (cursor.Next(leftRight)) { - if (p_rect.GetRight() <= leftRight->GetLeft()) + if (p_rect.GetRight() <= leftRight->GetLeft()) { return FALSE; - if (leftRight->GetRight() > p_rect.GetLeft()) + } + if (leftRight->GetRight() > p_rect.GetLeft()) { return TRUE; + } } return FALSE; diff --git a/LEGO1/omni/src/video/mxregioncursor.cpp b/LEGO1/omni/src/video/mxregioncursor.cpp index 89c90403..6b74ee3f 100644 --- a/LEGO1/omni/src/video/mxregioncursor.cpp +++ b/LEGO1/omni/src/video/mxregioncursor.cpp @@ -14,14 +14,17 @@ MxRegionCursor::MxRegionCursor(MxRegion* p_region) // FUNCTION: LEGO1 0x100c40b0 MxRegionCursor::~MxRegionCursor() { - if (m_rect) + if (m_rect) { delete m_rect; + } - if (m_topBottomCursor) + if (m_topBottomCursor) { delete m_topBottomCursor; + } - if (m_leftRightCursor) + if (m_leftRightCursor) { delete m_leftRightCursor; + } } // FUNCTION: LEGO1 0x100c4140 @@ -38,8 +41,9 @@ MxRect32* MxRegionCursor::VTable0x18() UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); } - else + else { Reset(); + } return m_rect; } @@ -58,8 +62,9 @@ MxRect32* MxRegionCursor::VTable0x20() UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); } - else + else { Reset(); + } return m_rect; } @@ -144,11 +149,13 @@ MxRect32* MxRegionCursor::VTable0x24(MxRect32& p_rect) UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); m_rect->Intersect(p_rect); } - else + else { FUN_100c4a20(p_rect); + } } - else + else { FUN_100c4a20(p_rect); + } return m_rect; } @@ -167,11 +174,13 @@ MxRect32* MxRegionCursor::VTable0x2c(MxRect32& p_rect) UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); m_rect->Intersect(p_rect); } - else + else { FUN_100c4b50(p_rect); + } } - else + else { FUN_100c4b50(p_rect); + } return m_rect; } @@ -195,8 +204,9 @@ void MxRegionCursor::Reset() // FUNCTION: LEGO1 0x100c46c0 void MxRegionCursor::FUN_100c46c0(MxRegionLeftRightList& p_leftRightList) { - if (m_leftRightCursor) + if (m_leftRightCursor) { delete m_leftRightCursor; + } m_leftRightCursor = new MxRegionLeftRightListCursor(&p_leftRightList); } @@ -204,8 +214,9 @@ void MxRegionCursor::FUN_100c46c0(MxRegionLeftRightList& p_leftRightList) // FUNCTION: LEGO1 0x100c4980 void MxRegionCursor::UpdateRect(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom) { - if (!m_rect) + if (!m_rect) { m_rect = new MxRect32; + } m_rect->SetLeft(p_left); m_rect->SetTop(p_top); @@ -228,8 +239,9 @@ void MxRegionCursor::FUN_100c4a20(MxRect32& p_rect) MxRegionLeftRight* leftRight; while (m_leftRightCursor->Next(leftRight)) { - if (p_rect.GetRight() <= leftRight->GetLeft()) + if (p_rect.GetRight() <= leftRight->GetLeft()) { break; + } if (p_rect.GetLeft() < leftRight->GetRight()) { UpdateRect( @@ -263,8 +275,9 @@ void MxRegionCursor::FUN_100c4b50(MxRect32& p_rect) MxRegionLeftRight* leftRight; while (m_leftRightCursor->Prev(leftRight)) { - if (leftRight->GetRight() <= p_rect.GetLeft()) + if (leftRight->GetRight() <= p_rect.GetLeft()) { break; + } if (leftRight->GetLeft() < p_rect.GetRight()) { UpdateRect( diff --git a/LEGO1/omni/src/video/mxsmack.cpp b/LEGO1/omni/src/video/mxsmack.cpp index 551b87c9..8d1835fe 100644 --- a/LEGO1/omni/src/video/mxsmack.cpp +++ b/LEGO1/omni/src/video/mxsmack.cpp @@ -40,8 +40,9 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) // TODO for (MxU32 i = 0; i < FRAME_COUNT(p_mxSmack); i++) { - if (p_mxSmack->m_maxFrameSize < frameSizes[i]) + if (p_mxSmack->m_maxFrameSize < frameSizes[i]) { p_mxSmack->m_maxFrameSize = frameSizes[i]; + } } frameTypes = new MxU8[FRAME_COUNT(p_mxSmack)]; @@ -54,8 +55,9 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) p_data += FRAME_COUNT(p_mxSmack); MxU32 treeSize = p_mxSmack->m_smackTag.tablesize + 0x1000; - if (treeSize <= 0x2000) + if (treeSize <= 0x2000) { treeSize = 0x2000; + } huffmanTrees = new MxU8[treeSize]; @@ -127,16 +129,21 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) // FUNCTION: LEGO1 0x100c5d40 void MxSmack::Destroy(MxSmack* p_mxSmack) { - if (p_mxSmack->m_frameSizes) + if (p_mxSmack->m_frameSizes) { delete[] p_mxSmack->m_frameSizes; - if (p_mxSmack->m_frameTypes) + } + if (p_mxSmack->m_frameTypes) { delete[] p_mxSmack->m_frameTypes; - if (p_mxSmack->m_huffmanTrees) + } + if (p_mxSmack->m_huffmanTrees) { delete[] p_mxSmack->m_huffmanTrees; - if (p_mxSmack->m_huffmanTables) + } + if (p_mxSmack->m_huffmanTables) { delete[] p_mxSmack->m_huffmanTables; - if (p_mxSmack->m_unk0x6b4) + } + if (p_mxSmack->m_unk0x6b4) { delete[] p_mxSmack->m_unk0x6b4; + } } // This should be refactored to somewhere else @@ -223,12 +230,14 @@ MxBool MxSmack::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect { u32 left, bottom, top, right; - if (!*p_und) + if (!*p_und) { return FALSE; + } if (*p_und == 1) { - if (!SmackGetRect(p_unk0x6b4, p_smackRect)) + if (!SmackGetRect(p_unk0x6b4, p_smackRect)) { return FALSE; + } *p_und = 2; } @@ -238,10 +247,12 @@ MxBool MxSmack::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect bottom = p_smackRect[3] + p_smackRect[1]; while (SmackGetRect(p_unk0x6b4, p_smackRect)) { - if (left > p_smackRect[0]) + if (left > p_smackRect[0]) { left = p_smackRect[0]; - if (right < p_smackRect[0] + p_smackRect[2]) + } + if (right < p_smackRect[0] + p_smackRect[2]) { right = p_smackRect[0] + p_smackRect[2]; + } bottom = p_smackRect[1] + p_smackRect[3]; } diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index 1779fe82..8bb2ed6f 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -51,8 +51,9 @@ void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk) // FUNCTION: LEGO1 0x100b3960 void MxSmkPresenter::CreateBitmap() { - if (m_bitmap) + if (m_bitmap) { delete m_bitmap; + } m_bitmap = new MxBitmap; m_bitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE); @@ -72,8 +73,9 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) MxRectList list(TRUE); MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, &list); - if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) + if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) { RealizePalette(); + } MxRect32 invalidateRect; MxRectListCursor cursor(&list); @@ -91,8 +93,9 @@ void MxSmkPresenter::VTable0x88() { if ((m_mxSmack.m_smackTag.SmackerType & 1) != 0) { MxU32 und = (m_currentFrame % m_mxSmack.m_smackTag.Frames); - if (1 < m_currentFrame && und == 1) + if (1 < m_currentFrame && und == 1) { m_currentFrame = 1; + } } else { if (m_mxSmack.m_smackTag.Frames == m_currentFrame) { diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 83b1a87e..ca749578 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -19,21 +19,24 @@ void MxStillPresenter::Destroy(MxBool p_fromDestructor) { m_criticalSection.Enter(); - if (m_bitmapInfo) + if (m_bitmapInfo) { delete m_bitmapInfo; + } m_bitmapInfo = NULL; m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxVideoPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x100b9cc0 void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk) { - if (m_bitmapInfo) + if (m_bitmapInfo) { delete m_bitmapInfo; + } MxU8* data = new MxU8[p_chunk->GetLength()]; m_bitmapInfo = (MxBITMAPINFO*) data; @@ -43,8 +46,9 @@ void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk) // FUNCTION: LEGO1 0x100b9d10 void MxStillPresenter::CreateBitmap() { - if (m_bitmap) + if (m_bitmap) { delete m_bitmap; + } m_bitmap = new MxBitmap; m_bitmap->ImportBitmapInfo(m_bitmapInfo); @@ -90,10 +94,12 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk) delete m_bitmap; m_bitmap = NULL; - if (m_unk0x58 && und) + if (m_unk0x58 && und) { SetBit2(TRUE); - else + } + else { SetBit2(FALSE); + } } } @@ -110,8 +116,9 @@ void MxStillPresenter::StartingTickle() { MxVideoPresenter::StartingTickle(); - if (m_currentTickleState == e_streaming && ((MxDSMediaAction*) m_action)->GetPaletteManagement()) + if (m_currentTickleState == e_streaming && ((MxDSMediaAction*) m_action)->GetPaletteManagement()) { RealizePalette(); + } } // FUNCTION: LEGO1 0x100b9f90 @@ -124,8 +131,9 @@ void MxStillPresenter::StreamingTickle() NextFrame(); ProgressTickleState(e_repeating); - if (m_action->GetDuration() == -1 && m_compositePresenter) + if (m_action->GetDuration() == -1 && m_compositePresenter) { m_compositePresenter->VTable0x60(this); + } } } @@ -133,8 +141,9 @@ void MxStillPresenter::StreamingTickle() void MxStillPresenter::RepeatingTickle() { if (m_action->GetDuration() != -1) { - if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) + if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { ProgressTickleState(e_unk5); + } } } @@ -185,13 +194,15 @@ void MxStillPresenter::ParseExtra() { MxPresenter::ParseExtra(); - if (m_action->GetFlags() & MxDSAction::c_bit5) + if (m_action->GetFlags() & MxDSAction::c_bit5) { SetBit3(TRUE); + } MxU32 len = m_action->GetExtraLength(); - if (len == 0) + if (len == 0) { return; + } len &= MAXWORD; @@ -233,15 +244,18 @@ MxStillPresenter* MxStillPresenter::Clone() if (m_bitmap) { presenter->m_bitmap = new MxBitmap; - if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS) + if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS) { goto done; + } } - if (m_unk0x58) + if (m_unk0x58) { presenter->m_unk0x58 = MxDisplaySurface::FUN_100bbfb0(m_unk0x58); + } - if (m_alpha) + if (m_alpha) { presenter->m_alpha = new MxVideoPresenter::AlphaMask(*m_alpha); + } result = SUCCESS; } diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 9a2a6cee..f2c9ddfa 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -42,32 +42,39 @@ void MxVideoManager::Destroy(MxBool p_fromDestructor) m_thread->Terminate(); delete m_thread; } - else + else { TickleManager()->UnregisterClient(this); + } m_criticalSection.Enter(); - if (m_displaySurface) + if (m_displaySurface) { delete m_displaySurface; + } - if (m_region) + if (m_region) { delete m_region; + } - if (m_videoParam.GetPalette()) + if (m_videoParam.GetPalette()) { delete m_videoParam.GetPalette(); + } if (m_unk0x60) { - if (m_pDirectDraw) + if (m_pDirectDraw) { m_pDirectDraw->Release(); - if (m_pDirect3D) + } + if (m_pDirect3D) { m_pDirect3D->Release(); + } } Init(); m_criticalSection.Leave(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaManager::Destroy(); + } } // FUNCTION: LEGO1 0x100be3e0 @@ -85,8 +92,9 @@ void MxVideoManager::UpdateRegion() // FUNCTION: LEGO1 0x100be440 void MxVideoManager::SortPresenterList() { - if (this->m_presenters->GetCount() <= 1) + if (this->m_presenters->GetCount() <= 1) { return; + } MxPresenterListCursor a(this->m_presenters); MxPresenterListCursor b(this->m_presenters); @@ -132,8 +140,9 @@ MxResult MxVideoManager::VTable0x28( m_unk0x60 = FALSE; - if (MxMediaManager::InitPresenters() != SUCCESS) + if (MxMediaManager::InitPresenters() != SUCCESS) { goto done; + } m_criticalSection.Enter(); locked = TRUE; @@ -141,8 +150,9 @@ MxResult MxVideoManager::VTable0x28( m_videoParam = p_videoParam; m_region = new MxRegion(); - if (!m_region) + if (!m_region) { goto done; + } m_pDirectDraw = p_pDirectDraw; m_pDirect3D = p_pDirect3D; @@ -152,15 +162,17 @@ MxResult MxVideoManager::VTable0x28( palette = new MxPalette(); m_videoParam.SetPalette(palette); - if (!palette) + if (!palette) { goto done; + } } else { palette = p_videoParam.GetPalette()->Clone(); m_videoParam.SetPalette(palette); - if (!palette) + if (!palette) { goto done; + } } m_displaySurface = new MxDisplaySurface(); @@ -170,21 +182,25 @@ MxResult MxVideoManager::VTable0x28( if (p_createThread) { m_thread = new MxTickleThread(this, p_frequencyMS); - if (!m_thread || m_thread->Start(0, 0) != SUCCESS) + if (!m_thread || m_thread->Start(0, 0) != SUCCESS) { goto done; + } } - else + else { TickleManager()->RegisterClient(this, p_frequencyMS); + } status = SUCCESS; } done: - if (status != SUCCESS) + if (status != SUCCESS) { Destroy(); + } - if (locked) + if (locked) { m_criticalSection.Leave(); + } return status; } @@ -197,8 +213,9 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, m_unk0x60 = TRUE; - if (MxMediaManager::InitPresenters() != SUCCESS) + if (MxMediaManager::InitPresenters() != SUCCESS) { goto done; + } m_criticalSection.Enter(); locked = TRUE; @@ -206,29 +223,34 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, m_videoParam = p_videoParam; m_region = new MxRegion(); - if (!m_region) + if (!m_region) { goto done; + } - if (DirectDrawCreate(NULL, &m_pDirectDraw, NULL) != DD_OK) + if (DirectDrawCreate(NULL, &m_pDirectDraw, NULL) != DD_OK) { goto done; + } - if (m_pDirectDraw->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DDSCL_NORMAL) != DD_OK) + if (m_pDirectDraw->SetCooperativeLevel(MxOmni::GetInstance()->GetWindowHandle(), DDSCL_NORMAL) != DD_OK) { goto done; + } MxPalette* palette; if (p_videoParam.GetPalette() == NULL) { palette = new MxPalette(); m_videoParam.SetPalette(palette); - if (!palette) + if (!palette) { goto done; + } } else { palette = p_videoParam.GetPalette()->Clone(); m_videoParam.SetPalette(palette); - if (!palette) + if (!palette) { goto done; + } } m_displaySurface = new MxDisplaySurface(); @@ -238,21 +260,25 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, if (p_createThread) { m_thread = new MxTickleThread(this, p_frequencyMS); - if (!m_thread || m_thread->Start(0, 0) != SUCCESS) + if (!m_thread || m_thread->Start(0, 0) != SUCCESS) { goto done; + } } - else + else { TickleManager()->RegisterClient(this, p_frequencyMS); + } status = SUCCESS; } done: - if (status != SUCCESS) + if (status != SUCCESS) { Destroy(); + } - if (locked) + if (locked) { m_criticalSection.Leave(); + } return status; } @@ -268,8 +294,9 @@ void MxVideoManager::InvalidateRect(MxRect32& p_rect) { m_criticalSection.Enter(); - if (m_region) + if (m_region) { m_region->VTable0x18(p_rect); + } m_criticalSection.Leave(); } @@ -284,13 +311,15 @@ MxResult MxVideoManager::Tickle() MxPresenter* presenter; MxPresenterListCursor cursor(this->m_presenters); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->Tickle(); + } cursor.Reset(); - while (cursor.Next(presenter)) + while (cursor.Next(presenter)) { presenter->PutData(); + } UpdateRegion(); m_region->Reset(); diff --git a/LEGO1/omni/src/video/mxvideoparam.cpp b/LEGO1/omni/src/video/mxvideoparam.cpp index cc833727..8e48773f 100644 --- a/LEGO1/omni/src/video/mxvideoparam.cpp +++ b/LEGO1/omni/src/video/mxvideoparam.cpp @@ -46,15 +46,17 @@ MxVideoParam::MxVideoParam(MxVideoParam& p_videoParam) // FUNCTION: LEGO1 0x100bed50 MxVideoParam::~MxVideoParam() { - if (this->m_deviceId != NULL) + if (this->m_deviceId != NULL) { delete[] this->m_deviceId; + } } // FUNCTION: LEGO1 0x100bed70 void MxVideoParam::SetDeviceName(char* p_deviceId) { - if (this->m_deviceId != NULL) + if (this->m_deviceId != NULL) { delete[] this->m_deviceId; + } if (p_deviceId != NULL) { this->m_deviceId = new char[strlen(p_deviceId) + 1]; diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 546b7ea4..dcccf8f6 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -33,10 +33,12 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap) switch (p_bitmap.GetBmiHeader()->biCompression) { case BI_RGB: { - if (p_bitmap.GetBmiHeight() < 0) + if (p_bitmap.GetBmiHeight() < 0) { rowsBeforeTop = 0; - else + } + else { rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1; + } bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop); break; } @@ -44,10 +46,12 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap) bitmapSrcPtr = p_bitmap.GetBitmapData(); break; default: { - if (p_bitmap.GetBmiHeight() < 0) + if (p_bitmap.GetBmiHeight() < 0) { rowsBeforeTop = 0; - else + } + else { rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1; + } bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop); } } @@ -57,8 +61,9 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap) // If this is a bottom-up DIB, we will walk it in reverse. // TODO: Same rounding trick as in MxBitmap MxS32 rowSeek = ((m_width + 3) & -4); - if (p_bitmap.GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap.GetBmiHeight() > 0) + if (p_bitmap.GetBmiHeader()->biCompression != BI_RGB_TOPDOWN && p_bitmap.GetBmiHeight() > 0) { rowSeek = -rowSeek; + } // The actual offset into the m_bitmask array. The two for-loops // are just for counting the pixels. @@ -95,15 +100,17 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxVideoPresenter::AlphaMask& p_alph // FUNCTION: LEGO1 0x100b26d0 MxVideoPresenter::AlphaMask::~AlphaMask() { - if (m_bitmask) + if (m_bitmask) { delete[] m_bitmask; + } } // FUNCTION: LEGO1 0x100b26f0 MxS32 MxVideoPresenter::AlphaMask::IsHit(MxU32 p_x, MxU32 p_y) { - if (p_x >= m_width || p_y >= m_height) + if (p_x >= m_width || p_y >= m_height) { return 0; + } MxS32 pos = p_y * m_width + p_x; return m_bitmask[pos / 8] & (1 << abs(abs(pos) & 7)) ? 1 : 0; @@ -132,8 +139,9 @@ void MxVideoPresenter::Init() // FUNCTION: LEGO1 0x100b27b0 void MxVideoPresenter::Destroy(MxBool p_fromDestructor) { - if (MVideoManager() != NULL) + if (MVideoManager() != NULL) { MVideoManager()->UnregisterPresenter(*this); + } if (m_unk0x58) { m_unk0x58->Release(); @@ -159,8 +167,9 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor) Init(); - if (!p_fromDestructor) + if (!p_fromDestructor) { MxMediaPresenter::Destroy(FALSE); + } } // FUNCTION: LEGO1 0x100b28b0 @@ -183,11 +192,13 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y) { MxDSAction* action = GetAction(); if ((action == NULL) || (((action->GetFlags() & MxDSAction::c_bit11) == 0) && !IsEnabled()) || - (!m_bitmap && !m_alpha)) + (!m_bitmap && !m_alpha)) { return FALSE; + } - if (!m_bitmap) + if (!m_bitmap) { return m_alpha->IsHit(p_x - m_location.GetX(), p_y - m_location.GetY()); + } MxLong heightAbs = m_bitmap->GetBmiHeightAbs(); @@ -197,8 +208,9 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y) MxLong maxY = minY + heightAbs; MxLong maxX = minX + m_bitmap->GetBmiWidth(); - if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY) + if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY) { return FALSE; + } MxU8* pixel; @@ -230,11 +242,13 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y) pixel = m_bitmap->GetBmiStride() * height + m_bitmap->GetBitmapData(); } - if (GetBit4()) + if (GetBit4()) { return (MxBool) *pixel; + } - if ((GetAction()->GetFlags() & MxDSAction::c_bit4) && *pixel == 0) + if ((GetAction()->GetFlags() & MxDSAction::c_bit4) && *pixel == 0) { return FALSE; + } return TRUE; } @@ -242,32 +256,40 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y) inline MxS32 MxVideoPresenter::PrepareRects(MxRect32& p_rectDest, MxRect32& p_rectSrc) { if (p_rectDest.GetTop() > 480 || p_rectDest.GetLeft() > 640 || p_rectSrc.GetTop() > 480 || - p_rectSrc.GetLeft() > 640) + p_rectSrc.GetLeft() > 640) { return -1; + } - if (p_rectDest.GetBottom() > 480) + if (p_rectDest.GetBottom() > 480) { p_rectDest.SetBottom(480); + } - if (p_rectDest.GetRight() > 640) + if (p_rectDest.GetRight() > 640) { p_rectDest.SetRight(640); + } - if (p_rectSrc.GetBottom() > 480) + if (p_rectSrc.GetBottom() > 480) { p_rectSrc.SetBottom(480); + } - if (p_rectSrc.GetRight() > 640) + if (p_rectSrc.GetRight() > 640) { p_rectSrc.SetRight(640); + } MxS32 height = p_rectDest.GetHeight(); - if (height <= 1) + if (height <= 1) { return -1; + } MxS32 width = p_rectDest.GetWidth(); - if (width <= 1) + if (width <= 1) { return -1; + } if (p_rectSrc.GetRight() - width - p_rectSrc.GetLeft() == -1 && - p_rectSrc.GetBottom() - height - p_rectSrc.GetTop() == -1) + p_rectSrc.GetBottom() - height - p_rectSrc.GetTop() == -1) { return 1; + } p_rectSrc.SetRight(p_rectSrc.GetLeft() + width - 1); p_rectSrc.SetBottom(p_rectSrc.GetTop() + height - 1); @@ -325,7 +347,7 @@ void MxVideoPresenter::PutFrame() MxRegionCursor cursor(region); MxRect32* regionRect; - while (regionRect = cursor.VTable0x24(rect)) { + while ((regionRect = cursor.VTable0x24(rect))) { if (regionRect->GetWidth() >= 1 && regionRect->GetHeight() >= 1) { if (m_unk0x58) { rectSrc.SetLeft(regionRect->GetLeft() - m_location.GetX()); @@ -341,8 +363,9 @@ void MxVideoPresenter::PutFrame() if (m_action->GetFlags() & MxDSAction::c_bit4) { if (m_unk0x58) { - if (PrepareRects(rectDest, rectSrc) >= 0) + if (PrepareRects(rectDest, rectSrc) >= 0) { ddSurface->Blt((LPRECT) &rectDest, m_unk0x58, (LPRECT) &rectSrc, DDBLT_KEYSRC, NULL); + } } else { displaySurface->VTable0x30( @@ -358,8 +381,9 @@ void MxVideoPresenter::PutFrame() } } else if (m_unk0x58) { - if (PrepareRects(rectDest, rectSrc) >= 0) + if (PrepareRects(rectDest, rectSrc) >= 0) { ddSurface->Blt((LPRECT) &rectDest, m_unk0x58, (LPRECT) &rectSrc, 0, NULL); + } } else { displaySurface->VTable0x28( @@ -405,8 +429,9 @@ void MxVideoPresenter::StartingTickle() void MxVideoPresenter::StreamingTickle() { if (m_action->GetFlags() & MxDSAction::c_bit10) { - if (!m_currentChunk) + if (!m_currentChunk) { MxMediaPresenter::StreamingTickle(); + } if (m_currentChunk) { LoadFrame(m_currentChunk); @@ -418,24 +443,28 @@ void MxVideoPresenter::StreamingTickle() if (!m_currentChunk) { MxMediaPresenter::StreamingTickle(); - if (!m_currentChunk) + if (!m_currentChunk) { break; + } } - if (m_action->GetElapsedTime() < m_currentChunk->GetTime()) + if (m_action->GetElapsedTime() < m_currentChunk->GetTime()) { break; + } LoadFrame(m_currentChunk); m_subscriber->DestroyChunk(m_currentChunk); m_currentChunk = NULL; SetBit0(TRUE); - if (m_currentTickleState != e_streaming) + if (m_currentTickleState != e_streaming) { break; + } } - if (GetBit0()) + if (GetBit0()) { m_unk0x5c = 5; + } } } @@ -444,8 +473,9 @@ void MxVideoPresenter::RepeatingTickle() { if (IsEnabled()) { if (m_action->GetFlags() & MxDSAction::c_bit10) { - if (!m_currentChunk) + if (!m_currentChunk) { MxMediaPresenter::RepeatingTickle(); + } if (m_currentChunk) { LoadFrame(m_currentChunk); @@ -457,23 +487,27 @@ void MxVideoPresenter::RepeatingTickle() if (!m_currentChunk) { MxMediaPresenter::RepeatingTickle(); - if (!m_currentChunk) + if (!m_currentChunk) { break; + } } - if (m_action->GetElapsedTime() % m_action->GetLoopCount() < m_currentChunk->GetTime()) + if (m_action->GetElapsedTime() % m_action->GetLoopCount() < m_currentChunk->GetTime()) { break; + } LoadFrame(m_currentChunk); m_currentChunk = NULL; SetBit0(TRUE); - if (m_currentTickleState != e_repeating) + if (m_currentTickleState != e_repeating) { break; + } } - if (GetBit0()) + if (GetBit0()) { m_unk0x5c = 5; + } } } } @@ -485,14 +519,17 @@ void MxVideoPresenter::Unk5Tickle() if (sustainTime != -1) { if (sustainTime) { - if (m_unk0x60 == -1) + if (m_unk0x60 == -1) { m_unk0x60 = m_action->GetElapsedTime(); + } - if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) + if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) { ProgressTickleState(e_done); + } } - else + else { ProgressTickleState(e_done); + } } } @@ -534,8 +571,9 @@ MxResult MxVideoPresenter::PutData() { MxAutoLocker lock(&m_criticalSection); - if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5) + if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5) { PutFrame(); + } return SUCCESS; } diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index edca5395..266b2fa6 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -64,8 +64,9 @@ class Matrix4 { // FUNCTION: LEGO1 0x10002430 virtual Matrix4& operator+=(float (*p_data)[4]) { - for (int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { ((float*) m_data)[i] += ((float*) p_data)[i]; + } return *this; } // vtable+0x2c diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 4f48c333..4a2c979b 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -53,11 +53,12 @@ void OrientableROI::UpdateWorldData(const MxMatrix& p_transform) UpdateWorldVelocity(); // iterate over comps - if (m_comp) + if (m_comp) { for (CompoundObject::iterator iter = m_comp->begin(); !(iter == m_comp->end()); iter++) { ROI* child = *iter; static_cast(child)->UpdateWorldData(p_transform); } + } } // FUNCTION: LEGO1 0x100a5a50 diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index f218cdf4..005ec4dc 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -16,9 +16,9 @@ class OrientableROI : public ROI { OrientableROI(); - virtual const float* GetWorldVelocity() const override; // vtable+0x08 - virtual const BoundingBox& GetWorldBoundingBox() const override; // vtable+0x0c - virtual const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10 + const float* GetWorldVelocity() const override; // vtable+0x08 + const BoundingBox& GetWorldBoundingBox() const override; // vtable+0x0c + const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10 // FUNCTION: LEGO1 0x100a5db0 virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14 virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18 diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 91403ee8..a28a9874 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -192,7 +192,7 @@ class Vector3 : public Vector2 { // Vector2 overrides // FUNCTION: LEGO1 0x10003a60 - virtual void AddImpl(float* p_value) override + void AddImpl(float* p_value) override { m_data[0] += p_value[0]; m_data[1] += p_value[1]; @@ -200,7 +200,7 @@ class Vector3 : public Vector2 { } // vtable+0x04 // FUNCTION: LEGO1 0x10003a90 - virtual void AddImpl(float p_value) override + void AddImpl(float p_value) override { m_data[0] += p_value; m_data[1] += p_value; @@ -208,7 +208,7 @@ class Vector3 : public Vector2 { } // vtable+0x00 // FUNCTION: LEGO1 0x10003ac0 - virtual void SubImpl(float* p_value) override + void SubImpl(float* p_value) override { m_data[0] -= p_value[0]; m_data[1] -= p_value[1]; @@ -216,7 +216,7 @@ class Vector3 : public Vector2 { } // vtable+0x08 // FUNCTION: LEGO1 0x10003b20 - virtual void MulScalarImpl(float* p_value) override + void MulScalarImpl(float* p_value) override { m_data[0] *= *p_value; m_data[1] *= *p_value; @@ -224,7 +224,7 @@ class Vector3 : public Vector2 { } // vtable+0x0c // FUNCTION: LEGO1 0x10003af0 - virtual void MulVectorImpl(float* p_value) override + void MulVectorImpl(float* p_value) override { m_data[0] *= p_value[0]; m_data[1] *= p_value[1]; @@ -232,7 +232,7 @@ class Vector3 : public Vector2 { } // vtable+0x10 // FUNCTION: LEGO1 0x10003b50 - virtual void DivScalarImpl(float* p_value) override + void DivScalarImpl(float* p_value) override { m_data[0] /= *p_value; m_data[1] /= *p_value; @@ -240,19 +240,19 @@ class Vector3 : public Vector2 { } // vtable+0x14 // FUNCTION: LEGO1 0x10003b80 - virtual float DotImpl(float* p_a, float* p_b) const override + float DotImpl(float* p_a, float* p_b) const override { return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1]; } // vtable+0x18 // FUNCTION: LEGO1 0x10003ba0 - virtual void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 3); } // vtable+0x20 + void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 3); } // vtable+0x20 // FUNCTION: LEGO1 0x10003bc0 - virtual void Clear() override { memset(m_data, 0, sizeof(float) * 3); } // vtable+0x2c + void Clear() override { memset(m_data, 0, sizeof(float) * 3); } // vtable+0x2c // FUNCTION: LEGO1 0x10003bd0 - virtual float LenSquared() const override + float LenSquared() const override { return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2]; } // vtable+0x40 @@ -289,7 +289,7 @@ class Vector4 : public Vector3 { // Vector3 overrides // FUNCTION: LEGO1 0x10002870 - virtual void AddImpl(float* p_value) override + void AddImpl(float* p_value) override { m_data[0] += p_value[0]; m_data[1] += p_value[1]; @@ -298,7 +298,7 @@ class Vector4 : public Vector3 { } // vtable+0x04 // FUNCTION: LEGO1 0x100028b0 - virtual void AddImpl(float p_value) override + void AddImpl(float p_value) override { m_data[0] += p_value; m_data[1] += p_value; @@ -307,7 +307,7 @@ class Vector4 : public Vector3 { } // vtable+0x00 // FUNCTION: LEGO1 0x100028f0 - virtual void SubImpl(float* p_value) override + void SubImpl(float* p_value) override { m_data[0] -= p_value[0]; m_data[1] -= p_value[1]; @@ -316,7 +316,7 @@ class Vector4 : public Vector3 { } // vtable+0x08 // FUNCTION: LEGO1 0x10002970 - virtual void MulScalarImpl(float* p_value) override + void MulScalarImpl(float* p_value) override { m_data[0] *= *p_value; m_data[1] *= *p_value; @@ -325,7 +325,7 @@ class Vector4 : public Vector3 { } // vtable+0x0c // FUNCTION: LEGO1 0x10002930 - virtual void MulVectorImpl(float* p_value) override + void MulVectorImpl(float* p_value) override { m_data[0] *= p_value[0]; m_data[1] *= p_value[1]; @@ -334,7 +334,7 @@ class Vector4 : public Vector3 { } // vtable+0x10 // FUNCTION: LEGO1 0x100029b0 - virtual void DivScalarImpl(float* p_value) override + void DivScalarImpl(float* p_value) override { m_data[0] /= *p_value; m_data[1] /= *p_value; @@ -343,25 +343,25 @@ class Vector4 : public Vector3 { } // vtable+0x14 // FUNCTION: LEGO1 0x100029f0 - virtual float DotImpl(float* p_a, float* p_b) const override + float DotImpl(float* p_a, float* p_b) const override { return p_a[0] * p_b[0] + p_a[2] * p_b[2] + (p_a[1] * p_b[1] + p_a[3] * p_b[3]); } // vtable+0x18 // FUNCTION: LEGO1 0x10002a20 - virtual void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 4); } // vtable+0x20 + void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 4); } // vtable+0x20 // FUNCTION: LEGO1 0x10002b00 - virtual void Clear() override { memset(m_data, 0, sizeof(float) * 4); } // vtable+0x2c + void Clear() override { memset(m_data, 0, sizeof(float) * 4); } // vtable+0x2c // FUNCTION: LEGO1 0x10002b20 - virtual float LenSquared() const override + float LenSquared() const override { return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2] + m_data[3] * m_data[3]; } // vtable+0x40 // FUNCTION: LEGO1 0x10002b40 - virtual void EqualsScalar(float* p_value) override + void EqualsScalar(float* p_value) override { m_data[0] = *p_value; m_data[1] = *p_value; diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index 002ee7e9..d1e2e7fc 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -40,16 +40,16 @@ class UnkImpl; class RendererImpl : public Renderer { public: RendererImpl() : m_data(0) {} - ~RendererImpl() { Destroy(); } + ~RendererImpl() override { Destroy(); } - virtual void* ImplementationDataPtr() override; + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Device* CreateDevice(const DeviceDirectDrawCreateData&) override; - virtual Device* CreateDevice(const DeviceDirect3DCreateData&) override; + Device* CreateDevice(const DeviceDirectDrawCreateData&) override; + Device* CreateDevice(const DeviceDirect3DCreateData&) override; // vtable+0x10 - virtual View* CreateView( + View* CreateView( const Device*, const Camera*, unsigned long x, @@ -57,13 +57,13 @@ class RendererImpl : public Renderer { unsigned long width, unsigned long height ) override; - virtual Camera* CreateCamera() override; - virtual Light* CreateLight(LightType, float r, float g, float b) override; - virtual Group* CreateGroup(const Group* pParent) override; + Camera* CreateCamera() override; + Light* CreateLight(LightType, float r, float g, float b) override; + Group* CreateGroup(const Group* pParent) override; // vtable+0x20 - virtual Unk* CreateUnk() override; - virtual Texture* CreateTexture( + Unk* CreateUnk() override; + Texture* CreateTexture( int width, int height, int bitsPerTexel, @@ -72,12 +72,12 @@ class RendererImpl : public Renderer { int paletteEntryCount, const PaletteEntry* pEntries ) override; - virtual Texture* CreateTexture() override; + Texture* CreateTexture() override; - virtual Result SetTextureDefaultShadeCount(unsigned long) override; + Result SetTextureDefaultShadeCount(unsigned long) override; // vtable+0x30 - virtual Result SetTextureDefaultColorCount(unsigned long) override; + Result SetTextureDefaultColorCount(unsigned long) override; public: inline Result Create(); @@ -110,7 +110,7 @@ void RendererImpl::Destroy() class DeviceImpl : public Device { public: DeviceImpl() : m_data(0) {} - ~DeviceImpl() + ~DeviceImpl() override { if (m_data) { m_data->Release(); @@ -118,22 +118,22 @@ class DeviceImpl : public Device { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual unsigned long GetWidth(); - virtual unsigned long GetHeight(); + unsigned long GetWidth() override; + unsigned long GetHeight() override; // vtable+0x10 - virtual Result SetColorModel(ColorModel); - virtual Result SetShadingModel(ShadingModel); - virtual Result SetShadeCount(unsigned long); - virtual Result SetDither(int); + Result SetColorModel(ColorModel) override; + Result SetShadingModel(ShadingModel) override; + Result SetShadeCount(unsigned long) override; + Result SetDither(int) override; // vtable+0x20 - virtual Result Update(); - virtual void InitFromD3DDevice(Device*); - virtual void InitFromWindowsDevice(Device*); + Result Update() override; + void InitFromD3DDevice(Device*) override; + void InitFromWindowsDevice(Device*) override; inline IDirect3DRMDevice2* ImplementationData() const { return m_data; } @@ -147,7 +147,7 @@ class DeviceImpl : public Device { class ViewImpl : public View { public: ViewImpl() : m_data(0) {} - ~ViewImpl() + ~ViewImpl() override { if (m_data) { m_data->Release(); @@ -155,35 +155,35 @@ class ViewImpl : public View { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result Add(const Light*); - virtual Result Remove(const Light*); + Result Add(const Light*) override; + Result Remove(const Light*) override; // vtable+0x10 - virtual Result SetCamera(const Camera*); - virtual Result SetProjection(ProjectionType); - virtual Result SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees); - virtual Result SetBackgroundColor(float r, float g, float b); + Result SetCamera(const Camera*) override; + Result SetProjection(ProjectionType) override; + Result SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees) override; + Result SetBackgroundColor(float r, float g, float b) override; // vtable+0x20 - virtual Result GetBackgroundColor(float* r, float* g, float* b); - virtual Result Clear(); - virtual Result Render(const Light*); - virtual Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height); + Result GetBackgroundColor(float* r, float* g, float* b) override; + Result Clear() override; + Result Render(const Light*) override; + Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) override; // vtable+0x30 - virtual Result TransformWorldToScreen(const float world[3], float screen[4]); - virtual Result TransformScreenToWorld(const float screen[4], float world[3]); - virtual Result Pick( + Result TransformWorldToScreen(const float world[3], float screen[4]) override; + Result TransformScreenToWorld(const float screen[4], float world[3]) override; + Result Pick( unsigned long x, unsigned long y, const Group** ppGroupsToPickFrom, int groupsToPickFromCount, const Group**& rppPickedGroups, int& rPickedGroupCount - ); + ) override; inline IDirect3DRMViewport* ImplementationData() const { return m_data; } @@ -199,7 +199,7 @@ class ViewImpl : public View { class CameraImpl : public Camera { public: CameraImpl() : m_data(0) {} - ~CameraImpl() + ~CameraImpl() override { if (m_data) { m_data->Release(); @@ -207,10 +207,10 @@ class CameraImpl : public Camera { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetTransformation(FloatMatrix4&); + Result SetTransformation(FloatMatrix4&) override; inline IDirect3DRMFrame2* ImplementationData() const { return m_data; } @@ -224,7 +224,7 @@ class CameraImpl : public Camera { class LightImpl : public Light { public: LightImpl() : m_data(0) {} - ~LightImpl() + ~LightImpl() override { if (m_data) { m_data->Release(); @@ -232,11 +232,11 @@ class LightImpl : public Light { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetTransformation(FloatMatrix4&); - virtual Result SetColor(float r, float g, float b); + Result SetTransformation(FloatMatrix4&) override; + Result SetColor(float r, float g, float b) override; inline IDirect3DRMFrame2* ImplementationData() const { return m_data; } @@ -250,7 +250,7 @@ class LightImpl : public Light { class MeshImpl : public Mesh { public: MeshImpl() : m_data(0) {} - ~MeshImpl() + ~MeshImpl() override { if (m_data) { delete m_data; @@ -258,20 +258,20 @@ class MeshImpl : public Mesh { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetColor(float r, float g, float b, float a); - virtual Result SetTexture(const Texture*); + Result SetColor(float r, float g, float b, float a) override; + Result SetTexture(const Texture*) override; // vtable+0x10 - virtual Result GetTexture(Texture*&); - virtual Result SetTextureMappingMode(ProjectionType); - virtual Result SetShadingModel(ShadingModel); - virtual Mesh* DeepClone(Unk*); + Result GetTexture(Texture*&) override; + Result SetTextureMappingMode(ProjectionType) override; + Result SetShadingModel(ShadingModel) override; + Mesh* DeepClone(Unk*) override; // vtable+0x20 - virtual Mesh* ShallowClone(Unk*); + Mesh* ShallowClone(Unk*) override; struct MeshData { IDirect3DRMMesh* groupMesh; @@ -290,7 +290,7 @@ class MeshImpl : public Mesh { class GroupImpl : public Group { public: GroupImpl() : m_data(0) {} - ~GroupImpl() + ~GroupImpl() override { if (m_data) { m_data->Release(); @@ -298,26 +298,26 @@ class GroupImpl : public Group { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetTransformation(FloatMatrix4&); - virtual Result SetColor(float r, float g, float b, float a); + Result SetTransformation(FloatMatrix4&) override; + Result SetColor(float r, float g, float b, float a) override; // vtable+0x10 - virtual Result SetTexture(const Texture*); - virtual Result GetTexture(Texture*&); - virtual Result SetMaterialMode(MaterialMode); - virtual Result Add(const Mesh*); + Result SetTexture(const Texture*) override; + Result GetTexture(Texture*&) override; + Result SetMaterialMode(MaterialMode) override; + Result Add(const Mesh*) override; // vtable+0x20 - virtual Result Add(const Group*); - virtual Result Remove(const Mesh*); - virtual Result Remove(const Group*); - virtual Result RemoveAll(); + Result Add(const Group*) override; + Result Remove(const Mesh*) override; + Result Remove(const Group*) override; + Result RemoveAll() override; // vtable+0x30 - virtual Result Unknown(); + Result Unknown() override; friend class RendererImpl; @@ -329,7 +329,7 @@ class GroupImpl : public Group { class UnkImpl : public Unk { public: UnkImpl() : m_data(0) {} - ~UnkImpl() + ~UnkImpl() override { if (m_data) { m_data->Release(); @@ -337,10 +337,10 @@ class UnkImpl : public Unk { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetMeshData( + Result SetMeshData( unsigned long faceCount, unsigned long vertexCount, const float (*pPositions)[3], @@ -348,11 +348,11 @@ class UnkImpl : public Unk { const float (*pTextureCoordinates)[2], unsigned long vertexPerFaceCount, unsigned long* pFaceData - ); - virtual Result GetBoundingBox(float min[3], float max[3]); + ) override; + Result GetBoundingBox(float min[3], float max[3]) override; // vtable+0x10 - virtual Unk* Clone(); + Unk* Clone() override; inline IDirect3DRMMesh* ImplementationData() const { return m_data; } @@ -389,7 +389,7 @@ class TglD3DRMIMAGE { class TextureImpl : public Texture { public: TextureImpl() : m_data(0) {} - ~TextureImpl() + ~TextureImpl() override { if (m_data) { m_data->Release(); @@ -397,23 +397,23 @@ class TextureImpl : public Texture { } } - virtual void* ImplementationDataPtr(); + void* ImplementationDataPtr() override; // vtable+0x08 - virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels); - virtual void FillRowsOfTexture(int y, int height, void* pBuffer); + Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) override; + void FillRowsOfTexture(int y, int height, void* pBuffer) override; // vtable+0x10 - virtual Result Changed(int texelsChanged, int paletteChanged); - virtual Result GetBufferAndPalette( + Result Changed(int texelsChanged, int paletteChanged) override; + Result GetBufferAndPalette( int* pWidth, int* pHeight, int* pDepth, void** ppBuffer, int* ppPaletteSize, PaletteEntry** ppPalette - ); - virtual Result SetPalette(int entryCount, PaletteEntry* entries); + ) override; + Result SetPalette(int entryCount, PaletteEntry* entries) override; inline IDirect3DRMTexture* ImplementationData() const { return m_data; } inline void SetImplementation(IDirect3DRMTexture* pData) { m_data = pData; } diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index df918350..d8516955 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -27,7 +27,7 @@ class ViewLODList : public LODList { protected: ViewLODList(size_t capacity); - ~ViewLODList(); + ~ViewLODList() override; public: inline int AddRef(); @@ -133,8 +133,9 @@ inline int ViewLODList::AddRef() inline int ViewLODList::Release() { assert(m_refCount > 0); - if (!--m_refCount) + if (!--m_refCount) { m_owner->Destroy(this); + } return m_refCount; } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 3e7344d2..3e68f78e 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -1,5 +1,9 @@ #include "viewmanager.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(ViewManager, 0x1bc) + // STUB: LEGO1 0x100a5eb0 ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view) { diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index d89b7cef..625722b5 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -20,8 +20,15 @@ class ViewManager { // SYNTHETIC: LEGO1 0x100a6000 // ViewManager::`scalar deleting destructor' + inline void AddToUnknown0x08(ViewROI* p_roi) { m_unk0x08.push_back(p_roi); } + private: - undefined m_pad[0x1b8]; + undefined4 m_unk0x04; // 0x04 + CompoundObject m_unk0x08; // 0x08 + undefined m_pad[0x1c8]; // 0x14 }; +// TEMPLATE: LEGO1 0x10022030 +// list >::insert + #endif // VIEWMANAGER_H diff --git a/LEGO1/viewmanager/viewroi.h b/LEGO1/viewmanager/viewroi.h index 8e6d78a9..cec1ba0e 100644 --- a/LEGO1/viewmanager/viewroi.h +++ b/LEGO1/viewmanager/viewroi.h @@ -21,7 +21,7 @@ class ViewROI : public OrientableROI { SetLODList(lodList); geometry = pRenderer->CreateGroup(); } - inline ~ViewROI() + inline ~ViewROI() override { // SetLODList() will decrease refCount of LODList SetLODList(0); @@ -44,18 +44,18 @@ class ViewROI : public OrientableROI { reinterpret_cast(m_lods)->AddRef(); } } - virtual float IntrinsicImportance() const override; // vtable+0x04 - virtual void VTable0x1c() override; // vtable+0x1c - virtual void SetLocalTransform(const Matrix4& p_transform) override; // vtable+0x20 - virtual void VTable0x24(const MxMatrix& p_transform) override; // vtable+0x24 - virtual const Tgl::Group* GetGeometry() const; // vtable+0x34 - virtual Tgl::Group* GetGeometry(); // vtable+0x30 + float IntrinsicImportance() const override; // vtable+0x04 + void VTable0x1c() override; // vtable+0x1c + void SetLocalTransform(const Matrix4& p_transform) override; // vtable+0x20 + void VTable0x24(const MxMatrix& p_transform) override; // vtable+0x24 + virtual const Tgl::Group* GetGeometry() const; // vtable+0x34 + virtual Tgl::Group* GetGeometry(); // vtable+0x30 static undefined SetUnk101013d8(undefined p_flag); protected: Tgl::Group* geometry; - void UpdateWorldData(const MxMatrix& parent2world); + void UpdateWorldData(const MxMatrix& parent2world) override; }; // SYNTHETIC: LEGO1 0x100aa250 diff --git a/tools/isledecomp/isledecomp/compare/asm/parse.py b/tools/isledecomp/isledecomp/compare/asm/parse.py index ef1ad2c2..f8323165 100644 --- a/tools/isledecomp/isledecomp/compare/asm/parse.py +++ b/tools/isledecomp/isledecomp/compare/asm/parse.py @@ -9,6 +9,7 @@ import re from typing import Callable, List, Optional, Tuple from collections import namedtuple +from isledecomp.bin import InvalidVirtualAddressError from capstone import Cs, CS_ARCH_X86, CS_MODE_32 disassembler = Cs(CS_ARCH_X86, CS_MODE_32) @@ -55,7 +56,11 @@ def is_relocated(self, addr: int) -> bool: def float_replace(self, addr: int, data_size: int) -> Optional[str]: if callable(self.float_lookup): - float_str = self.float_lookup(addr, data_size) + try: + float_str = self.float_lookup(addr, data_size) + except InvalidVirtualAddressError: + # probably caused by reading an invalid instruction + return None if float_str is not None: return f"{float_str} (FLOAT)" diff --git a/tools/roadmap/roadmap.py b/tools/roadmap/roadmap.py index e8023c1d..97a4f894 100644 --- a/tools/roadmap/roadmap.py +++ b/tools/roadmap/roadmap.py @@ -5,7 +5,9 @@ import os import argparse import logging -from typing import List, Optional +import statistics +import bisect +from typing import Iterator, List, Optional, Tuple from collections import namedtuple from isledecomp import Bin as IsleBin from isledecomp.cvdump import Cvdump @@ -28,6 +30,7 @@ class ModuleMap: def __init__(self, pdb, binfile) -> None: cvdump = Cvdump(pdb).section_contributions().modules().run() self.module_lookup = {m.id: (m.lib, m.obj) for m in cvdump.modules} + self.library_lookup = {m.obj: m.lib for m in cvdump.modules} self.section_contrib = [ ( binfile.get_abs_addr(sizeref.section, sizeref.offset), @@ -38,11 +41,37 @@ def __init__(self, pdb, binfile) -> None: if binfile.is_valid_section(sizeref.section) ] + # For bisect performance enhancement + self.contrib_starts = [start for (start, _, __) in self.section_contrib] + + def get_lib_for_module(self, module: str) -> Optional[str]: + return self.library_lookup.get(module) + + def get_all_cmake_modules(self) -> List[str]: + return [ + obj + for (_, (__, obj)) in self.module_lookup.items() + if obj.startswith("CMakeFiles") + ] + def get_module(self, addr: int) -> Optional[str]: - for start, size, module_id in self.section_contrib: - if start <= addr < start + size: - if (module := self.module_lookup.get(module_id)) is not None: - return module + i = bisect.bisect_left(self.contrib_starts, addr) + # If the addr matches the section contribution start, we are in the + # right spot. Otherwise, we need to subtract one here. + # We don't want the insertion point given by bisect, but the + # section contribution that contains the address. + + (potential_start, _, __) = self.section_contrib[i] + if potential_start != addr: + i -= 1 + + # Safety catch: clamp to range of indices from section_contrib. + i = max(0, min(i, len(self.section_contrib) - 1)) + + (start, size, module_id) = self.section_contrib[i] + if start <= addr < start + size: + if (module := self.module_lookup.get(module_id)) is not None: + return module return None @@ -58,6 +87,9 @@ def print_sections(sections): print() +ALLOWED_TYPE_ABBREVIATIONS = ["fun", "dat", "poi", "str", "vta"] + + def match_type_abbreviation(mtype: Optional[SymbolType]) -> str: """Return abbreviation of the given SymbolType name""" if mtype is None: @@ -66,6 +98,42 @@ def match_type_abbreviation(mtype: Optional[SymbolType]) -> str: return mtype.name.lower()[:3] +def get_cmakefiles_prefix(module: str) -> str: + """For the given .obj, get the "CMakeFiles/something.dir/" prefix. + For lack of a better option, this is the library for this module.""" + if module.startswith("CMakeFiles"): + return "/".join(module.split("/", 2)[:2]) + "/" + + return module + + +def truncate_module_name(prefix: str, module: str) -> str: + """Remove the CMakeFiles prefix and the .obj suffix for the given module. + Input: CMakeFiles/lego1.dir/, CMakeFiles/lego1.dir/LEGO1/define.cpp.obj + Output: LEGO1/define.cpp""" + + if module.startswith(prefix): + module = module[len(prefix) :] + + if module.endswith(".obj"): + module = module[:-4] + + return module + + +def avg_remove_outliers(entries: List[int]) -> int: + """Compute the average from this list of entries (addresses) + after removing outlier values.""" + + if len(entries) == 1: + return entries[0] + + avg = statistics.mean(entries) + sd = statistics.pstdev(entries) + + return int(statistics.mean([e for e in entries if abs(e - avg) <= 2 * sd])) + + RoadmapRow = namedtuple( "RoadmapRow", [ @@ -82,6 +150,144 @@ def match_type_abbreviation(mtype: Optional[SymbolType]) -> str: ) +class DeltaCollector: + """Reads each row of the results and aggregates information about the + placement of each module.""" + + def __init__(self, match_type: str = "fun") -> None: + # The displacement for each symbol from each module + self.disp_map = {} + + # Each address for each module + self.addresses = {} + + # The earliest address for each module + self.earliest = {} + + # String abbreviation for which symbol type we are checking + self.match_type = "fun" + + match_type = str(match_type).strip().lower()[:3] + if match_type in ALLOWED_TYPE_ABBREVIATIONS: + self.match_type = match_type + + def read_row(self, row: RoadmapRow): + if row.module is None: + return + + if row.sym_type != self.match_type: + return + + if row.orig_addr is not None: + if row.module not in self.addresses: + self.addresses[row.module] = [] + + self.addresses[row.module].append(row.orig_addr) + + if row.orig_addr < self.earliest.get(row.module, 0xFFFFFFFFF): + self.earliest[row.module] = row.orig_addr + + if row.displacement is not None: + if row.module not in self.disp_map: + self.disp_map[row.module] = [] + + self.disp_map[row.module].append(row.displacement) + + def iter_sorted(self) -> Iterator[Tuple[int, int]]: + """Compute the average address for each module, then generate them + in ascending order.""" + avg_address = { + mod: avg_remove_outliers(values) for mod, values in self.addresses.items() + } + for mod, avg in sorted(avg_address.items(), key=lambda x: x[1]): + yield (avg, mod) + + +def suggest_order(results: List[RoadmapRow], module_map: ModuleMap, match_type: str): + """Suggest the order of modules for CMakeLists.txt""" + + dc = DeltaCollector(match_type) + for row in results: + dc.read_row(row) + + # First, show the order of .obj files for the "CMake Modules" + # Meaning: the modules where the .obj file begins with "CMakeFiles". + # These are the libraries where we directly control the order. + # The library name (from cvdump) doesn't make it obvious that these are + # our libraries so we derive the name based on the CMakeFiles prefix. + leftover_modules = set(module_map.get_all_cmake_modules()) + + # A little convoluted, but we want to take the first two tokens + # of the string with '/' as the delimiter. + # i.e. CMakeFiles/isle.dir/ + # The idea is to print exactly what appears in CMakeLists.txt. + cmake_prefixes = sorted(set(get_cmakefiles_prefix(mod) for mod in leftover_modules)) + + # Save this off because we'll use it again later. + computed_order = list(dc.iter_sorted()) + + for prefix in cmake_prefixes: + print(prefix) + + last_earliest = 0 + # Show modules ordered by the computed average of addresses + for _, module in computed_order: + if not module.startswith(prefix): + continue + + leftover_modules.remove(module) + + avg_displacement = None + displacements = dc.disp_map.get(module) + if displacements is not None and len(displacements) > 0: + avg_displacement = int(statistics.mean(displacements)) + + # Call attention to any modules where ordering by earliest + # address is different from the computed order we display. + earliest = dc.earliest.get(module) + ooo_mark = "*" if earliest < last_earliest else " " + last_earliest = earliest + + code_file = truncate_module_name(prefix, module) + print(f"0x{earliest:08x}{ooo_mark} {avg_displacement:10} {code_file}") + + # These modules are included in the final binary (in some form) but + # don't contribute any symbols of the type we are checking. + # n.b. There could still be other modules that are part of + # CMakeLists.txt but are not included in the pdb for whatever reason. + # In other words: don't take the list we provide as the final word on + # what should or should not be included. + # This is merely a suggestion of the order. + for module in leftover_modules: + if not module.startswith(prefix): + continue + + # aligned with previous print + code_file = truncate_module_name(prefix, module) + print(f" no suggestion {code_file}") + + print() + + # Now display the order of all libaries in the final file. + library_order = {} + + for start, module in computed_order: + lib = module_map.get_lib_for_module(module) + if lib is None: + lib = get_cmakefiles_prefix(module) + + if start < library_order.get(lib, 0xFFFFFFFFF): + library_order[lib] = start + + print("Library order (average address shown):") + for lib, start in sorted(library_order.items(), key=lambda x: x[1]): + # Strip off any OS path for brevity + if not lib.startswith("CMakeFiles"): + lib = os.path.basename(lib) + + print(f"{lib:40} {start:08x}") + + def print_text_report(results: List[RoadmapRow]): """Print the result with original and recomp addresses.""" for row in results: @@ -150,6 +356,13 @@ def parse_args() -> argparse.Namespace: parser.add_argument( "--verbose", "-v", action="store_true", help="Show recomp addresses in output" ) + parser.add_argument( + "--order", + const="fun", + nargs="?", + type=str, + help="Show suggested order of modules (using the specified symbol type)", + ) (args, _) = parser.parse_known_args() @@ -245,6 +458,10 @@ def to_roadmap_row(match): results = list(map(to_roadmap_row, engine.get_all())) + if args.order is not None: + suggest_order(results, module_map, args.order) + return + if args.csv is None: if args.verbose: print("ORIG sections:") diff --git a/util/decomp.h b/util/decomp.h index 3470fcc3..100f9f21 100644 --- a/util/decomp.h +++ b/util/decomp.h @@ -14,7 +14,7 @@ #endif #ifndef _countof -#define _countof(arr) sizeof(arr) / sizeof(arr[0]) +#define _countof(arr) (sizeof(arr) / sizeof(arr[0])) #endif typedef unsigned char undefined;