diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index 540d6042..d9c582c9 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -81,16 +81,19 @@ 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; + // 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: MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index dc567b9f..0133935f 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -1,6 +1,7 @@ #ifndef SKATEBOARD_H #define SKATEBOARD_H +#include "act1state.h" #include "decomp.h" #include "islepathactor.h" @@ -30,6 +31,8 @@ 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 @@ -37,7 +40,7 @@ class SkateBoard : public IslePathActor { private: undefined m_unk0x160; // 0x160 - undefined* m_unk0x164; // 0x164 + Act1State* m_act1state; // 0x164 }; #endif // SKATEBOARD_H diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index cee6cc45..8e065806 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,6 +1,8 @@ #include "skateboard.h" +#include "act1state.h" #include "decomp.h" +#include "isle.h" #include "isle_actions.h" #include "jukebox_actions.h" #include "legoanimationmanager.h" @@ -8,6 +10,7 @@ #include "misc.h" #include "mxmisc.h" #include "mxnotificationmanager.h" +#include "mxtransitionmanager.h" #include "pizza.h" DECOMP_SIZE_ASSERT(SkateBoard, 0x168) @@ -52,7 +55,7 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) void SkateBoard::VTable0xe4() { // TODO: Work out what kind of structure this points to - if (*(int*) (m_unk0x164 + 0x18) == 3) { + if (m_act1state->GetUnknown18() == 3) { Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); pizza->FUN_10038380(); pizza->FUN_100382b0(); @@ -119,41 +122,39 @@ void SkateBoard::FUN_10010270(undefined4 param_1) if (!m_act1state) { this->m_act1state = (Act1State*) GameState()->CreateState("Act1State"); } - pMVar3 = this->m_world->Find(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); - if (pMVar3) { - // I have no idea what this is. Need a call with vtable offset 0x54 and one 4 byte argument + 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(); } else { if (this->m_unk0x160 != '\0') { - MxNotificationParam local_1c = MxNotificationParam(c_notificationType0, NULL); - NotificationManager()->Send(this, local_1c); + NotificationManager()->Send(this, MxNotificationParam(c_notificationType0, NULL)); } } } + +// FUNCTION: LEGO1 0x100104f0 MxU32 SkateBoard::VTable0xd0() { - // TODO - return 0; + FUN_10010270(this->m_unk0x160); + return 1; } // FUNCTION: LEGO1 0x10010510 void SkateBoard::FUN_10010510() { - char *pcVar1; - - if (*(int *)(m_unk0x164 + 0x18) != 3) { - PlayMusic(JukeboxScript::c_BeachBlvd_Music); - pcVar1 = (char *)(m_unk0x164 + 0x22); - if (*pcVar1 == '\0') { - *pcVar1 = '\x01'; - MxMatrix x = MxMatrix(CurrentActor()->GetROI()->GetLocal2World()); - float xs = x[2][0] * 2.5; - float y = x[2][1] + 0.2; - float z = x[2][2] * 2.5; - x.TranslateBy(&xs, &y, &z); - AnimationManager()->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &x,'\x01','\0',NULL,0,TRUE,TRUE,'\x01'); - } - } - return; + if (m_act1state->GetUnknown18() != 3) { + PlayMusic(JukeboxScript::c_BeachBlvd_Music); + if (m_act1state->m_unk0x022 == '\0') { + m_act1state->m_unk0x022 = 1; + MxMatrix x = MxMatrix(CurrentActor()->GetROI()->GetLocal2World()); + float xs = x[2][0] * 2.5; + float y = x[2][1] + 0.2; + float z = x[2][2] * 2.5; + x.TranslateBy(&xs, &y, &z); + AnimationManager() + ->FUN_10060dc0(IsleScript::c_sns008in_RunAnim, &x, '\x01', '\0', NULL, 0, TRUE, TRUE, '\x01'); + } + } + return; }