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 InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender);
void SetCameraControllerFromIsle(); void SetCameraControllerFromIsle();
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); 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 FUN_1003ef00(MxBool);
void SetAppCursor(WPARAM p_wparam); void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60(); MxBool FUN_1003ef60();

View file

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

View file

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

View file

@ -95,7 +95,7 @@ void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targe
break; break;
case Extra::ActionType::e_stop: case Extra::ActionType::e_stop:
action.SetUnknown24(-2); action.SetUnknown24(-2);
if (!FUN_1003ee00(p_pAtom, p_targetEntityId)) { if (!RemoveFromCurrentWorld(p_pAtom, p_targetEntityId)) {
DeleteObject(action); DeleteObject(action);
} }
break; 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 // FUNCTION: LEGO1 0x1003ee00
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id) 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 // FUNCTION: LEGO1 0x1003ee80