More fixes

This commit is contained in:
Christian Semmler 2023-12-12 11:45:37 -05:00
parent 71335281a2
commit 7ded9d0263
26 changed files with 224 additions and 214 deletions

View File

@ -54,7 +54,7 @@ IsleApp::IsleApp()
m_windowActive = 1; m_windowActive = 1;
m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags());
m_videoParam.flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_videoParam.Flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16);
m_windowHandle = NULL; m_windowHandle = NULL;
m_cursorArrow = NULL; m_cursorArrow = NULL;
@ -157,19 +157,19 @@ void IsleApp::SetupVideoFlags(
char* deviceId char* deviceId
) )
{ {
m_videoParam.flags().SetFullScreen(fullScreen); m_videoParam.Flags().SetFullScreen(fullScreen);
m_videoParam.flags().SetFlipSurfaces(flipSurfaces); m_videoParam.Flags().SetFlipSurfaces(flipSurfaces);
m_videoParam.flags().SetBackBuffers(!backBuffers); m_videoParam.Flags().SetBackBuffers(!backBuffers);
m_videoParam.flags().Set_f2bit0(!param_6); m_videoParam.Flags().SetF2bit0(!param_6);
m_videoParam.flags().Set_f1bit7(param_7); m_videoParam.Flags().SetF1bit7(param_7);
m_videoParam.flags().SetWideViewAngle(wideViewAngle); m_videoParam.Flags().SetWideViewAngle(wideViewAngle);
m_videoParam.flags().Set_f2bit1(1); m_videoParam.Flags().SetF2bit1(1);
m_videoParam.SetDeviceName(deviceId); m_videoParam.SetDeviceName(deviceId);
if (using8bit) { if (using8bit) {
m_videoParam.flags().Set16Bit(0); m_videoParam.Flags().Set16Bit(0);
} }
if (using16bit) { if (using16bit) {
m_videoParam.flags().Set16Bit(1); m_videoParam.Flags().Set16Bit(1);
} }
} }

View File

@ -66,7 +66,7 @@ void LegoNavController::SetControlMax(int p_hMax, int p_vMax)
this->m_hMax = p_hMax; this->m_hMax = p_hMax;
this->m_vMax = p_vMax; this->m_vMax = p_vMax;
if (VideoManager()->GetVideoParam().flags().GetFullScreen()) { if (VideoManager()->GetVideoParam().Flags().GetFullScreen()) {
this->m_hMax = 640; this->m_hMax = 640;
this->m_vMax = 480; this->m_vMax = 480;
} }

View File

@ -70,10 +70,10 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
this->m_initialized = TRUE; this->m_initialized = TRUE;
this->m_videoParam = p_videoParam; this->m_videoParam = p_videoParam;
if (!this->m_videoParam.flags().GetFullScreen()) if (!this->m_videoParam.Flags().GetFullScreen())
this->m_videoParam.flags().SetFlipSurfaces(FALSE); this->m_videoParam.Flags().SetFlipSurfaces(FALSE);
if (!this->m_videoParam.flags().GetFlipSurfaces()) { if (!this->m_videoParam.Flags().GetFlipSurfaces()) {
this->m_videoParam.SetBackBuffers(1); this->m_videoParam.SetBackBuffers(1);
} }
else { else {
@ -84,10 +84,10 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
else if (backBuffers > 2) else if (backBuffers > 2)
this->m_videoParam.SetBackBuffers(2); this->m_videoParam.SetBackBuffers(2);
this->m_videoParam.flags().SetBackBuffers(TRUE); this->m_videoParam.Flags().SetBackBuffers(TRUE);
} }
if (this->m_videoParam.flags().GetFullScreen()) { if (this->m_videoParam.Flags().GetFullScreen()) {
MxS32 width = this->m_videoParam.GetRect().GetWidth(); MxS32 width = this->m_videoParam.GetRect().GetWidth();
MxS32 height = this->m_videoParam.GetRect().GetHeight(); MxS32 height = this->m_videoParam.GetRect().GetHeight();
@ -100,7 +100,7 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
if (lpDirectDraw->GetDisplayMode(&ddsd)) if (lpDirectDraw->GetDisplayMode(&ddsd))
goto done; goto done;
MxS32 bitdepth = !this->m_videoParam.flags().Get16Bit() ? 8 : 16; MxS32 bitdepth = !this->m_videoParam.Flags().Get16Bit() ? 8 : 16;
if (ddsd.dwWidth != width || ddsd.dwHeight != height || ddsd.ddpfPixelFormat.dwRGBBitCount != bitdepth) { if (ddsd.dwWidth != width || ddsd.dwHeight != height || ddsd.ddpfPixelFormat.dwRGBBitCount != bitdepth) {
if (lpDirectDraw->SetDisplayMode(width, height, bitdepth)) if (lpDirectDraw->SetDisplayMode(width, height, bitdepth))
@ -108,7 +108,7 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
} }
} }
if (this->m_videoParam.flags().GetFlipSurfaces()) { if (this->m_videoParam.Flags().GetFlipSurfaces()) {
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwBackBufferCount = this->m_videoParam.GetBackBuffers(); ddsd.dwBackBufferCount = this->m_videoParam.GetBackBuffers();
@ -139,7 +139,7 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam)
ddsd.dwHeight = this->m_videoParam.GetRect().GetHeight(); ddsd.dwHeight = this->m_videoParam.GetRect().GetHeight();
ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN; ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN;
if (!this->m_videoParam.flags().GetBackBuffers()) if (!this->m_videoParam.Flags().GetBackBuffers())
ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL)) if (lpDirectDraw->CreateSurface(&ddsd, &this->m_ddSurface2, NULL))

View File

