Refactor act 3 actors into act3actors.cpp (#1210)

This commit is contained in:
Christian Semmler 2024-12-12 07:14:46 -07:00 committed by GitHub
parent c05ff6ff4a
commit 598d6dd10c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 303 additions and 343 deletions

View file

@ -295,9 +295,6 @@ function(add_lego_libraries NAME)
LEGO1/lego/legoomni/src/actors/act2genactor.cpp
LEGO1/lego/legoomni/src/actors/act3actors.cpp
LEGO1/lego/legoomni/src/actors/act3ammo.cpp
LEGO1/lego/legoomni/src/actors/act3brickster.cpp
LEGO1/lego/legoomni/src/actors/act3cop.cpp
LEGO1/lego/legoomni/src/actors/act3shark.cpp
LEGO1/lego/legoomni/src/actors/ambulance.cpp
LEGO1/lego/legoomni/src/actors/bike.cpp
LEGO1/lego/legoomni/src/actors/buildingentity.cpp

View file

@ -5,6 +5,9 @@
// File name verified by multiple assertions, e.g. BETA10 0x10018391
class Act3Ammo;
class LegoWorld;
// VTABLE: LEGO1 0x100d7668 LegoPathActor
// VTABLE: LEGO1 0x100d7738 LegoAnimActor
// VTABLE: BETA10 0x101b8a98 LegoPathActor
@ -39,7 +42,120 @@ class Act3Actor : public LegoAnimActor {
static Mx3DPointFloat g_unk0x10104ef0;
};
// VTABLE: LEGO1 0x100d7750 LegoPathActor
// VTABLE: LEGO1 0x100d7820 LegoAnimActor
// SIZE 0x188
class Act3Cop : public Act3Actor {
public:
Act3Cop();
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
void SetUnknown0x20(MxFloat p_unk0x20) { m_unk0x20 = p_unk0x20; }
void FUN_10040360();
// SYNTHETIC: LEGO1 0x10043120
// Act3Cop::`scalar deleting destructor'
private:
MxFloat m_unk0x20; // 0x20
LegoWorld* m_world; // 0x24
undefined4 m_unk0x24[2]; // 0x28
};
// VTABLE: LEGO1 0x100d7838 LegoPathActor
// VTABLE: LEGO1 0x100d7908 LegoAnimActor
// SIZE 0x1b4
class Act3Brickster : public Act3Actor {
public:
Act3Brickster();
~Act3Brickster() override;
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
MxFloat GetUnknown0x24() { return m_unk0x24; }
MxFloat GetUnknown0x50() { return m_unk0x50; }
void SetUnknown0x20(MxFloat p_unk0x20) { m_unk0x20 = p_unk0x20; }
void SetUnknown0x24(MxFloat p_unk0x24) { m_unk0x24 = p_unk0x24; }
void SetUnknown0x50(MxFloat p_unk0x50) { m_unk0x50 = p_unk0x50; }
MxResult FUN_100417c0();
// SYNTHETIC: LEGO1 0x10043250
// Act3Brickster::`scalar deleting destructor'
private:
MxFloat m_unk0x20; // 0x20
MxFloat m_unk0x24; // 0x24
undefined4 m_unk0x28[10]; // 0x28
MxFloat m_unk0x50; // 0x50
undefined4 m_unk0x54; // 0x54
undefined4 m_unk0x58; // 0x58
};
// VTABLE: LEGO1 0x100d7920 LegoPathActor
// VTABLE: LEGO1 0x100d79f0 LegoAnimActor
// SIZE 0x1a8
class Act3Shark : public LegoAnimActor {
public:
Act3Shark();
// FUNCTION: LEGO1 0x100430d0
const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f03a0
return "Act3Shark";
}
void ParseAction(char*) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
// LegoAnimActor vtable
virtual MxResult FUN_10042ce0(Act3Ammo* p_ammo); // vtable+0x10
MxFloat GetUnknown0x2c() { return m_unk0x2c; }
void SetUnknown0x2c(MxFloat p_unk0x2c) { m_unk0x2c = p_unk0x2c; }
// SYNTHETIC: LEGO1 0x10043030
// Act3Shark::`scalar deleting destructor'
private:
list<Act3Ammo*> m_unk0x1c; // 0x1c
undefined4 m_unk0x28; // 0x28
MxFloat m_unk0x2c; // 0x2c
LegoWorld* m_world; // 0x30
LegoAnimActorStruct* m_unk0x34; // 0x34
LegoROI* m_unk0x38; // 0x38
Mx3DPointFloat m_unk0x3c; // 0x3c
};
// TEMPLATE: LEGO1 0x10042c20
// list<Act3Ammo *,allocator<Act3Ammo *> >::~list<Act3Ammo *,allocator<Act3Ammo *> >
// TEMPLATE: LEGO1 0x10042c90
// List<Act3Ammo *>::~List<Act3Ammo *>
// GLOBAL: LEGO1 0x100d7660
// Act3Actor::`vbtable'
// GLOBAL: LEGO1 0x100d7918
// Act3Shark::`vbtable'
#endif // ACT3ACTORS_H

