diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 2f64238de3..8d887d7369 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -38,14 +38,9 @@ class HelicopterState : public LegoState { return TRUE; } // vtable+0x18 - void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } - MxU32 GetUnkown8() { return m_unk0x08; } - // SYNTHETIC: LEGO1 0x1000e190 // HelicopterState::`scalar deleting destructor' - // TODO: Most likely getters/setters are not used according to BETA. - MxU32 m_unk0x08; // 0x08 }; diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 52ef3baf3d..9845e451d7 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -102,7 +102,7 @@ class LegoWorld : public LegoEntity { MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); // FUNCTION: BETA10 0x1002b4f0 - LegoCameraController* GetCamera() { return m_cameraController; } + LegoCameraController* GetCameraController() { return m_cameraController; } LegoEntityList* GetEntityList() { return m_entityList; } LegoOmni::World GetWorldId() { return m_worldId; } diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 059145ae1c..ab46617607 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -94,7 +94,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_HelicopterArms_Ctl); RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_TakeOff_Ctl); @@ -238,11 +238,11 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) assert(m_pathController); - if (m_world && m_world->GetCamera()) { + if (m_world && m_world->GetCameraController()) { Mx3DPointFloat location, direction, lookat; - location = m_world->GetCamera()->GetWorldLocation(); - direction = m_world->GetCamera()->GetWorldDirection(); + location = m_world->GetCameraController()->GetWorldLocation(); + direction = m_world->GetCameraController()->GetWorldDirection(); lookat = direction; lookat *= 3.0f; @@ -250,7 +250,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) Mx3DPointFloat v68, va4, up; Mx3DPointFloat v90(0, 1, 0); - v68 = m_world->GetCamera()->GetWorldUp(); + v68 = m_world->GetCameraController()->GetWorldUp(); va4.EqualsCross(v68, direction); up.EqualsCross(va4, v90); @@ -295,14 +295,17 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) } // FUNCTION: LEGO1 0x10003c20 +// FUNCTION: BETA10 0x1002ab4c MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { - MxU32 ret = 0; + MxLong result = 0; - switch (m_state->GetUnkown8()) { + switch (m_state->m_unk0x08) { case 1: { 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( LegoGameState::e_unk42, TRUE, @@ -317,25 +320,17 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) ); } - m_state->SetUnknown8(2); + m_state->m_unk0x08 = 2; MxMatrix matrix; matrix.SetIdentity(); - - 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; - } - + matrix.RotateX(0.5235987901687622); // PI / 6, 30 deg 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(); - ret = 1; + result = 1; break; } case 3: { @@ -344,10 +339,14 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]); 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) { - ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + assert(act1state); + act1state->m_unk0x018 = 0; SpawnPlayer( LegoGameState::e_unk41, TRUE, @@ -362,13 +361,13 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) ); } - m_state->SetUnknown8(0); - ret = 1; + m_state->m_unk0x08 = 0; + result = 1; break; } } - return ret; + return result; } // FUNCTION: LEGO1 0x10003e90 @@ -414,7 +413,7 @@ void Helicopter::Animate(float p_time) v2 *= f2; v2 += v1; - m_world->GetCamera()->FUN_100123e0(mat, 0); + m_world->GetCameraController()->FUN_100123e0(mat, 0); } else { if (m_state->m_unk0x08 == 4) { @@ -445,7 +444,7 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix) Vector3 vec5(m_unk0x1a8[2]); // EDI Vector3 vec6(m_unk0x1a8[3]); // locala0 // esp+0x28 - m_world->GetCamera()->FUN_100123b0(local48); + m_world->GetCameraController()->FUN_100123b0(local48); m_unk0x1a8.SetIdentity(); local90 = p_matrix; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 86730b7fbe..48d021b03d 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -381,7 +381,7 @@ void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender // FUNCTION: LEGO1 0x1003eab0 void SetCameraControllerFromIsle() { - InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCamera()); + InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCameraController()); } // FUNCTION: LEGO1 0x1003eae0 diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 731fa70c84..d697907ea2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -42,21 +42,21 @@ void LegoEntity::ResetWorldTransform(MxBool p_cameraFlag) { LegoWorld* world = CurrentWorld(); - if (world != NULL && world->GetCamera() != NULL) { + if (world != NULL && world->GetCameraController() != NULL) { m_cameraFlag = p_cameraFlag; if (m_cameraFlag) { - world->GetCamera()->SetEntity(this); - world->GetCamera()->SetWorldTransform( + world->GetCameraController()->SetEntity(this); + world->GetCameraController()->SetWorldTransform( Mx3DPointFloat(0.0F, 1.25F, 0.0F), Mx3DPointFloat(0.0F, 0.0F, 1.0F), Mx3DPointFloat(0.0F, 1.0F, 0.0F) ); } else { - if (world->GetCamera()->GetEntity() == this) { - world->GetCamera()->SetEntity(NULL); - world->GetCamera()->SetWorldTransform( + if (world->GetCameraController()->GetEntity() == this) { + world->GetCameraController()->SetEntity(NULL); + world->GetCameraController()->SetWorldTransform( Mx3DPointFloat(0.0F, 0.0F, 0.0F), Mx3DPointFloat(0.0F, 0.0F, 1.0F), Mx3DPointFloat(0.0F, 1.0F, 0.0F) @@ -72,10 +72,10 @@ void LegoEntity::SetWorldTransform(const Vector3& p_location, const Vector3& p_d { LegoWorld* world = CurrentWorld(); - if (world != NULL && world->GetCamera() != NULL) { + if (world != NULL && world->GetCameraController() != NULL) { m_cameraFlag = TRUE; - world->GetCamera()->SetEntity(this); - world->GetCamera()->SetWorldTransform(p_location, p_direction, p_up); + world->GetCameraController()->SetEntity(this); + world->GetCameraController()->SetWorldTransform(p_location, p_direction, p_up); } } @@ -193,8 +193,8 @@ void LegoEntity::FUN_10010c30() { LegoWorld* world = CurrentWorld(); - if (m_cameraFlag && world && world->GetCamera() && m_roi) { - world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1); + if (m_cameraFlag && world && world->GetCameraController() && m_roi) { + world->GetCameraController()->FUN_100123e0(m_roi->GetLocal2World(), 1); } } diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index ddf7960d4d..da82d9a7d1 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -542,8 +542,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) if (povPosition >= 0) { LegoWorld* world = CurrentWorld(); - if (world && world->GetCamera()) { - world->GetCamera()->FUN_10012320(DTOR(povPosition)); + if (world && world->GetCameraController()) { + world->GetCameraController()->FUN_10012320(DTOR(povPosition)); p_und = TRUE; } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index b1fbf48534..cc7fa38d53 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -414,7 +414,7 @@ void LegoPathActor::Animate(float p_time) LegoWorld* world = CurrentWorld(); if (world) { - world->GetCamera()->FUN_10012290(DTOR(m_unk0x14c)); + world->GetCameraController()->FUN_10012290(DTOR(m_unk0x14c)); } } } diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 5ebfab2e3e..7e8795cd43 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -340,8 +340,8 @@ void LegoRaceCar::FUN_10012ff0(float p_param) // Possible bug in the original code: The first argument is not initialized a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix); - if (r->GetCamera()) { - r->GetCamera()->FUN_100123e0(transformationMatrix, 0); + if (r->GetCameraController()) { + r->GetCameraController()->FUN_100123e0(transformationMatrix, 0); } m_roi->FUN_100a58f0(transformationMatrix); diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index a7f049add1..9df19e513e 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -634,7 +634,7 @@ void LegoAnimPresenter::PutFrame() 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++) { if (m_unk0x8c[i] != NULL) { MxMatrix mat(m_unk0x8c[i]->GetLocal2World()); @@ -650,7 +650,7 @@ void LegoAnimPresenter::PutFrame() up = und; - up -= m_currentWorld->GetCamera()->GetWorldLocation(); + up -= m_currentWorld->GetCameraController()->GetWorldLocation(); dir /= dirsqr; pos.EqualsCross(dir, up); pos.Unitize(); @@ -930,8 +930,8 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p MxMatrix transform(mat); p_anim->GetCamAnim()->FUN_1009f490(p_time, transform); - if (m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) { - m_currentWorld->GetCamera()->FUN_100123e0(transform, 0); + if (m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) { + m_currentWorld->GetCameraController()->FUN_100123e0(transform, 0); } } diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index 093b849ef1..93b4720d60 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -50,7 +50,7 @@ void LegoLoopingAnimPresenter::PutFrame() 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++) { if (m_unk0x8c[i] != NULL) { MxMatrix mat(m_unk0x8c[i]->GetLocal2World()); @@ -66,7 +66,7 @@ void LegoLoopingAnimPresenter::PutFrame() up = und; - up -= m_currentWorld->GetCamera()->GetWorldLocation(); + up -= m_currentWorld->GetCameraController()->GetWorldLocation(); dir /= dirsqr; pos.EqualsCross(dir, up); pos.Unitize();