@ -21,7 +21,7 @@ class MxTickleClient {
inline void SetLastUpdateTime(MxTime p_lastUpdateTime) { m_lastUpdateTime = p_lastUpdateTime; } inline void SetLastUpdateTime(MxTime p_lastUpdateTime) { m_lastUpdateTime = p_lastUpdateTime; }
inline void SetFlags(MxU16 flags) { m_flags = flags; } inline void SetFlags(MxU16 p_flags) { m_flags = p_flags; }
private: private:
MxCore* m_client; // 0x0 MxCore* m_client; // 0x0

View File

@ -3,10 +3,10 @@
#include <windows.h> #include <windows.h>
// GLOBAL: LEGO1 0x10101414 // GLOBAL: LEGO1 0x10101414
MxLong MxTimer::s_LastTimeCalculated = 0; MxLong MxTimer::g_lastTimeCalculated = 0;
// GLOBAL: LEGO1 0x10101418 // GLOBAL: LEGO1 0x10101418
MxLong MxTimer::s_LastTimeTimerStarted = 0; MxLong MxTimer::g_lastTimeTimerStarted = 0;
// FUNCTION: LEGO1 0x100ae060 // FUNCTION: LEGO1 0x100ae060
MxTimer::MxTimer() MxTimer::MxTimer()
@ -14,20 +14,20 @@ MxTimer::MxTimer()
this->m_isRunning = FALSE; this->m_isRunning = FALSE;
m_startTime = timeGetTime(); m_startTime = timeGetTime();
// yeah this is somehow what the asm is // yeah this is somehow what the asm is
s_LastTimeCalculated = m_startTime; g_lastTimeCalculated = m_startTime;
} }
// FUNCTION: LEGO1 0x100ae140 // FUNCTION: LEGO1 0x100ae140
MxLong MxTimer::GetRealTime() MxLong MxTimer::GetRealTime()
{ {
MxTimer::s_LastTimeCalculated = timeGetTime(); MxTimer::g_lastTimeCalculated = timeGetTime();
return MxTimer::s_LastTimeCalculated - this->m_startTime; return MxTimer::g_lastTimeCalculated - this->m_startTime;
} }
// FUNCTION: LEGO1 0x100ae160 // FUNCTION: LEGO1 0x100ae160
void MxTimer::Start() void MxTimer::Start()
{ {
s_LastTimeTimerStarted = this->GetRealTime(); g_lastTimeTimerStarted = this->GetRealTime();
this->m_isRunning = TRUE; this->m_isRunning = TRUE;
} }
@ -35,7 +35,7 @@ void MxTimer::Start()
void MxTimer::Stop() void MxTimer::Stop()
{ {
MxLong elapsed = this->GetRealTime(); MxLong elapsed = this->GetRealTime();
MxLong startTime = elapsed - MxTimer::s_LastTimeTimerStarted; MxLong startTime = elapsed - MxTimer::g_lastTimeTimerStarted;
this->m_isRunning = FALSE; this->m_isRunning = FALSE;
// this feels very stupid but it's what the assembly does // this feels very stupid but it's what the assembly does
this->m_startTime = this->m_startTime + startTime - 5; this->m_startTime = this->m_startTime + startTime - 5;

View File

@ -17,16 +17,16 @@ class MxTimer : public MxCore {
inline MxLong GetTime() inline MxLong GetTime()
{ {
if (this->m_isRunning) if (this->m_isRunning)
return s_LastTimeTimerStarted; return g_lastTimeTimerStarted;
else else
return s_LastTimeCalculated - this->m_startTime; return g_lastTimeCalculated - this->m_startTime;
} }
private: private:
MxLong m_startTime; MxLong m_startTime;
MxBool m_isRunning; MxBool m_isRunning;
static MxLong s_LastTimeCalculated; static MxLong g_lastTimeCalculated;
static MxLong s_LastTimeTimerStarted; static MxLong g_lastTimeTimerStarted;
}; };
#endif // MXTIMER_H #endif // MXTIMER_H

View File

@ -21,8 +21,8 @@ MxTransitionManager::MxTransitionManager()
m_ddSurface = NULL; m_ddSurface = NULL;
m_waitIndicator = NULL; m_waitIndicator = NULL;
m_copyBuffer = NULL; m_copyBuffer = NULL;
m_copyFlags.bit0 = FALSE; m_copyFlags.m_bit0 = FALSE;
m_unk0x28.bit0 = FALSE; m_unk0x28.m_bit0 = FALSE;
m_unk0x24 = 0; m_unk0x24 = 0;
} }
@ -58,22 +58,22 @@ MxResult MxTransitionManager::Tickle()
switch (this->m_transitionType) { switch (this->m_transitionType) {
case NO_ANIMATION: case NO_ANIMATION:
Transition_None(); TransitionNone();
break; break;
case DISSOLVE: case DISSOLVE:
Transition_Dissolve(); TransitionDissolve();
break; break;
case PIXELATION: case PIXELATION:
Transition_Pixelation(); TransitionPixelation();
break; break;
case SCREEN_WIPE: case SCREEN_WIPE:
Transition_Wipe(); TransitionWipe();
break; break;
case WINDOWS: case WINDOWS:
Transition_Windows(); TransitionWindows();
break; break;
case BROKEN: case BROKEN:
Transition_Broken(); TransitionBroken();
break; break;
} }
return SUCCESS; return SUCCESS;
@ -95,9 +95,9 @@ MxResult MxTransitionManager::StartTransition(
this->m_transitionType = p_animationType; this->m_transitionType = p_animationType;
m_copyFlags.bit0 = p_doCopy; m_copyFlags.m_bit0 = p_doCopy;
if (m_copyFlags.bit0 && m_waitIndicator != NULL) { if (m_copyFlags.m_bit0 && m_waitIndicator != NULL) {
m_waitIndicator->Enable(TRUE); m_waitIndicator->Enable(TRUE);
MxDSAction* action = m_waitIndicator->GetAction(); MxDSAction* action = m_waitIndicator->GetAction();
@ -132,7 +132,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
if (m_transitionType != NOT_TRANSITIONING) { if (m_transitionType != NOT_TRANSITIONING) {
m_transitionType = NOT_TRANSITIONING; m_transitionType = NOT_TRANSITIONING;
m_copyFlags.bit0 = FALSE; m_copyFlags.m_bit0 = FALSE;
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
@ -147,7 +147,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
} }
// FUNCTION: LEGO1 0x1004bcf0 // FUNCTION: LEGO1 0x1004bcf0
void MxTransitionManager::Transition_None() void MxTransitionManager::TransitionNone()
{ {
LegoVideoManager* videoManager = VideoManager(); LegoVideoManager* videoManager = VideoManager();
videoManager->GetDisplaySurface()->FUN_100ba640(); videoManager->GetDisplaySurface()->FUN_100ba640();
@ -155,7 +155,7 @@ void MxTransitionManager::Transition_None()
} }
// FUNCTION: LEGO1 0x1004bd10 // FUNCTION: LEGO1 0x1004bd10
void MxTransitionManager::Transition_Dissolve() void MxTransitionManager::TransitionDissolve()
{ {
// If the animation is finished // If the animation is finished
if (m_animationTimer == 40) { if (m_animationTimer == 40) {
@ -212,14 +212,14 @@ void MxTransitionManager::Transition_Dissolve()
// Shift the chosen column a different amount at each scanline. // Shift the chosen column a different amount at each scanline.
// We use the same shift for that scanline each time. // We use the same shift for that scanline each time.
// By the end, every pixel gets hit. // By the end, every pixel gets hit.
MxS32 x_shift = (m_randomShift[row] + col) % 640; MxS32 xShift = (m_randomShift[row] + col) % 640;
// Set the chosen pixel to black // Set the chosen pixel to black
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) { if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) {
((MxU8*) ddsd.lpSurface)[row * ddsd.lPitch + x_shift] = 0; ((MxU8*) ddsd.lpSurface)[row * ddsd.lPitch + xShift] = 0;
} }
else { else {
((MxU16*) ddsd.lpSurface)[row * ddsd.lPitch + x_shift] = 0; ((MxU16*) ddsd.lpSurface)[row * ddsd.lPitch + xShift] = 0;
} }
} }
} }
@ -227,7 +227,7 @@ void MxTransitionManager::Transition_Dissolve()
SetupCopyRect(&ddsd); SetupCopyRect(&ddsd);
m_ddSurface->Unlock(ddsd.lpSurface); m_ddSurface->Unlock(ddsd.lpSurface);
if (VideoManager()->GetVideoParam().flags().GetFlipSurfaces()) { if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1(); LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
} }
@ -237,7 +237,7 @@ void MxTransitionManager::Transition_Dissolve()
} }
// FUNCTION: LEGO1 0x1004bed0 // FUNCTION: LEGO1 0x1004bed0
void MxTransitionManager::Transition_Pixelation() void MxTransitionManager::TransitionPixelation()
{ {
if (m_animationTimer == 16) { if (m_animationTimer == 16) {
m_animationTimer = 0; m_animationTimer = 0;
@ -289,20 +289,20 @@ void MxTransitionManager::Transition_Pixelation()
continue; continue;
for (MxS32 row = 0; row < 48; row++) { for (MxS32 row = 0; row < 48; row++) {
MxS32 x_shift = 10 * ((m_randomShift[row] + col) % 64); MxS32 xShift = 10 * ((m_randomShift[row] + col) % 64);
// To do the pixelation, we subdivide the 640x480 surface into // To do the pixelation, we subdivide the 640x480 surface into
// 10x10 pixel blocks. At the chosen block, we sample the top-leftmost // 10x10 pixel blocks. At the chosen block, we sample the top-leftmost
// color and set the other 99 pixels to that value. // color and set the other 99 pixels to that value.
// Find the pixel to sample // Find the pixel to sample
MxS32 sample_ofs = 10 * row * ddsd.lPitch + x_shift; MxS32 sampleOfs = 10 * row * ddsd.lPitch + xShift;
MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8; MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8;
// Save this cast from void* to save time. // Save this cast from void* to save time.
// Seems to help accuracy doing it this way. // Seems to help accuracy doing it this way.
MxU8* surface = (MxU8*) ddsd.lpSurface; MxU8* surface = (MxU8*) ddsd.lpSurface;
MxU8* source = surface + sample_ofs * bytesPerPixel; MxU8* source = surface + sampleOfs * bytesPerPixel;
MxU32 sample = bytesPerPixel == 1 ? *source : *(MxU16*) source; MxU32 sample = bytesPerPixel == 1 ? *source : *(MxU16*) source;
@ -310,32 +310,32 @@ void MxTransitionManager::Transition_Pixelation()
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) { if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8) {
// TODO: This block and the next don't match, but they are // TODO: This block and the next don't match, but they are
// hopefully correct in principle. // hopefully correct in principle.
MxU16 color_word = MAKEWORD(LOBYTE(sample), LOBYTE(sample)); MxU16 colorWord = MAKEWORD(LOBYTE(sample), LOBYTE(sample));
MxU32 new_color = MAKELONG(color_word, color_word); MxU32 newColor = MAKELONG(colorWord, colorWord);
MxU8* pos = surface + k * ddsd.lPitch + x_shift; MxU8* pos = surface + k * ddsd.lPitch + xShift;
MxU32* dest = (MxU32*) pos; MxU32* dest = (MxU32*) pos;
// Sets 10 pixels (10 bytes) // Sets 10 pixels (10 bytes)
dest[0] = new_color; dest[0] = newColor;
dest[1] = new_color; dest[1] = newColor;
MxU16* half = (MxU16*) (dest + 2); MxU16* half = (MxU16*) (dest + 2);
*half = new_color; *half = newColor;
} }
else { else {
MxU32 new_color = MAKELONG(sample, sample); MxU32 newColor = MAKELONG(sample, sample);
// You might expect a cast to MxU16* instead, but lPitch is // You might expect a cast to MxU16* instead, but lPitch is
// bytes/scanline, not pixels/scanline. Therefore, we just // bytes/scanline, not pixels/scanline. Therefore, we just
// need to double the x_shift to get to the right spot. // need to double the xShift to get to the right spot.
MxU8* pos = surface + k * ddsd.lPitch + 2 * x_shift; MxU8* pos = surface + k * ddsd.lPitch + 2 * xShift;
MxU32* dest = (MxU32*) pos; MxU32* dest = (MxU32*) pos;
// Sets 10 pixels (20 bytes) // Sets 10 pixels (20 bytes)
dest[0] = new_color; dest[0] = newColor;
dest[1] = new_color; dest[1] = newColor;
dest[2] = new_color; dest[2] = newColor;
dest[3] = new_color; dest[3] = newColor;
dest[4] = new_color; dest[4] = newColor;
} }
} }
} }
@ -344,7 +344,7 @@ void MxTransitionManager::Transition_Pixelation()
SetupCopyRect(&ddsd); SetupCopyRect(&ddsd);
m_ddSurface->Unlock(ddsd.lpSurface); m_ddSurface->Unlock(ddsd.lpSurface);
if (VideoManager()->GetVideoParam().flags().GetFlipSurfaces()) { if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) {
LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1(); LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1();
surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT);
} }
@ -354,7 +354,7 @@ void MxTransitionManager::Transition_Pixelation()
} }
// FUNCTION: LEGO1 0x1004c170 // FUNCTION: LEGO1 0x1004c170
void MxTransitionManager::Transition_Wipe() void MxTransitionManager::TransitionWipe()
{ {
// If the animation is finished // If the animation is finished
if (m_animationTimer == 240) { if (m_animationTimer == 240) {
@ -393,7 +393,7 @@ void MxTransitionManager::Transition_Wipe()
} }
// FUNCTION: LEGO1 0x1004c270 // FUNCTION: LEGO1 0x1004c270
void MxTransitionManager::Transition_Windows() void MxTransitionManager::TransitionWindows()
{ {
if (m_animationTimer == 240) { if (m_animationTimer == 240) {
m_animationTimer = 0; m_animationTimer = 0;
@ -439,7 +439,7 @@ void MxTransitionManager::Transition_Windows()
} }
// FUNCTION: LEGO1 0x1004c3e0 // FUNCTION: LEGO1 0x1004c3e0
void MxTransitionManager::Transition_Broken() void MxTransitionManager::TransitionBroken()
{ {
// This function has no actual animation logic. // This function has no actual animation logic.
// It also never calls EndTransition to // It also never calls EndTransition to
@ -487,22 +487,22 @@ void MxTransitionManager::SetWaitIndicator(MxVideoPresenter* p_waitIndicator)
} }
else { else {
// Disable copy rect // Disable copy rect
m_copyFlags.bit0 = FALSE; m_copyFlags.m_bit0 = FALSE;
} }
} }
// FUNCTION: LEGO1 0x1004c4d0 // FUNCTION: LEGO1 0x1004c4d0
void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc) void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC p_ddsc)
{ {
// Check if the copy rect is setup // Check if the copy rect is setup
if (m_copyFlags.bit0 == FALSE || m_waitIndicator == NULL || m_copyBuffer == NULL) { if (m_copyFlags.m_bit0 == FALSE || m_waitIndicator == NULL || m_copyBuffer == NULL) {
return; return;
} }
// Copy the copy rect onto the surface // Copy the copy rect onto the surface
MxU8* dst; MxU8* dst;
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8; MxU32 bytesPerPixel = p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
const MxU8* src = (const MxU8*) m_copyBuffer; const MxU8* src = (const MxU8*) m_copyBuffer;
@ -510,12 +510,12 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel; copyPitch = ((m_copyRect.right - m_copyRect.left) + 1) * bytesPerPixel;
MxS32 y; MxS32 y;
dst = (MxU8*) ddsc->lpSurface + (ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left); dst = (MxU8*) p_ddsc->lpSurface + (p_ddsc->lPitch * m_copyRect.top) + (bytesPerPixel * m_copyRect.left);
for (y = 0; y < m_copyRect.bottom - m_copyRect.top + 1; ++y) { for (y = 0; y < m_copyRect.bottom - m_copyRect.top + 1; ++y) {
memcpy(dst, src, copyPitch); memcpy(dst, src, copyPitch);
src += copyPitch; src += copyPitch;
dst += ddsc->lPitch; dst += p_ddsc->lPitch;
} }
// Free the copy buffer // Free the copy buffer
@ -524,10 +524,10 @@ void MxTransitionManager::SubmitCopyRect(LPDDSURFACEDESC ddsc)
} }
// FUNCTION: LEGO1 0x1004c580 // FUNCTION: LEGO1 0x1004c580
void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc) void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc)
{ {
// Check if the copy rect is setup // Check if the copy rect is setup
if (m_copyFlags.bit0 == FALSE || m_waitIndicator == NULL) { if (m_copyFlags.m_bit0 == FALSE || m_waitIndicator == NULL) {
return; return;
} }
@ -537,9 +537,9 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
// Check if wait indicator has started // Check if wait indicator has started
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) { if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
// Setup the copy rect // Setup the copy rect
MxU32 copyPitch = (ddsc->ddpfPixelFormat.dwRGBBitCount / 8) * MxU32 copyPitch = (p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8) *
(m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously (m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
MxU32 bytesPerPixel = ddsc->ddpfPixelFormat.dwRGBBitCount / 8; MxU32 bytesPerPixel = p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8;
m_copyRect.left = m_waitIndicator->GetLocationX(); m_copyRect.left = m_waitIndicator->GetLocationX();
m_copyRect.top = m_waitIndicator->GetLocationY(); m_copyRect.top = m_waitIndicator->GetLocationY();
@ -552,7 +552,7 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
// Allocate the copy buffer // Allocate the copy buffer
const MxU8* src = const MxU8* src =
(const MxU8*) ddsc->lpSurface + m_copyRect.top * ddsc->lPitch + bytesPerPixel * m_copyRect.left; (const MxU8*) p_ddsc->lpSurface + m_copyRect.top * p_ddsc->lPitch + bytesPerPixel * m_copyRect.left;
m_copyBuffer = new MxU8[bytesPerPixel * width * height]; m_copyBuffer = new MxU8[bytesPerPixel * width * height];
if (!m_copyBuffer) if (!m_copyBuffer)
@ -563,7 +563,7 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++) { for (MxS32 i = 0; i < (m_copyRect.bottom - m_copyRect.top + 1); i++) {
memcpy(dst, src, copyPitch); memcpy(dst, src, copyPitch);
src += ddsc->lPitch; src += p_ddsc->lPitch;
dst += copyPitch; dst += copyPitch;
} }
} }
@ -571,9 +571,9 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
// Setup display surface // Setup display surface
if ((m_waitIndicator->GetAction()->GetFlags() & MxDSAction::Flag_Bit5) != 0) { if ((m_waitIndicator->GetAction()->GetFlags() & MxDSAction::Flag_Bit5) != 0) {
MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface(); MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface();
MxBool unkbool = FALSE; MxBool und = FALSE;
displaySurface->VTable0x2c( displaySurface->VTable0x2c(
ddsc, p_ddsc,
m_waitIndicator->GetBitmap(), m_waitIndicator->GetBitmap(),
0, 0,
0, 0,
@ -581,13 +581,13 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC ddsc)
m_waitIndicator->GetLocationY(), m_waitIndicator->GetLocationY(),
m_waitIndicator->GetWidth(), m_waitIndicator->GetWidth(),
m_waitIndicator->GetHeight(), m_waitIndicator->GetHeight(),
unkbool und
); );
} }
else { else {
MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface(); MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface();
displaySurface->VTable0x24( displaySurface->VTable0x24(
ddsc, p_ddsc,
m_waitIndicator->GetBitmap(), m_waitIndicator->GetBitmap(),
0, 0,
0, 0,

View File

@ -45,23 +45,23 @@ class MxTransitionManager : public MxCore {
private: private:
void EndTransition(MxBool p_notifyWorld); void EndTransition(MxBool p_notifyWorld);
void Transition_None(); void TransitionNone();
void Transition_Dissolve(); void TransitionDissolve();
void Transition_Pixelation(); void TransitionPixelation();
void Transition_Wipe(); void TransitionWipe();
void Transition_Windows(); void TransitionWindows();
void Transition_Broken(); void TransitionBroken();
void SubmitCopyRect(LPDDSURFACEDESC ddsc); void SubmitCopyRect(LPDDSURFACEDESC p_ddsc);
void SetupCopyRect(LPDDSURFACEDESC ddsc); void SetupCopyRect(LPDDSURFACEDESC p_ddsc);
MxVideoPresenter* m_waitIndicator; MxVideoPresenter* m_waitIndicator;
RECT m_copyRect; RECT m_copyRect;
MxU8* m_copyBuffer; MxU8* m_copyBuffer;
flag_bitfield m_copyFlags; FlagBitfield m_copyFlags;
undefined4 m_unk0x24; undefined4 m_unk0x24;
flag_bitfield m_unk0x28; FlagBitfield m_unk0x28;
TransitionType m_transitionType; TransitionType m_transitionType;
LPDIRECTDRAWSURFACE m_ddSurface; LPDIRECTDRAWSURFACE m_ddSurface;

View File

@ -58,16 +58,16 @@ typedef MxU8 MxBool;
// Must be union with struct for match. // Must be union with struct for match.
typedef union { typedef union {
struct { struct {
MxU8 bit0 : 1; MxU8 m_bit0 : 1;
MxU8 bit1 : 1; MxU8 m_bit1 : 1;
MxU8 bit2 : 1; MxU8 m_bit2 : 1;
MxU8 bit3 : 1; MxU8 m_bit3 : 1;
MxU8 bit4 : 1; MxU8 m_bit4 : 1;
MxU8 bit5 : 1; MxU8 m_bit5 : 1;
MxU8 bit6 : 1; MxU8 m_bit6 : 1;
MxU8 bit7 : 1; MxU8 m_bit7 : 1;
}; };
// BYTE all; // ? // BYTE all; // ?
} flag_bitfield; } FlagBitfield;
#endif // MXTYPES_H #endif // MXTYPES_H

View File

@ -12,9 +12,9 @@ MxString* MxVariable::GetValue()
} }
// FUNCTION: LEGO1 0x1003beb0 // FUNCTION: LEGO1 0x1003beb0
void MxVariable::SetValue(const char* value) void MxVariable::SetValue(const char* p_value)
{ {
m_value = value; m_value = p_value;
} }
// FUNCTION: LEGO1 0x1003bec0 // FUNCTION: LEGO1 0x1003bec0

View File

@ -21,7 +21,7 @@ class MxVariable {
m_value = p_value; m_value = p_value;
} }
virtual MxString* GetValue(); virtual MxString* GetValue();
virtual void SetValue(const char*); virtual void SetValue(const char* p_value);
virtual void Destroy(); virtual void Destroy();
inline const MxString* GetKey() const { return &m_key; } inline const MxString* GetKey() const { return &m_key; }

View File

@ -99,14 +99,14 @@ void MxVideoManager::SortPresenterList()
finished = TRUE; finished = TRUE;
for (MxU32 i = count; i != 0; i--) { for (MxU32 i = count; i != 0; i--) {
MxPresenter *p_a, *p_b; MxPresenter *presenterA, *presenterB;
a.Next(p_a); a.Next(presenterA);
b.Next(p_b); b.Next(presenterB);
if (p_a->GetDisplayZ() < p_b->GetDisplayZ()) { if (presenterA->GetDisplayZ() < presenterB->GetDisplayZ()) {
a.SetValue(p_b); a.SetValue(presenterB);
b.SetValue(p_a); b.SetValue(presenterA);
finished = FALSE; finished = FALSE;
} }
} }

View File

@ -23,13 +23,13 @@ MxVideoParam::MxVideoParam()
// FUNCTION: LEGO1 0x100beca0 // FUNCTION: LEGO1 0x100beca0
MxVideoParam::MxVideoParam( MxVideoParam::MxVideoParam(
COMPAT_CONST MxRect32& p_rect, COMPAT_CONST MxRect32& p_rect,
MxPalette* p_pal, MxPalette* p_palette,
MxULong p_backBuffers, MxULong p_backBuffers,
COMPAT_CONST MxVideoParamFlags& p_flags COMPAT_CONST MxVideoParamFlags& p_flags
) )
{ {
this->m_rect = p_rect; this->m_rect = p_rect;
this->m_palette = p_pal; this->m_palette = p_palette;
this->m_backBuffers = p_backBuffers; this->m_backBuffers = p_backBuffers;
this->m_flags = p_flags; this->m_flags = p_flags;
this->m_unk0x1c = 0; this->m_unk0x1c = 0;
@ -56,16 +56,16 @@ MxVideoParam::~MxVideoParam()
} }
// FUNCTION: LEGO1 0x100bed70 // FUNCTION: LEGO1 0x100bed70
void MxVideoParam::SetDeviceName(char* id) void MxVideoParam::SetDeviceName(char* p_deviceId)
{ {
if (this->m_deviceId != NULL) if (this->m_deviceId != NULL)
delete[] this->m_deviceId; delete[] this->m_deviceId;
if (id != 0) { if (p_deviceId != NULL) {
this->m_deviceId = new char[strlen(id) + 1]; this->m_deviceId = new char[strlen(p_deviceId) + 1];
if (this->m_deviceId != NULL) { if (this->m_deviceId != NULL) {
strcpy(this->m_deviceId, id); strcpy(this->m_deviceId, p_deviceId);
} }
} }
else { else {

View File

@ -14,15 +14,19 @@
class MxVideoParam { class MxVideoParam {
public: public:
__declspec(dllexport) MxVideoParam(); __declspec(dllexport) MxVideoParam();
__declspec(dllexport) MxVideoParam(MxVideoParam&); __declspec(dllexport) MxVideoParam(MxVideoParam& p_videoParam);
__declspec(dllexport) __declspec(dllexport) MxVideoParam(
MxVideoParam(COMPAT_CONST MxRect32& rect, MxPalette* pal, MxULong p3, COMPAT_CONST MxVideoParamFlags& flags); COMPAT_CONST MxRect32& p_rect,
__declspec(dllexport) MxVideoParam& operator=(const MxVideoParam&); MxPalette* p_palette,
MxULong p_backBuffers,
COMPAT_CONST MxVideoParamFlags& p_flags
);
__declspec(dllexport) MxVideoParam& operator=(const MxVideoParam& p_videoParam);
__declspec(dllexport) ~MxVideoParam(); __declspec(dllexport) ~MxVideoParam();
__declspec(dllexport) void SetDeviceName(char* id); __declspec(dllexport) void SetDeviceName(char* p_deviceId);
inline MxVideoParamFlags& flags() { return m_flags; } inline MxVideoParamFlags& Flags() { return m_flags; }
inline void SetPalette(MxPalette* p_palette) { this->m_palette = p_palette; } inline void SetPalette(MxPalette* p_palette) { this->m_palette = p_palette; }
inline void SetBackBuffers(MxU32 p_backBuffers) { this->m_backBuffers = p_backBuffers; } inline void SetBackBuffers(MxU32 p_backBuffers) { this->m_backBuffers = p_backBuffers; }

View File

@ -6,10 +6,10 @@ MxVideoParamFlags::MxVideoParamFlags()
this->SetFullScreen(0); this->SetFullScreen(0);
this->SetFlipSurfaces(0); this->SetFlipSurfaces(0);
this->SetBackBuffers(0); this->SetBackBuffers(0);
this->Set_f1bit3(0); this->SetF1bit3(0);
this->Set_f1bit4(0); this->SetF1bit4(0);
this->Set16Bit(0); this->Set16Bit(0);
this->SetWideViewAngle(1); this->SetWideViewAngle(1);
this->Set_f1bit7(1); this->SetF1bit7(1);
this->Set_f2bit1(1); this->SetF2bit1(1);
} }

View File

@ -9,43 +9,43 @@ class MxVideoParamFlags {
public: public:
__declspec(dllexport) MxVideoParamFlags(); __declspec(dllexport) MxVideoParamFlags();
inline void SetFullScreen(BOOL e) { m_flags1.bit0 = e; } inline void SetFullScreen(BOOL p_e) { m_flags1.m_bit0 = p_e; }
inline void SetFlipSurfaces(BOOL e) { m_flags1.bit1 = e; } inline void SetFlipSurfaces(BOOL p_e) { m_flags1.m_bit1 = p_e; }
inline void SetBackBuffers(BOOL e) { m_flags1.bit2 = e; } inline void SetBackBuffers(BOOL p_e) { m_flags1.m_bit2 = p_e; }
inline void Set_f1bit3(BOOL e) { m_flags1.bit3 = e; } inline void SetF1bit3(BOOL p_e) { m_flags1.m_bit3 = p_e; }
inline void Set_f1bit4(BOOL e) { m_flags1.bit4 = e; } inline void SetF1bit4(BOOL p_e) { m_flags1.m_bit4 = p_e; }
inline void Set16Bit(BYTE e) { m_flags1.bit5 = e; } inline void Set16Bit(BYTE p_e) { m_flags1.m_bit5 = p_e; }
inline void SetWideViewAngle(BOOL e) { m_flags1.bit6 = e; } inline void SetWideViewAngle(BOOL p_e) { m_flags1.m_bit6 = p_e; }
inline void Set_f1bit7(BOOL e) { m_flags1.bit7 = e; } inline void SetF1bit7(BOOL p_e) { m_flags1.m_bit7 = p_e; }
inline void Set_f2bit0(BOOL e) { m_flags2.bit0 = e; } inline void SetF2bit0(BOOL p_e) { m_flags2.m_bit0 = p_e; }
inline void Set_f2bit1(BOOL e) { m_flags2.bit1 = e; } inline void SetF2bit1(BOOL p_e) { m_flags2.m_bit1 = p_e; }
inline void Set_f2bit2(BOOL e) { m_flags2.bit2 = e; } inline void SetF2bit2(BOOL p_e) { m_flags2.m_bit2 = p_e; }
inline void Set_f2bit3(BOOL e) { m_flags2.bit3 = e; } inline void SetF2bit3(BOOL p_e) { m_flags2.m_bit3 = p_e; }
inline void Set_f2bit4(BOOL e) { m_flags2.bit4 = e; } inline void SetF2bit4(BOOL p_e) { m_flags2.m_bit4 = p_e; }
inline void Set_f2bit5(BOOL e) { m_flags2.bit5 = e; } inline void SetF2bit5(BOOL p_e) { m_flags2.m_bit5 = p_e; }
inline void Set_f2bit6(BOOL e) { m_flags2.bit6 = e; } inline void SetF2bit6(BOOL p_e) { m_flags2.m_bit6 = p_e; }
inline void Set_f2bit7(BOOL e) { m_flags2.bit7 = e; } inline void SetF2bit7(BOOL p_e) { m_flags2.m_bit7 = p_e; }
inline BYTE GetFullScreen() { return m_flags1.bit0; } inline BYTE GetFullScreen() { return m_flags1.m_bit0; }
inline BYTE GetFlipSurfaces() { return m_flags1.bit1; } inline BYTE GetFlipSurfaces() { return m_flags1.m_bit1; }
inline BYTE GetBackBuffers() { return m_flags1.bit2; } inline BYTE GetBackBuffers() { return m_flags1.m_bit2; }
inline BYTE Get_f1bit3() { return m_flags1.bit3; } inline BYTE Get_f1bit3() { return m_flags1.m_bit3; }
inline BYTE Get_f1bit4() { return m_flags1.bit4; } inline BYTE Get_f1bit4() { return m_flags1.m_bit4; }
inline BYTE Get16Bit() { return m_flags1.bit5; } inline BYTE Get16Bit() { return m_flags1.m_bit5; }
inline BYTE GetWideViewAngle() { return m_flags1.bit6; } inline BYTE GetWideViewAngle() { return m_flags1.m_bit6; }
inline BYTE Get_f1bit7() { return m_flags1.bit7; } inline BYTE Get_f1bit7() { return m_flags1.m_bit7; }
inline BYTE Get_f2bit0() { return m_flags2.bit0; } inline BYTE Get_f2bit0() { return m_flags2.m_bit0; }
inline BYTE Get_f2bit1() { return m_flags2.bit1; } inline BYTE Get_f2bit1() { return m_flags2.m_bit1; }
inline BYTE Get_f2bit2() { return m_flags2.bit2; } inline BYTE Get_f2bit2() { return m_flags2.m_bit2; }
inline BYTE Get_f2bit3() { return m_flags2.bit3; } inline BYTE Get_f2bit3() { return m_flags2.m_bit3; }
inline BYTE Get_f2bit4() { return m_flags2.bit4; } inline BYTE Get_f2bit4() { return m_flags2.m_bit4; }
inline BYTE Get_f2bit5() { return m_flags2.bit5; } inline BYTE Get_f2bit5() { return m_flags2.m_bit5; }
inline BYTE Get_f2bit6() { return m_flags2.bit6; } inline BYTE Get_f2bit6() { return m_flags2.m_bit6; }
inline BYTE Get_f2bit7() { return m_flags2.bit7; } inline BYTE Get_f2bit7() { return m_flags2.m_bit7; }
private: private:
flag_bitfield m_flags1; FlagBitfield m_flags1;
flag_bitfield m_flags2; FlagBitfield m_flags2;
}; };
#endif // MXVIDEOPARAMFLAGS_H #endif // MXVIDEOPARAMFLAGS_H

View File

@ -72,16 +72,16 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
{ {
m_width = p_bitmap.GetBmiWidth(); m_width = p_bitmap.GetBmiWidth();
// DECOMP: ECX becomes word-sized if these are not two separate actions. // DECOMP: ECX becomes word-sized if these are not two separate actions.
MxLong _height = p_bitmap.GetBmiHeightAbs(); MxLong height = p_bitmap.GetBmiHeightAbs();
m_height = _height; m_height = height;
MxS32 size = ((m_width * m_height) / 8) + 1; MxS32 size = ((m_width * m_height) / 8) + 1;
m_bitmask = new MxU8[size]; m_bitmask = new MxU8[size];
memset(m_bitmask, 0, size); memset(m_bitmask, 0, size);
MxU32 biCompression = p_bitmap.GetBmiHeader()->biCompression; MxU32 biCompression = p_bitmap.GetBmiHeader()->biCompression;
MxU32 rows_before_top; MxU32 rowsBeforeTop;
MxU8* bitmap_src_ptr; MxU8* bitmapSrcPtr;
// The goal here is to enable us to walk through the bitmap's rows // The goal here is to enable us to walk through the bitmap's rows
// in order, regardless of the orientation. We want to end up at the // in order, regardless of the orientation. We want to end up at the
@ -95,11 +95,11 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
// DECOMP: I think this must be an OR. If not, the check for // DECOMP: I think this must be an OR. If not, the check for
// biCompression == 16 gets optimized away. // biCompression == 16 gets optimized away.
if (biCompression == BI_RGB_TOPDOWN || p_bitmap.GetBmiHeight() < 0) { if (biCompression == BI_RGB_TOPDOWN || p_bitmap.GetBmiHeight() < 0) {
rows_before_top = 0; rowsBeforeTop = 0;
} }
else { else {
rows_before_top = p_bitmap.GetBmiHeightAbs(); rowsBeforeTop = p_bitmap.GetBmiHeightAbs();
rows_before_top--; rowsBeforeTop--;
} }
goto seek_to_last_row; goto seek_to_last_row;
@ -107,48 +107,48 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
else if (biCompression == BI_RGB_TOPDOWN) { else if (biCompression == BI_RGB_TOPDOWN) {
// DECOMP: This is the only condition where we skip the // DECOMP: This is the only condition where we skip the
// calculation below. // calculation below.
bitmap_src_ptr = p_bitmap.GetBitmapData(); bitmapSrcPtr = p_bitmap.GetBitmapData();
} }
else { else {
if (p_bitmap.GetBmiHeight() < 0) { if (p_bitmap.GetBmiHeight() < 0) {
rows_before_top = 0; rowsBeforeTop = 0;
} }
else { else {
rows_before_top = p_bitmap.GetBmiHeightAbs(); rowsBeforeTop = p_bitmap.GetBmiHeightAbs();
rows_before_top--; rowsBeforeTop--;
} }
// TODO: would prefer not to use goto if we can figure this structure out // TODO: would prefer not to use goto if we can figure this structure out
seek_to_last_row: seek_to_last_row:
bitmap_src_ptr = p_bitmap.GetBmiStride() * rows_before_top + p_bitmap.GetBitmapData(); bitmapSrcPtr = p_bitmap.GetBmiStride() * rowsBeforeTop + p_bitmap.GetBitmapData();
} }
// How many bytes are there for each row of the bitmap? // How many bytes are there for each row of the bitmap?
// (i.e. the image stride) // (i.e. the image stride)
// If this is a bottom-up DIB, we will walk it in reverse. // If this is a bottom-up DIB, we will walk it in reverse.
// TODO: Same rounding trick as in MxBitmap // TODO: Same rounding trick as in MxBitmap
MxS32 row_seek = ((m_width + 3) & -4); MxS32 rowSeek = ((m_width + 3) & -4);
if (p_bitmap.GetBmiHeight() < 0) if (p_bitmap.GetBmiHeight() < 0)
row_seek = -row_seek; rowSeek = -rowSeek;
// The actual offset into the m_bitmask array. The two for-loops // The actual offset into the m_bitmask array. The two for-loops
// are just for counting the pixels. // are just for counting the pixels.
MxS32 offset = 0; MxS32 offset = 0;
MxU8* t_ptr = bitmap_src_ptr; MxU8* tPtr = bitmapSrcPtr;
for (MxS32 j = 0; j < m_height; j++) { for (MxS32 j = 0; j < m_height; j++) {
for (MxS32 i = 0; i < m_width; i++) { for (MxS32 i = 0; i < m_width; i++) {
if (*t_ptr) { if (*tPtr) {
// TODO: Second CDQ instruction for abs() should not be there. // TODO: Second CDQ instruction for abs() should not be there.
MxU32 shift = abs(offset) & 7; MxU32 shift = abs(offset) & 7;
m_bitmask[offset / 8] |= (1 << abs((MxS32) shift)); m_bitmask[offset / 8] |= (1 << abs((MxS32) shift));
} }
t_ptr++; tPtr++;
offset++; offset++;
} }
// Seek to the start of the next row // Seek to the start of the next row
bitmap_src_ptr += row_seek; bitmapSrcPtr += rowSeek;
t_ptr = bitmap_src_ptr; tPtr = bitmapSrcPtr;
} }
} }
@ -263,20 +263,20 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
MxLong heightAbs = m_bitmap->GetBmiHeightAbs(); MxLong heightAbs = m_bitmap->GetBmiHeightAbs();
MxLong min_x = GetLocationX(); MxLong minX = GetLocationX();
MxLong min_y = GetLocationY(); MxLong minY = GetLocationY();
MxLong max_y = min_y + heightAbs; MxLong maxY = minY + heightAbs;
MxLong max_x = min_x + m_bitmap->GetBmiWidth(); MxLong maxX = minX + m_bitmap->GetBmiWidth();
if (p_x < min_x || p_x >= max_x || p_y < min_y || p_y >= max_y) if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY)
return FALSE; return FALSE;
MxU8* pixel; MxU8* pixel;
MxLong biCompression = m_bitmap->GetBmiHeader()->biCompression; MxLong biCompression = m_bitmap->GetBmiHeader()->biCompression;
MxLong height = m_bitmap->GetBmiHeight(); MxLong height = m_bitmap->GetBmiHeight();
MxLong seek_row; MxLong seekRow;
// DECOMP: Same basic layout as AlphaMask constructor // DECOMP: Same basic layout as AlphaMask constructor
// The idea here is to again seek to the correct place in the bitmap's // The idea here is to again seek to the correct place in the bitmap's
@ -285,13 +285,13 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
// the MxPresenter location x and y coordinates. // the MxPresenter location x and y coordinates.
if (biCompression == BI_RGB) { if (biCompression == BI_RGB) {
if (biCompression == BI_RGB_TOPDOWN || height < 0) { if (biCompression == BI_RGB_TOPDOWN || height < 0) {
seek_row = p_y - GetLocationY(); seekRow = p_y - GetLocationY();
} }
else { else {
height = height > 0 ? height : -height; height = height > 0 ? height : -height;
seek_row = height - p_y - 1 + GetLocationY(); seekRow = height - p_y - 1 + GetLocationY();
} }
pixel = m_bitmap->GetBmiStride() * seek_row + m_bitmap->GetBitmapData() - GetLocationX() + p_x; pixel = m_bitmap->GetBmiStride() * seekRow + m_bitmap->GetBitmapData() - GetLocationX() + p_x;
} }
else if (biCompression == BI_RGB_TOPDOWN) { else if (biCompression == BI_RGB_TOPDOWN) {
pixel = m_bitmap->GetBitmapData(); pixel = m_bitmap->GetBitmapData();

View File

@ -335,9 +335,9 @@ void MxWavePresenter::ParseExtra()
memcpy(extraCopy, extraData, len); memcpy(extraCopy, extraData, len);
extraCopy[len] = '\0'; extraCopy[len] = '\0';
char t_soundValue[512]; char soundValue[512];
if (KeyValueStringParse(t_soundValue, g_strSOUND, extraCopy)) { if (KeyValueStringParse(soundValue, g_strSOUND, extraCopy)) {
if (!strcmpi(t_soundValue, "FALSE")) if (!strcmpi(soundValue, "FALSE"))
Enable(FALSE); Enable(FALSE);
} }
} }

View File

@ -4,10 +4,10 @@ DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20)
DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0)
// FUNCTION: LEGO1 0x10039510 // FUNCTION: LEGO1 0x10039510
PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 id) PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id)
{ {
for (MxS16 i = 0; i < 5; i++) for (MxS16 i = 0; i < 5; i++)
if (m_state[i].m_id == id) if (m_state[i].m_id == p_id)
return m_state + i; return m_state + i;
return NULL; return NULL;
} }

