Implement LegoVideoManager::MoveCursor and improve SetSkyColor (#190)

* improved SetSkyColor match

* LegoVideoManager::MoveCursor

* rename parameters

* Minor improvements

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2023-10-08 16:00:59 -04:00 committed by GitHub
parent 7c674cbb47
commit 3ac0c5d86c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 14 deletions

View file

@ -1,5 +1,6 @@
#include "legovideomanager.h" #include "legovideomanager.h"
#include <ddraw.h>
DECOMP_SIZE_ASSERT(LegoVideoManager, 0x590);
// OFFSET: LEGO1 0x1007aa20 STUB // OFFSET: LEGO1 0x1007aa20 STUB
LegoVideoManager::LegoVideoManager() LegoVideoManager::LegoVideoManager()
@ -39,20 +40,32 @@ void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
// TODO // TODO
} }
// OFFSET: LEGO1 0x1007b6a0 STUB // OFFSET: LEGO1 0x1007b6a0
void LegoVideoManager::MoveCursor(int x, int y) 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 // 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.peRed = (p_red * 255.0f);
colorStrucure.peGreen = (green * 255.0); colorStrucure.peGreen = (p_green * 255.0f);
colorStrucure.peBlue = (blue * 255.0); colorStrucure.peBlue = (p_blue * 255.0f);
colorStrucure.peFlags = -124; 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)
} }

View file

@ -6,6 +6,8 @@
#include "lego3dmanager.h" #include "lego3dmanager.h"
#include "decomp.h" #include "decomp.h"
#include <ddraw.h>
// VTABLE 0x100d9c88 // VTABLE 0x100d9c88
// SIZE 0x590 // SIZE 0x590
class LegoVideoManager : public MxVideoManager class LegoVideoManager : public MxVideoManager
@ -24,7 +26,10 @@ class LegoVideoManager : public MxVideoManager
inline MxDirect3D *GetDirect3D() { return this->m_direct3d; } inline MxDirect3D *GetDirect3D() { return this->m_direct3d; }
void SetSkyColor(float r, float g, float b); 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: private:
undefined4 m_unk64; undefined4 m_unk64;
@ -32,8 +37,14 @@ class LegoVideoManager : public MxVideoManager
undefined4 m_unk6c; undefined4 m_unk6c;
undefined4 m_unk70; undefined4 m_unk70;
MxDirect3D *m_direct3d; MxDirect3D *m_direct3d;
undefined m_pad78[0x6c]; undefined m_pad0x78[0x6c];
MxBool m_unke4; 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 #endif // LEGOVIDEOMANAGER_H

View file

@ -26,6 +26,7 @@ class MxPalette : public MxCore
MxResult SetSkyColor(LPPALETTEENTRY p_sky_color); MxResult SetSkyColor(LPPALETTEENTRY p_sky_color);
void Reset(MxBool p_ignoreSkyColor); void Reset(MxBool p_ignoreSkyColor);
LPDIRECTDRAWPALETTE CreateNativePalette(); LPDIRECTDRAWPALETTE CreateNativePalette();
inline void SetOverrideSkyColor(MxBool p_value) { this->m_overrideSkyColor = p_value; }
private: private:
LPDIRECTDRAWPALETTE m_palette; LPDIRECTDRAWPALETTE m_palette;
PALETTEENTRY m_entries[256]; // 0xc PALETTEENTRY m_entries[256]; // 0xc

View file

@ -29,7 +29,7 @@ class MxVideoManager : public MxMediaManager
inline MxVideoParam& GetVideoParam() { return this->m_videoParam; } inline MxVideoParam& GetVideoParam() { return this->m_videoParam; }
inline LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } inline LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; }
inline MxDisplaySurface *GetDisplaySurface() { return this->m_displaySurface; } inline MxDisplaySurface *GetDisplaySurface() { return this->m_displaySurface; }
private: protected:
MxVideoParam m_videoParam; MxVideoParam m_videoParam;
LPDIRECTDRAW m_pDirectDraw; LPDIRECTDRAW m_pDirectDraw;
LPDIRECTDRAWSURFACE m_pDDSurface; LPDIRECTDRAWSURFACE m_pDDSurface;