Order functions in binary up to the end of Helicopter; refactor vector/matrix classes (#1309)

* Order experimentation

* Revert IslePathActor

* Fix order

* Fix inlining

* Fixes

* WIP

* WIP

* Refactor

* Refactor

* Fix operators

* Remove obsolete inline keyword

* Fix ctors

* Refactor

* Rename files

* Refactor

* Remove empty line
This commit is contained in:
Christian Semmler
2025-01-04 15:07:04 -07:00
committed by GitHub
parent b8f1364ac7
commit c54805fde8
25 changed files with 1245 additions and 1030 deletions

View File

@@ -10,6 +10,7 @@ class Act3Brickster;
class Act3Cop;
class Act3Shark;
class Helicopter;
class MxQuaternionTransformer;
// Macros confirmed by BETA10
#define MAX_PIZZAS 20
@@ -152,7 +153,7 @@ protected:
const Matrix4& p_destination,
const Matrix4& p_startPosition,
const Matrix4& p_endPosition,
const UnknownMx4DPointFloat& p_unk0x1f4
const MxQuaternionTransformer& p_unk0x1f4
);
Act3State* m_state; // 0xf8

View File

@@ -3,7 +3,7 @@
#include "islepathactor.h"
#include "legostate.h"
#include "realtime/matrix.h"
#include "mxgeometry/mxquaternion.h"
class Act3;
@@ -88,12 +88,12 @@ public:
protected:
void FUN_100042a0(const Matrix4& p_matrix);
MxMatrix m_unk0x160; // 0x160
MxMatrix m_unk0x1a8; // 0x1a8
float m_unk0x1f0; // 0x1f0
UnknownMx4DPointFloat m_unk0x1f4; // 0x1f4
HelicopterState* m_state; // 0x228
MxAtomId m_script; // 0x22c
MxMatrix m_unk0x160; // 0x160
MxMatrix m_unk0x1a8; // 0x1a8
float m_unk0x1f0; // 0x1f0
MxQuaternionTransformer m_unk0x1f4; // 0x1f4
HelicopterState* m_state; // 0x228
MxAtomId m_script; // 0x22c
};
#endif // HELICOPTER_H

View File

@@ -86,6 +86,26 @@ public:
IslePathActor();
// FUNCTION: LEGO1 0x10002e70
virtual MxLong HandleClick() { return 0; } // vtable+0xcc
// FUNCTION: LEGO1 0x10002df0
virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0
// FUNCTION: LEGO1 0x10002e80
virtual MxLong HandleControl(LegoControlManagerNotificationParam&) { return 0; } // vtable+0xd4
// FUNCTION: LEGO1 0x10002e90
virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8
// FUNCTION: LEGO1 0x10002e00
virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0xdc
virtual void Enter(); // vtable+0xe0
virtual void Exit(); // vtable+0xe4
virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags); // vtable+0xe8
virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec
// FUNCTION: LEGO1 0x10002e10
~IslePathActor() override { IslePathActor::Destroy(TRUE); }
@@ -108,29 +128,6 @@ public:
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c
// FUNCTION: LEGO1 0x10002e70
virtual MxLong HandleClick() { return 0; } // vtable+0xcc
// FUNCTION: LEGO1 0x10002df0
virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0
// FUNCTION: LEGO1 0x10002e80
virtual MxLong HandleControl(LegoControlManagerNotificationParam&) { return 0; } // vtable+0xd4
// FUNCTION: LEGO1 0x10002e90
virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8
// FUNCTION: LEGO1 0x10002e00
virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0xdc
virtual void Enter(); // vtable+0xe0
virtual void Exit(); // vtable+0xe4
virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags); // vtable+0xe8
virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec
// SYNTHETIC: LEGO1 0x10002ff0
// IslePathActor::`scalar deleting destructor'
void FUN_1001b660();
void Reset()
@@ -143,6 +140,9 @@ public:
static void RegisterSpawnLocations();
// SYNTHETIC: LEGO1 0x10002ff0
// IslePathActor::`scalar deleting destructor'
protected:
LegoWorld* m_world; // 0x154
LegoPathActor* m_previousActor; // 0x158

View File

@@ -3,6 +3,7 @@
#include "decomp.h"
#include "legoentity.h"
#include "mxgeometry/mxmatrix.h"
class LegoCacheSound;

View File

