mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
clang-format
This commit is contained in:
parent
f58d4e45e9
commit
69f0ddaafc
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
#ifndef LEGOMAIN_H
|
||||
#define LEGOMAIN_H
|
||||
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include "compat.h"
|
||||
#include "lego1_export.h"
|
||||
#include "legoutils.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
#include <SDL3/SDL_events.h>
|
||||
|
||||
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'
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#define DS_NOT_A_STREAM -1
|
||||
|
||||
struct LegoSdlEvents {
|
||||
Uint32 windows_message;
|
||||
Uint32 windows_message;
|
||||
};
|
||||
|
||||
LEGO1_EXPORT extern LegoSdlEvents g_LegoSdlEvents;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#include <limits.h> // ULONG_MAX
|
||||
#include <math.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <limits.h> // ULONG_MAX
|
||||
#include <math.h>
|
||||
#include <windows.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -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
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user