Refactor MxDSAction to use SetFlags instead of SetUnknown24 across multiple files

This commit is contained in:
Florian Kaiser 2025-05-08 21:18:51 +02:00
parent 0a2d598b57
commit 3428b3b4f0
19 changed files with 38 additions and 38 deletions

View File

@ -149,7 +149,7 @@ IsleApp::~IsleApp()
void IsleApp::Close() void IsleApp::Close()
{ {
MxDSAction ds; MxDSAction ds;
ds.SetUnknown24(-2); ds.SetFlags(-2);
if (Lego()) { if (Lego()) {
GameState()->Save(0); GameState()->Save(0);
@ -859,7 +859,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
} }
ds.SetAtomId(stream->GetAtom()); ds.SetAtomId(stream->GetAtom());
ds.SetUnknown24(-1); ds.SetFlags(-1);
ds.SetObjectId(0); ds.SetObjectId(0);
VideoManager()->EnableFullScreenMovie(TRUE, TRUE); VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
@ -869,7 +869,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
} }
else { else {
ds.SetAtomId(stream->GetAtom()); ds.SetAtomId(stream->GetAtom());
ds.SetUnknown24(-1); ds.SetFlags(-1);
ds.SetObjectId(0); ds.SetObjectId(0);
if (Start(&ds) != SUCCESS) { if (Start(&ds) != SUCCESS) {
return; return;

View File

@ -71,7 +71,7 @@ void MxBackgroundAudioManager::DestroyMusic()
if (m_script.GetInternal()) { if (m_script.GetInternal()) {
MxDSAction ds; MxDSAction ds;
ds.SetAtomId(m_script); ds.SetAtomId(m_script);
ds.SetUnknown24(-2); ds.SetFlags(-2);
DeleteObject(ds); DeleteObject(ds);
Streamer()->Close(m_script.GetInternal()); Streamer()->Close(m_script.GetInternal());
m_enabled = FALSE; m_enabled = FALSE;
@ -257,7 +257,7 @@ MxResult MxBackgroundAudioManager::PlayMusic(
MxDSAction action; MxDSAction action;
action.SetAtomId(GetCurrentAction().GetAtomId()); action.SetAtomId(GetCurrentAction().GetAtomId());
action.SetObjectId(GetCurrentAction().GetObjectId()); action.SetObjectId(GetCurrentAction().GetObjectId());
action.SetUnknown24(GetCurrentAction().GetUnknown24()); action.SetFlags(GetCurrentAction().GetUnknown24());
m_action2.SetAtomId(p_action.GetAtomId()); m_action2.SetAtomId(p_action.GetAtomId());
m_action2.SetObjectId(p_action.GetObjectId()); m_action2.SetObjectId(p_action.GetObjectId());
@ -268,7 +268,7 @@ MxResult MxBackgroundAudioManager::PlayMusic(
GetCurrentAction().SetAtomId(action.GetAtomId()); GetCurrentAction().SetAtomId(action.GetAtomId());
GetCurrentAction().SetObjectId(action.GetObjectId()); GetCurrentAction().SetObjectId(action.GetObjectId());
GetCurrentAction().SetUnknown24(action.GetUnknown24()); GetCurrentAction().SetFlags(action.GetUnknown24());
if (result == SUCCESS) { if (result == SUCCESS) {
m_tickleState = p_tickleState; m_tickleState = p_tickleState;

View File

@ -1012,7 +1012,7 @@ MxResult LegoAnimationManager::FUN_100605e0(
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId)); action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
action.SetObjectId(animInfo.m_objectId); action.SetObjectId(animInfo.m_objectId);
action.SetUnknown24(-1); action.SetFlags(-1);
action.AppendExtra(strlen(buf) + 1, buf); action.AppendExtra(strlen(buf) + 1, buf);
if (StartActionIfUnknown0x13c(action) == SUCCESS) { if (StartActionIfUnknown0x13c(action) == SUCCESS) {
@ -1079,7 +1079,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId)); action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
action.SetObjectId(p_objectId); action.SetObjectId(p_objectId);
action.SetUnknown24(-1); action.SetFlags(-1);
action.AppendExtra(strlen(buf) + 1, buf); action.AppendExtra(strlen(buf) + 1, buf);
if (StartActionIfUnknown0x13c(action) == SUCCESS) { if (StartActionIfUnknown0x13c(action) == SUCCESS) {

View File

@ -294,7 +294,7 @@ void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p
break; break;
case Extra::ActionType::e_close: case Extra::ActionType::e_close:
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
Streamer()->Close(p_pAtom.GetInternal()); Streamer()->Close(p_pAtom.GetInternal());
break; break;
@ -308,7 +308,7 @@ void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p
break; break;
case Extra::ActionType::e_stop: case Extra::ActionType::e_stop:
assert(p_streamId != DS_NOT_A_STREAM); assert(p_streamId != DS_NOT_A_STREAM);
action.SetUnknown24(-2); action.SetFlags(-2);
if (!RemoveFromCurrentWorld(p_pAtom, p_streamId)) { if (!RemoveFromCurrentWorld(p_pAtom, p_streamId)) {
DeleteObject(action); DeleteObject(action);

View File

@ -239,7 +239,7 @@ void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last)
MxDSAction action; MxDSAction action;
action.SetAtomId(*p_id); action.SetAtomId(*p_id);
action.SetUnknown24(-2); action.SetFlags(-2);
for (MxS32 first = p_first, last = p_last; first <= last; first++) { for (MxS32 first = p_first, last = p_last; first <= last; first++) {
action.SetObjectId(first); action.SetObjectId(first);

View File

@ -550,7 +550,7 @@ MxResult LegoOmni::Start(MxDSAction* p_dsAction)
MxResult result = MxOmni::Start(p_dsAction); MxResult result = MxOmni::Start(p_dsAction);
this->m_action.SetAtomId(p_dsAction->GetAtomId()); this->m_action.SetAtomId(p_dsAction->GetAtomId());
this->m_action.SetObjectId(p_dsAction->GetObjectId()); this->m_action.SetObjectId(p_dsAction->GetObjectId());
this->m_action.SetUnknown24(p_dsAction->GetUnknown24()); this->m_action.SetFlags(p_dsAction->GetUnknown24());
return result; return result;
} }

View File

@ -114,11 +114,11 @@ void LegoPathStruct::FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_boo
action.SetAtomId(m_atomId); action.SetAtomId(m_atomId);
if (p_bool) { if (p_bool) {
action.SetUnknown24(-1); action.SetFlags(-1);
Start(&action); Start(&action);
} }
else { else {
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
} }
} }
@ -155,7 +155,7 @@ void LegoPathStruct::PlayMusic(MxBool p_direction, MxU32 p_data)
MxDSAction action; MxDSAction action;
action.SetAtomId(*g_jukeboxScript); action.SetAtomId(*g_jukeboxScript);
action.SetUnknown24(-1); action.SetFlags(-1);
if (p_data <= sizeOfArray(triggersReff)) { if (p_data <= sizeOfArray(triggersReff)) {
action.SetObjectId(music[triggersReff[p_data - 1][p_direction == FALSE] - 1]); action.SetObjectId(music[triggersReff[p_data - 1][p_direction == FALSE] - 1]);

View File

@ -1494,7 +1494,7 @@ void Infocenter::StopCredits()
MxDSAction action; MxDSAction action;
action.SetObjectId(CreditsScript::c_LegoCredits); action.SetObjectId(CreditsScript::c_LegoCredits);
action.SetAtomId(*g_creditsScript); action.SetAtomId(*g_creditsScript);
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
} }
@ -1519,7 +1519,7 @@ void Infocenter::StopCurrentAction()
MxDSAction action; MxDSAction action;
action.SetObjectId(m_currentInfomainScript); action.SetObjectId(m_currentInfomainScript);
action.SetAtomId(*g_infomainScript); action.SetAtomId(*g_infomainScript);
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
m_currentInfomainScript = InfomainScript::c_noneInfomain; m_currentInfomainScript = InfomainScript::c_noneInfomain;
} }
@ -1540,7 +1540,7 @@ void Infocenter::StopBookAnimation()
MxDSAction action; MxDSAction action;
action.SetObjectId(SndanimScript::c_BookWig_Flic); action.SetObjectId(SndanimScript::c_BookWig_Flic);
action.SetAtomId(*g_sndAnimScript); action.SetAtomId(*g_sndAnimScript);
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
} }

View File

@ -401,7 +401,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param)
case IsleScript::c_Observe_LCab_Ctl: case IsleScript::c_Observe_LCab_Ctl:
action.SetAtomId(*g_isleScript); action.SetAtomId(*g_isleScript);
action.SetObjectId(IsleScript::c_Observe_Monkey_Flc); action.SetObjectId(IsleScript::c_Observe_Monkey_Flc);
action.SetUnknown24(0); action.SetFlags(0);
Start(&action); Start(&action);
break; break;
case IsleScript::c_Observe_RCab_Ctl: case IsleScript::c_Observe_RCab_Ctl:

View File

@ -580,7 +580,7 @@ void LegoAct2::Enable(MxBool p_enable)
if (m_unk0x1144 != (Act2mainScript::Script) 0) { if (m_unk0x1144 != (Act2mainScript::Script) 0) {
MxDSAction action; MxDSAction action;
action.SetAtomId(m_atomId); action.SetAtomId(m_atomId);
action.SetUnknown24(-2); action.SetFlags(-2);
action.SetObjectId(m_unk0x1144); action.SetObjectId(m_unk0x1144);
DeleteObject(action); DeleteObject(action);
m_unk0x1144 = (Act2mainScript::Script) 0; m_unk0x1144 = (Act2mainScript::Script) 0;

View File

@ -190,7 +190,7 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key)
m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone(); m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone();
if (m_name[0][m_unk0x280.m_cursorPos] != NULL) { if (m_name[0][m_unk0x280.m_cursorPos] != NULL) {
m_alphabet[key - 'A']->GetAction()->SetUnknown24(m_alphabet[key - 'A']->GetAction()->GetUnknown24() + 1); m_alphabet[key - 'A']->GetAction()->SetFlags(m_alphabet[key - 'A']->GetAction()->GetUnknown24() + 1);
m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE); m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE);
m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating); m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating);
m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121); m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121);

View File

@ -71,7 +71,7 @@ void Score::DeleteScript()
MxDSAction action; MxDSAction action;
action.SetObjectId(InfoscorScript::c_iicc31in_PlayWav); action.SetObjectId(InfoscorScript::c_iicc31in_PlayWav);
action.SetAtomId(*g_infoscorScript); action.SetAtomId(*g_infoscorScript);
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
m_state->SetTutorialFlag(FALSE); m_state->SetTutorialFlag(FALSE);
} }

