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

@ -52,13 +52,13 @@ class CarRace : public LegoRace {
return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78
// FUNCTION: BETA10 0x100cd060
RaceSkel* GetSkeleton() { return m_skeleton; }

View File

@ -29,12 +29,12 @@ class JetskiRace : public LegoRace {
return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
void FUN_10016930(MxS32 p_param1, MxS16 p_param2);

View File

@ -11,7 +11,7 @@
#include "mxtypes.h"
class Act1State;
class LegoEventNotificationParam;
class LegoControlManagerNotificationParam;
class LegoPathActor;
class MxEndActionNotificationParam;
class MxNotificationParam;
@ -117,7 +117,7 @@ class LegoRace : public LegoWorld {
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
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));
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);
if (image != NULL) {
if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, image->GetBits(), desc.dwWidth * desc.dwHeight);
memcpy(image->GetBits(), desc.lpSurface, desc.dwWidth * desc.dwHeight);
}
else {
MxU8* surface = (MxU8*) desc.lpSurface;
const LegoU8* bits = image->GetBits();
LegoU8* bits = image->GetBits();
for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth);
memcpy(bits, surface, desc.dwWidth);
surface += desc.lPitch;
bits += desc.dwWidth;
}

View File

@ -248,7 +248,7 @@ void MxTransitionManager::DissolveTransition()
}
else {
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
// starting at the top of the screen.
MxU8* line = (MxU8*) ddsd.lpSurface + 2 * ddsd.lPitch * m_animationTimer;
memset(line, 0, ddsd.lPitch);
line += ddsd.lPitch;
memset(line, 0, ddsd.lPitch);
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);
line += ddsd.lPitch;
memset(line, 0, ddsd.lPitch);
}
SetupCopyRect(&ddsd);
m_ddSurface->Unlock(ddsd.lpSurface);

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ class LegoImage {
{
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 Write(LegoStorage* p_storage);

View File

@ -170,39 +170,16 @@ BOOL MxDirect3D::D3DSetMode()
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
DDSURFACEDESC desc;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
DDBLTFX ddBltFx = {};
ddBltFx.dwSize = sizeof(DDBLTFX);
ddBltFx.dwFillColor = 0;
if (backBuffer->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;
}
backBuffer->Unlock(desc.lpSurface);
}
else {
SDL_Log("MxDirect3D::D3DSetMode() back lock failed\n");
if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
}
if (IsFullScreen()) {
memset(&desc, 0, sizeof(desc));
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 {
if (frontBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n");
}
}

View File

@ -65,8 +65,6 @@ void MxDisplaySurface::ClearScreen()
MxS32 width = m_videoParam.GetRect().GetWidth();
MxS32 height = m_videoParam.GetRect().GetHeight();
RECT rc = {0, 0, width, height};
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
if (m_ddSurface2->GetSurfaceDesc(&desc) != DD_OK) {
@ -78,9 +76,9 @@ void MxDisplaySurface::ClearScreen()
ddBltFx.dwFillColor = 0;
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->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()) {