Compare commits

...

3 Commits

Author SHA1 Message Date
Fabian Neundorf
15fec495e5 Clear unknowns in Act2Brick (#1675) 2025-08-09 18:05:43 +02:00
Fabian Neundorf
61eaea8bb4 Clear unknowns in LegoAnimActorStruct and LegoAnimActor (#1673) 2025-08-09 17:40:12 +02:00
Fabian Neundorf
1a317a3ef8 Clear unknowns in LegoEntity (#1672) 2025-08-09 17:38:59 +02:00
18 changed files with 111 additions and 84 deletions

View File

@@ -8,6 +8,13 @@
// SIZE 0x194
class Act2Brick : public LegoPathActor {
public:
enum {
e_removed = 0,
e_created = 1,
e_placed = 2,
e_atRest = 3,
};
Act2Brick();
~Act2Brick() override; // vtable+0x00
@@ -35,7 +42,7 @@ public:
MxResult Create(MxS32 p_index);
void Remove();
void FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary);
void Place(MxMatrix& p_localToWorld, MxMatrix& p_endLocalToWorld, LegoPathBoundary* p_boundary);
void PlayWhistleSound();
void StopWhistleSound();
void Mute(MxBool p_muted);
@@ -44,12 +51,12 @@ private:
static const LegoChar* g_lodNames[];
static MxLong g_lastHitActorTime;
LegoCacheSound* m_whistleSound; // 0x154
undefined m_unk0x158[0x0c]; // 0x158
undefined4 m_unk0x164; // 0x164
Mx3DPointFloat m_unk0x168; // 0x168
Mx3DPointFloat m_unk0x17c; // 0x17c
MxS32 m_unk0x190; // 0x190
LegoCacheSound* m_whistleSound; // 0x154
undefined m_unk0x158[0x0c]; // 0x158
MxU32 m_state; // 0x164
Mx3DPointFloat m_localToWorldMovementStep; // 0x168
Mx3DPointFloat m_endLocalToWorld; // 0x17c
MxS32 m_step; // 0x190
};
#endif // ACT2BRICK_H

View File

@@ -8,13 +8,13 @@ class LegoAnim;
// SIZE 0x20
struct LegoAnimActorStruct {
LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
LegoAnimActorStruct(float p_worldSpeed, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs);
~LegoAnimActorStruct();
float GetDuration();
// FUNCTION: BETA10 0x1000fb10
float GetUnknown0x00() { return m_unk0x00; }
float GetWorldSpeed() { return m_worldSpeed; }
// FUNCTION: BETA10 0x10012210
LegoAnim* GetAnimTreePtr() { return m_AnimTreePtr; }
@@ -23,7 +23,7 @@ struct LegoAnimActorStruct {
LegoROI** GetROIMap() { return m_roiMap; }
// TODO: Possibly private
float m_unk0x00; // 0x00
float m_worldSpeed; // 0x00
LegoAnim* m_AnimTreePtr; // 0x04
LegoROI** m_roiMap; // 0x08
MxU32 m_numROIs; // 0x0c
@@ -47,9 +47,14 @@ public:
void Animate(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
virtual MxResult FUN_1001c1f0(float& p_und);
virtual MxResult FUN_1001c360(float, Matrix4& p_transform);
virtual MxResult FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs);
virtual MxResult GetTimeInCycle(float& p_timeInCycle);
virtual MxResult AnimateWithTransform(float p_time, Matrix4& p_transform);
virtual MxResult CreateAnimActorStruct(
LegoAnim* p_AnimTreePtr,
float p_worldSpeed,
LegoROI** p_roiMap,
MxU32 p_numROIs
);
virtual void ClearMaps();
// FUNCTION: LEGO1 0x1000fba0

View File

@@ -76,9 +76,9 @@ public:
virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48
virtual void SwitchMood(); // vtable+0x4c
void FUN_10010c30();
void TransformPointOfView();
void SetType(MxU8 p_type);
void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und);
void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_updateCamera);
Mx3DPointFloat GetWorldDirection();
Mx3DPointFloat GetWorldUp();
Mx3DPointFloat GetWorldPosition();

View File

@@ -15,7 +15,7 @@ public:
void ParseAction(char* p_extra) override; // vtable+0x20
MxResult FUN_1001c360(float p_und, Matrix4& p_transform) override;
MxResult AnimateWithTransform(float p_time, Matrix4& p_transform) override;
virtual void FUN_10071c80(Vector3& p_vec);

View File

@@ -144,7 +144,7 @@ void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
void Act2Actor::FUN_10018980()
{
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
m_shootAnim = m_animMaps[i];
}
}

View File

@@ -270,7 +270,7 @@ void Act3Cop::ParseAction(char* p_extra)
}
for (i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
m_eatAnim = m_animMaps[i];
}
}
@@ -558,7 +558,7 @@ void Act3Brickster::ParseAction(char* p_extra)
((Act3*) m_world)->SetBrickster(this);
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
m_shootAnim = m_animMaps[i];
}
}

