Isle
Loading...
Searching...
No Matches
legounknown.cpp
Go to the documentation of this file.
1#include "legounknown.h"
2
4
6
7// FUNCTION: LEGO1 0x1009a0f0
9{
10 for (LegoS32 i = 0; i < sizeOfArray(m_unk0x00); i++) {
11 m_unk0x00[i].Clear();
12 }
13}
14
15// FUNCTION: LEGO1 0x1009a130
17{
18}
19
20// FUNCTION: LEGO1 0x1009a140
21// FUNCTION: BETA10 0x10182c2f
23 const Vector3& p_point1,
24 const Vector3& p_point2,
25 const Vector3& p_point3,
26 const Vector3& p_point4
27)
28{
29 m_unk0x00[0] = p_point1;
30 m_unk0x00[1] = p_point2;
31
32 for (LegoS32 i = 0; i < 3; i++) {
33 m_unk0x00[2][i] = (p_point3[i] - p_point1[i]) * 3.0f - p_point2[i] * 2.0f - p_point4[i];
34 m_unk0x00[3][i] = (p_point1[i] - p_point3[i]) * 2.0f + p_point4[i] + p_point2[i];
35 }
36}
37
38// FUNCTION: LEGO1 0x1009a1e0
39// FUNCTION: BETA10 0x10182d61
41{
42 Vector3 v1(p_mat[3]);
43 Vector3 v2(p_mat[0]);
44 Vector3 v3(p_mat[1]);
45 Vector3 v4(p_mat[2]);
46
47 if (p_f1 <= 0.001) {
48 v1 = m_unk0x00[0];
49 v4 = m_unk0x00[1];
50 }
51 else if (p_f1 >= 0.999) {
52 v1 = m_unk0x00[0];
53 v1 += m_unk0x00[1];
54 v1 += m_unk0x00[2];
55 v1 += m_unk0x00[3];
56
57 for (LegoS32 i = 0; i < 3; i++) {
58 v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f;
59 }
60 }
61 else {
62 float local30 = p_f1 * p_f1;
63 float local34 = local30 * p_f1;
64
65 for (LegoS32 i = 0; i < 3; i++) {
66 v1[i] = m_unk0x00[0][i] + m_unk0x00[1][i] * p_f1 + m_unk0x00[2][i] * local30 + m_unk0x00[3][i] * local34;
67 v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * p_f1 * 2.0f + m_unk0x00[3][i] * local30 * 3.0f;
68 }
69 }
70
71 if (p_und) {
72 v4 *= -1.0f;
73 }
74
75 if (v4.Unitize() != 0) {
76 return FAILURE;
77 }
78
79 v2.EqualsCross(p_v, v4);
80 if (v2.Unitize() != 0) {
81 return FAILURE;
82 }
83
84 v3.EqualsCross(v4, v2);
85 return SUCCESS;
86}
Opaque Bezier curve utility used for actor or path position interpolation.
Definition: legounknown.h:18
LegoResult FUN_1009a1e0(float p_f1, Matrix4 &p_mat, Vector3 &p_v, LegoU32 p_und)
[AI] Evaluates the curve and its tangent at p_f1 and computes the local orthonormal frame.
Definition: legounknown.cpp:40
void FUN_1009a140(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, const Vector3 &p_point4)
[AI] Configure internal curve control points.
Definition: legounknown.cpp:22
~LegoUnknown()
[AI] Destructor (no-op).
Definition: legounknown.cpp:16
4x4 Matrix class with virtual interface for manipulation and transformation.
Definition: matrix.h:24
virtual int Unitize()
[AI] Scales the vector so its norm is 1 (unit vector).
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
virtual void EqualsCross(const Vector3 &p_a, const Vector3 &p_b)
[AI] Sets this vector to be the cross product of p_a and p_b.
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
#define sizeOfArray(arr)
Definition: decomp.h:23
unsigned long LegoU32
[AI] Unsigned 32-bit integer type for cross-platform compatibility.
Definition: legotypes.h:71
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
Definition: legotypes.h:101
long LegoS32
[AI] Signed 32-bit integer type for cross-platform compatibility.
Definition: legotypes.h:65
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30