@@ -7,7 +7,7 @@
#include "legostate.h"
#include "legotraninfolist.h"
#include "mxcore.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxgeometry/mxquaternion.h"
class LegoAnimPresenter;
class LegoEntity;
@@ -258,46 +258,46 @@ private:
void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404);
void FUN_10064b50(MxLong p_time);
LegoOmni::World m_worldId; // 0x08
MxU16 m_animCount; // 0x0c
MxU16 m_unk0x0e; // 0x0e
MxU16 m_unk0x10; // 0x10
AnimInfo* m_anims; // 0x14
undefined2 m_unk0x18; // 0x18
MxBool m_unk0x1a; // 0x1a
MxU32 m_unk0x1c; // 0x1c
LegoTranInfoList* m_tranInfoList; // 0x20
LegoTranInfoList* m_tranInfoList2; // 0x24
MxPresenter* m_unk0x28[2]; // 0x28
MxLong m_unk0x30[2]; // 0x30
MxBool m_unk0x38; // 0x38
MxBool m_animRunning; // 0x39
MxBool m_enableCamAnims; // 0x3a
Extra m_extras[40]; // 0x3c
MxU32 m_lastExtraCharacterId; // 0x3fc
MxBool m_unk0x400; // 0x400
MxBool m_unk0x401; // 0x401
MxBool m_unk0x402; // 0x402
MxLong m_unk0x404; // 0x404
MxLong m_unk0x408; // 0x408
MxLong m_unk0x40c; // 0x40c
MxLong m_unk0x410; // 0x410
MxU32 m_unk0x414; // 0x414
MxU32 m_numAllowedExtras; // 0x418
undefined4 m_unk0x41c; // 0x41c
AnimState* m_animState; // 0x420
LegoROIList* m_unk0x424; // 0x424
MxBool m_suspendedEnableCamAnims; // 0x428
MxBool m_unk0x429; // 0x429
MxBool m_unk0x42a; // 0x42a
MxBool m_suspended; // 0x42b
LegoTranInfo* m_unk0x42c; // 0x42c
MxBool m_unk0x430; // 0x430
MxLong m_unk0x434; // 0x434
MxLong m_unk0x438; // 0x438
MxMatrix m_unk0x43c; // 0x43c
MxMatrix m_unk0x484; // 0x484
UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc
LegoOmni::World m_worldId; // 0x08
MxU16 m_animCount; // 0x0c
MxU16 m_unk0x0e; // 0x0e
MxU16 m_unk0x10; // 0x10
AnimInfo* m_anims; // 0x14
undefined2 m_unk0x18; // 0x18
MxBool m_unk0x1a; // 0x1a
MxU32 m_unk0x1c; // 0x1c
LegoTranInfoList* m_tranInfoList; // 0x20
LegoTranInfoList* m_tranInfoList2; // 0x24
MxPresenter* m_unk0x28[2]; // 0x28
MxLong m_unk0x30[2]; // 0x30
MxBool m_unk0x38; // 0x38
MxBool m_animRunning; // 0x39
MxBool m_enableCamAnims; // 0x3a
Extra m_extras[40]; // 0x3c
MxU32 m_lastExtraCharacterId; // 0x3fc
MxBool m_unk0x400; // 0x400
MxBool m_unk0x401; // 0x401
MxBool m_unk0x402; // 0x402
MxLong m_unk0x404; // 0x404
MxLong m_unk0x408; // 0x408
MxLong m_unk0x40c; // 0x40c
MxLong m_unk0x410; // 0x410
MxU32 m_unk0x414; // 0x414
MxU32 m_numAllowedExtras; // 0x418
undefined4 m_unk0x41c; // 0x41c
AnimState* m_animState; // 0x420
LegoROIList* m_unk0x424; // 0x424
MxBool m_suspendedEnableCamAnims; // 0x428
MxBool m_unk0x429; // 0x429
MxBool m_unk0x42a; // 0x42a
MxBool m_suspended; // 0x42b
LegoTranInfo* m_unk0x42c; // 0x42c
MxBool m_unk0x430; // 0x430
MxLong m_unk0x434; // 0x434
MxLong m_unk0x438; // 0x438
MxMatrix m_unk0x43c; // 0x43c
MxMatrix m_unk0x484; // 0x484
MxQuaternionTransformer m_unk0x4cc; // 0x4cc
};
// TEMPLATE: LEGO1 0x10061750

View File

@@ -4,6 +4,7 @@
#include "legogamestate.h"
#include "legostate.h"
#include "legoworld.h"
#include "mxgeometry/mxquaternion.h"
class LegoCarBuildAnimPresenter;
class LegoControlManagerNotificationParam;
@@ -189,7 +190,7 @@ private:
MxS32 m_unk0x250[2]; // 0x250
LegoCarBuildAnimPresenter* m_unk0x258; // 0x258
UnknownMx4DPointFloat m_unk0x25c; // 0x25c
MxQuaternionTransformer m_unk0x25c; // 0x25c
// These two are likely locations in pixel space
MxS32 m_unk0x290[2]; // 0x290

View File

@@ -3,7 +3,6 @@
#include "legoactor.h"
#include "misc/legounknown.h"
#include "mxgeometry/mxmatrix.h"
#include "mxtypes.h"
struct LegoEdge;

View File

@@ -419,7 +419,7 @@ void Helicopter::Animate(float p_time)
Vector3 v3(m_unk0x1a8[3]);
mat.SetIdentity();
m_unk0x1f4.BETA_1004aaa0(mat, f2);
m_unk0x1f4.InterpolateToMatrix(mat, f2);
v2 = v3;
v2 -= v1;
@@ -482,8 +482,8 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix)
m_unk0x1f0 = Timer()->GetTime();
m_unk0x1f4.BETA_1004a9b0(local48, local90);
m_unk0x1f4.FUN_10004520();
m_unk0x1f4.SetStartEnd(local48, local90);
m_unk0x1f4.NormalizeDirection();
}
// FUNCTION: LEGO1 0x10004640

