implement RemoveFromCurrentWorld (#700)

* implement RemoveFromCurrentWorld

* Replace magic values

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-03-19 16:07:07 -04:00
committed by GitHub
parent 2477b89e32
commit 556c7698d8
4 changed files with 44 additions and 20 deletions

View File

@@ -95,7 +95,7 @@ void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targe
break;
case Extra::ActionType::e_stop:
action.SetUnknown24(-2);
if (!FUN_1003ee00(p_pAtom, p_targetEntityId)) {
if (!RemoveFromCurrentWorld(p_pAtom, p_targetEntityId)) {
DeleteObject(action);
}
break;
@@ -238,10 +238,33 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO
}
}
// STUB: LEGO1 0x1003ee00
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
// FUNCTION: LEGO1 0x1003ee00
MxBool RemoveFromCurrentWorld(MxAtomId& p_atomId, MxS32 p_id)
{
return TRUE;
LegoWorld* world = CurrentWorld();
if (world) {
MxCore* object = world->Find(p_atomId, p_id);
if (object) {
world->Remove(object);
if (!object->IsA("MxPresenter")) {
delete object;
}
else {
if (((MxPresenter*) object)->GetAction()) {
FUN_100b7220(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE);
}
((MxPresenter*) object)->EndAction();
}
return TRUE;
}
}
return FALSE;
}
// FUNCTION: LEGO1 0x1003ee80