View File

@@ -342,7 +342,7 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
assert(m_world && m_world->GetCameraController());
m_world->GetCameraController()->SetWorldTransform(at, dir, up);
FUN_10010c30();
TransformPointOfView();
result = 1;
break;
}
@@ -388,13 +388,13 @@ void Helicopter::VTable0x74(Matrix4& p_transform)
{
if (m_userNavFlag) {
m_roi->UpdateTransformationRelativeToParent(p_transform);
FUN_10010c30();
TransformPointOfView();
}
else {
m_roi->SetLocal2World(p_transform);
m_roi->WrappedUpdateWorldData();
if (m_cameraFlag) {
FUN_10010c30();
TransformPointOfView();
}
}
}

View File

@@ -93,7 +93,7 @@ void IslePathActor::Enter()
SetUserActor(this);
FUN_1001b660();
FUN_10010c30();
TransformPointOfView();
}
}
@@ -152,7 +152,7 @@ void IslePathActor::Exit()
}
FUN_1001b660();
FUN_10010c30();
TransformPointOfView();
ResetViewVelocity();
}
@@ -633,7 +633,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar
m_roi->SetLocal2World(p_transform);
if (m_cameraFlag) {
ResetViewVelocity();
FUN_10010c30();
TransformPointOfView();
}
}

View File

@@ -31,7 +31,7 @@ MxLong Act2Brick::g_lastHitActorTime = 0;
Act2Brick::Act2Brick()
{
m_whistleSound = NULL;
m_unk0x164 = 0;
m_state = Act2Brick::e_removed;
}
// FUNCTION: LEGO1 0x1007a470
@@ -72,7 +72,7 @@ MxResult Act2Brick::Create(MxS32 p_index)
m_roi->SetEntity(this);
CurrentWorld()->Add(this);
m_unk0x164 = 1;
m_state = Act2Brick::e_created;
return SUCCESS;
}
@@ -88,27 +88,27 @@ void Act2Brick::Remove()
m_roi = NULL;
}
m_unk0x164 = 0;
m_state = Act2Brick::e_removed;
}
// FUNCTION: LEGO1 0x1007a670
// FUNCTION: BETA10 0x10012c04
void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary)
void Act2Brick::Place(MxMatrix& p_localToWorld, MxMatrix& p_endLocalToWorld, LegoPathBoundary* p_boundary)
{
m_unk0x17c = p_param2[3];
m_unk0x168 = p_param2[3];
m_unk0x168 -= p_param1[3];
m_unk0x168 /= 8.0f;
m_endLocalToWorld = p_endLocalToWorld[3];
m_localToWorldMovementStep = p_endLocalToWorld[3];
m_localToWorldMovementStep -= p_localToWorld[3];
m_localToWorldMovementStep /= 8.0f;
m_unk0x190 = 0;
m_step = 0;
TickleManager()->RegisterClient(this, 20);
m_unk0x164 = 2;
m_state = Act2Brick::e_placed;
CurrentWorld()->PlaceActor(this);
p_boundary->AddActor(this);
SetActorState(c_disabled);
m_roi->SetLocal2World(p_param1);
m_roi->SetLocal2World(p_localToWorld);
m_roi->WrappedUpdateWorldData();
m_roi->SetVisibility(TRUE);
}
@@ -136,15 +136,15 @@ MxResult Act2Brick::HitActor(LegoPathActor* p_actor, MxBool)
MxResult Act2Brick::Tickle()
{
MxMatrix local2world(m_roi->GetLocal2World());
m_unk0x190++;
m_step++;
if (m_unk0x190 >= 8) {
local2world.SetTranslation(m_unk0x17c[0], m_unk0x17c[1], m_unk0x17c[2]);
m_unk0x164 = 3;
if (m_step >= 8) {
local2world.SetTranslation(m_endLocalToWorld[0], m_endLocalToWorld[1], m_endLocalToWorld[2]);
m_state = Act2Brick::e_atRest;
TickleManager()->UnregisterClient(this);
}
else {
VPV3(local2world[3], local2world[3], m_unk0x168);
VPV3(local2world[3], local2world[3], m_localToWorldMovementStep);
}
m_roi->SetLocal2World(local2world);
@@ -165,7 +165,7 @@ MxLong Act2Brick::Notify(MxParam& p_param)
StopWhistleSound();
}
MxNotificationParam param(c_notificationType22, this);
MxNotificationParam param(c_notificationAct2Brick, this);
NotificationManager()->Send(CurrentWorld(), param);
return 1;
}

