Skip to content

Commit

Permalink
Order functions in binary up to the end of Helicopter; refactor vec…
Browse files Browse the repository at this point in the history
…tor/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
  • Loading branch information
foxtacles authored Jan 4, 2025
1 parent b8f1364 commit c54805f
Show file tree
Hide file tree
Showing 25 changed files with 1,247 additions and 1,032 deletions.
3 changes: 2 additions & 1 deletion LEGO1/lego/legoomni/include/act3.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Act3Brickster;
class Act3Cop;
class Act3Shark;
class Helicopter;
class MxQuaternionTransformer;

// Macros confirmed by BETA10
#define MAX_PIZZAS 20
Expand Down Expand Up @@ -152,7 +153,7 @@ class Act3 : public LegoWorld {
const Matrix4& p_destination,
const Matrix4& p_startPosition,
const Matrix4& p_endPosition,
const UnknownMx4DPointFloat& p_unk0x1f4
const MxQuaternionTransformer& p_unk0x1f4
);

Act3State* m_state; // 0xf8
Expand Down
14 changes: 7 additions & 7 deletions LEGO1/lego/legoomni/include/helicopter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "islepathactor.h"
#include "legostate.h"
#include "realtime/matrix.h"
#include "mxgeometry/mxquaternion.h"

class Act3;

Expand Down Expand Up @@ -88,12 +88,12 @@ class Helicopter : public IslePathActor {
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
46 changes: 23 additions & 23 deletions LEGO1/lego/legoomni/include/islepathactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@ class IslePathActor : public LegoPathActor {

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); }

Expand All @@ -108,29 +128,6 @@ class IslePathActor : public LegoPathActor {
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()
Expand All @@ -143,6 +140,9 @@ class IslePathActor : public LegoPathActor {

static void RegisterSpawnLocations();

// SYNTHETIC: LEGO1 0x10002ff0
// IslePathActor::`scalar deleting destructor'

protected:
LegoWorld* m_world; // 0x154
LegoPathActor* m_previousActor; // 0x158
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/legoomni/include/legoactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "decomp.h"
#include "legoentity.h"
#include "mxgeometry/mxmatrix.h"

class LegoCacheSound;

Expand Down
82 changes: 41 additions & 41 deletions LEGO1/lego/legoomni/include/legoanimationmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -258,46 +258,46 @@ class LegoAnimationManager : public MxCore {
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
Expand Down
3 changes: 2 additions & 1 deletion LEGO1/lego/legoomni/include/legocarbuild.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "legogamestate.h"
#include "legostate.h"
#include "legoworld.h"
#include "mxgeometry/mxquaternion.h"

class LegoCarBuildAnimPresenter;
class LegoControlManagerNotificationParam;
Expand Down Expand Up @@ -189,7 +190,7 @@ class LegoCarBuild : public LegoWorld {
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
Expand Down
1 change: 0 additions & 1 deletion LEGO1/lego/legoomni/include/legopathactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "legoactor.h"
#include "misc/legounknown.h"
#include "mxgeometry/mxmatrix.h"
#include "mxtypes.h"

struct LegoEdge;
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/actors/helicopter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/build/legocarbuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/video/legovideomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions LEGO1/lego/legoomni/src/worlds/act3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions LEGO1/lego/sources/anim/legoanim.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "legoanim.h"

#include "mxgeometry/mxmatrix.h"
#include "mxgeometry/mxquaternion.h"

#include <limits.h>

Expand Down Expand Up @@ -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();
Expand All @@ -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())
);
Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/sources/geom/legowegedge.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "decomp.h"
#include "legoweedge.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxgeometry/mxgeometry4d.h"

class LegoPathStruct;

Expand Down
1 change: 1 addition & 0 deletions LEGO1/lego/sources/roi/legoroi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit c54805f

Please sign in to comment.