From ebc3145ca79d28f9f2f3751ce928e588fbc9d5bf Mon Sep 17 00:00:00 2001 From: ktkaufman03 Date: Tue, 4 Jul 2023 20:11:48 -0400 Subject: [PATCH] fix: MxPalette rgbquad ctor functionally matches Not quite ASM matching yet because of weird register allocation mismatches. --- LEGO1/mxpalette.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/LEGO1/mxpalette.cpp b/LEGO1/mxpalette.cpp index 2ee03cab..dac24ba6 100644 --- a/LEGO1/mxpalette.cpp +++ b/LEGO1/mxpalette.cpp @@ -271,6 +271,24 @@ MxPalette::MxPalette() this->m_skyColor = this->m_entries[141]; } +// OFFSET: LEGO1 0x100BEED0 +MxPalette::MxPalette(const RGBQUAD *p_colors) +{ + this->m_overrideSkyColor = FALSE; + this->m_palette = NULL; + GetDefaultPalette(this->m_entries); + + for ( int i = 10; i < 246; i++ ) + { + this->m_entries[i].peRed = p_colors[i].rgbRed; + this->m_entries[i].peGreen = p_colors[i].rgbGreen; + this->m_entries[i].peBlue = p_colors[i].rgbBlue; + this->m_entries[i].peFlags = 0; + } + + this->m_skyColor = this->m_entries[141]; +} + // OFFSET: LEGO1 100bef90 MxPalette::~MxPalette() { @@ -307,17 +325,6 @@ MxPalette* MxPalette::Clone() return result; } -// OFFSET: LEGO1 0x100beed0 -MxPalette* MxPalette::FromBitmapPalette(RGBQUAD* p_bmp) -{ - // FIXME: Incomplete - this->m_overrideSkyColor = FALSE; - ApplySystemEntriesToPalette(this->m_entries); - memcpy(this->m_entries + 10, &p_bmp[10], 246); - this->m_skyColor = this->m_entries[141]; - return this; -} - // OFFSET: LEGO1 0x100bf420 void MxPalette::GetDefaultPalette(LPPALETTEENTRY p_entries) {