View File

@ -28,10 +28,10 @@ class PizzaMissionState : public LegoState {
return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name);
} }
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; } inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; }
private: private:
PizzaMissionStateEntry* GetState(MxU8 id); PizzaMissionStateEntry* GetState(MxU8 p_id);
protected: protected:
undefined4 m_unk0x8; undefined4 m_unk0x8;

View File

@ -12,12 +12,12 @@ RaceState::RaceState()
} }
// FUNCTION: LEGO1 0x10016280 // FUNCTION: LEGO1 0x10016280
RaceStateEntry* RaceState::GetState(MxU8 id) RaceStateEntry* RaceState::GetState(MxU8 p_id)
{ {
for (MxS16 i = 0;; i++) { for (MxS16 i = 0;; i++) {
if (i >= 5) if (i >= 5)
return NULL; return NULL;
if (m_state[i].m_id == id) if (m_state[i].m_id == p_id)
return m_state + i; return m_state + i;
} }
} }

View File

@ -30,10 +30,10 @@ class RaceState : public LegoState {
return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name);
} }
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; } inline MxU16 GetColor(MxU8 p_id) { return GetState(p_id)->m_color; }
private: private:
RaceStateEntry* GetState(MxU8 id); RaceStateEntry* GetState(MxU8 p_id);
protected: protected:
RaceStateEntry m_state[5]; RaceStateEntry m_state[5];