View file

@ -1,46 +0,0 @@
#ifndef ACT3BRICKSTER_H
#define ACT3BRICKSTER_H
#include "act3actors.h"
// VTABLE: LEGO1 0x100d7838 LegoPathActor
// VTABLE: LEGO1 0x100d7908 LegoAnimActor
// SIZE 0x1b4
class Act3Brickster : public Act3Actor {
public:
Act3Brickster();
~Act3Brickster() override;
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
MxFloat GetUnknown0x24() { return m_unk0x24; }
MxFloat GetUnknown0x50() { return m_unk0x50; }
void SetUnknown0x20(MxFloat p_unk0x20) { m_unk0x20 = p_unk0x20; }
void SetUnknown0x24(MxFloat p_unk0x24) { m_unk0x24 = p_unk0x24; }
void SetUnknown0x50(MxFloat p_unk0x50) { m_unk0x50 = p_unk0x50; }
MxResult FUN_100417c0();
// SYNTHETIC: LEGO1 0x10043250
// Act3Brickster::`scalar deleting destructor'
private:
MxFloat m_unk0x20; // 0x20
MxFloat m_unk0x24; // 0x24
undefined4 m_unk0x28[10]; // 0x28
MxFloat m_unk0x50; // 0x50
undefined4 m_unk0x54; // 0x54
undefined4 m_unk0x58; // 0x58
};
#endif // ACT3BRICKSTER_H

View file

@ -1,35 +0,0 @@
#ifndef ACT3COP_H
#define ACT3COP_H
#include "act3actors.h"
class LegoWorld;
// VTABLE: LEGO1 0x100d7750 LegoPathActor
// VTABLE: LEGO1 0x100d7820 LegoAnimActor
// SIZE 0x188
class Act3Cop : public Act3Actor {
public:
Act3Cop();
void ParseAction(char* p_extra) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
void SetUnknown0x20(MxFloat p_unk0x20) { m_unk0x20 = p_unk0x20; }
void FUN_10040360();
// SYNTHETIC: LEGO1 0x10043120
// Act3Cop::`scalar deleting destructor'
private:
MxFloat m_unk0x20; // 0x20
LegoWorld* m_world; // 0x24
undefined4 m_unk0x24[2]; // 0x28
};
#endif // ACT3COP_H

View file

@ -1,55 +0,0 @@
#ifndef ACT3SHARK_H
#define ACT3SHARK_H
#include "legoanimactor.h"
class Act3;
class Act3Ammo;
// VTABLE: LEGO1 0x100d7920 LegoPathActor
// VTABLE: LEGO1 0x100d79f0 LegoAnimActor
// SIZE 0x1a8
class Act3Shark : public LegoAnimActor {
public:
Act3Shark();
// FUNCTION: LEGO1 0x100430d0
const char* ClassName() const override // vtable+0x0c
{
// STRING: LEGO1 0x100f03a0
return "Act3Shark";
}
void ParseAction(char*) override; // vtable+0x20
void VTable0x70(float p_time) override; // vtable+0x70
// LegoAnimActor vtable
virtual MxResult FUN_10042ce0(Act3Ammo* p_ammo); // vtable+0x10
MxFloat GetUnknown0x2c() { return m_unk0x2c; }
void SetUnknown0x2c(MxFloat p_unk0x2c) { m_unk0x2c = p_unk0x2c; }
// SYNTHETIC: LEGO1 0x10043030
// Act3Shark::`scalar deleting destructor'
private:
list<Act3Ammo*> m_unk0x1c; // 0x1c
undefined4 m_unk0x28; // 0x28
MxFloat m_unk0x2c; // 0x2c
Act3* m_a3; // 0x30
LegoAnimActorStruct* m_unk0x34; // 0x34
LegoROI* m_unk0x38; // 0x38
Mx3DPointFloat m_unk0x3c; // 0x3c
};
// TEMPLATE: LEGO1 0x10042c20
// list<Act3Ammo *,allocator<Act3Ammo *> >::~list<Act3Ammo *,allocator<Act3Ammo *> >
// TEMPLATE: LEGO1 0x10042c90
// List<Act3Ammo *>::~List<Act3Ammo *>
// GLOBAL: LEGO1 0x100d7918
// Act3Shark::`vbtable'
#endif // ACT3SHARK_H

View file

