mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Drop old cursor code (#509)
This commit is contained in:
parent
920ba63a31
commit
1ae9933bd5
@ -387,15 +387,7 @@ inline void LegoVideoManager::DrawCursor()
|
||||
LPDIRECTDRAWSURFACE ddSurface2 = m_displaySurface->GetDirectDrawSurface2();
|
||||
|
||||
if (!m_cursorSurface) {
|
||||
m_cursorRect.top = 0;
|
||||
m_cursorRect.left = 0;
|
||||
m_cursorRect.bottom = 16;
|
||||
m_cursorRect.right = 16;
|
||||
m_cursorSurface = MxDisplaySurface::CreateCursorSurface();
|
||||
|
||||
if (!m_cursorSurface) {
|
||||
m_drawCursor = FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ddSurface2
|
||||
|
||||
@ -97,7 +97,6 @@ class MxDisplaySurface : public MxCore {
|
||||
); // vtable+0x44
|
||||
|
||||
void ClearScreen();
|
||||
static LPDIRECTDRAWSURFACE CreateCursorSurface();
|
||||
static LPDIRECTDRAWSURFACE CreateCursorSurface(const CursorBitmap* p_cursorBitmap);
|
||||
static LPDIRECTDRAWSURFACE CopySurface(LPDIRECTDRAWSURFACE p_src);
|
||||
|
||||
|
||||
@ -1015,86 +1015,6 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CopySurface(LPDIRECTDRAWSURFACE p_src)
|
||||
return newSurface;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bc070
|
||||
LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface()
|
||||
{
|
||||
LPDIRECTDRAWSURFACE newSurface = NULL;
|
||||
IDirectDraw* draw = MVideoManager()->GetDirectDraw();
|
||||
MVideoManager();
|
||||
|
||||
DDSURFACEDESC ddsd;
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
if (draw->GetDisplayMode(&ddsd) != DD_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ddsd.ddpfPixelFormat.dwRGBBitCount != 16) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ddsd.dwWidth = 16;
|
||||
ddsd.dwHeight = 16;
|
||||
ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK) {
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
if (draw->CreateSurface(&ddsd, &newSurface, NULL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
if (newSurface->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) != DD_OK) {
|
||||
goto done;
|
||||
}
|
||||
else {
|
||||
MxU16* surface = (MxU16*) ddsd.lpSurface;
|
||||
MxLong pitch = ddsd.lPitch;
|
||||
|
||||
// draw a simple cursor to the surface
|
||||
for (MxS32 x = 0; x < 16; x++) {
|
||||
MxU16* surface2 = surface;
|
||||
for (MxS32 y = 0; y < 16; y++) {
|
||||
if ((y > 10 || x) && (x > 10 || y) && x + y != 10) {
|
||||
if (x + y > 10) {
|
||||
*surface2 = RGB555_CREATE(0x1f, 0, 0x1f);
|
||||
}
|
||||
else {
|
||||
*surface2 = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*surface2 = 0;
|
||||
}
|
||||
surface2++;
|
||||
}
|
||||
surface = (MxU16*) ((MxU8*) surface + pitch);
|
||||
}
|
||||
|
||||
newSurface->Unlock(ddsd.lpSurface);
|
||||
DDCOLORKEY colorkey;
|
||||
colorkey.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f);
|
||||
colorkey.dwColorSpaceLowValue = RGB555_CREATE(0x1f, 0, 0x1f);
|
||||
newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey);
|
||||
|
||||
return newSurface;
|
||||
}
|
||||
|
||||
done:
|
||||
if (newSurface) {
|
||||
newSurface->Release();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100bc200
|
||||
void MxDisplaySurface::VTable0x24(
|
||||
LPDDSURFACEDESC p_desc,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user