mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Supporting items for SetupCopyRect() (#177)
* Minor improvements all related to SetupCopyRect * Rename inline getters. malloc/free -> new/delete * MxTypes in TransitionManager. Remove stub marker (oops)
This commit is contained in:
@@ -29,7 +29,7 @@ MxTransitionManager::MxTransitionManager()
|
||||
// OFFSET: LEGO1 0x1004ba00
|
||||
MxTransitionManager::~MxTransitionManager()
|
||||
{
|
||||
free(m_copyBuffer);
|
||||
delete[] m_copyBuffer;
|
||||
|
||||
if (m_waitIndicator != NULL) {
|
||||
delete m_waitIndicator->GetAction();
|
||||
@@ -324,17 +324,17 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
|
||||
}
|
||||
|
||||
// Copy the copy rect onto the surface
|
||||
char *dst;
|
||||
MxU8 *dst;
|
||||
|
||||
DWORD bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
const char *src = (const char *)m_copyBuffer;
|
||||
const MxU8 *src = (const MxU8 *)m_copyBuffer;
|
||||
|
||||
LONG copyPitch;
|
||||
MxS32 copyPitch;
|
||||
copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel;
|
||||
|
||||
LONG y;
|
||||
dst = (char *)ddsc->lpSurface + (ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
|
||||
MxS32 y;
|
||||
dst = (MxU8 *)ddsc->lpSurface + (ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
|
||||
|
||||
for (y = 0; y < m_copyRect.bottom - m_copyRect.top + 1; ++y) {
|
||||
memcpy(dst, src, copyPitch);
|
||||
@@ -343,7 +343,7 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
|
||||
}
|
||||
|
||||
// Free the copy buffer
|
||||
free(m_copyBuffer);
|
||||
delete[] m_copyBuffer;
|
||||
m_copyBuffer = NULL;
|
||||
}
|
||||
|
||||
@@ -361,11 +361,11 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
|
||||
// Check if wait indicator has started
|
||||
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
|
||||
// Setup the copy rect
|
||||
DWORD copyPitch = (ddsc->ddpfPixelFormat.dwRGBBitCount / 8) * (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
|
||||
DWORD bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
MxU32 copyPitch = (ddsc->ddpfPixelFormat.dwRGBBitCount / 8) * (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
|
||||
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
|
||||
|
||||
m_copyRect.left = m_waitIndicator->GetLocation().m_x;
|
||||
m_copyRect.top = m_waitIndicator->GetLocation().m_y;
|
||||
m_copyRect.left = m_waitIndicator->GetLocationX();
|
||||
m_copyRect.top = m_waitIndicator->GetLocationY();
|
||||
|
||||
MxS32 height = m_waitIndicator->GetHeight();
|
||||
MxS32 width = m_waitIndicator->GetWidth();
|
||||
@@ -374,14 +374,14 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
|
||||
m_copyRect.bottom = m_copyRect.top + height - 1;
|
||||
|
||||
// Allocate the copy buffer
|
||||
const char *src = (const char*)ddsc->lpSurface + m_copyRect.top * ddsc->lPitch + bytesPerPixel * m_copyRect.left;
|
||||
const MxU8 *src = (const MxU8*)ddsc->lpSurface + m_copyRect.top * ddsc->lPitch + bytesPerPixel * m_copyRect.left;
|
||||
|
||||
m_copyBuffer = malloc(bytesPerPixel * width * height);
|
||||
m_copyBuffer = new MxU8[bytesPerPixel * width * height];
|
||||
if (!m_copyBuffer)
|
||||
return;
|
||||
|
||||
// Copy into the copy buffer
|
||||
char *dst = (char*)m_copyBuffer;
|
||||
MxU8 *dst = m_copyBuffer;
|
||||
|
||||
for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++)
|
||||
{
|
||||
@@ -396,11 +396,11 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
|
||||
{
|
||||
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
|
||||
MxBool unkbool = FALSE;
|
||||
displaySurface->vtable2c(ddsc, m_waitIndicator->m_unk50, 0, 0, m_waitIndicator->GetLocation().m_x, m_waitIndicator->GetLocation().m_y, m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight(), unkbool);
|
||||
displaySurface->vtable2c(ddsc, m_waitIndicator->m_bitmap, 0, 0, m_waitIndicator->GetLocationX(), m_waitIndicator->GetLocationY(), m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight(), unkbool);
|
||||
}
|
||||
else
|
||||
{
|
||||
MxDisplaySurface *displaySurface = VideoManager()->GetDisplaySurface();
|
||||
displaySurface->vtable24(ddsc, m_waitIndicator->m_unk50, 0, 0, m_waitIndicator->GetLocation().m_x, m_waitIndicator->GetLocation().m_y, m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight());
|
||||
displaySurface->vtable24(ddsc, m_waitIndicator->m_bitmap, 0, 0, m_waitIndicator->GetLocationX(), m_waitIndicator->GetLocationY(), m_waitIndicator->GetWidth(), m_waitIndicator->GetHeight());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user