Merge branch 'master' of https://github.com/isledecomp/isle-portable into draw-cursor

This commit is contained in:
Helloyunho 2025-07-03 11:07:48 +09:00
commit b770d92e5d
No known key found for this signature in database
GPG Key ID: 6AFA210B0150BE47
11 changed files with 55 additions and 67 deletions

View File

@ -55,7 +55,7 @@ class CarRace : public LegoRace {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70 MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78 MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78

View File

@ -32,7 +32,7 @@ class JetskiRace : public LegoRace {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70 MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74

View File

@ -11,7 +11,7 @@
#include "mxtypes.h" #include "mxtypes.h"
class Act1State; class Act1State;
class LegoEventNotificationParam; class LegoControlManagerNotificationParam;
class LegoPathActor; class LegoPathActor;
class MxEndActionNotificationParam; class MxEndActionNotificationParam;
class MxNotificationParam; class MxNotificationParam;
@ -117,7 +117,7 @@ class LegoRace : public LegoWorld {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c virtual MxLong HandleControl(LegoControlManagerNotificationParam&) = 0; // vtable+0x6c
// FUNCTION: LEGO1 0x10015b70 // FUNCTION: LEGO1 0x10015b70
virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x70 virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x70

View File

@ -708,19 +708,19 @@ void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name)
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
if (surface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY, NULL) == DD_OK) { if (surface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR, NULL) == DD_OK) {
LegoImage* image = new LegoImage(desc.dwWidth, desc.dwHeight); LegoImage* image = new LegoImage(desc.dwWidth, desc.dwHeight);
if (image != NULL) { if (image != NULL) {
if (desc.dwWidth == desc.lPitch) { if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, image->GetBits(), desc.dwWidth * desc.dwHeight); memcpy(image->GetBits(), desc.lpSurface, desc.dwWidth * desc.dwHeight);
} }
else { else {
MxU8* surface = (MxU8*) desc.lpSurface; MxU8* surface = (MxU8*) desc.lpSurface;
const LegoU8* bits = image->GetBits(); LegoU8* bits = image->GetBits();
for (MxS32 i = 0; i < desc.dwHeight; i++) { for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth); memcpy(bits, surface, desc.dwWidth);
surface += desc.lPitch; surface += desc.lPitch;
bits += desc.dwWidth; bits += desc.dwWidth;
} }

View File

@ -248,7 +248,7 @@ void MxTransitionManager::DissolveTransition()
} }
else { else {
MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift * 4; MxU8* surf = (MxU8*) ddsd.lpSurface + ddsd.lPitch * row + xShift * 4;
*(MxU32*) surf = 0; *(MxU32*) surf = 0xFF000000;
} }
} }
} }
@ -416,10 +416,25 @@ void MxTransitionManager::WipeDownTransition()
// For each of the 240 animation ticks, blank out two scanlines // For each of the 240 animation ticks, blank out two scanlines
// starting at the top of the screen. // starting at the top of the screen.
MxU8* line = (MxU8*) ddsd.lpSurface + 2 * ddsd.lPitch * m_animationTimer; MxU8* line = (MxU8*) ddsd.lpSurface + 2 * ddsd.lPitch * m_animationTimer;
if (ddsd.ddpfPixelFormat.dwRGBBitCount == 32) {
MxU32* pixels = (MxU32*) line;
int pixelsPerLine = ddsd.lPitch / 4;
for (int i = 0; i < pixelsPerLine; i++) {
pixels[i] = 0xFF000000;
}
line += ddsd.lPitch;
pixels = (MxU32*) line;
for (int i = 0; i < pixelsPerLine; i++) {
pixels[i] = 0xFF000000;
}
}
else {
memset(line, 0, ddsd.lPitch); memset(line, 0, ddsd.lPitch);
line += ddsd.lPitch; line += ddsd.lPitch;
memset(line, 0, ddsd.lPitch); memset(line, 0, ddsd.lPitch);
}
SetupCopyRect(&ddsd); SetupCopyRect(&ddsd);
m_ddSurface->Unlock(ddsd.lpSurface); m_ddSurface->Unlock(ddsd.lpSurface);

View File