View File

@@ -155,7 +155,12 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
// FUNCTION: LEGO1 0x100109b0
// FUNCTION: BETA10 0x1007e8b8
void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und)
void LegoEntity::SetLocation(
const Vector3& p_location,
const Vector3& p_direction,
const Vector3& p_up,
MxBool p_updateCamera
)
{
Mx3DPointFloat direction;
Mx3DPointFloat up;
@@ -182,14 +187,14 @@ void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_directi
m_roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*m_roi);
if (p_und) {
FUN_10010c30();
if (p_updateCamera) {
TransformPointOfView();
}
}
}
// FUNCTION: LEGO1 0x10010c30
void LegoEntity::FUN_10010c30()
void LegoEntity::TransformPointOfView()
{
LegoWorld* world = CurrentWorld();

View File

@@ -13,9 +13,14 @@ DECOMP_SIZE_ASSERT(LegoAnimActorStruct, 0x20)
// FUNCTION: LEGO1 0x1001bf80
// FUNCTION: BETA10 0x1003dc10
LegoAnimActorStruct::LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs)
LegoAnimActorStruct::LegoAnimActorStruct(
float p_worldSpeed,
LegoAnim* p_AnimTreePtr,
LegoROI** p_roiMap,
MxU32 p_numROIs
)
{
m_unk0x00 = p_unk0x00;
m_worldSpeed = p_worldSpeed;
m_AnimTreePtr = p_AnimTreePtr;
m_roiMap = p_roiMap;
m_numROIs = p_numROIs;
@@ -50,22 +55,22 @@ LegoAnimActor::~LegoAnimActor()
// FUNCTION: LEGO1 0x1001c1f0
// FUNCTION: BETA10 0x1003f240
MxResult LegoAnimActor::FUN_1001c1f0(float& p_und)
MxResult LegoAnimActor::GetTimeInCycle(float& p_timeInCycle)
{
float duration = (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration();
p_und = m_actorTime - duration * ((MxS32) (m_actorTime / duration));
p_timeInCycle = m_actorTime - duration * ((MxS32) (m_actorTime / duration));
return SUCCESS;
}
// FUNCTION: LEGO1 0x1001c240
void LegoAnimActor::VTable0x74(Matrix4& p_transform)
{
float und;
float timeInCycle;
LegoPathActor::VTable0x74(p_transform);
if (m_curAnim >= 0) {
FUN_1001c1f0(und);
FUN_1001c360(und, p_transform);
GetTimeInCycle(timeInCycle);
AnimateWithTransform(timeInCycle, p_transform);
}
}
@@ -81,10 +86,10 @@ void LegoAnimActor::Animate(float p_time)
if (m_actorState == c_initial && !m_userNavFlag && m_worldSpeed <= 0) {
if (m_curAnim >= 0) {
MxMatrix matrix(m_unk0xec);
float f;
FUN_1001c1f0(f);
FUN_1001c360(f, matrix);
MxMatrix transform(m_unk0xec);
float timeInCycle;
GetTimeInCycle(timeInCycle);
AnimateWithTransform(timeInCycle, transform);
}
m_lastTime = m_actorTime = p_time;
@@ -96,9 +101,9 @@ void LegoAnimActor::Animate(float p_time)
// FUNCTION: LEGO1 0x1001c360
// FUNCTION: BETA10 0x1003e2d3
MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
MxResult LegoAnimActor::AnimateWithTransform(float p_time, Matrix4& p_transform)
{
if (p_und >= 0) {
if (p_time >= 0) {
assert((m_curAnim >= 0) && (m_curAnim < m_animMaps.size()));
LegoROI** roiMap = m_animMaps[m_curAnim]->m_roiMap;
@@ -133,11 +138,11 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
}
for (MxS32 j = 0; j < n->GetNumChildren(); j++) {
LegoROI::ApplyAnimationTransformation(n->GetChild(j), p_transform, p_und, roiMap);
LegoROI::ApplyAnimationTransformation(n->GetChild(j), p_transform, p_time, roiMap);
}
if (m_cameraFlag) {
FUN_10010c30();
TransformPointOfView();
}
}
@@ -150,15 +155,20 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
// FUNCTION: LEGO1 0x1001c450
// FUNCTION: BETA10 0x1003e590
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs)
MxResult LegoAnimActor::CreateAnimActorStruct(
LegoAnim* p_AnimTreePtr,
float p_worldSpeed,
LegoROI** p_roiMap,
MxU32 p_numROIs
)
{
// the capitalization of `p_AnimTreePtr` was taken from BETA10
assert(p_AnimTreePtr && p_roiMap);
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_unk0x00, p_AnimTreePtr, p_roiMap, p_numROIs);
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_worldSpeed, p_AnimTreePtr, p_roiMap, p_numROIs);
for (vector<LegoAnimActorStruct*>::iterator it = m_animMaps.begin(); it != m_animMaps.end(); it++) {
if (p_unk0x00 < (*it)->m_unk0x00) {
if (p_worldSpeed < (*it)->m_worldSpeed) {
m_animMaps.insert(it, laas);
SetWorldSpeed(m_worldSpeed);
return SUCCESS;
@@ -196,12 +206,12 @@ void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed)
if (m_animMaps.size() > 0) {
m_curAnim = 0;
if (m_worldSpeed >= m_animMaps[m_animMaps.size() - 1]->m_unk0x00) {
if (m_worldSpeed >= m_animMaps[m_animMaps.size() - 1]->m_worldSpeed) {
m_curAnim = m_animMaps.size() - 1;
}
else {
for (MxU32 i = 0; i < m_animMaps.size(); i++) {
if (m_worldSpeed <= m_animMaps[i]->m_unk0x00) {
if (m_worldSpeed <= m_animMaps[i]->m_worldSpeed) {
m_curAnim = i;
break;
}

View File

@@ -169,7 +169,7 @@ inline void LegoExtraActor::FUN_1002ad8a()
m_assAnimP->FUN_1006d680(this, -20.0f);
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -20.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -20.0f) {
m_assAnim = new LegoAnimActorStruct(*m_animMaps[i]);
break;
}
@@ -181,7 +181,7 @@ inline void LegoExtraActor::FUN_1002ad8a()
m_disAnimP->FUN_1006d680(this, -21.0f);
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -21.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -21.0f) {
m_disAnim = new LegoAnimActorStruct(*m_animMaps[i]);
break;
}
@@ -410,7 +410,7 @@ void LegoExtraActor::VTable0xc4()
if (b) {
float duration = m_animMaps[m_curAnim]->GetDuration();
MxMatrix matrix(m_unk0xec);
LegoAnimActor::FUN_1001c360(duration, matrix);
LegoAnimActor::AnimateWithTransform(duration, matrix);
}
}
}

View File

@@ -162,7 +162,7 @@ MxResult LegoPathActor::VTable0x88(
}
else {
m_boundary->AddActor(this);
FUN_10010c30();
TransformPointOfView();
}
m_unk0xec = m_roi->GetLocal2World();
@@ -222,7 +222,7 @@ MxResult LegoPathActor::VTable0x84(
if (m_cameraFlag && m_userNavFlag) {
m_boundary->AddActor(this);
FUN_10010c30();
TransformPointOfView();
}
else {
p5.EqualsCross(*p_boundary->GetUp(), p3);
@@ -392,14 +392,14 @@ void LegoPathActor::VTable0x74(Matrix4& p_transform)
{
if (m_userNavFlag) {
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(p_transform);
FUN_10010c30();
TransformPointOfView();
}
else {
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(p_transform);
m_roi->WrappedUpdateWorldData();
if (m_cameraFlag) {
FUN_10010c30();
TransformPointOfView();
}
}
}
@@ -745,7 +745,7 @@ void LegoPathActor::VTable0xa8()
if (m_userNavFlag) {
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0xec);
FUN_10010c30();
TransformPointOfView();
}
}

View File

@@ -268,10 +268,10 @@ void LegoRaceCar::ParseAction(char* p_extra)
MxS32 i;
for (i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
m_skelKick1Anim = m_animMaps[i];
}
else if (m_animMaps[i]->GetUnknown0x00() == -2.0f) {
else if (m_animMaps[i]->GetWorldSpeed() == -2.0f) {
m_skelKick2Anim = m_animMaps[i];
}
}

View File

@@ -22,15 +22,15 @@ RaceSkel::~RaceSkel()
// FUNCTION: LEGO1 0x10071b50
// FUNCTION: BETA10 0x100f13cf
MxResult RaceSkel::FUN_1001c360(float p_und, Matrix4& p_transform)
MxResult RaceSkel::AnimateWithTransform(float p_time, Matrix4& p_transform)
{
p_transform[3][0] = -630.0f;
p_transform[3][1] = -4.688f;
p_transform[3][2] = 323.0f;
m_animPosition = p_und;
m_animPosition = p_time;
return LegoAnimActor::FUN_1001c360(p_und, p_transform);
return LegoAnimActor::AnimateWithTransform(p_time, p_transform);
}
// FUNCTION: LEGO1 0x10071b90

View File

@@ -1435,7 +1435,7 @@ void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p
if (m_roiMap != NULL) {
m_roiMapList->Append(m_roiMap);
p_actor->FUN_1001c450(m_anim, p_value, m_roiMap, m_roiMapSize);
p_actor->CreateAnimActorStruct(m_anim, p_value, m_roiMap, m_roiMapSize);
m_roiMap = NULL;
}

View File

@@ -294,7 +294,7 @@ MxLong LegoAct2::Notify(MxParam& p_param)
result = 1;
break;
}
case c_notificationType22:
case c_notificationAct2Brick:
SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE);
m_unk0x10c1++;
@@ -647,7 +647,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
local2world[3][1] += 1.5;
local2world2[3][1] -= 0.1;
m_bricks[m_nextBrick - 1].FUN_1007a670(local2world, local2world2, boundary);
m_bricks[m_nextBrick - 1].Place(local2world, local2world2, boundary);
}
return 0;
@@ -671,7 +671,7 @@ MxResult LegoAct2::FUN_100516b0()
local2world[3][1] += 1.3;
local2world2[3][1] -= 0.1;
brick.FUN_1007a670(local2world, local2world2, boundary);
brick.Place(local2world, local2world2, boundary);
m_nextBrick++;
m_unk0x10c4 = 9;
m_unk0x10d0 = 0;

View File

@@ -29,7 +29,7 @@ enum NotificationId {
c_notificationPathStruct = 19, // 100d6230
c_notificationType20 = 20,
c_notificationNewPresenter = 21,
c_notificationType22 = 22,
c_notificationAct2Brick = 22,
c_notificationType23 = 23,
c_notificationTransitioned = 24
};