This commit is contained in:
Christian Semmler 2024-12-23 11:05:09 -07:00
parent dcbcf7a8a4
commit 5994df1407

View File

@ -1,6 +1,7 @@
#include "mxdisplaysurface.h" #include "mxdisplaysurface.h"
#include "mxbitmap.h" #include "mxbitmap.h"
#include "mxdebug.h"
#include "mxmisc.h" #include "mxmisc.h"
#include "mxomni.h" #include "mxomni.h"
#include "mxpalette.h" #include "mxpalette.h"
@ -740,65 +741,74 @@ void MxDisplaySurface::DrawTransparentRLE(
} }
// FUNCTION: LEGO1 0x100bb850 // FUNCTION: LEGO1 0x100bb850
void MxDisplaySurface::VTable0x34(MxU8 *p_pixels, MxS32 p_bpp, MxS32 p_width, MxS32 p_height, MxS32 p_x, MxS32 p_y) // FUNCTION: BETA10 0x10141191
void MxDisplaySurface::VTable0x34(MxU8* p_pixels, MxS32 p_bpp, MxS32 p_width, MxS32 p_height, MxS32 p_x, MxS32 p_y)
{ {
DDSURFACEDESC surfaceDesc; DDSURFACEDESC surfaceDesc;
memset(&surfaceDesc, 0, sizeof(surfaceDesc)); memset(&surfaceDesc, 0, sizeof(surfaceDesc));
surfaceDesc.dwSize = sizeof(surfaceDesc); surfaceDesc.dwSize = sizeof(surfaceDesc);
HRESULT result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL);
if (result == DDERR_SURFACELOST) { HRESULT result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL);
m_ddSurface2->Restore();
result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL); if (result == DDERR_SURFACELOST) {
} m_ddSurface2->Restore();
if (result != DD_OK) { result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL);
return; }
}
int dst_bitcount = m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount; if (result == DD_OK) {
switch (dst_bitcount) { MxU8* pixels = p_pixels;
case 8:
if (p_bpp == 16) { switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) {
// BUG: should go to end of function and unlock m_ddSurface2 case 8: {
return; if (p_bpp == 16) {
} else { MxTrace("16 bit source to 8 bit display NOT_IMPLEMENTED");
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + p_x; assert(0);
MxU8 *src = p_pixels; return;
while (p_height != 0) { }
p_height--;
memcpy(dst, src, p_width); MxU8* dst = (MxU8*) surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + p_x;
src += p_width; MxLong stride = p_width;
dst += surfaceDesc.lPitch; MxLong length = surfaceDesc.lPitch;
}
} while (p_height--) {
break; memcpy(dst, pixels, p_width);
case 16: pixels += stride;
switch (p_bpp) { dst += length;
case 16: { }
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + 2 * p_x; break;
MxU8 *src = p_pixels; }
while (p_height != 0) { case 16: {
p_height--; if (p_bpp == 16) {
memcpy(dst, src, 2 * p_width); MxU8* dst = (MxU8*) surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + p_x;
src += 2 * p_width; MxLong stride = p_width * 2;
dst += surfaceDesc.lPitch; MxLong length = surfaceDesc.lPitch;
}
break; while (p_height--) {
} memcpy(dst, pixels, 2 * p_width);
case 8: { pixels += stride;
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + 2 * p_x; dst += length;
MxU8 *src = p_pixels; }
for (MxS32 i = 0; i < p_height; src += p_width, dst += surfaceDesc.lPitch, i++) { }
for (MxS32 j = 0; j < p_width; dst += 2, src += 1, j++) { else if (p_bpp == 8) {
*(MxU16 *) dst = m_16bitPal[*src]; MxU8* dst = (MxU8*) surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + 2 * p_x;
} MxLong stride = p_width * 2;
} MxLong length = -2 * p_width + surfaceDesc.lPitch;
break;
} for (MxS32 i = 0; i < p_height; i++) {
default: for (MxS32 j = 0; j < p_width; j++) {
break; *(MxU16*) dst = m_16bitPal[*pixels++];
} dst += 2;
break; }
}
m_ddSurface2->Unlock(surfaceDesc.lpSurface); pixels += stride;
dst += length;
}
}
}
}
m_ddSurface2->Unlock(surfaceDesc.lpSurface);
}
} }
// FUNCTION: LEGO1 0x100bba50 // FUNCTION: LEGO1 0x100bba50