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

View File

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

View File

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

View File

@ -518,26 +518,36 @@ LegoOmni::World LegoOmni::GetWorldId(const char* p_key)
}
// FUNCTION: LEGO1 0x1005b4f0
// FUNCTION: BETA10 0x1008eeec
void LegoOmni::Disable(MxBool p_disable, MxU16 p_flags)
{
if (p_disable) {
if (p_flags & c_disableInput) {
m_inputManager->DisableInputProcessing();
}
#ifdef BETA10
if (this->m_paused != p_disable) {
// 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) {
((LegoVideoManager*) m_videoManager)->SetRender3D(FALSE);
}
if (p_disable) {
if (p_flags & c_disableInput) {
m_inputManager->DisableInputProcessing();
}
if (p_flags & c_clearScreen) {
m_videoManager->GetDisplaySurface()->ClearScreen();
if (p_flags & c_disable3d) {
((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 {
m_inputManager->EnableInputProcessing();
((LegoVideoManager*) m_videoManager)->SetRender3D(TRUE);
((LegoVideoManager*) m_videoManager)->UpdateView(0, 0, 0, 0);
}
#endif
}
// 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};
// FUNCTION: LEGO1 0x10071d40
void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
void Act3List::Insert(MxS32 p_objectId, InsertMode p_option)
{
if (m_unk0x0c) {
return;
}
switch (p_option) {
case 1:
case InsertMode::e_replaceAction:
if (!empty()) {
FUN_10071fa0();
DeleteActionWrapper();
push_back(Act3ListElement(p_objectId, p_option, FALSE));
}
else {
@ -126,7 +126,7 @@ void Act3List::Insert(MxS32 p_objectId, MxS32 p_option)
push_back(Act3ListElement(p_objectId, p_option, TRUE));
}
break;
case 2:
case InsertMode::e_queueAction:
if (empty()) {
push_back(Act3ListElement(p_objectId, p_option, TRUE));
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));
}
break;
case 3:
case InsertMode::e_onlyIfEmpty:
if (empty()) {
push_back(Act3ListElement(p_objectId, p_option, TRUE));
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
void Act3List::FUN_10071fa0()
void Act3List::DeleteActionWrapper()
{
DeleteAction();
}
@ -161,7 +161,7 @@ void Act3List::Clear()
}
for (Act3List::iterator it = begin(); it != end();) {
if ((*it).m_unk0x08) {
if ((*it).m_hasStarted) {
MxDSAction ds;
ds.SetAtomId(*g_act3Script);
ds.SetObjectId((*it).m_objectId);
@ -175,46 +175,47 @@ void Act3List::Clear()
// FUNCTION: LEGO1 0x100720d0
void Act3List::FUN_100720d0(MxU32 p_objectId)
{
if (m_unk0x0c == 0) {
MxU32 removed = FALSE;
if (m_unk0x0c) {
return;
}
if (!empty()) {
if (p_objectId != 0) {
for (Act3List::iterator it = begin(); it != end(); it++) {
if ((*it).m_unk0x08 && (*it).m_objectId == p_objectId) {
erase(it);
removed = TRUE;
break;
}
MxU32 removed = FALSE;
if (!empty()) {
if (p_objectId != 0) {
for (Act3List::iterator it = begin(); it != end(); it++) {
if ((*it).m_hasStarted && (*it).m_objectId == p_objectId) {
erase(it);
removed = TRUE;
break;
}
}
else {
pop_front();
removed = TRUE;
}
}
else {
pop_front();
removed = TRUE;
}
if (removed && size() > 0) {
// TODO: Match
Act3List::iterator it = begin();
Act3ListElement& item = *(it++);
if (removed && size() > 0) {
Act3List::iterator it = begin();
Act3ListElement& firstItem = *(it++);
for (; it != end(); it++) {
if ((*it).m_unk0x04 == 1) {
for (Act3List::iterator it2 = begin(); it2 != it;) {
if ((*it2).m_unk0x08) {
FUN_10071fa0();
return;
}
it2 = erase(it2);
for (; it != end(); it++) {
if ((*it).m_unk0x04 == 1) {
for (Act3List::iterator it2 = begin(); it2 != it;) {
if ((*it2).m_hasStarted) {
DeleteActionWrapper();
return;
}
it2 = erase(it2);
}
}
}
if (!item.m_unk0x08) {
item.m_unk0x08 = TRUE;
InvokeAction(Extra::e_start, *g_act3Script, item.m_objectId, NULL);
}
if (!firstItem.m_hasStarted) {
firstItem.m_hasStarted = TRUE;
InvokeAction(Extra::e_start, *g_act3Script, firstItem.m_objectId, NULL);
}
}
}
@ -454,14 +455,14 @@ void Act3::TriggerHitSound(undefined4 p_param1)
m_bricksterDonutSound = 0;
}
m_unk0x4220.Insert(g_bricksterDonutSounds[m_bricksterDonutSound++], 1);
m_unk0x4220.Insert(g_bricksterDonutSounds[m_bricksterDonutSound++], Act3List::e_replaceAction);
return;
}
default:
return;
}
m_unk0x4220.Insert(objectId, 3);
m_unk0x4220.Insert(objectId, Act3List::e_onlyIfEmpty);
}
// FUNCTION: LEGO1 0x10072c30

View File

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

View File

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