diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index 540d6042..db99ec6a 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -81,16 +81,17 @@ class Act1State : public LegoState { inline MxU32 GetUnknown18() { return m_unk0x018; } inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } - inline MxS16 GetUnknown21() { return m_unk0x021; } + inline MxU8 GetUnknown21() { return m_unk0x021; } inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } - inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x021 = p_unk0x21; } + inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } // SYNTHETIC: LEGO1 0x10033960 // Act1State::`scalar deleting destructor' friend class Isle; + friend class SkateBoard; protected: MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 @@ -105,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 abc4d96e..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(MxBool); - 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 dc567b9f..63a2bb87 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "islepathactor.h" +class Act1State; + // VTABLE: LEGO1 0x100d55f0 // SIZE 0x168 class SkateBoard : public IslePathActor { @@ -36,8 +38,10 @@ class SkateBoard : public IslePathActor { // SkateBoard::`scalar deleting destructor' private: - undefined m_unk0x160; // 0x160 - undefined* m_unk0x164; // 0x164 + void FUN_10010270(MxBool p_enable); + + MxBool m_unk0x160; // 0x160 + Act1State* m_act1state; // 0x164 }; #endif // SKATEBOARD_H 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 93d29c00..825015c0 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,11 +1,17 @@ #include "skateboard.h" +#include "act1state.h" #include "decomp.h" +#include "isle.h" #include "isle_actions.h" +#include "jukebox_actions.h" +#include "legoanimationmanager.h" #include "legoutils.h" #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxstillpresenter.h" +#include "mxtransitionmanager.h" #include "pizza.h" DECOMP_SIZE_ASSERT(SkateBoard, 0x168) @@ -13,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; @@ -49,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 (*(int*) (m_unk0x164 + 0x18) == 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); @@ -63,11 +69,39 @@ void SkateBoard::VTable0xe4() ControlManager()->Unregister(this); } -// STUB: LEGO1 0x100100e0 +// FUNCTION: LEGO1 0x100100e0 MxU32 SkateBoard::VTable0xcc() { - // TODO - return 0; + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + 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, 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, IsleScript::c_SkateDashboard, NULL); + GetCurrentAction().SetObjectId(-1); + ControlManager()->Register(this); + } + + FUN_10010270(m_unk0x160); + + Vector3 position = m_roi->GetWorldPosition(); + AnimationManager()->FUN_10064670(&position); + AnimationManager()->FUN_10064740(&position); + return 1; } // FUNCTION: LEGO1 0x10010230 @@ -75,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; @@ -84,15 +118,46 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) return result; } -// STUB: LEGO1 0x100104f0 -MxU32 SkateBoard::VTable0xd0() +// FUNCTION: LEGO1 0x10010270 +// FUNCTION: BETA10 0x100f5366 +void SkateBoard::FUN_10010270(MxBool p_enable) { - // TODO - return 0; + m_act1state = (Act1State*) GameState()->GetState("Act1State"); + if (!m_act1state) { + m_act1state = (Act1State*) GameState()->CreateState("Act1State"); + } + + MxStillPresenter* presenter = (MxStillPresenter*) m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); + if (presenter) { + presenter->Enable(p_enable); + } + else if (m_unk0x160) { + NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL)); + } } -// STUB: LEGO1 0x10010510 +// FUNCTION: LEGO1 0x100104f0 +// FUNCTION: BETA10 0x100f5472 +MxU32 SkateBoard::VTable0xd0() +{ + FUN_10010270(m_unk0x160); + return 1; +} + +// FUNCTION: LEGO1 0x10010510 void SkateBoard::FUN_10010510() { - // TODO + if (m_act1state->m_unk0x018 != 3) { + PlayMusic(JukeboxScript::c_BeachBlvd_Music); + + 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, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + } + } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 27dcce84..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(MxBool) +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/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 202f0236..92de53ae 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -515,7 +515,7 @@ inline void LegoAnimNodeData::GetTranslation( break; } - p_matrix.TranslateBy(&x, &y, &z); + p_matrix.TranslateBy(x, y, z); } // FUNCTION: LEGO1 0x100a06f0 diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index 1e14db26..02f724b1 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -74,19 +74,19 @@ 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; - m_data[3][2] += *p_z; + m_data[3][0] += p_x; + m_data[3][1] += p_y; + m_data[3][2] += p_z; } // 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; - m_data[3][2] = *p_z; + m_data[3][0] = p_x; + m_data[3][1] = p_y; + m_data[3][2] = p_z; } // vtable+0x34 // FUNCTION: LEGO1 0x100024d0