Implement/match LegoPathController::AddActor and RemoveActor (#915)

* Implement/match LegoPathController::AddActor and RemoveActor

* Fix types
This commit is contained in:
Christian Semmler
2024-05-13 06:46:59 -04:00
committed by GitHub
parent 91fe09af3c
commit 5f34d2e877
14 changed files with 145 additions and 69 deletions

View File

@@ -287,9 +287,9 @@ MxResult LegoExtraActor::WaitForAnimation()
if (m_boundary != oldBoundary) {
MxU32 b = FALSE;
LegoAnimPresenterSet* set = m_boundary->GetPresenters();
LegoAnimPresenterSet& set = m_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) {
MxU32 roiMapSize;
if ((*it)->GetROIMap(roiMapSize)) {
b = TRUE;
@@ -312,9 +312,9 @@ void LegoExtraActor::Restart()
{
if (m_unk0x0e != 0) {
MxU32 b = FALSE;
LegoAnimPresenterSet* set = m_boundary->GetPresenters();
LegoAnimPresenterSet& set = m_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) {
MxU32 roiMapSize;
if ((*it)->GetROIMap(roiMapSize)) {
b = TRUE;

View File

@@ -431,19 +431,19 @@ MxU32 LegoPathActor::VTable0x6c(
Vector3& p_v3
)
{
LegoAnimPresenterSet* laps = p_boundary->GetPresenters();
LegoAnimPresenterSet& laps = p_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator itap = laps->begin(); itap != laps->end(); itap++) {
for (LegoAnimPresenterSet::iterator itap = laps.begin(); itap != laps.end(); itap++) {
if ((*itap)->VTable0x94(p_v1, p_v2, p_f1, p_f2, p_v3)) {
return 1;
}
}
LegoPathActorSet* plpas = p_boundary->GetActors();
LegoPathActorSet lpas(*plpas);
LegoPathActorSet& plpas = p_boundary->GetActors();
LegoPathActorSet lpas(plpas);
for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) {
if (plpas->find(*itpa) != plpas->end()) {
if (plpas.find(*itpa) != plpas.end()) {
LegoPathActor* actor = *itpa;
if (this != actor && !(actor->GetState() & 0x100)) {

View File

@@ -25,6 +25,14 @@ MxResult LegoPathBoundary::AddActor(LegoPathActor* p_actor)
return SUCCESS;
}
// FUNCTION: LEGO1 0x100574a0
// FUNCTION: BETA10 0x100b156f
MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor)
{
m_actors.erase(p_actor);
return SUCCESS;
}
// STUB: LEGO1 0x100575b0
void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor)
{

View File

@@ -207,7 +207,7 @@ MxResult LegoPathController::FUN_10045c20(
)
{
if (p_actor->GetController() != NULL) {
p_actor->GetController()->FUN_10046770(p_actor);
p_actor->GetController()->RemoveActor(p_actor);
p_actor->SetController(NULL);
}
@@ -226,11 +226,49 @@ MxResult LegoPathController::FUN_10045c20(
return SUCCESS;
}
// STUB: LEGO1 0x10046770
// FUNCTION: BETA10 0x100b7264
undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor)
// STUB: LEGO1 0x10046050
// FUNCTION: BETA10 0x100b6f35
MxResult LegoPathController::FUN_10046050(
LegoPathActor* p_actor,
LegoAnimPresenter* p_presenter,
Vector3& p_position,
Vector3& p_direction
)
{
return 0;
// TODO
return SUCCESS;
}
// FUNCTION: LEGO1 0x100466a0
// FUNCTION: BETA10 0x100b71fe
MxResult LegoPathController::AddActor(LegoPathActor* p_actor)
{
if (p_actor->GetController() != NULL) {
p_actor->GetController()->RemoveActor(p_actor);
p_actor->SetController(NULL);
}
m_actors.insert(p_actor);
p_actor->SetController(this);
return SUCCESS;
}
// FUNCTION: LEGO1 0x10046770
// FUNCTION: BETA10 0x100b7264
MxResult LegoPathController::RemoveActor(LegoPathActor* p_actor)
{
MxResult result = FAILURE;
p_actor->VTable0xc4();
m_actors.erase(p_actor);
for (MxS32 i = 0; i < m_numL; i++) {
if (m_boundaries[i].RemoveActor(p_actor) == SUCCESS) {
result = SUCCESS;
}
}
return result;
}
// FUNCTION: LEGO1 0x100468f0