diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index e7c2dda1..d8e7801e 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -185,7 +185,8 @@ MxS32 IsleApp::SetupLegoOmni() failure = Lego()->Create(param) == FAILURE; } #else - MxS32 failure = Lego()->Create(MxOmniCreateParam(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE; + MxS32 failure = + Lego()->Create(MxOmniCreateParam(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE; #endif if (!failure) { @@ -388,17 +389,17 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) break; } - if (event->user.type == g_LegoSdlEvents.windows_message) { + if (event->user.type == g_LegoSdlEvents.windows_message) { switch (event->user.code) { case WM_ISLE_SETCURSOR: g_isle->SetupCursor((Cursor) (uintptr_t) event->user.data1); break; case WM_QUIT: - return SDL_APP_SUCCESS; + return SDL_APP_SUCCESS; + break; + default: + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unknown SDL Windows message: 0x%" SDL_PRIx32, event->user.code); break; - default: - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unknown SDL Windows message: 0x%" SDL_PRIx32, event->user.code); - break; } } diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index a323cdf3..0fbbff44 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -1,13 +1,14 @@ #ifndef LEGOMAIN_H #define LEGOMAIN_H -#include #include "compat.h" #include "lego1_export.h" #include "legoutils.h" #include "mxdsaction.h" #include "mxomni.h" +#include + class Isle; class LegoAnimationManager; class LegoBuildingManager; @@ -187,14 +188,15 @@ class LegoOmni : public MxOmni { MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) { return m_unk0x13c ? Start(&p_dsAction) : SUCCESS; } void SetUnknown13c(MxBool p_unk0x13c) { m_unk0x13c = p_unk0x13c; } - void CloseMainWindow() { - SDL_Event event; - event.user.type = g_LegoSdlEvents.windows_message; - event.user.code = WM_CLOSE; - event.user.data1 = NULL; - event.user.data2 = NULL; - SDL_PushEvent(&event); - } + void CloseMainWindow() + { + SDL_Event event; + event.user.type = g_LegoSdlEvents.windows_message; + event.user.code = WM_CLOSE; + event.user.data1 = NULL; + event.user.data2 = NULL; + SDL_PushEvent(&event); + } // SYNTHETIC: LEGO1 0x10058b30 // LegoOmni::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 49a87543..8825f457 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -16,7 +16,7 @@ #define DS_NOT_A_STREAM -1 struct LegoSdlEvents { - Uint32 windows_message; + Uint32 windows_message; }; LEGO1_EXPORT extern LegoSdlEvents g_LegoSdlEvents; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 978aa703..c258105c 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -567,13 +567,14 @@ void EnableAnimations(MxBool p_enable) AnimationManager()->FUN_100604d0(p_enable); } -void InitSdlEvents() { - static bool initialized = false; - if (!initialized) { - initialized = true; - Uint32 event = SDL_RegisterEvents(1); - g_LegoSdlEvents.windows_message = event + 0; - } +void InitSdlEvents() +{ + static bool initialized = false; + if (!initialized) { + initialized = true; + Uint32 event = SDL_RegisterEvents(1); + g_LegoSdlEvents.windows_message = event + 0; + } } // FUNCTION: LEGO1 0x1003ef40 diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index e90be07d..1c209f60 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -518,7 +518,11 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) // FUNCTION: BETA10 0x10089fc5 void LegoInputManager::StartAutoDragTimer() { - HWND hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + HWND hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); m_autoDragTimerID = ::SetTimer(hWnd, 1, m_autoDragTime, NULL); } @@ -527,7 +531,11 @@ void LegoInputManager::StartAutoDragTimer() void LegoInputManager::StopAutoDragTimer() { if (m_autoDragTimerID) { - HWND hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + HWND hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); ::KillTimer(hWnd, m_autoDragTimerID); } } diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index a83a0989..f5d725be 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -160,7 +160,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) { MxResult result = FAILURE; AUTOLOCK(m_criticalSection); - HWND hWnd = NULL; + HWND hWnd = NULL; p_param.CreateFlags().CreateObjectFactory(FALSE); p_param.CreateFlags().CreateVideoManager(FALSE); @@ -192,7 +192,12 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) goto done; } - hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + // [library:dinput] + hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(hWnd) != SUCCESS) { delete m_inputManager; m_inputManager = NULL; @@ -262,7 +267,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) SetAppCursor(e_cursorBusy); m_gameState->SetCurrentAct(LegoGameState::e_act1); - InitSdlEvents(); + InitSdlEvents(); result = SUCCESS; diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index d9aa657a..0b5a9e4f 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -85,7 +85,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM Mx3DPointFloat dirVec(0.0, 0.0, 1.0); Mx3DPointFloat upVec(0.0, 1.0, 0.0); MxMatrix outMatrix; - HWND hwnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + // [library:ddraw] [library:d3d] + HWND hwnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); MxS32 bits = p_videoParam.Flags().Get16Bit() ? 16 : 8; if (!p_videoParam.GetPalette()) { @@ -176,7 +181,11 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM Lego3DManager::CreateStruct createStruct; memset(&createStruct, 0, sizeof(createStruct)); - createStruct.m_hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + createStruct.m_hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); createStruct.m_pDirectDraw = m_pDirectDraw; createStruct.m_pFrontBuffer = m_displaySurface->GetDirectDrawSurface1(); createStruct.m_pBackBuffer = m_displaySurface->GetDirectDrawSurface2(); diff --git a/LEGO1/mxdirectx/mxstopwatch.h b/LEGO1/mxdirectx/mxstopwatch.h index d5b1daa6..2cddb341 100644 --- a/LEGO1/mxdirectx/mxstopwatch.h +++ b/LEGO1/mxdirectx/mxstopwatch.h @@ -3,10 +3,10 @@ #include "assert.h" -#include // ULONG_MAX -#include #include #include +#include // ULONG_MAX +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ class MxStopWatch { Uint64 m_startTick; // 0x00 // ??? when we provide LARGE_INTEGER arithmetic, use a // LARGE_INTEGER m_elapsedTicks rather than m_elapsedSeconds - double m_elapsedSeconds; // 0x0c + double m_elapsedSeconds; // 0x0c Uint64 m_ticksPerSeconds; // 0x14 }; @@ -59,9 +59,9 @@ inline void MxStopWatch::Stop() { Uint64 endTick; - endTick = SDL_GetPerformanceCounter(); + endTick = SDL_GetPerformanceCounter(); - m_elapsedSeconds = (double)(endTick - m_startTick) / (double)m_ticksPerSeconds; + m_elapsedSeconds = (double) (endTick - m_startTick) / (double) m_ticksPerSeconds; } // FUNCTION: BETA10 0x100d8c10 @@ -79,7 +79,7 @@ inline Uint64 MxStopWatch::TicksPerSeconds() const ticksPerSeconds = SDL_GetPerformanceFrequency(); assert(ticksPerSeconds); - return ticksPerSeconds; + return ticksPerSeconds; } // FUNCTION: BETA10 0x100d9020 diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index ebc7b5d3..c80ad35b 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -62,9 +62,7 @@ class MxOmni : public MxCore { static void SetInstance(MxOmni* p_instance); static MxBool ActionSourceEquals(MxDSAction* p_action, const char* p_name); - SDL_Window* GetWindowHandle() const { - return m_windowHandle; - } + SDL_Window* GetWindowHandle() const { return m_windowHandle; } // FUNCTION: BETA10 0x10125100 MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index cb9c09b6..2bdfbe2d 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -140,12 +140,13 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) MxResult result = FAILURE; LPDIRECTDRAW lpDirectDraw = MVideoManager()->GetDirectDraw(); SDL_Window* window = MxOmni::GetInstance()->GetWindowHandle(); - HWND hWnd = (HWND - ) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + // [library:ddraw] + HWND hWnd = + (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); - if (!hWnd) { - goto done; - } + if (!hWnd) { + goto done; + } m_initialized = TRUE; m_videoParam = p_videoParam; @@ -848,7 +849,12 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p } else { MxPoint32 point(0, 0); - HWND hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + // [library:ddraw] + HWND hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); ClientToScreen(hWnd, (LPPOINT) &point); p_left2 += m_videoParam.GetRect().GetLeft() + point.GetX(); diff --git a/LEGO1/omni/src/video/mxvideomanager.cpp b/LEGO1/omni/src/video/mxvideomanager.cpp index 3a17821e..e6eab0e6 100644 --- a/LEGO1/omni/src/video/mxvideomanager.cpp +++ b/LEGO1/omni/src/video/mxvideomanager.cpp @@ -216,7 +216,7 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, { MxBool locked = FALSE; MxResult status = FAILURE; - HWND hWnd = NULL; + HWND hWnd = NULL; m_unk0x60 = TRUE; @@ -238,7 +238,12 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, goto done; } - hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + // [library:ddraw] + hWnd = (HWND) SDL_GetPointerProperty( + SDL_GetWindowProperties(MxOmni::GetInstance()->GetWindowHandle()), + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); if (m_pDirectDraw->SetCooperativeLevel(hWnd, DDSCL_NORMAL) != DD_OK) { goto done; }