diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index d9c582c9..db99ec6a 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -91,8 +91,6 @@ class Act1State : public LegoState { // Act1State::`scalar deleting destructor' friend class Isle; - // I would very much prefer to use getters and setters, but that seems to mess up other code. - // Maybe we need to add the right number of getters and setters? friend class SkateBoard; protected: @@ -108,7 +106,7 @@ class Act1State : public LegoState { MxBool m_unk0x01f; // 0x01f MxBool m_planeActive; // 0x020 undefined m_unk0x021; // 0x021 - undefined m_unk0x022; // 0x022 + MxBool m_unk0x022; // 0x022 undefined m_unk0x023; // 0x023 NamedPlane m_unk0x024; // 0x024 NamedPlane m_unk0x070; // 0x070 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 3c841afb..62aa66eb 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -81,7 +81,7 @@ class LegoAnimationManager : public MxCore { IsleScript::Script p_objectId, MxMatrix* p_matrix, MxBool p_param3, - undefined p_param4, + MxBool p_param4, LegoROI* p_roi, MxBool p_param6, MxBool p_param7, @@ -96,8 +96,8 @@ class LegoAnimationManager : public MxCore { void FUN_100629b0(MxU32, MxBool); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); - void FUN_10064670(undefined4); - void FUN_10064740(MxBool); + void FUN_10064670(Vector3*); + void FUN_10064740(Vector3*); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 0133935f..63a2bb87 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -1,10 +1,11 @@ #ifndef SKATEBOARD_H #define SKATEBOARD_H -#include "act1state.h" #include "decomp.h" #include "islepathactor.h" +class Act1State; + // VTABLE: LEGO1 0x100d55f0 // SIZE 0x168 class SkateBoard : public IslePathActor { @@ -31,15 +32,15 @@ class SkateBoard : public IslePathActor { MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 void VTable0xe4() override; // vtable+0xe4 - // not 100 % sure about the signature - void FUN_10010270(undefined4 param_1); void FUN_10010510(); // SYNTHETIC: LEGO1 0x1000ff60 // SkateBoard::`scalar deleting destructor' private: - undefined m_unk0x160; // 0x160 + void FUN_10010270(MxBool p_enable); + + MxBool m_unk0x160; // 0x160 Act1State* m_act1state; // 0x164 }; diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index 1ec5c841..c3e53fde 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -25,7 +25,7 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x m_unk0x01f = FALSE; m_unk0x008 = g_unk0x100f37f0; m_unk0x014 = -1; - m_unk0x022 = 0; + m_unk0x022 = FALSE; m_unk0x154 = NULL; m_unk0x158 = NULL; m_unk0x15c = NULL; @@ -122,8 +122,8 @@ MxResult Act1State::Serialize(LegoFile* p_legoFile) } } - p_legoFile->Write(&m_unk0x010, sizeof(undefined2)); - p_legoFile->Write(&m_unk0x022, sizeof(undefined)); + p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); } else if (p_legoFile->IsReadMode()) { if (m_unk0x108.GetName()->Compare("") != 0) { @@ -176,8 +176,8 @@ MxResult Act1State::Serialize(LegoFile* p_legoFile) } } - p_legoFile->Read(&m_unk0x010, sizeof(undefined2)); - p_legoFile->Read(&m_unk0x022, sizeof(undefined)); + p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); } // TODO @@ -205,7 +205,7 @@ MxBool Act1State::SetFlag() m_unk0x024.SetName(""); m_unk0x070.SetName(""); m_unk0x0bc.SetName(""); - m_unk0x022 = 0; + m_unk0x022 = FALSE; m_unk0x108.SetName(""); if (m_unk0x154) { diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index ca3a5c98..fc166d2c 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -115,7 +115,7 @@ MxU32 Helicopter::VTable0xcc() switch (GameState()->GetCurrentAct()) { case LegoGameState::e_act1: m_script = *g_isleScript; - AnimationManager()->FUN_10064670(FALSE); + AnimationManager()->FUN_10064670(NULL); VTable0xe8(LegoGameState::e_unk41, TRUE, 7); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter); FUN_10015820(TRUE, 0); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index c733decc..825015c0 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -10,6 +10,7 @@ #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" #include "mxtransitionmanager.h" #include "pizza.h" @@ -18,7 +19,7 @@ DECOMP_SIZE_ASSERT(SkateBoard, 0x168) // FUNCTION: LEGO1 0x1000fd40 SkateBoard::SkateBoard() { - m_unk0x160 = 0; + m_unk0x160 = FALSE; m_unk0x13c = 15.0; m_unk0x150 = 3.5; m_unk0x148 = 1; @@ -54,13 +55,13 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x10010050 void SkateBoard::VTable0xe4() { - // TODO: Work out what kind of structure this points to - if (m_act1state->GetUnknown18() == 3) { + if (m_act1state->m_unk0x018 == 3) { Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); pizza->FUN_10038380(); pizza->FUN_100382b0(); - m_unk0x160 = 0; + m_unk0x160 = FALSE; } + IslePathActor::VTable0xe4(); GameState()->m_currentArea = LegoGameState::Area::e_skateboard; RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl); @@ -72,33 +73,34 @@ void SkateBoard::VTable0xe4() MxU32 SkateBoard::VTable0xcc() { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - if (!FUN_1003ef60() && state->GetUnknown18() != 3) { + + if (!FUN_1003ef60() && state->m_unk0x018 != 3) { return 1; } + FUN_10015820(TRUE, 0); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard); - TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 0x32, FALSE, TRUE); + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); + if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { CurrentActor()->VTable0xe4(); } } + if (!CurrentActor()->IsA("SkateBoard")) { VTable0xe0(); - InvokeAction(Extra::ActionType::e_start, *g_isleScript, 0xc1, NULL); + InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); } - FUN_10010270(this->m_unk0x160); - // this->m_roi->GetLocal2World().GetData()[0] - // TODO: If this is correct, then the signature of the AnimationManager calls are wrong. - // float data[3]; - Matrix4 stuff = this->m_roi->GetLocal2World(); - Vector3 vec = Vector3(&stuff[3][0]); - // MxBool puVar11 = (MxBool) 0xf4; - AnimationManager()->FUN_10064670((int)&vec); - AnimationManager()->FUN_10064740((int)&vec); + + FUN_10010270(m_unk0x160); + + Vector3 position = m_roi->GetWorldPosition(); + AnimationManager()->FUN_10064670(&position); + AnimationManager()->FUN_10064740(&position); return 1; } @@ -107,7 +109,7 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) { MxU32 result = 0; - if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == 0xc3) { + if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) { VTable0xe4(); GameState()->m_currentArea = LegoGameState::Area::e_unk66; result = 1; @@ -117,44 +119,45 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10010270 -void SkateBoard::FUN_10010270(undefined4 param_1) +// FUNCTION: BETA10 0x100f5366 +void SkateBoard::FUN_10010270(MxBool p_enable) { - MxCore* pMVar3; - m_act1state = (Act1State*) GameState()->GetState("Act1State"); if (!m_act1state) { - this->m_act1state = (Act1State*) GameState()->CreateState("Act1State"); + m_act1state = (Act1State*) GameState()->CreateState("Act1State"); } - if (pMVar3 = this->m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap)) { - // I have no idea what this is. Need a call with vtable offset 0x54 and (likely) no argument. - ((LegoWorld*) pMVar3)->VTable0x54(); + + MxStillPresenter* presenter = (MxStillPresenter*) m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); + if (presenter) { + presenter->Enable(p_enable); } - else { - if (this->m_unk0x160 != '\0') { - NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL)); - } + else if (m_unk0x160) { + NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL)); } } // FUNCTION: LEGO1 0x100104f0 +// FUNCTION: BETA10 0x100f5472 MxU32 SkateBoard::VTable0xd0() { - FUN_10010270(this->m_unk0x160); + FUN_10010270(m_unk0x160); return 1; } // FUNCTION: LEGO1 0x10010510 void SkateBoard::FUN_10010510() { - if (m_act1state->GetUnknown18() != 3) { + if (m_act1state->m_unk0x018 != 3) { PlayMusic(JukeboxScript::c_BeachBlvd_Music); - if (m_act1state->m_unk0x022 == '\0') { - m_act1state->m_unk0x022 = 1; - MxMatrix matrix = MxMatrix(CurrentActor()->GetROI()->GetLocal2World()); - matrix.TranslateBy(2.5 * matrix[2][0], 0.2 + matrix[2][1], 2.5 * matrix[2][2]); + + if (!m_act1state->m_unk0x022) { + m_act1state->m_unk0x022 = TRUE; + + MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); + mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5); + AnimationManager() - ->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &matrix, '\x01', '\0', NULL, 0, TRUE, TRUE, '\x01'); + ->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); } } - return; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 76676897..52f71ef9 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -849,7 +849,7 @@ MxResult LegoAnimationManager::FUN_10060dc0( IsleScript::Script p_objectId, MxMatrix* p_matrix, MxBool p_param3, - undefined p_param4, + MxBool p_param4, LegoROI* p_roi, MxBool p_param6, MxBool p_param7, @@ -870,10 +870,10 @@ MxResult LegoAnimationManager::FUN_10060dc0( MxBool unk0x0a; switch (p_param4) { - case 0: + case FALSE: unk0x0a = m_anims[i].m_unk0x0a; break; - case 1: + case TRUE: unk0x0a = TRUE; break; default: @@ -1040,13 +1040,13 @@ void LegoAnimationManager::FUN_10063aa0() } // STUB: LEGO1 0x10064670 -void LegoAnimationManager::FUN_10064670(undefined4) +void LegoAnimationManager::FUN_10064670(Vector3*) { // TODO } // STUB: LEGO1 0x10064740 -void LegoAnimationManager::FUN_10064740(MxBool) +void LegoAnimationManager::FUN_10064740(Vector3*) { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 58c21544..b4f8c75a 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -331,7 +331,6 @@ MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState) { MxCompositePresenterList::iterator it = m_list.begin(); for (MxS16 i = m_unk0x4e; i > 0; i--, it++) { - ; } return (*it)->HasTickleStatePassed(p_tickleState); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 72d9d7d9..3ebd9807 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -629,7 +629,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 0; if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) { - AnimationManager()->FUN_10064740(FALSE); + AnimationManager()->FUN_10064740(NULL); } else if (GameState()->m_currentArea == LegoGameState::e_unk66) { Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); @@ -637,13 +637,13 @@ void Isle::Enable(MxBool p_enable) Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); ((Vector3&) sub).Sub(&position); if (sub.LenSquared() < 1024.0f) { - AnimationManager()->FUN_10064740(FALSE); + AnimationManager()->FUN_10064740(NULL); } Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f); ((Vector3&) sub2).Sub(&position); if (sub2.LenSquared() < 1024.0f) { - AnimationManager()->FUN_10064670(FALSE); + AnimationManager()->FUN_10064670(NULL); } } break; @@ -666,12 +666,12 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, TRUE, 1, NULL, FALSE, FALSE, TRUE, 0); + AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; FUN_1003ef00(FALSE); - AnimationManager()->FUN_10064670(FALSE); + AnimationManager()->FUN_10064670(NULL); break; } case 6: { @@ -694,7 +694,7 @@ void Isle::Enable(MxBool p_enable) break; } - AnimationManager()->FUN_10060dc0(script, NULL, TRUE, 1, NULL, FALSE, FALSE, TRUE, 0); + AnimationManager()->FUN_10060dc0(script, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, FALSE); } m_act1state->m_unk0x018 = 0; diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index f83ae57e..02f724b1 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -74,7 +74,7 @@ class Matrix4 { } // vtable+0x2c // FUNCTION: LEGO1 0x10002460 - virtual void TranslateBy(const float &p_x, const float &p_y, const float &p_z) + virtual void TranslateBy(const float& p_x, const float& p_y, const float& p_z) { m_data[3][0] += p_x; m_data[3][1] += p_y; @@ -82,7 +82,7 @@ class Matrix4 { } // vtable+0x30 // FUNCTION: LEGO1 0x100024a0 - virtual void SetTranslation(const float &p_x, const float &p_y, const float &p_z) + virtual void SetTranslation(const float& p_x, const float& p_y, const float& p_z) { m_data[3][0] = p_x; m_data[3][1] = p_y;