View File

@ -107,9 +107,9 @@ MxLong Score::Notify(MxParam& p_param)
} }
// FUNCTION: LEGO1 0x10001510 // FUNCTION: LEGO1 0x10001510
MxLong Score::FUN_10001510(MxEndActionNotificationParam& p) MxLong Score::FUN_10001510(MxEndActionNotificationParam& p_param)
{ {
MxDSAction* action = p.GetAction(); MxDSAction* action = p_param.GetAction();
if (m_atom == action->GetAtomId()) { if (m_atom == action->GetAtomId()) {
MxU32 id = action->GetObjectId(); MxU32 id = action->GetObjectId();
@ -151,12 +151,12 @@ void Score::Stop()
} }
// FUNCTION: LEGO1 0x100016d0 // FUNCTION: LEGO1 0x100016d0
MxLong Score::FUN_100016d0(MxType17NotificationParam& p) MxLong Score::FUN_100016d0(MxType17NotificationParam& p_param)
{ {
MxS16 l = p.GetUnknown28(); MxS16 l = p_param.GetUnknown28();
if (l == 1 || p.GetUnknown20() == 4) { if (l == 1 || p_param.GetUnknown20() == 4) {
switch (p.GetUnknown20()) { switch (p_param.GetUnknown20()) {
case 1: case 1:
m_unk0xf8 = 2; m_unk0xf8 = 2;
DeleteScript(); DeleteScript();

View File

@ -38,8 +38,8 @@ class Score : public LegoWorld {
virtual void VTable0x68(MxBool p_add) override; // vtable+68 virtual void VTable0x68(MxBool p_add) override; // vtable+68
void Paint(); void Paint();
MxLong FUN_10001510(MxEndActionNotificationParam& p); MxLong FUN_10001510(MxEndActionNotificationParam& p_param);
MxLong FUN_100016d0(MxType17NotificationParam& p); MxLong FUN_100016d0(MxType17NotificationParam& p_param);
void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color); void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color);
protected: protected:

View File

@ -22,9 +22,9 @@ class TowTrackMissionState : public LegoState {
return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name);
} }
inline MxU16 GetColor(MxU8 id) inline MxU16 GetColor(MxU8 p_id)
{ {
switch (id) { switch (p_id) {
case 1: case 1:
return m_color1; return m_color1;
case 2: case 2:

View File

@ -5,3 +5,9 @@ configureLegoPartPresenter(MxS32, MxS32): 'DLL exported function'
configureLegoROI(MxS32): 'DLL exported function' configureLegoROI(MxS32): 'DLL exported function'
configureLegoWorldPresenter(MxS32): 'DLL exported function' configureLegoWorldPresenter(MxS32): 'DLL exported function'
GetNoCD_SourceName(): 'DLL exported function' GetNoCD_SourceName(): 'DLL exported function'
m_3dView: 'Allow this variable name'
m_3dManager: 'Allow this variable name'
m_16bitPal: 'Allow this variable 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"