From 120ffdaca6977758263369cfba7a4da0e5e4715a Mon Sep 17 00:00:00 2001 From: disinvite Date: Thu, 17 Apr 2025 21:49:09 -0400 Subject: [PATCH] Improve Act3Ammo --- LEGO1/lego/legoomni/include/act3ammo.h | 2 +- .../lego/legoomni/include/legopathboundary.h | 8 +- LEGO1/lego/legoomni/src/actors/act3ammo.cpp | 104 +++++++++--------- 3 files changed, 63 insertions(+), 51 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3ammo.h b/LEGO1/lego/legoomni/include/act3ammo.h index ee4e3dc1..e80aa6b0 100644 --- a/LEGO1/lego/legoomni/include/act3ammo.h +++ b/LEGO1/lego/legoomni/include/act3ammo.h @@ -90,7 +90,7 @@ class Act3Ammo : public LegoPathActor { // Act3Ammo::`scalar deleting destructor' private: - MxResult FUN_10053db0(float p_param1, const Matrix4& p_param2); + MxResult FUN_10053db0(float p_param1, Matrix4& p_param2); static Mx3DPointFloat g_unk0x10104f08; diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index a2a2d6ba..1ceef36a 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -81,7 +81,7 @@ class LegoPathBoundary : public LegoWEGEdge { // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::erase // TEMPLATE: LEGO1 0x1002c440 -// TEMPLATE: BETA10 0x100b6480 +// TEMPLATE: BETA10 0x10020480 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::find // TEMPLATE: LEGO1 0x1002c4c0 @@ -196,6 +196,12 @@ class LegoPathBoundary : public LegoWEGEdge { // TEMPLATE: BETA10 0x10082b40 // _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::const_iterator::operator* +// TEMPLATE: BETA10 0x100b6440 +// set >::find + +// TEMPLATE: BETA10 0x100b6480 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::find + // TEMPLATE: BETA10 0x10021dc0 // Set::Set diff --git a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp index 6eb4c70a..59a20e5a 100644 --- a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp @@ -198,7 +198,7 @@ MxResult Act3Ammo::FUN_10053d30(LegoPathController* p_p, MxFloat p_unk0x19c) // FUNCTION: LEGO1 0x10053db0 // FUNCTION: BETA10 0x1001e0f0 -MxResult Act3Ammo::FUN_10053db0(float p_param1, const Matrix4& p_param2) +MxResult Act3Ammo::FUN_10053db0(float p_param1, Matrix4& p_param2) { float local34 = p_param1 * p_param1; @@ -397,69 +397,75 @@ void Act3Ammo::Animate(float p_time) LegoPathActorSet lpas(plpas); for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) { - if (plpas.find(*itpa) != plpas.end() && this != *itpa) { - LegoROI* r = (*itpa)->GetROI(); - assert(r); + if (plpas.find(*itpa) == plpas.end()) { + continue; + } - if (!strncmp(r->GetName(), "pammo", 5)) { - Mx3DPointFloat local1c8; - Mx3DPointFloat local1b4; + if (this == *itpa) { + continue; + } - local1c8 = r->GetLocal2World()[3]; - local1b4 = m_roi->GetLocal2World()[3]; + LegoROI* r = (*itpa)->GetROI(); + assert(r); - local1b4 -= local1c8; + if (!strncmp(r->GetName(), "pammo", 5)) { + Mx3DPointFloat local1c8; + Mx3DPointFloat local1b4; - float radius = r->GetWorldBoundingSphere().Radius(); - if (local1b4.LenSquared() <= radius * radius) { - MxS32 index = -1; - if (sscanf(r->GetName(), "pammo%d", &index) != 1) { - assert(0); - } + local1c8 = r->GetLocal2World()[3]; + local1b4 = m_roi->GetLocal2World()[3]; - assert(m_world); + local1b4 -= local1c8; - if (m_world->m_pizzas[index].IsValid() && !m_world->m_pizzas[index].IsSharkFood()) { - m_world->EatPizza(index); - m_world->m_brickster->FUN_100417c0(); - } + float radius = r->GetWorldBoundingSphere().Radius(); + if (local1b4.LenSquared() <= radius * radius) { + MxS32 index = -1; + if (sscanf(r->GetName(), "pammo%d", &index) != 1) { + assert(0); + } - if (IsDonut()) { - assert(SoundManager()->GetCacheSoundManager()); - SoundManager()->GetCacheSoundManager()->Play("dnhitpz", NULL, FALSE); - m_world->RemoveDonut(*this); - local14 = TRUE; - break; - } + assert(m_world); + + if (m_world->m_pizzas[index].IsValid() && !m_world->m_pizzas[index].IsSharkFood()) { + m_world->EatPizza(index); + m_world->m_brickster->FUN_100417c0(); + } + + if (IsDonut()) { + assert(SoundManager()->GetCacheSoundManager()); + SoundManager()->GetCacheSoundManager()->Play("dnhitpz", NULL, FALSE); + m_world->RemoveDonut(*this); + local14 = TRUE; + break; } } - else if (!strncmp(r->GetName(), "dammo", 5)) { - Mx3DPointFloat local1f8; - Mx3DPointFloat local1e4; + } + else if (!strncmp(r->GetName(), "dammo", 5)) { + Mx3DPointFloat local1f8; + Mx3DPointFloat local1e4; - local1f8 = r->GetLocal2World()[3]; - local1e4 = m_roi->GetLocal2World()[3]; + local1f8 = r->GetLocal2World()[3]; + local1e4 = m_roi->GetLocal2World()[3]; - local1e4 -= local1f8; + local1e4 -= local1f8; - float radius = r->GetWorldBoundingSphere().Radius(); - if (local1e4.LenSquared() <= radius * radius) { - MxS32 index = -1; - if (sscanf(r->GetName(), "dammo%d", &index) != 1) { - assert(0); - } + float radius = r->GetWorldBoundingSphere().Radius(); + if (local1e4.LenSquared() <= radius * radius) { + MxS32 index = -1; + if (sscanf(r->GetName(), "dammo%d", &index) != 1) { + assert(0); + } - assert(m_world); + assert(m_world); - m_world->EatDonut(index); + m_world->EatDonut(index); - if (IsPizza()) { - assert(SoundManager()->GetCacheSoundManager()); - SoundManager()->GetCacheSoundManager()->Play("pzhitdn", NULL, FALSE); - m_world->RemovePizza(*this); - local14 = TRUE; - break; - } + if (IsPizza()) { + assert(SoundManager()->GetCacheSoundManager()); + SoundManager()->GetCacheSoundManager()->Play("pzhitdn", NULL, FALSE); + m_world->RemovePizza(*this); + local14 = TRUE; + break; } } }