View File

@ -26,7 +26,7 @@ class MxActionNotificationParam : public MxNotificationParam {
m_action->SetAtomId(oldAction->GetAtomId()); m_action->SetAtomId(oldAction->GetAtomId());
m_action->SetObjectId(oldAction->GetObjectId()); m_action->SetObjectId(oldAction->GetObjectId());
m_action->SetUnknown24(oldAction->GetUnknown24()); m_action->SetFlags(oldAction->GetUnknown24());
} }
// FUNCTION: LEGO1 0x10051050 // FUNCTION: LEGO1 0x10051050

View File

@ -88,7 +88,7 @@ class MxDSObject : public MxCore {
// FUNCTION: BETA10 0x10017940 // FUNCTION: BETA10 0x10017940
const MxAtomId& GetAtomId() { return m_atomId; } const MxAtomId& GetAtomId() { return m_atomId; }
MxS16 GetUnknown24() { return m_unk0x24; } MxS16 GetUnknown24() { return m_flags; }
MxPresenter* GetUnknown28() { return m_unk0x28; } MxPresenter* GetUnknown28() { return m_unk0x28; }
void SetType(Type p_type) { m_type = p_type; } void SetType(Type p_type) { m_type = p_type; }
@ -97,7 +97,7 @@ class MxDSObject : public MxCore {
void SetObjectId(MxU32 p_objectId) { m_objectId = p_objectId; } void SetObjectId(MxU32 p_objectId) { m_objectId = p_objectId; }
// FUNCTION: BETA10 0x10039570 // FUNCTION: BETA10 0x10039570
void SetUnknown24(MxS16 p_unk0x24) { m_unk0x24 = p_unk0x24; } void SetFlags(MxS16 p_flags) { m_flags = p_flags; }
void SetUnknown28(MxPresenter* p_unk0x28) { m_unk0x28 = p_unk0x28; } void SetUnknown28(MxPresenter* p_unk0x28) { m_unk0x28 = p_unk0x28; }
@ -115,7 +115,7 @@ class MxDSObject : public MxCore {
char* m_objectName; // 0x18 char* m_objectName; // 0x18
MxU32 m_objectId; // 0x1c MxU32 m_objectId; // 0x1c
MxAtomId m_atomId; // 0x20 MxAtomId m_atomId; // 0x20
MxS16 m_unk0x24; // 0x24 MxS16 m_flags; // 0x24
MxPresenter* m_unk0x28; // 0x28 MxPresenter* m_unk0x28; // 0x28
}; };

View File

@ -29,7 +29,7 @@ MxDSObject::MxDSObject()
m_unk0x14 = 0; m_unk0x14 = 0;
m_objectName = NULL; m_objectName = NULL;
m_objectId = -1; m_objectId = -1;
m_unk0x24 = -1; m_flags = -1;
m_unk0x28 = NULL; m_unk0x28 = NULL;
} }
@ -49,7 +49,7 @@ void MxDSObject::CopyFrom(MxDSObject& p_dsObject)
m_unk0x14 = p_dsObject.m_unk0x14; m_unk0x14 = p_dsObject.m_unk0x14;
SetObjectName(p_dsObject.m_objectName); SetObjectName(p_dsObject.m_objectName);
m_objectId = p_dsObject.m_objectId; m_objectId = p_dsObject.m_objectId;
m_unk0x24 = p_dsObject.m_unk0x24; m_flags = p_dsObject.m_flags;
m_atomId = p_dsObject.m_atomId; m_atomId = p_dsObject.m_atomId;
m_unk0x28 = p_dsObject.m_unk0x28; m_unk0x28 = p_dsObject.m_unk0x28;
} }
@ -170,7 +170,7 @@ void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_flags)
m_objectId = *(MxU32*) p_source; m_objectId = *(MxU32*) p_source;
p_source += sizeof(m_objectId); p_source += sizeof(m_objectId);
m_unk0x24 = p_flags; m_flags = p_flags;
} }
// FUNCTION: LEGO1 0x100bfa80 // FUNCTION: LEGO1 0x100bfa80

View File

@ -184,7 +184,7 @@ void MxOmni::Destroy()
{ {
MxDSAction action; MxDSAction action;
action.SetObjectId(-1); action.SetObjectId(-1);
action.SetUnknown24(-2); action.SetFlags(-2);
DeleteObject(action); DeleteObject(action);
} }

View File

@ -42,12 +42,12 @@ MxResult MxRAMStreamController::VTable0x20(MxDSAction* p_action)
MxResult result = FAILURE; MxResult result = FAILURE;
if (p_action->GetUnknown24() == -1) { if (p_action->GetUnknown24() == -1) {
p_action->SetUnknown24(-3); p_action->SetFlags(-3);
MxDSObject* action = m_unk0x54.Find(p_action); MxDSObject* action = m_unk0x54.Find(p_action);
if (action != NULL) { if (action != NULL) {
unk0x24 = action->GetUnknown24() + 1; unk0x24 = action->GetUnknown24() + 1;
} }
p_action->SetUnknown24(unk0x24); p_action->SetFlags(unk0x24);
} }
else { else {
if (m_unk0x54.Find(p_action)) { if (m_unk0x54.Find(p_action)) {

View File

@ -127,7 +127,7 @@ MxResult MxStreamController::VTable0x24(MxDSAction* p_action)
return FAILURE; return FAILURE;
} }
else { else {
p_action->SetUnknown24(m_action0x60->GetUnknown24()); p_action->SetFlags(m_action0x60->GetUnknown24());
p_action->SetObjectId(m_action0x60->GetObjectId()); p_action->SetObjectId(m_action0x60->GetObjectId());
return FUN_100c1f00(m_action0x60); return FUN_100c1f00(m_action0x60);
} }
@ -183,7 +183,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset)
} }
} }
p_action->SetUnknown24(newUnknown24 + 1); p_action->SetFlags(newUnknown24 + 1);
} }
else { else {
if (m_unk0x3c.Find(p_action)) { if (m_unk0x3c.Find(p_action)) {

View File

@ -98,7 +98,7 @@ MxStreamController* MxStreamer::Open(const char* p_name, MxU16 p_lookupType)
MxLong MxStreamer::Close(const char* p_name) MxLong MxStreamer::Close(const char* p_name)
{ {
MxDSAction ds; MxDSAction ds;
ds.SetUnknown24(-2); ds.SetFlags(-2);
for (list<MxStreamController*>::iterator it = m_controllers.begin(); it != m_controllers.end(); it++) { for (list<MxStreamController*>::iterator it = m_controllers.begin(); it != m_controllers.end(); it++) {
MxStreamController* c = *it; MxStreamController* c = *it;
@ -192,10 +192,10 @@ MxResult MxStreamer::DeleteObject(MxDSAction* p_dsAction)
if (p_dsAction) { if (p_dsAction) {
tempAction.SetObjectId(p_dsAction->GetObjectId()); tempAction.SetObjectId(p_dsAction->GetObjectId());
tempAction.SetAtomId(p_dsAction->GetAtomId()); tempAction.SetAtomId(p_dsAction->GetAtomId());
tempAction.SetUnknown24(p_dsAction->GetUnknown24()); tempAction.SetFlags(p_dsAction->GetUnknown24());
} }
else { else {
tempAction.SetUnknown24(-2); tempAction.SetFlags(-2);
} }
MxResult result = FAILURE; MxResult result = FAILURE;
@ -233,7 +233,7 @@ MxLong MxStreamer::Notify(MxParam& p_param)
MxStreamController* c = s.GetController(); MxStreamController* c = s.GetController();
MxDSAction ds; MxDSAction ds;
ds.SetUnknown24(-2); ds.SetFlags(-2);
if (c->IsStoped(&ds)) { if (c->IsStoped(&ds)) {
delete c; delete c;