isle-portable/LEGO1/lego/sources/misc/legounknown.cpp
Christian Semmler d62054db2e
Updates from isledecomp/isle (#1)
* Implement/match LegoAnimationManager::FUN_10064b50 (#926)

* Implement/match LegoAnimationManager::FUN_10063d10 (#927)

* Implement/match LegoAnimationManager::FUN_10064380 (#928)

* Implement/match LegoAnimationManager::FUN_10064380

* Fix naming

* Revert

* Implement/matche LegoAnimationManager::FUN_10064740 and FUN_10064670 (#929)

* Implement/match FUN_1003ef00 and related (#931)

* Implement/match LegoAnimationManager::FUN_10064120 (#932)

* Implement/match LegoAnimationManager::FUN_10064120

* Fix naming

* Fix parentheses

* Implement LegoAnimationManager::FUN_10064010 (#933)

* Implement/match ViewManager::FUN_100a6150 (#934)

* Implement/match PlayCamAnim and CameraTriggerFire (#935)

* Implement/match PlayCamAnim and CameraTriggerFire

* Fix type

* Name var

* Implement/match LegoAnimationManager::FUN_10063fb0 (#936)

* basic name improvements (#930)

* basic name improvements

* clang-format

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>

* Implement/match LegoPathBoundary::Intersect (#937)

* Implement LegoPathActor::VTable0x68 (#938)

* Implement LegoPathActor::VTable0x68

* Fix naming

* Implement/match LegoPathBoundary::FUN_100575b0 (#939)

* Implement LegoUnknown::FUN_1009a1e0 (#940)

* Implement/match LegoPathController::FUN_1004a240 (#941)

* Implement LegoPathActor::VTable0x9c (#942)

* Implement LegoPathActor::VTable0x9c

* Add annotation

* Implement/match LegoPathActor::SwitchBoundary (#943)

* Implement/match LegoPathActor::SwitchBoundary

* Rename var

* Implement/match LegoPathStruct (#944)

* Implement/match LegoPathStruct

* Rename some nums

* Consistent naming

* Naming

* relax regex

* Name some functions

* Improve naming

* Rename

* Implement/match LegoPathActor::VTable0xa4 and VTable0xa8 (#945)

* Implement/match LegoPathActor::VTable0xa4

* Implement/match LegoPathActor::VTable0xa8

* Name enum constants

---------

Co-authored-by: Cameron <25990062+crtdll@users.noreply.github.com>
2024-05-23 18:09:49 +02:00

79 lines
1.8 KiB
C++

#include "legounknown.h"
DECOMP_SIZE_ASSERT(LegoUnknown, 0x50)
// FUNCTION: LEGO1 0x1009a0f0
LegoUnknown::LegoUnknown()
{
for (LegoS32 i = 0; i < sizeOfArray(m_unk0x00); i++) {
m_unk0x00[i].Clear();
}
}
// FUNCTION: LEGO1 0x1009a130
LegoUnknown::~LegoUnknown()
{
}
// FUNCTION: LEGO1 0x1009a140
void LegoUnknown::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4)
{
m_unk0x00[0] = p_point1;
m_unk0x00[1] = p_point2;
for (LegoS32 i = 0; i < 3; i++) {
m_unk0x00[2][i] = (p_point3[i] - p_point1[i]) * 3.0f - p_point2[i] * 2.0f - p_point4[i];
m_unk0x00[3][i] = (p_point1[i] - p_point3[i]) * 2.0f + p_point4[i] + p_point2[i];
}
}
// 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;
}