mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 08:54:15 +00:00
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy
* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def
* Add initial .clang-tidy and fixes
* fix file perms
* Comment out DESCRIPTION
* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def
* Looks like clang is allergic to the libs in the directx5 SDK
* Update .clang-tidy
* Fix typo in .clang-tidy
* Attempt to generate an action error
* Revert "Attempt to generate an action error"
This reverts commit 96c4c65fed.
* cmake: test with -Wparentheses + optionally with -Werror
* ci: -k0 is a Ninja argument
* Use -Werror only for msys2 builds
* cmake: only emit warnings for specific warnings
* cmake: and don't do -Werror/-WX anymore
* Fix warnings
* Fix mingw warnings
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
committed by
GitHub
parent
97d1ba7c71
commit
9e686e2a87
@@ -50,8 +50,9 @@ LegoVideoManager::~LegoVideoManager()
|
||||
// FUNCTION: LEGO1 0x1007abb0
|
||||
MxResult LegoVideoManager::CreateDirect3D()
|
||||
{
|
||||
if (!m_direct3d)
|
||||
if (!m_direct3d) {
|
||||
m_direct3d = new MxDirect3D;
|
||||
}
|
||||
|
||||
return m_direct3d ? SUCCESS : FAILURE;
|
||||
}
|
||||
@@ -77,25 +78,29 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
MxPalette* palette = new MxPalette;
|
||||
p_videoParam.SetPalette(palette);
|
||||
|
||||
if (!palette)
|
||||
if (!palette) {
|
||||
goto done;
|
||||
}
|
||||
paletteCreated = TRUE;
|
||||
}
|
||||
|
||||
PALETTEENTRY paletteEntries[256];
|
||||
p_videoParam.GetPalette()->GetEntries(paletteEntries);
|
||||
|
||||
if (CreateDirect3D() != SUCCESS)
|
||||
if (CreateDirect3D() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (deviceEnumerate.DoEnumerate() != SUCCESS)
|
||||
if (deviceEnumerate.DoEnumerate() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_videoParam.GetDeviceName()) {
|
||||
deviceNum = deviceEnumerate.ParseDeviceName(p_videoParam.GetDeviceName());
|
||||
if (deviceNum >= 0) {
|
||||
if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS)
|
||||
if ((deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device)) != SUCCESS) {
|
||||
deviceNum = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,10 +112,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
|
||||
m_direct3d->SetDevice(deviceEnumerate, driver, device);
|
||||
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2)
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2) {
|
||||
p_videoParam.Flags().SetF2bit0(TRUE);
|
||||
else
|
||||
}
|
||||
else {
|
||||
p_videoParam.Flags().SetF2bit0(FALSE);
|
||||
}
|
||||
|
||||
ViewROI::SetUnk101013d8(p_videoParam.Flags().GetF2bit0() == FALSE);
|
||||
|
||||
@@ -124,8 +131,9 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
bits,
|
||||
paletteEntries,
|
||||
sizeof(paletteEntries) / sizeof(paletteEntries[0])
|
||||
))
|
||||
)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (MxVideoManager::VTable0x28(
|
||||
p_videoParam,
|
||||
@@ -136,18 +144,21 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
m_direct3d->GetClipper(),
|
||||
p_frequencyMS,
|
||||
p_createThread
|
||||
) != SUCCESS)
|
||||
) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_renderer = Tgl::CreateRenderer();
|
||||
|
||||
if (!m_renderer)
|
||||
if (!m_renderer) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_3dManager = new Lego3DManager;
|
||||
|
||||
if (!m_3dManager)
|
||||
if (!m_3dManager) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
Lego3DManager::CreateStruct createStruct;
|
||||
memset(&createStruct, 0, sizeof(createStruct));
|
||||
@@ -161,13 +172,15 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
createStruct.m_direct3d = m_direct3d->GetDirect3D();
|
||||
createStruct.m_d3dDevice = m_direct3d->GetDirect3DDevice();
|
||||
|
||||
if (!m_3dManager->Create(createStruct))
|
||||
if (!m_3dManager->Create(createStruct)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
ViewLODList* pLODList;
|
||||
|
||||
if (ConfigureD3DRM() != SUCCESS)
|
||||
if (ConfigureD3DRM() != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
pLODList = m_3dManager->GetViewLODListManager()->Create("CameraROI", 1);
|
||||
m_viewROI = new LegoROI(m_renderer, pLODList, Timer()->GetTime());
|
||||
@@ -219,19 +232,22 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
|
||||
m_cursorY = p_cursorY;
|
||||
m_drawCursor = TRUE;
|
||||
|
||||
if (623 < p_cursorX)
|
||||
if (623 < p_cursorX) {
|
||||
m_cursorX = 623;
|
||||
}
|
||||
|
||||
if (463 < p_cursorY)
|
||||
if (463 < p_cursorY) {
|
||||
m_cursorY = 463;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1007b770
|
||||
MxResult LegoVideoManager::Tickle()
|
||||
{
|
||||
if (m_unk0x554 && !m_videoParam.Flags().GetFlipSurfaces() &&
|
||||
TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning)
|
||||
TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning) {
|
||||
Sleep(30);
|
||||
}
|
||||
|
||||
m_stopWatch->Stop();
|
||||
m_elapsedSeconds = m_stopWatch->ElapsedSeconds();
|
||||
@@ -245,11 +261,13 @@ MxResult LegoVideoManager::Tickle()
|
||||
MxPresenter* presenter;
|
||||
MxPresenterListCursor cursor(m_presenters);
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->Tickle();
|
||||
}
|
||||
|
||||
if (m_render3d && !m_paused)
|
||||
if (m_render3d && !m_paused) {
|
||||
m_3dManager->GetLego3DView()->GetView()->Clear();
|
||||
}
|
||||
|
||||
MxRect32 rect(0, 0, m_videoParam.GetRect().GetWidth() - 1, m_videoParam.GetRect().GetHeight() - 1);
|
||||
InvalidateRect(rect);
|
||||
@@ -257,8 +275,9 @@ MxResult LegoVideoManager::Tickle()
|
||||
if (!m_paused && (m_render3d || m_unk0xe5)) {
|
||||
cursor.Reset();
|
||||
|
||||
while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0)
|
||||
while (cursor.Next(presenter) && presenter->GetDisplayZ() >= 0) {
|
||||
presenter->PutData();
|
||||
}
|
||||
|
||||
if (!m_unk0xe5) {
|
||||
m_3dManager->Render(0.0);
|
||||
@@ -267,21 +286,25 @@ MxResult LegoVideoManager::Tickle()
|
||||
|
||||
cursor.Prev();
|
||||
|
||||
while (cursor.Next(presenter))
|
||||
while (cursor.Next(presenter)) {
|
||||
presenter->PutData();
|
||||
}
|
||||
|
||||
if (m_drawCursor)
|
||||
if (m_drawCursor) {
|
||||
DrawCursor();
|
||||
}
|
||||
|
||||
if (m_drawFPS)
|
||||
if (m_drawFPS) {
|
||||
DrawFPS();
|
||||
}
|
||||
}
|
||||
else if (m_fullScreenMovie) {
|
||||
MxPresenter* presenter;
|
||||
MxPresenterListCursor cursor(m_presenters);
|
||||
|
||||
if (cursor.Last(presenter))
|
||||
if (cursor.Last(presenter)) {
|
||||
presenter->PutData();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_paused) {
|
||||
@@ -316,8 +339,9 @@ inline void LegoVideoManager::DrawCursor()
|
||||
m_cursorRect.right = 16;
|
||||
m_cursorSurface = MxDisplaySurface::CreateCursorSurface();
|
||||
|
||||
if (!m_cursorSurface)
|
||||
if (!m_cursorSurface) {
|
||||
m_drawCursor = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ddSurface2
|
||||
@@ -467,19 +491,22 @@ MxResult LegoVideoManager::ConfigureD3DRM()
|
||||
IDirect3DRMDevice2* d3drm =
|
||||
((TglImpl::DeviceImpl*) m_3dManager->GetLego3DView()->GetDevice())->ImplementationData();
|
||||
|
||||
if (!d3drm)
|
||||
if (!d3drm) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxAssignedDevice* assignedDevice = m_direct3d->GetAssignedDevice();
|
||||
|
||||
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) {
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) {
|
||||
d3drm->SetTextureQuality(D3DRMTEXTURE_LINEAR);
|
||||
}
|
||||
|
||||
d3drm->SetDither(TRUE);
|
||||
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND)
|
||||
if (assignedDevice->GetDesc().dpcTriCaps.dwShadeCaps & D3DPSHADECAPS_ALPHAFLATBLEND) {
|
||||
d3drm->SetRenderMode(D3DRMRENDERMODE_BLENDEDTRANSPARENCY);
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user