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/define.cpp b/LEGO1/define.cpp index 84073b9d..d083988c 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -1,5 +1,11 @@ #include "define.h" +// 0x100f3be8 +const char *g_str_enable = "enable"; + +// 0x100f3bf4 +const char *g_str_disable = "disable"; + // 0x10101eac const char *g_parseExtraTokens = ":;"; diff --git a/LEGO1/define.h b/LEGO1/define.h index ec41943e..b0b447fc 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -1,6 +1,8 @@ #ifndef DEFINE_H #define DEFINE_H +extern const char *g_str_enable; +extern const char *g_str_disable; extern const char *g_parseExtraTokens; extern const char *g_strWORLD; extern const char *g_strACTION; 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..2fcb8474 --- /dev/null +++ b/LEGO1/legofullscreenmovie.cpp @@ -0,0 +1,36 @@ +#include "legofullscreenmovie.h" +#include "mxtypes.h" +#include "legoomni.h" +#include "define.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24) + +// 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..02f2e0d6 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -5,6 +5,17 @@ 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..6939395d 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -1,7 +1,10 @@ #ifndef LEGOGAMESTATE_H #define LEGOGAMESTATE_H +#include "decomp.h" #include "mxtypes.h" +#include "legobackgroundcolor.h" +#include "legofullscreenmovie.h" class LegoGameState { @@ -16,6 +19,10 @@ class LegoGameState private: char *m_savePath; + undefined m_unk[20]; + LegoBackgroundColor *m_backgroundColor; // 0x18 + LegoBackgroundColor *m_tempBackgroundColor; // 0x1c + LegoFullScreenMovie *m_fullScreenMovie; // 0x20 }; #endif // LEGOGAMESTATE_H diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp index 9c1044e2..3bba1aea 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, 1); +} + // 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 60f670fb..cae9c59b 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: