From b9a53ecf7764e95b803db3298fe3d475198e96a9 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Wed, 10 Jan 2024 15:51:05 -0500 Subject: [PATCH] Update mxdisplaysurface.cpp --- LEGO1/omni/src/video/mxdisplaysurface.cpp | 71 ++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index e05b0816..4824c87b 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -569,9 +569,78 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44(MxBitmap*, undefined4*, undefin return NULL; } -// STUB: LEGO1 0x100bc070 +// FUNCTION: LEGO1 0x100bc070 LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bc070() { + LPDIRECTDRAWSURFACE newSurface = NULL; + IDirectDraw* draw = MVideoManager()->GetDirectDraw(); + MVideoManager(); + + DDSURFACEDESC ddsd; + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + if (draw->GetDisplayMode(&ddsd) != S_OK) { + return NULL; + } + + if (ddsd.ddpfPixelFormat.dwRGBBitCount != 16) { + return NULL; + } + + ddsd.dwWidth = 16; + ddsd.dwHeight = 16; + ddsd.dwFlags = 4103; + ddsd.ddsCaps.dwCaps = 16448; + + if (draw->CreateSurface(&ddsd, &newSurface, NULL) == S_OK) { + ddsd.ddsCaps.dwCaps &= ~0x4000; + ddsd.ddsCaps.dwCaps |= 0x800; + if (draw->CreateSurface(&ddsd, &newSurface, NULL) == S_OK) { + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + if (newSurface->Lock(NULL, &ddsd, 1, NULL) != S_OK) { + if (newSurface) { + newSurface->Release(); + } + + return NULL; + } + else { + MxU8* surface = (MxU8*) ddsd.lpSurface; + + for (MxU32 x = 0; x < 16; x++) { + + MxU8* surface2 = surface; + for (MxU32 y = 0; y < 16; y++) { + for (y = 0; y < 16; ++y) { + if ((y > 10 || x) && (x > 10 || y) && x + y != 10) { + if (x + y <= 10) + *surface2 = -1; + else + *surface2 = 31775; + } + else { + *surface2 = 0; + } + surface2++; + } + } + surface += ddsd.lPitch; + } + + newSurface->Unlock(ddsd.lpSurface); + DDCOLORKEY colorkey; + colorkey.dwColorSpaceHighValue = 31775; + colorkey.dwColorSpaceLowValue = 31775; + newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey); + + return newSurface; + } + } + } + return NULL; }