Clear unknowns in LegoPathActor (#1731)

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Fabian Neundorf
2026-01-31 01:47:11 +01:00
committed by GitHub
parent 935be9de55
commit 971fe939a6
31 changed files with 674 additions and 551 deletions

View File

@@ -29,18 +29,18 @@ public:
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
// FUNCTION: LEGO1 0x1001a180
MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override
MxS32 CheckIntersections(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override
{
if (m_animatingHit) {
return 0;
}
return LegoAnimActor::VTable0x68(p_v1, p_v2, p_v3);
return LegoAnimActor::CheckIntersections(p_v1, p_v2, p_v3);
} // vtable+0x68
void Animate(float p_time) override; // vtable+0x70
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxResult CalculateSpline() override; // vtable+0x9c
MxS32 NextTargetLocation() override; // vtable+0xa0
void InitializeNextShot();

View File

@@ -57,7 +57,7 @@ class Act3Actor : public LegoAnimActor {
public:
Act3Actor();
MxU32 VTable0x90(float p_time, Matrix4& p_transform) override; // vtable+0x90
MxU32 StepState(float p_time, Matrix4& p_transform) override; // vtable+0x90
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// FUNCTION: LEGO1 0x100431b0
@@ -105,7 +105,7 @@ public:
void ParseAction(char* p_extra) override; // vtable+0x20
void Animate(float p_time) override; // vtable+0x70
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c
MxResult CalculateSpline() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
@@ -143,7 +143,7 @@ public:
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
MxResult CalculateSpline() override; // vtable+0x9c
MxFloat GetUnknown0x20() { return m_unk0x20; }
MxFloat GetUnknown0x24() { return m_unk0x24; }

View File

@@ -90,7 +90,7 @@ public:
// Act3Ammo::`scalar deleting destructor'
private:
MxResult CalculateTransform(float p_curveParameter, Matrix4& p_transform);
MxResult CalculateTransformOnCurve(float p_curveParameter, Matrix4& p_transform);
static Mx3DPointFloat g_hitTranslation;

View File

@@ -69,7 +69,7 @@ public:
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void Animate(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
void ApplyTransform(Matrix4& p_transform) override; // vtable+0x74
MxLong HandleClick() override; // vtable+0xcc
MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4
MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8

View File

@@ -45,7 +45,7 @@ public:
void ParseAction(char* p_extra) override; // vtable+0x20
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
void Animate(float p_time) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
void ApplyTransform(Matrix4& p_transform) override; // vtable+0x74
virtual MxResult GetTimeInCycle(float& p_timeInCycle);
virtual MxResult AnimateWithTransform(float p_time, Matrix4& p_transform);

View File

@@ -37,21 +37,22 @@ public:
}
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
MxS32 VTable0x68(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3) override; // vtable+0x68
inline MxU32 VTable0x6c(
MxS32 CheckIntersections(Vector3& p_rayOrigin, Vector3& p_rayEnd, Vector3& p_intersectionPoint)
override; // vtable+0x68
inline MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
) override; // vtable+0x6c
void Animate(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
void ApplyTransform(Matrix4& p_transform) override; // vtable+0x74
MxU32 StepState(float p_time, Matrix4& p_matrix) override; // vtable+0x90
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
MxResult CalculateSpline() override; // vtable+0x9c
void GetWalkingBehavior(MxBool& p_countCounterclockWise, MxS32& p_selectedEdgeIndex) override; // vtable+0xa4
void VTable0xc4() override; // vtable+0xc4
virtual MxResult SwitchDirection();
@@ -59,7 +60,7 @@ public:
void Restart();
inline void InitializeReassemblyAnim();
void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
void SetPathWalkingMode(MxU8 p_pathWalkingMode) { m_pathWalkingMode = p_pathWalkingMode; }
// SYNTHETIC: LEGO1 0x1002b760
// LegoExtraActor::`scalar deleting destructor'
@@ -72,7 +73,7 @@ private:
};
MxFloat m_scheduledTime; // 0x08
undefined m_unk0x0c; // 0x0c
MxU8 m_pathWalkingMode; // 0x0c
MxU8 m_axis; // 0x0d
MxBool m_animationAtCurrentBoundary; // 0x0e
MxFloat m_prevWorldSpeed; // 0x10

View File

@@ -24,9 +24,9 @@ public:
enum ActorState {
// States
c_initial = 0,
c_one = 1,
c_two = 2,
c_three = 3,
c_ready = 1,
c_hit = 2,
c_hitAnimation = 3,
c_disabled = 4,
c_maxState = 255,
@@ -38,17 +38,21 @@ public:
~LegoPathActor() override;
void ParseAction(char* p_extra) override; // vtable+0x20
virtual MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3); // vtable+0x68
virtual MxU32 VTable0x6c(
virtual MxS32 CheckIntersections(
Vector3& p_rayOrigin,
Vector3& p_rayEnd,
Vector3& p_intersectionPoint
); // vtable+0x68
virtual MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
); // vtable+0x6c
virtual void Animate(float p_time); // vtable+0x70
virtual void VTable0x74(Matrix4& p_transform); // vtable+0x74
virtual void ApplyTransform(Matrix4& p_transform); // vtable+0x74
// FUNCTION: LEGO1 0x10002d20
// FUNCTION: BETA10 0x1000f500
@@ -58,21 +62,21 @@ public:
// FUNCTION: BETA10 0x1000f530
virtual MxBool GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c
virtual MxResult VTable0x80(
const Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
Vector3& p_point4
virtual MxResult SetSpline(
const Vector3& p_start,
Vector3& p_tangentAtStart,
Vector3& p_end,
Vector3& p_tangentAtEnd
); // vtable+0x80
virtual MxResult VTable0x84(
virtual MxResult SetTransformAndDestinationFromPoints(
LegoPathBoundary* p_boundary,
float p_time,
Vector3& p_p1,
Vector3& p_p4,
Vector3& p_start,
Vector3& p_direction,
LegoOrientedEdge* p_destEdge,
float p_destScale
); // vtable+0x84
virtual MxResult VTable0x88(
virtual MxResult SetTransformAndDestinationFromEdge(
LegoPathBoundary* p_boundary,
float p_time,
LegoEdge& p_srcEdge,
@@ -80,11 +84,11 @@ public:
LegoOrientedEdge& p_destEdge,
float p_destScale
); // vtable+0x88
virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c
virtual MxS32 CalculateTransform(float p_time, Matrix4& p_transform); // vtable+0x8c
// FUNCTION: LEGO1 0x10002d40
// FUNCTION: BETA10 0x1000f560
virtual MxU32 VTable0x90(float, Matrix4&) { return FALSE; } // vtable+0x90
virtual MxU32 StepState(float, Matrix4&) { return FALSE; } // vtable+0x90
// FUNCTION: LEGO1 0x10002d50
// FUNCTION: BETA10 0x1000f800
@@ -93,16 +97,16 @@ public:
virtual void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
float& p_scale
); // vtable+0x98
virtual MxResult VTable0x9c(); // vtable+0x9c
virtual MxResult CalculateSpline(); // vtable+0x9c
// FUNCTION: LEGO1 0x10002d60
// FUNCTION: BETA10 0x1000f820
virtual MxS32 NextTargetLocation() { return 0; } // vtable+0xa0
virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8
virtual void GetWalkingBehavior(MxBool& p_countCounterclockWise, MxS32& p_selectedEdgeIndex); // vtable+0xa4
virtual void ApplyLocal2World(); // vtable+0xa8
// FUNCTION: LEGO1 0x10002d70
// FUNCTION: BETA10 0x1000f580
@@ -114,26 +118,32 @@ public:
// FUNCTION: LEGO1 0x10002d90
// FUNCTION: BETA10 0x1000f5e0
virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4
virtual MxFloat GetWallHitDirectionFactor() { return m_wallHitDirectionFactor; } // vtable+0xb4
// FUNCTION: LEGO1 0x10002da0
// FUNCTION: BETA10 0x1000f610
virtual MxFloat VTable0xb8() { return m_unk0x144; } // vtable+0xb8
virtual MxFloat GetWallHitDampening() { return m_wallHitDampening; } // vtable+0xb8
// FUNCTION: LEGO1 0x10002db0
// FUNCTION: BETA10 0x1000f640
virtual void VTable0xbc(MxFloat p_unk0x140) { m_unk0x140 = p_unk0x140; } // vtable+0xbc
virtual void SetWallHitDirectionFactor(MxFloat p_wallHitDirectionFactor)
{
m_wallHitDirectionFactor = p_wallHitDirectionFactor;
} // vtable+0xbc
// FUNCTION: LEGO1 0x10002dc0
// FUNCTION: BETA10 0x1000f670
virtual void VTable0xc0(MxFloat p_unk0x144) { m_unk0x144 = p_unk0x144; } // vtable+0xc0
virtual void SetWallHitDampening(MxFloat p_wallHitDampening)
{
m_wallHitDampening = p_wallHitDampening;
} // vtable+0xc0
// FUNCTION: LEGO1 0x10002dd0
// FUNCTION: BETA10 0x1000f6a0
virtual void VTable0xc4() {} // vtable+0xc4
// FUNCTION: LEGO1 0x10002de0
virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8
virtual void SetCanRotate(MxU8 p_canRotate) { m_canRotate = p_canRotate; } // vtable+0xc8
// FUNCTION: LEGO1 0x1000c430
// FUNCTION: BETA10 0x10012790
@@ -158,7 +168,7 @@ public:
LegoPathController* GetController() { return m_pathController; }
MxBool GetCollideBox() { return m_collideBox; }
MxFloat GetLastTime() { return m_lastTime; }
MxFloat GetTransformTime() { return m_transformTime; }
MxFloat GetActorTime() { return m_actorTime; }
void SetBoundary(LegoPathBoundary* p_boundary) { m_boundary = p_boundary; }
@@ -167,7 +177,7 @@ public:
void SetActorState(MxU32 p_actorState) { m_actorState = p_actorState; }
void SetController(LegoPathController* p_pathController) { m_pathController = p_pathController; }
void SetLastTime(MxFloat p_lastTime) { m_lastTime = p_lastTime; }
void SetTransformTime(MxFloat p_transformTime) { m_transformTime = p_transformTime; }
void SetActorTime(MxFloat p_actorTime) { m_actorTime = p_actorTime; }
void UpdatePlane(LegoNamedPlane& p_namedPlane);
@@ -178,42 +188,42 @@ public:
// LegoPathActor::`scalar deleting destructor'
protected:
inline MxU32 FUN_1002edd0(
list<LegoPathBoundary*>& p_boundaries,
inline MxU32 CheckIntersectionBothFaces(
list<LegoPathBoundary*>& p_checkedBoundaries,
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3,
MxS32 p_und
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint,
MxS32 p_depth
);
MxFloat m_BADuration; // 0x78
MxFloat m_unk0x7c; // 0x7c
MxFloat m_traveledDistance; // 0x7c
MxFloat m_actorTime; // 0x80
MxFloat m_lastTime; // 0x84
MxFloat m_transformTime; // 0x84
LegoPathBoundary* m_boundary; // 0x88
LegoSpline m_spline; // 0x8c
MxU32 m_actorState; // 0xdc
LegoOrientedEdge* m_destEdge; // 0xe0
MxFloat m_unk0xe4; // 0xe4
MxFloat m_destScale; // 0xe4
MxBool m_collideBox; // 0xe8
MxBool m_unk0xe9; // 0xe9
MxBool m_finishedTravel; // 0xe9
MxBool m_userNavFlag; // 0xea
MxMatrix m_unk0xec; // 0xec
MxMatrix m_local2World; // 0xec
LegoPathEdgeContainer* m_grec; // 0x134
LegoPathController* m_pathController; // 0x138
MxFloat m_maxLinearVel; // 0x13c
MxFloat m_unk0x140; // 0x140
MxFloat m_unk0x144; // 0x144
MxU8 m_unk0x148; // 0x148
MxS32 m_unk0x14c; // 0x14c
MxFloat m_unk0x150; // 0x150
MxFloat m_wallHitDirectionFactor; // 0x140
MxFloat m_wallHitDampening; // 0x144
MxU8 m_canRotate; // 0x148
MxS32 m_lastRotationAngle; // 0x14c
MxFloat m_linearRotationRatio; // 0x150
};
// FUNCTION: LEGO1 0x1002edd0
// LegoPathActor::FUN_1002edd0
// LegoPathActor::CheckIntersectionBothFaces
// TEMPLATE: LEGO1 0x10018b70
// List<LegoBoundaryEdge>::~List<LegoBoundaryEdge>

View File

@@ -40,7 +40,7 @@ public:
MxResult AddActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void CheckAndCallPathTriggers(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void CheckAndCallPathTriggers(Vector3& p_from, Vector3& p_to, LegoPathActor* p_actor);
void SwitchBoundary(
LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary,

View File

@@ -30,8 +30,12 @@ public:
return !strcmp(p_name, LegoRaceActor::ClassName()) || LegoAnimActor::IsA(p_name);
}
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
MxS32 CheckIntersections(
Vector3& p_rayOrigin,
Vector3& p_rayEnd,
Vector3& p_intersectionPoint
) override; // vtable+0x68
MxU32 StepState(float p_time, Matrix4& p_matrix) override; // vtable+0x90
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
virtual MxResult FUN_10014aa0();

View File

@@ -64,10 +64,23 @@ public:
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
// FUNCTION: LEGO1 0x10014150
MxU32 VTable0x6c(LegoPathBoundary* p_boundary, Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3)
override
MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
) override
{
return LegoJetskiRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3);
return LegoJetskiRaceActor::CheckPresenterAndActorIntersections(
p_boundary,
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint
);
} // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70
@@ -80,7 +93,7 @@ public:
} // vtable+0x98
// FUNCTION: LEGO1 0x10014210
MxResult VTable0x9c() override { return LegoJetskiRaceActor::VTable0x9c(); } // vtable+0x9c
MxResult CalculateSpline() override { return LegoJetskiRaceActor::CalculateSpline(); } // vtable+0x9c
virtual void SetMaxLinearVelocity(float p_worldSpeed);
@@ -127,10 +140,23 @@ public:
// FUNCTION: LEGO1 0x10014500
// FUNCTION: BETA10 0x100cd5e0
MxU32 VTable0x6c(LegoPathBoundary* p_boundary, Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3)
override
MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
) override
{
return LegoCarRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3);
return LegoCarRaceActor::CheckPresenterAndActorIntersections(
p_boundary,
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint
);
} // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70
@@ -143,7 +169,7 @@ public:
LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
MxResult CalculateSpline() override; // vtable+0x9c
virtual void SetMaxLinearVelocity(float p_maxLinearVelocity);
virtual void KickCamera(float p_param);

View File

@@ -35,13 +35,13 @@ public:
return !strcmp(p_name, LegoCarRaceActor::ClassName()) || LegoRaceActor::IsA(p_name);
}
inline MxU32 VTable0x6c(
inline MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
) override; // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70
void SwitchBoundary(
@@ -49,7 +49,7 @@ public:
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
MxResult CalculateSpline() override; // vtable+0x9c
// LegoCarRaceActor vtable
@@ -130,13 +130,13 @@ public:
return !strcmp(p_name, LegoJetskiRaceActor::ClassName()) || LegoCarRaceActor::IsA(p_name);
}
inline MxU32 VTable0x6c(
inline MxU32 CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
) override; // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70
MxS32 VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edge) override; // vtable+0x1c

