Implement/match Act3Ammo::Create, Act3Ammo::FUN_10053cb0, Act3Ammo::FUN_10053d30 (#1205)

* Implement/match Act3Ammo::Create

* Fix BETA addr

* Move

* Move

* Remove header

* Add missing header
This commit is contained in:
Christian Semmler 2024-12-10 14:35:59 -07:00 committed by GitHub
parent 59e2aa2804
commit adc83dc76e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 126 additions and 25 deletions

View file

@ -11,7 +11,10 @@ class Act3;
class Act3Ammo : public LegoPathActor {
public:
enum {
c_placed = 0x04
c_pizza = 0x01,
c_donut = 0x02,
c_valid = 0x04,
c_bit4 = 0x08
};
Act3Ammo();
@ -21,9 +24,7 @@ class Act3Ammo : public LegoPathActor {
void VTable0x70(float p_time) override; // vtable+0x70
// FUNCTION: BETA10 0x10017750
MxU32 IsPlaced() { return m_ammoFlag & c_placed; }
MxFloat GetUnknown0x158() { return m_unk0x158; }
MxU32 IsValid() { return m_ammoFlag & c_valid; }
// FUNCTION: BETA10 0x100177b0
Mx3DPointFloat* GetUnknown0x160() { return m_unk0x160; }
@ -31,12 +32,39 @@ class Act3Ammo : public LegoPathActor {
// FUNCTION: BETA10 0x100177e0
MxFloat* GetUnknown0x19c() { return &m_unk0x19c; }
// FUNCTION: BETA10 0x1001fbd0
void SetValid(MxBool p_valid)
{
if (p_valid) {
m_ammoFlag |= c_valid;
}
else {
m_ammoFlag &= ~c_valid;
}
}
// FUNCTION: BETA10 0x1001fc80
MxU32 IsPizza() { return m_ammoFlag & c_pizza; }
// FUNCTION: BETA10 0x1001fcb0
void SetBit4(MxBool p_bit4)
{
if (p_bit4) {
m_ammoFlag |= c_bit4;
}
else {
m_ammoFlag &= ~c_bit4;
}
}
MxFloat GetUnknown0x158() { return m_unk0x158; }
void SetUnknown0x158(MxFloat p_unk0x158) { m_unk0x158 = p_unk0x158; }
MxResult FUN_10053980(Act3* p_a3, MxU32 p_isDonut, MxS32 p_index);
MxResult Create(Act3* p_a3, MxU32 p_isPizza, MxS32 p_index);
MxResult FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp);
MxResult FUN_10053cb0(LegoPathController* p_controller, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c);
MxResult FUN_10053d30(LegoPathController* p_controller, MxFloat p_unk0x19c);
MxResult FUN_10053cb0(LegoPathController* p_p, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c);
MxResult FUN_10053d30(LegoPathController* p_p, MxFloat p_unk0x19c);
// SYNTHETIC: LEGO1 0x10053880
// Act3Ammo::`scalar deleting destructor'

View file

@ -1,10 +1,13 @@
#include "act3ammo.h"
#include "legocachesoundmanager.h"
#include "legocharactermanager.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "roi/legoroi.h"
#include <assert.h>
#include <stdio.h>
DECOMP_SIZE_ASSERT(Act3Ammo, 0x1a0)
@ -36,11 +39,44 @@ void Act3Ammo::Destroy(MxBool p_fromDestructor)
}
}
// STUB: LEGO1 0x10053980
// STUB: BETA10 0x1001d8b3
MxResult Act3Ammo::FUN_10053980(Act3* p_a3, MxU32 p_isDonut, MxS32 p_index)
// FUNCTION: LEGO1 0x10053980
// FUNCTION: BETA10 0x1001d8b3
MxResult Act3Ammo::Create(Act3* p_a3, MxU32 p_isPizza, MxS32 p_index)
{
// TODO
assert(m_ammoFlag);
char name[12];
if (p_isPizza) {
sprintf(name, "pammo%d", p_index);
m_roi = CharacterManager()->CreateAutoROI(name, "pizpie", FALSE);
m_roi->SetVisibility(TRUE);
BoundingSphere sphere;
sphere.Center()[0] = sphere.Center()[1] = sphere.Center()[2] = 0.0f;
sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 2.0f;
m_roi->SetBoundingSphere(sphere);
m_ammoFlag = c_pizza;
assert(m_roi);
}
else {
sprintf(name, "dammo%d", p_index);
m_roi = CharacterManager()->CreateAutoROI(name, "donut", FALSE);
m_roi->SetVisibility(TRUE);
BoundingSphere sphere;
sphere.Center()[0] = sphere.Center()[1] = sphere.Center()[2] = 0.0f;
sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 5.0f;
m_roi->SetBoundingSphere(sphere);
m_ammoFlag = c_donut;
assert(m_roi);
}
m_a3 = p_a3;
SetValid(TRUE);
return SUCCESS;
}
@ -52,19 +88,56 @@ MxResult Act3Ammo::FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p
return SUCCESS;
}
// STUB: LEGO1 0x10053cb0
// STUB: BETA10 0x1001ddf4
MxResult Act3Ammo::FUN_10053cb0(LegoPathController* p_controller, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c)
// FUNCTION: LEGO1 0x10053cb0
// FUNCTION: BETA10 0x1001ddf4
MxResult Act3Ammo::FUN_10053cb0(LegoPathController* p_p, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c)
{
// TODO
assert(p_p);
assert(IsValid());
if (IsPizza()) {
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("shootpz", NULL, FALSE);
}
else {
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("shootdn", NULL, FALSE);
}
m_pathController = p_p;
m_boundary = p_boundary;
m_BADuration = 10000.0f;
m_unk0x19c = p_unk0x19c;
m_unk0x7c = 0.0f;
m_lastTime = -1.0f;
m_state = 1;
return SUCCESS;
}
// STUB: LEGO1 0x10053d30
// STUB: BETA10 0x1001df73
MxResult Act3Ammo::FUN_10053d30(LegoPathController* p_controller, MxFloat p_unk0x19c)
// FUNCTION: LEGO1 0x10053d30
// FUNCTION: BETA10 0x1001df73
MxResult Act3Ammo::FUN_10053d30(LegoPathController* p_p, MxFloat p_unk0x19c)
{
// TODO
assert(p_p);
assert(IsValid());
SetBit4(TRUE);
if (IsPizza()) {
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("shootpz", NULL, FALSE);
}
else {
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("shootdn", NULL, FALSE);
}
m_pathController = p_p;
m_BADuration = 10000.0f;
m_unk0x19c = p_unk0x19c;
m_unk0x7c = 0.0f;
m_lastTime = -1.0f;
m_state = 1;
return SUCCESS;
}

