diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ad9343..db8739cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,7 +367,8 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp LEGO1/lego/legoomni/src/isle/radiostate.cpp - LEGO1/lego/legoomni/src/main/legoomni.cpp + LEGO1/lego/legoomni/src/main/legomain.cpp + LEGO1/lego/legoomni/src/main/scripts.cpp LEGO1/lego/legoomni/src/notify/legoeventnotificationparam.cpp LEGO1/lego/legoomni/src/paths/legoanimactor.cpp LEGO1/lego/legoomni/src/paths/legoextraactor.cpp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23e25faf..20b61718 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,8 @@ To access the Ghidra repository, use the following details: - Address: `server.mattkc.com` - Port: `13100` +**Please note that at the time of writing, much of the information found on the Ghidra server is severely outdated**. Generally, the source code found in this repository represents the latest "source of truth" and should be referenced whenever possible. + ## General Guidelines 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. @@ -26,6 +28,7 @@ This repository currently has only one goal: accuracy to the original executable ## Overview * [`3rdparty`](/3rdparty): Contains code obtained from third parties, not including Mindscape. Generally, these are libraries that have been placed in the public domain or are freely available on the web. As these are unaltered files, our style guide (see below) does not apply. +* [`CONFIG`](/CONFIG): Decompilation of `CONFIG.EXE`. It depends on some code in `LEGO1`. * [`ISLE`](/ISLE): Decompilation of `ISLE.EXE`. It depends on some code in `LEGO1`. * [`LEGO1`](/LEGO1): Decompilation of `LEGO1.DLL`. This folder contains code from Mindscape's custom in-house engine called **Omni** (file pattern: `mx*`), the LEGO Island-specific extensions for Omni and the game's code (file pattern: `lego*`) as well as several utility libraries developed by Mindscape. * [`tools`](/tools): A set of tools aiding in the decompilation effort. @@ -33,7 +36,15 @@ This repository currently has only one goal: accuracy to the original executable ## Tooling -Please make yourself familiar with the [available tooling and annotations](/tools/README.md). +Please make yourself familiar with the [available tooling and annotations](/tools/README.md). These are generally required to contribute to the project. + +## Notes on MSVC 4.20 + +As outlined in the [`README`](/README.md), Microsoft Visual C++ 4.20 is the compiler we use to build the game. + +One important aspect to know about this compiler in the context of the decompilation project is that the assembly code generation is somewhat erratic. We call this peculiarity "compiler randomness" or entropy. In essence, what it comes down to is that changes to the code base, for instance in a header, can pseudo-randomly affect the code generation of functions in compilation units that include this header, even if the changes are completely unrelated to those functions. For example, by adding an extra (unused) inline function or an enum declaration in a header, the code in some functions may unexpectedly wind up looking different and our main tool, [`reccmp`](/tools/README.md), will report either a (significantly) reduced or increased accuracy for those functions. This issue roughly affects around ~5% of all decompiled functions. + +We are currently unaware of the exact nature of this phenomenon. Unfortunately it represents a significant obstacle in our effort to achieve 100% matching binaries. If you or anyone you know has knowledge about the compiler internals that lead to the described observations, please contact us. ## Code Style @@ -41,7 +52,7 @@ In general, we're not exhaustively strict about coding style, but there are some ### Formatting -We are currently using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) with a configuration file that aims to replicate the code formatting employed by the original developers. There are [integrations](https://clang.llvm.org/docs/ClangFormat.html#vim-integration) available for most editors and IDEs. The required `clang-format` version is `17.x`. +We are currently using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) with configuration files that aim to replicate the code formatting employed by the original developers. There are [integrations](https://clang.llvm.org/docs/ClangFormat.html#vim-integration) available for most editors and IDEs. The required `clang-format` version is `17.x`. ### Naming conventions diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 44420792..6f6296aa 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1,17 +1,19 @@ #include "isleapp.h" +#include "3dmanager/lego3dmanager.h" #include "decomp.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" +#include "legomain.h" #include "legomodelpresenter.h" -#include "legoomni.h" #include "legopartpresenter.h" #include "legovideomanager.h" #include "legoworldpresenter.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" +#include "mxdirectx/mxdirect3d.h" #include "mxdsaction.h" #include "mxmisc.h" #include "mxomnicreateflags.h" @@ -20,7 +22,9 @@ #include "mxticklemanager.h" #include "mxtimer.h" #include "mxtransitionmanager.h" +#include "mxvariabletable.h" #include "res/resource.h" +#include "roi/legoroi.h" #include "viewmanager/viewmanager.h" #include diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index 540d6042..dcc09959 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -1,9 +1,9 @@ #ifndef ACT1STATE_H #define ACT1STATE_H -#include "legonamedtexture.h" #include "legostate.h" -#include "roi/legoroi.h" + +class LegoNamedTexture; // VTABLE: LEGO1 0x100d7028 // SIZE 0x26c @@ -81,16 +81,17 @@ class Act1State : public LegoState { inline MxU32 GetUnknown18() { return m_unk0x018; } inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } - inline MxS16 GetUnknown21() { return m_unk0x021; } + inline MxU8 GetUnknown21() { return m_unk0x021; } inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } - inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x021 = p_unk0x21; } + inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } // SYNTHETIC: LEGO1 0x10033960 // Act1State::`scalar deleting destructor' friend class Isle; + friend class SkateBoard; protected: MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 @@ -105,7 +106,7 @@ class Act1State : public LegoState { MxBool m_unk0x01f; // 0x01f MxBool m_planeActive; // 0x020 undefined m_unk0x021; // 0x021 - undefined m_unk0x022; // 0x022 + MxBool m_unk0x022; // 0x022 undefined m_unk0x023; // 0x023 NamedPlane m_unk0x024; // 0x024 NamedPlane m_unk0x070; // 0x070 diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 99615f9e..1aff83a0 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -1,9 +1,10 @@ #ifndef AMBULANCE_H #define AMBULANCE_H -#include "ambulancemissionstate.h" #include "islepathactor.h" +class AmbulanceMissionState; + // VTABLE: LEGO1 0x100d71a8 // SIZE 0x184 class Ambulance : public IslePathActor { diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index d81c26d8..9d15fd50 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -18,15 +18,16 @@ struct AnimInfo { char* m_animName; // 0x00 MxU32 m_objectId; // 0x04 MxS16 m_unk0x08; // 0x08 - MxU8 m_unk0x0a; // 0x0a + MxBool m_unk0x0a; // 0x0a MxU8 m_unk0x0b; // 0x0b MxU8 m_unk0x0c; // 0x0c MxU8 m_unk0x0d; // 0x0d MxU32 m_unk0x10[4]; // 0x10 MxU8 m_modelCount; // 0x20 + MxS16 m_unk0x22; // 0x22 ModelInfo* m_models; // 0x24 MxU8 m_unk0x28; // 0x28 - MxU8 m_unk0x29; // 0x29 + MxBool m_unk0x29; // 0x29 MxS8 m_unk0x2a[3]; // 0x2a }; diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 9071aba5..c6dd28d5 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -2,12 +2,13 @@ #define GASSTATION_H #include "decomp.h" -#include "gasstationstate.h" #include "legogamestate.h" #include "legoworld.h" -#include "mxstillpresenter.h" #include "radio.h" +class GasStationState; +class MxStillPresenter; + // VTABLE: LEGO1 0x100d4650 // SIZE 0x128 class GasStation : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 3876d9a7..b568390a 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -1,10 +1,11 @@ #ifndef HELICOPTER_H #define HELICOPTER_H -#include "helicopterstate.h" #include "islepathactor.h" #include "realtime/matrix.h" +class HelicopterState; + // VTABLE: LEGO1 0x100d40f8 // SIZE 0x230 class Helicopter : public IslePathActor { @@ -25,13 +26,13 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - MxU32 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 + 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(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/historybook.h b/LEGO1/lego/legoomni/include/historybook.h index d7a79705..af3b9be2 100644 --- a/LEGO1/lego/legoomni/include/historybook.h +++ b/LEGO1/lego/legoomni/include/historybook.h @@ -4,7 +4,8 @@ #include "decomp.h" #include "legogamestate.h" #include "legoworld.h" -#include "mxstillpresenter.h" + +class MxStillPresenter; // VTABLE: LEGO1 0x100da328 // SIZE 0x3e4 diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 9595988f..40f4f947 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -3,11 +3,13 @@ #include "actionsfwd.h" #include "decomp.h" -#include "hospitalstate.h" #include "legogamestate.h" #include "legoworld.h" -#include "mxstillpresenter.h" -#include "radio.h" + +class HospitalState; +class LegoControlManagerEvent; +class MxEndActionNotificationParam; +class MxStillPresenter; // VTABLE: LEGO1 0x100d9730 // SIZE 0x12c diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index e4342fee..04b56757 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -8,6 +8,7 @@ #include "radio.h" class InfocenterState; +class MxNotificationParam; class MxStillPresenter; class LegoControlManagerEvent; diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h index e154f42e..05b0ed83 100644 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ b/LEGO1/lego/legoomni/include/infocenterstate.h @@ -4,7 +4,8 @@ #include "decomp.h" #include "legogamestate.h" #include "legostate.h" -#include "mxstillpresenter.h" + +class MxStillPresenter; // VTABLE: LEGO1 0x100d93a8 // SIZE 0x94 diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 6e337454..1affab4a 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -2,8 +2,10 @@ #define ISLEACTOR_H #include "legoactor.h" -#include "legoworld.h" -#include "mxactionnotificationparam.h" + +class LegoWorld; +class MxEndActionNotificationParam; +class MxNotificationParam; // VTABLE: LEGO1 0x100d5178 // SIZE 0x7c diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 67b1b320..e834eff1 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -1,18 +1,87 @@ #ifndef ISLEPATHACTOR_H #define ISLEPATHACTOR_H -#include "legocontrolmanager.h" #include "legogamestate.h" #include "legopathactor.h" -#include "legoworld.h" -#include "mxtype18notificationparam.h" -#include "mxtype19notificationparam.h" #include "mxtypes.h" +class LegoControlManagerEvent; +class LegoEndAnimNotificationParam; +class LegoWorld; +class MxType19NotificationParam; + // VTABLE: LEGO1 0x100d4398 // SIZE 0x160 class IslePathActor : public LegoPathActor { public: + enum { + c_LOCATIONS_NUM = 29 + }; + + enum { + c_spawnBit1 = 0x01, + c_playMusic = 0x02, + c_spawnBit3 = 0x04 + }; + + // SIZE 0x38 + struct SpawnLocation { + SpawnLocation() {} + + // FUNCTION: LEGO1 0x1001b1b0 + SpawnLocation( + LegoGameState::Area p_area, + MxAtomId* p_script, + MxS32 p_entityId, + const char* p_path, + MxS16 p_src, + float p_srcScale, + MxS16 p_dest, + float p_destScale, + undefined4 p_unk0x30, + JukeboxScript::Script p_music + ) + { + m_area = p_area; + m_script = p_script; + m_entityId = p_entityId; + strcpy(m_path, p_path); + m_src = p_src; + m_srcScale = p_srcScale; + m_dest = p_dest; + m_destScale = p_destScale; + m_unk0x30 = p_unk0x30; + m_music = p_music; + } + + // FUNCTION: LEGO1 0x1001b230 + SpawnLocation& operator=(const SpawnLocation& p_location) + { + m_area = p_location.m_area; + m_script = p_location.m_script; + m_entityId = p_location.m_entityId; + strcpy(m_path, p_location.m_path); + m_src = p_location.m_src; + m_srcScale = p_location.m_srcScale; + m_dest = p_location.m_dest; + m_destScale = p_location.m_destScale; + m_unk0x30 = p_location.m_unk0x30; + m_music = p_location.m_music; + return *this; + } + + LegoGameState::Area m_area; // 0x00 + MxAtomId* m_script; // 0x04 + MxS32 m_entityId; // 0x08 + char m_path[20]; // 0x0c + MxS16 m_src; // 0x20 + float m_srcScale; // 0x24 + MxS16 m_dest; // 0x28 + float m_destScale; // 0x2c + undefined4 m_unk0x30; // 0x30 + JukeboxScript::Script m_music; // 0x34 + }; + IslePathActor(); // FUNCTION: LEGO1 0x10002e10 @@ -46,15 +115,15 @@ class IslePathActor : public LegoPathActor { virtual MxU32 VTable0xd4(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 - virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8 + virtual MxU32 VTable0xd8(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 - virtual void VTable0xe8(LegoGameState::Area, MxBool, MxU8); // vtable+0xe8 - virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); + virtual void VTable0xe0(); // vtable+0xe0 + virtual void VTable0xe4(); // vtable+0xe4 + virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags); // vtable+0xe8 + virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec // SYNTHETIC: LEGO1 0x10002ff0 // IslePathActor::`scalar deleting destructor' @@ -64,6 +133,8 @@ class IslePathActor : public LegoPathActor { void FUN_1001b660(); + static void RegisterSpawnLocations(); + protected: LegoWorld* m_world; // 0x154 IslePathActor* m_unk0x158; // 0x158 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 92147be9..263b2a4f 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -3,7 +3,8 @@ #include "decomp.h" #include "islepathactor.h" -#include "legocontrolmanager.h" + +class LegoControlManagerEvent; // VTABLE: LEGO1 0x100d9ec8 // SIZE 0x164 diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index f5778dda..260fb9a5 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -2,11 +2,12 @@ #define JUKEBOX_H #include "decomp.h" -#include "jukeboxstate.h" -#include "legocontrolmanager.h" #include "legogamestate.h" #include "legoworld.h" +class LegoControlManagerEvent; +class JukeBoxState; + // VTABLE: LEGO1 0x100d8958 // SIZE 0x104 class JukeBox : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index f0ee58dd..c7dd6a35 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -2,8 +2,6 @@ #define LEGOACT2_H #include "act2brick.h" -#include "legocarraceactor.h" -#include "legopathactor.h" #include "legoworld.h" // VTABLE: LEGO1 0x100d82e0 diff --git a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h index 7bc6b005..98ee03f2 100644 --- a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h @@ -2,14 +2,15 @@ #define LEGOACTIONCONTROLPRESENTER_H #include "decomp.h" -#include "legoutils.h" +#include "extra.h" #include "mxmediapresenter.h" +#include "mxstring.h" // VTABLE: LEGO1 0x100d5118 // SIZE 0x68 class LegoActionControlPresenter : public MxMediaPresenter { public: - inline LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; } + LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; } ~LegoActionControlPresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: LEGO1 0x1000d0e0 diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 358ca600..ebde373c 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -2,9 +2,10 @@ #define LEGOACTOR_H #include "decomp.h" -#include "legocachsound.h" #include "legoentity.h" +class LegoCacheSound; + // VTABLE: LEGO1 0x100d6d68 // SIZE 0x78 class LegoActor : public LegoEntity { diff --git a/LEGO1/lego/legoomni/include/legoanimactor.h b/LEGO1/lego/legoomni/include/legoanimactor.h index 91eafd11..296c48d0 100644 --- a/LEGO1/lego/legoomni/include/legoanimactor.h +++ b/LEGO1/lego/legoomni/include/legoanimactor.h @@ -1,10 +1,11 @@ #ifndef LEGOANIMACTOR_H #define LEGOANIMACTOR_H -#include "anim/legoanim.h" #include "decomp.h" #include "legopathactor.h" +class LegoAnim; + // SIZE 0x20 struct LegoAnimActorStruct { LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs); diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index ae8bc302..56efee8c 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -2,14 +2,19 @@ #define LEGOANIMATIONMANAGER_H #include "actionsfwd.h" -#include "animstate.h" #include "decomp.h" -#include "legoentity.h" #include "legotraninfolist.h" #include "mxcore.h" +#include "mxgeometry/mxgeometry3d.h" +class AnimState; class LegoAnimPresenter; +class LegoEntity; +class LegoFile; +class LegoPathBoundary; class LegoROIList; +struct ModelInfo; +class MxDSAction; // SIZE 0x18 struct Character { @@ -36,11 +41,13 @@ struct Vehicle { // SIZE 0x18 struct Unknown0x3c { - LegoROI* m_roi; // 0x00 - MxU32 m_id; // 0x04 - undefined m_unk0x08[0x08]; // 0x08 - float m_unk0x10; // 0x10 - undefined m_unk0x14; // 0x14 + LegoROI* m_roi; // 0x00 + MxS32 m_characterId; // 0x04 + undefined4 m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0d; // 0x0d + float m_unk0x10; // 0x10 + MxBool m_unk0x14; // 0x14 }; // VTABLE: LEGO1 0x100d8c18 @@ -67,10 +74,10 @@ class LegoAnimationManager : public MxCore { } void Reset(MxBool p_und); - void FUN_1005ef10(); - void FUN_1005f0b0(); - void FUN_1005f6d0(MxBool); - void FUN_1005f700(MxBool); + void Suspend(); + void Resume(); + void FUN_1005f6d0(MxBool p_unk0x400); + void FUN_1005f700(MxBool p_unk0x3a); MxResult LoadScriptInfo(MxS32 p_scriptIndex); MxBool FindVehicle(const char* p_name, MxU32& p_index); MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info); @@ -80,13 +87,13 @@ class LegoAnimationManager : public MxCore { MxResult FUN_10060dc0( IsleScript::Script p_objectId, MxMatrix* p_matrix, - undefined p_param3, - undefined p_param4, - undefined4 p_param5, - undefined p_param6, + MxBool p_param3, + MxBool p_param4, + LegoROI* p_roi, + MxBool p_param6, MxBool p_param7, MxBool p_param8, - undefined p_param9 + MxBool p_param9 ); void FUN_10061010(undefined4); void FUN_100617c0(MxS32, MxU16&, MxU16&); @@ -96,8 +103,8 @@ class LegoAnimationManager : public MxCore { void FUN_100629b0(MxU32, MxBool); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); - void FUN_10064670(MxBool); - void FUN_10064740(MxBool); + void FUN_10064670(Vector3*); + void FUN_10064740(Vector3*); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); @@ -108,27 +115,43 @@ class LegoAnimationManager : public MxCore { void Init(); MxResult FUN_100605e0( MxU32 p_index, - MxU8 p_unk0x0a, + MxBool p_unk0x0a, MxMatrix* p_matrix, - undefined, - undefined4, - undefined, - MxBool, - MxBool, - undefined + MxBool p_bool1, + LegoROI* p_roi, + MxBool p_bool2, + MxBool p_bool3, + MxBool p_bool4, + MxBool p_bool5 ); MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2); void DeleteAnimations(); + void FUN_10061530(); + MxU16 FUN_10062110( + LegoROI* p_roi, + Vector3& p_direction, + Vector3& p_position, + LegoPathBoundary* p_boundary, + float p_speed, + MxU8 p_und, + MxBool p_unk0x14 + ); MxS8 GetCharacterIndex(const char* p_name); + MxBool FUN_100623a0(AnimInfo& p_info); + void FUN_10062580(AnimInfo& p_info); + MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); + void FUN_10063d10(); + void FUN_100648f0(LegoTranInfo*, MxLong); + void FUN_10064b50(MxLong p_time); - MxU32 m_scriptIndex; // 0x08 + MxS32 m_scriptIndex; // 0x08 MxU16 m_animCount; // 0x0c MxU16 m_unk0x0e; // 0x0e MxU16 m_unk0x10; // 0x10 AnimInfo* m_anims; // 0x14 undefined2 m_unk0x18; // 0x18 - undefined m_unk0x1a; // 0x1a + MxBool m_unk0x1a; // 0x1a MxU32 m_unk0x1c; // 0x1c LegoTranInfoList* m_tranInfoList; // 0x20 LegoTranInfoList* m_tranInfoList2; // 0x24 @@ -136,27 +159,27 @@ class LegoAnimationManager : public MxCore { MxLong m_unk0x30[2]; // 0x30 MxBool m_unk0x38; // 0x38 MxBool m_unk0x39; // 0x39 - undefined m_unk0x3a; // 0x3a + MxBool m_unk0x3a; // 0x3a Unknown0x3c m_unk0x3c[40]; // 0x3c undefined4 m_unk0x3fc; // 0x3fc - MxU8 m_unk0x400; // 0x400 - undefined m_unk0x401; // 0x401 - MxU8 m_unk0x402; // 0x402 + MxBool m_unk0x400; // 0x400 + MxBool m_unk0x401; // 0x401 + MxBool m_unk0x402; // 0x402 MxLong m_unk0x404; // 0x404 MxLong m_unk0x408; // 0x408 MxLong m_unk0x40c; // 0x40c - undefined4 m_unk0x410; // 0x410 + MxLong m_unk0x410; // 0x410 undefined4 m_unk0x414; // 0x414 - undefined4 m_unk0x418; // 0x418 + MxU32 m_numAllowedExtras; // 0x418 undefined4 m_unk0x41c; // 0x41c AnimState* m_animState; // 0x420 LegoROIList* m_unk0x424; // 0x424 - undefined m_unk0x428; // 0x428 - undefined m_unk0x429; // 0x429 - undefined m_unk0x42a; // 0x42a - undefined m_unk0x42b; // 0x42b - undefined4 m_unk0x42c; // 0x42c - undefined m_unk0x430; // 0x430 + MxBool m_unk0x428; // 0x428 + MxBool m_unk0x429; // 0x429 + MxBool m_unk0x42a; // 0x42a + MxBool m_suspended; // 0x42b + LegoTranInfo* m_unk0x42c; // 0x42c + MxBool m_unk0x430; // 0x430 undefined4 m_unk0x434[2]; // 0x434 MxMatrix m_unk0x43c; // 0x43c MxMatrix m_unk0x484; // 0x484 diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index f7e793d4..0d90473b 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -2,12 +2,12 @@ #define LEGOANIMMMPRESENTER_H #include "mxcompositepresenter.h" -#include "mxgeometry/mxmatrix.h" class LegoAnimPresenter; class LegoWorld; class LegoROI; struct LegoTranInfo; +class MxMatrix; // VTABLE: LEGO1 0x100d7de8 // SIZE 0x74 diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 30e5201c..4e51ebb4 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -1,16 +1,16 @@ #ifndef LEGOANIMPRESENTER_H #define LEGOANIMPRESENTER_H -#include "anim/legoanim.h" #include "legoroilist.h" -#include "mxgeometry/mxgeometry3d.h" -#include "mxgeometry/mxmatrix.h" +#include "mxatom.h" #include "mxvideopresenter.h" +class LegoAnim; class LegoWorld; -class LegoAnimClass; class LegoAnimActor; class LegoPathBoundary; +class MxMatrix; +class Vector3; struct LegoAnimStructComparator { MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmp(p_a, p_b) < 0; } diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index a00c3a6b..f48cdfa8 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -2,13 +2,13 @@ #define LEGOBUILDINGMANAGER_H #include "decomp.h" -#include "misc/legostorage.h" #include "mxcore.h" class LegoEntity; class LegoROI; class LegoWorld; struct LegoBuildingData; +class LegoStorage; // VTABLE: LEGO1 0x100d6f50 // SIZE 0x30 diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index f326c35d..67d139ff 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -6,6 +6,8 @@ #include "mxstl/stlcompat.h" #include "mxtypes.h" +#pragma warning(disable : 4237) + // SIZE 0x08 struct LegoCacheSoundEntry { LegoCacheSoundEntry() : m_sound(NULL), m_name(NULL) {} diff --git a/LEGO1/lego/legoomni/include/legocameracontroller.h b/LEGO1/lego/legoomni/include/legocameracontroller.h index 50439347..f7325286 100644 --- a/LEGO1/lego/legoomni/include/legocameracontroller.h +++ b/LEGO1/lego/legoomni/include/legocameracontroller.h @@ -2,7 +2,6 @@ #define LEGOCAMERACONTROLLER_H #include "legopointofviewcontroller.h" -#include "mxcore.h" #include "mxgeometry/mxgeometry3d.h" #include "mxgeometry/mxmatrix.h" #include "mxpoint32.h" diff --git a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h index 55036496..5b72d2be 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h @@ -1,6 +1,7 @@ #ifndef LEGOCARBUILDANIMPRESENTER_H #define LEGOCARBUILDANIMPRESENTER_H +#include "anim/legoanim.h" #include "legoanimpresenter.h" // VTABLE: LEGO1 0x100d99e0 diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 038c31e8..7bd6e987 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -2,13 +2,14 @@ #define LEGOCHARACTERMANAGER_H #include "decomp.h" -#include "legoextraactor.h" -#include "legovariables.h" -#include "misc/legostorage.h" #include "mxstl/stlcompat.h" #include "mxtypes.h" +#include "roi/legoroi.h" +class CustomizeAnimFileVariable; class LegoActor; +class LegoExtraActor; +class LegoStorage; class LegoROI; #pragma warning(disable : 4237) @@ -40,7 +41,7 @@ struct LegoCharacter { MxU32 m_refCount; // 0x04 }; -struct LegoCharacterData; +struct LegoCharacterInfo; typedef map LegoCharacterMap; @@ -64,8 +65,8 @@ class LegoCharacterManager { void FUN_10083f10(LegoROI* p_roi); MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo); LegoExtraActor* GetActor(const char* p_key); - LegoCharacterData* GetData(const char* p_key); - LegoCharacterData* GetData(LegoROI* p_roi); + LegoCharacterInfo* GetInfo(const char* p_key); + LegoCharacterInfo* GetInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legocharacters.h b/LEGO1/lego/legoomni/include/legocharacters.h index 309d6f00..313a49e4 100644 --- a/LEGO1/lego/legoomni/include/legocharacters.h +++ b/LEGO1/lego/legoomni/include/legocharacters.h @@ -8,7 +8,7 @@ class LegoExtraActor; class LegoROI; // SIZE 0x108 -struct LegoCharacterData { +struct LegoCharacterInfo { // SIZE 0x18 struct Part { MxU8* m_unk0x00; // 0x00 @@ -45,7 +45,34 @@ struct LegoCharacterLOD { float m_up[3]; // 0x4c }; -extern LegoCharacterData g_characterDataInit[66]; +enum LegoCharacterLODs { + c_topLOD, + c_bodyLOD, + c_infohatLOD, + c_infogronLOD, + c_headLOD, + c_armlftLOD, + c_armrtLOD, + c_clawlftLOD, + c_clawrtLOD, + c_leglftLOD, + c_legrtLOD +}; + +enum LegoCharacterParts { + c_bodyPart, + c_infohatPart, + c_infogronPart, + c_headPart, + c_armlftPart, + c_armrtPart, + c_clawlftPart, + c_clawrtPart, + c_leglftPart, + c_legrtPart +}; + +extern LegoCharacterInfo g_characterInfoInit[66]; extern LegoCharacterLOD g_characterLODs[11]; #endif // LEGOCHARACTERS_H diff --git a/LEGO1/lego/legoomni/include/legoendanimnotificationparam.h b/LEGO1/lego/legoomni/include/legoendanimnotificationparam.h new file mode 100644 index 00000000..be7e9315 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legoendanimnotificationparam.h @@ -0,0 +1,34 @@ +#ifndef LEGOENDANIMNOTIFICATIONPARAM_H +#define LEGOENDANIMNOTIFICATIONPARAM_H + +#include "decomp.h" +#include "mxnotificationparam.h" + +// VTABLE: LEGO1 0x100d7e80 +// SIZE 0x10 +class LegoEndAnimNotificationParam : public MxNotificationParam { +public: + LegoEndAnimNotificationParam(NotificationId p_type, MxCore* p_sender, MxU32 p_index) + : MxNotificationParam(p_type, p_sender), m_index(p_index) + { + } + + // FUNCTION: LEGO1 0x1004afd0 + MxNotificationParam* Clone() const override + { + return new LegoEndAnimNotificationParam(m_type, m_sender, m_index); + } // vtable+0x04 + + inline MxU32 GetIndex() { return m_index; } + +protected: + MxU32 m_index; // 0x0c +}; + +// SYNTHETIC: LEGO1 0x1004b080 +// LegoEndAnimNotificationParam::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1004b0f0 +// LegoEndAnimNotificationParam::~LegoEndAnimNotificationParam + +#endif // LEGOENDANIMNOTIFICATIONPARAM_H diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 9b44c4d8..034dc700 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -3,10 +3,11 @@ #include "decomp.h" #include "extra.h" -#include "mxdsaction.h" #include "mxentity.h" -#include "realtime/vector.h" -#include "roi/legoroi.h" + +class LegoROI; +class MxDSAction; +class Vector3; // VTABLE: LEGO1 0x100d4858 // SIZE 0x68 diff --git a/LEGO1/lego/legoomni/include/legoentitylist.h b/LEGO1/lego/legoomni/include/legoentitylist.h index 783692b3..2a7320af 100644 --- a/LEGO1/lego/legoomni/include/legoentitylist.h +++ b/LEGO1/lego/legoomni/include/legoentitylist.h @@ -1,11 +1,10 @@ #ifndef LEGOENTITYLIST_H #define LEGOENTITYLIST_H +#include "legoentity.h" #include "mxlist.h" #include "mxtypes.h" -class LegoEntity; - // VTABLE: LEGO1 0x100d6410 // class MxCollection diff --git a/LEGO1/lego/legoomni/include/legoentitypresenter.h b/LEGO1/lego/legoomni/include/legoentitypresenter.h index 4e98eb5b..e8bf6ff1 100644 --- a/LEGO1/lego/legoomni/include/legoentitypresenter.h +++ b/LEGO1/lego/legoomni/include/legoentitypresenter.h @@ -4,6 +4,7 @@ #include "mxcompositepresenter.h" class LegoEntity; +class Vector3; // VTABLE: LEGO1 0x100d8398 // SIZE 0x50 diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index 732d4894..cdd771e3 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -3,10 +3,11 @@ #include "mxnotificationparam.h" #include "mxtypes.h" -#include "roi/legoroi.h" #include +class LegoROI; + // VTABLE: LEGO1 0x100d6aa0 // SIZE 0x20 class LegoEventNotificationParam : public MxNotificationParam { diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 08c1d5e7..05f24c5f 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -3,14 +3,17 @@ #include "actionsfwd.h" #include "decomp.h" -#include "legobackgroundcolor.h" -#include "legofullscreenmovie.h" -#include "misc/legostorage.h" #include "mxtypes.h" -#include "mxvariabletable.h" +#include + +class LegoBackgroundColor; +class LegoFile; +class LegoFullScreenMovie; class LegoState; +class LegoStorage; class MxVariable; +class MxVariableTable; class MxString; // SIZE 0x08 @@ -54,8 +57,9 @@ class LegoGameState { e_unk20, e_unk21, e_pizzeriaExterior, - - e_garageExterior = 25, + e_unk23, + e_unk24, + e_garageExterior, e_garage, e_garadoor, e_unk28, @@ -73,14 +77,17 @@ class LegoGameState { e_unk40, e_unk41, e_unk42, - - e_unk45 = 45, + e_unk43, + e_unk44, + e_unk45, e_act2main, e_act3script, e_unk48, e_unk49, - - e_jukeboxw = 53, + e_unk50, + e_unk51, + e_unk52, + e_jukeboxw, e_unk54, e_unk55, e_histbook, diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index f103360c..2bd7e26b 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -3,14 +3,15 @@ #include "decomp.h" #include "legoeventnotificationparam.h" -#include "legoworld.h" #include "mxlist.h" #include "mxpresenter.h" #include "mxqueue.h" #include +class LegoCameraController; class LegoControlManager; +class LegoWorld; extern MxS32 g_unk0x100f31b0; extern const char* g_unk0x100f31b4; diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legomain.h similarity index 71% rename from LEGO1/lego/legoomni/include/legoomni.h rename to LEGO1/lego/legoomni/include/legomain.h index 33f06a54..1d2191d5 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -1,5 +1,5 @@ -#ifndef LEGOOMNI_H -#define LEGOOMNI_H +#ifndef LEGOMAIN_H +#define LEGOMAIN_H #include "compat.h" #include "mxdsaction.h" @@ -27,35 +27,6 @@ class MxBackgroundAudioManager; class MxTransitionManager; class ViewLODListManager; -extern MxAtomId* g_copterScript; -extern MxAtomId* g_dunecarScript; -extern MxAtomId* g_jetskiScript; -extern MxAtomId* g_racecarScript; -extern MxAtomId* g_carraceScript; -extern MxAtomId* g_carracerScript; -extern MxAtomId* g_jetraceScript; -extern MxAtomId* g_jetracerScript; -extern MxAtomId* g_isleScript; -extern MxAtomId* g_elevbottScript; -extern MxAtomId* g_infodoorScript; -extern MxAtomId* g_infomainScript; -extern MxAtomId* g_infoscorScript; -extern MxAtomId* g_regbookScript; -extern MxAtomId* g_histbookScript; -extern MxAtomId* g_hospitalScript; -extern MxAtomId* g_policeScript; -extern MxAtomId* g_garageScript; -extern MxAtomId* g_act2mainScript; -extern MxAtomId* g_act3Script; -extern MxAtomId* g_jukeboxScript; -extern MxAtomId* g_pz5Script; -extern MxAtomId* g_introScript; -extern MxAtomId* g_testScript; -extern MxAtomId* g_jukeboxwScript; -extern MxAtomId* g_sndAnimScript; -extern MxAtomId* g_creditsScript; -extern MxAtomId* g_nocdSourceName; - // VTABLE: LEGO1 0x100d8638 // SIZE 0x140 class LegoOmni : public MxOmni { @@ -103,65 +74,6 @@ class LegoOmni : public MxOmni { MxAtomId* m_atomId; // 0x18 }; - // SIZE 0x38 - struct PathContainer { - PathContainer() {} - - // FUNCTION: LEGO1 0x1001b1b0 - PathContainer( - undefined4 p_unk0x00, - MxAtomId* p_script, - undefined4 p_unk0x04, - const char* p_key, - undefined2 p_unk0x20, - float p_unk0x24, - undefined2 p_unk0x28, - float p_unk0x2c, - undefined4 p_unk0x30, - MxS32 p_unk0x34 - ) - { - m_unk0x00 = p_unk0x00; - m_script = p_script; - m_unk0x04 = p_unk0x04; - strcpy(m_key, p_key); - m_unk0x20 = p_unk0x20; - m_unk0x24 = p_unk0x24; - m_unk0x28 = p_unk0x28; - m_unk0x2c = p_unk0x2c; - m_unk0x30 = p_unk0x30; - m_unk0x34 = p_unk0x34; - } - - // FUNCTION: LEGO1 0x1001b230 - PathContainer& operator=(const PathContainer& p_container) - { - m_unk0x00 = p_container.m_unk0x00; - m_script = p_container.m_script; - m_unk0x04 = p_container.m_unk0x04; - strcpy(m_key, p_container.m_key); - m_unk0x20 = p_container.m_unk0x20; - m_unk0x24 = p_container.m_unk0x24; - m_unk0x28 = p_container.m_unk0x28; - m_unk0x2c = p_container.m_unk0x2c; - m_unk0x30 = p_container.m_unk0x30; - m_unk0x34 = p_container.m_unk0x34; - return *this; - } - - private: - undefined4 m_unk0x00; // 0x00 - MxAtomId* m_script; // 0x04 - undefined4 m_unk0x04; // 0x08 - char m_key[20]; // 0x0c - undefined2 m_unk0x20; // 0x20 - float m_unk0x24; // 0x24 - undefined2 m_unk0x28; // 0x28 - float m_unk0x2c; // 0x2c - undefined4 m_unk0x30; // 0x30 - MxS32 m_unk0x34; // 0x34 - }; - LegoOmni(); ~LegoOmni() override; // vtable+00 @@ -264,12 +176,4 @@ class LegoOmni : public MxOmni { MxBool m_unk0x13c; // 0x13c }; -const char* GetNoCD_SourceName(); - -LegoEntity* PickEntity(MxLong, MxLong); -LegoROI* PickROI(MxLong, MxLong); - -void CreateScripts(); -void DestroyScripts(); - -#endif // LEGOOMNI_H +#endif // LEGOMAIN_H diff --git a/LEGO1/lego/legoomni/include/legometerpresenter.h b/LEGO1/lego/legoomni/include/legometerpresenter.h index 8bb57608..ad43944d 100644 --- a/LEGO1/lego/legoomni/include/legometerpresenter.h +++ b/LEGO1/lego/legoomni/include/legometerpresenter.h @@ -2,6 +2,7 @@ #define LEGOMETERPRESENTER_H #include "mxstillpresenter.h" +#include "mxstring.h" // VTABLE: LEGO1 0x100d7ac8 // SIZE 0x94 diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index ef2d204e..fdf0b5f3 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -4,7 +4,8 @@ #include "decomp.h" #include "mxcore.h" #include "mxtypes.h" -#include "realtime/vector.h" + +class Vector3; ////////////////////////////////////////////////////////////////////////////// // diff --git a/LEGO1/lego/legoomni/include/legopalettepresenter.h b/LEGO1/lego/legoomni/include/legopalettepresenter.h index c9e7fb81..d6906540 100644 --- a/LEGO1/lego/legoomni/include/legopalettepresenter.h +++ b/LEGO1/lego/legoomni/include/legopalettepresenter.h @@ -2,9 +2,10 @@ #define LEGOPALETTEPRESENTER_H #include "decomp.h" -#include "mxpalette.h" #include "mxvideopresenter.h" +class MxPalette; + // VTABLE: LEGO1 0x100d9aa0 // SIZE 0x68 class LegoPalettePresenter : public MxVideoPresenter { diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index e9488e8e..86b67ac2 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -1,14 +1,15 @@ #ifndef LEGOPATHACTOR_H #define LEGOPATHACTOR_H -#include "geom/legounkown100db7f4.h" #include "legoactor.h" #include "misc/legounknown.h" +#include "mxgeometry/mxmatrix.h" #include "mxtypes.h" -#include "realtime/matrix.h" +struct LegoEdge; class LegoPathBoundary; class LegoPathController; +class LegoUnknown100db7f4; // VTABLE: LEGO1 0x100d6e28 // SIZE 0x154 diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 024e85d2..393ab9ed 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -3,11 +3,10 @@ #include "geom/legowegedge.h" #include "legoanimpresenter.h" +#include "legopathactor.h" #include "mxstl/stlcompat.h" #include "mxtypes.h" -class LegoPathActor; - struct LegoPathActorSetCompare { MxU32 operator()(const LegoPathActor* p_lhs, const LegoPathActor* p_rhs) const { diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 5a55fa0e..392d083c 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -2,12 +2,15 @@ #define LEGOPATHCONTROLLER_H #include "decomp.h" -#include "legopathactor.h" #include "mxcore.h" +#include "mxstl/stlcompat.h" class LegoAnimPresenter; +class LegoPathActor; class LegoPathBoundary; class LegoWorld; +class MxAtomId; +class Vector3; struct LegoPathControllerComparator { MxBool operator()(const undefined*, const undefined*) const { return 0; } @@ -41,6 +44,14 @@ class LegoPathController : public MxCore { virtual void VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 virtual void Destroy(); // vtable+0x18 + MxResult FUN_10045c20( + LegoPathActor* p_actor, + const char* p_path, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale + ); undefined4 FUN_10046770(LegoPathActor* p_actor); void FUN_100468f0(LegoAnimPresenter* p_presenter); void FUN_10046930(LegoAnimPresenter* p_presenter); diff --git a/LEGO1/lego/legoomni/include/legopathpresenter.h b/LEGO1/lego/legoomni/include/legopathpresenter.h index 6477c2c0..9e3f0f0f 100644 --- a/LEGO1/lego/legoomni/include/legopathpresenter.h +++ b/LEGO1/lego/legoomni/include/legopathpresenter.h @@ -1,6 +1,7 @@ #ifndef LEGOPATHPRESENTER_H #define LEGOPATHPRESENTER_H +#include "mxatom.h" #include "mxmediapresenter.h" // VTABLE: LEGO1 0x100d7c10 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 3094f33c..e2eccd80 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -2,11 +2,11 @@ #define LEGOPLANTMANAGER_H #include "decomp.h" -#include "misc/legostorage.h" #include "mxcore.h" class LegoEntity; class LegoROI; +class LegoStorage; // VTABLE: LEGO1 0x100d6758 // SIZE 0x2c diff --git a/LEGO1/lego/legoomni/include/legoraceactor.h b/LEGO1/lego/legoomni/include/legoraceactor.h index 9ae2d92e..92f1e8c7 100644 --- a/LEGO1/lego/legoomni/include/legoraceactor.h +++ b/LEGO1/lego/legoomni/include/legoraceactor.h @@ -2,7 +2,8 @@ #define LEGORACEACTOR_H #include "legoanimactor.h" -#include "realtime/matrix.h" + +class Matrix4; /* VTABLE: LEGO1 0x100d5b78 LegoAnimActor diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index 4c7db772..d090b686 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -2,7 +2,6 @@ #define LEGORACECAR_H #include "legocarraceactor.h" -#include "legopathactor.h" #include "legoracemap.h" /* diff --git a/LEGO1/lego/legoomni/include/legosoundmanager.h b/LEGO1/lego/legoomni/include/legosoundmanager.h index e7dd809e..ad46bf8f 100644 --- a/LEGO1/lego/legoomni/include/legosoundmanager.h +++ b/LEGO1/lego/legoomni/include/legosoundmanager.h @@ -1,9 +1,10 @@ #ifndef LEGOSOUNDMANAGER_H #define LEGOSOUNDMANAGER_H -#include "legocachesoundmanager.h" #include "mxsoundmanager.h" +class LegoCacheSoundManager; + // VTABLE: LEGO1 0x100d6b10 // SIZE 0x44 class LegoSoundManager : public MxSoundManager { diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index b3ba9e31..21ddde85 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -4,7 +4,6 @@ #include "decomp.h" #include "misc/legostorage.h" #include "mxcore.h" -#include "mxstring.h" // VTABLE: LEGO1 0x100d46c0 // SIZE 0x08 diff --git a/LEGO1/lego/legoomni/include/legotraninfo.h b/LEGO1/lego/legoomni/include/legotraninfo.h index dfea986a..3ded0903 100644 --- a/LEGO1/lego/legoomni/include/legotraninfo.h +++ b/LEGO1/lego/legoomni/include/legotraninfo.h @@ -3,8 +3,12 @@ #include "decomp.h" #include "mxgeometry/mxmatrix.h" +#include "mxtypes.h" +struct AnimInfo; class LegoAnimMMPresenter; +class LegoROI; +class MxPresenter; // SIZE 0x78 struct LegoTranInfo { @@ -30,7 +34,9 @@ struct LegoTranInfo { m_unk0x2c.SetIdentity(); } - undefined4 m_unk0x00; // 0x00 + ~LegoTranInfo() { delete m_unk0x0c; } + + AnimInfo* m_animInfo; // 0x00 MxU32 m_index; // 0x04 LegoROI* m_unk0x08; // 0x08 MxMatrix* m_unk0x0c; // 0x0c diff --git a/LEGO1/lego/legoomni/include/legounknown100d5778.h b/LEGO1/lego/legoomni/include/legounknown100d5778.h index cb4dd25e..fe5df73f 100644 --- a/LEGO1/lego/legoomni/include/legounknown100d5778.h +++ b/LEGO1/lego/legoomni/include/legounknown100d5778.h @@ -3,10 +3,11 @@ #include "decomp.h" #include "mxtypes.h" -#include "roi/legoroi.h" #include +class LegoROI; + // VTABLE: LEGO1 0x100d5778 // SIZE 0x30 class LegoUnknown100d5778 { diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index e484c9a0..b02d7a6d 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -1,27 +1,30 @@ #ifndef LEGOUTILS_H #define LEGOUTILS_H +#include "decomp.h" #include "extra.h" -#include "misc/legostorage.h" -#include "misc/legotexture.h" -#include "mxstring.h" #include "mxtypes.h" -#include "mxutilities.h" #include +class IslePathActor; class MxAtomId; class LegoEntity; +class LegoFile; class LegoAnimPresenter; class LegoNamedTexture; +class LegoROI; class LegoTreeNode; +LegoEntity* PickEntity(MxLong, MxLong); +LegoROI* PickROI(MxLong, MxLong); MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); void FUN_1003e050(LegoAnimPresenter* p_presenter); Extra::ActionType MatchActionString(const char*); void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender); void SetCameraControllerFromIsle(); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); +void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool); diff --git a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h index 0c019349..7a70a873 100644 --- a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h +++ b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h @@ -28,7 +28,7 @@ class LegoVehicleBuildState : public LegoState { // SYNTHETIC: LEGO1 0x100260a0 // LegoVehicleBuildState::`scalar deleting destructor' -private: + // private: Playlist m_unk0x08[4]; // 0x08 // This can be one of the following: @@ -44,8 +44,8 @@ class LegoVehicleBuildState : public LegoState { // * 6 == exit(ing) build screen MxU32 m_animationState; // 0x48 undefined m_unk0x4c; // 0x4c - undefined m_unk0x4d; // 0x4d - undefined m_unk0x4e; // 0x4e + MxBool m_unk0x4d; // 0x4d + MxBool m_unk0x4e; // 0x4e MxU8 m_placedPartCount; // 0x4f }; diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index a036c4e2..eb7a0b90 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -1,16 +1,21 @@ #ifndef LEGOVIDEOMANAGER_H #define LEGOVIDEOMANAGER_H -#include "3dmanager/lego3dmanager.h" #include "decomp.h" #include "legophonemelist.h" -#include "mxdirectx/mxdirect3d.h" -#include "mxdirectx/mxstopwatch.h" #include "mxvideomanager.h" #include +class Lego3DManager; class LegoROI; +class MxDirect3D; +class MxStopWatch; + +namespace Tgl +{ +class Renderer; +} // VTABLE: LEGO1 0x100d9c88 // SIZE 0x590 @@ -47,6 +52,8 @@ class LegoVideoManager : public MxVideoManager { inline LegoROI* GetViewROI() { return this->m_viewROI; } inline MxDirect3D* GetDirect3D() { return this->m_direct3d; } inline MxBool GetRender3D() { return this->m_render3d; } + inline double GetElapsedSeconds() { return this->m_elapsedSeconds; } + inline void SetRender3D(MxBool p_render3d) { this->m_render3d = p_render3d; } inline void SetUnk0x554(MxBool p_unk0x554) { this->m_unk0x554 = p_unk0x554; } diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index f882b685..781a8ac6 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -2,15 +2,14 @@ #define LEGOWORLD_H #include "legocachesoundlist.h" -#include "legocachsound.h" -#include "legocameracontroller.h" #include "legoentity.h" #include "legoentitylist.h" #include "legopathcontrollerlist.h" -#include "mxpresenter.h" #include "mxpresenterlist.h" +#include "roi/legoroi.h" class IslePathActor; +class LegoCameraController; class LegoPathBoundary; class LegoHideAnimPresenter; @@ -66,6 +65,14 @@ class LegoWorld : public LegoEntity { MxBool PresentersPending(); void Remove(MxCore* p_object); + MxResult FUN_1001f720( + IslePathActor* p_actor, + const char* p_path, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale + ); undefined4 FUN_1001fa70(IslePathActor* p_actor); undefined4 FUN_1001fb70( IslePathActor* p_actor, diff --git a/LEGO1/lego/legoomni/include/misc.h b/LEGO1/lego/legoomni/include/misc.h index 67c97c78..65606dfb 100644 --- a/LEGO1/lego/legoomni/include/misc.h +++ b/LEGO1/lego/legoomni/include/misc.h @@ -3,9 +3,6 @@ #include "compat.h" #include "decomp.h" -#include "legoinputmanager.h" -#include "legoomni.h" -#include "legovideomanager.h" // Long include path due to dependency of misc library on LegoOmni #include "lego/legoomni/include/actions/actionsfwd.h" #include "mxtypes.h" @@ -16,6 +13,7 @@ class LegoBuildingManager; class LegoCharacterManager; class LegoControlManager; class LegoGameState; +class LegoInputManager; class LegoNavController; class LegoOmni; class LegoPlantManager; @@ -64,10 +62,4 @@ void PlayMusic(JukeboxScript::Script p_script); void SetIsWorldActive(MxBool p_isWorldActive); void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); -// FUNCTION: LEGO1 0x10015890 -inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) -{ - return LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction); -} - #endif // MISC_H diff --git a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h index 4b70e9e8..922ff625 100644 --- a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h +++ b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h @@ -1,13 +1,12 @@ #ifndef MXBACKGROUNDAUDIOMANAGER_H #define MXBACKGROUNDAUDIOMANAGER_H -#include "mxaudiopresenter.h" #include "mxcore.h" #include "mxdsaction.h" -#include "mxnotificationmanager.h" -#include "mxpresenter.h" #include "mxtypes.h" +class MxAudioPresenter; + // VTABLE: LEGO1 0x100d9fe8 // SIZE 0x150 class MxBackgroundAudioManager : public MxCore { diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 7884334d..bb8c18f7 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "isleactor.h" +class SkateBoard; + // VTABLE: LEGO1 0x100d7380 // SIZE 0x9c class Pizza : public IsleActor { @@ -31,18 +33,23 @@ class Pizza : public IsleActor { undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 undefined4 VTable0x80(MxParam&) override; // vtable+0x80 + void FUN_100382b0(); + void FUN_10038380(); + + inline void SetSkateboard(SkateBoard* p_skateboard) { m_skateboard = p_skateboard; } + // SYNTHETIC: LEGO1 0x100380e0 // Pizza::`scalar deleting destructor' private: - undefined4 m_unk0x7c; // 0x7c - undefined4 m_unk0x80; // 0x80 - undefined4 m_unk0x84; // 0x84 - undefined4 m_unk0x88; // 0x88 - undefined4 m_unk0x8c; // 0x8c - undefined4 m_unk0x90; // 0x90 - undefined4 m_unk0x94; // 0x94 - undefined m_unk0x98; // 0x98 + undefined4 m_unk0x7c; // 0x7c + undefined4 m_unk0x80; // 0x80 + SkateBoard* m_skateboard; // 0x84 + undefined4 m_unk0x88; // 0x88 + undefined4 m_unk0x8c; // 0x8c + undefined4 m_unk0x90; // 0x90 + undefined4 m_unk0x94; // 0x94 + undefined m_unk0x98; // 0x98 }; #endif // PIZZA_H diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 5b4e4778..4ba7ac20 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -2,12 +2,13 @@ #define POLICE_H #include "decomp.h" -#include "legocontrolmanager.h" #include "legogamestate.h" #include "legoworld.h" -#include "mxdsaction.h" #include "radio.h" +class LegoControlManagerEvent; +class LegoEventNotificationParam; +class MxDSAction; class PoliceState; // VTABLE: LEGO1 0x100d8a80 diff --git a/LEGO1/lego/legoomni/include/policestate.h b/LEGO1/lego/legoomni/include/policestate.h index 3f9a9bad..75970729 100644 --- a/LEGO1/lego/legoomni/include/policestate.h +++ b/LEGO1/lego/legoomni/include/policestate.h @@ -4,7 +4,6 @@ #include "actionsfwd.h" #include "decomp.h" #include "legostate.h" -#include "police.h" // VTABLE: LEGO1 0x100d8af0 // SIZE 0x10 diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 7e3cff87..3c35a300 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -1,10 +1,11 @@ #ifndef RADIO_H #define RADIO_H -#include "legocontrolmanager.h" -#include "mxactionnotificationparam.h" #include "mxcore.h" -#include "radiostate.h" + +class LegoControlManagerEvent; +class MxEndActionNotificationParam; +class RadioState; // VTABLE: LEGO1 0x100d6d10 // SIZE 0x10 diff --git a/LEGO1/lego/legoomni/include/radiostate.h b/LEGO1/lego/legoomni/include/radiostate.h index b768da19..e0c0066c 100644 --- a/LEGO1/lego/legoomni/include/radiostate.h +++ b/LEGO1/lego/legoomni/include/radiostate.h @@ -2,7 +2,8 @@ #define RADIOSTATE_H #include "legostate.h" -#include "mxdsaction.h" + +class MxAtomId; // VTABLE: LEGO1 0x100d6d28 // SIZE 0x30 diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index 9bb23115..1266d29b 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -1,14 +1,12 @@ #ifndef REGISTRATIONBOOK_H #define REGISTRATIONBOOK_H -#include "jukebox.h" -#include "legogamestate.h" #include "legoworld.h" -#include "mxcontrolpresenter.h" -#include "mxstillpresenter.h" class InfocenterState; +class MxControlPresenter; class MxEndActionNotificationParam; +class MxStillPresenter; class LegoControlManagerEvent; // VTABLE: LEGO1 0x100d9928 diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 9ee47851..71efd0f4 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -1,12 +1,12 @@ #ifndef SCORE_H #define SCORE_H -#include "legocontrolmanager.h" -#include "legoeventnotificationparam.h" #include "legogamestate.h" #include "legoworld.h" -#include "mxactionnotificationparam.h" -#include "scorestate.h" + +class LegoControlManagerEvent; +class MxEndActionNotificationParam; +class ScoreState; // VTABLE: LEGO1 0x100d4018 // SIZE 0x104 diff --git a/LEGO1/lego/legoomni/include/scripts.h b/LEGO1/lego/legoomni/include/scripts.h new file mode 100644 index 00000000..a47c8995 --- /dev/null +++ b/LEGO1/lego/legoomni/include/scripts.h @@ -0,0 +1,39 @@ +#ifndef SCRIPTS_H +#define SCRIPTS_H + +class MxAtomId; + +extern MxAtomId* g_copterScript; +extern MxAtomId* g_dunecarScript; +extern MxAtomId* g_jetskiScript; +extern MxAtomId* g_racecarScript; +extern MxAtomId* g_carraceScript; +extern MxAtomId* g_carracerScript; +extern MxAtomId* g_jetraceScript; +extern MxAtomId* g_jetracerScript; +extern MxAtomId* g_isleScript; +extern MxAtomId* g_elevbottScript; +extern MxAtomId* g_infodoorScript; +extern MxAtomId* g_infomainScript; +extern MxAtomId* g_infoscorScript; +extern MxAtomId* g_regbookScript; +extern MxAtomId* g_histbookScript; +extern MxAtomId* g_hospitalScript; +extern MxAtomId* g_policeScript; +extern MxAtomId* g_garageScript; +extern MxAtomId* g_act2mainScript; +extern MxAtomId* g_act3Script; +extern MxAtomId* g_jukeboxScript; +extern MxAtomId* g_pz5Script; +extern MxAtomId* g_introScript; +extern MxAtomId* g_testScript; +extern MxAtomId* g_jukeboxwScript; +extern MxAtomId* g_sndAnimScript; +extern MxAtomId* g_creditsScript; +extern MxAtomId* g_nocdSourceName; + +void CreateScripts(); +void DestroyScripts(); +const char* GetNoCD_SourceName(); + +#endif // SCRIPTS_H diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index b5d4fbf1..63a2bb87 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -4,11 +4,14 @@ #include "decomp.h" #include "islepathactor.h" +class Act1State; + // VTABLE: LEGO1 0x100d55f0 // SIZE 0x168 class SkateBoard : public IslePathActor { public: SkateBoard(); + ~SkateBoard() override; // FUNCTION: LEGO1 0x1000fdd0 inline const char* ClassName() const override // vtable+0x0c @@ -35,9 +38,10 @@ class SkateBoard : public IslePathActor { // SkateBoard::`scalar deleting destructor' private: - // TODO: SkateBoard types - undefined m_unk0x160; - undefined m_unk0x161[0x7]; + void FUN_10010270(MxBool p_enable); + + MxBool m_unk0x160; // 0x160 + Act1State* m_act1state; // 0x164 }; #endif // SKATEBOARD_H diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 2d1146ef..056f0793 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -23,14 +23,14 @@ class TowTrack : public IslePathActor { return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name); } - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 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 + 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(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 void FUN_1004dab0(); void FUN_1004dad0(); diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index 1ec5c841..98c167fe 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -1,5 +1,6 @@ #include "act1state.h" +#include "legonamedtexture.h" #include "legoutils.h" DECOMP_SIZE_ASSERT(Act1State, 0x26c) @@ -25,7 +26,7 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x m_unk0x01f = FALSE; m_unk0x008 = g_unk0x100f37f0; m_unk0x014 = -1; - m_unk0x022 = 0; + m_unk0x022 = FALSE; m_unk0x154 = NULL; m_unk0x158 = NULL; m_unk0x15c = NULL; @@ -122,8 +123,8 @@ MxResult Act1State::Serialize(LegoFile* p_legoFile) } } - p_legoFile->Write(&m_unk0x010, sizeof(undefined2)); - p_legoFile->Write(&m_unk0x022, sizeof(undefined)); + p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); } else if (p_legoFile->IsReadMode()) { if (m_unk0x108.GetName()->Compare("") != 0) { @@ -176,8 +177,8 @@ MxResult Act1State::Serialize(LegoFile* p_legoFile) } } - p_legoFile->Read(&m_unk0x010, sizeof(undefined2)); - p_legoFile->Read(&m_unk0x022, sizeof(undefined)); + p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); } // TODO @@ -205,7 +206,7 @@ MxBool Act1State::SetFlag() m_unk0x024.SetName(""); m_unk0x070.SetName(""); m_unk0x0bc.SetName(""); - m_unk0x022 = 0; + m_unk0x022 = FALSE; m_unk0x108.SetName(""); if (m_unk0x154) { diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 9c0f87e5..d793503b 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -1,14 +1,17 @@ #include "ambulance.h" +#include "ambulancemissionstate.h" #include "decomp.h" #include "legocontrolmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legovariables.h" +#include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxticklemanager.h" #include "mxtimer.h" +#include "mxvariabletable.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Ambulance, 0x184) diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 14133abd..e6be2228 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -3,10 +3,10 @@ #include "isle_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Bike, 0x164) diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index ca3a5c98..0dd71005 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -3,18 +3,20 @@ #include "act1state.h" #include "act3.h" #include "act3_actions.h" +#include "helicopterstate.h" #include "isle.h" #include "isle_actions.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legoanimationmanager.h" +#include "legocameracontroller.h" #include "legocontrolmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Helicopter, 0x230) DECOMP_SIZE_ASSERT(Mx3DPointFloat, 0x14) @@ -64,17 +66,23 @@ void Helicopter::GetState() void Helicopter::VTable0xe4() { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { - VTable0xe8(LegoGameState::e_unk40, TRUE, 7); + SpawnPlayer( + LegoGameState::e_unk40, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } IslePathActor::VTable0xe4(); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_copter); - if (CurrentActor()) { - if (CurrentActor()->IsA("IslePathActor")) { - ((IslePathActor*) CurrentActor())->VTable0xe8(LegoGameState::e_unk55, TRUE, 7); - } + if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) { + CurrentActor()->SpawnPlayer( + LegoGameState::e_unk55, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } } @@ -115,8 +123,12 @@ MxU32 Helicopter::VTable0xcc() switch (GameState()->GetCurrentAct()) { case LegoGameState::e_act1: m_script = *g_isleScript; - AnimationManager()->FUN_10064670(FALSE); - VTable0xe8(LegoGameState::e_unk41, TRUE, 7); + AnimationManager()->FUN_10064670(NULL); + SpawnPlayer( + LegoGameState::e_unk41, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter); FUN_10015820(TRUE, 0); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE); @@ -248,7 +260,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10003c20 -MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) +MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param) { MxU32 ret = 0; @@ -256,10 +268,18 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) case 1: { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); - VTable0xe8(LegoGameState::e_unk42, TRUE, 7); + SpawnPlayer( + LegoGameState::e_unk42, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } else { - VTable0xe8(LegoGameState::e_unk49, TRUE, 7); + SpawnPlayer( + LegoGameState::e_unk49, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } m_state->SetUnknown8(2); @@ -293,10 +313,18 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); - VTable0xe8(LegoGameState::e_unk41, TRUE, 7); + SpawnPlayer( + LegoGameState::e_unk41, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } else { - VTable0xe8(LegoGameState::e_unk48, TRUE, 7); + SpawnPlayer( + LegoGameState::e_unk48, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } m_state->SetUnknown8(0); diff --git a/LEGO1/lego/legoomni/src/actors/isleactor.cpp b/LEGO1/lego/legoomni/src/actors/isleactor.cpp index 9281a443..a09c62d7 100644 --- a/LEGO1/lego/legoomni/src/actors/isleactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/isleactor.cpp @@ -1,10 +1,10 @@ #include "isleactor.h" #include "legoentity.h" -#include "legoomni.h" #include "legoworld.h" #include "misc.h" #include "mxnotificationparam.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(IsleActor, 0x7c) @@ -45,7 +45,7 @@ MxLong IsleActor::Notify(MxParam& p_param) case c_notificationType11: result = VTable0x68(); break; - case c_notificationType18: + case c_notificationEndAnim: result = VTable0x70(); break; case c_notificationType19: diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 46dce944..60c2fa3d 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -1,13 +1,25 @@ #include "islepathactor.h" +#include "3dmanager/lego3dmanager.h" +#include "isle_actions.h" +#include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legoutils.h" +#include "legovehiclebuildstate.h" +#include "legovideomanager.h" +#include "legoworld.h" #include "misc.h" +#include "mxbackgroundaudiomanager.h" #include "mxnotificationparam.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(IslePathActor, 0x160) +DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38) + +// GLOBAL: LEGO1 0x10102b28 +IslePathActor::SpawnLocation g_spawnLocations[IslePathActor::c_LOCATIONS_NUM]; // FUNCTION: LEGO1 0x1001a200 IslePathActor::IslePathActor() @@ -47,8 +59,8 @@ MxLong IslePathActor::Notify(MxParam& p_param) case c_notificationClick: ret = VTable0xd4((LegoControlManagerEvent&) p_param); break; - case c_notificationType18: - ret = VTable0xd8((MxType18NotificationParam&) p_param); + case c_notificationEndAnim: + ret = VTable0xd8((LegoEndAnimNotificationParam&) p_param); break; case c_notificationType19: ret = VTable0xdc((MxType19NotificationParam&) p_param); @@ -90,10 +102,454 @@ void IslePathActor::VTable0xe4() // TODO } -// STUB: LEGO1 0x1001b2a0 -void IslePathActor::VTable0xe8(LegoGameState::Area, MxBool, MxU8) +// FUNCTION: LEGO1 0x1001a700 +void IslePathActor::RegisterSpawnLocations() { - // TODO + g_spawnLocations[0] = SpawnLocation( + LegoGameState::e_pizzeriaExterior, + g_isleScript, + 0, + "int35", + 2, + 0.6, + 4, + 0.4, + 0x2a, + JukeboxScript::c_Quiet_Audio + ); + g_spawnLocations[1] = SpawnLocation( + LegoGameState::e_unk23, + g_isleScript, + 0, + "edg00_49", + 1, + 0.43, + 2, + 0.6, + 0x27, + JukeboxScript::c_Quiet_Audio + ); + g_spawnLocations[2] = SpawnLocation( + LegoGameState::e_unk24, + g_isleScript, + 0, + "edg00_191", + 2, + 0.5, + 0, + 0.55, + 0x26, + JukeboxScript::c_Quiet_Audio + ); + g_spawnLocations[3] = SpawnLocation( + LegoGameState::e_unk4, + g_isleScript, + 0, + "int46", + 0, + 0.5, + 2, + 0.5, + 0x10, + JukeboxScript::c_InformationCenter_Music + ); + g_spawnLocations[4] = SpawnLocation( + LegoGameState::e_jetraceExterior, + g_isleScript, + 0, + "EDG00_46", + 0, + 0.95, + 2, + 0.19, + 0x17, + JukeboxScript::c_Beach_Music + ); + g_spawnLocations[5] = SpawnLocation( + LegoGameState::e_unk17, + g_isleScript, + 0, + "EDG00_46", + 3, + 0.625, + 2, + 0.03, + 0x18, + JukeboxScript::c_Beach_Music + ); + g_spawnLocations[6] = SpawnLocation( + LegoGameState::e_jetrace2, + g_isleScript, + 0, + "EDG10_63", + 0, + 0.26, + 1, + 0.01, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[7] = SpawnLocation( + LegoGameState::e_carraceExterior, + g_isleScript, + 0, + "INT15", + 5, + 0.65, + 1, + 0.68, + 0x33, + JukeboxScript::c_CentralNorthRoad_Music + ); + g_spawnLocations[8] = SpawnLocation( + LegoGameState::e_unk20, + g_isleScript, + 0, + "INT16", + 4, + 0.1, + 2, + 0, + 0x34, + JukeboxScript::c_CentralNorthRoad_Music + ); + g_spawnLocations[9] = SpawnLocation( + LegoGameState::e_unk21, + g_isleScript, + 0, + "INT62", + 2, + 0.1, + 3, + 0.7, + 0x36, + JukeboxScript::c_CentralNorthRoad_Music + ); + g_spawnLocations[10] = SpawnLocation( + LegoGameState::e_garageExterior, + g_isleScript, + 0, + "INT24", + 0, + 0.55, + 2, + 0.71, + 0x08, + JukeboxScript::c_GarageArea_Music + ); + g_spawnLocations[11] = SpawnLocation( + LegoGameState::e_unk28, + g_isleScript, + 0, + "INT24", + 2, + 0.73, + 4, + 0.71, + 0x0a, + JukeboxScript::c_GarageArea_Music + ); + g_spawnLocations[12] = SpawnLocation( + LegoGameState::e_hospitalExterior, + g_isleScript, + 0, + "INT19", + 0, + 0.85, + 1, + 0.28, + 0, + JukeboxScript::c_Hospital_Music + ); + g_spawnLocations[13] = SpawnLocation( + LegoGameState::e_unk31, + g_isleScript, + 0, + "EDG02_28", + 3, + 0.37, + 1, + 0.52, + 0x0c, + JukeboxScript::c_Hospital_Music + ); + g_spawnLocations[14] = SpawnLocation( + LegoGameState::e_policeExterior, + g_isleScript, + 0, + "INT33", + 0, + 0.88, + 2, + 0.74, + 0x22, + JukeboxScript::c_PoliceStation_Music + ); + g_spawnLocations[15] = SpawnLocation( + LegoGameState::e_unk33, + g_isleScript, + 0, + "EDG02_64", + 2, + 0.24, + 0, + 0.84, + 0x23, + JukeboxScript::c_PoliceStation_Music + ); + g_spawnLocations[16] = SpawnLocation( + LegoGameState::e_unk40, + g_isleScript, + 0, + "edg02_51", + 2, + 0.63, + 3, + 0.01, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[17] = SpawnLocation( + LegoGameState::e_unk41, + g_isleScript, + 0, + "edg02_51", + 2, + 0.63, + 0, + 0.4, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[18] = SpawnLocation( + LegoGameState::e_unk43, + g_isleScript, + 0, + "edg02_35", + 2, + 0.8, + 0, + 0.2, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[19] = SpawnLocation( + LegoGameState::e_unk44, + g_isleScript, + 0, + "EDG03_01", + 2, + 0.25, + 0, + 0.75, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[20] = SpawnLocation( + LegoGameState::e_unk45, + g_isleScript, + 0, + "edg10_70", + 3, + 0.25, + 0, + 0.7, + 0x44, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[21] = SpawnLocation( + LegoGameState::e_unk42, + g_isleScript, + 0, + "inv_05", + 2, + 0.75, + 0, + 0.19, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[22] = SpawnLocation( + LegoGameState::e_unk48, + g_act3Script, + 0, + "edg02_51", + 2, + 0.63, + 0, + 0.4, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[23] = SpawnLocation( + LegoGameState::e_unk49, + g_act3Script, + 0, + "inv_05", + 2, + 0.75, + 0, + 0.19, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[24] = SpawnLocation( + LegoGameState::e_unk50, + g_act2mainScript, + 0, + "EDG02_51", + 0, + 0.64, + 1, + 0.37, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[25] = SpawnLocation( + LegoGameState::e_unk51, + g_isleScript, + 0, + "edg02_32", + 0, + 0.5, + 2, + 0.5, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[26] = SpawnLocation( + LegoGameState::e_unk52, + g_isleScript, + 0, + "edg02_19", + 2, + 0.5, + 0, + 0.5, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[27] = SpawnLocation( + LegoGameState::e_unk54, + g_isleScript, + 0, + "int36", + 0, + 0.2, + 4, + 0.4, + 0, + JukeboxScript::c_noneJukebox + ); + g_spawnLocations[28] = SpawnLocation( + LegoGameState::e_unk55, + g_isleScript, + 0, + "edg02_50", + 2, + 0.8, + 1, + 0.3, + 0, + JukeboxScript::c_noneJukebox + ); +} + +// FUNCTION: LEGO1 0x1001b2a0 +// FUNCTION: BETA10 0x100369c6 +void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags) +{ + MxS16 i; + + for (i = 0; i < c_LOCATIONS_NUM && g_spawnLocations[i].m_area != p_area; i++) { + } + + assert(i != c_LOCATIONS_NUM); + + if (i != c_LOCATIONS_NUM) { + LegoWorld* world = FindWorld(*g_spawnLocations[i].m_script, g_spawnLocations[i].m_entityId); + assert(world); + + if (m_world != NULL) { + m_world->FUN_1001fc80(this); + m_world->Remove(this); + VideoManager()->Get3DManager()->Remove(*m_roi); + } + + m_world = world; + + if (p_und) { + VTable0xe0(); + } + + m_world->FUN_1001f720( + this, + g_spawnLocations[i].m_path, + g_spawnLocations[i].m_src, + g_spawnLocations[i].m_srcScale, + g_spawnLocations[i].m_dest, + g_spawnLocations[i].m_destScale + ); + + if (GameState()->GetActorId() != m_actorId) { + m_world->Add(this); + } + + LegoVehicleBuildState* state = NULL; + + if (p_flags & c_spawnBit1) { + MxBool und = FALSE; + IsleScript::Script anim; + + switch (g_spawnLocations[i].m_unk0x30) { + case 0x00: + case 0x44: + break; + case 0x0a: + state = (LegoVehicleBuildState*) GameState()->GetState("LegoDuneCarBuildState"); + anim = IsleScript::c_igs008na_RunAnim; + break; + case 0x18: + state = (LegoVehicleBuildState*) GameState()->GetState("LegoJetskiBuildState"); + anim = IsleScript::c_ijs006sn_RunAnim; + break; + case 0x23: + state = (LegoVehicleBuildState*) GameState()->GetState("LegoCopterBuildState"); + anim = IsleScript::c_ips002ro_RunAnim; + break; + case 0x34: + state = (LegoVehicleBuildState*) GameState()->GetState("LegoRaceCarBuildState"); + anim = IsleScript::c_irt007in_RunAnim; + break; + default: + und = TRUE; + break; + } + + if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) { + if (AnimationManager()->FUN_10060dc0(anim, NULL, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE) == + SUCCESS) { + state->m_unk0x4e = TRUE; + und = FALSE; + } + } + + if (und) { + FUN_1003ecc0(this, 0, g_spawnLocations[i].m_unk0x30, TRUE); + } + } + + if (m_cameraFlag) { + FUN_1003eda0(); + } + + if (p_flags & c_playMusic && g_spawnLocations[i].m_music != JukeboxScript::c_noneJukebox) { + MxDSAction action; + action.SetAtomId(*g_jukeboxScript); + action.SetObjectId(g_spawnLocations[i].m_music); + BackgroundAudioManager()->PlayMusic(action, 5, 4); + } + } } // FUNCTION: LEGO1 0x1001b5b0 diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 167fc4ce..ade45933 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -6,13 +6,14 @@ #include "jukebox_actions.h" #include "jukeboxstate.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxnotificationparam.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(JukeBoxEntity, 0x6c) diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 6a16c580..57ab17df 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -8,13 +8,13 @@ DECOMP_SIZE_ASSERT(Pizza, 0x9c) // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() { - this->m_unk0x7c = 0; - this->m_unk0x80 = 0; - this->m_unk0x84 = 0; - this->m_unk0x88 = 0; - this->m_unk0x8c = -1; - this->m_unk0x98 = 0; - this->m_unk0x90 = 0x80000000; + m_unk0x7c = 0; + m_unk0x80 = 0; + m_skateboard = NULL; + m_unk0x88 = 0; + m_unk0x8c = -1; + m_unk0x98 = 0; + m_unk0x90 = 0x80000000; } // FUNCTION: LEGO1 0x10038100 @@ -30,6 +30,16 @@ MxResult Pizza::Create(MxDSAction& p_dsAction) return SUCCESS; } +// STUB: LEGO1 0x100382b0 +void Pizza::FUN_100382b0() +{ +} + +// STUB: LEGO1 0x10038380 +void Pizza::FUN_10038380() +{ +} + // STUB: LEGO1 0x100383f0 undefined4 Pizza::VTable0x68() { diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index e21a399f..a04523b1 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -3,12 +3,15 @@ #include "isle_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" -#include "legoomni.h" +#include "legoworld.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxcontrolpresenter.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "radiostate.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Radio, 0x10) @@ -80,7 +83,7 @@ void Radio::Stop() if (m_state->IsActive()) { LegoWorld* world = CurrentWorld(); - MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), 18); + MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtom(), IsleScript::c_Radio_Ctl); if (presenter) { presenter->VTable0x6c(0); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index a111c7a7..352e0bba 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,58 +1,165 @@ #include "skateboard.h" +#include "act1state.h" #include "decomp.h" +#include "isle.h" +#include "isle_actions.h" +#include "jukebox_actions.h" +#include "legoanimationmanager.h" +#include "legocontrolmanager.h" +#include "legoutils.h" +#include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" +#include "mxtransitionmanager.h" +#include "pizza.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(SkateBoard, 0x168) // FUNCTION: LEGO1 0x1000fd40 SkateBoard::SkateBoard() { - this->m_unk0x160 = 0; - this->m_unk0x13c = 15.0; - this->m_unk0x150 = 3.5; - this->m_unk0x148 = 1; + m_unk0x160 = FALSE; + m_unk0x13c = 15.0; + m_unk0x150 = 3.5; + m_unk0x148 = 1; NotificationManager()->Register(this); } -// STUB: LEGO1 0x10010000 +// FUNCTION: LEGO1 0x1000ff80 +SkateBoard::~SkateBoard() +{ + ControlManager()->Unregister(this); + NotificationManager()->Unregister(this); +} + +// FUNCTION: LEGO1 0x10010000 MxResult SkateBoard::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult result = IslePathActor::Create(p_dsAction); + + if (result == SUCCESS) { + m_world = CurrentWorld(); + m_world->Add(this); + + Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); + if (pizza) { + pizza->SetSkateboard(this); + } + } + + return result; } -// STUB: LEGO1 0x10010050 +// FUNCTION: LEGO1 0x10010050 void SkateBoard::VTable0xe4() { - // TODO + if (m_act1state->m_unk0x018 == 3) { + Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); + pizza->FUN_10038380(); + pizza->FUN_100382b0(); + m_unk0x160 = FALSE; + } + + IslePathActor::VTable0xe4(); + GameState()->m_currentArea = LegoGameState::Area::e_skateboard; + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); + ControlManager()->Unregister(this); } -// STUB: LEGO1 0x100100e0 +// FUNCTION: LEGO1 0x100100e0 MxU32 SkateBoard::VTable0xcc() { - // TODO - return 0; + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (!FUN_1003ef60() && state->m_unk0x018 != 3) { + return 1; + } + + FUN_10015820(TRUE, 0); + + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard); + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); + + if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { + if (!CurrentActor()->IsA("SkateBoard")) { + CurrentActor()->VTable0xe4(); + } + } + + if (!CurrentActor()->IsA("SkateBoard")) { + VTable0xe0(); + InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); + GetCurrentAction().SetObjectId(-1); + ControlManager()->Register(this); + } + + FUN_10010270(m_unk0x160); + + Vector3 position = m_roi->GetWorldPosition(); + AnimationManager()->FUN_10064670(&position); + AnimationManager()->FUN_10064740(&position); + return 1; } -// STUB: LEGO1 0x10010230 +// FUNCTION: LEGO1 0x10010230 MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) { - // TODO - return 0; + MxU32 result = 0; + + if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) { + VTable0xe4(); + GameState()->m_currentArea = LegoGameState::Area::e_unk66; + result = 1; + } + + return result; } -// STUB: LEGO1 0x100104f0 +// FUNCTION: LEGO1 0x10010270 +// FUNCTION: BETA10 0x100f5366 +void SkateBoard::FUN_10010270(MxBool p_enable) +{ + m_act1state = (Act1State*) GameState()->GetState("Act1State"); + if (!m_act1state) { + m_act1state = (Act1State*) GameState()->CreateState("Act1State"); + } + + MxStillPresenter* presenter = (MxStillPresenter*) m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); + if (presenter) { + presenter->Enable(p_enable); + } + else if (m_unk0x160) { + NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL)); + } +} + +// FUNCTION: LEGO1 0x100104f0 +// FUNCTION: BETA10 0x100f5472 MxU32 SkateBoard::VTable0xd0() { - // TODO - return 0; + FUN_10010270(m_unk0x160); + return 1; } -// STUB: LEGO1 0x10010510 +// FUNCTION: LEGO1 0x10010510 void SkateBoard::FUN_10010510() { - // TODO + if (m_act1state->m_unk0x018 != 3) { + PlayMusic(JukeboxScript::c_BeachBlvd_Music); + + if (!m_act1state->m_unk0x022) { + m_act1state->m_unk0x022 = TRUE; + + MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); + mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5); + + AnimationManager() + ->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + } + } } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index c99c4f11..2b087966 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -37,7 +37,7 @@ MxLong TowTrack::Notify(MxParam& p_param) } // STUB: LEGO1 0x1004cd30 -MxU32 TowTrack::VTable0xd8(MxType18NotificationParam& p_param) +MxU32 TowTrack::VTable0xd8(LegoEndAnimNotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp index a30aa94a..59ca793b 100644 --- a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp @@ -1,8 +1,10 @@ #include "legoloadcachesoundpresenter.h" +#include "legocachesoundmanager.h" #include "legocachsound.h" #include "legosoundmanager.h" #include "misc.h" +#include "mxdssubscriber.h" #include "mxstreamchunk.h" #include "mxwavepresenter.h" diff --git a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp index 0c077963..942f8040 100644 --- a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp @@ -1,5 +1,6 @@ #include "legosoundmanager.h" +#include "legocachesoundmanager.h" #include "mxautolock.h" #include "mxomni.h" diff --git a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp index 4a3a0eda..d10888ff 100644 --- a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp @@ -1,10 +1,12 @@ #include "mxbackgroundaudiomanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" +#include "mxaudiopresenter.h" #include "mxcompositepresenter.h" #include "mxdssound.h" #include "mxmisc.h" +#include "mxnotificationmanager.h" #include "mxpresenter.h" #include "mxstreamer.h" #include "mxticklemanager.h" diff --git a/LEGO1/lego/legoomni/src/build/buildingentity.cpp b/LEGO1/lego/legoomni/src/build/buildingentity.cpp index 15a2fdfd..7986a589 100644 --- a/LEGO1/lego/legoomni/src/build/buildingentity.cpp +++ b/LEGO1/lego/legoomni/src/build/buildingentity.cpp @@ -2,6 +2,7 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxnotificationparam.h" DECOMP_SIZE_ASSERT(BuildingEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp index 43227d51..2e5df9ef 100644 --- a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp +++ b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp @@ -9,8 +9,8 @@ LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) { this->m_className = p_classType; this->m_unk0x4c = 0; - this->m_unk0x4d = 0; - this->m_unk0x4e = 0; + this->m_unk0x4d = FALSE; + this->m_unk0x4e = FALSE; this->m_placedPartCount = 0; } diff --git a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp index 86972b68..607a0595 100644 --- a/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp @@ -2,13 +2,15 @@ #include "define.h" #include "extra.h" -#include "legoomni.h" +#include "legomain.h" #include "legoutils.h" #include "mxcompositepresenter.h" +#include "mxdssubscriber.h" #include "mxmediapresenter.h" #include "mxmisc.h" #include "mxstreamchunk.h" #include "mxticklemanager.h" +#include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoActionControlPresenter, 0x68) diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 2bf7664f..8f304edf 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1,18 +1,23 @@ #include "legoanimationmanager.h" +#include "animstate.h" #include "define.h" #include "islepathactor.h" #include "legocharactermanager.h" +#include "legoendanimnotificationparam.h" +#include "legoextraactor.h" #include "legogamestate.h" -#include "legoomni.h" +#include "legomain.h" #include "legoroilist.h" +#include "legovideomanager.h" +#include "legoworld.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" +#include "mxnotificationmanager.h" #include "mxticklemanager.h" #include "mxtimer.h" #include "mxutilities.h" -#include "roi/legoroi.h" #include @@ -22,6 +27,9 @@ DECOMP_SIZE_ASSERT(Vehicle, 0x08) DECOMP_SIZE_ASSERT(Unknown0x3c, 0x18) DECOMP_SIZE_ASSERT(LegoTranInfo, 0x78) +// GLOBAL: LEGO1 0x100d8b28 +MxU8 g_unk0x100d8b28[] = {0, 1, 2, 4, 8, 16}; + // GLOBAL: LEGO1 0x100f6d20 Vehicle g_vehicles[] = { {"bikebd", 0, FALSE}, @@ -84,9 +92,18 @@ Character g_characters[47] = { {"jk", FALSE, -1, 0, FALSE, FALSE, TRUE, 1500, 20000, FALSE, 0, 0} }; +// GLOBAL: LEGO1 0x100f74b0 +float g_unk0x100f74b0 = 10.0f; + +// GLOBAL: LEGO1 0x100f74ec +float g_unk0x100f74ec = -1.0f; + // GLOBAL: LEGO1 0x100f74f8 MxS32 g_legoAnimationManagerConfig = 1; +// GLOBAL: LEGO1 0x100f7500 +float g_unk0x100f7500 = 0.1f; + // FUNCTION: LEGO1 0x1005eb50 void LegoAnimationManager::configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig) { @@ -152,14 +169,14 @@ LegoAnimationManager::~LegoAnimationManager() // FUNCTION: BETA10 0x1003fbc0 void LegoAnimationManager::Reset(MxBool p_und) { - m_unk0x402 = 0; + m_unk0x402 = FALSE; if (p_und && m_animState != NULL) { m_animState->SetFlag(); } - undefined unk0x42b = m_unk0x42b; - FUN_1005ef10(); + MxBool suspended = m_suspended; + Suspend(); if (m_tranInfoList != NULL) { delete m_tranInfoList; @@ -172,34 +189,105 @@ void LegoAnimationManager::Reset(MxBool p_und) DeleteAnimations(); Init(); - m_unk0x42b = unk0x42b; + m_suspended = suspended; m_unk0x428 = m_unk0x3a; m_unk0x429 = m_unk0x400; m_unk0x42a = m_unk0x402; } -// STUB: LEGO1 0x1005ef10 -void LegoAnimationManager::FUN_1005ef10() +// FUNCTION: LEGO1 0x1005ef10 +// FUNCTION: BETA10 0x1003fc7a +void LegoAnimationManager::Suspend() { - // TODO + m_animState = (AnimState*) GameState()->GetState("AnimState"); + if (m_animState == NULL) { + m_animState = (AnimState*) GameState()->CreateState("AnimState"); + } + + if (m_scriptIndex == 0) { + m_animState->FUN_10065240(m_animCount, m_anims, m_unk0x3fc); + } + + if (!m_suspended) { + m_suspended = TRUE; + m_unk0x428 = m_unk0x3a; + m_unk0x429 = m_unk0x400; + m_unk0x42a = m_unk0x402; + m_unk0x402 = FALSE; + + FUN_10061010(0); + + MxS32 i; + for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL) { + LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + + if (actor != NULL && actor->GetController() != NULL) { + actor->GetController()->FUN_10046770(actor); + actor->ClearController(); + } + + CharacterManager()->FUN_10083db0(roi); + } + + if (m_unk0x3c[i].m_unk0x14) { + m_unk0x3c[i].m_unk0x14 = FALSE; + + MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + + LegoROI* roi = Lego()->FindROI(g_vehicles[vehicleId].m_name); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + + m_unk0x3c[i].m_roi = NULL; + m_unk0x3c[i].m_characterId = -1; + m_unk0x3c[i].m_unk0x10 = -1.0f; + } + + m_unk0x18 = 0; + m_unk0x1a = FALSE; + m_unk0x3a = FALSE; + m_unk0x400 = FALSE; + m_unk0x414 = 0; + m_unk0x401 = FALSE; + + for (i = 0; i < (MxS32) _countof(g_characters); i++) { + g_characters[i].m_unk0x04 = FALSE; + } + } } -// STUB: LEGO1 0x1005f0b0 -void LegoAnimationManager::FUN_1005f0b0() +// FUNCTION: LEGO1 0x1005f0b0 +// FUNCTION: BETA10 0x1003fefe +void LegoAnimationManager::Resume() { - // TODO + if (m_suspended) { + m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); + m_unk0x410 = 5000; + m_unk0x3a = m_unk0x428; + m_unk0x400 = m_unk0x429; + m_unk0x402 = m_unk0x42a; + m_suspended = FALSE; + } } // FUNCTION: LEGO1 0x1005f130 // FUNCTION: BETA10 0x1003ffb7 void LegoAnimationManager::Init() { - m_unk0x402 = 0; + m_unk0x402 = FALSE; m_scriptIndex = -1; m_animCount = 0; m_anims = NULL; m_unk0x18 = 0; - m_unk0x1a = 0; + m_unk0x1a = FALSE; m_tranInfoList = NULL; m_tranInfoList2 = NULL; m_unk0x41c = g_legoAnimationManagerConfig <= 1 ? 10 : 20; @@ -212,24 +300,24 @@ void LegoAnimationManager::Init() for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { m_unk0x3c[i].m_roi = NULL; - m_unk0x3c[i].m_id = -1; + m_unk0x3c[i].m_characterId = -1; m_unk0x3c[i].m_unk0x10 = -1.0f; - m_unk0x3c[i].m_unk0x14 = 0; + m_unk0x3c[i].m_unk0x14 = FALSE; } m_unk0x38 = FALSE; m_unk0x39 = FALSE; - m_unk0x3a = 1; + m_unk0x3a = TRUE; m_unk0x3fc = 0; - m_unk0x400 = 0; + m_unk0x400 = FALSE; m_unk0x414 = 0; - m_unk0x418 = 5; + m_numAllowedExtras = 5; m_unk0x0e = 0; m_unk0x10 = 0; - m_unk0x401 = 0; - m_unk0x42b = 0; - m_unk0x430 = 0; - m_unk0x42c = 0; + m_unk0x401 = FALSE; + m_suspended = FALSE; + m_unk0x430 = FALSE; + m_unk0x42c = NULL; m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); m_unk0x410 = 5000; @@ -251,16 +339,32 @@ void LegoAnimationManager::Init() m_unk0x424 = new LegoROIList(); } -// STUB: LEGO1 0x1005f6d0 -void LegoAnimationManager::FUN_1005f6d0(MxBool) +// FUNCTION: LEGO1 0x1005f6d0 +// FUNCTION: BETA10 0x100401e7 +void LegoAnimationManager::FUN_1005f6d0(MxBool p_unk0x400) { - // TODO + if (m_suspended) { + m_unk0x429 = p_unk0x400; + } + else { + m_unk0x400 = p_unk0x400; + + if (!p_unk0x400) { + FUN_100627d0(TRUE); + } + } } -// STUB: LEGO1 0x1005f700 -void LegoAnimationManager::FUN_1005f700(MxBool) +// FUNCTION: LEGO1 0x1005f700 +// FUNCTION: BETA10 0x1004024c +void LegoAnimationManager::FUN_1005f700(MxBool p_unk0x3a) { - // TODO + if (m_suspended) { + m_unk0x428 = p_unk0x3a; + } + else { + m_unk0x3a = p_unk0x3a; + } } // FUNCTION: LEGO1 0x1005f720 @@ -287,8 +391,8 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_unk0x38 = FALSE; m_unk0x39 = FALSE; - m_unk0x430 = 0; - m_unk0x42c = 0; + m_unk0x430 = FALSE; + m_unk0x42c = NULL; for (j = 0; j < (MxS32) _countof(g_characters); j++) { g_characters[j].m_active = FALSE; @@ -364,7 +468,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) } m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2); - m_anims[j].m_unk0x29 = 0; + m_anims[j].m_unk0x29 = FALSE; for (k = 0; k < 3; k++) { m_anims[j].m_unk0x2a[k] = -1; @@ -400,15 +504,15 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) FUN_100617c0(-1, m_unk0x0e, m_unk0x10); result = SUCCESS; - m_unk0x402 = 1; + m_unk0x402 = TRUE; - if (m_unk0x42b) { + if (m_suspended) { m_unk0x428 = m_unk0x3a; m_unk0x429 = m_unk0x400; - m_unk0x42a = 1; - m_unk0x3a = 0; - m_unk0x400 = 0; - m_unk0x402 = 0; + m_unk0x42a = TRUE; + m_unk0x3a = FALSE; + m_unk0x400 = FALSE; + m_unk0x402 = FALSE; } if (p_scriptIndex == 0) { @@ -541,7 +645,7 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoFile* p_file, ModelInfo* p_info // FUNCTION: LEGO1 0x100603c0 void LegoAnimationManager::DeleteAnimations() { - undefined unk0x42b = m_unk0x42b; + MxBool suspended = m_suspended; if (m_anims != NULL) { for (MxS32 i = 0; i < m_animCount; i++) { @@ -560,7 +664,7 @@ void LegoAnimationManager::DeleteAnimations() } Init(); - m_unk0x42b = unk0x42b; + m_suspended = suspended; } // STUB: LEGO1 0x10060570 @@ -569,22 +673,100 @@ void LegoAnimationManager::FUN_10060570(MxBool) // TODO } -// STUB: LEGO1 0x100605e0 +// FUNCTION: LEGO1 0x100605e0 // FUNCTION: BETA10 0x1004152b MxResult LegoAnimationManager::FUN_100605e0( MxU32 p_index, - MxU8 p_unk0x0a, + MxBool p_unk0x0a, MxMatrix* p_matrix, - undefined, - undefined4, - undefined, - MxBool, - MxBool, - undefined + MxBool p_bool1, + LegoROI* p_roi, + MxBool p_bool2, + MxBool p_bool3, + MxBool p_bool4, + MxBool p_bool5 ) { - // TODO - return FAILURE; + MxResult result = FAILURE; + + if (m_scriptIndex != -1 && p_index < m_animCount && m_tranInfoList != NULL) { + FUN_100627d0(FALSE); + FUN_10062770(); + + MxDSAction action; + AnimInfo& animInfo = m_anims[p_index]; + + if (!p_bool1) { + if (m_unk0x39 || !animInfo.m_unk0x29) { + return FAILURE; + } + + if (FUN_100623a0(animInfo)) { + return FAILURE; + } + + if (FUN_10062710(animInfo)) { + return FAILURE; + } + } + + FUN_10062580(animInfo); + + LegoTranInfo* tranInfo = new LegoTranInfo(); + tranInfo->m_animInfo = &animInfo; + tranInfo->m_index = ++m_unk0x1c; + tranInfo->m_unk0x10 = 0; + tranInfo->m_unk0x08 = p_roi; + tranInfo->m_unk0x12 = m_anims[p_index].m_unk0x08; + tranInfo->m_unk0x14 = p_unk0x0a; + tranInfo->m_objectId = animInfo.m_objectId; + tranInfo->m_unk0x15 = p_bool2; + + if (p_matrix != NULL) { + tranInfo->m_unk0x0c = new MxMatrix(*p_matrix); + } + + tranInfo->m_unk0x1c = m_unk0x28; + tranInfo->m_unk0x20 = m_unk0x30; + tranInfo->m_unk0x28 = p_bool3; + tranInfo->m_unk0x29 = p_bool4; + + if (m_tranInfoList != NULL) { + m_tranInfoList->Append(tranInfo); + } + + char buf[256]; + sprintf(buf, "%s:%d", g_strANIMMAN_ID, tranInfo->m_index); + + action.SetAtomId(*Lego()->GetScriptAtom(m_scriptIndex)); + action.SetObjectId(animInfo.m_objectId); + action.SetUnknown24(-1); + action.AppendExtra(strlen(buf) + 1, buf); + + if (StartActionIfUnknown0x13c(action) == SUCCESS) { + BackgroundAudioManager()->LowerVolume(); + tranInfo->m_flags |= LegoTranInfo::c_bit2; + animInfo.m_unk0x22++; + m_unk0x404 = Timer()->GetTime(); + + if (p_bool5) { + FUN_100648f0(tranInfo, m_unk0x404); + } + else if (p_unk0x0a) { + IslePathActor* actor = CurrentActor(); + + if (actor != NULL) { + actor->SetState(4); + actor->SetWorldSpeed(0.0f); + } + } + + m_unk0x39 = TRUE; + result = SUCCESS; + } + } + + return result; } // FUNCTION: LEGO1 0x100609f0 @@ -597,12 +779,12 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix FUN_100627d0(FALSE); LegoTranInfo* info = new LegoTranInfo(); - info->m_unk0x00 = 0; + info->m_animInfo = NULL; info->m_index = ++m_unk0x1c; info->m_unk0x10 = 0; info->m_unk0x08 = NULL; info->m_unk0x12 = -1; - info->m_unk0x14 = 0; + info->m_unk0x14 = FALSE; info->m_objectId = p_objectId; if (p_matrix != NULL) { @@ -657,7 +839,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { if (m_unk0x3c[i].m_roi == roi) { - MxU32 characterId = m_unk0x3c[i].m_id; + MxS32 characterId = m_unk0x3c[i].m_characterId; g_characters[characterId].m_unk0x07 = TRUE; MxS32 vehicleId = g_characters[characterId].m_vehicleId; @@ -671,7 +853,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt } } - if (StartActionIfUnknown0x13c(p_dsAction) == SUCCESS) { + if (LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction) == SUCCESS) { result = SUCCESS; } @@ -683,13 +865,13 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt MxResult LegoAnimationManager::FUN_10060dc0( IsleScript::Script p_objectId, MxMatrix* p_matrix, - undefined p_param3, - undefined p_param4, - undefined4 p_param5, - undefined p_param6, + MxBool p_param3, + MxBool p_param4, + LegoROI* p_roi, + MxBool p_param6, MxBool p_param7, MxBool p_param8, - undefined p_param9 + MxBool p_param9 ) { MxResult result = FAILURE; @@ -702,21 +884,21 @@ MxResult LegoAnimationManager::FUN_10060dc0( for (MxS32 i = 0; i < m_animCount; i++) { if (m_anims[i].m_objectId == p_objectId) { found = TRUE; - undefined unk0x0a; + MxBool unk0x0a; switch (p_param4) { - case 0: + case FALSE: unk0x0a = m_anims[i].m_unk0x0a; break; - case 1: - unk0x0a = 1; + case TRUE: + unk0x0a = TRUE; break; default: - unk0x0a = 0; + unk0x0a = FALSE; break; } - result = FUN_100605e0(i, unk0x0a, p_matrix, p_param3, p_param5, p_param6, p_param7, p_param8, p_param9); + result = FUN_100605e0(i, unk0x0a, p_matrix, p_param3, p_roi, p_param6, p_param7, p_param8, p_param9); break; } } @@ -734,6 +916,12 @@ void LegoAnimationManager::FUN_10061010(undefined4) // TODO } +// STUB: LEGO1 0x10061530 +void LegoAnimationManager::FUN_10061530() +{ + // TODO +} + // STUB: LEGO1 0x100617c0 void LegoAnimationManager::FUN_100617c0(MxS32, MxU16&, MxU16&) { @@ -758,20 +946,213 @@ LegoTranInfo* LegoAnimationManager::GetTranInfo(MxU32 p_index) return NULL; } -// STUB: LEGO1 0x100619f0 +// FUNCTION: LEGO1 0x100619f0 +// FUNCTION: BETA10 0x100426b1 MxLong LegoAnimationManager::Notify(MxParam& p_param) { - // TODO + if (((MxNotificationParam&) p_param).GetSender() == this) { + if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim) { + FUN_100605e0(m_unk0x18, TRUE, NULL, TRUE, NULL, FALSE, TRUE, TRUE, TRUE); + } + } + else if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim && m_tranInfoList != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList); + LegoTranInfo* tranInfo; + + MxU32 index = ((LegoEndAnimNotificationParam&) p_param).GetIndex(); + MxBool found = FALSE; + + while (cursor.Next(tranInfo)) { + if (tranInfo->m_index == index) { + if (m_unk0x430 && m_unk0x42c == tranInfo) { + FUN_10064b50(-1); + } + + if (tranInfo->m_flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + } + + m_unk0x39 = FALSE; + m_unk0x404 = Timer()->GetTime(); + + found = TRUE; + cursor.Detach(); + delete tranInfo; + + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL) { + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + + if (actor != NULL) { + actor->Restart(); + } + } + } + + break; + } + } + + if (m_unk0x1a && found) { + m_unk0x18++; + + if (m_animCount <= m_unk0x18) { + m_unk0x1a = FALSE; + } + else { + LegoEndAnimNotificationParam param(c_notificationEndAnim, this, 0); + NotificationManager()->Send(this, param); + } + } + } + return 0; } -// STUB: LEGO1 0x10061cc0 +// FUNCTION: LEGO1 0x10061cc0 +// FUNCTION: BETA10 0x1004293c MxResult LegoAnimationManager::Tickle() { - // TODO + FUN_10061530(); + + if (!m_unk0x402) { + return SUCCESS; + } + + IslePathActor* actor = CurrentActor(); + LegoROI* roi; + + if (actor == NULL || (roi = actor->GetROI()) == NULL) { + return SUCCESS; + } + + if (m_unk0x401) { + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL && m_unk0x3c[i].m_unk0x0d) { + LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + + if (actor != NULL && actor->GetController() != NULL) { + actor->GetController()->FUN_10046770(actor); + actor->ClearController(); + } + + CharacterManager()->FUN_10083db0(roi); + + if (m_unk0x3c[i].m_unk0x14) { + m_unk0x3c[i].m_unk0x14 = FALSE; + + MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + + LegoROI* roi = Lego()->FindROI(g_vehicles[vehicleId].m_name); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + + m_unk0x3c[i].m_roi = NULL; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x07 = FALSE; + m_unk0x3c[i].m_characterId = -1; + m_unk0x3c[i].m_unk0x0d = FALSE; + m_unk0x414--; + } + } + + m_unk0x401 = FALSE; + } + + MxLong time = Timer()->GetTime(); + float speed = actor->GetWorldSpeed(); + + FUN_10064b50(time); + + if (!m_unk0x39 && time - m_unk0x404 > 10000 && speed < g_unk0x100f74b0 && speed > g_unk0x100f74ec) { + LegoPathBoundary* boundary = actor->GetBoundary(); + + Mx3DPointFloat position(roi->GetWorldPosition()); + Mx3DPointFloat direction(roi->GetWorldDirection()); + + MxU8 und = 0; + MxU8 actorId = GameState()->GetActorId(); + + if (actorId <= 5) { + und = g_unk0x100d8b28[actorId]; + } + + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL) { + MxU16 result = FUN_10062110(roi, direction, position, boundary, speed, und, m_unk0x3c[i].m_unk0x14); + + if (result) { + MxMatrix mat; + mat = roi->GetLocal2World(); + + if (FUN_100605e0(result & USHRT_MAX, FALSE, &mat, TRUE, roi, FALSE, TRUE, TRUE, TRUE) == SUCCESS) { + m_unk0x404 = time; + return SUCCESS; + } + } + } + } + } + + if (time - m_unk0x40c > 1000) { + FUN_10063d10(); + m_unk0x40c = time; + } + + if (time - m_unk0x408 < m_unk0x410) { + return SUCCESS; + } + + m_unk0x410 = (rand() * 10000 / SHRT_MAX) + 5000; + m_unk0x408 = time; + + if (time - m_unk0x404 > 10000) { + FUN_100629b0(-1, FALSE); + } + + double elapsedSeconds = VideoManager()->GetElapsedSeconds(); + + if (elapsedSeconds < 1.0 && elapsedSeconds > 0.01) { + g_unk0x100f7500 = (g_unk0x100f7500 * 2.0 + elapsedSeconds) / 3.0; + + if (elapsedSeconds > 0.2 && m_numAllowedExtras > 2) { + m_numAllowedExtras--; + } + else if (g_unk0x100f7500 < 0.16 && m_numAllowedExtras < m_unk0x41c) { + m_numAllowedExtras++; + } + } + return SUCCESS; } +// STUB: LEGO1 0x10062110 +// FUNCTION: BETA10 0x10042f41 +MxU16 LegoAnimationManager::FUN_10062110( + LegoROI* p_roi, + Vector3& p_direction, + Vector3& p_position, + LegoPathBoundary* p_boundary, + float p_speed, + MxU8 p_und, + MxBool p_unk0x14 +) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x10062360 // FUNCTION: BETA10 0x100432dd MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name) @@ -787,6 +1168,29 @@ MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name) return -1; } +// STUB: LEGO1 0x100623a0 +// FUNCTION: BETA10 0x10043342 +MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10062580 +// FUNCTION: BETA10 0x10043552 +void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) +{ + // TODO +} + +// STUB: LEGO1 0x10062710 +// FUNCTION: BETA10 0x10043787 +MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info) +{ + // TODO + return FALSE; +} + // FUNCTION: LEGO1 0x10062770 // FUNCTION: BETA10 0x1004381a void LegoAnimationManager::FUN_10062770() @@ -811,6 +1215,7 @@ void LegoAnimationManager::FUN_100627d0(MxBool) } // STUB: LEGO1 0x100629b0 +// FUNCTION: BETA10 0x10043c10 void LegoAnimationManager::FUN_100629b0(MxU32, MxBool) { // TODO @@ -851,14 +1256,35 @@ void LegoAnimationManager::FUN_10063aa0() } } +// STUB: LEGO1 0x10063d10 +// FUNCTION: BETA10 0x10045034 +void LegoAnimationManager::FUN_10063d10() +{ + // TODO +} + // STUB: LEGO1 0x10064670 -void LegoAnimationManager::FUN_10064670(MxBool) +void LegoAnimationManager::FUN_10064670(Vector3*) { // TODO } // STUB: LEGO1 0x10064740 -void LegoAnimationManager::FUN_10064740(MxBool) +void LegoAnimationManager::FUN_10064740(Vector3*) +{ + // TODO +} + +// STUB: LEGO1 0x100648f0 +// FUNCTION: BETA10 0x10045daf +void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) +{ + // TODO +} + +// STUB: LEGO1 0x10064b50 +// FUNCTION: BETA10 0x10045f14 +void LegoAnimationManager::FUN_10064b50(MxLong p_time) { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index e93e9a60..9ebaaa8a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -1,10 +1,12 @@ #include "legoanimmmpresenter.h" +#include "3dmanager/lego3dmanager.h" #include "decomp.h" #include "define.h" #include "islepathactor.h" #include "legoanimationmanager.h" #include "legoanimpresenter.h" +#include "legoendanimnotificationparam.h" #include "legotraninfo.h" #include "legovideomanager.h" #include "legoworld.h" @@ -15,7 +17,6 @@ #include "mxnotificationmanager.h" #include "mxobjectfactory.h" #include "mxtimer.h" -#include "mxtype18notificationparam.h" #include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74) @@ -123,7 +124,7 @@ void LegoAnimMMPresenter::EndAction() m_tranInfo = NULL; - MxType18NotificationParam param(c_notificationType18, NULL, m_animmanId); + LegoEndAnimNotificationParam param(c_notificationEndAnim, NULL, m_animmanId); if (m_animmanId != 0) { NotificationManager()->Send(AnimationManager(), param); } diff --git a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp index fa5795d7..c66dd269 100644 --- a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp +++ b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp @@ -1,10 +1,13 @@ #include "legobackgroundcolor.h" +#include "3dmanager/lego3dmanager.h" #include "decomp.h" #include "legoutils.h" #include "legovideomanager.h" #include "misc.h" +#include + DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30) // GLOBAL: LEGO1 0x100f3fb0 diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index ba2ddde5..d5ba428b 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -1,15 +1,20 @@ #include "legocharactermanager.h" +#include "3dmanager/lego3dmanager.h" #include "legoanimactor.h" #include "legocharacters.h" +#include "legoextraactor.h" #include "legogamestate.h" +#include "legovariables.h" #include "legovideomanager.h" #include "misc.h" #include "misc/legocontainer.h" +#include "misc/legostorage.h" #include "mxmisc.h" +#include "mxvariabletable.h" #include "realtime/realtime.h" #include "roi/legolod.h" -#include "roi/legoroi.h" +#include "viewmanager/viewmanager.h" #include @@ -35,7 +40,7 @@ MxU32 g_unk0x100fc4ec = 2; MxU32 g_unk0x100fc4f0 = 0; // GLOBAL: LEGO1 0x10104f20 -LegoCharacterData g_characterData[66]; +LegoCharacterInfo g_chracterInfo[66]; // FUNCTION: LEGO1 0x10082a20 LegoCharacterManager::LegoCharacterManager() @@ -50,22 +55,22 @@ LegoCharacterManager::LegoCharacterManager() // FUNCTION: LEGO1 0x10083270 void LegoCharacterManager::Init() { - for (MxS32 i = 0; i < _countof(g_characterData); i++) { - g_characterData[i] = g_characterDataInit[i]; + for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { + g_chracterInfo[i] = g_characterInfoInit[i]; } } // FUNCTION: LEGO1 0x100832a0 void LegoCharacterManager::FUN_100832a0() { - for (MxS32 i = 0; i < _countof(g_characterData); i++) { - LegoCharacterData* data = GetData(g_characterData[i].m_name); + for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { + LegoCharacterInfo* info = GetInfo(g_chracterInfo[i].m_name); - if (data != NULL) { - LegoExtraActor* actor = data->m_actor; + if (info != NULL) { + LegoExtraActor* actor = info->m_actor; if (actor != NULL && actor->IsA("LegoExtraActor")) { - LegoROI* roi = g_characterData[i].m_roi; + LegoROI* roi = g_chracterInfo[i].m_roi; MxU32 refCount = GetRefCount(roi); while (refCount != 0) { @@ -82,37 +87,46 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_characterData); i++) { - LegoCharacterData* data = &g_characterData[i]; + for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { + LegoCharacterInfo* info = &g_chracterInfo[i]; - if (p_storage->Write(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) { + if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; } - if (p_storage->Write(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) { + if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Write(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[1].m_unk0x08, sizeof(data->m_parts[1].m_unk0x08)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != + SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[1].m_unk0x14, sizeof(data->m_parts[1].m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[2].m_unk0x14, sizeof(data->m_parts[2].m_unk0x14)) != SUCCESS) { + if (p_storage->Write( + &info->m_parts[c_infogronPart].m_unk0x14, + sizeof(info->m_parts[c_infogronPart].m_unk0x14) + ) != SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[4].m_unk0x14, sizeof(data->m_parts[4].m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[5].m_unk0x14, sizeof(data->m_parts[5].m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[8].m_unk0x14, sizeof(data->m_parts[8].m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Write(&data->m_parts[9].m_unk0x14, sizeof(data->m_parts[9].m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) != + SUCCESS) { goto done; } } @@ -128,37 +142,46 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_characterData); i++) { - LegoCharacterData* data = &g_characterData[i]; + for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { + LegoCharacterInfo* info = &g_chracterInfo[i]; - if (p_storage->Read(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) { + if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; } - if (p_storage->Read(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) { + if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Read(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[1].m_unk0x08, sizeof(data->m_parts[1].m_unk0x08)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != + SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[1].m_unk0x14, sizeof(data->m_parts[1].m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[2].m_unk0x14, sizeof(data->m_parts[2].m_unk0x14)) != SUCCESS) { + if (p_storage->Read( + &info->m_parts[c_infogronPart].m_unk0x14, + sizeof(info->m_parts[c_infogronPart].m_unk0x14) + ) != SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[4].m_unk0x14, sizeof(data->m_parts[4].m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[5].m_unk0x14, sizeof(data->m_parts[5].m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[8].m_unk0x14, sizeof(data->m_parts[8].m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) != + SUCCESS) { goto done; } - if (p_storage->Read(&data->m_parts[9].m_unk0x14, sizeof(data->m_parts[9].m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) != + SUCCESS) { goto done; } } @@ -213,7 +236,7 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) actor->SetROI(character->m_roi, FALSE, FALSE); actor->SetType(LegoEntity::e_character); actor->SetFlag(LegoActor::c_bit2); - GetData(p_key)->m_actor = actor; + GetInfo(p_key)->m_actor = actor; } return character->m_roi; @@ -250,7 +273,7 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name) character = (*it).second; if (character->RemoveRef() == 0) { - LegoCharacterData* data = GetData(p_name); + LegoCharacterInfo* info = GetInfo(p_name); LegoEntity* entity = character->m_roi->GetEntity(); if (entity != NULL) { @@ -264,18 +287,18 @@ void LegoCharacterManager::FUN_10083c30(const char* p_name) m_characters->erase(it); - if (data != NULL) { - if (data->m_actor != NULL) { - data->m_actor->ClearFlag(LegoEntity::c_bit2); - delete data->m_actor; + if (info != NULL) { + if (info->m_actor != NULL) { + info->m_actor->ClearFlag(LegoEntity::c_bit2); + delete info->m_actor; } else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { entity->ClearFlag(LegoEntity::c_bit2); delete entity; } - data->m_roi = NULL; - data->m_actor = NULL; + info->m_roi = NULL; + info->m_actor = NULL; } } } @@ -292,7 +315,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) if (character->m_roi == p_roi) { if (character->RemoveRef() == 0) { - LegoCharacterData* data = GetData(character->m_roi->GetName()); + LegoCharacterInfo* info = GetInfo(character->m_roi->GetName()); LegoEntity* entity = character->m_roi->GetEntity(); if (entity != NULL) { @@ -306,18 +329,18 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) m_characters->erase(it); - if (data != NULL) { - if (data->m_actor != NULL) { - data->m_actor->ClearFlag(LegoEntity::c_bit2); - delete data->m_actor; + if (info != NULL) { + if (info->m_actor != NULL) { + info->m_actor->ClearFlag(LegoEntity::c_bit2); + delete info->m_actor; } else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { entity->ClearFlag(LegoEntity::c_bit2); delete entity; } - data->m_roi = NULL; - data->m_actor = NULL; + info->m_roi = NULL; + info->m_actor = NULL; } } @@ -381,39 +404,39 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) Tgl::Renderer* renderer = VideoManager()->GetRenderer(); ViewLODListManager* lodManager = GetViewLODListManager(); LegoTextureContainer* textureContainer = TextureContainer(); - LegoCharacterData* data = GetData(p_key); + LegoCharacterInfo* info = GetInfo(p_key); - if (data == NULL) { + if (info == NULL) { goto done; } if (!strcmpi(p_key, "pep")) { - LegoCharacterData* pepper = GetData("pepper"); + LegoCharacterInfo* pepper = GetInfo("pepper"); - data->m_unk0x0c = pepper->m_unk0x0c; - data->m_unk0x10 = pepper->m_unk0x10; - data->m_unk0x14 = pepper->m_unk0x14; + info->m_unk0x0c = pepper->m_unk0x0c; + info->m_unk0x10 = pepper->m_unk0x10; + info->m_unk0x14 = pepper->m_unk0x14; - for (i = 0; i < _countof(data->m_parts); i++) { - data->m_parts[i] = pepper->m_parts[i]; + for (i = 0; i < _countof(info->m_parts); i++) { + info->m_parts[i] = pepper->m_parts[i]; } } roi = new LegoROI(renderer); roi->SetName(p_key); - boundingSphere.Center()[0] = g_characterLODs[0].m_boundingSphere[0]; - boundingSphere.Center()[1] = g_characterLODs[0].m_boundingSphere[1]; - boundingSphere.Center()[2] = g_characterLODs[0].m_boundingSphere[2]; - boundingSphere.Radius() = g_characterLODs[0].m_boundingSphere[3]; + boundingSphere.Center()[0] = g_characterLODs[c_topLOD].m_boundingSphere[0]; + boundingSphere.Center()[1] = g_characterLODs[c_topLOD].m_boundingSphere[1]; + boundingSphere.Center()[2] = g_characterLODs[c_topLOD].m_boundingSphere[2]; + boundingSphere.Radius() = g_characterLODs[c_topLOD].m_boundingSphere[3]; roi->SetBoundingSphere(boundingSphere); - boundingBox.Min()[0] = g_characterLODs[0].m_boundingBox[0]; - boundingBox.Min()[1] = g_characterLODs[0].m_boundingBox[1]; - boundingBox.Min()[2] = g_characterLODs[0].m_boundingBox[2]; - boundingBox.Max()[0] = g_characterLODs[0].m_boundingBox[3]; - boundingBox.Max()[1] = g_characterLODs[0].m_boundingBox[4]; - boundingBox.Max()[2] = g_characterLODs[0].m_boundingBox[5]; + boundingBox.Min()[0] = g_characterLODs[c_topLOD].m_boundingBox[0]; + boundingBox.Min()[1] = g_characterLODs[c_topLOD].m_boundingBox[1]; + boundingBox.Min()[2] = g_characterLODs[c_topLOD].m_boundingBox[2]; + boundingBox.Max()[0] = g_characterLODs[c_topLOD].m_boundingBox[3]; + boundingBox.Max()[1] = g_characterLODs[c_topLOD].m_boundingBox[4]; + boundingBox.Max()[2] = g_characterLODs[c_topLOD].m_boundingBox[5]; roi->SetUnknown0x80(boundingBox); comp = new CompoundObject(); @@ -421,7 +444,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) for (i = 0; i < _countof(g_characterLODs) - 1; i++) { char lodName[256]; - LegoCharacterData::Part& part = data->m_parts[i]; + LegoCharacterInfo::Part& part = info->m_parts[i]; const char* parentName; if (i == 0 || i == 1) { @@ -495,14 +518,14 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) } CalcLocalTransform( - Mx3DPointFloat(g_characterLODs[0].m_position), - Mx3DPointFloat(g_characterLODs[0].m_direction), - Mx3DPointFloat(g_characterLODs[0].m_up), + Mx3DPointFloat(g_characterLODs[c_topLOD].m_position), + Mx3DPointFloat(g_characterLODs[c_topLOD].m_direction), + Mx3DPointFloat(g_characterLODs[c_topLOD].m_up), mat ); roi->WrappedSetLocalTransform(mat); - data->m_roi = roi; + info->m_roi = roi; success = TRUE; done: @@ -519,12 +542,12 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo) { LegoResult result = SUCCESS; - LegoROI* head = FindChildROI(p_roi, g_characterLODs[4].m_name); + LegoROI* head = FindChildROI(p_roi, g_characterLODs[c_headLOD].m_name); if (head != NULL) { char lodName[256]; - ViewLODList* lodList = GetViewLODListManager()->Lookup(g_characterLODs[4].m_parentName); + ViewLODList* lodList = GetViewLODListManager()->Lookup(g_characterLODs[c_headLOD].m_parentName); MxS32 lodSize = lodList->Size(); sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++); ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize); @@ -532,8 +555,8 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex Tgl::Renderer* renderer = VideoManager()->GetRenderer(); if (p_textureInfo == NULL) { - LegoCharacterData* info = GetData(p_roi->GetName()); - LegoCharacterData::Part& part = info->m_parts[3]; + LegoCharacterInfo* info = GetInfo(p_roi->GetName()); + LegoCharacterInfo::Part& part = info->m_parts[c_headPart]; p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); } @@ -565,8 +588,8 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex // FUNCTION: LEGO1 0x10084c00 MxBool LegoCharacterManager::Exists(const char* p_key) { - for (MxU32 i = 0; i < _countof(g_characterData); i++) { - if (!strcmpi(g_characterData[i].m_name, p_key)) { + for (MxU32 i = 0; i < _countof(g_chracterInfo); i++) { + if (!strcmpi(g_chracterInfo[i].m_name, p_key)) { return TRUE; } } @@ -577,46 +600,46 @@ MxBool LegoCharacterManager::Exists(const char* p_key) // FUNCTION: LEGO1 0x10084c40 LegoExtraActor* LegoCharacterManager::GetActor(const char* p_key) { - LegoCharacterData* data = GetData(p_key); + LegoCharacterInfo* info = GetInfo(p_key); - if (data != NULL) { - return data->m_actor; + if (info != NULL) { + return info->m_actor; } return NULL; } // FUNCTION: LEGO1 0x10084c60 -LegoCharacterData* LegoCharacterManager::GetData(const char* p_key) +LegoCharacterInfo* LegoCharacterManager::GetInfo(const char* p_key) { MxU32 i; - for (i = 0; i < _countof(g_characterData); i++) { - if (!strcmpi(g_characterData[i].m_name, p_key)) { + for (i = 0; i < _countof(g_chracterInfo); i++) { + if (!strcmpi(g_chracterInfo[i].m_name, p_key)) { break; } } - if (i < _countof(g_characterData)) { - return &g_characterData[i]; + if (i < _countof(g_chracterInfo)) { + return &g_chracterInfo[i]; } return NULL; } // FUNCTION: LEGO1 0x10084cb0 -LegoCharacterData* LegoCharacterManager::GetData(LegoROI* p_roi) +LegoCharacterInfo* LegoCharacterManager::GetInfo(LegoROI* p_roi) { MxU32 i; - for (i = 0; i < _countof(g_characterData); i++) { - if (g_characterData[i].m_roi == p_roi) { + for (i = 0; i < _countof(g_chracterInfo); i++) { + if (g_chracterInfo[i].m_roi == p_roi) { break; } } - if (i < _countof(g_characterData)) { - return &g_characterData[i]; + if (i < _countof(g_chracterInfo)) { + return &g_chracterInfo[i]; } return NULL; @@ -646,13 +669,13 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) // FUNCTION: LEGO1 0x10084ec0 MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) { - LegoCharacterData* data = GetData(p_roi->GetName()); + LegoCharacterInfo* info = GetInfo(p_roi->GetName()); - if (data == NULL) { + if (info == NULL) { return FALSE; } - LegoCharacterData::Part& part = data->m_parts[1]; + LegoCharacterInfo::Part& part = info->m_parts[c_infohatPart]; part.m_unk0x08++; MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08]; @@ -662,7 +685,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) unk0x00 = part.m_unk0x00[part.m_unk0x08]; } - LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[2].m_name); + LegoROI* childROI = FindChildROI(p_roi, g_characterLODs[c_infohatLOD].m_name); if (childROI != NULL) { char lodName[256]; @@ -700,14 +723,14 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) // FUNCTION: LEGO1 0x10085140 MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) { - LegoCharacterData* data = GetData(p_roi); + LegoCharacterInfo* info = GetInfo(p_roi); if (p_und) { - return data->m_unk0x14 + g_unk0x100fc4dc; + return info->m_unk0x14 + g_unk0x100fc4dc; } - if (data != NULL) { - return data->m_unk0x0c + g_unk0x100fc4d8; + if (info != NULL) { + return info->m_unk0x0c + g_unk0x100fc4d8; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legocharacters.cpp b/LEGO1/lego/legoomni/src/common/legocharacters.cpp index bd30b0d4..d80b49c8 100644 --- a/LEGO1/lego/legoomni/src/common/legocharacters.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharacters.cpp @@ -1,7 +1,7 @@ #include "legocharacters.h" -DECOMP_SIZE_ASSERT(LegoCharacterData, 0x108) -DECOMP_SIZE_ASSERT(LegoCharacterData::Part, 0x18) +DECOMP_SIZE_ASSERT(LegoCharacterInfo, 0x108) +DECOMP_SIZE_ASSERT(LegoCharacterInfo::Part, 0x18) DECOMP_SIZE_ASSERT(LegoCharacterLOD, 0x58) // Unclear whether g_characterLODs[0] (top) is its own global, see: LegoCharacterManager::CreateROI @@ -172,7 +172,7 @@ const char* g_unk0x100f80a0[] = {"lego white", "lego black", "lego yellow", "lego red", "lego blue", "lego brown", "lego lt grey", "lego green"}; // GLOBAL: LEGO1 0x100f80c0 -LegoCharacterData g_characterDataInit[] = { +LegoCharacterInfo g_characterInfoInit[] = { {"pepper", NULL, NULL, diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 9ef5b33a..cedf5482 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1,5 +1,6 @@ #include "legogamestate.h" +#include "3dmanager/lego3dmanager.h" #include "act1state.h" #include "act2main_actions.h" #include "act3_actions.h" @@ -28,10 +29,12 @@ #include "jukebox_actions.h" #include "jukeboxw_actions.h" #include "legoanimationmanager.h" +#include "legobackgroundcolor.h" #include "legobuildingmanager.h" #include "legocharactermanager.h" +#include "legofullscreenmovie.h" +#include "legomain.h" #include "legonavcontroller.h" -#include "legoomni.h" #include "legoplantmanager.h" #include "legostate.h" #include "legoutils.h" @@ -40,14 +43,18 @@ #include "misc.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" +#include "mxnotificationmanager.h" +#include "mxnotificationparam.h" #include "mxobjectfactory.h" #include "mxstring.h" +#include "mxutilities.h" #include "mxvariabletable.h" #include "police_actions.h" #include "racecar.h" #include "racecar_actions.h" #include "regbook_actions.h" #include "roi/legoroi.h" +#include "scripts.h" #include "sndanim_actions.h" #include @@ -791,7 +798,7 @@ void LegoGameState::SwitchArea(Area p_area) FUN_10015820(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d); BackgroundAudioManager()->Stop(); - AnimationManager()->FUN_1005ef10(); + AnimationManager()->Suspend(); VideoManager()->SetUnk0x554(FALSE); switch (p_area) { @@ -896,10 +903,14 @@ void LegoGameState::SwitchArea(Area p_area) else { SetCameraControllerFromIsle(); CurrentActor()->ResetWorldTransform(TRUE); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); } - CurrentActor()->VTable0xe8(p_area, TRUE, 7); + CurrentActor()->SpawnPlayer( + p_area, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); break; } case e_hospital: @@ -910,8 +921,12 @@ void LegoGameState::SwitchArea(Area p_area) LoadIsle(); SetCameraControllerFromIsle(); CurrentActor()->ResetWorldTransform(TRUE); - AnimationManager()->FUN_1005f0b0(); - CurrentActor()->VTable0xe8(p_area, TRUE, 7); + AnimationManager()->Resume(); + CurrentActor()->SpawnPlayer( + p_area, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); break; case e_police: VideoManager()->SetUnk0x554(TRUE); @@ -1083,28 +1098,28 @@ void LegoGameState::Init() if (m_loadedAct == e_act1) { Isle* isle = (Isle*) FindWorld(*g_isleScript, 0); - Helicopter* copter = (Helicopter*) isle->Find(*g_copterScript, 1); + Helicopter* copter = (Helicopter*) isle->Find(*g_copterScript, CopterScript::c_Helicopter_Actor); if (copter) { isle->FUN_1001fc80(copter); isle->VTable0x6c(copter); delete copter; } - DuneBuggy* dunebuggy = (DuneBuggy*) isle->Find(*g_dunecarScript, 2); + DuneBuggy* dunebuggy = (DuneBuggy*) isle->Find(*g_dunecarScript, DunecarScript::c_DuneBugy_Actor); if (dunebuggy) { isle->FUN_1001fc80(dunebuggy); isle->VTable0x6c(dunebuggy); delete dunebuggy; } - Jetski* jetski = (Jetski*) isle->Find(*g_jetskiScript, 3); + Jetski* jetski = (Jetski*) isle->Find(*g_jetskiScript, JetskiScript::c_Jetski_Actor); if (jetski) { isle->FUN_1001fc80(jetski); isle->VTable0x6c(jetski); delete jetski; } - RaceCar* racecar = (RaceCar*) isle->Find(*g_racecarScript, 4); + RaceCar* racecar = (RaceCar*) isle->Find(*g_racecarScript, RacecarScript::c_RaceCar_Actor); if (racecar) { isle->FUN_1001fc80(racecar); isle->VTable0x6c(racecar); diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index 7463524c..520a0070 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -4,6 +4,7 @@ #include "misc.h" #include "misc/legoimage.h" #include "misc/legotexture.h" +#include "mxdirectx/mxdirect3d.h" #include "tgl/d3drm/impl.h" DECOMP_SIZE_ASSERT(LegoTextureInfo, 0x10) diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 3cf3e705..07cdde5b 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -1,27 +1,47 @@ #include "legoutils.h" +#include "3dmanager/lego3dmanager.h" #include "act1state.h" +#include "anim/legoanim.h" #include "islepathactor.h" #include "legoanimpresenter.h" #include "legogamestate.h" #include "legoinputmanager.h" +#include "legomain.h" #include "legonamedtexture.h" -#include "legoomni.h" #include "legosoundmanager.h" +#include "legovideomanager.h" #include "legoworld.h" #include "legoworldlist.h" #include "misc.h" +#include "misc/legotree.h" #include "mxdsaction.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstreamer.h" #include "mxtypes.h" +#include "mxutilities.h" +#include "mxvariabletable.h" #include "realtime/realtime.h" +#include "scripts.h" #include #include #include +// FUNCTION: LEGO1 0x1003dd70 +LegoROI* PickROI(MxLong p_a, MxLong p_b) +{ + return (LegoROI*) VideoManager()->Get3DManager()->GetLego3DView()->Pick(p_a, p_b); +} + +// STUB: LEGO1 0x1003ddc0 +LegoEntity* PickEntity(MxLong, MxLong) +{ + // TODO + return NULL; +} + // FUNCTION: LEGO1 0x1003df90 MxS16 CountTotalTreeNodes(LegoTreeNode* p_node) { @@ -320,7 +340,15 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO } } +// STUB: LEGO1 0x1003ecc0 +// FUNCTION: BETA10 0x100d4b38 +void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool) +{ + // TODO +} + // FUNCTION: LEGO1 0x1003eda0 +// FUNCTION: BETA10 0x100d4bf4 void FUN_1003eda0() { Mx3DPointFloat vec; diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 71e6e587..993b0129 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -1,5 +1,6 @@ #include "legovariables.h" +#include "3dmanager/lego3dmanager.h" #include "legobuildingmanager.h" #include "legocharactermanager.h" #include "legogamestate.h" diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index cc1d5218..bf77f5e8 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -1,7 +1,13 @@ #include "misc.h" +#include "3dmanager/lego3dmanager.h" +#include "legoinputmanager.h" +#include "legomain.h" +#include "legovideomanager.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" +#include "roi/legoroi.h" +#include "scripts.h" // GLOBAL: LEGO1 0x100f4c58 MxBool g_isWorldActive = TRUE; @@ -136,6 +142,13 @@ void SetCurrentActor(IslePathActor* p_currentActor) LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); } +// FUNCTION: LEGO1 0x10015890 +// FUNCTION: BETA10 0x100e4d80 +MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) +{ + return LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction); +} + // FUNCTION: LEGO1 0x100158b0 void DeleteAction() { diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 58c21544..b4f8c75a 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -331,7 +331,6 @@ MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState) { MxCompositePresenterList::iterator it = m_list.begin(); for (MxS16 i = m_unk0x4e; i > 0; i--, it++) { - ; } return (*it)->HasTickleStatePassed(p_tickleState); diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index b7537d9e..90a37ef2 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -6,6 +6,7 @@ #include "legoworld.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" +#include "mxdisplaysurface.h" #include "mxmisc.h" #include "mxparam.h" #include "mxticklemanager.h" diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 8f88d5d5..a7ca2c20 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -4,6 +4,7 @@ #include "legovideomanager.h" #include "misc.h" #include "mxcontrolpresenter.h" +#include "mxdsaction.h" #include "mxmisc.h" #include "mxpresenter.h" #include "mxticklemanager.h" diff --git a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index 6e006a28..e94d02d8 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -2,6 +2,7 @@ #include "decomp.h" #include "mxbitmap.h" +#include "mxdsaction.h" #include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94) diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 6c27fd34..58df76c4 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -1,9 +1,11 @@ #include "legoactor.h" #include "define.h" +#include "legocachesoundmanager.h" #include "legosoundmanager.h" #include "misc.h" #include "mxutilities.h" +#include "roi/legoroi.h" DECOMP_SIZE_ASSERT(LegoActor, 0x78) diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index 1076e787..6025f614 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -1,5 +1,6 @@ #include "legocameracontroller.h" +#include "3dmanager/lego3dmanager.h" #include "legoinputmanager.h" #include "legonotify.h" #include "legosoundmanager.h" @@ -8,6 +9,7 @@ #include "mxmisc.h" #include "mxtimer.h" #include "realtime/realtime.h" +#include "roi/legoroi.h" #include diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 20cc85df..192fc804 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -1,8 +1,11 @@ #include "legoentity.h" +#include "3dmanager/lego3dmanager.h" #include "define.h" #include "legobuildingmanager.h" +#include "legocameracontroller.h" #include "legocharactermanager.h" +#include "legoeventnotificationparam.h" #include "legogamestate.h" #include "legoplantmanager.h" #include "legoutils.h" @@ -10,6 +13,7 @@ #include "legoworld.h" #include "misc.h" #include "mxmisc.h" +#include "mxutilities.h" #include "realtime/realtime.h" DECOMP_SIZE_ASSERT(LegoEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 573d2392..fc18ea5c 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -1,20 +1,25 @@ #include "legonavcontroller.h" +#include "3dmanager/lego3dmanager.h" #include "infocenterstate.h" #include "legoanimationmanager.h" +#include "legocameracontroller.h" #include "legocameralocations.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "legosoundmanager.h" #include "legoutils.h" #include "legovideomanager.h" +#include "legoworld.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxtimer.h" #include "mxtransitionmanager.h" +#include "mxutilities.h" #include "realtime/realtime.h" +#include "realtime/realtimeview.h" #include diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index 0b226d04..0575056d 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -1,7 +1,7 @@ #include "3dmanager/lego3dview.h" #include "legoentity.h" +#include "legomain.h" #include "legonavcontroller.h" -#include "legoomni.h" #include "legopointofviewcontroller.h" #include "legosoundmanager.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 13696cbb..eda48fc6 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -1,15 +1,18 @@ #include "legoworld.h" +#include "anim/legoanim.h" #include "islepathactor.h" #include "legoanimationmanager.h" #include "legoanimpresenter.h" #include "legobuildingmanager.h" +#include "legocachesoundmanager.h" +#include "legocameracontroller.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legolocomotionanimpresenter.h" +#include "legomain.h" #include "legonavcontroller.h" -#include "legoomni.h" #include "legoplantmanager.h" #include "legosoundmanager.h" #include "legoutils.h" @@ -21,6 +24,8 @@ #include "mxnotificationmanager.h" #include "mxnotificationparam.h" #include "mxticklemanager.h" +#include "mxutilities.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(LegoWorld, 0xf8) DECOMP_SIZE_ASSERT(LegoEntityList, 0x18) @@ -267,6 +272,29 @@ LegoCameraController* LegoWorld::VTable0x54() return m_cameraController; } +// FUNCTION: LEGO1 0x1001f720 +// FUNCTION: BETA10 0x100da24b +MxResult LegoWorld::FUN_1001f720( + IslePathActor* p_actor, + const char* p_path, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale +) +{ + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + if (controller->FUN_10045c20(p_actor, p_path, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) { + return SUCCESS; + } + } + + return FAILURE; +} + // STUB: LEGO1 0x1001fa70 undefined4 LegoWorld::FUN_1001fa70(IslePathActor* p_actor) { @@ -630,7 +658,7 @@ void LegoWorld::Enable(MxBool p_enable) PlantManager()->FUN_10026360(m_scriptIndex); AnimationManager()->LoadScriptInfo(m_scriptIndex); BuildingManager()->FUN_1002fa00(); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); } GameState()->ResetROI(); diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 591a3a3f..a4e5902b 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -5,8 +5,8 @@ #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legoentity.h" +#include "legomain.h" #include "legomodelpresenter.h" -#include "legoomni.h" #include "legopartpresenter.h" #include "legoplantmanager.h" #include "legotexturepresenter.h" diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp index 238059b1..012d9eb8 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp @@ -6,11 +6,11 @@ #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(GasStationEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp index 60fedd36..006d2d05 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp @@ -6,11 +6,11 @@ #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(HospitalEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp index 5157cb25..3ebe8e44 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp @@ -12,11 +12,11 @@ #include "legoact2state.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp index 2af1ddbb..a6159d62 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp @@ -2,6 +2,7 @@ #include "infocenter.h" #include "infomain_actions.h" +#include "mxstillpresenter.h" DECOMP_SIZE_ASSERT(InfocenterState, 0x94) diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 65bcc1b5..3d683dea 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -1,8 +1,11 @@ #include "legoinputmanager.h" +#include "legocameracontroller.h" #include "legocontrolmanager.h" -#include "legoomni.h" +#include "legomain.h" +#include "legoutils.h" #include "legovideomanager.h" +#include "legoworld.h" #include "misc.h" #include "mxautolock.h" #include "roi/legoroi.h" diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp index b30ae739..8f9d518c 100644 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp @@ -6,11 +6,11 @@ #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(BeachHouseEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/isle/radiostate.cpp b/LEGO1/lego/legoomni/src/isle/radiostate.cpp index 026ece80..5927a94b 100644 --- a/LEGO1/lego/legoomni/src/isle/radiostate.cpp +++ b/LEGO1/lego/legoomni/src/isle/radiostate.cpp @@ -2,9 +2,9 @@ #include "jukebox.h" #include "jukebox_actions.h" -#include "legoomni.h" #include "mxmisc.h" #include "mxtimer.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(RadioState, 0x30) diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp similarity index 58% rename from LEGO1/lego/legoomni/src/main/legoomni.cpp rename to LEGO1/lego/legoomni/src/main/legomain.cpp index af62ee8e..0dc851a6 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -1,5 +1,7 @@ -#include "legoomni.h" +#include "legomain.h" +#include "3dmanager/lego3dmanager.h" +#include "islepathactor.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legocharactermanager.h" @@ -18,260 +20,28 @@ #include "mxactionnotificationparam.h" #include "mxautolock.h" #include "mxbackgroundaudiomanager.h" +#include "mxdisplaysurface.h" #include "mxdsfile.h" #include "mxmisc.h" +#include "mxnotificationmanager.h" #include "mxomnicreateflags.h" #include "mxomnicreateparam.h" #include "mxstreamer.h" #include "mxticklemanager.h" #include "mxtransitionmanager.h" +#include "mxvariabletable.h" +#include "scripts.h" #include "viewmanager/viewmanager.h" +DECOMP_SIZE_ASSERT(LegoOmni, 0x140) DECOMP_SIZE_ASSERT(LegoOmni::ScriptContainer, 0x1c) -DECOMP_SIZE_ASSERT(LegoOmni::PathContainer, 0x38) DECOMP_SIZE_ASSERT(LegoWorldList, 0x18) DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10) -// GLOBAL: LEGO1 0x100f451c -MxAtomId* g_copterScript = NULL; - -// GLOBAL: LEGO1 0x100f4520 -MxAtomId* g_dunecarScript = NULL; - -// GLOBAL: LEGO1 0x100f4524 -MxAtomId* g_jetskiScript = NULL; - -// GLOBAL: LEGO1 0x100f4528 -MxAtomId* g_racecarScript = NULL; - -// GLOBAL: LEGO1 0x100f452c -MxAtomId* g_carraceScript = NULL; - -// GLOBAL: LEGO1 0x100f4530 -MxAtomId* g_carracerScript = NULL; - -// GLOBAL: LEGO1 0x100f4534 -MxAtomId* g_jetraceScript = NULL; - -// GLOBAL: LEGO1 0x100f4538 -MxAtomId* g_jetracerScript = NULL; - -// GLOBAL: LEGO1 0x100f453c -MxAtomId* g_isleScript = NULL; - -// GLOBAL: LEGO1 0x100f4540 -MxAtomId* g_elevbottScript = NULL; - -// GLOBAL: LEGO1 0x100f4544 -MxAtomId* g_infodoorScript = NULL; - -// GLOBAL: LEGO1 0x100f4548 -MxAtomId* g_infomainScript = NULL; - -// GLOBAL: LEGO1 0x100f454c -MxAtomId* g_infoscorScript = NULL; - -// GLOBAL: LEGO1 0x100f4550 -MxAtomId* g_regbookScript = NULL; - -// GLOBAL: LEGO1 0x100f4554 -MxAtomId* g_histbookScript = NULL; - -// GLOBAL: LEGO1 0x100f4558 -MxAtomId* g_hospitalScript = NULL; - -// GLOBAL: LEGO1 0x100f455c -MxAtomId* g_policeScript = NULL; - -// GLOBAL: LEGO1 0x100f4560 -MxAtomId* g_garageScript = NULL; - -// GLOBAL: LEGO1 0x100f4564 -MxAtomId* g_act2mainScript = NULL; - -// GLOBAL: LEGO1 0x100f4568 -MxAtomId* g_act3Script = NULL; - -// GLOBAL: LEGO1 0x100f456c -MxAtomId* g_jukeboxScript = NULL; - -// GLOBAL: LEGO1 0x100f4570 -MxAtomId* g_pz5Script = NULL; - -// GLOBAL: LEGO1 0x100f4574 -MxAtomId* g_introScript = NULL; - -// GLOBAL: LEGO1 0x100f4578 -MxAtomId* g_testScript = NULL; - -// GLOBAL: LEGO1 0x100f457c -MxAtomId* g_jukeboxwScript = NULL; - -// GLOBAL: LEGO1 0x100f4580 -MxAtomId* g_sndAnimScript = NULL; - -// GLOBAL: LEGO1 0x100f4584 -MxAtomId* g_creditsScript = NULL; - -// GLOBAL: LEGO1 0x100f4588 -MxAtomId* g_nocdSourceName = NULL; - // GLOBAL: LEGO1 0x100f6718 // STRING: LEGO1 0x100f6710 const char* g_current = "current"; -// GLOBAL: LEGO1 0x10102b28 -LegoOmni::PathContainer g_extraPaths[29]; - -// FUNCTION: LEGO1 0x1001a700 -void RegisterExtraPaths() -{ - g_extraPaths[0] = LegoOmni::PathContainer(0x16, g_isleScript, 0, "int35", 2, 0.6, 4, 0.4, 0x2a, 0x12); - g_extraPaths[1] = LegoOmni::PathContainer(0x17, g_isleScript, 0, "edg00_49", 1, 0.43, 2, 0.6, 0x27, 0x12); - g_extraPaths[2] = LegoOmni::PathContainer(0x18, g_isleScript, 0, "edg00_191", 2, 0.5, 0, 0.55, 0x26, 0x12); - g_extraPaths[3] = LegoOmni::PathContainer(0x04, g_isleScript, 0, "int46", 0, 0.5, 2, 0.5, 0x10, 0x0b); - g_extraPaths[4] = LegoOmni::PathContainer(0x10, g_isleScript, 0, "EDG00_46", 0, 0.95, 2, 0.19, 0x17, 0x11); - g_extraPaths[5] = LegoOmni::PathContainer(0x11, g_isleScript, 0, "EDG00_46", 3, 0.625, 2, 0.03, 0x18, 0x11); - g_extraPaths[6] = LegoOmni::PathContainer(0x0f, g_isleScript, 0, "EDG10_63", 0, 0.26, 1, 0.01, 0, -1); - g_extraPaths[7] = LegoOmni::PathContainer(0x13, g_isleScript, 0, "INT15", 5, 0.65, 1, 0.68, 0x33, 0x0e); - g_extraPaths[8] = LegoOmni::PathContainer(0x14, g_isleScript, 0, "INT16", 4, 0.1, 2, 0, 0x34, 0x0e); - g_extraPaths[9] = LegoOmni::PathContainer(0x15, g_isleScript, 0, "INT62", 2, 0.1, 3, 0.7, 0x36, 0x0e); - g_extraPaths[10] = LegoOmni::PathContainer(0x19, g_isleScript, 0, "INT24", 0, 0.55, 2, 0.71, 0x08, 0x0f); - g_extraPaths[11] = LegoOmni::PathContainer(0x1c, g_isleScript, 0, "INT24", 2, 0.73, 4, 0.71, 0x0a, 0x0f); - g_extraPaths[12] = LegoOmni::PathContainer(0x1d, g_isleScript, 0, "INT19", 0, 0.85, 1, 0.28, 0, 0x0a); - g_extraPaths[13] = LegoOmni::PathContainer(0x1f, g_isleScript, 0, "EDG02_28", 3, 0.37, 1, 0.52, 0x0c, 0x0a); - g_extraPaths[14] = LegoOmni::PathContainer(0x20, g_isleScript, 0, "INT33", 0, 0.88, 2, 0.74, 0x22, 0x0c); - g_extraPaths[15] = LegoOmni::PathContainer(0x21, g_isleScript, 0, "EDG02_64", 2, 0.24, 0, 0.84, 0x23, 0x0c); - g_extraPaths[16] = LegoOmni::PathContainer(0x28, g_isleScript, 0, "edg02_51", 2, 0.63, 3, 0.01, 0, -1); - g_extraPaths[17] = LegoOmni::PathContainer(0x29, g_isleScript, 0, "edg02_51", 2, 0.63, 0, 0.4, 0, -1); - g_extraPaths[18] = LegoOmni::PathContainer(0x2b, g_isleScript, 0, "edg02_35", 2, 0.8, 0, 0.2, 0, -1); - g_extraPaths[19] = LegoOmni::PathContainer(0x2c, g_isleScript, 0, "EDG03_01", 2, 0.25, 0, 0.75, 0, -1); - g_extraPaths[20] = LegoOmni::PathContainer(0x2d, g_isleScript, 0, "edg10_70", 3, 0.25, 0, 0.7, 0x44, -1); - g_extraPaths[21] = LegoOmni::PathContainer(0x2a, g_isleScript, 0, "inv_05", 2, 0.75, 0, 0.19, 0, -1); - g_extraPaths[22] = LegoOmni::PathContainer(0x30, g_act3Script, 0, "edg02_51", 2, 0.63, 0, 0.4, 0, -1); - g_extraPaths[23] = LegoOmni::PathContainer(0x31, g_act3Script, 0, "inv_05", 2, 0.75, 0, 0.19, 0, -1); - g_extraPaths[24] = LegoOmni::PathContainer(0x32, g_act2mainScript, 0, "EDG02_51", 0, 0.64, 1, 0.37, 0, -1); - g_extraPaths[25] = LegoOmni::PathContainer(0x33, g_isleScript, 0, "edg02_32", 0, 0.5, 2, 0.5, 0, -1); - g_extraPaths[26] = LegoOmni::PathContainer(0x34, g_isleScript, 0, "edg02_19", 2, 0.5, 0, 0.5, 0, -1); - g_extraPaths[27] = LegoOmni::PathContainer(0x36, g_isleScript, 0, "int36", 0, 0.2, 4, 0.4, 0, -1); - g_extraPaths[28] = LegoOmni::PathContainer(0x37, g_isleScript, 0, "edg02_50", 2, 0.8, 1, 0.3, 0, -1); -} - -// FUNCTION: LEGO1 0x1003dd70 -LegoROI* PickROI(MxLong p_a, MxLong p_b) -{ - return (LegoROI*) VideoManager()->Get3DManager()->GetLego3DView()->Pick(p_a, p_b); -} - -// STUB: LEGO1 0x1003ddc0 -LegoEntity* PickEntity(MxLong, MxLong) -{ - // TODO - return NULL; -} - -// FUNCTION: LEGO1 0x100528e0 -void CreateScripts() -{ - g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", e_lowerCase2); - g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", e_lowerCase2); - g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", e_lowerCase2); - g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", e_lowerCase2); - g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", e_lowerCase2); - g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", e_lowerCase2); - g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", e_lowerCase2); - g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", e_lowerCase2); - g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", e_lowerCase2); - g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", e_lowerCase2); - g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", e_lowerCase2); - g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", e_lowerCase2); - g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", e_lowerCase2); - g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", e_lowerCase2); - g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", e_lowerCase2); - g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", e_lowerCase2); - g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", e_lowerCase2); - g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", e_lowerCase2); - g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", e_lowerCase2); - g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", e_lowerCase2); - g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", e_lowerCase2); - g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", e_lowerCase2); - g_introScript = new MxAtomId("\\lego\\scripts\\intro", e_lowerCase2); - g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", e_lowerCase2); - g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", e_lowerCase2); - g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", e_lowerCase2); - g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", e_lowerCase2); - g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", e_lowerCase2); -} - -// FUNCTION: LEGO1 0x100530c0 -void DestroyScripts() -{ - delete g_copterScript; - delete g_dunecarScript; - delete g_jetskiScript; - delete g_racecarScript; - delete g_carraceScript; - delete g_carracerScript; - delete g_jetraceScript; - delete g_jetracerScript; - delete g_isleScript; - delete g_elevbottScript; - delete g_infodoorScript; - delete g_infomainScript; - delete g_infoscorScript; - delete g_regbookScript; - delete g_histbookScript; - delete g_hospitalScript; - delete g_policeScript; - delete g_garageScript; - delete g_act2mainScript; - delete g_act3Script; - delete g_jukeboxScript; - delete g_pz5Script; - delete g_introScript; - delete g_testScript; - delete g_jukeboxwScript; - delete g_sndAnimScript; - delete g_creditsScript; - delete g_nocdSourceName; - - g_copterScript = NULL; - g_dunecarScript = NULL; - g_jetskiScript = NULL; - g_racecarScript = NULL; - g_carraceScript = NULL; - g_carracerScript = NULL; - g_jetraceScript = NULL; - g_jetracerScript = NULL; - g_isleScript = NULL; - g_elevbottScript = NULL; - g_infodoorScript = NULL; - g_infomainScript = NULL; - g_infoscorScript = NULL; - g_regbookScript = NULL; - g_histbookScript = NULL; - g_hospitalScript = NULL; - g_policeScript = NULL; - g_garageScript = NULL; - g_act2mainScript = NULL; - g_act3Script = NULL; - g_jukeboxScript = NULL; - g_pz5Script = NULL; - g_introScript = NULL; - g_testScript = NULL; - g_testScript = NULL; - g_jukeboxwScript = NULL; - g_sndAnimScript = NULL; - g_creditsScript = NULL; - g_nocdSourceName = NULL; -} - -// FUNCTION: LEGO1 0x10053430 -const char* GetNoCD_SourceName() -{ - return g_nocdSourceName->GetInternal(); -} - // FUNCTION: LEGO1 0x10058a00 LegoOmni::LegoOmni() { @@ -467,7 +237,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) m_variableTable->SetVariable(variable); CreateScripts(); - RegisterExtraPaths(); + IslePathActor::RegisterSpawnLocations(); result = RegisterScripts(); if (result != SUCCESS) { diff --git a/LEGO1/lego/legoomni/src/main/scripts.cpp b/LEGO1/lego/legoomni/src/main/scripts.cpp new file mode 100644 index 00000000..32c3f86e --- /dev/null +++ b/LEGO1/lego/legoomni/src/main/scripts.cpp @@ -0,0 +1,189 @@ +#include "scripts.h" + +#include "mxatom.h" + +// GLOBAL: LEGO1 0x100f451c +MxAtomId* g_copterScript = NULL; + +// GLOBAL: LEGO1 0x100f4520 +MxAtomId* g_dunecarScript = NULL; + +// GLOBAL: LEGO1 0x100f4524 +MxAtomId* g_jetskiScript = NULL; + +// GLOBAL: LEGO1 0x100f4528 +MxAtomId* g_racecarScript = NULL; + +// GLOBAL: LEGO1 0x100f452c +MxAtomId* g_carraceScript = NULL; + +// GLOBAL: LEGO1 0x100f4530 +MxAtomId* g_carracerScript = NULL; + +// GLOBAL: LEGO1 0x100f4534 +MxAtomId* g_jetraceScript = NULL; + +// GLOBAL: LEGO1 0x100f4538 +MxAtomId* g_jetracerScript = NULL; + +// GLOBAL: LEGO1 0x100f453c +MxAtomId* g_isleScript = NULL; + +// GLOBAL: LEGO1 0x100f4540 +MxAtomId* g_elevbottScript = NULL; + +// GLOBAL: LEGO1 0x100f4544 +MxAtomId* g_infodoorScript = NULL; + +// GLOBAL: LEGO1 0x100f4548 +MxAtomId* g_infomainScript = NULL; + +// GLOBAL: LEGO1 0x100f454c +MxAtomId* g_infoscorScript = NULL; + +// GLOBAL: LEGO1 0x100f4550 +MxAtomId* g_regbookScript = NULL; + +// GLOBAL: LEGO1 0x100f4554 +MxAtomId* g_histbookScript = NULL; + +// GLOBAL: LEGO1 0x100f4558 +MxAtomId* g_hospitalScript = NULL; + +// GLOBAL: LEGO1 0x100f455c +MxAtomId* g_policeScript = NULL; + +// GLOBAL: LEGO1 0x100f4560 +MxAtomId* g_garageScript = NULL; + +// GLOBAL: LEGO1 0x100f4564 +MxAtomId* g_act2mainScript = NULL; + +// GLOBAL: LEGO1 0x100f4568 +MxAtomId* g_act3Script = NULL; + +// GLOBAL: LEGO1 0x100f456c +MxAtomId* g_jukeboxScript = NULL; + +// GLOBAL: LEGO1 0x100f4570 +MxAtomId* g_pz5Script = NULL; + +// GLOBAL: LEGO1 0x100f4574 +MxAtomId* g_introScript = NULL; + +// GLOBAL: LEGO1 0x100f4578 +MxAtomId* g_testScript = NULL; + +// GLOBAL: LEGO1 0x100f457c +MxAtomId* g_jukeboxwScript = NULL; + +// GLOBAL: LEGO1 0x100f4580 +MxAtomId* g_sndAnimScript = NULL; + +// GLOBAL: LEGO1 0x100f4584 +MxAtomId* g_creditsScript = NULL; + +// GLOBAL: LEGO1 0x100f4588 +MxAtomId* g_nocdSourceName = NULL; + +// FUNCTION: LEGO1 0x100528e0 +void CreateScripts() +{ + g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", e_lowerCase2); + g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", e_lowerCase2); + g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", e_lowerCase2); + g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", e_lowerCase2); + g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", e_lowerCase2); + g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", e_lowerCase2); + g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", e_lowerCase2); + g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", e_lowerCase2); + g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", e_lowerCase2); + g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", e_lowerCase2); + g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", e_lowerCase2); + g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", e_lowerCase2); + g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", e_lowerCase2); + g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", e_lowerCase2); + g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", e_lowerCase2); + g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", e_lowerCase2); + g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", e_lowerCase2); + g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", e_lowerCase2); + g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", e_lowerCase2); + g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", e_lowerCase2); + g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", e_lowerCase2); + g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", e_lowerCase2); + g_introScript = new MxAtomId("\\lego\\scripts\\intro", e_lowerCase2); + g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", e_lowerCase2); + g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", e_lowerCase2); + g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", e_lowerCase2); + g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", e_lowerCase2); + g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", e_lowerCase2); +} + +// FUNCTION: LEGO1 0x100530c0 +void DestroyScripts() +{ + delete g_copterScript; + delete g_dunecarScript; + delete g_jetskiScript; + delete g_racecarScript; + delete g_carraceScript; + delete g_carracerScript; + delete g_jetraceScript; + delete g_jetracerScript; + delete g_isleScript; + delete g_elevbottScript; + delete g_infodoorScript; + delete g_infomainScript; + delete g_infoscorScript; + delete g_regbookScript; + delete g_histbookScript; + delete g_hospitalScript; + delete g_policeScript; + delete g_garageScript; + delete g_act2mainScript; + delete g_act3Script; + delete g_jukeboxScript; + delete g_pz5Script; + delete g_introScript; + delete g_testScript; + delete g_jukeboxwScript; + delete g_sndAnimScript; + delete g_creditsScript; + delete g_nocdSourceName; + + g_copterScript = NULL; + g_dunecarScript = NULL; + g_jetskiScript = NULL; + g_racecarScript = NULL; + g_carraceScript = NULL; + g_carracerScript = NULL; + g_jetraceScript = NULL; + g_jetracerScript = NULL; + g_isleScript = NULL; + g_elevbottScript = NULL; + g_infodoorScript = NULL; + g_infomainScript = NULL; + g_infoscorScript = NULL; + g_regbookScript = NULL; + g_histbookScript = NULL; + g_hospitalScript = NULL; + g_policeScript = NULL; + g_garageScript = NULL; + g_act2mainScript = NULL; + g_act3Script = NULL; + g_jukeboxScript = NULL; + g_pz5Script = NULL; + g_introScript = NULL; + g_testScript = NULL; + g_testScript = NULL; + g_jukeboxwScript = NULL; + g_sndAnimScript = NULL; + g_creditsScript = NULL; + g_nocdSourceName = NULL; +} + +// FUNCTION: LEGO1 0x10053430 +const char* GetNoCD_SourceName() +{ + return g_nocdSourceName->GetInternal(); +} diff --git a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp index c94b498d..70c73fe2 100644 --- a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp @@ -1,5 +1,6 @@ #include "legoanimactor.h" +#include "anim/legoanim.h" #include "define.h" #include "legolocomotionanimpresenter.h" #include "legopathboundary.h" diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 4402756d..9da6e219 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -1,8 +1,11 @@ #include "legoextraactor.h" +#include "anim/legoanim.h" +#include "legocachesoundmanager.h" #include "legolocomotionanimpresenter.h" #include "legopathboundary.h" #include "legosoundmanager.h" +#include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxtimer.h" diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 977624b5..400f165d 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -1,11 +1,16 @@ #include "legopathactor.h" +#include "geom/legounkown100db7f4.h" +#include "legocachesoundmanager.h" +#include "legocameracontroller.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legosoundmanager.h" +#include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxtimer.h" +#include "mxvariabletable.h" #include diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 422b972f..2a7c15e0 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -27,6 +27,20 @@ MxResult LegoPathController::Tickle() return SUCCESS; } +// STUB: LEGO1 0x10045c20 +// FUNCTION: BETA10 0x100b6d80 +MxResult LegoPathController::FUN_10045c20( + LegoPathActor* p_actor, + const char* p_path, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale +) +{ + return SUCCESS; +} + // STUB: LEGO1 0x10046770 undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index 9ff31ed4..7542192b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -1,8 +1,11 @@ #include "legopathpresenter.h" +#include "legopathcontroller.h" #include "legovideomanager.h" +#include "legoworld.h" #include "misc.h" #include "mxautolock.h" +#include "mxdssubscriber.h" #include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoPathPresenter, 0x54) diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp index 365b8ef9..d3beb0e4 100644 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ b/LEGO1/lego/legoomni/src/police/policeentity.cpp @@ -6,11 +6,11 @@ #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/police/policestate.cpp b/LEGO1/lego/legoomni/src/police/policestate.cpp index 4078de0b..c0a6e716 100644 --- a/LEGO1/lego/legoomni/src/police/policestate.cpp +++ b/LEGO1/lego/legoomni/src/police/policestate.cpp @@ -1,12 +1,12 @@ #include "policestate.h" #include "islepathactor.h" -#include "legoomni.h" #include "misc.h" #include "mxdsaction.h" #include "mxmisc.h" #include "police.h" #include "police_actions.h" +#include "scripts.h" #include diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp index 01d64153..f7a572b0 100644 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp @@ -6,11 +6,11 @@ #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" -#include "legoomni.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index c5aa1e1c..32a8d26f 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1,9 +1,13 @@ #include "legoanimpresenter.h" +#include "3dmanager/lego3dmanager.h" +#include "anim/legoanim.h" #include "define.h" #include "legoanimationmanager.h" #include "legoanimmmpresenter.h" +#include "legocameracontroller.h" #include "legocharactermanager.h" +#include "legoendanimnotificationparam.h" #include "legopathboundary.h" #include "legovideomanager.h" #include "legoworld.h" @@ -11,14 +15,16 @@ #include "mxautolock.h" #include "mxcompositepresenter.h" #include "mxdsanim.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstreamchunk.h" #include "mxtimer.h" -#include "mxtype18notificationparam.h" #include "mxutilities.h" +#include "mxvariabletable.h" #include "mxvideomanager.h" #include "realtime/realtime.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(LegoAnimPresenter, 0xbc) @@ -1021,7 +1027,7 @@ void LegoAnimPresenter::EndAction() LegoWorld* world = CurrentWorld(); if (world != NULL) { - MxType18NotificationParam param(c_notificationType18, NULL, 0); + LegoEndAnimNotificationParam param(c_notificationEndAnim, NULL, 0); NotificationManager()->Send(world, param); } diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index 81a9b921..c5da3ffe 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -1,6 +1,6 @@ #include "legolocomotionanimpresenter.h" -#include "legoomni.h" +#include "legomain.h" #include "legoworld.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 7417748f..974c2e16 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -1,5 +1,6 @@ #include "legomodelpresenter.h" +#include "3dmanager/lego3dmanager.h" #include "anim/legoanim.h" #include "define.h" #include "legocharactermanager.h" @@ -12,6 +13,8 @@ #include "misc/legotexture.h" #include "misc/version.h" #include "mxcompositepresenter.h" +#include "mxdirectx/mxdirect3d.h" +#include "mxdssubscriber.h" #include "mxutilities.h" #include "realtime/realtime.h" #include "roi/legoroi.h" diff --git a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp index f8322e93..880f1b9f 100644 --- a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp @@ -3,6 +3,9 @@ #include "legovideomanager.h" #include "misc.h" #include "misc/legostorage.h" +#include "mxdsaction.h" +#include "mxdssubscriber.h" +#include "mxpalette.h" #include "mxstreamchunk.h" DECOMP_SIZE_ASSERT(LegoPalettePresenter, 0x68) diff --git a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp index 7aead0ed..87e15745 100644 --- a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp @@ -5,6 +5,9 @@ #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "misc/legotexture.h" +#include "mxdirectx/mxdirect3d.h" +#include "mxdsaction.h" +#include "mxdssubscriber.h" #include "viewmanager/viewlodlist.h" DECOMP_SIZE_ASSERT(LegoLODList, 0x18) diff --git a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp index 5c0dd322..5fbbba21 100644 --- a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp @@ -1,9 +1,11 @@ #include "legophonemepresenter.h" #include "legocharactermanager.h" +#include "legovideomanager.h" #include "misc.h" #include "misc/legocontainer.h" #include "mxcompositepresenter.h" +#include "mxdsaction.h" DECOMP_SIZE_ASSERT(LegoPhonemePresenter, 0x88) diff --git a/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp b/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp index e2d5211b..0c76b447 100644 --- a/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp @@ -6,6 +6,8 @@ #include "misc/legoimage.h" #include "misc/legostorage.h" #include "mxcompositepresenter.h" +#include "mxdirectx/mxdirect3d.h" +#include "mxdssubscriber.h" DECOMP_SIZE_ASSERT(LegoTexturePresenter, 0x54) DECOMP_SIZE_ASSERT(LegoNamedTexture, 0x14) diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index e24de146..f790c7da 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -1,8 +1,15 @@ #include "legovideomanager.h" -#include "legoomni.h" +#include "3dmanager/lego3dmanager.h" +#include "legoinputmanager.h" +#include "legomain.h" #include "misc.h" +#include "mxdirectx/mxdirect3d.h" +#include "mxdirectx/mxstopwatch.h" +#include "mxdisplaysurface.h" #include "mxmisc.h" +#include "mxpalette.h" +#include "mxregion.h" #include "mxtimer.h" #include "mxtransitionmanager.h" #include "realtime/matrix.h" diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 0222bd83..b3184aff 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -7,12 +7,13 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "legovariables.h" #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxtransitionmanager.h" +#include "mxvariabletable.h" DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 9f4f870f..d32b32ab 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -1,21 +1,24 @@ #include "gasstation.h" #include "garage_actions.h" +#include "gasstationstate.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" #include "mxticklemanager.h" #include "mxtimer.h" #include "mxtransitionmanager.h" #include "radio.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(GasStation, 0x128) diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index 9f99002b..7534623a 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -7,6 +7,7 @@ #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" #include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4) diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 43b422dc..cbc86643 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -2,20 +2,24 @@ #include "act1state.h" #include "hospital_actions.h" +#include "hospitalstate.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "legoutils.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" #include "mxticklemanager.h" #include "mxtimer.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Hospital, 0x12c) diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index bddef81b..d5d68518 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -14,7 +14,7 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "legoplantmanager.h" #include "legoutils.h" #include "legovideomanager.h" @@ -22,12 +22,17 @@ #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxcontrolpresenter.h" +#include "mxdisplaysurface.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxticklemanager.h" #include "mxtransitionmanager.h" +#include "mxutilities.h" +#include "radiostate.h" +#include "scripts.h" #include "sndanim_actions.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(Infocenter, 0x1d8) DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18) diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index a94d5f27..bc961368 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -7,13 +7,14 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxtransitionmanager.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc) diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f26dca62..f87b3412 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1,5 +1,6 @@ #include "isle.h" +#include "3dmanager/lego3dmanager.h" #include "act1state.h" #include "ambulance.h" #include "bike.h" @@ -13,20 +14,24 @@ #include "jukebox_actions.h" #include "jukeboxentity.h" #include "legoanimationmanager.h" +#include "legobackgroundcolor.h" #include "legocontrolmanager.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "legoutils.h" #include "legovariables.h" #include "legovideomanager.h" #include "misc.h" #include "motocycle.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxtransitionmanager.h" +#include "mxvariabletable.h" #include "pizza.h" +#include "scripts.h" #include "skateboard.h" #include "towtrack.h" @@ -138,7 +143,7 @@ MxLong Isle::Notify(MxParam& p_param) case c_notificationClick: result = HandleClick((LegoControlManagerEvent&) p_param); break; - case c_notificationType18: + case c_notificationEndAnim: switch (m_act1state->m_unk0x018) { case 4: result = CurrentActor()->Notify(p_param); @@ -499,7 +504,11 @@ void Isle::Enable(MxBool p_enable) if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) { IslePathActor* actor = CurrentActor(); - actor->VTable0xe8(LegoGameState::e_unk45, FALSE, 7); + actor->SpawnPlayer( + LegoGameState::e_unk45, + FALSE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); actor->SetState(0); } else { @@ -629,7 +638,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 0; if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) { - AnimationManager()->FUN_10064740(FALSE); + AnimationManager()->FUN_10064740(NULL); } else if (GameState()->m_currentArea == LegoGameState::e_unk66) { Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); @@ -637,18 +646,22 @@ void Isle::Enable(MxBool p_enable) Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); ((Vector3&) sub).Sub(&position); if (sub.LenSquared() < 1024.0f) { - AnimationManager()->FUN_10064740(FALSE); + AnimationManager()->FUN_10064740(NULL); } Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f); ((Vector3&) sub2).Sub(&position); if (sub2.LenSquared() < 1024.0f) { - AnimationManager()->FUN_10064670(FALSE); + AnimationManager()->FUN_10064670(NULL); } } break; case 5: { - CurrentActor()->VTable0xe8(LegoGameState::e_jetrace2, FALSE, 7); + CurrentActor()->SpawnPlayer( + LegoGameState::e_jetrace2, + FALSE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -666,17 +679,21 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, 1, 1, 0, 0, FALSE, TRUE, 0); + AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; FUN_1003ef00(FALSE); - AnimationManager()->FUN_10064670(FALSE); + AnimationManager()->FUN_10064670(NULL); break; } case 6: { GameState()->m_currentArea = LegoGameState::e_carraceExterior; - CurrentActor()->VTable0xe8(LegoGameState::e_unk21, FALSE, 7); + CurrentActor()->SpawnPlayer( + LegoGameState::e_unk21, + FALSE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -694,7 +711,7 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, 1, 1, 0, 0, FALSE, TRUE, 0); + AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; @@ -721,7 +738,11 @@ void Isle::Enable(MxBool p_enable) break; case 11: m_act1state->m_unk0x018 = 0; - CurrentActor()->VTable0xe8(LegoGameState::e_unk54, TRUE, 7); + CurrentActor()->SpawnPlayer( + LegoGameState::e_unk54, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); GameState()->m_currentArea = LegoGameState::e_unk66; FUN_1003ef00(TRUE); m_jukebox->StartAction(); @@ -781,7 +802,11 @@ void Isle::FUN_10032620() case LegoGameState::e_hospitalExterior: case LegoGameState::e_unk31: case LegoGameState::e_policeExterior: - CurrentActor()->VTable0xe8(GameState()->m_currentArea, TRUE, 7); + CurrentActor()->SpawnPlayer( + GameState()->m_currentArea, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); GameState()->m_currentArea = LegoGameState::e_unk66; break; } @@ -857,7 +882,7 @@ MxLong Isle::HandleTransitionEnd() GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; VariableTable()->SetVariable("VISIBILITY", "Show Gas"); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); SetAppCursor(0); SetIsWorldActive(TRUE); @@ -867,7 +892,7 @@ MxLong Isle::HandleTransitionEnd() GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); SetAppCursor(0); SetIsWorldActive(TRUE); diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 84483153..257db67b 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -7,7 +7,7 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index e73c1384..1cf8f879 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -5,8 +5,9 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 549fc89a..29802f23 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -5,16 +5,18 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" #include "misc.h" #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" +#include "mxcontrolpresenter.h" #include "mxdisplaysurface.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" #include "mxtimer.h" #include "mxtransitionmanager.h" #include "regbook_actions.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0) diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index 868241d6..0bb40ea7 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -9,15 +9,18 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" -#include "legoomni.h" +#include "legomain.h" #include "misc.h" #include "misc/legocontainer.h" +#include "mxactionnotificationparam.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxnotificationparam.h" #include "mxtransitionmanager.h" #include "pizzamissionstate.h" #include "racestate.h" +#include "scorestate.h" +#include "scripts.h" #include "towtrackmissionstate.h" DECOMP_SIZE_ASSERT(Score, 0x104) diff --git a/LEGO1/lego/sources/3dmanager/lego3dmanager.cpp b/LEGO1/lego/sources/3dmanager/lego3dmanager.cpp index f58a519a..1781870a 100644 --- a/LEGO1/lego/sources/3dmanager/lego3dmanager.cpp +++ b/LEGO1/lego/sources/3dmanager/lego3dmanager.cpp @@ -4,6 +4,7 @@ #include "decomp.h" #include "viewmanager/viewlodlist.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(Lego3DManager, 0x10); diff --git a/LEGO1/lego/sources/3dmanager/lego3dview.h b/LEGO1/lego/sources/3dmanager/lego3dview.h index 74a9eb1c..6c8930e9 100644 --- a/LEGO1/lego/sources/3dmanager/lego3dview.h +++ b/LEGO1/lego/sources/3dmanager/lego3dview.h @@ -3,7 +3,9 @@ #include "decomp.h" #include "legoview1.h" -#include "viewmanager/viewmanager.h" + +class ViewManager; +class ViewROI; ///////////////////////////////////////////////////////////////////////////// // Lego3DView diff --git a/LEGO1/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 202f0236..92de53ae 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -515,7 +515,7 @@ inline void LegoAnimNodeData::GetTranslation( break; } - p_matrix.TranslateBy(&x, &y, &z); + p_matrix.TranslateBy(x, y, z); } // FUNCTION: LEGO1 0x100a06f0 diff --git a/LEGO1/lego/sources/anim/legoanim.h b/LEGO1/lego/sources/anim/legoanim.h index 7ba9cc04..9dd23a55 100644 --- a/LEGO1/lego/sources/anim/legoanim.h +++ b/LEGO1/lego/sources/anim/legoanim.h @@ -4,7 +4,8 @@ #include "decomp.h" #include "misc/legostorage.h" #include "misc/legotree.h" -#include "realtime/matrix.h" + +class Matrix4; // SIZE 0x08 class LegoAnimKey { diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index a3b71b64..da440e71 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -2,9 +2,9 @@ #define __LEGOEDGE_H #include "misc/legotypes.h" -#include "realtime/vector.h" class LegoWEEdge; +class Vector3; // VTABLE: LEGO1 0x100db7b8 // SIZE 0x24 diff --git a/LEGO1/lego/sources/misc/legocontainer.cpp b/LEGO1/lego/sources/misc/legocontainer.cpp index dddb979a..d9bdc0eb 100644 --- a/LEGO1/lego/sources/misc/legocontainer.cpp +++ b/LEGO1/lego/sources/misc/legocontainer.cpp @@ -2,6 +2,7 @@ #include "lego/legoomni/include/legovideomanager.h" #include "lego/legoomni/include/misc.h" +#include "mxdirectx/mxdirect3d.h" #include "tgl/d3drm/impl.h" DECOMP_SIZE_ASSERT(LegoContainerInfo, 0x10); diff --git a/LEGO1/lego/sources/misc/legounknown.h b/LEGO1/lego/sources/misc/legounknown.h index 8980d96a..03eafcee 100644 --- a/LEGO1/lego/sources/misc/legounknown.h +++ b/LEGO1/lego/sources/misc/legounknown.h @@ -3,7 +3,8 @@ #include "legotypes.h" #include "mxgeometry/mxgeometry3d.h" -#include "mxgeometry/mxmatrix.h" + +class Matrix4; // SIZE 0x50 class LegoUnknown { diff --git a/LEGO1/omni/include/mxatom.h b/LEGO1/omni/include/mxatom.h index 9528a3c6..ae3dbba3 100644 --- a/LEGO1/omni/include/mxatom.h +++ b/LEGO1/omni/include/mxatom.h @@ -35,8 +35,8 @@ class MxAtom { // MxAtom::`scalar deleting destructor' private: - MxString m_key; - MxU16 m_value; + MxString m_key; // 0x00 + MxU16 m_value; // 0x10 }; struct MxAtomCompare { diff --git a/LEGO1/omni/include/mxautolock.h b/LEGO1/omni/include/mxautolock.h index 1488cd4e..677804e7 100644 --- a/LEGO1/omni/include/mxautolock.h +++ b/LEGO1/omni/include/mxautolock.h @@ -1,7 +1,7 @@ #ifndef MXAUTOLOCK_H #define MXAUTOLOCK_H -#include "mxcriticalsection.h" +class MxCriticalSection; #define AUTOLOCK(CS) MxAutoLock lock(&CS) diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index 8f06abf0..a11853e4 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -2,11 +2,13 @@ #define MXBITMAP_H #include "mxcore.h" -#include "mxpalette.h" #include "mxtypes.h" +#include #include +class MxPalette; + // The stock BITMAPINFO struct from wingdi.h only makes room for one color // in the palette. It seems like the expectation (if you use the struct) // is to malloc as much as you actually need, and then index into the array diff --git a/LEGO1/omni/include/mxcompositepresenter.h b/LEGO1/omni/include/mxcompositepresenter.h index 2e5a6d95..977c1325 100644 --- a/LEGO1/omni/include/mxcompositepresenter.h +++ b/LEGO1/omni/include/mxcompositepresenter.h @@ -1,10 +1,12 @@ #ifndef MXCOMPOSITEPRESENTER_H #define MXCOMPOSITEPRESENTER_H -#include "mxactionnotificationparam.h" #include "mxpresenter.h" #include "mxstl/stlcompat.h" +class MxEndActionNotificationParam; +class MxNotificationParam; + class MxCompositePresenterList : public list {}; // VTABLE: LEGO1 0x100dc618 diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index ab13c73d..b7312833 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -3,13 +3,14 @@ #include "decomp.h" #include "mxdsbuffer.h" -#include "mxdsstreamingaction.h" #include "mxstl/stlcompat.h" #include "mxstreamcontroller.h" #include "mxtypes.h" #include +class MxDSStreamingAction; + // VTABLE: LEGO1 0x100dccb8 // SIZE 0xc8 class MxDiskStreamController : public MxStreamController { diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index f440a8a9..2ec14784 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -2,13 +2,14 @@ #define MXDISPLAYSURFACE_H #include "decomp.h" -#include "mxbitmap.h" #include "mxcore.h" -#include "mxpalette.h" #include "mxvideoparam.h" #include +class MxBitmap; +class MxPalette; + // VTABLE: LEGO1 0x100dc768 // SIZE 0xac class MxDisplaySurface : public MxCore { diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index 19ea4390..532035b5 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -8,6 +8,7 @@ class MxOmni; // VTABLE: LEGO1 0x100dc098 +// VTABLE: BETA10 0x101c1b68 // SIZE 0x94 class MxDSAction : public MxDSObject { public: @@ -27,10 +28,12 @@ class MxDSAction : public MxDSObject { MxDSAction(); ~MxDSAction() override; + MxDSAction(MxDSAction& p_dsAction); void CopyFrom(MxDSAction& p_dsAction); MxDSAction& operator=(MxDSAction& p_dsAction); // FUNCTION: LEGO1 0x100ad980 + // FUNCTION: BETA10 0x1012bcf0 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x101013f4 @@ -38,6 +41,7 @@ class MxDSAction : public MxDSObject { } // FUNCTION: LEGO1 0x100ad990 + // FUNCTION: BETA10 0x1012bd10 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSAction::ClassName()) || MxDSObject::IsA(p_name); @@ -57,22 +61,39 @@ class MxDSAction : public MxDSObject { void AppendExtra(MxU16 p_extraLength, const char* p_extraData); + // FUNCTION: BETA10 0x1003a560 inline void GetExtra(MxU16& p_extraLength, char*& p_extraData) { p_extraLength = m_extraLength; p_extraData = m_extraData; } + // FUNCTION: BETA10 0x1003cf70 inline MxU32 GetFlags() { return m_flags; } + + // FUNCTION: BETA10 0x1004daa0 inline void SetFlags(MxU32 p_flags) { m_flags = p_flags; } + inline char* GetExtraData() { return m_extraData; } inline MxU16 GetExtraLength() const { return m_extraLength; } + + // FUNCTION: BETA10 0x1005a560 inline MxLong GetStartTime() const { return m_startTime; } + + // FUNCTION: BETA10 0x1012be80 inline MxS32 GetLoopCount() { return m_loopCount; } + inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } + + // FUNCTION: BETA10 0x1003db50 inline Mx3DPointFloat& GetLocation() { return m_location; } + + // FUNCTION: BETA10 0x1003db80 inline Mx3DPointFloat& GetDirection() { return m_direction; } + + // FUNCTION: BETA10 0x1003dbb0 inline Mx3DPointFloat& GetUp() { return m_up; } + inline void SetLocation(const Vector3& p_location) { m_location = p_location; } inline void SetDirection(const Vector3& p_direction) { m_direction = p_direction; } inline void SetUp(const Vector3& p_up) { m_up = p_up; } @@ -85,6 +106,7 @@ class MxDSAction : public MxDSObject { inline MxBool IsBit3() const { return m_flags & c_bit3; } // SYNTHETIC: LEGO1 0x100ada60 + // SYNTHETIC: BETA10 0x1012be40 // MxDSAction::`scalar deleting destructor' protected: diff --git a/LEGO1/omni/include/mxdsactionlist.h b/LEGO1/omni/include/mxdsactionlist.h index 6c8b8024..989508e6 100644 --- a/LEGO1/omni/include/mxdsactionlist.h +++ b/LEGO1/omni/include/mxdsactionlist.h @@ -2,10 +2,9 @@ #define MXDSACTIONLIST_H #include "decomp.h" +#include "mxdsaction.h" #include "mxlist.h" -class MxDSAction; - // VTABLE: LEGO1 0x100dcea8 // class MxCollection @@ -31,7 +30,7 @@ class MxDSActionList : public MxList { // MxDSActionList::`scalar deleting destructor' private: - undefined m_unk0x18; + undefined m_unk0x18; // 0x18 }; // VTABLE: LEGO1 0x100d7e68 diff --git a/LEGO1/omni/include/mxdsmediaaction.h b/LEGO1/omni/include/mxdsmediaaction.h index 1fb95cc0..9b5f8604 100644 --- a/LEGO1/omni/include/mxdsmediaaction.h +++ b/LEGO1/omni/include/mxdsmediaaction.h @@ -3,9 +3,9 @@ #include "decomp.h" #include "mxdsaction.h" -#include "mxpoint32.h" // VTABLE: LEGO1 0x100dcd40 +// VTABLE: BETA10 0x101c2ad8 // SIZE 0xb8 class MxDSMediaAction : public MxDSAction { public: @@ -13,9 +13,11 @@ class MxDSMediaAction : public MxDSAction { ~MxDSMediaAction() override; void CopyFrom(MxDSMediaAction& p_dsMediaAction); + MxDSMediaAction(MxDSMediaAction& p_dsMediaAction); MxDSMediaAction& operator=(MxDSMediaAction& p_dsMediaAction); // FUNCTION: LEGO1 0x100c8be0 + // FUNCTION: BETA10 0x1015c700 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f7624 @@ -23,12 +25,14 @@ class MxDSMediaAction : public MxDSAction { } // FUNCTION: LEGO1 0x100c8bf0 + // FUNCTION: BETA10 0x1015c6a0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, MxDSMediaAction::ClassName()) || MxDSAction::IsA(p_name); } // SYNTHETIC: LEGO1 0x100c8cd0 + // SYNTHETIC: BETA10 0x1015d810 // MxDSMediaAction::`scalar deleting destructor' undefined4 VTable0x14() override; // vtable+14; @@ -38,18 +42,34 @@ class MxDSMediaAction : public MxDSAction { void CopyMediaSrcPath(const char* p_mediaSrcPath); - inline MxS32 GetFramesPerSecond() const { return this->m_framesPerSecond; } - inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; } - inline MxS32 GetPaletteManagement() const { return this->m_paletteManagement; } - inline MxLong GetSustainTime() const { return this->m_sustainTime; } + // FUNCTION: BETA10 0x1013c2e0 + inline MxS32 GetFramesPerSecond() const { return m_framesPerSecond; } + + // FUNCTION: BETA10 0x1012efd0 + inline MxS32 GetMediaFormat() const { return m_mediaFormat; } + + // FUNCTION: BETA10 0x1013b860 + inline MxS32 GetPaletteManagement() const { return m_paletteManagement; } + + // FUNCTION: BETA10 0x1005ab60 + inline MxLong GetSustainTime() const { return m_sustainTime; } private: - MxU32 m_sizeOnDisk; // 0x94 - char* m_mediaSrcPath; // 0x98 - struct { + struct Unk0x9cStruct { + // FUNCTION: BETA10 0x1015d7c0 + void SetUnk0x00(undefined4 p_value) { m_unk0x00 = p_value; } + + // FUNCTION: BETA10 0x1015d7e0 + void SetUnk0x04(undefined4 p_value) { m_unk0x04 = p_value; } + + // intentionally public undefined4 m_unk0x00; undefined4 m_unk0x04; - } m_unk0x9c; // 0x9c + }; + + MxU32 m_sizeOnDisk; // 0x94 + char* m_mediaSrcPath; // 0x98 + Unk0x9cStruct m_unk0x9c; // 0x9c MxS32 m_framesPerSecond; // 0xa4 MxS32 m_mediaFormat; // 0xa8 MxS32 m_paletteManagement; // 0xac diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index 1a8c6ba2..8fe2426c 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -8,6 +8,7 @@ class MxPresenter; // VTABLE: LEGO1 0x100dc868 +// VTABLE: BETA10 0x101c23f0 // SIZE 0x2c class MxDSObject : public MxCore { public: @@ -30,15 +31,18 @@ class MxDSObject : public MxCore { ~MxDSObject() override; void CopyFrom(MxDSObject& p_dsObject); + MxDSObject(MxDSObject& p_dsObject); MxDSObject& operator=(MxDSObject& p_dsObject); void SetObjectName(const char* p_objectName); void SetSourceName(const char* p_sourceName); // FUNCTION: LEGO1 0x100bf730 + // FUNCTION: BETA10 0x1012bdd0 inline const char* ClassName() const override { return "MxDSObject"; } // vtable+0c // FUNCTION: LEGO1 0x100bf740 + // FUNCTION: BETA10 0x1012bd70 inline MxBool IsA(const char* p_name) const override { return !strcmp(p_name, MxDSObject::ClassName()) || MxCore::IsA(p_name); @@ -50,27 +54,37 @@ class MxDSObject : public MxCore { // FUNCTION: ISLE 0x401c40 // FUNCTION: LEGO1 0x10005530 - inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20; + // FUNCTION: BETA10 0x100152e0 + inline virtual void SetAtomId(MxAtomId p_atomId) { m_atomId = p_atomId; } // vtable+20; - inline Type GetType() const { return (Type) this->m_type; } - inline const char* GetSourceName() const { return this->m_sourceName; } - inline const char* GetObjectName() const { return this->m_objectName; } - inline MxU32 GetObjectId() { return this->m_objectId; } - inline const MxAtomId& GetAtomId() { return this->m_atomId; } - inline MxS16 GetUnknown24() { return this->m_unk0x24; } - inline MxPresenter* GetUnknown28() { return this->m_unk0x28; } + // FUNCTION: BETA10 0x1012ef90 + inline Type GetType() const { return (Type) m_type; } - inline void SetType(Type p_type) { this->m_type = p_type; } - inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; } - inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; } - inline void SetUnknown28(MxPresenter* p_unk0x28) { this->m_unk0x28 = p_unk0x28; } + // FUNCTION: BETA10 0x1012efb0 + inline const char* GetSourceName() const { return m_sourceName; } + inline const char* GetObjectName() const { return m_objectName; } + inline MxU32 GetObjectId() { return m_objectId; } + inline const MxAtomId& GetAtomId() { return m_atomId; } + inline MxS16 GetUnknown24() { return m_unk0x24; } + inline MxPresenter* GetUnknown28() { return m_unk0x28; } + + inline void SetType(Type p_type) { m_type = p_type; } + + // FUNCTION: BETA10 0x100152b0 + inline void SetObjectId(MxU32 p_objectId) { m_objectId = p_objectId; } + + // FUNCTION: BETA10 0x10039570 + inline void SetUnknown24(MxS16 p_unk0x24) { m_unk0x24 = p_unk0x24; } + + inline void SetUnknown28(MxPresenter* p_unk0x28) { m_unk0x28 = p_unk0x28; } inline void ClearAtom() { m_atomId.Clear(); } // SYNTHETIC: LEGO1 0x100bf7c0 + // SYNTHETIC: BETA10 0x10148770 // MxDSObject::`scalar deleting destructor' -private: +protected: MxU32 m_sizeOnDisk; // 0x08 MxU16 m_type; // 0x0c char* m_sourceName; // 0x10 diff --git a/LEGO1/omni/include/mxdssubscriber.h b/LEGO1/omni/include/mxdssubscriber.h index 54cd203d..6d420c35 100644 --- a/LEGO1/omni/include/mxdssubscriber.h +++ b/LEGO1/omni/include/mxdssubscriber.h @@ -3,8 +3,6 @@ #include "decomp.h" #include "mxcore.h" -#include "mxdschunk.h" -#include "mxstreamchunk.h" #include "mxstreamchunklist.h" class MxStreamController; diff --git a/LEGO1/omni/include/mxmediamanager.h b/LEGO1/omni/include/mxmediamanager.h index 77720bf3..5fd2390c 100644 --- a/LEGO1/omni/include/mxmediamanager.h +++ b/LEGO1/omni/include/mxmediamanager.h @@ -4,9 +4,10 @@ #include "mxcore.h" #include "mxcriticalsection.h" #include "mxpresenterlist.h" -#include "mxthread.h" #include "mxtypes.h" +class MxThread; + // VTABLE: LEGO1 0x100dc6b0 // SIZE 0x2c class MxMediaManager : public MxCore { diff --git a/LEGO1/omni/include/mxmediapresenter.h b/LEGO1/omni/include/mxmediapresenter.h index 7eef4ff6..e78ac194 100644 --- a/LEGO1/omni/include/mxmediapresenter.h +++ b/LEGO1/omni/include/mxmediapresenter.h @@ -2,10 +2,11 @@ #define MXMEDIAPRESENTER_H #include "decomp.h" -#include "mxdssubscriber.h" #include "mxpresenter.h" #include "mxstreamchunklist.h" +class MxDSSubscriber; + // VTABLE: LEGO1 0x100d4cd8 // SIZE 0x50 class MxMediaPresenter : public MxPresenter { diff --git a/LEGO1/omni/include/mxmidipresenter.h b/LEGO1/omni/include/mxmidipresenter.h index 3dabbc0e..adab6fe2 100644 --- a/LEGO1/omni/include/mxmidipresenter.h +++ b/LEGO1/omni/include/mxmidipresenter.h @@ -2,7 +2,8 @@ #define MXMIDIPRESENTER_H #include "mxmusicpresenter.h" -#include "mxstreamchunk.h" + +class MxStreamChunk; // VTABLE: LEGO1 0x100dca20 // SIZE 0x58 @@ -41,7 +42,7 @@ class MxMIDIPresenter : public MxMusicPresenter { void Destroy(MxBool p_fromDestructor); protected: - MxStreamChunk* m_chunk; + MxStreamChunk* m_chunk; // 0x54 }; #endif // MXMIDIPRESENTER_H diff --git a/LEGO1/omni/include/mxnotificationmanager.h b/LEGO1/omni/include/mxnotificationmanager.h index 69ad1b18..e99f0923 100644 --- a/LEGO1/omni/include/mxnotificationmanager.h +++ b/LEGO1/omni/include/mxnotificationmanager.h @@ -3,10 +3,11 @@ #include "mxcore.h" #include "mxcriticalsection.h" -#include "mxnotificationparam.h" #include "mxstl/stlcompat.h" #include "mxtypes.h" +class MxNotificationParam; + class MxNotification { public: MxNotification(MxCore* p_target, const MxNotificationParam& p_param); diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index 1443d07b..afe2282b 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -7,6 +7,7 @@ class MxCore; +// Several of those should be defined in LegoOmni enum NotificationId { c_notificationType0 = 0, c_notificationStartAction = 1, // 100dc210:100d8350 @@ -24,8 +25,8 @@ enum NotificationId { c_notificationDrag = 14, c_notificationTimer = 15, // 100d6aa0 c_notificationClick = 17, - c_notificationType18 = 18, // 100d7e80 - c_notificationType19 = 19, // 100d6230 + c_notificationEndAnim = 18, // 100d7e80 + c_notificationType19 = 19, // 100d6230 c_notificationType20 = 20, c_notificationNewPresenter = 21, c_notificationType22 = 22, diff --git a/LEGO1/omni/include/mxomnicreateflags.h b/LEGO1/omni/include/mxomnicreateflags.h index 62e795fa..561af2a1 100644 --- a/LEGO1/omni/include/mxomnicreateflags.h +++ b/LEGO1/omni/include/mxomnicreateflags.h @@ -3,6 +3,7 @@ #include "mxtypes.h" +// SIZE 0x02 class MxOmniCreateFlags { public: MxOmniCreateFlags(); diff --git a/LEGO1/omni/include/mxomnicreateparam.h b/LEGO1/omni/include/mxomnicreateparam.h index 5bc87dbb..338767bb 100644 --- a/LEGO1/omni/include/mxomnicreateparam.h +++ b/LEGO1/omni/include/mxomnicreateparam.h @@ -32,10 +32,10 @@ class MxOmniCreateParam : public MxParam { // MxOmniCreateParam::`scalar deleting destructor' private: - MxString m_mediaPath; - HWND m_windowHandle; - MxVideoParam m_videoParam; - MxOmniCreateFlags m_createFlags; + MxString m_mediaPath; // 0x04 + HWND m_windowHandle; // 0x14 + MxVideoParam m_videoParam; // 0x18 + MxOmniCreateFlags m_createFlags; // 0x3c }; // SYNTHETIC: ISLE 0x4014b0 diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index dae4e0ad..a652f40d 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -4,10 +4,11 @@ #include "decomp.h" #include "mxcore.h" #include "mxcriticalsection.h" -#include "mxdsaction.h" #include "mxpoint32.h" class MxCompositePresenter; +class MxDSAction; +class MxOmni; class MxStreamController; class MxEntity; @@ -107,7 +108,7 @@ class MxPresenter : public MxCore { virtual void Enable(MxBool p_enable); // vtable+0x54 MxEntity* CreateEntity(const char* p_defaultName); - void SendToCompositePresenter(MxOmni*); + void SendToCompositePresenter(MxOmni* p_omni); MxBool IsEnabled(); inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; } diff --git a/LEGO1/omni/include/mxramstreamcontroller.h b/LEGO1/omni/include/mxramstreamcontroller.h index 820fc3f7..b445e8cd 100644 --- a/LEGO1/omni/include/mxramstreamcontroller.h +++ b/LEGO1/omni/include/mxramstreamcontroller.h @@ -2,9 +2,10 @@ #define MXRAMSTREAMCONTROLLER_H #include "mxdsbuffer.h" -#include "mxdsstreamingaction.h" #include "mxstreamcontroller.h" +class MxDSStreamingAction; + // VTABLE: LEGO1 0x100dc728 // SIZE 0x98 class MxRAMStreamController : public MxStreamController { diff --git a/LEGO1/omni/include/mxsmack.h b/LEGO1/omni/include/mxsmack.h index 227dbd6d..e7fdf3ce 100644 --- a/LEGO1/omni/include/mxsmack.h +++ b/LEGO1/omni/include/mxsmack.h @@ -2,12 +2,13 @@ #define MXSMACK_H #include "decomp.h" -#include "mxbitmap.h" #include "mxrectlist.h" #include "mxtypes.h" #include +struct MxBITMAPINFO; + // These functions are not part of the public interface, // but present in SMACK.LIB and used directly by Mindscape. extern "C" diff --git a/LEGO1/omni/include/mxstreamchunk.h b/LEGO1/omni/include/mxstreamchunk.h index 00e242d0..80c33c8a 100644 --- a/LEGO1/omni/include/mxstreamchunk.h +++ b/LEGO1/omni/include/mxstreamchunk.h @@ -2,7 +2,6 @@ #define MXSTREAMCHUNK_H #include "mxdschunk.h" -#include "mxdsobject.h" class MxDSBuffer; class MxStreamListMxDSSubscriber; diff --git a/LEGO1/omni/include/mxstreamchunklist.h b/LEGO1/omni/include/mxstreamchunklist.h index 4ae8fabe..105ff93b 100644 --- a/LEGO1/omni/include/mxstreamchunklist.h +++ b/LEGO1/omni/include/mxstreamchunklist.h @@ -3,8 +3,7 @@ #include "decomp.h" #include "mxlist.h" - -class MxStreamChunk; +#include "mxstreamchunk.h" // VTABLE: LEGO1 0x100dc5d0 // class MxCollection diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index b623d28f..8948edf4 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -5,14 +5,12 @@ #include "mxatom.h" #include "mxcore.h" #include "mxcriticalsection.h" -#include "mxdsaction.h" -#include "mxdsobject.h" #include "mxdssubscriber.h" #include "mxstl/stlcompat.h" #include "mxstreamlist.h" -#include "mxstreamprovider.h" class MxDSStreamingAction; +class MxStreamProvider; // VTABLE: LEGO1 0x100dc968 // SIZE 0x64 diff --git a/LEGO1/omni/include/mxstreamer.h b/LEGO1/omni/include/mxstreamer.h index 6ed47802..95c53fee 100644 --- a/LEGO1/omni/include/mxstreamer.h +++ b/LEGO1/omni/include/mxstreamer.h @@ -3,19 +3,21 @@ #include "decomp.h" #include "mxcore.h" -#include "mxdsobject.h" #include "mxmemorypool.h" #include "mxnotificationparam.h" +#include "mxstl/stlcompat.h" #include "mxstreamcontroller.h" #include "mxtypes.h" #include -#include + +class MxDSObject; typedef MxMemoryPool<64, 22> MxMemoryPool64; typedef MxMemoryPool<128, 2> MxMemoryPool128; // VTABLE: LEGO1 0x100dc760 +// SIZE 0x10 class MxStreamerNotification : public MxNotificationParam { public: inline MxStreamerNotification(NotificationId p_type, MxCore* p_sender, MxStreamController* p_ctrlr) @@ -29,7 +31,7 @@ class MxStreamerNotification : public MxNotificationParam { MxStreamController* GetController() { return m_controller; } private: - MxStreamController* m_controller; + MxStreamController* m_controller; // 0x0c }; // VTABLE: LEGO1 0x100dc710 diff --git a/LEGO1/omni/include/mxstreamprovider.h b/LEGO1/omni/include/mxstreamprovider.h index 1082fffe..19f455e8 100644 --- a/LEGO1/omni/include/mxstreamprovider.h +++ b/LEGO1/omni/include/mxstreamprovider.h @@ -3,10 +3,10 @@ #include "decomp.h" #include "mxcore.h" -#include "mxdsfile.h" class MxStreamController; class MxDSAction; +class MxDSFile; // VTABLE: LEGO1 0x100dd100 // SIZE 0x10 diff --git a/LEGO1/omni/include/mxtype18notificationparam.h b/LEGO1/omni/include/mxtype18notificationparam.h deleted file mode 100644 index 77d3ecb9..00000000 --- a/LEGO1/omni/include/mxtype18notificationparam.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef MXTYPE18NOTIFICATIONPARAM_H -#define MXTYPE18NOTIFICATIONPARAM_H - -#include "decomp.h" -#include "mxnotificationparam.h" - -// VTABLE: LEGO1 0x100d7e80 -// SIZE 0x10 -class MxType18NotificationParam : public MxNotificationParam { -public: - MxType18NotificationParam(NotificationId p_type, MxCore* p_sender, undefined4 p_unk0x0c) - : MxNotificationParam(p_type, p_sender), m_unk0x0c(p_unk0x0c) - { - } - - // FUNCTION: LEGO1 0x1004afd0 - MxNotificationParam* Clone() const override - { - return new MxType18NotificationParam(m_type, m_sender, m_unk0x0c); - } // vtable+0x04 - -protected: - undefined4 m_unk0x0c; // 0x0c -}; - -// SYNTHETIC: LEGO1 0x1004b080 -// MxType18NotificationParam::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1004b0f0 -// MxType18NotificationParam::~MxType18NotificationParam - -#endif // MXTYPE18NOTIFICATIONPARAM_H diff --git a/LEGO1/omni/include/mxvariable.h b/LEGO1/omni/include/mxvariable.h index 6ad125de..7f1e8c33 100644 --- a/LEGO1/omni/include/mxvariable.h +++ b/LEGO1/omni/include/mxvariable.h @@ -10,6 +10,7 @@ class MxVariable { public: MxVariable() {} + // FUNCTION: BETA10 0x1012a840 MxVariable(const char* p_key, const char* p_value) { @@ -17,6 +18,7 @@ class MxVariable { m_key.ToUpperCase(); m_value = p_value; } + // FUNCTION: BETA10 0x1012aa30 MxVariable(const char* p_key) { diff --git a/LEGO1/omni/include/mxvideomanager.h b/LEGO1/omni/include/mxvideomanager.h index a915f5f5..02c16b61 100644 --- a/LEGO1/omni/include/mxvideomanager.h +++ b/LEGO1/omni/include/mxvideomanager.h @@ -1,14 +1,15 @@ #ifndef MXVIDEOMANAGER_H #define MXVIDEOMANAGER_H -#include "mxdisplaysurface.h" #include "mxmediamanager.h" -#include "mxrect32.h" -#include "mxregion.h" #include "mxvideoparam.h" #include +class MxDisplaySurface; +class MxRect32; +class MxRegion; + // VTABLE: LEGO1 0x100dc810 // SIZE 0x64 class MxVideoManager : public MxMediaManager { diff --git a/LEGO1/omni/include/mxvideoparam.h b/LEGO1/omni/include/mxvideoparam.h index b9ae10ba..f9766b97 100644 --- a/LEGO1/omni/include/mxvideoparam.h +++ b/LEGO1/omni/include/mxvideoparam.h @@ -2,14 +2,14 @@ #define MXVIDEOPARAM_H #include "compat.h" -#include "mxpalette.h" #include "mxrect32.h" #include "mxtypes.h" -#include "mxvariabletable.h" #include "mxvideoparamflags.h" #include +class MxPalette; + // SIZE 0x24 class MxVideoParam { public: diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 5beac120..19a40e39 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -6,6 +6,8 @@ #include "mxmediapresenter.h" #include "mxrect32.h" +#include + // VTABLE: LEGO1 0x100d4be8 // SIZE 0x64 class MxVideoPresenter : public MxMediaPresenter { diff --git a/LEGO1/omni/src/action/mxdsaction.cpp b/LEGO1/omni/src/action/mxdsaction.cpp index c5222fcb..8dc22fcf 100644 --- a/LEGO1/omni/src/action/mxdsaction.cpp +++ b/LEGO1/omni/src/action/mxdsaction.cpp @@ -4,106 +4,132 @@ #include "mxtimer.h" #include "mxutilities.h" +#include #include #include DECOMP_SIZE_ASSERT(MxDSAction, 0x94) // GLOBAL: LEGO1 0x10101410 +// GLOBAL: BETA10 0x10201f5c MxU16 g_sep = TWOCC(',', ' '); // FUNCTION: LEGO1 0x100ad810 +// FUNCTION: BETA10 0x1012afd0 MxDSAction::MxDSAction() { - this->m_flags = MxDSAction::c_enabled; - this->m_startTime = INT_MIN; - this->m_extraData = NULL; - this->m_extraLength = 0; - this->m_duration = INT_MIN; - this->m_loopCount = -1; - - this->SetType(e_action); - this->m_location.Fill(FLT_MAX); - this->m_direction.Fill(FLT_MAX); - this->m_up.Fill(FLT_MAX); - this->m_unk0x84 = NULL; - this->m_unk0x88 = 0; - this->m_origin = NULL; - this->m_unk0x90 = INT_MIN; + m_type = e_action; + m_flags = MxDSAction::c_enabled; + m_extraLength = 0; + m_extraData = NULL; + m_startTime = INT_MIN; + m_duration = INT_MIN; + m_loopCount = -1; + m_location.Fill(FLT_MAX); + m_direction.Fill(FLT_MAX); + m_up.Fill(FLT_MAX); + m_unk0x84 = NULL; + m_unk0x88 = 0; + m_origin = NULL; + m_unk0x90 = INT_MIN; } // FUNCTION: LEGO1 0x100ad940 +// FUNCTION: BETA10 0x1012bc50 MxLong MxDSAction::GetDuration() { - return this->m_duration; + return m_duration; } // FUNCTION: LEGO1 0x100ad950 +// FUNCTION: BETA10 0x1012bc90 void MxDSAction::SetDuration(MxLong p_duration) { - this->m_duration = p_duration; + m_duration = p_duration; } // FUNCTION: LEGO1 0x100ad960 +// FUNCTION: BETA10 0x1012bcc0 MxBool MxDSAction::HasId(MxU32 p_objectId) { - return this->GetObjectId() == p_objectId; + return m_objectId == p_objectId; } // FUNCTION: LEGO1 0x100ada40 +// FUNCTION: BETA10 0x1012bdf0 void MxDSAction::SetUnknown90(MxLong p_unk0x90) { - this->m_unk0x90 = p_unk0x90; + m_unk0x90 = p_unk0x90; } // FUNCTION: LEGO1 0x100ada50 +// FUNCTION: BETA10 0x1012be20 MxLong MxDSAction::GetUnknown90() { - return this->m_unk0x90; + return m_unk0x90; } // FUNCTION: LEGO1 0x100ada80 +// FUNCTION: BETA10 0x1012b144 MxDSAction::~MxDSAction() { - delete[] this->m_extraData; + delete[] m_extraData; } // FUNCTION: LEGO1 0x100adaf0 +// FUNCTION: BETA10 0x1012b1c7 void MxDSAction::CopyFrom(MxDSAction& p_dsAction) { - this->SetObjectId(p_dsAction.GetObjectId()); - this->m_flags = p_dsAction.m_flags; - this->m_startTime = p_dsAction.m_startTime; - this->m_duration = p_dsAction.m_duration; - this->m_loopCount = p_dsAction.m_loopCount; - this->m_location = p_dsAction.m_location; - this->m_direction = p_dsAction.m_direction; - this->m_up = p_dsAction.m_up; + m_objectId = p_dsAction.m_objectId; + m_flags = p_dsAction.m_flags; + m_startTime = p_dsAction.m_startTime; + m_duration = p_dsAction.m_duration; + m_loopCount = p_dsAction.m_loopCount; + m_location = p_dsAction.m_location; + m_direction = p_dsAction.m_direction; + m_up = p_dsAction.m_up; AppendExtra(p_dsAction.m_extraLength, p_dsAction.m_extraData); - this->m_unk0x84 = p_dsAction.m_unk0x84; - this->m_unk0x88 = p_dsAction.m_unk0x88; - this->m_origin = p_dsAction.m_origin; - this->m_unk0x90 = p_dsAction.m_unk0x90; + m_unk0x84 = p_dsAction.m_unk0x84; + m_unk0x88 = p_dsAction.m_unk0x88; + m_origin = p_dsAction.m_origin; + m_unk0x90 = p_dsAction.m_unk0x90; +} + +// FUNCTION: BETA10 0x1012b2b3 +MxDSAction::MxDSAction(MxDSAction& p_dsAction) : MxDSObject(p_dsAction) +{ + CopyFrom(p_dsAction); } // FUNCTION: LEGO1 0x100adbd0 +// FUNCTION: BETA10 0x1012b355 undefined4 MxDSAction::VTable0x14() { return MxDSObject::VTable0x14(); } // FUNCTION: LEGO1 0x100adbe0 +// FUNCTION: BETA10 0x1012b373 MxU32 MxDSAction::GetSizeOnDisk() { - MxU32 totalSizeOnDisk; + MxU32 size = MxDSObject::GetSizeOnDisk(); + size += sizeof(m_flags); + size += sizeof(m_startTime); + size += sizeof(m_duration); + size += sizeof(m_loopCount); + size += sizeof(double) * 3; // m_location + size += sizeof(double) * 3; // m_direction + size += sizeof(double) * 3; // m_up + size += sizeof(m_extraLength); + size += m_extraLength; - totalSizeOnDisk = MxDSObject::GetSizeOnDisk() + 90 + this->m_extraLength; - this->m_sizeOnDisk = totalSizeOnDisk - MxDSObject::GetSizeOnDisk(); + m_sizeOnDisk = size - MxDSObject::GetSizeOnDisk(); - return totalSizeOnDisk; + return size; } // FUNCTION: LEGO1 0x100adc10 +// FUNCTION: BETA10 0x1012b3d9 MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction) { if (this == &p_dsAction) { @@ -111,11 +137,12 @@ MxDSAction& MxDSAction::operator=(MxDSAction& p_dsAction) } MxDSObject::operator=(p_dsAction); - this->CopyFrom(p_dsAction); + CopyFrom(p_dsAction); return *this; } // FUNCTION: LEGO1 0x100adc40 +// FUNCTION: BETA10 0x1012b420 MxDSAction* MxDSAction::Clone() { MxDSAction* clone = new MxDSAction(); @@ -128,54 +155,56 @@ MxDSAction* MxDSAction::Clone() } // FUNCTION: LEGO1 0x100adcd0 +// FUNCTION: BETA10 0x1012b4ca MxLong MxDSAction::GetElapsedTime() { - return Timer()->GetTime() - this->m_unk0x90; + return Timer()->GetTime() - m_unk0x90; } // FUNCTION: LEGO1 0x100add00 +// FUNCTION: BETA10 0x1012b4f5 void MxDSAction::MergeFrom(MxDSAction& p_dsAction) { - if (p_dsAction.m_startTime != INT_MIN) { - this->m_startTime = p_dsAction.m_startTime; + if (p_dsAction.GetStartTime() != INT_MIN) { + m_startTime = p_dsAction.GetStartTime(); } if (p_dsAction.GetDuration() != INT_MIN) { - this->m_duration = p_dsAction.GetDuration(); + m_duration = p_dsAction.GetDuration(); } - if (p_dsAction.m_loopCount != -1) { - this->m_loopCount = p_dsAction.m_loopCount; + if (p_dsAction.GetLoopCount() != -1) { + m_loopCount = p_dsAction.GetLoopCount(); } - if (p_dsAction.m_location[0] != FLT_MAX) { - this->m_location[0] = p_dsAction.m_location[0]; + if (p_dsAction.GetLocation()[0] != FLT_MAX) { + m_location[0] = p_dsAction.GetLocation()[0]; } - if (p_dsAction.m_location[1] != FLT_MAX) { - this->m_location[1] = p_dsAction.m_location[1]; + if (p_dsAction.GetLocation()[1] != FLT_MAX) { + m_location[1] = p_dsAction.GetLocation()[1]; } - if (p_dsAction.m_location[2] != FLT_MAX) { - this->m_location[2] = p_dsAction.m_location[2]; + if (p_dsAction.GetLocation()[2] != FLT_MAX) { + m_location[2] = p_dsAction.GetLocation()[2]; } - if (p_dsAction.m_direction[0] != FLT_MAX) { - this->m_direction[0] = p_dsAction.m_direction[0]; + if (p_dsAction.GetDirection()[0] != FLT_MAX) { + m_direction[0] = p_dsAction.GetDirection()[0]; } - if (p_dsAction.m_direction[1] != FLT_MAX) { - this->m_direction[1] = p_dsAction.m_direction[1]; + if (p_dsAction.GetDirection()[1] != FLT_MAX) { + m_direction[1] = p_dsAction.GetDirection()[1]; } - if (p_dsAction.m_direction[2] != FLT_MAX) { - this->m_direction[2] = p_dsAction.m_up[2]; // This is correct + if (p_dsAction.GetDirection()[2] != FLT_MAX) { + m_direction[2] = p_dsAction.GetUp()[2]; // This is correct } - if (p_dsAction.m_up[0] != FLT_MAX) { - this->m_up[0] = p_dsAction.m_up[0]; + if (p_dsAction.GetUp()[0] != FLT_MAX) { + m_up[0] = p_dsAction.GetUp()[0]; } - if (p_dsAction.m_up[1] != FLT_MAX) { - this->m_up[1] = p_dsAction.m_up[1]; + if (p_dsAction.GetUp()[1] != FLT_MAX) { + m_up[1] = p_dsAction.GetUp()[1]; } - if (p_dsAction.m_up[2] != FLT_MAX) { - this->m_up[2] = p_dsAction.m_up[2]; + if (p_dsAction.GetUp()[2] != FLT_MAX) { + m_up[2] = p_dsAction.GetUp()[2]; } MxU16 extraLength; @@ -183,64 +212,71 @@ void MxDSAction::MergeFrom(MxDSAction& p_dsAction) p_dsAction.GetExtra(extraLength, extraData); if (extraLength && extraData) { - if (!this->m_extraData || !strncmp("XXX", this->m_extraData, 3)) { - delete[] this->m_extraData; - this->m_extraLength = 0; + if (!m_extraData || !strncmp("XXX", m_extraData, 3)) { + delete[] m_extraData; + m_extraLength = 0; AppendExtra(extraLength, extraData); } } } // FUNCTION: LEGO1 0x100ade60 +// FUNCTION: BETA10 0x1012b8a9 void MxDSAction::AppendExtra(MxU16 p_extraLength, const char* p_extraData) { - if (this->m_extraData == p_extraData || !p_extraData) { + if (m_extraData == p_extraData) { return; } - if (this->m_extraLength) { - char* concat = new char[p_extraLength + this->m_extraLength + sizeof(g_sep)]; - memcpy(concat, this->m_extraData, this->m_extraLength); + if (p_extraData) { + if (m_extraLength) { + char* newExtra = new char[p_extraLength + m_extraLength + sizeof(g_sep)]; + assert(newExtra); + memcpy(newExtra, m_extraData, m_extraLength); + memcpy(&newExtra[m_extraLength], &g_sep, sizeof(g_sep)); + memcpy(&newExtra[m_extraLength + sizeof(g_sep)], p_extraData, p_extraLength); - *(MxU16*) &concat[this->m_extraLength] = g_sep; - memcpy(&concat[this->m_extraLength + sizeof(g_sep)], p_extraData, p_extraLength); + m_extraLength += p_extraLength + sizeof(g_sep); + delete[] m_extraData; + m_extraData = newExtra; + } + else { + m_extraData = new char[p_extraLength]; - this->m_extraLength += p_extraLength + sizeof(g_sep); - delete[] this->m_extraData; - this->m_extraData = concat; - } - else { - char* copy = new char[p_extraLength]; - this->m_extraData = copy; - - if (copy) { - this->m_extraLength = p_extraLength; - memcpy(copy, p_extraData, p_extraLength); + if (m_extraData) { + m_extraLength = p_extraLength; + memcpy(m_extraData, p_extraData, p_extraLength); + } + else { + assert(0); + } } } } // FUNCTION: LEGO1 0x100adf70 +// FUNCTION: BETA10 0x1012ba6a void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) { MxDSObject::Deserialize(p_source, p_unk0x24); - GetScalar(p_source, this->m_flags); - GetScalar(p_source, this->m_startTime); - GetScalar(p_source, this->m_duration); - GetScalar(p_source, this->m_loopCount); - GetDouble(p_source, this->m_location[0]); - GetDouble(p_source, this->m_location[1]); - GetDouble(p_source, this->m_location[2]); - GetDouble(p_source, this->m_direction[0]); - GetDouble(p_source, this->m_direction[1]); - GetDouble(p_source, this->m_direction[2]); - GetDouble(p_source, this->m_up[0]); - GetDouble(p_source, this->m_up[1]); - GetDouble(p_source, this->m_up[2]); + // clang-format off + m_flags = *( MxU32*) p_source; p_source += sizeof(m_flags); + m_startTime = *(MxLong*) p_source; p_source += sizeof(m_startTime); + m_duration = *(MxLong*) p_source; p_source += sizeof(m_duration); + m_loopCount = *( MxS32*) p_source; p_source += sizeof(m_loopCount); + m_location[0] = *(double*) p_source; p_source += sizeof(double); + m_location[1] = *(double*) p_source; p_source += sizeof(double); + m_location[2] = *(double*) p_source; p_source += sizeof(double); + m_direction[0] = *(double*) p_source; p_source += sizeof(double); + m_direction[1] = *(double*) p_source; p_source += sizeof(double); + m_direction[2] = *(double*) p_source; p_source += sizeof(double); + m_up[0] = *(double*) p_source; p_source += sizeof(double); + m_up[1] = *(double*) p_source; p_source += sizeof(double); + m_up[2] = *(double*) p_source; p_source += sizeof(double); - MxU16 extraLength = *(MxU16*) p_source; - p_source += 2; + MxU16 extraLength = *( MxU16*) p_source; p_source += sizeof(extraLength); + // clang-format on if (extraLength) { AppendExtra(extraLength, (char*) p_source); diff --git a/LEGO1/omni/src/action/mxdsanim.cpp b/LEGO1/omni/src/action/mxdsanim.cpp index c90933b1..fd15ce70 100644 --- a/LEGO1/omni/src/action/mxdsanim.cpp +++ b/LEGO1/omni/src/action/mxdsanim.cpp @@ -3,6 +3,7 @@ DECOMP_SIZE_ASSERT(MxDSAnim, 0xb8) // FUNCTION: LEGO1 0x100c8ff0 +// FUNCTION: BETA10 0x1015cd71 MxDSAnim::MxDSAnim() { this->SetType(e_anim); diff --git a/LEGO1/omni/src/action/mxdsevent.cpp b/LEGO1/omni/src/action/mxdsevent.cpp index 64702e65..fbbc2bdb 100644 --- a/LEGO1/omni/src/action/mxdsevent.cpp +++ b/LEGO1/omni/src/action/mxdsevent.cpp @@ -3,6 +3,7 @@ DECOMP_SIZE_ASSERT(MxDSEvent, 0xb8) // FUNCTION: LEGO1 0x100c95f0 +// FUNCTION: BETA10 0x1015d2e5 MxDSEvent::MxDSEvent() { this->SetType(e_event); diff --git a/LEGO1/omni/src/action/mxdsmediaaction.cpp b/LEGO1/omni/src/action/mxdsmediaaction.cpp index 9da0946a..9ae76166 100644 --- a/LEGO1/omni/src/action/mxdsmediaaction.cpp +++ b/LEGO1/omni/src/action/mxdsmediaaction.cpp @@ -5,38 +5,48 @@ DECOMP_SIZE_ASSERT(MxDSMediaAction, 0xb8) // FUNCTION: LEGO1 0x100c8b40 +// FUNCTION: BETA10 0x1015c760 MxDSMediaAction::MxDSMediaAction() { - this->m_mediaSrcPath = NULL; - this->m_unk0x9c.m_unk0x00 = 0; - this->m_unk0x9c.m_unk0x04 = 0; - this->m_framesPerSecond = 0; - this->m_mediaFormat = 0; - this->m_paletteManagement = 1; - this->m_unk0xb4 = -1; - this->m_sustainTime = 0; - this->SetType(e_mediaAction); + m_type = e_mediaAction; + m_mediaSrcPath = NULL; + m_unk0x9c.SetUnk0x00(0); + m_unk0x9c.SetUnk0x04(0); + m_framesPerSecond = 0; + m_mediaFormat = 0; + m_unk0xb4 = -1; + m_paletteManagement = 1; + m_sustainTime = 0; } // FUNCTION: LEGO1 0x100c8cf0 +// FUNCTION: BETA10 0x1015c846 MxDSMediaAction::~MxDSMediaAction() { - delete[] this->m_mediaSrcPath; + delete[] m_mediaSrcPath; } // FUNCTION: LEGO1 0x100c8d60 +// FUNCTION: BETA10 0x1015c8cc void MxDSMediaAction::CopyFrom(MxDSMediaAction& p_dsMediaAction) { CopyMediaSrcPath(p_dsMediaAction.m_mediaSrcPath); - this->m_unk0x9c = p_dsMediaAction.m_unk0x9c; - this->m_framesPerSecond = p_dsMediaAction.m_framesPerSecond; - this->m_mediaFormat = p_dsMediaAction.m_mediaFormat; - this->m_paletteManagement = p_dsMediaAction.m_paletteManagement; - this->m_sustainTime = p_dsMediaAction.m_sustainTime; + m_unk0x9c = p_dsMediaAction.m_unk0x9c; + m_framesPerSecond = p_dsMediaAction.m_framesPerSecond; + m_mediaFormat = p_dsMediaAction.m_mediaFormat; + m_paletteManagement = p_dsMediaAction.m_paletteManagement; + m_sustainTime = p_dsMediaAction.m_sustainTime; +} + +// FUNCTION: BETA10 0x1015c959 +MxDSMediaAction::MxDSMediaAction(MxDSMediaAction& p_dsMediaAction) : MxDSAction(p_dsMediaAction) +{ + CopyFrom(p_dsMediaAction); } // FUNCTION: LEGO1 0x100c8dc0 +// FUNCTION: BETA10 0x1015c9da MxDSMediaAction& MxDSMediaAction::operator=(MxDSMediaAction& p_dsMediaAction) { if (this == &p_dsMediaAction) { @@ -44,11 +54,12 @@ MxDSMediaAction& MxDSMediaAction::operator=(MxDSMediaAction& p_dsMediaAction) } MxDSAction::operator=(p_dsMediaAction); - this->CopyFrom(p_dsMediaAction); + CopyFrom(p_dsMediaAction); return *this; } // FUNCTION: LEGO1 0x100c8df0 +// FUNCTION: BETA10 0x1015ca21 MxDSAction* MxDSMediaAction::Clone() { MxDSMediaAction* clone = new MxDSMediaAction(); @@ -61,58 +72,73 @@ MxDSAction* MxDSMediaAction::Clone() } // FUNCTION: LEGO1 0x100c8e80 +// FUNCTION: BETA10 0x1015cacb void MxDSMediaAction::CopyMediaSrcPath(const char* p_mediaSrcPath) { - if (this->m_mediaSrcPath == p_mediaSrcPath) { + if (m_mediaSrcPath == p_mediaSrcPath) { return; } - delete[] this->m_mediaSrcPath; + delete[] m_mediaSrcPath; if (p_mediaSrcPath) { - this->m_mediaSrcPath = new char[strlen(p_mediaSrcPath) + 1]; - if (this->m_mediaSrcPath) { - strcpy(this->m_mediaSrcPath, p_mediaSrcPath); + m_mediaSrcPath = new char[strlen(p_mediaSrcPath) + 1]; + if (m_mediaSrcPath) { + strcpy(m_mediaSrcPath, p_mediaSrcPath); } } else { - this->m_mediaSrcPath = NULL; + m_mediaSrcPath = NULL; } } // FUNCTION: LEGO1 0x100c8f00 +// FUNCTION: BETA10 0x1015cbf5 undefined4 MxDSMediaAction::VTable0x14() { return MxDSAction::VTable0x14(); } // FUNCTION: LEGO1 0x100c8f10 +// FUNCTION: BETA10 0x1015cc13 MxU32 MxDSMediaAction::GetSizeOnDisk() { MxU32 totalSizeOnDisk = MxDSAction::GetSizeOnDisk(); - if (this->m_mediaSrcPath) { - totalSizeOnDisk += strlen(this->m_mediaSrcPath) + 1; + if (m_mediaSrcPath) { + totalSizeOnDisk += strlen(m_mediaSrcPath) + 1; } else { totalSizeOnDisk++; } - totalSizeOnDisk += 24; - this->m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk(); + totalSizeOnDisk += sizeof(m_unk0x9c.m_unk0x00); + totalSizeOnDisk += sizeof(m_unk0x9c.m_unk0x04); + totalSizeOnDisk += sizeof(m_framesPerSecond); + totalSizeOnDisk += sizeof(m_mediaFormat); + totalSizeOnDisk += sizeof(m_paletteManagement); + totalSizeOnDisk += sizeof(m_sustainTime); + + m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk(); return totalSizeOnDisk; } // FUNCTION: LEGO1 0x100c8f60 +// FUNCTION: BETA10 0x1015cc93 void MxDSMediaAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) { MxDSAction::Deserialize(p_source, p_unk0x24); - GetString(p_source, this->m_mediaSrcPath, this, &MxDSMediaAction::CopyMediaSrcPath); - GetScalar(p_source, this->m_unk0x9c.m_unk0x00); - GetScalar(p_source, this->m_unk0x9c.m_unk0x04); - GetScalar(p_source, this->m_framesPerSecond); - GetScalar(p_source, this->m_mediaFormat); - GetScalar(p_source, this->m_paletteManagement); - GetScalar(p_source, this->m_sustainTime); + CopyMediaSrcPath((char*) p_source); + p_source += strlen(m_mediaSrcPath) + 1; + + // clang-format off + m_unk0x9c.SetUnk0x00(*(MxU32*) p_source); p_source += sizeof(m_unk0x9c.m_unk0x00); + m_unk0x9c.SetUnk0x04(*(MxU32*) p_source); p_source += sizeof(m_unk0x9c.m_unk0x04); + + m_framesPerSecond = *(MxS32*) p_source; p_source += sizeof(m_framesPerSecond); + m_mediaFormat = *(MxS32*) p_source; p_source += sizeof(m_mediaFormat); + m_paletteManagement = *(MxS32*) p_source; p_source += sizeof(m_paletteManagement); + m_sustainTime = *(MxS32*) p_source; p_source += sizeof(m_sustainTime); + // clang-format on } diff --git a/LEGO1/omni/src/action/mxdsmultiaction.cpp b/LEGO1/omni/src/action/mxdsmultiaction.cpp index d18c75de..edf01c1d 100644 --- a/LEGO1/omni/src/action/mxdsmultiaction.cpp +++ b/LEGO1/omni/src/action/mxdsmultiaction.cpp @@ -5,6 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSActionList, 0x1c); DECOMP_SIZE_ASSERT(MxDSActionListCursor, 0x10); // FUNCTION: LEGO1 0x100c9b90 +// FUNCTION: BETA10 0x10159410 MxDSMultiAction::MxDSMultiAction() { this->SetType(e_multiAction); diff --git a/LEGO1/omni/src/action/mxdsobject.cpp b/LEGO1/omni/src/action/mxdsobject.cpp index e99a12d4..ae266fe0 100644 --- a/LEGO1/omni/src/action/mxdsobject.cpp +++ b/LEGO1/omni/src/action/mxdsobject.cpp @@ -19,18 +19,20 @@ DECOMP_SIZE_ASSERT(MxDSObject, 0x2c); // FUNCTION: LEGO1 0x100bf6a0 +// FUNCTION: BETA10 0x101478c0 MxDSObject::MxDSObject() { - this->SetType(e_object); - this->m_sourceName = NULL; - this->m_unk0x14 = 0; - this->m_objectName = NULL; - this->m_unk0x24 = -1; - this->m_objectId = -1; - this->m_unk0x28 = 0; + m_type = e_object; + m_sourceName = NULL; + m_unk0x14 = 0; + m_objectName = NULL; + m_objectId = -1; + m_unk0x24 = -1; + m_unk0x28 = NULL; } // FUNCTION: LEGO1 0x100bf7e0 +// FUNCTION: BETA10 0x1014798e MxDSObject::~MxDSObject() { delete[] m_objectName; @@ -38,120 +40,147 @@ MxDSObject::~MxDSObject() } // FUNCTION: LEGO1 0x100bf870 +// FUNCTION: BETA10 0x10147a45 void MxDSObject::CopyFrom(MxDSObject& p_dsObject) { - this->SetSourceName(p_dsObject.m_sourceName); - this->m_unk0x14 = p_dsObject.m_unk0x14; - this->SetObjectName(p_dsObject.m_objectName); - this->m_objectId = p_dsObject.m_objectId; - this->m_unk0x24 = p_dsObject.m_unk0x24; - this->m_atomId = p_dsObject.m_atomId; - this->m_unk0x28 = p_dsObject.m_unk0x28; + SetSourceName(p_dsObject.m_sourceName); + m_unk0x14 = p_dsObject.m_unk0x14; + SetObjectName(p_dsObject.m_objectName); + m_objectId = p_dsObject.m_objectId; + m_unk0x24 = p_dsObject.m_unk0x24; + m_atomId = p_dsObject.m_atomId; + m_unk0x28 = p_dsObject.m_unk0x28; +} + +// FUNCTION: BETA10 0x10147abf +MxDSObject::MxDSObject(MxDSObject& p_dsObject) +{ + CopyFrom(p_dsObject); } // FUNCTION: LEGO1 0x100bf8c0 +// FUNCTION: BETA10 0x10147b57 MxDSObject& MxDSObject::operator=(MxDSObject& p_dsObject) { if (this == &p_dsObject) { return *this; } - this->CopyFrom(p_dsObject); + CopyFrom(p_dsObject); return *this; } // FUNCTION: LEGO1 0x100bf8e0 +// FUNCTION: BETA10 0x10147b92 void MxDSObject::SetObjectName(const char* p_objectName) { - if (p_objectName != this->m_objectName) { - delete[] this->m_objectName; + if (p_objectName == m_objectName) { + return; + } - if (p_objectName) { - this->m_objectName = new char[strlen(p_objectName) + 1]; + delete[] m_objectName; - if (this->m_objectName) { - strcpy(this->m_objectName, p_objectName); - } - } - else { - this->m_objectName = NULL; + if (p_objectName) { + m_objectName = new char[strlen(p_objectName) + 1]; + + if (m_objectName) { + strcpy(m_objectName, p_objectName); } } + else { + m_objectName = NULL; + } } // FUNCTION: LEGO1 0x100bf950 +// FUNCTION: BETA10 0x10147c2e void MxDSObject::SetSourceName(const char* p_sourceName) { - if (p_sourceName != this->m_sourceName) { - delete[] this->m_sourceName; + if (p_sourceName == m_sourceName) { + return; + } - if (p_sourceName) { - this->m_sourceName = new char[strlen(p_sourceName) + 1]; + delete[] m_sourceName; - if (this->m_sourceName) { - strcpy(this->m_sourceName, p_sourceName); - } - } - else { - this->m_sourceName = NULL; + if (p_sourceName) { + m_sourceName = new char[strlen(p_sourceName) + 1]; + + if (m_sourceName) { + strcpy(m_sourceName, p_sourceName); } } + else { + m_sourceName = NULL; + } } // FUNCTION: LEGO1 0x100bf9c0 +// FUNCTION: BETA10 0x10147cca undefined4 MxDSObject::VTable0x14() { + // DECOMP: Rendered as 8 + 2 in beta. Maybe a sizeof() call? return 10; } // FUNCTION: LEGO1 0x100bf9d0 +// FUNCTION: BETA10 0x10147cee MxU32 MxDSObject::GetSizeOnDisk() { - MxU32 sizeOnDisk; + MxU32 sizeOnDisk = 0; - if (this->m_sourceName) { - sizeOnDisk = strlen(this->m_sourceName) + 3; - } - else { - sizeOnDisk = 3; - } + sizeOnDisk += 2; - sizeOnDisk += 4; - - if (this->m_objectName) { - sizeOnDisk += strlen(this->m_objectName) + 1; + if (m_sourceName) { + sizeOnDisk += strlen(m_sourceName) + 1; } else { sizeOnDisk++; } - sizeOnDisk += 4; - this->m_sizeOnDisk = sizeOnDisk; + sizeOnDisk += sizeof(m_unk0x14); + + if (m_objectName) { + sizeOnDisk += strlen(m_objectName) + 1; + } + else { + sizeOnDisk++; + } + + sizeOnDisk += sizeof(m_objectId); + + m_sizeOnDisk = sizeOnDisk; return sizeOnDisk; } // FUNCTION: LEGO1 0x100bfa20 +// FUNCTION: BETA10 0x10147d73 void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) { - GetString(p_source, this->m_sourceName, this, &MxDSObject::SetSourceName); - GetScalar(p_source, this->m_unk0x14); - GetString(p_source, this->m_objectName, this, &MxDSObject::SetObjectName); - GetScalar(p_source, this->m_objectId); + SetSourceName((char*) p_source); + p_source += strlen(m_sourceName) + 1; - this->m_unk0x24 = p_unk0x24; + m_unk0x14 = *(undefined4*) p_source; + p_source += sizeof(m_unk0x14); + + SetObjectName((char*) p_source); + p_source += strlen(m_objectName) + 1; + + m_objectId = *(MxU32*) p_source; + p_source += sizeof(m_objectId); + + m_unk0x24 = p_unk0x24; } // FUNCTION: LEGO1 0x100bfb30 +// FUNCTION: BETA10 0x10147f35 MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) { + MxDSObject* obj = NULL; + MxU16 type = *(MxU16*) p_source; p_source += 2; - MxDSObject* obj = NULL; - switch (type) { - default: - return NULL; case MxDSObject::e_object: obj = new MxDSObject(); break; @@ -167,6 +196,15 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) case MxDSObject::e_sound: obj = new MxDSSound(); break; + case MxDSObject::e_event: + obj = new MxDSEvent(); + break; + case MxDSObject::e_still: + obj = new MxDSStill(); + break; + case MxDSObject::e_objectAction: + obj = new MxDSObjectAction(); + break; case MxDSObject::e_multiAction: obj = new MxDSMultiAction(); break; @@ -176,18 +214,11 @@ MxDSObject* DeserializeDSObjectDispatch(MxU8*& p_source, MxS16 p_flags) case MxDSObject::e_parallelAction: obj = new MxDSParallelAction(); break; - case MxDSObject::e_event: - obj = new MxDSEvent(); - break; case MxDSObject::e_selectAction: obj = new MxDSSelectAction(); break; - case MxDSObject::e_still: - obj = new MxDSStill(); - break; - case MxDSObject::e_objectAction: - obj = new MxDSObjectAction(); - break; + default: + return NULL; } if (obj) { diff --git a/LEGO1/omni/src/action/mxdsobjectaction.cpp b/LEGO1/omni/src/action/mxdsobjectaction.cpp index 40eadec3..dbfcce10 100644 --- a/LEGO1/omni/src/action/mxdsobjectaction.cpp +++ b/LEGO1/omni/src/action/mxdsobjectaction.cpp @@ -3,6 +3,7 @@ DECOMP_SIZE_ASSERT(MxDSObjectAction, 0xb8) // FUNCTION: LEGO1 0x100c8870 +// FUNCTION: BETA10 0x1015c3b0 MxDSObjectAction::MxDSObjectAction() { this->SetType(e_objectAction); diff --git a/LEGO1/omni/src/action/mxdsparallelaction.cpp b/LEGO1/omni/src/action/mxdsparallelaction.cpp index f4e61245..4ea4f6ea 100644 --- a/LEGO1/omni/src/action/mxdsparallelaction.cpp +++ b/LEGO1/omni/src/action/mxdsparallelaction.cpp @@ -5,6 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSParallelAction, 0x9c) // FUNCTION: LEGO1 0x100cae80 +// FUNCTION: BETA10 0x1015a14d MxDSParallelAction::MxDSParallelAction() { this->SetType(e_parallelAction); diff --git a/LEGO1/omni/src/action/mxdsselectaction.cpp b/LEGO1/omni/src/action/mxdsselectaction.cpp index 79fec8a0..0aa5f053 100644 --- a/LEGO1/omni/src/action/mxdsselectaction.cpp +++ b/LEGO1/omni/src/action/mxdsselectaction.cpp @@ -10,6 +10,7 @@ DECOMP_SIZE_ASSERT(MxStringListCursor, 0x10) DECOMP_SIZE_ASSERT(MxListEntry, 0x18) // FUNCTION: LEGO1 0x100cb2b0 +// FUNCTION: BETA10 0x1015a515 MxDSSelectAction::MxDSSelectAction() { this->SetType(e_selectAction); diff --git a/LEGO1/omni/src/action/mxdsserialaction.cpp b/LEGO1/omni/src/action/mxdsserialaction.cpp index b03efdf0..d258dee8 100644 --- a/LEGO1/omni/src/action/mxdsserialaction.cpp +++ b/LEGO1/omni/src/action/mxdsserialaction.cpp @@ -5,6 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSSerialAction, 0xa8) // FUNCTION: LEGO1 0x100ca9d0 +// FUNCTION: BETA10 0x10159cf3 MxDSSerialAction::MxDSSerialAction() { this->SetType(e_serialAction); diff --git a/LEGO1/omni/src/action/mxdssound.cpp b/LEGO1/omni/src/action/mxdssound.cpp index 2340ea96..7dc8d69a 100644 --- a/LEGO1/omni/src/action/mxdssound.cpp +++ b/LEGO1/omni/src/action/mxdssound.cpp @@ -5,6 +5,7 @@ DECOMP_SIZE_ASSERT(MxDSSound, 0xc0) // FUNCTION: LEGO1 0x100c92c0 +// FUNCTION: BETA10 0x1015cfdb MxDSSound::MxDSSound() { this->m_volume = 0x4f; diff --git a/LEGO1/omni/src/action/mxdsstill.cpp b/LEGO1/omni/src/action/mxdsstill.cpp index c044a2e6..7e6df18b 100644 --- a/LEGO1/omni/src/action/mxdsstill.cpp +++ b/LEGO1/omni/src/action/mxdsstill.cpp @@ -3,6 +3,7 @@ DECOMP_SIZE_ASSERT(MxDSStill, 0xb8) // FUNCTION: LEGO1 0x100c98c0 +// FUNCTION: BETA10 0x1015d54f MxDSStill::MxDSStill() { this->SetType(e_still); diff --git a/LEGO1/omni/src/audio/mxmidipresenter.cpp b/LEGO1/omni/src/audio/mxmidipresenter.cpp index 205b760d..d3c990c5 100644 --- a/LEGO1/omni/src/audio/mxmidipresenter.cpp +++ b/LEGO1/omni/src/audio/mxmidipresenter.cpp @@ -3,6 +3,7 @@ #include "decomp.h" #include "mxautolock.h" #include "mxdssound.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxmusicmanager.h" diff --git a/LEGO1/omni/src/audio/mxmusicmanager.cpp b/LEGO1/omni/src/audio/mxmusicmanager.cpp index 59c8f841..fa8bdcbe 100644 --- a/LEGO1/omni/src/audio/mxmusicmanager.cpp +++ b/LEGO1/omni/src/audio/mxmusicmanager.cpp @@ -1,6 +1,7 @@ #include "mxmusicmanager.h" #include "mxmisc.h" +#include "mxthread.h" #include "mxticklemanager.h" #include diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index 583d1dfc..33dd2bad 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -1,9 +1,11 @@ #include "mxsoundmanager.h" #include "mxautolock.h" +#include "mxdsaction.h" #include "mxmisc.h" #include "mxomni.h" #include "mxpresenter.h" +#include "mxthread.h" #include "mxticklemanager.h" #include "mxwavepresenter.h" diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index defb20f6..de113a7a 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -4,6 +4,7 @@ #include "define.h" #include "mxautolock.h" #include "mxdssound.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxomni.h" #include "mxsoundmanager.h" diff --git a/LEGO1/omni/src/common/mxcompositepresenter.cpp b/LEGO1/omni/src/common/mxcompositepresenter.cpp index 7a5262b9..a88279ac 100644 --- a/LEGO1/omni/src/common/mxcompositepresenter.cpp +++ b/LEGO1/omni/src/common/mxcompositepresenter.cpp @@ -1,6 +1,7 @@ #include "mxcompositepresenter.h" #include "decomp.h" +#include "mxactionnotificationparam.h" #include "mxautolock.h" #include "mxdsmultiaction.h" #include "mxmisc.h" diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index b735550b..4a322b33 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -3,6 +3,7 @@ #include "mxactionnotificationparam.h" #include "mxautolock.h" #include "mxcompositepresenter.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstreamchunk.h" diff --git a/LEGO1/omni/src/event/mxeventpresenter.cpp b/LEGO1/omni/src/event/mxeventpresenter.cpp index 70a3c6af..05c94de0 100644 --- a/LEGO1/omni/src/event/mxeventpresenter.cpp +++ b/LEGO1/omni/src/event/mxeventpresenter.cpp @@ -2,6 +2,8 @@ #include "decomp.h" #include "mxautolock.h" +#include "mxdsaction.h" +#include "mxdssubscriber.h" #include "mxeventmanager.h" #include "mxmisc.h" #include "mxvariabletable.h" diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index 099b41cc..c6c83733 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -15,6 +15,7 @@ #include "mxstreamer.h" #include "mxticklemanager.h" #include "mxtimer.h" +#include "mxvariabletable.h" #include "mxvideomanager.h" // GLOBAL: LEGO1 0x101015b8 diff --git a/LEGO1/omni/src/main/mxomnicreateflags.cpp b/LEGO1/omni/src/main/mxomnicreateflags.cpp index 19a87055..916c7bcd 100644 --- a/LEGO1/omni/src/main/mxomnicreateflags.cpp +++ b/LEGO1/omni/src/main/mxomnicreateflags.cpp @@ -1,5 +1,9 @@ #include "mxomnicreateflags.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxOmniCreateFlags, 0x02) + // FUNCTION: LEGO1 0x100b0a30 // FUNCTION: BETA10 0x10130a1c MxOmniCreateFlags::MxOmniCreateFlags() diff --git a/LEGO1/omni/src/main/mxomnicreateparam.cpp b/LEGO1/omni/src/main/mxomnicreateparam.cpp index 2393ea05..7f84fbc1 100644 --- a/LEGO1/omni/src/main/mxomnicreateparam.cpp +++ b/LEGO1/omni/src/main/mxomnicreateparam.cpp @@ -1,5 +1,9 @@ #include "mxomnicreateparam.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxOmniCreateParam, 0x40) + // FUNCTION: LEGO1 0x100b0b00 // FUNCTION: BETA10 0x10130b6b MxOmniCreateParam::MxOmniCreateParam( diff --git a/LEGO1/omni/src/notify/mxnotificationmanager.cpp b/LEGO1/omni/src/notify/mxnotificationmanager.cpp index 48c478cd..f9c00c3c 100644 --- a/LEGO1/omni/src/notify/mxnotificationmanager.cpp +++ b/LEGO1/omni/src/notify/mxnotificationmanager.cpp @@ -4,6 +4,7 @@ #include "decomp.h" #include "mxautolock.h" #include "mxmisc.h" +#include "mxnotificationparam.h" #include "mxparam.h" #include "mxticklemanager.h" #include "mxtypes.h" diff --git a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp index d316912d..d6b73a9b 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp @@ -3,6 +3,7 @@ #include "mxautolock.h" #include "mxdiskstreamcontroller.h" #include "mxdsbuffer.h" +#include "mxdsfile.h" #include "mxdsstreamingaction.h" #include "mxomni.h" #include "mxramstreamprovider.h" diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index bc40f71c..450673f7 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -8,6 +8,7 @@ #include "mxstreamchunk.h" #include "mxstreamcontroller.h" #include "mxstreamer.h" +#include "mxstreamprovider.h" DECOMP_SIZE_ASSERT(MxDSBuffer, 0x34); diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index d0915810..ec06f90b 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -2,6 +2,7 @@ #include "decomp.h" #include "mxdsbuffer.h" +#include "mxdsfile.h" #include "mxomni.h" #include "mxstreamcontroller.h" diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index a94cd974..4b76abf2 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -7,6 +7,7 @@ #include "mxnextactiondatastart.h" #include "mxstl/stlcompat.h" #include "mxstreamchunk.h" +#include "mxstreamprovider.h" #include "mxtimer.h" #include "mxutilities.h" diff --git a/LEGO1/omni/src/system/mxautolock.cpp b/LEGO1/omni/src/system/mxautolock.cpp index 56a5a977..a67c382c 100644 --- a/LEGO1/omni/src/system/mxautolock.cpp +++ b/LEGO1/omni/src/system/mxautolock.cpp @@ -1,5 +1,7 @@ #include "mxautolock.h" +#include "mxcriticalsection.h" + // FUNCTION: LEGO1 0x100b8ed0 MxAutoLock::MxAutoLock(MxCriticalSection* p_criticalSection) { diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index 5cbbe8ee..29733d5f 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -1,6 +1,7 @@ #include "mxbitmap.h" #include "decomp.h" +#include "mxpalette.h" #include "mxutilities.h" DECOMP_SIZE_ASSERT(MxBitmap, 0x20); diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index e9a61549..6f3fbe0e 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -1,7 +1,9 @@ #include "mxdisplaysurface.h" +#include "mxbitmap.h" #include "mxmisc.h" #include "mxomni.h" +#include "mxpalette.h" #include "mxutilities.h" #include "mxvideomanager.h" diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index 31279ca3..b8d98dfb 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -1,6 +1,8 @@ #include "mxloopingflcpresenter.h" #include "decomp.h" +#include "mxdsaction.h" +#include "mxdssubscriber.h" DECOMP_SIZE_ASSERT(MxLoopingFlcPresenter, 0x6c); diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index 384e645b..499fb075 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -2,6 +2,7 @@ #include "mxautolock.h" #include "mxdsmediaaction.h" +#include "mxdssubscriber.h" DECOMP_SIZE_ASSERT(MxLoopingSmkPresenter, 0x724); diff --git a/LEGO1/omni/src/video/mxsmack.cpp b/LEGO1/omni/src/video/mxsmack.cpp index 8d1835fe..fd08e8a9 100644 --- a/LEGO1/omni/src/video/mxsmack.cpp +++ b/LEGO1/omni/src/video/mxsmack.cpp @@ -1,5 +1,7 @@ #include "mxsmack.h" +#include "mxbitmap.h" + #include DECOMP_SIZE_ASSERT(SmackTag, 0x390); diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index a507eb15..1ac6bd1e 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -3,6 +3,7 @@ #include "decomp.h" #include "mxdsmediaaction.h" #include "mxmisc.h" +#include "mxpalette.h" #include "mxvideomanager.h" DECOMP_SIZE_ASSERT(MxSmkPresenter, 0x720); diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index b64f7490..f2c8ba6e 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -3,9 +3,12 @@ #include "decomp.h" #include "define.h" #include "mxcompositepresenter.h" +#include "mxdisplaysurface.h" #include "mxdsmediaaction.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxomni.h" +#include "mxpalette.h" #include "mxutilities.h" #include "mxvideomanager.h" diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 14b99a7e..f3bf04fd 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -1,9 +1,13 @@ #include "mxvideomanager.h" #include "mxautolock.h" +#include "mxdisplaysurface.h" #include "mxmisc.h" #include "mxomni.h" +#include "mxpalette.h" #include "mxpresenter.h" +#include "mxregion.h" +#include "mxthread.h" #include "mxticklemanager.h" DECOMP_SIZE_ASSERT(MxVideoManager, 0x64) diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 71d115d4..02adeb01 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -1,7 +1,9 @@ #include "mxvideopresenter.h" #include "mxautolock.h" +#include "mxdisplaysurface.h" #include "mxdsmediaaction.h" +#include "mxdssubscriber.h" #include "mxmisc.h" #include "mxregioncursor.h" #include "mxvideomanager.h" diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index 1e14db26..82c3166a 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -74,19 +74,19 @@ class Matrix4 { } // vtable+0x2c // FUNCTION: LEGO1 0x10002460 - virtual void TranslateBy(const float* p_x, const float* p_y, const float* p_z) + virtual void TranslateBy(const float& p_x, const float& p_y, const float& p_z) { - m_data[3][0] += *p_x; - m_data[3][1] += *p_y; - m_data[3][2] += *p_z; + m_data[3][0] += p_x; + m_data[3][1] += p_y; + m_data[3][2] += p_z; } // vtable+0x30 // FUNCTION: LEGO1 0x100024a0 - virtual void SetTranslation(const float* p_x, const float* p_y, const float* p_z) + virtual void SetTranslation(const float& p_x, const float& p_y, const float& p_z) { - m_data[3][0] = *p_x; - m_data[3][1] = *p_y; - m_data[3][2] = *p_z; + m_data[3][0] = p_x; + m_data[3][1] = p_y; + m_data[3][2] = p_z; } // vtable+0x34 // FUNCTION: LEGO1 0x100024d0 @@ -151,48 +151,44 @@ class Matrix4 { float (*m_data)[4]; }; -// Not close, Ghidra struggles understinging this method so it will have to -// be manually worked out. Included since I at least figured out what it was -// doing with rotateIndex and what overall operation it's trying to do. -// STUB: LEGO1 0x10002550 +// FUNCTION: LEGO1 0x10002550 inline void Matrix4::ToQuaternion(Vector4& p_outQuat) { - /* - float trace = m_data[0] + m_data[5] + m_data[10]; + float trace = m_data[0][0] + m_data[1][1] + m_data[2][2]; if (trace > 0) { trace = sqrt(trace + 1.0); - p_outQuat->GetData()[3] = trace * 0.5f; - p_outQuat->GetData()[0] = (m_data[9] - m_data[6]) * trace; - p_outQuat->GetData()[1] = (m_data[2] - m_data[8]) * trace; - p_outQuat->GetData()[2] = (m_data[4] - m_data[1]) * trace; - return; + p_outQuat[3] = trace * 0.5f; + trace = 0.5f / trace; + p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace; + p_outQuat[1] = (m_data[0][2] - m_data[2][0]) * trace; + p_outQuat[2] = (m_data[1][0] - m_data[0][1]) * trace; } + else { - // ~GLOBAL: LEGO1 0x100d4090 - static int rotateIndex[] = {1, 2, 0}; + // GLOBAL: LEGO1 0x100d4090 + static int rotateIndex[] = {1, 2, 0}; - // Largest element along the trace - int largest = m_data[0] < m_data[5]; - if (*Element(largest, largest) < m_data[10]) - largest = 2; + // Largest element along the trace + int largest = 0; + if (m_data[0][0] < m_data[1][1]) { + largest = 1; + } + if (*Element(largest, largest) < m_data[2][2]) { + largest = 2; + } - int next = rotateIndex[largest]; - int nextNext = rotateIndex[next]; - float valueA = *Element(nextNext, nextNext); - float valueB = *Element(next, next); - float valueC = *Element(largest, largest); + int next = rotateIndex[largest]; + int nextNext = rotateIndex[next]; - // Above is somewhat decomped, below is pure speculation since the automatic - // decomp becomes very garbled. - float traceValue = sqrt(valueA - valueB - valueC + 1.0); + float trace = sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0); - p_outQuat->GetData()[largest] = traceValue * 0.5f; - traceValue = 0.5f / traceValue; + p_outQuat[largest] = trace * 0.5f; + trace = 0.5f / trace; - p_outQuat->GetData()[3] = (m_data[next + 4 * nextNext] - m_data[nextNext + 4 * next]) * traceValue; - p_outQuat->GetData()[next] = (m_data[next + 4 * largest] + m_data[largest + 4 * next]) * traceValue; - p_outQuat->GetData()[nextNext] = (m_data[nextNext + 4 * largest] + m_data[largest + 4 * nextNext]) * traceValue; - */ + p_outQuat[3] = (*Element(nextNext, next) - *Element(next, nextNext)) * trace; + p_outQuat[next] = (*Element(largest, next) + *Element(next, largest)) * trace; + p_outQuat[nextNext] = (*Element(largest, nextNext) + *Element(nextNext, largest)) * trace; + } } // FUNCTION: LEGO1 0x10002710 diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index acdd6cb3..06d3acc5 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -195,11 +195,11 @@ class Vector3 : public Vector2 { virtual void EqualsCross(float* p_a, Vector3* p_b) { EqualsCrossImpl(p_a, p_b->m_data); } // vtable+0x78 // FUNCTION: LEGO1 0x10003bf0 - virtual void EqualsScalar(float* p_value) + virtual void Fill(const float& p_value) { - m_data[0] = *p_value; - m_data[1] = *p_value; - m_data[2] = *p_value; + m_data[0] = p_value; + m_data[1] = p_value; + m_data[2] = p_value; } // vtable+0x84 // Vector2 overrides @@ -270,8 +270,6 @@ class Vector3 : public Vector2 { return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2]; } // vtable+0x40 - inline void Fill(float p_value) { EqualsScalar(&p_value); } - friend class Mx3DPointFloat; }; @@ -374,12 +372,12 @@ class Vector4 : public Vector3 { } // vtable+0x40 // FUNCTION: LEGO1 0x10002b40 - void EqualsScalar(float* p_value) override + void Fill(const float& p_value) override { - m_data[0] = *p_value; - m_data[1] = *p_value; - m_data[2] = *p_value; - m_data[3] = *p_value; + m_data[0] = p_value; + m_data[1] = p_value; + m_data[2] = p_value; + m_data[3] = p_value; } // vtable+0x84 friend class Mx4DPointFloat; diff --git a/tools/README.md b/tools/README.md index 6e6b046f..0c6b4112 100644 --- a/tools/README.md +++ b/tools/README.md @@ -162,16 +162,19 @@ Use `pip` to install the required packages to be able to use the Python tools fo pip install -r tools/requirements.txt ``` -* [`patch_c2.py`](/tools/patch_c2.py): Patches `C2.EXE` (part of MSVC 4.20), to get rid of a bugged warning -* [`reccmp`](/tools/reccmp): Compares the original EXE or DLL with a recompiled EXE or DLL, provided a PDB file -* [`verexp`](/tools/verexp): Verifies exports by comparing the exports of the original DLL and the recompiled DLL * [`decomplint`](/tools/decomplint): Checks the decompilation annotations (see above) +* [`isledecomp`](/tools/isledecomp): A library that implements a parser to identify the decompilation annotations (see above) * [`ncc`](/tools/ncc): Checks naming conventions based on a set of rules -* [`isledecomp`](/tools/isledecomp): A library that implements a parser to identify the "decompilation" annotations (see above) +* [`reccmp`](/tools/reccmp): Compares an original binary with a recompiled binary, provided a PDB file +* [`roadmap`](/tools/roadmap): Compares symbol locations in an original binary with the same symbol locations of a recompiled binary +* [`verexp`](/tools/verexp): Verifies exports by comparing the exports of the original DLL and the recompiled DLL +* [`vtable`](/tools/vtable): Asserts virtual table correctness by comparing a recompiled binary with the original +* [`datacmp.py`](/tools/datacmp.py): Compares global data found in the original with the recompiled version +* [`patch_c2.py`](/tools/patch_c2.py): Patches `C2.EXE` (part of MSVC 4.20) to get rid of a bugged warning ## Testing -`isledecomp` has a small suite of tests. Install `pylint` and run it, passing in the directory: +`isledecomp` comes with a suite of tests. Install `pylint` and run it, passing in the directory: ``` pip install pytest diff --git a/tools/isledecomp/isledecomp/bin.py b/tools/isledecomp/isledecomp/bin.py index 9ca3195b..05ecfa92 100644 --- a/tools/isledecomp/isledecomp/bin.py +++ b/tools/isledecomp/isledecomp/bin.py @@ -2,7 +2,7 @@ import struct import bisect from functools import cached_property -from typing import List, Optional, Tuple +from typing import Iterator, List, Optional, Tuple from dataclasses import dataclass from collections import namedtuple @@ -77,6 +77,18 @@ def match_name(self, name: str) -> bool: def contains_vaddr(self, vaddr: int) -> bool: return self.virtual_address <= vaddr < self.virtual_address + self.extent + def read_virtual(self, vaddr: int, size: int) -> memoryview: + ofs = vaddr - self.virtual_address + + # Negative index will read from the end, which we don't want + if ofs < 0: + raise InvalidVirtualAddressError + + try: + return self.view[ofs : ofs + size] + except IndexError as ex: + raise InvalidVirtualAddressError from ex + def addr_is_uninitialized(self, vaddr: int) -> bool: """We cannot rely on the IMAGE_SCN_CNT_UNINITIALIZED_DATA flag (0x80) in the characteristics field so instead we determine it this way.""" @@ -109,6 +121,7 @@ def __init__(self, filename: str, find_str: bool = False) -> None: self._section_vaddr: List[int] = [] self.find_str = find_str self._potential_strings = {} + self._relocations = set() self._relocated_addrs = set() self.imports = [] self.thunks = [] @@ -279,11 +292,49 @@ def _populate_relocations(self): # We are now interested in the relocated addresses themselves. Seek to the # address where there is a relocation, then read the four bytes into our set. reloc_addrs.sort() + self._relocations = set(reloc_addrs) + for section_id, offset in map(self.get_relative_addr, reloc_addrs): section = self.get_section_by_index(section_id) (relocated_addr,) = struct.unpack(" Iterator[Tuple[int, int, float]]: + """Floating point instructions that refer to a memory address can + point to constant values. Search the code sections to find FP + instructions and check whether the pointer address refers to + read-only data.""" + + # TODO: Should check any section that has code, not just .text + text = self.get_section_by_name(".text") + rdata = self.get_section_by_name(".rdata") + + # These are the addresses where a relocation occurs. + # Meaning: it points to an absolute address of something + for addr in self._relocations: + if not text.contains_vaddr(addr): + continue + + # Read the two bytes before the relocated address. + # We will check against possible float opcodes + raw = text.read_virtual(addr - 2, 6) + (opcode, opcode_ext, const_addr) = struct.unpack(" Optional[int]: return None -def bytes_to_float(b: bytes) -> Optional[float]: - if len(b) == 4: - return struct.unpack(" Optional[int]: if len(b) == 4: return struct.unpack(" bool: return False - def float_replace(self, addr: int, data_size: int) -> Optional[str]: - if callable(self.bin_lookup): - float_bytes = self.bin_lookup(addr, data_size) - if float_bytes is None: - return None - - float_value = bytes_to_float(float_bytes) - if float_value is not None: - return f"{float_value} (FLOAT)" - - return None - def lookup( self, addr: int, use_cache: bool = True, exact: bool = False ) -> Optional[str]: @@ -165,25 +143,6 @@ def hex_replace_indirect(self, match: re.Match) -> str: return match.group(0).replace(match.group(1), self.replace(value)) - def hex_replace_float(self, match: re.Match) -> str: - """Special case for replacements on float instructions. - If the pointer is a float constant, read it from the binary.""" - value = int(match.group(1), 16) - - # If we can find a variable name for this pointer, use it. - placeholder = self.lookup(value) - - # Read what's under the pointer and show the decimal value. - if placeholder is None: - float_size = 8 if "qword" in match.string else 4 - placeholder = self.float_replace(value, float_size) - - # If we can't read the float, use a regular placeholder. - if placeholder is None: - placeholder = self.replace(value) - - return match.group(0).replace(match.group(1), placeholder) - def sanitize(self, inst: DisasmLiteInst) -> Tuple[str, str]: # For jumps or calls, if the entire op_str is a hex number, the value # is a relative offset. @@ -224,9 +183,6 @@ def sanitize(self, inst: DisasmLiteInst) -> Tuple[str, str]: if inst.mnemonic == "call": # Special handling for absolute indirect CALL. op_str = ptr_replace_regex.sub(self.hex_replace_indirect, inst.op_str) - elif inst.mnemonic.startswith("f"): - # If floating point instruction - op_str = ptr_replace_regex.sub(self.hex_replace_float, inst.op_str) else: op_str = ptr_replace_regex.sub(self.hex_replace_always, inst.op_str) diff --git a/tools/isledecomp/isledecomp/compare/core.py b/tools/isledecomp/isledecomp/compare/core.py index c66cee94..b49600d0 100644 --- a/tools/isledecomp/isledecomp/compare/core.py +++ b/tools/isledecomp/isledecomp/compare/core.py @@ -82,6 +82,7 @@ def __init__( self._load_cvdump() self._load_markers() self._find_original_strings() + self._find_float_const() self._match_imports() self._match_exports() self._match_thunks() @@ -249,6 +250,18 @@ def _find_original_strings(self): self._db.match_string(addr, string) + def _find_float_const(self): + """Add floating point constants in each binary to the database. + We are not matching anything right now because these values are not + deduped like strings.""" + for addr, size, float_value in self.orig_bin.find_float_consts(): + self._db.set_orig_symbol(addr, SymbolType.FLOAT, str(float_value), size) + + for addr, size, float_value in self.recomp_bin.find_float_consts(): + self._db.set_recomp_symbol( + addr, SymbolType.FLOAT, str(float_value), None, size + ) + def _match_imports(self): """We can match imported functions based on the DLL name and function symbol name.""" diff --git a/tools/isledecomp/isledecomp/compare/db.py b/tools/isledecomp/isledecomp/compare/db.py index f055e8fd..634cf455 100644 --- a/tools/isledecomp/isledecomp/compare/db.py +++ b/tools/isledecomp/isledecomp/compare/db.py @@ -84,6 +84,23 @@ def __init__(self): self._db = sqlite3.connect(":memory:") self._db.executescript(_SETUP_SQL) + def set_orig_symbol( + self, + addr: int, + compare_type: Optional[SymbolType], + name: Optional[str], + size: Optional[int], + ): + # Ignore collisions here. + if self._orig_used(addr): + return + + compare_value = compare_type.value if compare_type is not None else None + self._db.execute( + "INSERT INTO `symbols` (orig_addr, compare_type, name, size) VALUES (?,?,?,?)", + (addr, compare_value, name, size), + ) + def set_recomp_symbol( self, addr: int, diff --git a/tools/isledecomp/isledecomp/types.py b/tools/isledecomp/isledecomp/types.py index 4d518dd3..31829c65 100644 --- a/tools/isledecomp/isledecomp/types.py +++ b/tools/isledecomp/isledecomp/types.py @@ -10,3 +10,4 @@ class SymbolType(Enum): POINTER = 3 STRING = 4 VTABLE = 5 + FLOAT = 6 diff --git a/tools/isledecomp/tests/test_sanitize.py b/tools/isledecomp/tests/test_sanitize.py index ca23c861..deb3c825 100644 --- a/tools/isledecomp/tests/test_sanitize.py +++ b/tools/isledecomp/tests/test_sanitize.py @@ -189,6 +189,7 @@ def substitute_1234(addr: int, _: bool) -> Optional[str]: assert op_str == "0x5555" +@pytest.mark.skip(reason="changed implementation") def test_float_replacement(): """Floating point constants often appear as pointers to data. A good example is ViewROI::IntrinsicImportance and the subclass override @@ -208,6 +209,7 @@ def bin_lookup(addr: int, _: int) -> Optional[bytes]: assert op_str == "dword ptr [3.1415927410125732 (FLOAT)]" +@pytest.mark.skip(reason="changed implementation") def test_float_variable(): """If there is a variable at the address referenced by a float instruction, use the name instead of calling into the float replacement handler.""" diff --git a/tools/ncc/skip.yml b/tools/ncc/skip.yml index 6da0cc9c..46229e07 100644 --- a/tools/ncc/skip.yml +++ b/tools/ncc/skip.yml @@ -29,3 +29,4 @@ m_disAnimP: "Allow original naming from beta" i_activity: "Allow original naming from beta" i_actor: "Allow original naming from beta" score: "Allow original naming from beta" +c_LOCATIONS_NUM: "Allow original naming from beta" diff --git a/tools/roadmap/roadmap.py b/tools/roadmap/roadmap.py index 379fcfc2..a0df3cbc 100644 --- a/tools/roadmap/roadmap.py +++ b/tools/roadmap/roadmap.py @@ -10,6 +10,7 @@ from typing import Iterator, List, Optional, Tuple from collections import namedtuple from isledecomp import Bin as IsleBin +from isledecomp.bin import InvalidVirtualAddressError from isledecomp.cvdump import Cvdump from isledecomp.compare import Compare as IsleCompare from isledecomp.types import SymbolType @@ -87,7 +88,7 @@ def print_sections(sections): print() -ALLOWED_TYPE_ABBREVIATIONS = ["fun", "dat", "poi", "str", "vta"] +ALLOWED_TYPE_ABBREVIATIONS = ["fun", "dat", "poi", "str", "vta", "flo"] def match_type_abbreviation(mtype: Optional[SymbolType]) -> str: @@ -456,7 +457,16 @@ def to_roadmap_row(match): module_name, ) - results = list(map(to_roadmap_row, engine.get_all())) + def roadmap_row_generator(matches): + for match in matches: + try: + yield to_roadmap_row(match) + except InvalidVirtualAddressError: + # This is here to work around the fact that we have RVA + # values (i.e. not real virtual addrs) in our compare db. + pass + + results = list(roadmap_row_generator(engine.get_all())) if args.order is not None: suggest_order(results, module_map, args.order)