mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 07:37:59 -05:00
Implement LegoUnknown::FUN_1009a1e0 (#940)
This commit is contained in:
parent
fb16b2c896
commit
8428cde67f
3 changed files with 49 additions and 5 deletions
|
@ -27,8 +27,52 @@ void LegoUnknown::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_
|
|||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1009a1e0
|
||||
LegoResult LegoUnknown::FUN_1009a1e0(float, Matrix4&, Vector3&, LegoU32)
|
||||
// FUNCTION: LEGO1 0x1009a1e0
|
||||
// FUNCTION: BETA10 0x10182d61
|
||||
LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und)
|
||||
{
|
||||
Vector3 v1(p_mat[3]);
|
||||
Vector3 v2(p_mat[0]);
|
||||
Vector3 v3(p_mat[1]);
|
||||
Vector3 v4(p_mat[2]);
|
||||
|
||||
if (p_f1 <= 0.001) {
|
||||
v1 = m_unk0x00[0];
|
||||
v4 = m_unk0x00[1];
|
||||
}
|
||||
else if (p_f1 >= 0.999) {
|
||||
v1 = m_unk0x00[0];
|
||||
((Vector3&) v2).Add(&m_unk0x00[1]);
|
||||
((Vector3&) v3).Add(&m_unk0x00[2]);
|
||||
((Vector3&) v4).Add(&m_unk0x00[3]);
|
||||
|
||||
for (LegoS32 i = 0; i < 3; i++) {
|
||||
v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
float local30 = p_f1 * p_f1;
|
||||
float local34 = local30 * p_f1;
|
||||
|
||||
for (LegoS32 i = 0; i < 3; i++) {
|
||||
v1[i] = m_unk0x00[0][i] + m_unk0x00[1][i] * p_f1 + m_unk0x00[2][i] * local30 + m_unk0x00[3][i] * local34;
|
||||
v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * p_f1 * 2.0f + m_unk0x00[3][i] * local30 * 3.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_und) {
|
||||
((Vector3&) v4).Mul(-1.0f);
|
||||
}
|
||||
|
||||
if (v4.Unitize() != 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
v2.EqualsCross(&p_v, &v4);
|
||||
if (v2.Unitize() != 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
v3.EqualsCross(&v4, &v2);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class LegoUnknown {
|
|||
~LegoUnknown();
|
||||
|
||||
void FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4);
|
||||
LegoResult FUN_1009a1e0(float, Matrix4&, Vector3&, LegoU32);
|
||||
LegoResult FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und);
|
||||
|
||||
private:
|
||||
Mx3DPointFloat m_unk0x00[4]; // 0x00
|
||||
|
|
|
@ -104,7 +104,7 @@ class Vector2 {
|
|||
|
||||
if (sq > 0.0f) {
|
||||
float root = sqrt(sq);
|
||||
if (root > 0) {
|
||||
if (root > 0.0f) {
|
||||
DivScalarImpl(&root);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue