Interpret Act3List properties, minor fixes (#1619)

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz 2025-07-12 17:05:29 +02:00 committed by GitHub
parent 10986376cb
commit ac46537599
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 89 additions and 64 deletions

View File

@ -20,12 +20,12 @@ class MxQuaternionTransformer;
struct Act3ListElement { struct Act3ListElement {
MxU32 m_objectId; // 0x00 MxU32 m_objectId; // 0x00
undefined4 m_unk0x04; // 0x04 undefined4 m_unk0x04; // 0x04
undefined m_unk0x08; // 0x08 MxBool m_hasStarted; // 0x08
Act3ListElement() {} Act3ListElement() {}
Act3ListElement(MxU32 p_objectId, undefined4 p_unk0x04, undefined p_unk0x08) Act3ListElement(MxU32 p_objectId, undefined4 p_unk0x04, MxBool p_hasStarted)
: m_objectId(p_objectId), m_unk0x04(p_unk0x04), m_unk0x08(p_unk0x08) : m_objectId(p_objectId), m_unk0x04(p_unk0x04), m_hasStarted(p_hasStarted)
{ {
} }
@ -36,10 +36,16 @@ struct Act3ListElement {
// SIZE 0x10 // SIZE 0x10
class Act3List : private list<Act3ListElement> { class Act3List : private list<Act3ListElement> {
public: public:
enum InsertMode {
e_replaceAction = 1,
e_queueAction = 2,
e_onlyIfEmpty = 3
};
Act3List() { m_unk0x0c = 0; } Act3List() { m_unk0x0c = 0; }
void Insert(MxS32 p_objectId, MxS32 p_option); void Insert(MxS32 p_objectId, InsertMode p_option);
void FUN_10071fa0(); void DeleteActionWrapper();
void Clear(); void Clear();
void FUN_100720d0(MxU32 p_objectId); void FUN_100720d0(MxU32 p_objectId);

View File

@ -117,6 +117,7 @@ public:
void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; } void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; }
void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; } void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; }
// FUNCTION: BETA10 0x1002e290
void DisableInputProcessing() void DisableInputProcessing()
{ {
m_unk0x88 = TRUE; m_unk0x88 = TRUE;

View File

@ -62,7 +62,9 @@ public:
MxBool GetRender3D() { return m_render3d; } MxBool GetRender3D() { return m_render3d; }
double GetElapsedSeconds() { return m_elapsedSeconds; } double GetElapsedSeconds() { return m_elapsedSeconds; }
// FUNCTION: BETA10 0x1002e290
void SetRender3D(MxBool p_render3d) { m_render3d = p_render3d; } void SetRender3D(MxBool p_render3d) { m_render3d = p_render3d; }
void SetUnk0x554(MxBool p_unk0x554) { m_unk0x554 = p_unk0x554; } void SetUnk0x554(MxBool p_unk0x554) { m_unk0x554 = p_unk0x554; }
private: private:

View File

@ -518,26 +518,36 @@ LegoOmni::World LegoOmni::GetWorldId(const char* p_key)
} }
// FUNCTION: LEGO1 0x1005b4f0 // FUNCTION: LEGO1 0x1005b4f0
// FUNCTION: BETA10 0x1008eeec
void LegoOmni::Disable(MxBool p_disable, MxU16 p_flags) void LegoOmni::Disable(MxBool p_disable, MxU16 p_flags)
{ {
if (p_disable) { #ifdef BETA10
if (p_flags & c_disableInput) { if (this->m_paused != p_disable) {
m_inputManager->DisableInputProcessing(); // This is probably a different variable, but this code was mostly added for structural matching
} m_paused = p_disable;
#endif
if (p_flags & c_disable3d) { if (p_disable) {
((LegoVideoManager*) m_videoManager)->SetRender3D(FALSE); if (p_flags & c_disableInput) {
} m_inputManager->DisableInputProcessing();
}
if (p_flags & c_clearScreen) { if (p_flags & c_disable3d) {
m_videoManager->GetDisplaySurface()->ClearScreen(); ((LegoVideoManager*) m_videoManager)->SetRender3D(FALSE);
}
if (p_flags & c_clearScreen) {
m_videoManager->GetDisplaySurface()->ClearScreen();
}
} }
else {
m_inputManager->EnableInputProcessing();
((LegoVideoManager*) m_videoManager)->SetRender3D(TRUE);
((LegoVideoManager*) m_videoManager)->UpdateView(0, 0, 0, 0);
}
#ifdef BETA10
} }
else { #endif
m_inputManager->EnableInputProcessing();
((LegoVideoManager*) m_videoManager)->SetRender3D(TRUE);
((LegoVideoManager*) m_videoManager)->UpdateView(0, 0, 0, 0);
}
} }
// FUNCTION: LEGO1 0x1005b560 // FUNCTION: LEGO1 0x1005b560

View File

@ -109,16 +109,16 @@ Act3Script::Script g_unk0x100d95e8[] =
{Act3Script::c_tlp053in_RunAnim, Act3Script::c_tlp064la_RunAnim, Act3Script::c_tlp068in_RunAnim}; {Act3Script::c_tlp053in_RunAnim, Act3Script::c_tlp064la_RunAnim, Act3Script::c_tlp068in_RunAnim};
// FUNCTION: LEGO1 0x10071d40 // FUNCTION: LEGO1 0x10071d40
void Act3List::Insert(MxS32 p_objectId, MxS32 p_option) void Act3List::Insert(MxS32 p_objectId, InsertMode p_option)
{ {
if (m_unk0x0c) { if (m_unk0x0c) {
return; return;
} }
switch (p_option) { switch (p_option) {
case 1: case InsertMode::e_replaceAction:
if (!empty()) { if (!empty()) {
FUN_10071fa0(); DeleteActionWrapper();
push_back(Act3ListElement(p_objectId, p_option, FALSE)); push_back(Act3ListElement(p_objectId, p_option, FALSE));
} }
else { else {
@ -126,7 +126,7 @@ void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
push_back(Act3ListElement(p_objectId, p_option, TRUE)); push_back(Act3ListElement(p_objectId, p_option, TRUE));
} }
break; break;
case 2: case InsertMode::e_queueAction:
if (empty()) { if (empty()) {
push_back(Act3ListElement(p_objectId, p_option, TRUE)); push_back(Act3ListElement(p_objectId, p_option, TRUE));
InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL); InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL);
@ -135,7 +135,7 @@ void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
push_back(Act3ListElement(p_objectId, p_option, FALSE)); push_back(Act3ListElement(p_objectId, p_option, FALSE));
} }
break; break;
case 3: case InsertMode::e_onlyIfEmpty:
if (empty()) { if (empty()) {
push_back(Act3ListElement(p_objectId, p_option, TRUE)); push_back(Act3ListElement(p_objectId, p_option, TRUE));
InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL); InvokeAction(Extra::e_start, *g_act3Script, p_objectId, NULL);
@ -145,7 +145,7 @@ void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
} }
// FUNCTION: LEGO1 0x10071fa0 // FUNCTION: LEGO1 0x10071fa0
void Act3List::FUN_10071fa0() void Act3List::DeleteActionWrapper()
{ {
DeleteAction(); DeleteAction();
} }
@ -161,7 +161,7 @@ void Act3List::Clear()
} }
for (Act3List::iterator it = begin(); it != end();) { for (Act3List::iterator it = begin(); it != end();) {
if ((*it).m_unk0x08) { if ((*it).m_hasStarted) {
MxDSAction ds; MxDSAction ds;
ds.SetAtomId(*g_act3Script); ds.SetAtomId(*g_act3Script);
ds.SetObjectId((*it).m_objectId); ds.SetObjectId((*it).m_objectId);
@ -175,46 +175,47 @@ void Act3List::Clear()
// FUNCTION: LEGO1 0x100720d0 // FUNCTION: LEGO1 0x100720d0
void Act3List::FUN_100720d0(MxU32 p_objectId) void Act3List::FUN_100720d0(MxU32 p_objectId)
{ {
if (m_unk0x0c == 0) { if (m_unk0x0c) {
MxU32 removed = FALSE; return;
}
if (!empty()) { MxU32 removed = FALSE;
if (p_objectId != 0) {
for (Act3List::iterator it = begin(); it != end(); it++) { if (!empty()) {
if ((*it).m_unk0x08 && (*it).m_objectId == p_objectId) { if (p_objectId != 0) {
erase(it); for (Act3List::iterator it = begin(); it != end(); it++) {
removed = TRUE; if ((*it).m_hasStarted && (*it).m_objectId == p_objectId) {
break; erase(it);
} removed = TRUE;
break;
} }
} }
else { }
pop_front(); else {
removed = TRUE; pop_front();
} removed = TRUE;
}
if (removed && size() > 0) { if (removed && size() > 0) {
// TODO: Match Act3List::iterator it = begin();
Act3List::iterator it = begin(); Act3ListElement& firstItem = *(it++);
Act3ListElement& item = *(it++);
for (; it != end(); it++) { for (; it != end(); it++) {
if ((*it).m_unk0x04 == 1) { if ((*it).m_unk0x04 == 1) {
for (Act3List::iterator it2 = begin(); it2 != it;) { for (Act3List::iterator it2 = begin(); it2 != it;) {
if ((*it2).m_unk0x08) { if ((*it2).m_hasStarted) {
FUN_10071fa0(); DeleteActionWrapper();
return; return;
}
it2 = erase(it2);
} }
it2 = erase(it2);
} }
} }
}
if (!item.m_unk0x08) { if (!firstItem.m_hasStarted) {
item.m_unk0x08 = TRUE; firstItem.m_hasStarted = TRUE;
InvokeAction(Extra::e_start, *g_act3Script, item.m_objectId, NULL); InvokeAction(Extra::e_start, *g_act3Script, firstItem.m_objectId, NULL);
}
} }
} }
} }
@ -454,14 +455,14 @@ void Act3::TriggerHitSound(undefined4 p_param1)
m_bricksterDonutSound = 0; m_bricksterDonutSound = 0;
} }
m_unk0x4220.Insert(g_bricksterDonutSounds[m_bricksterDonutSound++], 1); m_unk0x4220.Insert(g_bricksterDonutSounds[m_bricksterDonutSound++], Act3List::e_replaceAction);
return; return;
} }
default: default:
return; return;
} }
m_unk0x4220.Insert(objectId, 3); m_unk0x4220.Insert(objectId, Act3List::e_onlyIfEmpty);
} }
// FUNCTION: LEGO1 0x10072c30 // FUNCTION: LEGO1 0x10072c30

View File

@ -41,7 +41,10 @@ public:
MxVideoParam& GetVideoParam() { return this->m_videoParam; } MxVideoParam& GetVideoParam() { return this->m_videoParam; }
LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; }
// FUNCTION: BETA10 0x1002e290
MxDisplaySurface* GetDisplaySurface() { return this->m_displaySurface; } MxDisplaySurface* GetDisplaySurface() { return this->m_displaySurface; }
MxRegion* GetRegion() { return this->m_region; } MxRegion* GetRegion() { return this->m_region; }
// SYNTHETIC: LEGO1 0x100be280 // SYNTHETIC: LEGO1 0x100be280

View File

@ -42,20 +42,22 @@ void MxDisplaySurface::Init()
} }
// FUNCTION: LEGO1 0x100ba640 // FUNCTION: LEGO1 0x100ba640
// FUNCTION: BETA10 0x1013f506
void MxDisplaySurface::ClearScreen() void MxDisplaySurface::ClearScreen()
{ {
MxS32 i;
MxS32 backBuffers; MxS32 backBuffers;
DDSURFACEDESC desc; DDSURFACEDESC desc;
HRESULT hr; HRESULT hr;
if (!m_videoParam.Flags().GetFlipSurfaces()) { if (m_videoParam.Flags().GetFlipSurfaces()) {
backBuffers = 1;
}
else {
backBuffers = m_videoParam.GetBackBuffers() + 1; backBuffers = m_videoParam.GetBackBuffers() + 1;
} }
else {
backBuffers = 1;
}
for (MxS32 i = 0; i < backBuffers; i++) { for (i = 0; i < backBuffers; i++) {
memset(&desc, 0, sizeof(DDSURFACEDESC)); memset(&desc, 0, sizeof(DDSURFACEDESC));
desc.dwSize = sizeof(DDSURFACEDESC); desc.dwSize = sizeof(DDSURFACEDESC);