From 41604832cf388455adfb6859cf1fc070e89fddcf Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Wed, 5 Jul 2023 04:33:02 +0200 Subject: [PATCH] improve accuracy --- LEGO1/mxdirectdraw.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/LEGO1/mxdirectdraw.cpp b/LEGO1/mxdirectdraw.cpp index 5a6f35fa..57715619 100644 --- a/LEGO1/mxdirectdraw.cpp +++ b/LEGO1/mxdirectdraw.cpp @@ -875,9 +875,8 @@ BOOL MxDirectDraw::GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSU BOOL MxDirectDraw::IsSupportedMode(int width, int height, int bpp) { Mode mode = { width, height, bpp }; - int i; - for (i = 0; i < m_pCurrentDeviceModesList->count; i++) + for (int i = 0; i < m_pCurrentDeviceModesList->count; i++) { if (m_pCurrentDeviceModesList->m_mode_ARRAY[i] == mode) { @@ -1154,11 +1153,10 @@ void MxDirectDraw::unk1() HRESULT result; byte* line; DDSURFACEDESC ddsd; - int i; - unsigned int j; + int j; int count = m_bFlipSurfaces ? 2 : 1; - for (i = 0; count > i; i++) + for (int i = 0; i < count; i++) { memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -1178,10 +1176,10 @@ void MxDirectDraw::unk1() // clear backBuffer line = (byte*)ddsd.lpSurface; - for (j = ddsd.dwHeight - 1; j ; j--) + for (j = ddsd.dwHeight; j-- ;) { - memset(line, 0, ddsd.dwWidth); - line += ddsd.lPitch; + memset(line, 0, ddsd.dwWidth); + line += ddsd.lPitch; } m_pBackBuffer->Unlock(ddsd.lpSurface);