View file

@ -130,11 +130,11 @@ MxResult Act3::ShootPizza(LegoPathController* p_controller, Vector3& p_location,
{
MxS32 nextPizza;
for (nextPizza = 0; nextPizza < (MxS32) sizeOfArray(m_pizzas); nextPizza++) {
if (!m_pizzas[nextPizza].IsPlaced()) {
if (!m_pizzas[nextPizza].IsValid()) {
LegoPathBoundary* boundary = NULL;
MxU32 local18 = TRUE;
m_pizzas[nextPizza].FUN_10053980(this, TRUE, nextPizza);
m_pizzas[nextPizza].Create(this, TRUE, nextPizza);
if (m_pizzas[nextPizza].FUN_10053b40(p_location, p_direction, p_up) != SUCCESS) {
return FAILURE;
@ -186,10 +186,10 @@ MxResult Act3::ShootDonut(LegoPathController* p_controller, Vector3& p_location,
{
MxS32 nextDonut;
for (nextDonut = 0; nextDonut < (MxS32) sizeOfArray(m_donuts); nextDonut++) {
if (!m_donuts[nextDonut].IsPlaced()) {
if (!m_donuts[nextDonut].IsValid()) {
LegoPathBoundary* boundary = NULL;
m_donuts[nextDonut].FUN_10053980(this, FALSE, nextDonut);
m_donuts[nextDonut].Create(this, FALSE, nextDonut);
if (m_donuts[nextDonut].FUN_10053b40(p_location, p_direction, p_up) != SUCCESS) {
return FAILURE;
@ -515,7 +515,7 @@ void Act3::Enable(MxBool p_enable)
MxS32 i;
for (i = 0; i < (MxS32) sizeOfArray(m_pizzas); i++) {
if (m_pizzas[i].IsPlaced()) {
if (m_pizzas[i].IsValid()) {
m_pizzas[i].SetLastTime(m_pizzas[i].GetLastTime() + delta);
m_pizzas[i].SetActorTime(m_pizzas[i].GetActorTime() + delta);
m_pizzas[i].SetUnknown0x158(m_pizzas[i].GetUnknown0x158() + delta);
@ -523,7 +523,7 @@ void Act3::Enable(MxBool p_enable)
}
for (i = 0; i < (MxS32) sizeOfArray(m_donuts); i++) {
if (m_donuts[i].IsPlaced()) {
if (m_donuts[i].IsValid()) {
m_donuts[i].SetLastTime(m_donuts[i].GetLastTime() + delta);
m_donuts[i].SetActorTime(m_donuts[i].GetActorTime() + delta);
m_donuts[i].SetUnknown0x158(m_donuts[i].GetUnknown0x158() + delta);