mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-23 15:31:16 +00:00
Merge remote-tracking branch 'isle/master' into merge-isle-2
This commit is contained in:
commit
7d90befd05
@ -38,14 +38,9 @@ class HelicopterState : public LegoState {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} // vtable+0x18
|
} // vtable+0x18
|
||||||
|
|
||||||
void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; }
|
|
||||||
MxU32 GetUnkown8() { return m_unk0x08; }
|
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1000e190
|
// SYNTHETIC: LEGO1 0x1000e190
|
||||||
// HelicopterState::`scalar deleting destructor'
|
// HelicopterState::`scalar deleting destructor'
|
||||||
|
|
||||||
// TODO: Most likely getters/setters are not used according to BETA.
|
|
||||||
|
|
||||||
MxU32 m_unk0x08; // 0x08
|
MxU32 m_unk0x08; // 0x08
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,18 @@ class LegoNamedPart {
|
|||||||
m_name = p_name;
|
m_name = p_name;
|
||||||
m_list = p_list;
|
m_list = p_list;
|
||||||
}
|
}
|
||||||
~LegoNamedPart() { delete m_list; }
|
~LegoNamedPart()
|
||||||
|
{
|
||||||
|
LegoLODListCursor cursor(m_list);
|
||||||
|
LegoLOD* lod;
|
||||||
|
|
||||||
|
while (cursor.First(lod)) {
|
||||||
|
cursor.Detach();
|
||||||
|
delete lod;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete m_list;
|
||||||
|
}
|
||||||
|
|
||||||
const MxString* GetName() const { return &m_name; }
|
const MxString* GetName() const { return &m_name; }
|
||||||
LegoLODList* GetList() { return m_list; }
|
LegoLODList* GetList() { return m_list; }
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class LegoWorld : public LegoEntity {
|
|||||||
MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId);
|
MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId);
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x1002b4f0
|
// FUNCTION: BETA10 0x1002b4f0
|
||||||
LegoCameraController* GetCamera() { return m_cameraController; }
|
LegoCameraController* GetCameraController() { return m_cameraController; }
|
||||||
|
|
||||||
LegoEntityList* GetEntityList() { return m_entityList; }
|
LegoEntityList* GetEntityList() { return m_entityList; }
|
||||||
LegoOmni::World GetWorldId() { return m_worldId; }
|
LegoOmni::World GetWorldId() { return m_worldId; }
|
||||||
|
|||||||
@ -444,6 +444,8 @@ MxS32 Act2Actor::VTable0xa0()
|
|||||||
{
|
{
|
||||||
undefined4 newLocation;
|
undefined4 newLocation;
|
||||||
|
|
||||||
|
assert(!m_grec);
|
||||||
|
|
||||||
CurrentWorld();
|
CurrentWorld();
|
||||||
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
|
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ DECOMP_SIZE_ASSERT(Matrix4, 0x08)
|
|||||||
DECOMP_SIZE_ASSERT(MxMatrix, 0x48)
|
DECOMP_SIZE_ASSERT(MxMatrix, 0x48)
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10001e60
|
// FUNCTION: LEGO1 0x10001e60
|
||||||
|
// FUNCTION: BETA10 0x1002a0d0
|
||||||
Helicopter::Helicopter()
|
Helicopter::Helicopter()
|
||||||
{
|
{
|
||||||
m_maxLinearVel = 60;
|
m_maxLinearVel = 60;
|
||||||
@ -43,6 +44,7 @@ Helicopter::~Helicopter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100032c0
|
// FUNCTION: LEGO1 0x100032c0
|
||||||
|
// FUNCTION: BETA10 0x1002a16d
|
||||||
MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
||||||
{
|
{
|
||||||
MxResult result = IslePathActor::Create(p_dsAction);
|
MxResult result = IslePathActor::Create(p_dsAction);
|
||||||
@ -52,6 +54,8 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
|||||||
((Act3*) m_world)->SetHelicopter(this);
|
((Act3*) m_world)->SetHelicopter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(m_world);
|
||||||
|
|
||||||
if (m_world != NULL) {
|
if (m_world != NULL) {
|
||||||
m_world->Add(this);
|
m_world->Add(this);
|
||||||
}
|
}
|
||||||
@ -61,6 +65,7 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10003320
|
// FUNCTION: LEGO1 0x10003320
|
||||||
|
// FUNCTION: BETA10 0x1002a240
|
||||||
void Helicopter::CreateState()
|
void Helicopter::CreateState()
|
||||||
{
|
{
|
||||||
m_state = (HelicopterState*) GameState()->GetState("HelicopterState");
|
m_state = (HelicopterState*) GameState()->GetState("HelicopterState");
|
||||||
@ -70,8 +75,11 @@ void Helicopter::CreateState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10003360
|
// FUNCTION: LEGO1 0x10003360
|
||||||
|
// FUNCTION: BETA10 0x1002a29a
|
||||||
void Helicopter::Exit()
|
void Helicopter::Exit()
|
||||||
{
|
{
|
||||||
|
assert(UserActor() == this);
|
||||||
|
|
||||||
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
||||||
SpawnPlayer(
|
SpawnPlayer(
|
||||||
LegoGameState::e_unk40,
|
LegoGameState::e_unk40,
|
||||||
@ -94,7 +102,7 @@ void Helicopter::Exit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_state->SetUnknown8(0);
|
m_state->m_unk0x08 = 0;
|
||||||
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterDashboard_Bitmap);
|
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterDashboard_Bitmap);
|
||||||
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterArms_Ctl);
|
RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterArms_Ctl);
|
||||||
RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_TakeOff_Ctl);
|
RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_TakeOff_Ctl);
|
||||||
@ -110,6 +118,7 @@ void Helicopter::Exit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10003480
|
// FUNCTION: LEGO1 0x10003480
|
||||||
|
// FUNCTION: BETA10 0x1002a3db
|
||||||
MxLong Helicopter::HandleClick()
|
MxLong Helicopter::HandleClick()
|
||||||
{
|
{
|
||||||
if (!FUN_1003ef60()) {
|
if (!FUN_1003ef60()) {
|
||||||
@ -118,6 +127,7 @@ MxLong Helicopter::HandleClick()
|
|||||||
|
|
||||||
if (!m_world) {
|
if (!m_world) {
|
||||||
m_world = CurrentWorld();
|
m_world = CurrentWorld();
|
||||||
|
assert(m_world);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationManager()->FUN_1005f6d0(FALSE);
|
AnimationManager()->FUN_1005f6d0(FALSE);
|
||||||
@ -163,6 +173,8 @@ MxLong Helicopter::HandleClick()
|
|||||||
MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||||
{
|
{
|
||||||
MxLong result = 0;
|
MxLong result = 0;
|
||||||
|
|
||||||
|
assert(m_world);
|
||||||
MxAtomId script;
|
MxAtomId script;
|
||||||
|
|
||||||
switch (GameState()->GetCurrentAct()) {
|
switch (GameState()->GetCurrentAct()) {
|
||||||
@ -199,9 +211,10 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
|
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
|
||||||
|
assert(act1State);
|
||||||
if (m_state->m_unk0x08 == 0) {
|
if (m_state->m_unk0x08 == 0) {
|
||||||
state->m_unk0x018 = 4;
|
act1State->m_unk0x018 = 4;
|
||||||
m_state->m_unk0x08 = 1;
|
m_state->m_unk0x08 = 1;
|
||||||
m_world->RemoveActor(this);
|
m_world->RemoveActor(this);
|
||||||
InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL);
|
InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL);
|
||||||
@ -238,11 +251,11 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
|||||||
|
|
||||||
assert(m_pathController);
|
assert(m_pathController);
|
||||||
|
|
||||||
if (m_world && m_world->GetCamera()) {
|
if (m_world && m_world->GetCameraController()) {
|
||||||
Mx3DPointFloat location, direction, lookat;
|
Mx3DPointFloat location, direction, lookat;
|
||||||
|
|
||||||
location = m_world->GetCamera()->GetWorldLocation();
|
location = m_world->GetCameraController()->GetWorldLocation();
|
||||||
direction = m_world->GetCamera()->GetWorldDirection();
|
direction = m_world->GetCameraController()->GetWorldDirection();
|
||||||
|
|
||||||
lookat = direction;
|
lookat = direction;
|
||||||
lookat *= 3.0f;
|
lookat *= 3.0f;
|
||||||
@ -250,7 +263,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
|||||||
|
|
||||||
Mx3DPointFloat v68, va4, up;
|
Mx3DPointFloat v68, va4, up;
|
||||||
Mx3DPointFloat v90(0, 1, 0);
|
Mx3DPointFloat v90(0, 1, 0);
|
||||||
v68 = m_world->GetCamera()->GetWorldUp();
|
v68 = m_world->GetCameraController()->GetWorldUp();
|
||||||
va4.EqualsCross(v68, direction);
|
va4.EqualsCross(v68, direction);
|
||||||
up.EqualsCross(va4, v90);
|
up.EqualsCross(va4, v90);
|
||||||
|
|
||||||
@ -295,14 +308,17 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10003c20
|
// FUNCTION: LEGO1 0x10003c20
|
||||||
|
// FUNCTION: BETA10 0x1002ab4c
|
||||||
MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
||||||
{
|
{
|
||||||
MxU32 ret = 0;
|
MxLong result = 0;
|
||||||
|
|
||||||
switch (m_state->GetUnkown8()) {
|
switch (m_state->m_unk0x08) {
|
||||||
case 1: {
|
case 1: {
|
||||||
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
||||||
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
|
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
|
||||||
|
assert(act1State);
|
||||||
|
act1State->m_unk0x018 = 4;
|
||||||
SpawnPlayer(
|
SpawnPlayer(
|
||||||
LegoGameState::e_unk42,
|
LegoGameState::e_unk42,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -317,25 +333,17 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_state->SetUnknown8(2);
|
m_state->m_unk0x08 = 2;
|
||||||
|
|
||||||
MxMatrix matrix;
|
MxMatrix matrix;
|
||||||
matrix.SetIdentity();
|
matrix.SetIdentity();
|
||||||
|
matrix.RotateX(0.5235987901687622); // PI / 6, 30 deg
|
||||||
float s = sin(0.5235987901687622); // PI / 6, 30 deg
|
|
||||||
float c = cos(0.5235987901687622); // PI / 6, 30 deg
|
|
||||||
|
|
||||||
float matrixCopy[4][4];
|
|
||||||
memcpy(matrixCopy, matrix.GetData(), sizeof(matrixCopy));
|
|
||||||
for (MxS32 i = 0; i < 4; i++) {
|
|
||||||
matrix.GetData()[i][1] = matrixCopy[i][1] * c - matrixCopy[i][2] * s;
|
|
||||||
matrix.GetData()[i][2] = matrixCopy[i][2] * c + matrixCopy[i][1] * s;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]);
|
Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]);
|
||||||
m_world->GetCamera()->SetWorldTransform(at, dir, up);
|
|
||||||
|
assert(m_world && m_world->GetCameraController());
|
||||||
|
m_world->GetCameraController()->SetWorldTransform(at, dir, up);
|
||||||
FUN_10010c30();
|
FUN_10010c30();
|
||||||
ret = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@ -344,10 +352,14 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
|||||||
|
|
||||||
Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]);
|
Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]);
|
||||||
at[1] = 1.25;
|
at[1] = 1.25;
|
||||||
m_world->GetCamera()->SetWorldTransform(at, dir, up);
|
|
||||||
|
assert(m_world && m_world->GetCameraController());
|
||||||
|
m_world->GetCameraController()->SetWorldTransform(at, dir, up);
|
||||||
|
|
||||||
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
|
||||||
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
|
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
|
||||||
|
assert(act1State);
|
||||||
|
act1State->m_unk0x018 = 0;
|
||||||
SpawnPlayer(
|
SpawnPlayer(
|
||||||
LegoGameState::e_unk41,
|
LegoGameState::e_unk41,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -362,13 +374,13 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_state->SetUnknown8(0);
|
m_state->m_unk0x08 = 0;
|
||||||
ret = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10003e90
|
// FUNCTION: LEGO1 0x10003e90
|
||||||
@ -414,7 +426,7 @@ void Helicopter::Animate(float p_time)
|
|||||||
v2 *= f2;
|
v2 *= f2;
|
||||||
v2 += v1;
|
v2 += v1;
|
||||||
|
|
||||||
m_world->GetCamera()->FUN_100123e0(mat, 0);
|
m_world->GetCameraController()->FUN_100123e0(mat, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_state->m_unk0x08 == 4) {
|
if (m_state->m_unk0x08 == 4) {
|
||||||
@ -424,7 +436,7 @@ void Helicopter::Animate(float p_time)
|
|||||||
((Act3*) m_world)->FUN_10073430();
|
((Act3*) m_world)->FUN_10073430();
|
||||||
}
|
}
|
||||||
|
|
||||||
LegoPathActor::m_actorState = c_disabled;
|
SetActorState(c_disabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -445,7 +457,7 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix)
|
|||||||
Vector3 vec5(m_unk0x1a8[2]); // EDI
|
Vector3 vec5(m_unk0x1a8[2]); // EDI
|
||||||
Vector3 vec6(m_unk0x1a8[3]); // locala0 // esp+0x28
|
Vector3 vec6(m_unk0x1a8[3]); // locala0 // esp+0x28
|
||||||
|
|
||||||
m_world->GetCamera()->FUN_100123b0(local48);
|
m_world->GetCameraController()->FUN_100123b0(local48);
|
||||||
m_unk0x1a8.SetIdentity();
|
m_unk0x1a8.SetIdentity();
|
||||||
local90 = p_matrix;
|
local90 = p_matrix;
|
||||||
|
|
||||||
|
|||||||
@ -8,88 +8,88 @@ DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58)
|
|||||||
|
|
||||||
// GLOBAL: LEGO1 0x100da3b0
|
// GLOBAL: LEGO1 0x100da3b0
|
||||||
LegoActorLOD g_actorLODs[] = {
|
LegoActorLOD g_actorLODs[] = {
|
||||||
{"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617,
|
{"top", "top", 0, 0.000267f, 0.780808f, -0.01906f, 0.951612f, -0.461166f, -0.002794f, -0.299442f, 0.4617f,
|
||||||
1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0},
|
1.56441f, 0.261321f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f},
|
||||||
{"body", "body", LegoActorLOD::c_flag1,
|
{"body", "body", LegoActorLOD::c_flag1,
|
||||||
0.00158332, 0.401828, -0.00048697,
|
0.00158332f, 0.401828f, -0.00048697f,
|
||||||
0.408071, -0.287507, 0.150419,
|
0.408071f, -0.287507f, 0.150419f,
|
||||||
-0.147452, 0.289219, 0.649774,
|
-0.147452f, 0.289219f, 0.649774f,
|
||||||
0.14258, -0.00089, 0.436353,
|
0.14258f, -0.00089f, 0.436353f,
|
||||||
0.007277, 0, 0,
|
0.007277f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0},
|
0.0f},
|
||||||
{"infohat", "infohat", LegoActorLOD::c_flag2,
|
{"infohat", "infohat", LegoActorLOD::c_flag2,
|
||||||
0, -0.00938, -0.01955,
|
0.0f, -0.00938f, -0.01955f,
|
||||||
0.35, -0.231822, -0.140237,
|
0.35f, -0.231822f, -0.140237f,
|
||||||
-0.320954, 0.234149, 0.076968,
|
-0.320954f, 0.234149f, 0.076968f,
|
||||||
0.249083, 0.000191, 1.519793,
|
0.249083f, 0.000191f, 1.519793f,
|
||||||
0.001767, 0, 0,
|
0.001767f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0},
|
0.0f},
|
||||||
{"infogron", "infogron", LegoActorLOD::c_flag2,
|
{"infogron", "infogron", LegoActorLOD::c_flag2,
|
||||||
0, 0.11477, 0.00042,
|
0.0f, 0.11477f, 0.00042f,
|
||||||
0.26, -0.285558, -0.134391,
|
0.26f, -0.285558f, -0.134391f,
|
||||||
-0.142231, 0.285507, 0.152986,
|
-0.142231f, 0.285507f, 0.152986f,
|
||||||
0.143071, -0.00089, 0.436353,
|
0.143071f, -0.00089f, 0.436353f,
|
||||||
0.007277, 0, 0,
|
0.007277f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0},
|
0.0f},
|
||||||
{"head", "head", LegoActorLOD::c_flag1,
|
{"head", "head", LegoActorLOD::c_flag1,
|
||||||
0, -0.03006, 0,
|
0.0f, -0.03006f, 0.0f,
|
||||||
0.3, -0.189506, -0.209665,
|
0.3f, -0.189506f, -0.209665f,
|
||||||
-0.189824, 0.189532, 0.228822,
|
-0.189824f, 0.189532f, 0.228822f,
|
||||||
0.194945, -0.00105, 1.293115,
|
0.194945f, -0.00105f, 1.293115f,
|
||||||
0.001781, 0, 0,
|
0.001781f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0},
|
0.0f},
|
||||||
{"arm-lft", "arm-lft", LegoActorLOD::c_flag2,
|
{"arm-lft", "arm-lft", LegoActorLOD::c_flag2,
|
||||||
-0.06815, -0.0973747, 0.0154655,
|
-0.06815f, -0.0973747f, 0.0154655f,
|
||||||
0.237, -0.137931, -0.282775,
|
0.237f, -0.137931f, -0.282775f,
|
||||||
-0.105316, 0.000989, 0.100221,
|
-0.105316f, 0.000989f, 0.100221f,
|
||||||
0.140759, -0.225678, 0.963312,
|
0.140759f, -0.225678f, 0.963312f,
|
||||||
0.023286, -0.003031, -0.017187,
|
0.023286f, -0.003031f, -0.017187f,
|
||||||
0.999848, 0.173622, 0.984658,
|
0.999848f, 0.173622f, 0.984658f,
|
||||||
0.017453},
|
0.017453f},
|
||||||
{"arm-rt", "arm-rt", LegoActorLOD::c_flag2,
|
{"arm-rt", "arm-rt", LegoActorLOD::c_flag2,
|
||||||
0.0680946, -0.097152, 0.0152722,
|
0.0680946f, -0.097152f, 0.0152722f,
|
||||||
0.237, 0.00141, -0.289604,
|
0.237f, 0.00141f, -0.289604f,
|
||||||
-0.100831, 0.138786, 0.09291,
|
-0.100831f, 0.138786f, 0.09291f,
|
||||||
0.145437, 0.223494, 0.963583,
|
0.145437f, 0.223494f, 0.963583f,
|
||||||
0.018302, 0, 0,
|
0.018302f, 0.0f, 0.0f,
|
||||||
1, -0.173648, 0.984808,
|
1.0f, -0.173648f, 0.984808f,
|
||||||
0},
|
0.0f},
|
||||||
{"claw-lft", "claw-lft", LegoActorLOD::c_flag2,
|
{"claw-lft", "claw-lft", LegoActorLOD::c_flag2,
|
||||||
0.000773381, -0.101422, -0.0237761,
|
0.000773381f, -0.101422f, -0.0237761f,
|
||||||
0.15, -0.089838, -0.246208,
|
0.15f, -0.089838f, -0.246208f,
|
||||||
-0.117735, 0.091275, 0.000263,
|
-0.117735f, 0.091275f, 0.000263f,
|
||||||
0.07215, -0.341869, 0.700355,
|
0.07215f, -0.341869f, 0.700355f,
|
||||||
0.092779, 0.000001, 0.000003,
|
0.092779f, 0.000001f, 0.000003f,
|
||||||
1, 0.190812, 0.981627,
|
1.0f, 0.190812f, 0.981627f,
|
||||||
-0.000003},
|
-0.000003f},
|
||||||
{"claw-rt", "claw-lft", LegoActorLOD::c_flag2,
|
{"claw-rt", "claw-lft", LegoActorLOD::c_flag2,
|
||||||
0.000773381, -0.101422, -0.0237761,
|
0.000773381f, -0.101422f, -0.0237761f,
|
||||||
0.15, -0.095016, -0.245349,
|
0.15f, -0.095016f, -0.245349f,
|
||||||
-0.117979, 0.086528, 0.00067,
|
-0.117979f, 0.086528f, 0.00067f,
|
||||||
0.069743, 0.343317, 0.69924,
|
0.069743f, 0.343317f, 0.69924f,
|
||||||
0.096123, 0.00606, -0.034369,
|
0.096123f, 0.00606f, -0.034369f,
|
||||||
0.999391, -0.190704, 0.981027,
|
0.999391f, -0.190704f, 0.981027f,
|
||||||
0.034894},
|
0.034894f},
|
||||||
{"leg-lft", "leg", LegoActorLOD::c_flag2,
|
{"leg-lft", "leg", LegoActorLOD::c_flag2,
|
||||||
0.00433584, -0.177404, -0.0313928,
|
0.00433584f, -0.177404f, -0.0313928f,
|
||||||
0.33, -0.129782, -0.440428,
|
0.33f, -0.129782f, -0.440428f,
|
||||||
-0.184207, 0.13817, 0.118415,
|
-0.184207f, 0.13817f, 0.118415f,
|
||||||
0.122607, -0.156339, 0.436087,
|
0.122607f, -0.156339f, 0.436087f,
|
||||||
0.006822, 0, 0,
|
0.006822f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0},
|
0.0f},
|
||||||
{"leg-rt", "leg", LegoActorLOD::c_flag2,
|
{"leg-rt", "leg", LegoActorLOD::c_flag2,
|
||||||
0.00433584, -0.177404, -0.0313928,
|
0.00433584f, -0.177404f, -0.0313928f,
|
||||||
0.33, -0.132864, -0.437138,
|
0.33f, -0.132864f, -0.437138f,
|
||||||
-0.183944, 0.134614, 0.12043,
|
-0.183944f, 0.134614f, 0.12043f,
|
||||||
0.121888, 0.151154, 0.436296,
|
0.121888f, 0.151154f, 0.436296f,
|
||||||
0.007373, 0, 0,
|
0.007373f, 0.0f, 0.0f,
|
||||||
1, 0, 1,
|
1.0f, 0.0f, 1.0f,
|
||||||
0}
|
0.0f}
|
||||||
};
|
};
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100da778
|
// GLOBAL: LEGO1 0x100da778
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -386,7 +386,7 @@ void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender
|
|||||||
// FUNCTION: LEGO1 0x1003eab0
|
// FUNCTION: LEGO1 0x1003eab0
|
||||||
void SetCameraControllerFromIsle()
|
void SetCameraControllerFromIsle()
|
||||||
{
|
{
|
||||||
InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCamera());
|
InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCameraController());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1003eae0
|
// FUNCTION: LEGO1 0x1003eae0
|
||||||
|
|||||||
@ -56,7 +56,8 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
|||||||
// FUNCTION: LEGO1 0x1004bac0
|
// FUNCTION: LEGO1 0x1004bac0
|
||||||
MxResult MxTransitionManager::Tickle()
|
MxResult MxTransitionManager::Tickle()
|
||||||
{
|
{
|
||||||
if (m_animationSpeed + m_systemTime > SDL_GetTicks()) {
|
Uint64 time = m_animationSpeed + m_systemTime;
|
||||||
|
if (time > SDL_GetTicks()) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,21 +44,21 @@ void LegoEntity::ResetWorldTransform(MxBool p_cameraFlag)
|
|||||||
{
|
{
|
||||||
LegoWorld* world = CurrentWorld();
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
if (world != NULL && world->GetCamera() != NULL) {
|
if (world != NULL && world->GetCameraController() != NULL) {
|
||||||
m_cameraFlag = p_cameraFlag;
|
m_cameraFlag = p_cameraFlag;
|
||||||
|
|
||||||
if (m_cameraFlag) {
|
if (m_cameraFlag) {
|
||||||
world->GetCamera()->SetEntity(this);
|
world->GetCameraController()->SetEntity(this);
|
||||||
world->GetCamera()->SetWorldTransform(
|
world->GetCameraController()->SetWorldTransform(
|
||||||
Mx3DPointFloat(0.0F, 1.25F, 0.0F),
|
Mx3DPointFloat(0.0F, 1.25F, 0.0F),
|
||||||
Mx3DPointFloat(0.0F, 0.0F, 1.0F),
|
Mx3DPointFloat(0.0F, 0.0F, 1.0F),
|
||||||
Mx3DPointFloat(0.0F, 1.0F, 0.0F)
|
Mx3DPointFloat(0.0F, 1.0F, 0.0F)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (world->GetCamera()->GetEntity() == this) {
|
if (world->GetCameraController()->GetEntity() == this) {
|
||||||
world->GetCamera()->SetEntity(NULL);
|
world->GetCameraController()->SetEntity(NULL);
|
||||||
world->GetCamera()->SetWorldTransform(
|
world->GetCameraController()->SetWorldTransform(
|
||||||
Mx3DPointFloat(0.0F, 0.0F, 0.0F),
|
Mx3DPointFloat(0.0F, 0.0F, 0.0F),
|
||||||
Mx3DPointFloat(0.0F, 0.0F, 1.0F),
|
Mx3DPointFloat(0.0F, 0.0F, 1.0F),
|
||||||
Mx3DPointFloat(0.0F, 1.0F, 0.0F)
|
Mx3DPointFloat(0.0F, 1.0F, 0.0F)
|
||||||
@ -74,10 +74,10 @@ void LegoEntity::SetWorldTransform(const Vector3& p_location, const Vector3& p_d
|
|||||||
{
|
{
|
||||||
LegoWorld* world = CurrentWorld();
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
if (world != NULL && world->GetCamera() != NULL) {
|
if (world != NULL && world->GetCameraController() != NULL) {
|
||||||
m_cameraFlag = TRUE;
|
m_cameraFlag = TRUE;
|
||||||
world->GetCamera()->SetEntity(this);
|
world->GetCameraController()->SetEntity(this);
|
||||||
world->GetCamera()->SetWorldTransform(p_location, p_direction, p_up);
|
world->GetCameraController()->SetWorldTransform(p_location, p_direction, p_up);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,8 +195,8 @@ void LegoEntity::FUN_10010c30()
|
|||||||
{
|
{
|
||||||
LegoWorld* world = CurrentWorld();
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
if (m_cameraFlag && world && world->GetCamera() && m_roi) {
|
if (m_cameraFlag && world && world->GetCameraController() && m_roi) {
|
||||||
world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1);
|
world->GetCameraController()->FUN_100123e0(m_roi->GetLocal2World(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -541,8 +541,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und)
|
|||||||
if (povPosition >= 0) {
|
if (povPosition >= 0) {
|
||||||
LegoWorld* world = CurrentWorld();
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
if (world && world->GetCamera()) {
|
if (world && world->GetCameraController()) {
|
||||||
world->GetCamera()->FUN_10012320(DTOR(povPosition));
|
world->GetCameraController()->FUN_10012320(DTOR(povPosition));
|
||||||
p_und = TRUE;
|
p_und = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,6 +183,7 @@ void LegoAnimActor::ClearMaps()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1001c870
|
// FUNCTION: LEGO1 0x1001c870
|
||||||
|
// FUNCTION: BETA10 0x1003e7e4
|
||||||
void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed)
|
void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed)
|
||||||
{
|
{
|
||||||
if (p_worldSpeed < 0) {
|
if (p_worldSpeed < 0) {
|
||||||
|
|||||||
@ -414,7 +414,7 @@ void LegoPathActor::Animate(float p_time)
|
|||||||
LegoWorld* world = CurrentWorld();
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
if (world) {
|
if (world) {
|
||||||
world->GetCamera()->FUN_10012290(DTOR(m_unk0x14c));
|
world->GetCameraController()->FUN_10012290(DTOR(m_unk0x14c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,8 +343,8 @@ void LegoRaceCar::FUN_10012ff0(float p_param)
|
|||||||
// Possible bug in the original code: The first argument is not initialized
|
// Possible bug in the original code: The first argument is not initialized
|
||||||
a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix);
|
a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix);
|
||||||
|
|
||||||
if (r->GetCamera()) {
|
if (r->GetCameraController()) {
|
||||||
r->GetCamera()->FUN_100123e0(transformationMatrix, 0);
|
r->GetCameraController()->FUN_100123e0(transformationMatrix, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_roi->FUN_100a58f0(transformationMatrix);
|
m_roi->FUN_100a58f0(transformationMatrix);
|
||||||
|
|||||||
@ -637,7 +637,7 @@ void LegoAnimPresenter::PutFrame()
|
|||||||
|
|
||||||
FUN_1006b9a0(m_anim, time, m_unk0x78);
|
FUN_1006b9a0(m_anim, time, m_unk0x78);
|
||||||
|
|
||||||
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
|
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) {
|
||||||
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
||||||
if (m_unk0x8c[i] != NULL) {
|
if (m_unk0x8c[i] != NULL) {
|
||||||
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
|
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
|
||||||
@ -653,7 +653,7 @@ void LegoAnimPresenter::PutFrame()
|
|||||||
|
|
||||||
up = und;
|
up = und;
|
||||||
|
|
||||||
up -= m_currentWorld->GetCamera()->GetWorldLocation();
|
up -= m_currentWorld->GetCameraController()->GetWorldLocation();
|
||||||
dir /= dirsqr;
|
dir /= dirsqr;
|
||||||
pos.EqualsCross(dir, up);
|
pos.EqualsCross(dir, up);
|
||||||
pos.Unitize();
|
pos.Unitize();
|
||||||
@ -719,7 +719,7 @@ MxResult LegoAnimPresenter::FUN_1006b140(LegoROI* p_roi)
|
|||||||
|
|
||||||
for (i = 1; i <= m_roiMapSize; i++) {
|
for (i = 1; i <= m_roiMapSize; i++) {
|
||||||
if (m_roiMap[i] == p_roi) {
|
if (m_roiMap[i] == p_roi) {
|
||||||
if (local5c[i].Unknown(local58) != SUCCESS) {
|
if (local5c[i].BETA_1005a590(local58) != SUCCESS) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,8 +933,8 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
|
|||||||
MxMatrix transform(mat);
|
MxMatrix transform(mat);
|
||||||
p_anim->GetCamAnim()->FUN_1009f490(p_time, transform);
|
p_anim->GetCamAnim()->FUN_1009f490(p_time, transform);
|
||||||
|
|
||||||
if (m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
|
if (m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) {
|
||||||
m_currentWorld->GetCamera()->FUN_100123e0(transform, 0);
|
m_currentWorld->GetCameraController()->FUN_100123e0(transform, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void LegoLoopingAnimPresenter::PutFrame()
|
|||||||
|
|
||||||
FUN_1006b9a0(m_anim, time, m_unk0x78);
|
FUN_1006b9a0(m_anim, time, m_unk0x78);
|
||||||
|
|
||||||
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) {
|
if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) {
|
||||||
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
||||||
if (m_unk0x8c[i] != NULL) {
|
if (m_unk0x8c[i] != NULL) {
|
||||||
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
|
MxMatrix mat(m_unk0x8c[i]->GetLocal2World());
|
||||||
@ -66,7 +66,7 @@ void LegoLoopingAnimPresenter::PutFrame()
|
|||||||
|
|
||||||
up = und;
|
up = und;
|
||||||
|
|
||||||
up -= m_currentWorld->GetCamera()->GetWorldLocation();
|
up -= m_currentWorld->GetCameraController()->GetWorldLocation();
|
||||||
dir /= dirsqr;
|
dir /= dirsqr;
|
||||||
pos.EqualsCross(dir, up);
|
pos.EqualsCross(dir, up);
|
||||||
pos.Unitize();
|
pos.Unitize();
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class LegoFile : public LegoStorage {
|
|||||||
const char* data = p_str.GetData();
|
const char* data = p_str.GetData();
|
||||||
LegoU32 fullLength = strlen(data);
|
LegoU32 fullLength = strlen(data);
|
||||||
|
|
||||||
LegoU16 limitedLength = fullLength;
|
LegoU16 limitedLength = (LegoU16) fullLength;
|
||||||
Write(&limitedLength, sizeof(limitedLength));
|
Write(&limitedLength, sizeof(limitedLength));
|
||||||
Write((char*) data, (LegoS16) fullLength);
|
Write((char*) data, (LegoS16) fullLength);
|
||||||
|
|
||||||
|
|||||||
@ -675,6 +675,9 @@
|
|||||||
// LIBRARY: BETA10 0x100f9a50
|
// LIBRARY: BETA10 0x100f9a50
|
||||||
// _sin
|
// _sin
|
||||||
|
|
||||||
|
// LIBRARY: BETA10 0x100f9a5a
|
||||||
|
// _cos
|
||||||
|
|
||||||
// LIBRARY: BETA10 0x100f95d0
|
// LIBRARY: BETA10 0x100f95d0
|
||||||
// _sqrt
|
// _sqrt
|
||||||
|
|
||||||
|
|||||||
@ -164,9 +164,8 @@ inline int UnknownMx4DPointFloat::BETA_1004aaa0(Matrix4& p_matrix, float p_f)
|
|||||||
if (FUN_100040a0(v, p_f) == 0) {
|
if (FUN_100040a0(v, p_f) == 0) {
|
||||||
return p_matrix.FromQuaternion(v);
|
return p_matrix.FromQuaternion(v);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10004520
|
// FUNCTION: LEGO1 0x10004520
|
||||||
@ -198,15 +197,17 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
|
|||||||
{
|
{
|
||||||
if (m_unk0x30 == c_bit1) {
|
if (m_unk0x30 == c_bit1) {
|
||||||
p_v = m_unk0x00;
|
p_v = m_unk0x00;
|
||||||
p_v[3] = (1.0 - p_f) * acos((double) p_v[3]) * 2.0;
|
p_v[3] = (float) ((1.0 - p_f) * acos((double) p_v[3]) * 2.0);
|
||||||
return p_v.NormalizeQuaternion();
|
return p_v.NormalizeQuaternion();
|
||||||
}
|
}
|
||||||
else if (m_unk0x30 == c_bit2) {
|
|
||||||
|
if (m_unk0x30 == c_bit2) {
|
||||||
p_v = m_unk0x18;
|
p_v = m_unk0x18;
|
||||||
p_v[3] = p_f * acos((double) p_v[3]) * 2.0;
|
p_v[3] = (float) (p_f * acos((double) p_v[3]) * 2.0);
|
||||||
return p_v.NormalizeQuaternion();
|
return p_v.NormalizeQuaternion();
|
||||||
}
|
}
|
||||||
else if (m_unk0x30 == (c_bit1 | c_bit2)) {
|
|
||||||
|
if (m_unk0x30 == (c_bit1 | c_bit2)) {
|
||||||
int i;
|
int i;
|
||||||
double d1 = p_v.Dot(m_unk0x00, m_unk0x18);
|
double d1 = p_v.Dot(m_unk0x00, m_unk0x18);
|
||||||
double a;
|
double a;
|
||||||
@ -225,7 +226,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
p_v[i] = m_unk0x00[i] * a + m_unk0x18[i] * b;
|
p_v[i] = (float) (m_unk0x00[i] * a + m_unk0x18[i] * b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -237,15 +238,14 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f)
|
|||||||
b = sin(p_f * 1.570796326794895);
|
b = sin(p_f * 1.570796326794895);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
p_v[i] = m_unk0x00[i] * a + p_v[i] * b;
|
p_v[i] = (float) (m_unk0x00[i] * a + p_v[i] * b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MXGEOMETRY3D_H
|
#endif // MXGEOMETRY3D_H
|
||||||
|
|||||||
@ -179,7 +179,7 @@ class Matrix4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int Unknown(Matrix4& p_mat);
|
inline int BETA_1005a590(Matrix4& p_mat);
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1006b500
|
// FUNCTION: LEGO1 0x1006b500
|
||||||
void Swap(int p_d1, int p_d2)
|
void Swap(int p_d1, int p_d2)
|
||||||
@ -202,9 +202,11 @@ class Matrix4 {
|
|||||||
// FUNCTION: BETA10 0x100101c0
|
// FUNCTION: BETA10 0x100101c0
|
||||||
inline void Matrix4::ToQuaternion(Vector4& p_outQuat)
|
inline void Matrix4::ToQuaternion(Vector4& p_outQuat)
|
||||||
{
|
{
|
||||||
float trace = m_data[0][0] + m_data[1][1] + m_data[2][2];
|
float trace;
|
||||||
if (trace > 0) {
|
float localc = m_data[0][0] + m_data[1][1] + m_data[2][2];
|
||||||
trace = sqrt(trace + 1.0);
|
|
||||||
|
if (localc > 0) {
|
||||||
|
trace = (float) sqrt(localc + 1.0);
|
||||||
p_outQuat[3] = trace * 0.5f;
|
p_outQuat[3] = trace * 0.5f;
|
||||||
trace = 0.5f / trace;
|
trace = 0.5f / trace;
|
||||||
p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace;
|
p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace;
|
||||||
@ -212,7 +214,6 @@ inline void Matrix4::ToQuaternion(Vector4& p_outQuat)
|
|||||||
p_outQuat[2] = (m_data[1][0] - m_data[0][1]) * trace;
|
p_outQuat[2] = (m_data[1][0] - m_data[0][1]) * trace;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100d4090
|
// GLOBAL: LEGO1 0x100d4090
|
||||||
static int rotateIndex[] = {1, 2, 0};
|
static int rotateIndex[] = {1, 2, 0};
|
||||||
|
|
||||||
@ -228,7 +229,7 @@ inline void Matrix4::ToQuaternion(Vector4& p_outQuat)
|
|||||||
int next = rotateIndex[largest];
|
int next = rotateIndex[largest];
|
||||||
int nextNext = rotateIndex[next];
|
int nextNext = rotateIndex[next];
|
||||||
|
|
||||||
float trace = sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0);
|
trace = (float) sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0);
|
||||||
|
|
||||||
p_outQuat[largest] = trace * 0.5f;
|
p_outQuat[largest] = trace * 0.5f;
|
||||||
trace = 0.5f / trace;
|
trace = 0.5f / trace;
|
||||||
@ -243,55 +244,56 @@ inline void Matrix4::ToQuaternion(Vector4& p_outQuat)
|
|||||||
// FUNCTION: BETA10 0x10010550
|
// FUNCTION: BETA10 0x10010550
|
||||||
inline int Matrix4::FromQuaternion(const Vector4& p_vec)
|
inline int Matrix4::FromQuaternion(const Vector4& p_vec)
|
||||||
{
|
{
|
||||||
float len = p_vec.LenSquared();
|
float local14 = p_vec.LenSquared();
|
||||||
|
|
||||||
if (len > 0.0f) {
|
if (local14 > 0.0f) {
|
||||||
float v7 = 2.0f / len;
|
local14 = 2.0f / local14;
|
||||||
|
|
||||||
float v9 = p_vec[0] * v7;
|
float local24 = p_vec[0] * local14;
|
||||||
float v11 = p_vec[1] * v7;
|
float local34 = p_vec[1] * local14;
|
||||||
float v12 = p_vec[2] * v7;
|
float local10 = p_vec[2] * local14;
|
||||||
|
|
||||||
float v13 = p_vec[3] * v9;
|
float local28 = p_vec[3] * local24;
|
||||||
float v14 = p_vec[3] * v11;
|
float local2c = p_vec[3] * local34;
|
||||||
float v16 = p_vec[3] * v12;
|
float local30 = p_vec[3] * local10;
|
||||||
|
|
||||||
float v17 = p_vec[0] * v9;
|
float local38 = p_vec[0] * local24;
|
||||||
float v22 = p_vec[0] * v11;
|
float local8 = p_vec[0] * local34;
|
||||||
float v23 = p_vec[0] * v12;
|
float localc = p_vec[0] * local10;
|
||||||
|
|
||||||
float v18 = p_vec[1] * v11;
|
float local18 = p_vec[1] * local34;
|
||||||
float v24 = p_vec[1] * v12;
|
float local1c = p_vec[1] * local10;
|
||||||
float v19 = p_vec[2] * v12;
|
float local20 = p_vec[2] * local10;
|
||||||
|
|
||||||
m_data[0][0] = 1.0f - (v18 + v19);
|
m_data[0][0] = 1.0f - (local18 + local20);
|
||||||
m_data[1][0] = v22 + v16;
|
m_data[1][0] = local8 + local30;
|
||||||
m_data[2][0] = v23 - v14;
|
m_data[2][0] = localc - local2c;
|
||||||
|
|
||||||
m_data[0][1] = v22 - v16;
|
m_data[0][1] = local8 - local30;
|
||||||
m_data[1][1] = 1.0f - (v17 + v19);
|
m_data[1][1] = 1.0f - (local38 + local20);
|
||||||
m_data[2][1] = v24 + v13;
|
m_data[2][1] = local1c + local28;
|
||||||
|
|
||||||
m_data[0][2] = v14 + v23;
|
m_data[0][2] = local2c + localc;
|
||||||
m_data[1][2] = v24 - v13;
|
m_data[1][2] = local1c - local28;
|
||||||
m_data[2][2] = 1.0f - (v18 + v17);
|
m_data[2][2] = 1.0f - (local18 + local38);
|
||||||
|
|
||||||
m_data[3][0] = 0;
|
m_data[3][0] = 0.0f;
|
||||||
m_data[3][1] = 0;
|
m_data[3][1] = 0.0f;
|
||||||
m_data[3][2] = 0;
|
m_data[3][2] = 0.0f;
|
||||||
m_data[3][3] = 1.0f;
|
m_data[3][3] = 1.0f;
|
||||||
|
|
||||||
m_data[0][3] = 0;
|
m_data[0][3] = 0.0f;
|
||||||
m_data[1][3] = 0;
|
m_data[1][3] = 0.0f;
|
||||||
m_data[2][3] = 0;
|
m_data[2][3] = 0.0f;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x1005a590
|
// FUNCTION: BETA10 0x1005a590
|
||||||
inline int Matrix4::Unknown(Matrix4& p_mat)
|
inline int Matrix4::BETA_1005a590(Matrix4& p_mat)
|
||||||
{
|
{
|
||||||
float local5c[4][4];
|
float local5c[4][4];
|
||||||
Matrix4 localc(local5c);
|
Matrix4 localc(local5c);
|
||||||
|
|||||||
@ -121,35 +121,33 @@ class Vector2 {
|
|||||||
return -1;
|
return -1;
|
||||||
} // vtable+0x44
|
} // vtable+0x44
|
||||||
|
|
||||||
private:
|
|
||||||
// FUNCTION: LEGO1 0x100021c0
|
// FUNCTION: LEGO1 0x100021c0
|
||||||
virtual void Add(float p_value) { AddImpl(p_value); } // vtable+0x50
|
virtual void operator+=(float p_value) { AddImpl(p_value); } // vtable+0x50
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100021d0
|
// FUNCTION: LEGO1 0x100021d0
|
||||||
virtual void Add(const float* p_other) { AddImpl(p_other); } // vtable+0x4c
|
virtual void operator+=(const float* p_other) { AddImpl(p_other); } // vtable+0x4c
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100021e0
|
// FUNCTION: LEGO1 0x100021e0
|
||||||
virtual void Add(const Vector2& p_other) { AddImpl(p_other.m_data); } // vtable+0x48
|
virtual void operator+=(const Vector2& p_other) { AddImpl(p_other.m_data); } // vtable+0x48
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100021f0
|
// FUNCTION: LEGO1 0x100021f0
|
||||||
virtual void Sub(const float* p_other) { SubImpl(p_other); } // vtable+0x58
|
virtual void operator-=(const float* p_other) { SubImpl(p_other); } // vtable+0x58
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002200
|
// FUNCTION: LEGO1 0x10002200
|
||||||
virtual void Sub(const Vector2& p_other) { SubImpl(p_other.m_data); } // vtable+0x54
|
virtual void operator-=(const Vector2& p_other) { SubImpl(p_other.m_data); } // vtable+0x54
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002210
|
// FUNCTION: LEGO1 0x10002210
|
||||||
virtual void Mul(const float* p_other) { MulImpl(p_other); } // vtable+0x64
|
virtual void operator*=(const float* p_other) { MulImpl(p_other); } // vtable+0x64
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002220
|
// FUNCTION: LEGO1 0x10002220
|
||||||
virtual void Mul(const Vector2& p_other) { MulImpl(p_other.m_data); } // vtable+0x60
|
virtual void operator*=(const Vector2& p_other) { MulImpl(p_other.m_data); } // vtable+0x60
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002230
|
// FUNCTION: LEGO1 0x10002230
|
||||||
virtual void Mul(const float& p_value) { MulImpl(p_value); } // vtable+0x5c
|
virtual void operator*=(const float& p_value) { MulImpl(p_value); } // vtable+0x5c
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002240
|
// FUNCTION: LEGO1 0x10002240
|
||||||
virtual void Div(const float& p_value) { DivImpl(p_value); } // vtable+0x68
|
virtual void operator/=(const float& p_value) { DivImpl(p_value); } // vtable+0x68
|
||||||
|
|
||||||
public:
|
|
||||||
// FUNCTION: LEGO1 0x10002250
|
// FUNCTION: LEGO1 0x10002250
|
||||||
virtual void SetVector(const float* p_other) { EqualsImpl(p_other); } // vtable+0x70
|
virtual void SetVector(const float* p_other) { EqualsImpl(p_other); } // vtable+0x70
|
||||||
|
|
||||||
@ -192,19 +190,6 @@ class Vector2 {
|
|||||||
// FUNCTION: BETA10 0x1001d170
|
// FUNCTION: BETA10 0x1001d170
|
||||||
const float& operator[](int idx) const { return m_data[idx]; }
|
const float& operator[](int idx) const { return m_data[idx]; }
|
||||||
|
|
||||||
void operator+=(float p_value) { Add(p_value); }
|
|
||||||
void operator+=(const float* p_other) { Add(p_other); }
|
|
||||||
void operator+=(const Vector2& p_other) { Add(p_other); }
|
|
||||||
|
|
||||||
void operator-=(const float* p_other) { Sub(p_other); }
|
|
||||||
void operator-=(const Vector2& p_other) { Sub(p_other); }
|
|
||||||
|
|
||||||
void operator*=(const float* p_other) { Mul(p_other); }
|
|
||||||
void operator*=(const Vector2& p_other) { Mul(p_other); }
|
|
||||||
void operator*=(const float& p_value) { Mul(p_value); }
|
|
||||||
|
|
||||||
void operator/=(const float& p_value) { Div(p_value); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float* m_data; // 0x04
|
float* m_data; // 0x04
|
||||||
};
|
};
|
||||||
@ -467,38 +452,36 @@ class Vector4 : public Vector3 {
|
|||||||
// FUNCTION: BETA10 0x10048ad0
|
// FUNCTION: BETA10 0x10048ad0
|
||||||
inline int Vector4::NormalizeQuaternion()
|
inline int Vector4::NormalizeQuaternion()
|
||||||
{
|
{
|
||||||
float* v = m_data;
|
float length = m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2];
|
||||||
float magnitude = v[0] * v[0] + v[2] * v[2] + v[1] * v[1];
|
|
||||||
if (magnitude > 0.0f) {
|
if (length > 0.0f) {
|
||||||
float theta = v[3] * 0.5f;
|
float theta = m_data[3] * 0.5f;
|
||||||
v[3] = cos(theta);
|
float magnitude = sin((double) theta);
|
||||||
magnitude = sin(theta) / sqrt(magnitude);
|
m_data[3] = cos((double) theta);
|
||||||
Vector3::MulImpl(magnitude);
|
|
||||||
|
magnitude = magnitude / (float) sqrt((double) length);
|
||||||
|
m_data[0] *= magnitude;
|
||||||
|
m_data[1] *= magnitude;
|
||||||
|
m_data[2] *= magnitude;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static float QuaternionProductScalarPart(const float* bDat, const float* aDat)
|
|
||||||
{
|
|
||||||
// We have no indication from the beta that this function exists,
|
|
||||||
// but it helps with the stack layout of Vector4::EqualsHamiltonProduct()
|
|
||||||
return aDat[3] * bDat[3] - (aDat[0] * bDat[0] + aDat[2] * bDat[2] + aDat[1] * bDat[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10002bf0
|
// FUNCTION: LEGO1 0x10002bf0
|
||||||
// FUNCTION: BETA10 0x10048c20
|
// FUNCTION: BETA10 0x10048c20
|
||||||
inline int Vector4::EqualsHamiltonProduct(const Vector4& p_a, const Vector4& p_b)
|
inline int Vector4::EqualsHamiltonProduct(const Vector4& p_a, const Vector4& p_b)
|
||||||
{
|
{
|
||||||
m_data[3] = QuaternionProductScalarPart(p_a.m_data, p_b.m_data);
|
m_data[3] = p_a.m_data[3] * p_b.m_data[3] -
|
||||||
|
(p_a.m_data[0] * p_b.m_data[0] + p_a.m_data[2] * p_b.m_data[2] + p_a.m_data[1] * p_b.m_data[1]);
|
||||||
|
|
||||||
Vector3::EqualsCrossImpl(p_a.m_data, p_b.m_data);
|
Vector3::EqualsCrossImpl(p_a.m_data, p_b.m_data);
|
||||||
|
|
||||||
m_data[0] = p_b.m_data[3] * p_a.m_data[0] + p_a.m_data[3] * p_b.m_data[0] + m_data[0];
|
m_data[0] = p_b.m_data[3] * p_a.m_data[0] + p_a.m_data[3] * p_b.m_data[0] + m_data[0];
|
||||||
m_data[1] = p_b.m_data[1] * p_a.m_data[3] + p_a.m_data[1] * p_b.m_data[3] + m_data[1];
|
m_data[1] = p_b.m_data[1] * p_a.m_data[3] + p_a.m_data[1] * p_b.m_data[3] + m_data[1];
|
||||||
m_data[2] = p_b.m_data[2] * p_a.m_data[3] + p_a.m_data[2] * p_b.m_data[3] + m_data[2];
|
m_data[2] = p_b.m_data[2] * p_a.m_data[3] + p_a.m_data[2] * p_b.m_data[3] + m_data[2];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,15 +10,15 @@ namespace Tgl
|
|||||||
|
|
||||||
namespace Constant
|
namespace Constant
|
||||||
{
|
{
|
||||||
const float Pi = 3.14159265358979323846;
|
const double Pi = 3.14159265358979323846;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float DegreesToRadians(float degrees)
|
inline double DegreesToRadians(double degrees)
|
||||||
{
|
{
|
||||||
return Constant::Pi * (degrees / 180.0);
|
return Constant::Pi * (degrees / 180.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float RadiansToDegrees(float radians)
|
inline double RadiansToDegrees(double radians)
|
||||||
{
|
{
|
||||||
return (radians / Constant::Pi) * 180.0;
|
return (radians / Constant::Pi) * 180.0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user