diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index 5e9e1ec4..7c981bd0 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -37,13 +37,7 @@ Isle::Isle() m_frameDelta = 10; m_windowActive = 1; - MxRect32 rect; - rect.m_left = 0; - rect.m_top = 0; - rect.m_right = 639; - rect.m_bottom = 479; - - m_videoParam = MxVideoParam(rect, NULL, 1, MxVideoParamFlags()); + m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_windowHandle = NULL; @@ -116,7 +110,7 @@ void Isle::Close() } // OFFSET: ISLE 0x402740 -BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize) +BOOL Isle::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize) { HKEY hKey; DWORD valueType; @@ -135,7 +129,7 @@ BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize) } // OFFSET: ISLE 0x4027b0 -int ReadRegBool(LPCSTR name, BOOL *out) +int Isle::ReadRegBool(LPCSTR name, BOOL *out) { char buffer[256]; @@ -143,28 +137,30 @@ int ReadRegBool(LPCSTR name, BOOL *out) if (read) { if (strcmp("YES", buffer) == 0) { *out = TRUE; - return TRUE; + return read; } if (strcmp("NO", buffer) == 0) { *out = FALSE; - return TRUE; + return read; } + + read = FALSE; } - return FALSE; + return read; } // OFFSET: ISLE 0x402880 -int ReadRegInt(LPCSTR name, int *out) +int Isle::ReadRegInt(LPCSTR name, int *out) { char buffer[256]; - if (ReadReg(name, buffer, sizeof(buffer))) { + BOOL read = ReadReg(name, buffer, sizeof(buffer)); + if (read) { *out = atoi(buffer); - return TRUE; } - return FALSE; + return read; } // OFFSET: ISLE 0x4028d0 @@ -256,16 +252,18 @@ void Isle::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, // OFFSET: ISLE 0x4013b0 BOOL Isle::SetupLegoOmni() { + BOOL result = FALSE; char mediaPath[256]; GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); - if (Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) != FAILURE) { + BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE; + if (!failure) { VariableTable()->SetVariable("ACTOR_01", ""); TickleManager()->vtable1c(VideoManager(), 10); - return TRUE; + result = TRUE; } - return FALSE; + return result; } // OFFSET: ISLE 0x402e80 diff --git a/ISLE/isle.h b/ISLE/isle.h index d4f4e42e..4d6b73c4 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -12,7 +12,11 @@ class Isle Isle(); ~Isle(); - static void Close(); + void Close(); + + BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize); + int ReadRegBool(LPCSTR name, BOOL *out); + int ReadRegInt(LPCSTR name, int *out); MxResult SetupWindow(HINSTANCE hInstance); diff --git a/LEGO1/mxrect32.h b/LEGO1/mxrect32.h index 764117ec..092396f5 100644 --- a/LEGO1/mxrect32.h +++ b/LEGO1/mxrect32.h @@ -4,6 +4,14 @@ class MxRect32 { public: + MxRect32(int p_left, int p_top, int p_right, int p_bottom) + { + this->m_left = p_left; + this->m_top = p_top; + this->m_right = p_right; + this->m_bottom = p_bottom; + } + int m_left; int m_top; int m_right;