@ -1,8 +1,21 @@
#include "act3actors.h"
#include "act3.h"
#include "act3ammo.h"
#include "define.h"
#include "legocachesoundmanager.h"
#include "legolocomotionanimpresenter.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "mxutilities.h"
#include "roi/legoroi.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(Act3Actor, 0x178)
DECOMP_SIZE_ASSERT(Act3Cop, 0x188)
DECOMP_SIZE_ASSERT(Act3Brickster, 0x1b4)
DECOMP_SIZE_ASSERT(Act3Shark, 0x1a8)
// Initialized at LEGO1 0x1003fa20
// GLOBAL: LEGO1 0x10104ef0
@ -85,3 +98,176 @@ MxResult Act3Actor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
return SUCCESS;
}
// STUB: LEGO1 0x1003fe30
Act3Cop::Act3Cop()
{
// TODO
}
// FUNCTION: LEGO1 0x1003ff70
// FUNCTION: BETA10 0x10018526
MxResult Act3Cop::VTable0x94(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) {
assert(0);
}
assert(m_world);
((Act3*) m_world)->EatDonut(count);
m_unk0x20 = m_lastTime + 2000;
SetWorldSpeed(6.0);
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("eatdn", NULL, FALSE);
FUN_10040360();
}
else {
if (((Act3*) m_world)->GetBrickster()->GetROI() != roi) {
if (p_bool) {
return Act3Actor::VTable0x94(p_actor, p_bool);
}
}
else {
((Act3*) m_world)->GoodEnding(roi->GetLocal2World());
}
}
return SUCCESS;
}
// STUB: LEGO1 0x10040060
void Act3Cop::ParseAction(char* p_extra)
{
// TODO
}
// STUB: LEGO1 0x100401f0
void Act3Cop::VTable0x70(float p_time)
{
// TODO
}
// STUB: LEGO1 0x10040360
// STUB: BETA10 0x10018c6a
void Act3Cop::FUN_10040360()
{
// TODO
}
// STUB: LEGO1 0x10040d20
MxResult Act3Cop::VTable0x9c()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10040e10
Act3Brickster::Act3Brickster()
{
// TODO
}
// FUNCTION: LEGO1 0x10040f20
Act3Brickster::~Act3Brickster()
{
// TODO
}
// STUB: LEGO1 0x10040ff0
void Act3Brickster::ParseAction(char* p_extra)
{
// TODO
}
// STUB: LEGO1 0x10041050
void Act3Brickster::VTable0x70(float p_time)
{
// TODO
}
// STUB: LEGO1 0x100416b0
MxResult Act3Brickster::VTable0x94(LegoPathActor*, MxBool)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x100417c0
// STUB: BETA10 0x1001a407
MxResult Act3Brickster::FUN_100417c0()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10042990
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}
// STUB: LEGO1 0x100429d0
MxResult Act3Brickster::VTable0x9c()
{
// TODO
return SUCCESS;
}
// FUNCTION: LEGO1 0x10042ab0
Act3Shark::Act3Shark()
{
m_unk0x2c = 0.0f;
m_unk0x28 = 0;
}
// FUNCTION: LEGO1 0x10042ce0
MxResult Act3Shark::FUN_10042ce0(Act3Ammo* p_ammo)
{
p_ammo->SetBit5(TRUE);
m_unk0x1c.push_back(p_ammo);
return SUCCESS;
}
// STUB: LEGO1 0x10042d40
void Act3Shark::VTable0x70(float p_time)
{
// TODO
}
// FUNCTION: LEGO1 0x10042f30
void Act3Shark::ParseAction(char* p_extra)
{
LegoPathActor::ParseAction(p_extra);
m_world = (LegoWorld*) CurrentWorld();
char value[256];
if (KeyValueStringParse(value, g_strANIMATION, p_extra)) {
char* token = strtok(value, g_parseExtraTokens);
while (token != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) m_world->Find("LegoAnimPresenter", token);
if (presenter != NULL) {
token = strtok(NULL, g_parseExtraTokens);
if (token != NULL) {
presenter->FUN_1006d680(this, atof(token));
}
}
token = strtok(NULL, g_parseExtraTokens);
}
}
((Act3*) m_world)->SetShark(this);
m_unk0x34 = m_animMaps[0];
m_unk0x38 = m_unk0x34->m_roiMap[1];
m_unk0x38->SetVisibility(FALSE);
m_world->PlaceActor(this);
}

View file

