mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Match Helicopter::HandleEndAnim
(#1276)
This commit is contained in:

committed by
GitHub

parent
457300ddba
commit
6b3fcafbe1
@@ -38,14 +38,9 @@ public:
|
|||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -102,7 +102,7 @@ public:
|
|||||||
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; }
|
||||||
|
@@ -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_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);
|
||||||
@@ -238,11 +238,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 +250,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 +295,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 +320,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 +339,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 +361,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 +413,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) {
|
||||||
@@ -445,7 +444,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;
|
||||||
|
|
||||||
|
@@ -381,7 +381,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
|
||||||
|
@@ -42,21 +42,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)
|
||||||
@@ -72,10 +72,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,8 +193,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -542,8 +542,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -340,8 +340,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);
|
||||||
|
@@ -634,7 +634,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());
|
||||||
@@ -650,7 +650,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();
|
||||||
@@ -930,8 +930,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();
|
||||||
|
Reference in New Issue
Block a user