clang-format

This commit is contained in:
Anonymous Maarten 2024-12-27 03:34:51 +01:00
parent f58d4e45e9
commit 69f0ddaafc
11 changed files with 82 additions and 47 deletions

View File

@ -185,7 +185,8 @@ MxS32 IsleApp::SetupLegoOmni()
failure = Lego()->Create(param) == FAILURE; failure = Lego()->Create(param) == FAILURE;
} }
#else #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 #endif
if (!failure) { if (!failure) {

View File

@ -1,13 +1,14 @@
#ifndef LEGOMAIN_H #ifndef LEGOMAIN_H
#define LEGOMAIN_H #define LEGOMAIN_H
#include <SDL3/SDL_events.h>
#include "compat.h" #include "compat.h"
#include "lego1_export.h" #include "lego1_export.h"
#include "legoutils.h" #include "legoutils.h"
#include "mxdsaction.h" #include "mxdsaction.h"
#include "mxomni.h" #include "mxomni.h"
#include <SDL3/SDL_events.h>
class Isle; class Isle;
class LegoAnimationManager; class LegoAnimationManager;
class LegoBuildingManager; class LegoBuildingManager;
@ -187,7 +188,8 @@ class LegoOmni : public MxOmni {
MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) { return m_unk0x13c ? Start(&p_dsAction) : SUCCESS; } MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) { return m_unk0x13c ? Start(&p_dsAction) : SUCCESS; }
void SetUnknown13c(MxBool p_unk0x13c) { m_unk0x13c = p_unk0x13c; } void SetUnknown13c(MxBool p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
void CloseMainWindow() { void CloseMainWindow()
{
SDL_Event event; SDL_Event event;
event.user.type = g_LegoSdlEvents.windows_message; event.user.type = g_LegoSdlEvents.windows_message;
event.user.code = WM_CLOSE; event.user.code = WM_CLOSE;

View File

@ -567,7 +567,8 @@ void EnableAnimations(MxBool p_enable)
AnimationManager()->FUN_100604d0(p_enable); AnimationManager()->FUN_100604d0(p_enable);
} }
void InitSdlEvents() { void InitSdlEvents()
{
static bool initialized = false; static bool initialized = false;
if (!initialized) { if (!initialized) {
initialized = true; initialized = true;

View File

@ -518,7 +518,11 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
// FUNCTION: BETA10 0x10089fc5 // FUNCTION: BETA10 0x10089fc5
void LegoInputManager::StartAutoDragTimer() 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); m_autoDragTimerID = ::SetTimer(hWnd, 1, m_autoDragTime, NULL);
} }
@ -527,7 +531,11 @@ void LegoInputManager::StartAutoDragTimer()
void LegoInputManager::StopAutoDragTimer() void LegoInputManager::StopAutoDragTimer()
{ {
if (m_autoDragTimerID) { 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); ::KillTimer(hWnd, m_autoDragTimerID);
} }
} }

View File

@ -192,7 +192,12 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
goto done; 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) { if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(hWnd) != SUCCESS) {
delete m_inputManager; delete m_inputManager;
m_inputManager = NULL; m_inputManager = NULL;

View File

@ -85,7 +85,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
Mx3DPointFloat dirVec(0.0, 0.0, 1.0); Mx3DPointFloat dirVec(0.0, 0.0, 1.0);
Mx3DPointFloat upVec(0.0, 1.0, 0.0); Mx3DPointFloat upVec(0.0, 1.0, 0.0);
MxMatrix outMatrix; 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; MxS32 bits = p_videoParam.Flags().Get16Bit() ? 16 : 8;
if (!p_videoParam.GetPalette()) { if (!p_videoParam.GetPalette()) {
@ -176,7 +181,11 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
Lego3DManager::CreateStruct createStruct; Lego3DManager::CreateStruct createStruct;
memset(&createStruct, 0, sizeof(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_pDirectDraw = m_pDirectDraw;
createStruct.m_pFrontBuffer = m_displaySurface->GetDirectDrawSurface1(); createStruct.m_pFrontBuffer = m_displaySurface->GetDirectDrawSurface1();
createStruct.m_pBackBuffer = m_displaySurface->GetDirectDrawSurface2(); createStruct.m_pBackBuffer = m_displaySurface->GetDirectDrawSurface2();

View File

@ -3,10 +3,10 @@
#include "assert.h" #include "assert.h"
#include <limits.h> // ULONG_MAX
#include <math.h>
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
#include <limits.h> // ULONG_MAX
#include <math.h>
#include <windows.h> #include <windows.h>
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -62,9 +62,7 @@ class MxOmni : public MxCore {
static void SetInstance(MxOmni* p_instance); static void SetInstance(MxOmni* p_instance);
static MxBool ActionSourceEquals(MxDSAction* p_action, const char* p_name); static MxBool ActionSourceEquals(MxDSAction* p_action, const char* p_name);
SDL_Window* GetWindowHandle() const { SDL_Window* GetWindowHandle() const { return m_windowHandle; }
return m_windowHandle;
}
// FUNCTION: BETA10 0x10125100 // FUNCTION: BETA10 0x10125100
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }

View File

@ -140,8 +140,9 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
MxResult result = FAILURE; MxResult result = FAILURE;
LPDIRECTDRAW lpDirectDraw = MVideoManager()->GetDirectDraw(); LPDIRECTDRAW lpDirectDraw = MVideoManager()->GetDirectDraw();
SDL_Window* window = MxOmni::GetInstance()->GetWindowHandle(); SDL_Window* window = MxOmni::GetInstance()->GetWindowHandle();
HWND hWnd = (HWND // [library:ddraw]
) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); HWND hWnd =
(HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
if (!hWnd) { if (!hWnd) {
goto done; goto done;
@ -848,7 +849,12 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p
} }
else { else {
MxPoint32 point(0, 0); 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); ClientToScreen(hWnd, (LPPOINT) &point);
p_left2 += m_videoParam.GetRect().GetLeft() + point.GetX(); p_left2 += m_videoParam.GetRect().GetLeft() + point.GetX();

View File

@ -238,7 +238,12 @@ MxResult MxVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS,
goto done; 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) { if (m_pDirectDraw->SetCooperativeLevel(hWnd, DDSCL_NORMAL) != DD_OK) {
goto done; goto done;
} }