View File

@@ -358,7 +358,7 @@ void LegoCarBuild::VTable0x70()
m_unk0x2a0 = sqrt((MxDouble) DISTSQRD2(m_unk0x290, m_unk0x298));
m_unk0x25c.BETA_1004a9b0(m_unk0x178, m_unk0x208);
m_unk0x25c.SetStartEnd(m_unk0x178, m_unk0x208);
}
// FUNCTION: LEGO1 0x10023130
@@ -406,7 +406,7 @@ void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y)
MxFloat local1c = sqrt((double) (NORMSQRD2(local20))) / m_unk0x2a0;
m_unk0x25c.BETA_1004aaa0(local78, local1c);
m_unk0x25c.InterpolateToMatrix(local78, local1c);
local78[3][0] = m_unk0x178[3][0] + local18[0];
local78[3][1] = m_unk0x178[3][1] + local18[1];

View File

@@ -2797,8 +2797,8 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x
LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location);
if (location != NULL) {
CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484);
m_unk0x4cc.BETA_1004a9b0(m_unk0x43c, m_unk0x484);
m_unk0x4cc.FUN_10004520();
m_unk0x4cc.SetStartEnd(m_unk0x43c, m_unk0x484);
m_unk0x4cc.NormalizeDirection();
}
else {
p_tranInfo->m_flags &= ~LegoTranInfo::c_bit1;
@@ -2832,7 +2832,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time)
sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und;
sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und;
m_unk0x4cc.BETA_1004aaa0(mat, (float) (p_time - m_unk0x434) / 1000.0f);
m_unk0x4cc.InterpolateToMatrix(mat, (float) (p_time - m_unk0x434) / 1000.0f);
VPV3(mat[3], m_unk0x43c[3], sub);
mat[3][3] = 1.0f;

View File

@@ -8,12 +8,12 @@
#include "mxdirectx/mxdirect3d.h"
#include "mxdirectx/mxstopwatch.h"
#include "mxdisplaysurface.h"
#include "mxgeometry/mxmatrix.h"
#include "mxmisc.h"
#include "mxpalette.h"
#include "mxregion.h"
#include "mxtimer.h"
#include "mxtransitionmanager.h"
#include "realtime/matrix.h"
#include "realtime/realtime.h"
#include "roi/legoroi.h"
#include "tgl/d3drm/impl.h"

View File

@@ -799,7 +799,7 @@ void Act3::DebugCopter(
const Matrix4& p_destination,
const Matrix4& p_startPosition,
const Matrix4& p_endPosition,
const UnknownMx4DPointFloat& p_unk0x1f4
const MxQuaternionTransformer& p_unk0x1f4
)
{
DebugPrintf("Copter matrix...\n\n");
@@ -831,10 +831,10 @@ void Act3::DebugCopter(
Mx4DPointFloat unk0x00, unk0x18;
if (p_unk0x1f4.GetUnknown0x30() != 0) {
if (p_unk0x1f4.GetFlags() != 0) {
// TODO: Match
unk0x00 = p_unk0x1f4.GetUnknown0x00();
unk0x18 = p_unk0x1f4.GetUnknown0x18();
unk0x00 = p_unk0x1f4.GetStartQuat();
unk0x18 = p_unk0x1f4.GetEndQuat();
DebugPrintf("Source quaternion...");
// STRING: LEGO1 0x100f7864

View File

@@ -1,6 +1,7 @@
#include "legoanim.h"
#include "mxgeometry/mxmatrix.h"
#include "mxgeometry/mxquaternion.h"
#include <limits.h>
@@ -851,7 +852,7 @@ inline void LegoAnimNodeData::GetTranslation(
break;
case 2:
Mx4DPointFloat a;
UnknownMx4DPointFloat b;
MxQuaternionTransformer b;
if (p_rotationKeys[i].TestBit1() || p_rotationKeys[i + 1].TestBit1()) {
a[0] = p_rotationKeys[i].GetX();
@@ -878,9 +879,9 @@ inline void LegoAnimNodeData::GetTranslation(
c[3] = p_rotationKeys[i + 1].GetAngle();
}
b.BETA_10180b80(a);
b.BETA_10180bc0(c);
b.BETA_1004aaa0(
b.SetStart(a);
b.SetEnd(c);
b.InterpolateToMatrix(
p_matrix,
(p_time - p_rotationKeys[i].GetTime()) / (p_rotationKeys[i + 1].GetTime() - p_rotationKeys[i].GetTime())
);

View File

@@ -4,6 +4,7 @@
#include "decomp.h"
#include "legoweedge.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxgeometry/mxgeometry4d.h"
class LegoPathStruct;

View File

@@ -4,6 +4,7 @@
#include "legolod.h"
#include "misc/legocontainer.h"
#include "misc/legostorage.h"
#include "mxgeometry/mxgeometry4d.h"
#include "realtime/realtime.h"
#include "shape/legobox.h"
#include "shape/legosphere.h"