diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index 066e11d2..a6925e3d 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -45,16 +45,16 @@ public: MxS32 p_width, MxS32 p_height ); // vtable+0x28 - virtual MxBool VTable0x2c( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - MxBool + virtual void VTable0x2c( + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height, + MxBool p_RLE ); // vtable+0x2c virtual void VTable0x30( MxBitmap* p_bitmap, @@ -64,7 +64,7 @@ public: MxS32 p_bottom, MxS32 p_width, MxS32 p_height, - MxBool p_und + MxBool p_RLE ); // vtable+0x30 virtual undefined4 VTable0x34( undefined4, diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index d22c059b..2d179d01 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -491,7 +491,7 @@ void MxDisplaySurface::VTable0x30( MxS32 p_bottom, MxS32 p_width, MxS32 p_height, - MxBool p_und + MxBool p_RLE ) { if (!GetRectIntersection( @@ -527,7 +527,7 @@ void MxDisplaySurface::VTable0x30( switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { case 8: { MxU8* surface = (MxU8*) ddsd.lpSurface + p_right + (p_bottom * ddsd.lPitch); - if (p_und) { + if (p_RLE) { MxS32 size = p_bitmap->GetBmiHeader()->biSizeImage; DrawTransparentRLE(data, surface, size, p_width, p_height, ddsd.lPitch, 8); } @@ -553,7 +553,7 @@ void MxDisplaySurface::VTable0x30( } case 16: { MxU8* surface = (MxU8*) ddsd.lpSurface + (2 * p_right) + (p_bottom * ddsd.lPitch); - if (p_und) { + if (p_RLE) { MxS32 size = p_bitmap->GetBmiHeader()->biSizeImage; DrawTransparentRLE(data, surface, size, p_width, p_height, ddsd.lPitch, 16); } @@ -1212,20 +1212,85 @@ void MxDisplaySurface::VTable0x24( } } -// STUB: LEGO1 0x100bc630 -MxBool MxDisplaySurface::VTable0x2c( - LPDDSURFACEDESC, - MxBitmap*, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - undefined4, - MxBool +// FUNCTION: LEGO1 0x100bc630 +void MxDisplaySurface::VTable0x2c( + LPDDSURFACEDESC p_desc, + MxBitmap* p_bitmap, + MxS32 p_left, + MxS32 p_top, + MxS32 p_right, + MxS32 p_bottom, + MxS32 p_width, + MxS32 p_height, + MxBool p_RLE ) { - return 0; + // DECOMP: Almost an exact copy of VTable0x28, except that it uses the argument DDSURFACEDESC + // instead of getting one from GetDisplayMode. + if (!GetRectIntersection( + p_bitmap->GetBmiWidth(), + p_bitmap->GetBmiHeightAbs(), + m_videoParam.GetRect().GetWidth(), + m_videoParam.GetRect().GetHeight(), + &p_left, + &p_top, + &p_right, + &p_bottom, + &p_width, + &p_height + )) { + return; + } + + MxU8* src = p_bitmap->GetStart(p_left, p_top); + + switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { + case 8: { + MxLong destStride = p_desc->lPitch; + MxU8* dest = (MxU8*) p_desc->lpSurface + p_right + (p_bottom * p_desc->lPitch); + + if (p_RLE) { + DrawTransparentRLE(src, dest, p_bitmap->GetBmiHeader()->biSizeImage, p_width, p_height, p_desc->lPitch, 8); + } + else { + MxLong srcSkip = GetAdjustedStride(p_bitmap) - p_width; + MxLong destSkip = destStride - p_width; + + for (MxS32 i = 0; i < p_height; i++, src += srcSkip, dest += destSkip) { + for (MxS32 j = 0; j < p_width; j++, src++, dest++) { + if (*src) { + *dest = *src; + } + } + } + } + break; + } + case 16: { + MxLong destStride = p_desc->lPitch; + MxU8* dest = (MxU8*) p_desc->lpSurface + (2 * p_right) + (p_bottom * p_desc->lPitch); + + if (p_RLE) { + DrawTransparentRLE(src, dest, p_bitmap->GetBmiHeader()->biSizeImage, p_width, p_height, p_desc->lPitch, 16); + } + else { + MxLong srcStride = GetAdjustedStride(p_bitmap); + MxLong srcSkip = srcStride - p_width; + MxLong destSkip = destStride - 2 * p_width; + + for (MxS32 i = 0; i < p_height; i++, src += srcSkip, dest += destSkip) { + for (MxS32 j = 0; j < p_width; j++, src++, dest += 2) { + if (*src != 0) { + *(MxU16*) dest = m_16bitPal[*src]; + } + } + } + } + break; + } + default: + break; + } } // FUNCTION: LEGO1 0x100bc8b0 diff --git a/tools/ncc/skip.yml b/tools/ncc/skip.yml index 4f39ddc8..06c6e0a5 100644 --- a/tools/ncc/skip.yml +++ b/tools/ncc/skip.yml @@ -13,6 +13,7 @@ m_HELDesc: 'Allow this variable name' p_HWDesc: 'Allow this variable name' p_HELDesc: 'Allow this variable name' e_RAMStream: 'Allow this enum constant' +p_RLE: 'Allow this parameter name' p_milliseconds: 'Probably a bug with function call' m_increaseAmount: "Can't currently detect member in union" m_increaseFactor: "Can't currently detect member in union"