View File

@@ -179,7 +179,7 @@ MxResult Act2Actor::HitActor(LegoPathActor*, MxBool)
}
// FUNCTION: LEGO1 0x10018a20
MxResult Act2Actor::VTable0x9c()
MxResult Act2Actor::CalculateSpline()
{
if (m_grec && !m_grec->HasPath()) {
delete m_grec;
@@ -198,7 +198,7 @@ MxResult Act2Actor::VTable0x9c()
brickstrROI->UpdateTransformationRelativeToParent(brickstrMatrix);
}
return LegoPathActor::VTable0x9c();
return LegoPathActor::CalculateSpline();
}
}
@@ -607,7 +607,7 @@ MxU32 Act2Actor::UpdateShot(MxFloat p_time)
return FALSE;
}
m_lastTime = p_time;
m_transformTime = p_time;
LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix initialTransform = m_roi->GetLocal2World();

View File

@@ -100,20 +100,20 @@ Act3Actor::Act3Actor()
// FUNCTION: LEGO1 0x1003fb70
// FUNCTION: BETA10 0x100180ab
MxU32 Act3Actor::VTable0x90(float p_time, Matrix4& p_transform)
MxU32 Act3Actor::StepState(float p_time, Matrix4& p_transform)
{
// Note: Code duplication with LegoExtraActor::VTable0x90
// Note: Code duplication with LegoExtraActor::StepState
switch (m_actorState & c_maxState) {
case c_initial:
case c_one:
case c_ready:
return TRUE;
case c_two:
case c_hit:
m_unk0x1c = p_time + 2000.0f;
m_actorState = c_three;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
m_actorState = c_hitAnimation;
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
return FALSE;
case c_three:
case c_hitAnimation:
assert(!m_userNavFlag);
Vector3 positionRef(p_transform[3]);
@@ -127,10 +127,10 @@ MxU32 Act3Actor::VTable0x90(float p_time, Matrix4& p_transform)
p_transform.RotateX(0.6);
positionRef = position;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
VTable0x74(p_transform);
ApplyTransform(p_transform);
return FALSE;
}
else {
@@ -166,7 +166,7 @@ MxResult Act3Actor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
roi->SetLocal2World(local2world);
roi->WrappedUpdateWorldData();
p_actor->SetActorState(c_two | c_noCollide);
p_actor->SetActorState(c_hit | c_noCollide);
}
return SUCCESS;
@@ -195,7 +195,7 @@ MxResult Act3Cop::HitActor(LegoPathActor* p_actor, MxBool p_bool)
assert(m_world);
((Act3*) m_world)->EatDonut(index);
m_unk0x20 = m_lastTime + 2000;
m_unk0x20 = m_transformTime + 2000;
SetWorldSpeed(6.0);
assert(SoundManager()->GetCacheSoundManager());
@@ -284,7 +284,7 @@ void Act3Cop::Animate(float p_time)
{
Act3Actor::Animate(p_time);
if (m_unk0x20 > 0.0f && m_unk0x20 < m_lastTime) {
if (m_unk0x20 > 0.0f && m_unk0x20 < m_transformTime) {
SetWorldSpeed(2.0f);
m_unk0x20 = -1.0f;
}
@@ -328,7 +328,7 @@ MxResult Act3Cop::FUN_10040360()
LegoPathEdgeContainer* grec = NULL;
Act3* a3 = (Act3*) m_world;
MxMatrix local74(m_unk0xec);
MxMatrix local74(m_local2World);
Vector3 local2c(local74[3]);
Vector3 local20(local74[2]);
@@ -456,7 +456,7 @@ MxResult Act3Cop::FUN_10040360()
vecUnk = m_grec->m_position;
m_boundary = m_grec->m_boundary;
m_grec->m_direction = m_unk0xec[3];
m_grec->m_direction = m_local2World[3];
m_grec->m_direction -= vecUnk;
}
else {
@@ -469,7 +469,7 @@ MxResult Act3Cop::FUN_10040360()
local128 = *v2;
local128 -= *v1;
local128 *= m_unk0xe4;
local128 *= m_destScale;
local128 += *v1;
local128 *= -1.0f;
local128 += m_grec->m_position;
@@ -484,14 +484,14 @@ MxResult Act3Cop::FUN_10040360()
vecUnk = *v2;
vecUnk -= *v1;
vecUnk *= m_unk0xe4;
vecUnk *= m_destScale;
vecUnk += *v1;
}
Vector3 v1(m_unk0xec[0]);
Vector3 v2(m_unk0xec[1]);
Vector3 v3(m_unk0xec[2]);
Vector3 v4(m_unk0xec[3]);
Vector3 v1(m_local2World[0]);
Vector3 v2(m_local2World[1]);
Vector3 v3(m_local2World[2]);
Vector3 v4(m_local2World[3]);
v3 = v4;
v3 -= vecUnk;
@@ -500,7 +500,7 @@ MxResult Act3Cop::FUN_10040360()
v1.Unitize();
v2.EqualsCross(v3, v1);
VTable0x9c();
CalculateSpline();
}
return SUCCESS;
@@ -508,17 +508,17 @@ MxResult Act3Cop::FUN_10040360()
// FUNCTION: LEGO1 0x10040d20
// FUNCTION: BETA10 0x1001942c
MxResult Act3Cop::VTable0x9c()
MxResult Act3Cop::CalculateSpline()
{
if (m_grec && !m_grec->HasPath()) {
delete m_grec;
m_grec = NULL;
m_lastTime = Timer()->GetTime();
m_transformTime = Timer()->GetTime();
FUN_10040360();
return SUCCESS;
}
return Act3Actor::VTable0x9c();
return Act3Actor::CalculateSpline();
}
// FUNCTION: LEGO1 0x10040e10
@@ -570,7 +570,7 @@ void Act3Brickster::ParseAction(char* p_extra)
// FUNCTION: BETA10 0x100197d7
void Act3Brickster::Animate(float p_time)
{
if (m_lastTime <= m_unk0x20 && m_unk0x20 <= p_time) {
if (m_transformTime <= m_unk0x20 && m_unk0x20 <= p_time) {
SetWorldSpeed(5.0f);
}
@@ -618,7 +618,7 @@ void Act3Brickster::Animate(float p_time)
}
else {
MxMatrix local70;
local70 = m_unk0xec;
local70 = m_local2World;
Vector3 local14(local70[0]);
Vector3 local28(local70[1]);
@@ -642,7 +642,7 @@ void Act3Brickster::Animate(float p_time)
}
}
m_lastTime = p_time;
m_transformTime = p_time;
break;
case 4:
assert(m_shootAnim && m_bInfo);
@@ -663,7 +663,7 @@ void Act3Brickster::Animate(float p_time)
}
else {
MxMatrix locale4;
locale4 = m_unk0xec;
locale4 = m_local2World;
Vector3 local88(locale4[0]);
Vector3 local9c(locale4[1]);
@@ -689,7 +689,7 @@ void Act3Brickster::Animate(float p_time)
}
}
m_lastTime = p_time;
m_transformTime = p_time;
break;
case 5:
if (m_grec == NULL) {
@@ -793,11 +793,11 @@ MxResult Act3Brickster::FUN_100417c0()
LegoPathEdgeContainer* grec = NULL;
Act3* a3 = (Act3*) m_world;
MxMatrix local70(m_unk0xec);
MxMatrix local70(m_local2World);
Vector3 local28(local70[3]);
Vector3 local20(local70[2]);
if (m_unk0x58 < 8 && m_unk0x24 + 5000.0f < m_lastTime) {
if (m_unk0x58 < 8 && m_unk0x24 + 5000.0f < m_transformTime) {
float local18;
for (MxS32 i = 0; i < MAX_PIZZAS; i++) {
@@ -950,7 +950,7 @@ MxResult Act3Brickster::FUN_100417c0()
vecUnk = m_grec->m_position;
m_boundary = m_grec->m_boundary;
m_grec->m_direction = m_unk0xec[3];
m_grec->m_direction = m_local2World[3];
m_grec->m_direction -= vecUnk;
local150 = m_grec->m_direction;
@@ -964,7 +964,7 @@ MxResult Act3Brickster::FUN_100417c0()
local150 = *v2;
local150 -= *v1;
local150 *= m_unk0xe4;
local150 *= m_destScale;
local150 += *v1;
local150 *= -1.0f;
local150 += m_grec->m_position;
@@ -979,14 +979,14 @@ MxResult Act3Brickster::FUN_100417c0()
vecUnk = *v2;
vecUnk -= *v1;
vecUnk *= m_unk0xe4;
vecUnk *= m_destScale;
vecUnk += *v1;
}
Vector3 v1(m_unk0xec[0]);
Vector3 v2(m_unk0xec[1]);
Vector3 v3(m_unk0xec[2]);
Vector3 v4(m_unk0xec[3]);
Vector3 v1(m_local2World[0]);
Vector3 v2(m_local2World[1]);
Vector3 v3(m_local2World[2]);
Vector3 v4(m_local2World[3]);
v3 = v4;
v3 -= vecUnk;
@@ -995,7 +995,7 @@ MxResult Act3Brickster::FUN_100417c0()
v1.Unitize();
v2.EqualsCross(v3, v1);
VTable0x9c();
CalculateSpline();
if (m_pInfo != NULL) {
m_unk0x38 = 5;
@@ -1098,10 +1098,10 @@ MxS32 Act3Brickster::FUN_10042300()
m_destEdge = maxE;
if (m_boundary != boundaries[0]) {
m_unk0xe4 = 1.0 - m_unk0xe4;
m_destScale = 1.0 - m_destScale;
}
VTable0x9c();
CalculateSpline();
}
return -1;
@@ -1118,16 +1118,16 @@ void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEd
// FUNCTION: LEGO1 0x100429d0
// FUNCTION: BETA10 0x1001b75b
MxResult Act3Brickster::VTable0x9c()
MxResult Act3Brickster::CalculateSpline()
{
if (m_grec && !m_grec->HasPath()) {
delete m_grec;
m_grec = NULL;
m_lastTime = Timer()->GetTime();
m_transformTime = Timer()->GetTime();
return SUCCESS;
}
return Act3Actor::VTable0x9c();
return Act3Actor::CalculateSpline();
}
// FUNCTION: LEGO1 0x10042ab0

View File

@@ -166,9 +166,9 @@ MxResult Act3Ammo::Shoot(LegoPathController* p_p, LegoPathBoundary* p_boundary,
m_boundary = p_boundary;
m_BADuration = 10000.0f;
m_apexParameter = p_apexParameter;
m_unk0x7c = 0.0f;
m_lastTime = -1.0f;
m_actorState = c_one;
m_traveledDistance = 0.0f;
m_transformTime = -1.0f;
m_actorState = c_ready;
return SUCCESS;
}
@@ -193,15 +193,15 @@ MxResult Act3Ammo::Shoot(LegoPathController* p_p, MxFloat p_apexParameter)
m_pathController = p_p;
m_BADuration = 10000.0f;
m_apexParameter = p_apexParameter;
m_unk0x7c = 0.0f;
m_lastTime = -1.0f;
m_actorState = c_one;
m_traveledDistance = 0.0f;
m_transformTime = -1.0f;
m_actorState = c_ready;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10053db0
// FUNCTION: BETA10 0x1001e0f0
MxResult Act3Ammo::CalculateTransform(float p_curveParameter, Matrix4& p_transform)
MxResult Act3Ammo::CalculateTransformOnCurve(float p_curveParameter, Matrix4& p_transform)
{
float curveParameterSquare = p_curveParameter * p_curveParameter;
@@ -255,13 +255,13 @@ void Act3Ammo::Animate(float p_time)
switch (m_actorState & c_maxState) {
case c_initial:
case c_one:
case c_ready:
break;
case c_two:
case c_hit:
m_rotateTimeout = p_time + 2000.0f;
m_actorState = c_three;
m_actorState = c_hitAnimation;
return;
case c_three:
case c_hitAnimation:
MxMatrix transform;
Vector3 positionRef(transform[3]);
@@ -293,15 +293,15 @@ void Act3Ammo::Animate(float p_time)
return;
}
if (m_lastTime < 0.0f) {
m_lastTime = p_time;
m_unk0x7c = 0.0f;
if (m_transformTime < 0.0f) {
m_transformTime = p_time;
m_traveledDistance = 0.0f;
}
MxMatrix transform;
MxMatrix additionalTransform;
float f = (m_BADuration - m_unk0x7c) / m_worldSpeed + m_lastTime;
float f = (m_BADuration - m_traveledDistance) / m_worldSpeed + m_transformTime;
undefined4 unused1 = 0;
undefined4 unused2 = 0;
@@ -309,19 +309,19 @@ void Act3Ammo::Animate(float p_time)
MxU32 reachedTarget = FALSE;
if (f >= p_time) {
m_actorTime = (p_time - m_lastTime) * m_worldSpeed + m_actorTime;
m_unk0x7c = (p_time - m_lastTime) * m_worldSpeed + m_unk0x7c;
m_lastTime = p_time;
m_actorTime = (p_time - m_transformTime) * m_worldSpeed + m_actorTime;
m_traveledDistance = (p_time - m_transformTime) * m_worldSpeed + m_traveledDistance;
m_transformTime = p_time;
}
else {
reachedTarget = TRUE;
m_unk0x7c = m_BADuration;
m_lastTime = p_time;
m_traveledDistance = m_BADuration;
m_transformTime = p_time;
}
transform.SetIdentity();
MxResult r = CalculateTransform((m_unk0x7c / m_BADuration) * m_apexParameter, transform);
MxResult r = CalculateTransformOnCurve((m_traveledDistance / m_BADuration) * m_apexParameter, transform);
assert(r == 0); // SUCCESS
additionalTransform.SetIdentity();
@@ -369,7 +369,7 @@ void Act3Ammo::Animate(float p_time)
m_roi->SetLocal2World(transform);
m_roi->WrappedUpdateWorldData();
if (m_BADuration <= m_unk0x7c) {
if (m_BADuration <= m_traveledDistance) {
m_worldSpeed = 0.0f;
}

View File

@@ -19,8 +19,8 @@ DECOMP_SIZE_ASSERT(Bike, 0x164)
Bike::Bike()
{
m_maxLinearVel = 20.0;
m_unk0x150 = 3.0;
m_unk0x148 = 1;
m_linearRotationRatio = 3.0;
m_canRotate = 1;
}
// FUNCTION: LEGO1 0x100768f0

View File

@@ -384,7 +384,7 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
}
// FUNCTION: LEGO1 0x10003e90
void Helicopter::VTable0x74(Matrix4& p_transform)
void Helicopter::ApplyTransform(Matrix4& p_transform)
{
if (m_userNavFlag) {
m_roi->UpdateTransformationRelativeToParent(p_transform);

View File

@@ -33,8 +33,8 @@ const char* g_varJSWNSHY5 = "c_jswnshy5";
Jetski::Jetski()
{
m_maxLinearVel = 25.0;
m_unk0x150 = 2.0;
m_unk0x148 = 1;
m_linearRotationRatio = 2.0;
m_canRotate = 1;
}
// FUNCTION: LEGO1 0x1007e630

View File

@@ -22,8 +22,8 @@ DECOMP_SIZE_ASSERT(Motocycle, 0x16c)
Motocycle::Motocycle()
{
m_maxLinearVel = 40.0;
m_unk0x150 = 1.75;
m_unk0x148 = 1;
m_linearRotationRatio = 1.75;
m_canRotate = 1;
m_fuel = 1.0;
}

View File

@@ -22,8 +22,8 @@ SkateBoard::SkateBoard()
{
m_pizzaVisible = FALSE;
m_maxLinearVel = 15.0;
m_unk0x150 = 3.5;
m_unk0x148 = 1;
m_linearRotationRatio = 3.5;
m_canRotate = 1;
NotificationManager()->Register(this);
}

View File

@@ -314,7 +314,7 @@ MxS32 g_legoAnimationManagerConfig = 1;
float g_unk0x100f7500 = 0.1f;
// GLOBAL: LEGO1 0x100f7504
MxS32 g_unk0x100f7504 = 0;
MxS32 g_pathWalkingModeSelector = 0;
// FUNCTION: LEGO1 0x1005eb50
void LegoAnimationManager::configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig)
@@ -1927,10 +1927,10 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
}
if (i != m_numAllowedExtras) {
MxU8 und = rand() % 2 != 0 ? 1 : 2;
MxU8 pathWalkingMode = rand() % 2 != 0 ? 1 : 2;
MxBool bool1, bool2;
switch (g_unk0x100f7504 % 4) {
switch (g_pathWalkingModeSelector % 4) {
case 0:
bool1 = FALSE;
bool2 = FALSE;
@@ -1948,7 +1948,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
if (p_location < 0) {
boundary = new LegoLocation::Boundary;
if (!FUN_10064120(boundary, und == 2, bool2)) {
if (!FUN_10064120(boundary, pathWalkingMode == 2, bool2)) {
delete boundary;
boundary = NULL;
}
@@ -2002,19 +2002,19 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
g_characters[m_lastExtraCharacterId].m_name
);
switch (g_unk0x100f7504++ % 4) {
switch (g_pathWalkingModeSelector++ % 4) {
case 0:
actor->SetUnknown0x0c(und != 1 ? 1 : 2);
actor->SetPathWalkingMode(pathWalkingMode != 1 ? 1 : 2);
break;
case 1: {
actor->SetUnknown0x0c(und);
actor->SetPathWalkingMode(pathWalkingMode);
MxS32 src = boundary->m_src;
boundary->m_src = boundary->m_dest;
boundary->m_dest = src;
break;
}
default:
actor->SetUnknown0x0c(und);
actor->SetPathWalkingMode(pathWalkingMode);
break;
}
@@ -2184,21 +2184,21 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
MxResult result = 1; // Not a valid MxResult value
if (!local24) {
MxU8 unk0x0c;
MxU8 pathWalkingMode;
switch (rand() % 3) {
case 0:
unk0x0c = 1;
pathWalkingMode = 1;
break;
case 1:
unk0x0c = 2;
pathWalkingMode = 2;
break;
case 2:
unk0x0c = 0;
pathWalkingMode = 0;
break;
}
actor->SetUnknown0x0c(unk0x0c);
actor->SetPathWalkingMode(pathWalkingMode);
Mx3DPointFloat position;
Mx3DPointFloat direction;
@@ -2695,8 +2695,8 @@ MxResult LegoAnimationManager::FUN_10064380(
}
if (actor != NULL) {
MxU8 unk0x0c = rand() % 2 != 0 ? 1 : 2;
actor->SetUnknown0x0c(unk0x0c);
MxU8 pathWalkingMode = rand() % 2 != 0 ? 1 : 2;
actor->SetPathWalkingMode(pathWalkingMode);
actor->SetWorldSpeed(0.0f);
if (world->PlaceActor(actor, p_boundaryName, p_src, p_srcScale, p_dest, p_destScale) != SUCCESS) {

View File

@@ -471,10 +471,10 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
}
#ifdef BETA10
actor->VTable0xa8();
actor->ApplyLocal2World();
#else
if (m_tranInfo->m_unk0x29) {
actor->VTable0xa8();
actor->ApplyLocal2World();
}
#endif
}

View File

@@ -63,10 +63,10 @@ MxResult LegoAnimActor::GetTimeInCycle(float& p_timeInCycle)
}
// FUNCTION: LEGO1 0x1001c240
void LegoAnimActor::VTable0x74(Matrix4& p_transform)
void LegoAnimActor::ApplyTransform(Matrix4& p_transform)
{
float timeInCycle;
LegoPathActor::VTable0x74(p_transform);
LegoPathActor::ApplyTransform(p_transform);
if (m_curAnim >= 0) {
GetTimeInCycle(timeInCycle);
@@ -80,19 +80,19 @@ void LegoAnimActor::Animate(float p_time)
{
assert(m_roi);
if (m_lastTime == 0) {
m_lastTime = p_time - 1.0f;
if (m_transformTime == 0) {
m_transformTime = p_time - 1.0f;
}
if (m_actorState == c_initial && !m_userNavFlag && m_worldSpeed <= 0) {
if (m_curAnim >= 0) {
MxMatrix transform(m_unk0xec);
MxMatrix transform(m_local2World);
float timeInCycle;
GetTimeInCycle(timeInCycle);
AnimateWithTransform(timeInCycle, transform);
}
m_lastTime = m_actorTime = p_time;
m_transformTime = m_actorTime = p_time;
}
else {
LegoPathActor::Animate(p_time);

View File

@@ -32,7 +32,7 @@ LegoExtraActor::LegoExtraActor()
{
m_lastPathStruct = 0.0f;
m_scheduledTime = 0;
m_unk0x0c = 0;
m_pathWalkingMode = 0;
m_animationAtCurrentBoundary = FALSE;
m_reassemblyAnimation = e_none;
m_assAnim = NULL;
@@ -48,19 +48,19 @@ LegoExtraActor::~LegoExtraActor()
}
// FUNCTION: LEGO1 0x1002a720
MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
MxU32 LegoExtraActor::StepState(float p_time, Matrix4& p_transform)
{
switch (m_actorState & c_maxState) {
case c_initial:
case c_one:
case c_ready:
return TRUE;
case c_two:
case c_hit:
m_scheduledTime = p_time + 2000.0f;
m_actorState = c_three;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
m_actorState = c_hitAnimation;
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
return FALSE;
case c_three: {
case c_hitAnimation: {
Vector3 positionRef(p_transform[3]);
p_transform = m_roi->GetLocal2World();
@@ -89,9 +89,9 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
}
positionRef = position;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
VTable0x74(p_transform);
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
ApplyTransform(p_transform);
return FALSE;
}
else {
@@ -109,20 +109,20 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
}
// FUNCTION: LEGO1 0x1002aa90
void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
void LegoExtraActor::GetWalkingBehavior(MxBool& p_countCounterclockWise, MxS32& p_selectedEdgeIndex)
{
switch (m_unk0x0c) {
switch (m_pathWalkingMode) {
case 1:
p_und1 = TRUE;
p_und2 = 1;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = 1;
break;
case 2:
p_und1 = FALSE;
p_und2 = 1;
p_countCounterclockWise = FALSE;
p_selectedEdgeIndex = 1;
break;
default:
p_und1 = TRUE;
p_und2 = rand() % p_und2 + 1;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = rand() % p_selectedEdgeIndex + 1;
break;
}
}
@@ -131,10 +131,10 @@ void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
MxResult LegoExtraActor::SwitchDirection()
{
LegoPathBoundary* oldEdge = m_boundary;
Vector3 rightRef(m_unk0xec[0]);
Vector3 upRef(m_unk0xec[1]);
Vector3 dirRef(m_unk0xec[2]);
Vector3 positionRef(m_unk0xec[3]);
Vector3 rightRef(m_local2World[0]);
Vector3 upRef(m_local2World[1]);
Vector3 dirRef(m_local2World[2]);
Vector3 positionRef(m_local2World[3]);
dirRef *= -1.0f;
rightRef.EqualsCross(upRef, dirRef);
@@ -150,7 +150,7 @@ MxResult LegoExtraActor::SwitchDirection()
m_boundary = oldEdge;
}
LegoPathActor::VTable0x9c();
LegoPathActor::CalculateSpline();
return SUCCESS;
}
@@ -240,7 +240,7 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
VTable0xc4();
SetWorldSpeed(0);
m_reassemblyAnimation = e_disassemble;
SetActorState(c_one | c_noCollide);
SetActorState(c_ready | c_noCollide);
}
}
@@ -249,7 +249,7 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
assert(roi);
SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE);
VTable0xc4();
SetActorState(c_two | c_noCollide);
SetActorState(c_hit | c_noCollide);
Mx3DPointFloat dir = p_actor->GetWorldDirection();
MxMatrix matrix3 = MxMatrix(roi->GetLocal2World());
Vector3 positionRef(matrix3[3]);
@@ -272,10 +272,10 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
}
// FUNCTION: LEGO1 0x1002b290
MxResult LegoExtraActor::VTable0x9c()
MxResult LegoExtraActor::CalculateSpline()
{
LegoPathBoundary* oldBoundary = m_boundary;
MxResult result = LegoPathActor::VTable0x9c();
MxResult result = LegoPathActor::CalculateSpline();
if (m_boundary != oldBoundary) {
MxU32 foundAnimation = FALSE;
@@ -333,7 +333,7 @@ void LegoExtraActor::Animate(float p_time)
case e_disassemble:
if (m_scheduledTime < p_time) {
m_reassemblyAnimation = e_assemble;
m_actorState = c_one | c_noCollide;
m_actorState = c_ready | c_noCollide;
m_scheduledTime = m_assAnim->GetDuration() + p_time;
break;
}
@@ -347,7 +347,7 @@ void LegoExtraActor::Animate(float p_time)
m_actorState = c_initial;
SetWorldSpeed(m_prevWorldSpeed);
m_roi->SetLocal2World(m_localBeforeHit);
m_lastTime = p_time;
m_transformTime = p_time;
break;
}
else {
@@ -379,10 +379,10 @@ void LegoExtraActor::Animate(float p_time)
}
// FUNCTION: LEGO1 0x1002b5d0
void LegoExtraActor::VTable0x74(Matrix4& p_transform)
void LegoExtraActor::ApplyTransform(Matrix4& p_transform)
{
if (m_reassemblyAnimation == e_none) {
LegoAnimActor::VTable0x74(p_transform);
LegoAnimActor::ApplyTransform(p_transform);
}
}
@@ -409,32 +409,32 @@ void LegoExtraActor::VTable0xc4()
if (b) {
float duration = m_animMaps[m_curAnim]->GetDuration();
MxMatrix matrix(m_unk0xec);
MxMatrix matrix(m_local2World);
LegoAnimActor::AnimateWithTransform(duration, matrix);
}
}
}
// FUNCTION: LEGO1 0x1002b6f0
MxS32 LegoExtraActor::VTable0x68(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3)
MxS32 LegoExtraActor::CheckIntersections(Vector3& p_rayOrigin, Vector3& p_rayEnd, Vector3& p_intersectionPoint)
{
return LegoPathActor::VTable0x68(p_point1, p_point2, p_point3);
return LegoPathActor::CheckIntersections(p_rayOrigin, p_rayEnd, p_intersectionPoint);
}
// FUNCTION: LEGO1 0x1002b980
inline MxU32 LegoExtraActor::VTable0x6c(
inline MxU32 LegoExtraActor::CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
)
{
LegoAnimPresenterSet& presenters = p_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) {
if ((*itap)->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3)) {
if ((*itap)->Intersect(p_rayOrigin, p_rayDirection, p_rayLength, p_radius, p_intersectionPoint)) {
return 1;
}
}
@@ -453,11 +453,11 @@ inline MxU32 LegoExtraActor::VTable0x6c(
if (actor->GetUserNavFlag()) {
MxMatrix local2world = roi->GetLocal2World();
Vector3 local60(local2world[3]);
Mx3DPointFloat local54(p_v1);
Mx3DPointFloat local54(p_rayOrigin);
local54 -= local60;
float local1c = p_v2.Dot(p_v2, p_v2);
float local24 = p_v2.Dot(p_v2, local54) * 2.0f;
float local1c = p_rayDirection.Dot(p_rayDirection, p_rayDirection);
float local24 = p_rayDirection.Dot(p_rayDirection, local54) * 2.0f;
float local20 = local54.Dot(local54, local54);
if (m_hitBlockCounter != 0 && local20 < 10.0f) {
@@ -487,9 +487,10 @@ inline MxU32 LegoExtraActor::VTable0x6c(
local1cX = local40;
}
if ((local20X >= 0.0f && local20X <= p_f1) || (local1cX >= 0.0f && local1cX <= p_f1) ||
(local20X <= -0.01 && p_f1 + 0.01 <= local1cX)) {
p_v3 = p_v1;
if ((local20X >= 0.0f && local20X <= p_rayLength) ||
(local1cX >= 0.0f && local1cX <= p_rayLength) ||
(local20X <= -0.01 && p_rayLength + 0.01 <= local1cX)) {
p_intersectionPoint = p_rayOrigin;
if (HitActor(actor, TRUE) < 0) {
return 0;
@@ -502,7 +503,14 @@ inline MxU32 LegoExtraActor::VTable0x6c(
}
}
else {
if (roi->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (roi->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->GetCollideBox()
)) {
if (HitActor(actor, TRUE) < 0) {
return 0;
}

View File

@@ -44,18 +44,18 @@ LegoPathActor::LegoPathActor()
{
m_boundary = NULL;
m_actorTime = 0;
m_lastTime = 0;
m_unk0x7c = 0;
m_transformTime = 0;
m_traveledDistance = 0;
m_userNavFlag = FALSE;
m_actorState = c_initial;
m_grec = NULL;
m_pathController = NULL;
m_collideBox = FALSE;
m_unk0x148 = 0;
m_unk0x14c = 0;
m_unk0x140 = 0.0099999999f;
m_unk0x144 = 0.8f;
m_unk0x150 = 2.0f;
m_canRotate = 0;
m_lastRotationAngle = 0;
m_wallHitDirectionFactor = 0.0099999999f;
m_wallHitDampening = 0.8f;
m_linearRotationRatio = 2.0f;
}
// FUNCTION: LEGO1 0x1002d820
@@ -69,19 +69,24 @@ LegoPathActor::~LegoPathActor()
// FUNCTION: LEGO1 0x1002d8d0
// FUNCTION: BETA10 0x100ae8cd
MxResult LegoPathActor::VTable0x80(const Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4)
MxResult LegoPathActor::SetSpline(
const Vector3& p_start,
Vector3& p_tangentAtStart,
Vector3& p_end,
Vector3& p_tangentAtEnd
)
{
Mx3DPointFloat p1, p2, p3;
Mx3DPointFloat length, tangentAtStart, tangentAtEnd;
p1 = p_point3;
p1 -= p_point1;
m_BADuration = p1.LenSquared();
length = p_end;
length -= p_start;
m_BADuration = length.LenSquared();
if (m_BADuration > 0.0f) {
m_BADuration = sqrtf(m_BADuration);
p2 = p_point2;
p3 = p_point4;
m_spline.SetSpline(p_point1, p2, p_point3, p3);
tangentAtStart = p_tangentAtStart;
tangentAtEnd = p_tangentAtEnd;
m_spline.SetSpline(p_start, tangentAtStart, p_end, tangentAtEnd);
m_BADuration /= 0.001;
return SUCCESS;
}
@@ -93,7 +98,7 @@ MxResult LegoPathActor::VTable0x80(const Vector3& p_point1, Vector3& p_point2, V
// FUNCTION: LEGO1 0x1002d9c0
// FUNCTION: BETA10 0x100ae9da
MxResult LegoPathActor::VTable0x88(
MxResult LegoPathActor::SetTransformAndDestinationFromEdge(
LegoPathBoundary* p_boundary,
float p_time,
LegoEdge& p_srcEdge,
@@ -107,29 +112,29 @@ MxResult LegoPathActor::VTable0x88(
Vector3* v3 = p_destEdge.CWVertex(*p_boundary);
Vector3* v4 = p_destEdge.CCWVertex(*p_boundary);
Mx3DPointFloat p1, p2, p3, p4, p5;
Mx3DPointFloat start, end, destNormal, startDirection, endDirection;
p1 = *v2;
p1 -= *v1;
p1 *= p_srcScale;
p1 += *v1;
start = *v2;
start -= *v1;
start *= p_srcScale;
start += *v1;
p2 = *v4;
p2 -= *v3;
p2 *= p_destScale;
p2 += *v3;
end = *v4;
end -= *v3;
end *= p_destScale;
end += *v3;
m_boundary = p_boundary;
m_destEdge = &p_destEdge;
m_unk0xe4 = p_destScale;
m_unk0x7c = 0;
m_lastTime = p_time;
m_destScale = p_destScale;
m_traveledDistance = 0;
m_transformTime = p_time;
m_actorTime = p_time;
p_destEdge.GetFaceNormal(*p_boundary, p3);
p_destEdge.GetFaceNormal(*p_boundary, destNormal);
p4 = p2;
p4 -= p1;
p4.Unitize();
startDirection = end;
startDirection -= start;
startDirection.Unitize();
MxMatrix matrix;
Vector3 pos(matrix[3]);
@@ -138,8 +143,8 @@ MxResult LegoPathActor::VTable0x88(
Vector3 right(matrix[0]);
matrix.SetIdentity();
pos = p1;
dir = p4;
pos = start;
dir = startDirection;
up = *m_boundary->GetUp();
if (!m_cameraFlag || !m_userNavFlag) {
@@ -150,10 +155,10 @@ MxResult LegoPathActor::VTable0x88(
m_roi->UpdateTransformationRelativeToParent(matrix);
if (!m_cameraFlag || !m_userNavFlag) {
p5.EqualsCross(*p_boundary->GetUp(), p3);
p5.Unitize();
endDirection.EqualsCross(*p_boundary->GetUp(), destNormal);
endDirection.Unitize();
if (VTable0x80(p1, p4, p2, p5) == SUCCESS) {
if (SetSpline(start, startDirection, end, endDirection) == SUCCESS) {
m_boundary->AddActor(this);
}
else {
@@ -165,17 +170,17 @@ MxResult LegoPathActor::VTable0x88(
TransformPointOfView();
}
m_unk0xec = m_roi->GetLocal2World();
m_local2World = m_roi->GetLocal2World();
return SUCCESS;
}
// FUNCTION: LEGO1 0x1002de10
// FUNCTION: BETA10 0x100aee61
MxResult LegoPathActor::VTable0x84(
MxResult LegoPathActor::SetTransformAndDestinationFromPoints(
LegoPathBoundary* p_boundary,
float p_time,
Vector3& p_p1,
Vector3& p_p4,
Vector3& p_start,
Vector3& p_direction,
LegoOrientedEdge* p_destEdge,
float p_destScale
)
@@ -187,20 +192,20 @@ MxResult LegoPathActor::VTable0x84(
assert(v3 && v4);
Mx3DPointFloat p2, p3, p5;
Mx3DPointFloat end, destNormal, endDirection;
p2 = *v4;
p2 -= *v3;
p2 *= p_destScale;
p2 += *v3;
end = *v4;
end -= *v3;
end *= p_destScale;
end += *v3;
m_boundary = p_boundary;
m_destEdge = p_destEdge;
m_unk0xe4 = p_destScale;
m_unk0x7c = 0;
m_lastTime = p_time;
m_destScale = p_destScale;
m_traveledDistance = 0;
m_transformTime = p_time;
m_actorTime = p_time;
p_destEdge->GetFaceNormal(*p_boundary, p3);
p_destEdge->GetFaceNormal(*p_boundary, destNormal);
MxMatrix matrix;
Vector3 pos(matrix[3]);
@@ -209,8 +214,8 @@ MxResult LegoPathActor::VTable0x84(
Vector3 right(matrix[0]);
matrix.SetIdentity();
pos = p_p1;
dir = p_p4;
pos = p_start;
dir = p_direction;
up = *m_boundary->GetUp();
if (!m_cameraFlag || !m_userNavFlag) {
@@ -225,10 +230,10 @@ MxResult LegoPathActor::VTable0x84(
TransformPointOfView();
}
else {
p5.EqualsCross(*p_boundary->GetUp(), p3);
p5.Unitize();
endDirection.EqualsCross(*p_boundary->GetUp(), destNormal);
endDirection.Unitize();
if (VTable0x80(p_p1, p_p4, p2, p5) != SUCCESS) {
if (SetSpline(p_start, p_direction, end, endDirection) != SUCCESS) {
MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName());
return FAILURE;
}
@@ -236,57 +241,59 @@ MxResult LegoPathActor::VTable0x84(
m_boundary->AddActor(this);
}
m_unk0xec = m_roi->GetLocal2World();
m_local2World = m_roi->GetLocal2World();
return SUCCESS;
}
// FUNCTION: LEGO1 0x1002e100
// FUNCTION: BETA10 0x100b0520
MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
MxS32 LegoPathActor::CalculateTransform(float p_time, Matrix4& p_transform)
{
if (m_userNavFlag && m_actorState == c_initial) {
m_lastTime = p_time;
m_transformTime = p_time;
Mx3DPointFloat p1, p2, p3, p4, p5;
p5 = Vector3(m_roi->GetWorldDirection());
p4 = Vector3(m_roi->GetWorldPosition());
Mx3DPointFloat newDir, newPos, intersectionPoint, pos, dir;
dir = Vector3(m_roi->GetWorldDirection());
pos = Vector3(m_roi->GetWorldPosition());
LegoNavController* nav = NavController();
assert(nav);
m_worldSpeed = nav->GetLinearVel();
if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUp())) {
Mx3DPointFloat p6;
p6 = p2;
if (nav->CalculateNewPosDir(pos, dir, newPos, newDir, m_boundary->GetUp())) {
Mx3DPointFloat newPosCopy;
newPosCopy = newPos;
MxS32 result = 0;
m_unk0xe9 = m_boundary->Intersect(m_roi->GetWorldBoundingSphere().Radius(), p4, p2, p3, m_destEdge);
if (m_unk0xe9 == -1) {
m_finishedTravel =
m_boundary
->Intersect(m_roi->GetWorldBoundingSphere().Radius(), pos, newPos, intersectionPoint, m_destEdge);
if (m_finishedTravel == -1) {
MxTrace("Intersect returned -1\n");
return -1;
}
else {
if (m_unk0xe9 != 0) {
p2 = p3;
if (m_finishedTravel != FALSE) {
newPos = intersectionPoint;
}
}
result = VTable0x68(p4, p2, p3);
result = CheckIntersections(pos, newPos, intersectionPoint);
if (result > 0) {
p2 = p4;
m_unk0xe9 = 0;
newPos = pos;
m_finishedTravel = FALSE;
result = 0;
}
else {
m_boundary->CheckAndCallPathTriggers(p4, p2, this);
m_boundary->CheckAndCallPathTriggers(pos, newPos, this);
}
LegoPathBoundary* oldBoundary = m_boundary;
if (m_unk0xe9 != 0) {
VTable0x9c();
if (m_finishedTravel != FALSE) {
CalculateSpline();
if (m_boundary == oldBoundary) {
MxLong time = Timer()->GetTime();
@@ -300,15 +307,15 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
}
}
m_worldSpeed *= m_unk0x144;
m_worldSpeed *= m_wallHitDampening;
nav->SetLinearVel(m_worldSpeed);
Mx3DPointFloat p7(p2);
p7 -= p6;
Mx3DPointFloat newPosDelta(newPos);
newPosDelta -= newPosCopy;
if (p7.Unitize() == 0) {
float f = sqrt(p1.LenSquared()) * m_unk0x140;
p7 *= f;
p1 += p7;
if (newPosDelta.Unitize() == 0) {
float f = sqrt(newDir.LenSquared()) * m_wallHitDirectionFactor;
newPosDelta *= f;
newDir += newPosDelta;
}
}
}
@@ -320,7 +327,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
Vector3 dir(p_transform[2]);
Vector3 pos(p_transform[3]);
dir = p1;
dir = newDir;
up = *m_boundary->GetUp();
right.EqualsCross(up, dir);
@@ -328,7 +335,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
assert(res == 0);
dir.EqualsCross(right, up);
pos = p2;
pos = newPos;
return result;
}
else {
@@ -336,47 +343,47 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
}
}
else if (p_time >= 0 && m_worldSpeed > 0) {
float f = (m_BADuration - m_unk0x7c) / m_worldSpeed + m_lastTime;
float endTime = (m_BADuration - m_traveledDistance) / m_worldSpeed + m_transformTime;
if (f < p_time) {
m_unk0x7c = m_BADuration;
m_unk0xe9 = 1;
if (endTime < p_time) {
m_traveledDistance = m_BADuration;
m_finishedTravel = TRUE;
}
else {
f = p_time;
m_unk0x7c += (f - m_lastTime) * m_worldSpeed;
m_unk0xe9 = 0;
endTime = p_time;
m_traveledDistance += (endTime - m_transformTime) * m_worldSpeed;
m_finishedTravel = FALSE;
}
m_actorTime += (f - m_lastTime) * m_worldSpeed;
m_lastTime = f;
m_actorTime += (endTime - m_transformTime) * m_worldSpeed;
m_transformTime = endTime;
p_transform.SetIdentity();
LegoResult r;
if (m_userNavFlag) {
r = m_spline.Evaluate(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), FALSE);
r = m_spline.Evaluate(m_traveledDistance / m_BADuration, p_transform, *m_boundary->GetUp(), FALSE);
}
else {
r = m_spline.Evaluate(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), TRUE);
r = m_spline.Evaluate(m_traveledDistance / m_BADuration, p_transform, *m_boundary->GetUp(), TRUE);
}
assert(r == 0); // SUCCESS
Vector3 pos1(p_transform[3]);
Vector3 pos2(m_unk0xec[3]);
Vector3 end(p_transform[3]);
Vector3 origin(m_local2World[3]);
Mx3DPointFloat p1;
if (VTable0x68(pos2, pos1, p1) > 0) {
m_lastTime = p_time;
if (CheckIntersections(origin, end, p1) > 0) {
m_transformTime = p_time;
return 1;
}
else {
m_boundary->CheckAndCallPathTriggers(pos2, pos1, this);
pos2 = pos1;
m_boundary->CheckAndCallPathTriggers(origin, end, this);
origin = end;
}
if (m_unk0xe9 != 0) {
VTable0x9c();
if (m_finishedTravel != FALSE) {
CalculateSpline();
}
}
else {
@@ -388,7 +395,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
// FUNCTION: LEGO1 0x1002e740
// FUNCTION: BETA10 0x100b0f70
void LegoPathActor::VTable0x74(Matrix4& p_transform)
void LegoPathActor::ApplyTransform(Matrix4& p_transform)
{
if (m_userNavFlag) {
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(p_transform);
@@ -409,69 +416,70 @@ void LegoPathActor::VTable0x74(Matrix4& p_transform)
void LegoPathActor::Animate(float p_time)
{
MxMatrix transform;
MxU32 b = FALSE;
MxU32 applyTransform = FALSE;
while (m_lastTime < p_time) {
if (m_actorState != c_initial && !VTable0x90(p_time, transform)) {
while (m_transformTime < p_time) {
if (m_actorState != c_initial && !StepState(p_time, transform)) {
return;
}
if (VTable0x8c(p_time, transform) != 0) {
if (CalculateTransform(p_time, transform) != 0) {
break;
}
m_unk0xec = transform;
b = TRUE;
m_local2World = transform;
applyTransform = TRUE;
if (m_unk0xe9 != 0) {
if (m_finishedTravel != FALSE) {
break;
}
}
if (m_userNavFlag && m_unk0x148) {
if (m_userNavFlag && m_canRotate) {
LegoNavController* nav = NavController();
float vel = (nav->GetLinearVel() > 0)
? -(nav->GetRotationalVel() / (nav->GetMaxLinearVel() * m_unk0x150) * nav->GetLinearVel())
float vel =
(nav->GetLinearVel() > 0)
? -(nav->GetRotationalVel() / (nav->GetMaxLinearVel() * m_linearRotationRatio) * nav->GetLinearVel())
: 0;
if ((MxS32) vel != m_unk0x14c) {
m_unk0x14c = vel;
if ((MxS32) vel != m_lastRotationAngle) {
m_lastRotationAngle = vel;
LegoWorld* world = CurrentWorld();
if (world) {
world->GetCameraController()->RotateZ(DTOR(m_unk0x14c));
world->GetCameraController()->RotateZ(DTOR(m_lastRotationAngle));
}
}
}
if (b) {
VTable0x74(transform);
if (applyTransform) {
ApplyTransform(transform);
}
}
// FUNCTION: LEGO1 0x1002e8b0
// FUNCTION: BETA10 0x100af2f7
void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_scale)
{
assert(m_boundary);
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_scale);
}
// FUNCTION: LEGO1 0x1002e8d0
// FUNCTION: BETA10 0x100b1010
MxU32 LegoPathActor::VTable0x6c(
MxU32 LegoPathActor::CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
)
{
LegoAnimPresenterSet& presenters = p_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) {
if ((*itap)->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3)) {
if ((*itap)->Intersect(p_rayOrigin, p_rayDirection, p_rayLength, p_radius, p_intersectionPoint)) {
return 1;
}
}
@@ -487,7 +495,14 @@ MxU32 LegoPathActor::VTable0x6c(
LegoROI* roi = actor->GetROI();
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {
if (roi->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->m_collideBox)) {
if (roi->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->m_collideBox
)) {
HitActor(actor, TRUE);
actor->HitActor(this, FALSE);
return 2;
@@ -500,26 +515,33 @@ MxU32 LegoPathActor::VTable0x6c(
return 0;
}
inline MxU32 LegoPathActor::FUN_1002edd0(
list<LegoPathBoundary*>& p_boundaries,
inline MxU32 LegoPathActor::CheckIntersectionBothFaces(
list<LegoPathBoundary*>& p_checkedBoundaries,
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3,
MxS32 p_und
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint,
MxS32 p_depth
)
{
MxU32 result = VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3);
MxU32 result = CheckPresenterAndActorIntersections(
p_boundary,
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint
);
if (result != 0) {
return result;
}
p_boundaries.push_back(p_boundary);
p_checkedBoundaries.push_back(p_boundary);
if (p_und >= 2) {
if (p_depth >= 2) {
return 0;
}
@@ -531,14 +553,23 @@ inline MxU32 LegoPathActor::FUN_1002edd0(
if (boundary != NULL) {
list<LegoPathBoundary*>::const_iterator it;
for (it = p_boundaries.begin(); !(it == p_boundaries.end()); it++) {
for (it = p_checkedBoundaries.begin(); !(it == p_checkedBoundaries.end()); it++) {
if ((*it) == boundary) {
break;
}
}
if (it == p_boundaries.end()) {
result = FUN_1002edd0(p_boundaries, boundary, p_v1, p_v2, p_f1, p_f2, p_v3, p_und + 1);
if (it == p_checkedBoundaries.end()) {
result = CheckIntersectionBothFaces(
p_checkedBoundaries,
boundary,
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
p_depth + 1
);
if (result != 0) {
return result;
@@ -552,26 +583,35 @@ inline MxU32 LegoPathActor::FUN_1002edd0(
// FUNCTION: LEGO1 0x1002ebe0
// FUNCTION: BETA10 0x100af35e
MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
MxS32 LegoPathActor::CheckIntersections(Vector3& p_rayOrigin, Vector3& p_rayEnd, Vector3& p_intersectionPoint)
{
assert(m_boundary && m_roi);
Mx3DPointFloat v2(p_v2);
v2 -= p_v1;
Mx3DPointFloat rayDirection(p_rayEnd);
rayDirection -= p_rayOrigin;
float len = v2.LenSquared();
float len = rayDirection.LenSquared();
if (len <= 0.001) {
return 0;
}
len = sqrt((double) len);
v2 /= len;
rayDirection /= len;
float radius = m_roi->GetWorldBoundingSphere().Radius();
list<LegoPathBoundary*> boundaries;
return FUN_1002edd0(boundaries, m_boundary, p_v1, v2, len, radius, p_v3, 0);
return CheckIntersectionBothFaces(
boundaries,
m_boundary,
p_rayOrigin,
rayDirection,
len,
radius,
p_intersectionPoint,
0
);
}
// FUNCTION: LEGO1 0x1002f020
@@ -622,20 +662,21 @@ void LegoPathActor::ParseAction(char* p_extra)
// FUNCTION: LEGO1 0x1002f1b0
// FUNCTION: BETA10 0x100af899
MxResult LegoPathActor::VTable0x9c()
MxResult LegoPathActor::CalculateSpline()
{
Mx3DPointFloat local34;
Mx3DPointFloat local48;
MxU32 local1c = 1;
MxU32 local20 = 1;
Mx3DPointFloat targetPosition;
Mx3DPointFloat endDirection;
MxU32 noPath1 = TRUE;
MxU32 noPath2 = TRUE;
if (m_grec != NULL) {
if (m_grec->HasPath()) {
local1c = 0;
local20 = 0;
noPath1 = FALSE;
noPath2 = FALSE;
Mx3DPointFloat vec;
switch (m_pathController->GetNextPathEdge(*m_grec, local34, local48, m_unk0xe4, m_destEdge, m_boundary)) {
switch (m_pathController
->GetNextPathEdge(*m_grec, targetPosition, endDirection, m_destScale, m_destEdge, m_boundary)) {
case 0:
case 1:
break;
@@ -650,30 +691,30 @@ MxResult LegoPathActor::VTable0x9c()
}
}
if (local1c != 0) {
SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
if (noPath1 != FALSE) {
SwitchBoundary(m_boundary, m_destEdge, m_destScale);
}
if (local20 != 0) {
Mx3DPointFloat local78;
if (noPath2 != FALSE) {
Mx3DPointFloat normal;
assert(m_boundary && m_destEdge);
Vector3* v1 = m_destEdge->CWVertex(*m_boundary);
Vector3* v2 = m_destEdge->CCWVertex(*m_boundary);
Vector3* cw = m_destEdge->CWVertex(*m_boundary);
Vector3* ccw = m_destEdge->CCWVertex(*m_boundary);
assert(v1 && v2);
assert(cw && ccw);
LERP3(local34, *v1, *v2, m_unk0xe4);
LERP3(targetPosition, *cw, *ccw, m_destScale);
m_destEdge->GetFaceNormal(*m_boundary, local78);
local48.EqualsCross(*m_boundary->GetUp(), local78);
local48.Unitize();
m_destEdge->GetFaceNormal(*m_boundary, normal);
endDirection.EqualsCross(*m_boundary->GetUp(), normal);
endDirection.Unitize();
}
Vector3 rightRef(m_unk0xec[0]);
Vector3 upRef(m_unk0xec[1]);
Vector3 dirRef(m_unk0xec[2]);
Vector3 rightRef(m_local2World[0]);
Vector3 upRef(m_local2World[1]);
Vector3 dirRef(m_local2World[2]);
upRef = *m_boundary->GetUp();
@@ -683,74 +724,74 @@ MxResult LegoPathActor::VTable0x9c()
dirRef.EqualsCross(rightRef, upRef);
dirRef.Unitize();
Mx3DPointFloat localc0(m_unk0xec[3]);
Mx3DPointFloat local84(m_unk0xec[2]);
Mx3DPointFloat local70(local34);
Mx3DPointFloat start(m_local2World[3]);
Mx3DPointFloat direction(m_local2World[2]);
Mx3DPointFloat startToTarget(targetPosition);
local70 -= localc0;
float len = local70.LenSquared();
startToTarget -= start;
float len = startToTarget.LenSquared();
if (len >= 0.0f) {
len = sqrt(len);
local84 *= len;
local48 *= len;
direction *= len;
endDirection *= len;
}
if (!m_userNavFlag) {
local84 *= -1.0f;
direction *= -1.0f;
}
if (VTable0x80(localc0, local84, local34, local48) != SUCCESS) {
if (SetSpline(start, direction, targetPosition, endDirection) != SUCCESS) {
MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName());
return FAILURE;
}
m_unk0x7c = 0.0f;
m_traveledDistance = 0.0f;
return SUCCESS;
}
// FUNCTION: LEGO1 0x1002f650
// FUNCTION: BETA10 0x100afd67
void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
void LegoPathActor::GetWalkingBehavior(MxBool& p_countCounterclockWise, MxS32& p_selectedEdgeIndex)
{
switch (GetActorId()) {
case c_pepper:
p_und1 = TRUE;
p_und2 = 2;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = 2;
break;
case c_mama:
p_und1 = FALSE;
p_und2 = 1;
p_countCounterclockWise = FALSE;
p_selectedEdgeIndex = 1;
break;
case c_papa:
p_und1 = TRUE;
p_und2 = 1;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = 1;
break;
case c_nick:
case c_brickster:
p_und1 = TRUE;
p_und2 = rand() % p_und2 + 1;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = rand() % p_selectedEdgeIndex + 1;
break;
case c_laura:
p_und1 = FALSE;
p_und2 = 2;
p_countCounterclockWise = FALSE;
p_selectedEdgeIndex = 2;
break;
default:
p_und1 = TRUE;
p_und2 = 1;
p_countCounterclockWise = TRUE;
p_selectedEdgeIndex = 1;
break;
}
}
// FUNCTION: LEGO1 0x1002f700
// FUNCTION: BETA10 0x100afe4c
void LegoPathActor::VTable0xa8()
void LegoPathActor::ApplyLocal2World()
{
m_lastTime = Timer()->GetTime();
m_roi->SetLocal2World(m_unk0xec);
m_transformTime = Timer()->GetTime();
m_roi->SetLocal2World(m_local2World);
m_roi->WrappedUpdateWorldData();
if (m_userNavFlag) {
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0xec);
m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(m_local2World);
TransformPointOfView();
}
}

View File

@@ -128,7 +128,7 @@ void LegoPathBoundary::SwitchBoundary(
selectedEdgeIndex = 1;
}
else {
p_actor->VTable0xa4(countCounterclockwise, selectedEdgeIndex);
p_actor->GetWalkingBehavior(countCounterclockwise, selectedEdgeIndex);
}
while (selectedEdgeIndex > 0) {

View File

@@ -223,8 +223,14 @@ MxResult LegoPathController::PlaceActor(
assert(pSrcE && pDestE);
float time = Timer()->GetTime();
MxResult result =
p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoOrientedEdge&) *pDestE, p_destScale);
MxResult result = p_actor->SetTransformAndDestinationFromEdge(
pBoundary,
time,
*pSrcE,
p_srcScale,
(LegoOrientedEdge&) *pDestE,
p_destScale
);
if (result != SUCCESS) {
assert(0);
@@ -298,7 +304,8 @@ MxResult LegoPathController::PlaceActor(
return FAILURE;
}
if (p_actor->VTable0x84(boundary, time, p_position, p_direction, edge, 0.5f) == SUCCESS) {
if (p_actor->SetTransformAndDestinationFromPoints(boundary, time, p_position, p_direction, edge, 0.5f) ==
SUCCESS) {
p_actor->SetController(this);
m_actors.insert(p_actor);
return SUCCESS;

View File

@@ -25,9 +25,9 @@ LegoRaceActor::LegoRaceActor()
// FUNCTION: LEGO1 0x10014750
// FUNCTION: BETA10 0x100c9bba
MxS32 LegoRaceActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
MxS32 LegoRaceActor::CheckIntersections(Vector3& p_rayOrigin, Vector3& p_rayEnd, Vector3& p_intersectionPoint)
{
MxS32 result = LegoPathActor::VTable0x68(p_v1, p_v2, p_v3);
MxS32 result = LegoPathActor::CheckIntersections(p_rayOrigin, p_rayEnd, p_intersectionPoint);
if (m_userNavFlag && result) {
MxLong time = Timer()->GetTime();
@@ -46,20 +46,20 @@ MxS32 LegoRaceActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
// FUNCTION: LEGO1 0x100147f0
// FUNCTION: BETA10 0x100c9c93
MxU32 LegoRaceActor::VTable0x90(float p_time, Matrix4& p_transform)
MxU32 LegoRaceActor::StepState(float p_time, Matrix4& p_transform)
{
// Note: Code duplication with LegoExtraActor::VTable0x90
// Note: Code duplication with LegoExtraActor::StepState
switch (m_actorState) {
case c_initial:
case c_one:
case c_ready:
return TRUE;
case c_two:
case c_hit:
m_unk0x08 = p_time + 2000.0f;
m_actorState = c_three;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
m_actorState = c_hitAnimation;
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
return FALSE;
case c_three:
case c_hitAnimation:
assert(!m_userNavFlag);
Vector3 positionRef(p_transform[3]);
@@ -73,10 +73,10 @@ MxU32 LegoRaceActor::VTable0x90(float p_time, Matrix4& p_transform)
p_transform.RotateX(0.6);
positionRef = position;
m_actorTime += (p_time - m_lastTime) * m_worldSpeed;
m_lastTime = p_time;
m_actorTime += (p_time - m_transformTime) * m_worldSpeed;
m_transformTime = p_time;
VTable0x74(p_transform);
ApplyTransform(p_transform);
return FALSE;
}
else {
@@ -111,7 +111,7 @@ MxResult LegoRaceActor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
roi->SetLocal2World(matr);
p_actor->SetActorState(c_two);
p_actor->SetActorState(c_hit);
}
}

View File

@@ -471,7 +471,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr);
p_actor->SetActorState(c_two);
p_actor->SetActorState(c_hit);
}
if (m_userNavFlag) {
@@ -531,12 +531,12 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
// FUNCTION: LEGO1 0x10013600
// FUNCTION: BETA10 0x100cbe60
MxResult LegoRaceCar::VTable0x9c()
MxResult LegoRaceCar::CalculateSpline()
{
MxResult result;
if (m_userNavFlag) {
result = LegoCarRaceActor::VTable0x9c();
result = LegoCarRaceActor::CalculateSpline();
if (m_boundary) {
MxS32 onSkeletonBoundary = FALSE;
@@ -560,7 +560,7 @@ MxResult LegoRaceCar::VTable0x9c()
}
}
else {
result = LegoCarRaceActor::VTable0x9c();
result = LegoCarRaceActor::CalculateSpline();
}
return result;
@@ -685,7 +685,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
Vector3(matr[3]) += g_hitOffset;
roi->SetLocal2World(matr);
p_actor->SetActorState(c_two);
p_actor->SetActorState(c_hit);
}
if (m_userNavFlag) {

View File

@@ -51,9 +51,9 @@ LegoCarRaceActor::LegoCarRaceActor()
m_unk0x10 = 0.65f;
m_unk0x14 = 0.03f;
m_unk0x18 = 0.6f;
m_unk0x140 = 0.1f;
m_unk0x150 = -5.0f;
m_unk0x148 = 1;
m_wallHitDirectionFactor = 0.1f;
m_linearRotationRatio = -5.0f;
m_canRotate = 1;
VariableTable()->SetVariable(g_fuel, "0.8");
}
@@ -118,7 +118,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
Mx3DPointFloat destEdgeUnknownVector;
Mx3DPointFloat crossProduct;
if (m_actorState == c_one) {
if (m_actorState == c_ready) {
m_boundary = NULL;
// Not sure where the upper bound of 11 comes from, the underlying array has a size of 16
@@ -132,7 +132,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
assert(m_boundary);
m_actorState = c_initial;
m_unk0x7c = 0;
m_traveledDistance = 0;
if (m_userNavFlag) {
NavController()->SetLinearVel(m_worldSpeed);
@@ -145,7 +145,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
else {
for (MxS32 i = 0; i < 11; i += 2) {
if (LegoPathController::GetControlEdgeA(i) == p_edge) {
m_actorState = c_one;
m_actorState = c_ready;
if (m_worldSpeed < g_unk0x100f7aec) {
m_worldSpeed = g_unk0x100f7aec;
@@ -157,9 +157,9 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
}
}
if (m_actorState == c_one) {
if (m_actorState == c_ready) {
if (m_userNavFlag) {
m_unk0xe4 = 0.5f;
m_destScale = 0.5f;
}
// variable names verified by BETA10
@@ -167,7 +167,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
Vector3* v2 = m_destEdge->CWVertex(*m_boundary);
assert(v1 && v2);
LERP3(pointUnknown, *v1, *v2, m_unk0xe4);
LERP3(pointUnknown, *v1, *v2, m_destScale);
m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector);
@@ -184,14 +184,14 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
crossProduct *= 5.0f;
MxResult callResult =
VTable0x80(Vector3(m_roi->GetWorldPosition()), worldDirection, pointUnknown, crossProduct);
SetSpline(Vector3(m_roi->GetWorldPosition()), worldDirection, pointUnknown, crossProduct);
if (callResult) {
m_unk0x7c = 0;
m_traveledDistance = 0;
return 0;
}
else {
m_unk0x7c = 0;
m_traveledDistance = 0;
#ifdef BETA10
assert(0);
#endif
@@ -216,7 +216,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
// FUNCTION: BETA10 0x100cdb3c
void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
{
LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_destScale);
}
// FUNCTION: LEGO1 0x10080b70
@@ -229,7 +229,7 @@ void LegoCarRaceActor::Animate(float p_time)
if (strcmpi(value, g_racing) == 0) {
m_animState = 1;
m_lastTime = p_time - 1.0f;
m_transformTime = p_time - 1.0f;
m_unk0x1c = p_time;
}
}
@@ -241,14 +241,14 @@ void LegoCarRaceActor::Animate(float p_time)
// FUNCTION: LEGO1 0x10080be0
// FUNCTION: BETA10 0x100cdc54
MxResult LegoCarRaceActor::VTable0x9c()
MxResult LegoCarRaceActor::CalculateSpline()
{
LegoOrientedEdge* d = m_destEdge;
if (VTable0x1c(m_boundary, m_destEdge)) {
LegoPathBoundary* b = m_boundary;
SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
SwitchBoundary(m_boundary, m_destEdge, m_destScale);
assert(m_boundary && m_destEdge);
// variable names verified by BETA10
@@ -257,7 +257,7 @@ MxResult LegoCarRaceActor::VTable0x9c()
assert(v1 && v2);
Mx3DPointFloat point1;
LERP3(point1, *v1, *v2, m_unk0xe4);
LERP3(point1, *v1, *v2, m_destScale);
Mx3DPointFloat point2;
Mx3DPointFloat point3;
@@ -276,7 +276,7 @@ MxResult LegoCarRaceActor::VTable0x9c()
point4 *= 5.0f;
point5 *= 5.0f;
MxResult res = VTable0x80(m_roi->GetWorldPosition(), point4, point1, point5);
MxResult res = SetSpline(m_roi->GetWorldPosition(), point4, point1, point5);
#ifdef BETA10
if (res) {
@@ -285,7 +285,7 @@ MxResult LegoCarRaceActor::VTable0x9c()
}
#endif
m_unk0x7c = 0;
m_traveledDistance = 0;
}
return SUCCESS;
@@ -298,7 +298,7 @@ LegoJetskiRaceActor::LegoJetskiRaceActor()
m_unk0x10 = 0.95f;
m_unk0x14 = 0.04f;
m_unk0x18 = 0.5f;
m_unk0x150 = 1.5f;
m_linearRotationRatio = 1.5f;
}
// FUNCTION: LEGO1 0x10081120
@@ -314,7 +314,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
Vector3* v1 = NULL;
Vector3* v2 = NULL;
if (m_actorState == c_one) {
if (m_actorState == c_ready) {
if (m_destEdge == LegoPathController::GetControlEdgeA(13)) {
m_boundary = (LegoPathBoundary*) m_destEdge->OtherFace(LegoPathController::GetControlBoundaryA(13));
}
@@ -323,7 +323,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
}
m_actorState = c_initial;
m_unk0x7c = 0;
m_traveledDistance = 0;
if (m_userNavFlag) {
NavController()->SetLinearVel(m_worldSpeed);
@@ -335,7 +335,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
}
else {
if (p_edge == LegoPathController::GetControlEdgeA(12)) {
m_actorState = c_one;
m_actorState = c_ready;
if (m_worldSpeed < g_unk0x100da044) {
m_worldSpeed = g_unk0x100da044;
@@ -345,7 +345,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
m_boundary = LegoPathController::GetControlBoundaryA(13);
}
else if (p_edge == LegoPathController::GetControlEdgeA(14)) {
m_actorState = c_one;
m_actorState = c_ready;
if (m_worldSpeed < g_unk0x100da044) {
m_worldSpeed = g_unk0x100da044;
@@ -355,16 +355,16 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
m_boundary = LegoPathController::GetControlBoundaryA(15);
}
if (m_actorState == c_one) {
if (m_actorState == c_ready) {
if (m_userNavFlag) {
m_unk0xe4 = 0.5f;
m_destScale = 0.5f;
}
v1 = m_destEdge->CCWVertex(*m_boundary);
v2 = m_destEdge->CWVertex(*m_boundary);
assert(v1 && v2);
LERP3(a, *v1, *v2, m_unk0xe4);
LERP3(a, *v1, *v2, m_destScale);
m_destEdge->GetFaceNormal(*m_boundary, bbb);
c.EqualsCross(bbb, *m_boundary->GetUp());
@@ -376,9 +376,9 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
worldDirection *= -1.0f;
}
if (VTable0x80(m_roi->GetWorldPosition(), worldDirection, a, c)) {
if (SetSpline(m_roi->GetWorldPosition(), worldDirection, a, c)) {
#ifndef BETA10
m_unk0x7c = 0;
m_traveledDistance = 0;
return 0;
#else
assert(0);
@@ -386,7 +386,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
#endif
}
m_unk0x7c = 0;
m_traveledDistance = 0;
return 0;
}
else {
@@ -402,11 +402,11 @@ void LegoJetskiRaceActor::Animate(float p_time)
const LegoChar* raceState = VariableTable()->GetVariable(g_raceState);
if (!stricmp(raceState, g_racing)) {
m_animState = 1;
m_lastTime = p_time - 1.0f;
m_transformTime = p_time - 1.0f;
m_unk0x1c = p_time;
}
else if (!m_userNavFlag) {
LegoAnimActor::Animate(m_lastTime + 1.0f);
LegoAnimActor::Animate(m_transformTime + 1.0f);
}
}
@@ -417,13 +417,13 @@ void LegoJetskiRaceActor::Animate(float p_time)
// FUNCTION: LEGO1 0x10081840
// FUNCTION: BETA10 0x100cf680
inline MxU32 LegoCarRaceActor::VTable0x6c(
inline MxU32 LegoCarRaceActor::CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
)
{
// STRING: LEGO1 0x100f7af4
@@ -432,7 +432,7 @@ inline MxU32 LegoCarRaceActor::VTable0x6c(
LegoAnimPresenterSet& presenters = p_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) {
if ((*itap)->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3)) {
if ((*itap)->Intersect(p_rayOrigin, p_rayDirection, p_rayLength, p_radius, p_intersectionPoint)) {
return 1;
}
}
@@ -456,8 +456,14 @@ inline MxU32 LegoCarRaceActor::VTable0x6c(
LegoROI* firstROI = (LegoROI*) co->front();
if (firstROI
->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (firstROI->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->GetCollideBox()
)) {
HitActor(actor, TRUE);
if (actor->HitActor(this, FALSE) < 0) {
@@ -470,8 +476,14 @@ inline MxU32 LegoCarRaceActor::VTable0x6c(
LegoROI* lastROI = (LegoROI*) co->back();
if (lastROI
->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (lastROI->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->GetCollideBox()
)) {
HitActor(actor, TRUE);
if (actor->HitActor(this, FALSE) < 0) {
@@ -484,7 +496,14 @@ inline MxU32 LegoCarRaceActor::VTable0x6c(
}
}
else {
if (roi->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (roi->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->GetCollideBox()
)) {
HitActor(actor, TRUE);
if (actor->HitActor(this, FALSE) < 0) {
@@ -504,19 +523,19 @@ inline MxU32 LegoCarRaceActor::VTable0x6c(
}
// FUNCTION: LEGO1 0x10081fd0
inline MxU32 LegoJetskiRaceActor::VTable0x6c(
inline MxU32 LegoJetskiRaceActor::CheckPresenterAndActorIntersections(
LegoPathBoundary* p_boundary,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
float p_f2,
Vector3& p_v3
Vector3& p_rayOrigin,
Vector3& p_rayDirection,
float p_rayLength,
float p_radius,
Vector3& p_intersectionPoint
)
{
LegoAnimPresenterSet& presenters = p_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) {
if ((*itap)->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3)) {
if ((*itap)->Intersect(p_rayOrigin, p_rayDirection, p_rayLength, p_radius, p_intersectionPoint)) {
return 1;
}
}
@@ -532,7 +551,14 @@ inline MxU32 LegoJetskiRaceActor::VTable0x6c(
LegoROI* roi = actor->GetROI();
if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) {
if (roi->Intersect(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) {
if (roi->Intersect(
p_rayOrigin,
p_rayDirection,
p_rayLength,
p_radius,
p_intersectionPoint,
m_collideBox && actor->GetCollideBox()
)) {
HitActor(actor, TRUE);
if (actor->HitActor(this, FALSE) < 0) {

View File

@@ -582,13 +582,13 @@ MxLong Act3::Notify(MxParam& p_param)
m_cop1->SetActorState(LegoPathActor::c_initial);
m_cop1->SetWorldSpeed(2.0f);
m_cop1->VTable0xa8();
m_cop1->ApplyLocal2World();
m_cop2->SetActorState(LegoPathActor::c_initial);
m_cop2->SetWorldSpeed(2.0f);
m_cop2->VTable0xa8();
m_cop2->ApplyLocal2World();
m_brickster->VTable0xa8();
m_brickster->ApplyLocal2World();
m_pizzaHitSound = 0;
m_pizzaMissSound = 0;
m_copDonutSound = 0;
@@ -907,34 +907,34 @@ void Act3::Enable(MxBool p_enable)
MxFloat delta = Timer()->GetTime() - m_time - 100.0f;
m_time = -1.0f;
m_cop1->SetLastTime(m_cop1->GetLastTime() + delta);
m_cop1->SetTransformTime(m_cop1->GetTransformTime() + delta);
m_cop1->SetActorTime(m_cop1->GetActorTime() + delta);
m_cop1->SetUnknown0x20(m_cop1->GetUnknown0x20() + delta);
m_cop1->SetUnknown0x1c(m_cop1->GetUnknown0x1c() + delta);
m_cop2->SetLastTime(m_cop2->GetLastTime() + delta);
m_cop2->SetTransformTime(m_cop2->GetTransformTime() + delta);
m_cop2->SetActorTime(m_cop2->GetActorTime() + delta);
m_cop2->SetUnknown0x20(m_cop2->GetUnknown0x20() + delta);
m_cop2->SetUnknown0x1c(m_cop2->GetUnknown0x1c() + delta);
m_brickster->SetLastTime(m_brickster->GetLastTime() + delta);
m_brickster->SetTransformTime(m_brickster->GetTransformTime() + delta);
m_brickster->SetActorTime(m_brickster->GetActorTime() + delta);
m_brickster->SetUnknown0x20(m_brickster->GetUnknown0x20() + delta);
m_brickster->SetUnknown0x24(m_brickster->GetUnknown0x24() + delta);
m_brickster->SetUnknown0x50(m_brickster->GetUnknown0x50() + delta);
m_brickster->SetUnknown0x1c(m_brickster->GetUnknown0x1c() + delta);
m_copter->SetLastTime(m_copter->GetLastTime() + delta);
m_copter->SetTransformTime(m_copter->GetTransformTime() + delta);
m_copter->SetActorTime(m_copter->GetActorTime() + delta);
m_shark->SetLastTime(m_shark->GetLastTime() + delta);
m_shark->SetTransformTime(m_shark->GetTransformTime() + delta);
m_shark->SetActorTime(m_shark->GetActorTime() + delta);
m_shark->SetUnknown0x2c(m_shark->GetUnknown0x2c() + delta);
MxS32 i;
for (i = 0; i < (MxS32) sizeOfArray(m_pizzas); i++) {
if (m_pizzas[i].IsValid()) {
m_pizzas[i].SetLastTime(m_pizzas[i].GetLastTime() + delta);
m_pizzas[i].SetTransformTime(m_pizzas[i].GetTransformTime() + delta);
m_pizzas[i].SetActorTime(m_pizzas[i].GetActorTime() + delta);
m_pizzas[i].SetRotateTimeout(m_pizzas[i].GetRotateTimeout() + delta);
}
@@ -942,7 +942,7 @@ void Act3::Enable(MxBool p_enable)
for (i = 0; i < (MxS32) sizeOfArray(m_donuts); i++) {
if (m_donuts[i].IsValid()) {
m_donuts[i].SetLastTime(m_donuts[i].GetLastTime() + delta);
m_donuts[i].SetTransformTime(m_donuts[i].GetTransformTime() + delta);
m_donuts[i].SetActorTime(m_donuts[i].GetActorTime() + delta);
m_donuts[i].SetRotateTimeout(m_donuts[i].GetRotateTimeout() + delta);
}
@@ -954,7 +954,7 @@ void Act3::Enable(MxBool p_enable)
InputManager()->SetWorld(this);
InputManager()->Register(this);
SetUserActor(m_copter);
m_copter->VTable0xa8();
m_copter->ApplyLocal2World();
SetAppCursor(e_cursorArrow);
}
}

View File

@@ -123,7 +123,7 @@ public:
Vector4(float* p_data) : Vector3(p_data) {}
// Some code initializes a Vector4 from a `const float*` source.
// Example: `LegoCarBuild::VTable0x6c`
// Example: `LegoCarBuild::CheckIntersections`
// Vector4 however is a class that can mutate its underlying source, making
// initialization with a const source fundamentally incompatible.
// BETA10 appears to have two separate constructors for Vector4 as well,