From 3ac0c5d86c9c87e52119522451c44e3b0ff9cd28 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:00:59 -0400 Subject: [PATCH] Implement LegoVideoManager::MoveCursor and improve SetSkyColor (#190) * improved SetSkyColor match * LegoVideoManager::MoveCursor * rename parameters * Minor improvements --------- Co-authored-by: Christian Semmler --- LEGO1/legovideomanager.cpp | 33 +++++++++++++++++++++++---------- LEGO1/legovideomanager.h | 17 ++++++++++++++--- LEGO1/mxpalette.h | 1 + LEGO1/mxvideomanager.h | 2 +- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp index 4105ef2a..ca7926b9 100644 --- a/LEGO1/legovideomanager.cpp +++ b/LEGO1/legovideomanager.cpp @@ -1,5 +1,6 @@ #include "legovideomanager.h" -#include + +DECOMP_SIZE_ASSERT(LegoVideoManager, 0x590); // OFFSET: LEGO1 0x1007aa20 STUB LegoVideoManager::LegoVideoManager() @@ -39,20 +40,32 @@ void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale) // TODO } -// OFFSET: LEGO1 0x1007b6a0 STUB -void LegoVideoManager::MoveCursor(int x, int y) +// OFFSET: LEGO1 0x1007b6a0 +void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY) { - // TODO + m_cursorX = p_cursorX; + m_cursorY = p_cursorY; + m_cursorMoved = TRUE; + + if (623 < p_cursorX) + m_cursorX = 623; + + if (463 < p_cursorY) + m_cursorY = 463; } // OFFSET: LEGO1 0x1007c440 -void LegoVideoManager::SetSkyColor(float red, float green, float blue) +void LegoVideoManager::SetSkyColor(float p_red, float p_green, float p_blue) { - PALETTEENTRY colorStrucure; // [esp+0h] [ebp-4h] BYREF + PALETTEENTRY colorStrucure; - colorStrucure.peRed = (red* 255.0); - colorStrucure.peGreen = (green * 255.0); - colorStrucure.peBlue = (blue * 255.0); + colorStrucure.peRed = (p_red * 255.0f); + colorStrucure.peGreen = (p_green * 255.0f); + colorStrucure.peBlue = (p_blue * 255.0f); colorStrucure.peFlags = -124; - // TODO + m_videoParam.GetPalette()->SetSkyColor(&colorStrucure); + m_videoParam.GetPalette()->SetOverrideSkyColor(TRUE); + + // TODO 3d manager + //m_3dManager->m_pViewport->vtable1c(red, green, blue) } diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index 4ff8491b..cc051f16 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -6,6 +6,8 @@ #include "lego3dmanager.h" #include "decomp.h" +#include + // VTABLE 0x100d9c88 // SIZE 0x590 class LegoVideoManager : public MxVideoManager @@ -24,7 +26,10 @@ class LegoVideoManager : public MxVideoManager inline MxDirect3D *GetDirect3D() { return this->m_direct3d; } void SetSkyColor(float r, float g, float b); - inline void SetUnkE4(MxBool p_value) { this->m_unke4 = p_value; } + inline void SetUnkE4(MxBool p_unk0xe4) { this->m_unk0xe4 = p_unk0xe4; } + + // OFFSET: LEGO1 0x1007c4c0 + void OverrideSkyColor(MxBool p_shouldOverride) { this->m_videoParam.GetPalette()->SetOverrideSkyColor(p_shouldOverride);} private: undefined4 m_unk64; @@ -32,8 +37,14 @@ class LegoVideoManager : public MxVideoManager undefined4 m_unk6c; undefined4 m_unk70; MxDirect3D *m_direct3d; - undefined m_pad78[0x6c]; - MxBool m_unke4; + undefined m_pad0x78[0x6c]; + MxBool m_unk0xe4; + undefined m_pad0xe8[0x41c]; + MxBool m_cursorMoved; // 0x501 + undefined m_pad0x502[0x8]; + MxS32 m_cursorX; // 0x50c + MxS32 m_cursorY; // 0x510 + undefined m_pad0x514[0x7c]; }; #endif // LEGOVIDEOMANAGER_H diff --git a/LEGO1/mxpalette.h b/LEGO1/mxpalette.h index b024330a..7c9568b1 100644 --- a/LEGO1/mxpalette.h +++ b/LEGO1/mxpalette.h @@ -26,6 +26,7 @@ class MxPalette : public MxCore MxResult SetSkyColor(LPPALETTEENTRY p_sky_color); void Reset(MxBool p_ignoreSkyColor); LPDIRECTDRAWPALETTE CreateNativePalette(); + inline void SetOverrideSkyColor(MxBool p_value) { this->m_overrideSkyColor = p_value; } private: LPDIRECTDRAWPALETTE m_palette; PALETTEENTRY m_entries[256]; // 0xc diff --git a/LEGO1/mxvideomanager.h b/LEGO1/mxvideomanager.h index d72c1d10..f6e1a726 100644 --- a/LEGO1/mxvideomanager.h +++ b/LEGO1/mxvideomanager.h @@ -29,7 +29,7 @@ class MxVideoManager : public MxMediaManager inline MxVideoParam& GetVideoParam() { return this->m_videoParam; } inline LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } inline MxDisplaySurface *GetDisplaySurface() { return this->m_displaySurface; } -private: +protected: MxVideoParam m_videoParam; LPDIRECTDRAW m_pDirectDraw; LPDIRECTDRAWSURFACE m_pDDSurface;