mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-21 07:11:16 +00:00
Implement MxDisplaySurface::VTable0x34
This commit is contained in:
parent
1b99d75543
commit
dcbcf7a8a4
@ -66,13 +66,13 @@ class MxDisplaySurface : public MxCore {
|
|||||||
MxS32 p_height,
|
MxS32 p_height,
|
||||||
MxBool p_RLE
|
MxBool p_RLE
|
||||||
); // vtable+0x30
|
); // vtable+0x30
|
||||||
virtual undefined4 VTable0x34(
|
virtual void VTable0x34(
|
||||||
undefined4,
|
MxU8* p_pixels,
|
||||||
undefined4,
|
MxS32 p_bpp,
|
||||||
undefined4,
|
MxS32 p_width,
|
||||||
undefined4,
|
MxS32 p_height,
|
||||||
undefined4,
|
MxS32 p_x,
|
||||||
undefined4
|
MxS32 p_y
|
||||||
); // vtable+0x34
|
); // vtable+0x34
|
||||||
virtual void Display(
|
virtual void Display(
|
||||||
MxS32 p_left,
|
MxS32 p_left,
|
||||||
|
|||||||
@ -739,10 +739,66 @@ void MxDisplaySurface::DrawTransparentRLE(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100bb850
|
// FUNCTION: LEGO1 0x100bb850
|
||||||
undefined4 MxDisplaySurface::VTable0x34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4)
|
void MxDisplaySurface::VTable0x34(MxU8 *p_pixels, MxS32 p_bpp, MxS32 p_width, MxS32 p_height, MxS32 p_x, MxS32 p_y)
|
||||||
{
|
{
|
||||||
return 0;
|
DDSURFACEDESC surfaceDesc;
|
||||||
|
memset(&surfaceDesc, 0, sizeof(surfaceDesc));
|
||||||
|
surfaceDesc.dwSize = sizeof(surfaceDesc);
|
||||||
|
HRESULT result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL);
|
||||||
|
if (result == DDERR_SURFACELOST) {
|
||||||
|
m_ddSurface2->Restore();
|
||||||
|
result = m_ddSurface2->Lock(NULL, &surfaceDesc, DDLOCK_WAIT, NULL);
|
||||||
|
}
|
||||||
|
if (result != DD_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int dst_bitcount = m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount;
|
||||||
|
switch (dst_bitcount) {
|
||||||
|
case 8:
|
||||||
|
if (p_bpp == 16) {
|
||||||
|
// BUG: should go to end of function and unlock m_ddSurface2
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + p_x;
|
||||||
|
MxU8 *src = p_pixels;
|
||||||
|
while (p_height != 0) {
|
||||||
|
p_height--;
|
||||||
|
memcpy(dst, src, p_width);
|
||||||
|
src += p_width;
|
||||||
|
dst += surfaceDesc.lPitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
switch (p_bpp) {
|
||||||
|
case 16: {
|
||||||
|
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + 2 * p_x;
|
||||||
|
MxU8 *src = p_pixels;
|
||||||
|
while (p_height != 0) {
|
||||||
|
p_height--;
|
||||||
|
memcpy(dst, src, 2 * p_width);
|
||||||
|
src += 2 * p_width;
|
||||||
|
dst += surfaceDesc.lPitch;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: {
|
||||||
|
MxU8 *dst = (MxU8 *)surfaceDesc.lpSurface + p_y * surfaceDesc.lPitch + 2 * p_x;
|
||||||
|
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++) {
|
||||||
|
*(MxU16 *) dst = m_16bitPal[*src];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_ddSurface2->Unlock(surfaceDesc.lpSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100bba50
|
// FUNCTION: LEGO1 0x100bba50
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user