Implement/match Act3Brickster::HitActor (#1212)

* Implement/match `Act3Brickster::HitActor`

* Fixes

* Fixes

* Fixes

* Add `Act3Cop::VTable0x9c`

* Fix
This commit is contained in:
Christian Semmler 2024-12-12 09:10:44 -07:00 committed by GitHub
parent fe57a94416
commit aceba71fbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 166 additions and 78 deletions

View file

@ -23,7 +23,7 @@ class Act2Actor : public LegoAnimActor {
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override; // vtable+0x68
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxS32 VTable0xa0() override; // vtable+0xa0

View file

@ -26,7 +26,7 @@ class Act2Brick : public LegoPathActor {
return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name);
}
MxResult VTable0x94(LegoPathActor* p_actor, MxBool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool) override; // vtable+0x94
// SYNTHETIC: LEGO1 0x1007a450
// Act2Brick::`scalar deleting destructor'

View file

@ -6,7 +6,7 @@
// VTABLE: LEGO1 0x100d4ed8
// SIZE 0x154
class Act2GenActor : public LegoPathActor {
MxResult VTable0x94(LegoPathActor* p_actor, MxBool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool) override; // vtable+0x94
// SYNTHETIC: LEGO1 0x1000f5a0
// Act2GenActor::`scalar deleting destructor'

View file

@ -113,12 +113,12 @@ class Act3 : public LegoWorld {
void SetShark(Act3Shark* p_shark) { m_shark = p_shark; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
Act3Brickster* GetBrickster() { return m_brickster; }
// SYNTHETIC: LEGO1 0x10072630
// Act3::`scalar deleting destructor'
void EatPizza(MxS32 p_index);
void EatDonut(MxS32 p_index);
void RemovePizza(Act3Ammo& p_p);
void RemoveDonut(Act3Ammo& p_p);
MxResult ShootPizza(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up);
MxResult ShootDonut(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up);
@ -128,6 +128,11 @@ class Act3 : public LegoWorld {
void GoodEnding(const Matrix4& p_matrix);
static void DebugPrintf(const char* p_format, ...);
// BETA indicates that the actors access certain members directly.
friend class Act3Brickster;
friend class Act3Cop;
friend class Act3Shark;
protected:
MxLong HandleTransitionEnd();

View file

@ -24,7 +24,7 @@ class Act3Actor : public LegoAnimActor {
}
MxU32 VTable0x90(float p_time, Matrix4& p_transform) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxFloat GetUnknown0x1c() { return m_unk0x1c; }
@ -37,9 +37,9 @@ class Act3Actor : public LegoAnimActor {
// Act3Actor::~Act3Actor
private:
MxFloat m_unk0x1c; // 0x1c
static Mx3DPointFloat g_unk0x10104ef0;
MxFloat m_unk0x1c; // 0x1c
};
// VTABLE: LEGO1 0x100d7750 LegoPathActor
@ -51,7 +51,7 @@ class Act3Cop : public Act3Actor {
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
@ -66,7 +66,7 @@ class Act3Cop : public Act3Actor {
private:
MxFloat m_unk0x20; // 0x20
LegoWorld* m_world; // 0x24
undefined4 m_unk0x24[2]; // 0x28
undefined4 m_unk0x28[2]; // 0x28
};
// VTABLE: LEGO1 0x100d7838 LegoPathActor
@ -79,7 +79,7 @@ class Act3Brickster : public Act3Actor {
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,

View file

@ -68,6 +68,8 @@ class Act3Ammo : public LegoPathActor {
}
}
MxU32 IsBit5() { return m_ammoFlag & c_bit5; }
MxFloat GetUnknown0x158() { return m_unk0x158; }
void SetUnknown0x158(MxFloat p_unk0x158) { m_unk0x158 = p_unk0x158; }

View file

@ -26,7 +26,7 @@ class Doors : public LegoPathActor {
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
virtual MxFloat VTable0xcc(float p_time); // vtable+0xcc
// SYNTHETIC: LEGO1 0x1000e580

View file

@ -46,7 +46,7 @@ class LegoExtraActor : public virtual LegoAnimActor {
void VTable0x70(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
MxU32 VTable0x90(float p_time, Matrix4& p_matrix) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
void VTable0xa4(MxBool& p_und1, MxS32& p_und2) override; // vtable+0xa4
void VTable0xc4() override; // vtable+0xc4

View file

@ -41,7 +41,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap {
Vector3& p_v3
) override; // vtable+0x6c
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View file

@ -91,7 +91,7 @@ class LegoPathActor : public LegoActor {
virtual MxU32 VTable0x90(float, Matrix4&) { return FALSE; } // vtable+0x90
// FUNCTION: LEGO1 0x10002d50
virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual MxResult HitActor(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual void SwitchBoundary(
LegoPathBoundary*& p_boundary,

View file

@ -32,7 +32,7 @@ class LegoRaceActor : public virtual LegoAnimActor {
MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override; // vtable+0x68
MxU32 VTable0x90(float p_time, Matrix4& p_matrix) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// FUNCTION: LEGO1 0x10014aa0
// FUNCTION: BETA10 0x100ca038

View file

@ -67,7 +67,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
Vector3& p_v3
) override; // vtable+0x6c
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View file

@ -103,7 +103,7 @@ void Act2Actor::FUN_10018980()
// FUNCTION: LEGO1 0x100189f0
// FUNCTION: BETA10 0x1000ca64
MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool)
MxResult Act2Actor::HitActor(LegoPathActor*, MxBool)
{
if (m_unk0x1f == FALSE) {
m_unk0x1f = TRUE;
@ -117,7 +117,7 @@ MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool)
// FUNCTION: LEGO1 0x10018a20
MxResult Act2Actor::VTable0x9c()
{
if (m_grec && !(m_grec->m_flags & LegoPathEdgeContainer::c_bit1)) {
if (m_grec && !m_grec->GetBit1()) {
delete m_grec;
m_grec = NULL;
return SUCCESS;

View file

@ -14,7 +14,7 @@ MxLong Act2GenActor::g_lastHitActorTime = 0;
// FUNCTION: LEGO1 0x10018740
// FUNCTION: BETA10 0x1000c7a0
MxResult Act2GenActor::VTable0x94(LegoPathActor* p_actor, MxBool)
MxResult Act2GenActor::HitActor(LegoPathActor* p_actor, MxBool)
{
MxLong time = Timer()->GetTime();
MxLong diff = time - g_lastHitActorTime;

View file

@ -5,8 +5,11 @@
#include "define.h"
#include "legocachesoundmanager.h"
#include "legolocomotionanimpresenter.h"
#include "legopathedgecontainer.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxtimer.h"
#include "mxutilities.h"
#include "roi/legoroi.h"
@ -76,7 +79,7 @@ MxU32 Act3Actor::VTable0x90(float p_time, Matrix4& p_transform)
}
// FUNCTION: LEGO1 0x1003fd90
MxResult Act3Actor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult Act3Actor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
if (!p_actor->GetUserNavFlag() && p_bool) {
if (p_actor->GetState()) {
@ -110,9 +113,10 @@ Act3Cop::Act3Cop()
// FUNCTION: LEGO1 0x1003ff70
// FUNCTION: BETA10 0x10018526
MxResult Act3Cop::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult Act3Cop::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
LegoROI* roi = p_actor->GetROI();
if (p_bool && !strncmp(roi->GetName(), "dammo", 5)) {
MxS32 count = -1;
if (sscanf(roi->GetName(), "dammo%d", &count) != 1) {
@ -129,9 +133,9 @@ MxResult Act3Cop::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
FUN_10040360();
}
else {
if (((Act3*) m_world)->GetBrickster()->GetROI() != roi) {
if (((Act3*) m_world)->m_brickster->GetROI() != roi) {
if (p_bool) {
return Act3Actor::VTable0x94(p_actor, p_bool);
return Act3Actor::HitActor(p_actor, p_bool);
}
}
else {
@ -162,11 +166,19 @@ void Act3Cop::FUN_10040360()
// TODO
}
// STUB: LEGO1 0x10040d20
// FUNCTION: LEGO1 0x10040d20
// FUNCTION: BETA10 0x1001942c
MxResult Act3Cop::VTable0x9c()
{
// TODO
if (m_grec && !m_grec->GetBit1()) {
delete m_grec;
m_grec = NULL;
m_lastTime = Timer()->GetTime();
FUN_10040360();
return SUCCESS;
}
return Act3Actor::VTable0x9c();
}
// FUNCTION: LEGO1 0x10040e10
@ -220,10 +232,39 @@ void Act3Brickster::VTable0x70(float p_time)
// TODO
}
// STUB: LEGO1 0x100416b0
MxResult Act3Brickster::VTable0x94(LegoPathActor*, MxBool)
// FUNCTION: LEGO1 0x100416b0
// FUNCTION: BETA10 0x1001a299
MxResult Act3Brickster::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
// TODO
if (!p_bool) {
return FAILURE;
}
Act3* a3 = (Act3*) m_world;
LegoROI* r = p_actor->GetROI();
assert(r);
if (a3->m_cop1->GetROI() != r && a3->m_cop2->GetROI() != r) {
if (!strncmp(r->GetName(), "pammo", 5)) {
MxS32 count = -1;
if (sscanf(r->GetName(), "pammo%d", &count) != 1) {
assert(0);
}
assert(m_world);
if (a3->m_pizzas[count].IsValid() && !a3->m_pizzas[count].IsBit5()) {
a3->EatPizza(count);
}
m_unk0x38 = 2;
return SUCCESS;
}
else {
return Act3Actor::HitActor(p_actor, p_bool);
}
}
return SUCCESS;
}
@ -235,17 +276,27 @@ MxResult Act3Brickster::FUN_100417c0()
return SUCCESS;
}
// STUB: LEGO1 0x10042990
// FUNCTION: LEGO1 0x10042990
// FUNCTION: BETA10 0x1001b6e2
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
if (m_unk0x38 != 8) {
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);
}
}
// STUB: LEGO1 0x100429d0
// FUNCTION: LEGO1 0x100429d0
// FUNCTION: BETA10 0x1001b75b
MxResult Act3Brickster::VTable0x9c()
{
// TODO
if (m_grec && !m_grec->GetBit1()) {
delete m_grec;
m_grec = NULL;
m_lastTime = Timer()->GetTime();
return SUCCESS;
}
return Act3Actor::VTable0x9c();
}
// FUNCTION: LEGO1 0x10042ab0

View file

@ -24,7 +24,7 @@ MxFloat g_unk0x100d8e84 = 6000.0f;
// FUNCTION: LEGO1 0x10066100
// FUNCTION: BETA10 0x10026850
MxResult Doors::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult Doors::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
assert(m_ltDoor && m_rtDoor);

View file

@ -107,7 +107,7 @@ void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBou
}
// FUNCTION: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool)
MxResult Act2Brick::HitActor(LegoPathActor* p_actor, MxBool)
{
MxLong time = Timer()->GetTime();
MxLong diff = time - g_lastHitActorTime;

View file

@ -56,7 +56,7 @@ MxLong LegoJetski::Notify(MxParam& p_param)
}
// STUB: LEGO1 0x10013c40
MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
// TODO
return 0;

View file

@ -168,9 +168,9 @@ MxU32 LegoJetskiRaceActor::VTable0x6c(
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
VTable0x94(actor, TRUE);
HitActor(actor, TRUE);
if (actor->VTable0x94(this, FALSE) < 0) {
if (actor->HitActor(this, FALSE) < 0) {
return 0;
}
else {

View file

@ -190,7 +190,7 @@ inline void LegoExtraActor::FUN_1002ad8a()
}
// FUNCTION: LEGO1 0x1002aba0
MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
if (p_actor->GetState() != 0 || m_state != 0) {
return FAILURE;
@ -497,11 +497,11 @@ MxU32 LegoExtraActor::VTable0x6c(
(local20X <= -0.01 && p_f1 + 0.01 <= local1cX)) {
p_v3 = p_v1;
if (VTable0x94(actor, TRUE) < 0) {
if (HitActor(actor, TRUE) < 0) {
return 0;
}
actor->VTable0x94(this, FALSE);
actor->HitActor(this, FALSE);
return 2;
}
}
@ -509,11 +509,11 @@ MxU32 LegoExtraActor::VTable0x6c(
}
else {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (VTable0x94(actor, TRUE) < 0) {
if (HitActor(actor, TRUE) < 0) {
return 0;
}
actor->VTable0x94(this, FALSE);
actor->HitActor(this, FALSE);
return 2;
}
}

View file

@ -463,8 +463,8 @@ MxU32 LegoPathActor::VTable0x6c(
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->m_collideBox)) {
VTable0x94(actor, TRUE);
actor->VTable0x94(this, FALSE);
HitActor(actor, TRUE);
actor->HitActor(this, FALSE);
return 2;
}
}

View file

@ -95,7 +95,7 @@ MxU32 LegoRaceActor::VTable0x90(float p_time, Matrix4& p_transform)
// FUNCTION: LEGO1 0x10014a00
// FUNCTION: BETA10 0x100c9f5c
MxResult LegoRaceActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult LegoRaceActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
if (!p_actor->GetUserNavFlag()) {
if (p_actor->GetState()) {
@ -115,5 +115,6 @@ MxResult LegoRaceActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
p_actor->SetState(2);
}
}
return 0;
return SUCCESS;
}

View file

@ -428,7 +428,7 @@ void LegoRaceCar::VTable0x70(float p_time)
// FUNCTION: LEGO1 0x100133c0
// FUNCTION: BETA10 0x100cbb84
MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
{
// Note: Code duplication with LegoRaceActor::VTable0x94
if (!p_actor->GetUserNavFlag()) {
@ -499,6 +499,7 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
return FAILURE;
}
}
return SUCCESS;
}

View file

@ -333,9 +333,9 @@ MxU32 LegoCarRaceActor::VTable0x6c(
p_v3,
m_collideBox && actor->GetCollideBox()
)) {
VTable0x94(actor, TRUE);
HitActor(actor, TRUE);
if (actor->VTable0x94(this, FALSE) < 0) {
if (actor->HitActor(this, FALSE) < 0) {
return 0;
}
else {
@ -353,9 +353,9 @@ MxU32 LegoCarRaceActor::VTable0x6c(
p_v3,
m_collideBox && actor->GetCollideBox()
)) {
VTable0x94(actor, TRUE);
HitActor(actor, TRUE);
if (actor->VTable0x94(this, FALSE) < 0) {
if (actor->HitActor(this, FALSE) < 0) {
return 0;
}
else {
@ -366,8 +366,9 @@ MxU32 LegoCarRaceActor::VTable0x6c(
}
else {
if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
VTable0x94(actor, TRUE);
if (actor->VTable0x94(this, FALSE) < 0) {
HitActor(actor, TRUE);
if (actor->HitActor(this, FALSE) < 0) {
return 0;
}
else {

View file

@ -180,6 +180,14 @@ Act3::~Act3()
TickleManager()->UnregisterClient(this);
}
// FUNCTION: LEGO1 0x10072780
// FUNCTION: BETA10 0x100156ac
void Act3::EatPizza(MxS32 p_index)
{
assert(p_index < MAX_PIZZAS);
RemovePizza(m_pizzas[p_index]);
}
// FUNCTION: LEGO1 0x100727a0
// FUNCTION: BETA10 0x1001570d
void Act3::EatDonut(MxS32 p_index)
@ -188,6 +196,25 @@ void Act3::EatDonut(MxS32 p_index)
RemoveDonut(m_donuts[p_index]);
}
// FUNCTION: LEGO1 0x100727c0
// FUNCTION: BETA10 0x1001576e
void Act3::RemovePizza(Act3Ammo& p_p)
{
#ifdef _DEBUG
MxS32 i;
for (i = 0; i < MAX_PIZZAS; i++) {
if (&m_pizzas[i] == &p_p) {
break;
}
}
assert(i != MAX_PIZZAS);
#endif
assert(p_p.IsValid());
p_p.Remove();
}
// FUNCTION: LEGO1 0x100727d0
// FUNCTION: BETA10 0x10015828
void Act3::RemoveDonut(Act3Ammo& p_p)
@ -534,8 +561,8 @@ MxResult Act3::Tickle()
return SUCCESS;
}
// STUB: LEGO1 0x100733f0
// STUB: BETA10 0x10016ba2
// FUNCTION: LEGO1 0x100733f0
// FUNCTION: BETA10 0x10016ba2
void Act3::SetBrickster(Act3Brickster* p_brickster)
{
m_brickster = p_brickster;