@ -335,12 +335,10 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
} }
// FUNCTION: LEGO1 0x10017650 // FUNCTION: LEGO1 0x10017650
MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param) MxLong CarRace::HandleControl(LegoControlManagerNotificationParam& p_param)
{ {
LegoControlManagerNotificationParam* param = (LegoControlManagerNotificationParam*) &p_param; if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
if (param->m_unk0x28 == 1) {
switch (param->m_clickedObjectId) {
case 3: case 3:
InvokeAction(Extra::e_stop, *g_carraceScript, CarraceScript::c_irtx08ra_PlayWav, NULL); InvokeAction(Extra::e_stop, *g_carraceScript, CarraceScript::c_irtx08ra_PlayWav, NULL);
m_act1State->m_unk0x018 = 0; m_act1State->m_unk0x018 = 0;

View File

@ -122,12 +122,12 @@ MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
// FUNCTION: LEGO1 0x100165a0 // FUNCTION: LEGO1 0x100165a0
MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param) MxLong JetskiRace::HandleControl(LegoControlManagerNotificationParam& p_param)
{ {
MxLong result = 0; MxLong result = 0;
if (((LegoControlManagerNotificationParam*) &p_param)->m_unk0x28 == 1) { if (p_param.m_unk0x28 == 1) {
switch (((LegoControlManagerNotificationParam*) &p_param)->m_clickedObjectId) { switch (p_param.m_clickedObjectId) {
case JetraceScript::c_JetskiArms_Ctl: case JetraceScript::c_JetskiArms_Ctl:
m_act1State->m_unk0x018 = 0; m_act1State->m_unk0x018 = 0;
VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_raceState, "");

View File

@ -82,8 +82,8 @@ MxLong LegoRace::Notify(MxParam& p_param)
case c_notificationEndAction: case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param); result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break; break;
case c_notificationClick: case c_notificationControl:
result = HandleClick((LegoEventNotificationParam&) p_param); result = HandleControl((LegoControlManagerNotificationParam&) p_param);
break; break;
case c_notificationPathStruct: case c_notificationPathStruct:
result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); result = HandlePathStruct((LegoPathStructNotificationParam&) p_param);

View File

@ -46,7 +46,7 @@ class LegoImage {
{ {
m_palette->colors[p_i] = p_paletteEntry.GetColor(); m_palette->colors[p_i] = p_paletteEntry.GetColor();
} }
const LegoU8* GetBits() const { return (LegoU8*) m_surface->pixels; } LegoU8* GetBits() const { return (LegoU8*) m_surface->pixels; }
LegoResult Read(LegoStorage* p_storage, LegoU32 p_square); LegoResult Read(LegoStorage* p_storage, LegoU32 p_square);
LegoResult Write(LegoStorage* p_storage); LegoResult Write(LegoStorage* p_storage);

View File

@ -170,39 +170,16 @@ BOOL MxDirect3D::D3DSetMode()
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer(); LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
LPDIRECTDRAWSURFACE backBuffer = BackBuffer(); LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
DDSURFACEDESC desc; DDBLTFX ddBltFx = {};
memset(&desc, 0, sizeof(desc)); ddBltFx.dwSize = sizeof(DDBLTFX);
desc.dwSize = sizeof(desc); ddBltFx.dwFillColor = 0;
if (backBuffer->Lock(NULL, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) == DD_OK) { if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
unsigned char* surface = (unsigned char*) desc.lpSurface; SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
for (int i = 0; i < mode.height; i++) {
memset(surface, 0, desc.lPitch);
surface += desc.lPitch;
}
backBuffer->Unlock(desc.lpSurface);
}
else {
SDL_Log("MxDirect3D::D3DSetMode() back lock failed\n");
} }
if (IsFullScreen()) { if (IsFullScreen()) {
memset(&desc, 0, sizeof(desc)); if (frontBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
desc.dwSize = sizeof(desc);
if (frontBuffer->Lock(NULL, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) == DD_OK) {
unsigned char* surface = (unsigned char*) desc.lpSurface;
for (int i = 0; i < mode.height; i++) {
memset(surface, 0, desc.lPitch);
surface += desc.lPitch;
}
frontBuffer->Unlock(desc.lpSurface);
}
else {
SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n"); SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n");
} }
} }

View File

@ -65,8 +65,6 @@ void MxDisplaySurface::ClearScreen()
MxS32 width = m_videoParam.GetRect().GetWidth(); MxS32 width = m_videoParam.GetRect().GetWidth();
MxS32 height = m_videoParam.GetRect().GetHeight(); MxS32 height = m_videoParam.GetRect().GetHeight();
RECT rc = {0, 0, width, height};
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
if (m_ddSurface2->GetSurfaceDesc(&desc) != DD_OK) { if (m_ddSurface2->GetSurfaceDesc(&desc) != DD_OK) {
@ -78,9 +76,9 @@ void MxDisplaySurface::ClearScreen()
ddBltFx.dwFillColor = 0; ddBltFx.dwFillColor = 0;
for (MxS32 i = 0; i < backBuffers; i++) { for (MxS32 i = 0; i < backBuffers; i++) {
if (m_ddSurface2->Blt(&rc, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) { if (m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) {
m_ddSurface2->Restore(); m_ddSurface2->Restore();
m_ddSurface2->Blt(&rc, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx); m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx);
} }
if (m_videoParam.Flags().GetFlipSurfaces()) { if (m_videoParam.Flags().GetFlipSurfaces()) {