diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c408d65..bcdadc2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(lego1 SHARED LEGO1/legoentity.cpp LEGO1/legoentitypresenter.cpp LEGO1/legoflctexturepresenter.cpp + LEGO1/legofullscreenmovie.cpp LEGO1/legogamestate.cpp LEGO1/legohideanimpresenter.cpp LEGO1/legoinputmanager.cpp diff --git a/LEGO1/legobackgroundcolor.cpp b/LEGO1/legobackgroundcolor.cpp index e1d6beca..cc1483b3 100644 --- a/LEGO1/legobackgroundcolor.cpp +++ b/LEGO1/legobackgroundcolor.cpp @@ -3,6 +3,9 @@ #include "legoomni.h" #include "legoutil.h" #include "legovideomanager.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30) const char *g_delimiter = "\t"; const char *g_set = "set"; diff --git a/LEGO1/legobackgroundcolor.h b/LEGO1/legobackgroundcolor.h index aff62fe8..884a477b 100644 --- a/LEGO1/legobackgroundcolor.h +++ b/LEGO1/legobackgroundcolor.h @@ -3,11 +3,13 @@ #include "mxvariable.h" +// VTABLE 0x100d74a8 +// SIZE 0x30 class LegoBackgroundColor : public MxVariable { public: __declspec(dllexport) LegoBackgroundColor(const char *p_key, const char *p_value); - void SetValue(const char *p_colorString); + virtual void SetValue(const char *p_colorString) override; private: float h; diff --git a/LEGO1/legofullscreenmovie.cpp b/LEGO1/legofullscreenmovie.cpp new file mode 100644 index 00000000..f2a287f3 --- /dev/null +++ b/LEGO1/legofullscreenmovie.cpp @@ -0,0 +1,41 @@ +#include "legofullscreenmovie.h" +#include "mxtypes.h" +#include "legoomni.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24) + +// 0x100f3be8 +const char *g_str_enable = "enable"; + +// 0x100f3bf4 +const char *g_str_disable = "disable"; + +// OFFSET: LEGO1 0x1003c500 +LegoFullScreenMovie::LegoFullScreenMovie(const char *p_key, const char *p_value) +{ + m_key = p_key; + m_key.ToUpperCase(); + SetValue(p_value); +} + +// OFFSET: LEGO1 0x1003c5c0 +void LegoFullScreenMovie::SetValue(const char *p_option) +{ + m_value = p_option; + m_value.ToLowerCase(); + + LegoVideoManager *videomanager = VideoManager(); + if (videomanager) { + + if (!strcmp(m_value.GetData(), g_str_enable)) { + videomanager->EnableFullScreenMovie(TRUE); + return; + } + + if (!strcmp(m_value.GetData(), g_str_disable)) { + videomanager->EnableFullScreenMovie(FALSE); + return; + } + } +} diff --git a/LEGO1/legofullscreenmovie.h b/LEGO1/legofullscreenmovie.h new file mode 100644 index 00000000..ffe350f5 --- /dev/null +++ b/LEGO1/legofullscreenmovie.h @@ -0,0 +1,15 @@ +#ifndef LEGOFULLSCREENMOVIE_H +#define LEGOFULLSCREENMOVIE_H + +#include "mxvariable.h" + +// VTABLE 0x100d74b8 +// SIZE 0x24 +class LegoFullScreenMovie : public MxVariable +{ +public: + LegoFullScreenMovie(const char *p_key, const char *p_value); + virtual void SetValue(const char *p_option) override; +}; + +#endif // LEGOFULLSCREENMOVIE_H diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 344cf1ca..0f444f95 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -1,10 +1,26 @@ #include "legogamestate.h" #include "legoomni.h" +#include "decomp.h" + +// Based on the highest dword offset (0x42c) referenced in the constructor. +// There may be other members that come after. +DECOMP_SIZE_ASSERT(LegoGameState, 0x430) // OFFSET: LEGO1 0x10039550 LegoGameState::LegoGameState() { // TODO + m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68"); + VariableTable()->SetVariable(m_backgroundColor); + + m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundcolor", "set 56 54 68"); + VariableTable()->SetVariable(m_tempBackgroundColor); + + m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable"); + VariableTable()->SetVariable(m_fullScreenMovie); + + VariableTable()->SetVariable("lightposition", "2"); + SerializeScoreHistory(1); } // OFFSET: LEGO1 0x10039720 diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index ef2eeb1e..b1cd8b60 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -1,8 +1,12 @@ #ifndef LEGOGAMESTATE_H #define LEGOGAMESTATE_H +#include "decomp.h" #include "mxtypes.h" +#include "legobackgroundcolor.h" +#include "legofullscreenmovie.h" +// SIZE 0x430 (at least) class LegoGameState { public: @@ -15,7 +19,12 @@ class LegoGameState __declspec(dllexport) void SetSavePath(char *p); private: - char *m_savePath; + char *m_savePath; // 0x0 + undefined m_unk04[20]; + LegoBackgroundColor *m_backgroundColor; // 0x18 + LegoBackgroundColor *m_tempBackgroundColor; // 0x1c + LegoFullScreenMovie *m_fullScreenMovie; // 0x20 + undefined m_unk24[1036]; }; #endif // LEGOGAMESTATE_H diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp index 9c1044e2..4105ef2a 100644 --- a/LEGO1/legovideomanager.cpp +++ b/LEGO1/legovideomanager.cpp @@ -27,8 +27,14 @@ int LegoVideoManager::DisableRMDevice() return 0; } +// OFFSET: LEGO1 0x1007c300 +void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable) +{ + EnableFullScreenMovie(p_enable, TRUE); +} + // OFFSET: LEGO1 0x1007c310 STUB -void LegoVideoManager::EnableFullScreenMovie(unsigned char a, unsigned char b) +void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale) { // TODO } diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index d71c39a1..4ff8491b 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -16,7 +16,8 @@ class LegoVideoManager : public MxVideoManager __declspec(dllexport) int EnableRMDevice(); __declspec(dllexport) int DisableRMDevice(); - __declspec(dllexport) void EnableFullScreenMovie(unsigned char a, unsigned char b); + void EnableFullScreenMovie(MxBool p_enable); + __declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale); __declspec(dllexport) void MoveCursor(int x, int y); inline Lego3DManager *Get3DManager() { return this->m_3dManager; } diff --git a/LEGO1/mxvariable.cpp b/LEGO1/mxvariable.cpp index f18e6a94..0c9bf95a 100644 --- a/LEGO1/mxvariable.cpp +++ b/LEGO1/mxvariable.cpp @@ -1,5 +1,8 @@ #include "mxvariable.h" #include "mxstring.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxVariable, 0x24) // OFFSET: LEGO1 0x1003bea0 MxString *MxVariable::GetValue() diff --git a/LEGO1/mxvariable.h b/LEGO1/mxvariable.h index 6899dfac..83c83020 100644 --- a/LEGO1/mxvariable.h +++ b/LEGO1/mxvariable.h @@ -4,7 +4,8 @@ #include "mxstring.h" #include "mxcore.h" -//VTABLE: 0x100d74a8 +// VTABLE 0x100d7498 +// SIZE 0x24 class MxVariable { public: