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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 20 deletions

View file

@ -20,7 +20,7 @@ Extra::ActionType MatchActionString(const char*);
void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender);
void SetCameraControllerFromIsle();
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
MxBool RemoveFromCurrentWorld(MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool);
void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60();

View file

@ -1,5 +1,6 @@
#include "bike.h"
#include "isle_actions.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoomni.h"
@ -35,11 +36,11 @@ void Bike::VTable0xe4()
{
IslePathActor::VTable0xe4();
GameState()->SetCurrentArea(LegoGameState::Area::e_bike);
FUN_1003ee00(*g_isleScript, 11);
FUN_1003ee00(*g_isleScript, 12);
FUN_1003ee00(*g_isleScript, 15);
FUN_1003ee00(*g_isleScript, 14);
FUN_1003ee00(*g_isleScript, 13);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeDashboard_Bitmap);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeArms_Ctl);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeHorn_Ctl);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeHorn_Sound);
RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeInfo_Ctl);
ControlManager()->Unregister(this);
}

View file

@ -79,16 +79,16 @@ void Helicopter::VTable0xe4()
}
m_state->SetUnknown8(0);
FUN_1003ee00(m_script, 0x16);
FUN_1003ee00(m_script, 0x17);
FUN_1003ee00(m_script, 0x18);
FUN_1003ee00(m_script, 0x19);
FUN_1003ee00(m_script, 0x1a);
FUN_1003ee00(m_script, 0x1b);
FUN_1003ee00(m_script, 0x1c);
FUN_1003ee00(m_script, 0x1d);
FUN_1003ee00(m_script, 0x1e);
FUN_1003ee00(m_script, 0x1f);
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterDashboard_Bitmap);
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterArms_Ctl);
RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_TakeOff_Ctl);
RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_Land_Ctl);
RemoveFromCurrentWorld(m_script, Act3Script::c_Helicopter_Pizza_Ctl);
RemoveFromCurrentWorld(m_script, Act3Script::c_Helicopter_Donut_Ctl);
RemoveFromCurrentWorld(m_script, Act3Script::c_Helicopter_Info_Ctl);
RemoveFromCurrentWorld(m_script, 0x1d);
RemoveFromCurrentWorld(m_script, 0x1e);
RemoveFromCurrentWorld(m_script, 0x1f);
AnimationManager()->FUN_1005f6d0(TRUE);
ControlManager()->Unregister(this);
}

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)
{
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