@ -1,55 +0,0 @@
#include "act3brickster.h"
DECOMP_SIZE_ASSERT(Act3Brickster, 0x1b4)
// STUB: LEGO1 0x10040e10
Act3Brickster::Act3Brickster()
{
// TODO
}
// FUNCTION: LEGO1 0x10040f20
Act3Brickster::~Act3Brickster()
{
// TODO
}
// STUB: LEGO1 0x10040ff0
void Act3Brickster::ParseAction(char* p_extra)
{
// TODO
}
// STUB: LEGO1 0x10041050
void Act3Brickster::VTable0x70(float p_time)
{
// TODO
}
// STUB: LEGO1 0x100416b0
MxResult Act3Brickster::VTable0x94(LegoPathActor*, MxBool)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x100417c0
// STUB: BETA10 0x1001a407
MxResult Act3Brickster::FUN_100417c0()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10042990
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}
// STUB: LEGO1 0x100429d0
MxResult Act3Brickster::VTable0x9c()
{
// TODO
return SUCCESS;
}

View file

@ -1,78 +0,0 @@
#include "act3cop.h"
#include "act3.h"
#include "act3brickster.h"
#include "legocachesoundmanager.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "roi/legoroi.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(Act3Cop, 0x188)
// STUB: LEGO1 0x1003fe30
Act3Cop::Act3Cop()
{
// TODO
}
// FUNCTION: LEGO1 0x1003ff70
// FUNCTION: BETA10 0x10018526
MxResult Act3Cop::VTable0x94(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) {
assert(0);
}
assert(m_world);
((Act3*) m_world)->EatDonut(count);
m_unk0x20 = m_lastTime + 2000;
SetWorldSpeed(6.0);
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("eatdn", NULL, FALSE);
FUN_10040360();
}
else {
if (((Act3*) m_world)->GetBrickster()->GetROI() != roi) {
if (p_bool) {
return Act3Actor::VTable0x94(p_actor, p_bool);
}
}
else {
((Act3*) m_world)->GoodEnding(roi->GetLocal2World());
}
}
return SUCCESS;
}
// STUB: LEGO1 0x10040060
void Act3Cop::ParseAction(char* p_extra)
{
// TODO
}
// STUB: LEGO1 0x100401f0
void Act3Cop::VTable0x70(float p_time)
{
// TODO
}
// STUB: LEGO1 0x10040360
// STUB: BETA10 0x10018c6a
void Act3Cop::FUN_10040360()
{
// TODO
}
// STUB: LEGO1 0x10040d20
MxResult Act3Cop::VTable0x9c()
{
// TODO
return SUCCESS;
}

View file

@ -1,65 +0,0 @@
#include "act3shark.h"
#include "act3.h"
#include "act3ammo.h"
#include "define.h"
#include "legolocomotionanimpresenter.h"
#include "misc.h"
#include "mxutilities.h"
DECOMP_SIZE_ASSERT(Act3Shark, 0x1a8)
// FUNCTION: LEGO1 0x10042ab0
Act3Shark::Act3Shark()
{
m_unk0x2c = 0.0f;
m_unk0x28 = 0;
}
// FUNCTION: LEGO1 0x10042ce0
MxResult Act3Shark::FUN_10042ce0(Act3Ammo* p_ammo)
{
p_ammo->SetBit5(TRUE);
m_unk0x1c.push_back(p_ammo);
return SUCCESS;
}
// STUB: LEGO1 0x10042d40
void Act3Shark::VTable0x70(float p_time)
{
// TODO
}
// FUNCTION: LEGO1 0x10042f30
void Act3Shark::ParseAction(char* p_extra)
{
LegoPathActor::ParseAction(p_extra);
m_a3 = (Act3*) CurrentWorld();
char value[256];
if (KeyValueStringParse(value, g_strANIMATION, p_extra)) {
char* token = strtok(value, g_parseExtraTokens);
while (token != NULL) {
LegoLocomotionAnimPresenter* presenter =
(LegoLocomotionAnimPresenter*) m_a3->Find("LegoAnimPresenter", token);
if (presenter != NULL) {
token = strtok(NULL, g_parseExtraTokens);
if (token != NULL) {
presenter->FUN_1006d680(this, atof(token));
}
}
token = strtok(NULL, g_parseExtraTokens);
}
}
m_a3->SetShark(this);
m_unk0x34 = m_animMaps[0];
m_unk0x38 = m_unk0x34->m_roiMap[1];
m_unk0x38->SetVisibility(FALSE);
m_a3->PlaceActor(this);
}

View file

@ -6,9 +6,6 @@
#include "act2policestation.h"
#include "act3.h"
#include "act3actors.h"
#include "act3brickster.h"
#include "act3cop.h"
#include "act3shark.h"
#include "ambulance.h"
#include "bike.h"
#include "buildings.h"

View file

@ -2,9 +2,7 @@
#include "3dmanager/lego3dmanager.h"
#include "act3_actions.h"
#include "act3brickster.h"
#include "act3cop.h"
#include "act3shark.h"
#include "act3actors.h"
#include "helicopter.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"