Match MxDisplaySurface::FUN_100ba640

This commit is contained in:
Christian Semmler 2023-12-21 10:13:07 -05:00
parent 2f783c57a1
commit c2f853998e

View File

@ -31,19 +31,18 @@ void MxDisplaySurface::Reset()
// FUNCTION: LEGO1 0x100ba640 // FUNCTION: LEGO1 0x100ba640
void MxDisplaySurface::FUN_100ba640() void MxDisplaySurface::FUN_100ba640()
{ {
int backbuffers; MxS32 backBuffers;
DDSURFACEDESC desc; DDSURFACEDESC desc;
HRESULT hr; HRESULT hr;
int height;
if (!m_videoParam.Flags().GetFlipSurfaces()) { if (!m_videoParam.Flags().GetFlipSurfaces()) {
backbuffers = 1; backBuffers = 1;
} }
else { else {
backbuffers = m_videoParam.GetBackBuffers() + 1; backBuffers = m_videoParam.GetBackBuffers() + 1;
} }
for (MxU32 i = 0; i < backbuffers; i++) { for (MxS32 i = 0; i < backBuffers; i++) {
memset(&desc, 0, sizeof(DDSURFACEDESC)); memset(&desc, 0, sizeof(DDSURFACEDESC));
desc.dwSize = sizeof(DDSURFACEDESC); desc.dwSize = sizeof(DDSURFACEDESC);
@ -58,18 +57,11 @@ void MxDisplaySurface::FUN_100ba640()
} }
MxU8* surface = (MxU8*) desc.lpSurface; MxU8* surface = (MxU8*) desc.lpSurface;
height = m_videoParam.GetRect().GetBottom() - m_videoParam.GetRect().GetTop(); MxS32 height = m_videoParam.GetRect().GetHeight();
if (height != -1) {
do {
memset(
surface,
0,
(m_videoParam.GetRect().GetRight() - m_videoParam.GetRect().GetLeft() + 1) *
desc.ddpfPixelFormat.dwRGBBitCount
);
surface += desc.lPitch; while (height--) {
} while (height--); memset(surface, 0, m_videoParam.GetRect().GetWidth() * desc.ddpfPixelFormat.dwRGBBitCount / 8);
surface += desc.lPitch;
} }
m_ddSurface2->Unlock(desc.lpSurface); m_ddSurface2->Unlock(desc.lpSurface);