diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 27ec54b1..3f8b65ef 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -47,6 +47,7 @@ public: }; // VTABLE: LEGO1 0x100d82e0 +// VTABLE: BETA10 0x101ba898 // SIZE 0x1154 class LegoAct2 : public LegoWorld { public: diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index d005cf3c..60b5a9c3 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -1,13 +1,16 @@ #ifndef LEGOCARBUILD_H #define LEGOCARBUILD_H +#include "legogamestate.h" #include "legostate.h" #include "legoworld.h" class LegoCarBuildAnimPresenter; +class LegoEventNotificationParam; class MxControlPresenter; class MxStillPresenter; class MxSoundPresenter; +class MxActionNotificationParam; // VTABLE: LEGO1 0x100d66e0 // SIZE 0x50 @@ -90,9 +93,9 @@ public: void Enable(MxBool p_enable) override; // vtable+0x68 virtual void VTable0x6c(); // vtable+0x6c virtual void VTable0x70(); // vtable+0x70 - virtual void VTable0x74(MxFloat p_param1[3], MxFloat p_param2[3]); // vtable+0x74 - virtual void VTable0x78(MxFloat p_param1[3], MxFloat p_param2[3]); // vtable+0x78 - virtual void VTable0x7c(MxFloat p_param1[3], MxFloat p_param2[3]); // vtable+0x7c + virtual void VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x74 + virtual void VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x78 + virtual void VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x7c virtual void VTable0x80( MxFloat p_param1[2], MxFloat p_param2[2], @@ -102,45 +105,58 @@ public: void InitPresenters(); void FUN_10022f30(); + void FUN_10023130(MxLong p_x, MxLong p_y); + undefined4 FUN_10024250(LegoEventNotificationParam* p_param); + void FUN_100243a0(); + undefined4 FUN_10024480(MxActionNotificationParam* p_param); + undefined4 FUN_100244e0(MxLong p_x, MxLong p_y); + undefined4 FUN_100246e0(MxLong p_x, MxLong p_y); + MxS32 FUN_10024850(MxLong p_x, MxLong p_y); + undefined4 FUN_10024890(LegoEventNotificationParam* p_param); + void FUN_10024c20(LegoEventNotificationParam* p_param); void FUN_10024ef0(); void FUN_10024f50(); + void FUN_10024f70(MxBool p_enabled); void SetPresentersEnabled(MxBool p_enabled); void TogglePresentersEnabled(); + void FUN_100250e0(MxBool p_param); + void FUN_10025450(); undefined4 FUN_10025720(undefined4 p_param1); MxS32 FUN_10025d70(); void FUN_10025db0(const char* p_param1, undefined4 p_param2); + void FUN_10025e40(); MxS32 FUN_10025ee0(undefined4 p_param1); // SYNTHETIC: LEGO1 0x10022a60 // LegoCarBuild::`scalar deleting destructor' private: - undefined4 m_unk0xf8; // 0xf8 - MxS16 m_unk0xfc; // 0xfc - undefined m_unk0xfe[2]; // 0xfe - undefined4 m_unk0x100; // 0x100 - undefined4 m_unk0x104; // 0x104 - undefined m_unk0x108; // 0x108 - undefined m_unk0x109; // 0x109 - MxU16 m_unk0x10a; // 0x10a - DWORD m_unk0x10c; // 0x10c - LegoROI* m_unk0x110; // 0x110 - Mx3DPointFloat m_unk0x114; // 0x114 - undefined4 m_unk0x128; // 0x128 - MxMatrix m_unk0x12c; // 0x12c - undefined m_unk0x174; // 0x174 - MxMatrix m_unk0x178; // 0x178 - MxMatrix m_unk0x1c0; // 0x1c0 - MxMatrix m_unk0x208; // 0x208 - undefined m_unk0x250[0x08]; // 0x250 + undefined4 m_unk0xf8; // 0xf8 + MxS16 m_unk0xfc; // 0xfc + undefined m_unk0xfe[2]; // 0xfe + MxS32 m_unk0x100; // 0x100 + undefined4 m_unk0x104; // 0x104 + MxS8 m_unk0x108; // 0x108 + MxU8 m_unk0x109; // 0x109 + MxU16 m_unk0x10a; // 0x10a + DWORD m_unk0x10c; // 0x10c + LegoROI* m_unk0x110; // 0x110 + BoundingSphere m_unk0x114; // 0x114 + MxMatrix m_unk0x12c; // 0x12c + undefined m_unk0x174; // 0x174 + MxMatrix m_unk0x178; // 0x178 + MxMatrix m_unk0x1c0; // 0x1c0 + MxMatrix m_unk0x208; // 0x208 + + // This is likely a location in pixel space + MxS32 m_unk0x250[2]; // 0x250 + LegoCarBuildAnimPresenter* m_unk0x258; // 0x258 UnknownMx4DPointFloat m_unk0x25c; // 0x25c - // These four are likely locations in pixel space - MxS32 m_unk0x290; // 0x290 - MxS32 m_unk0x294; // 0x294 - MxS32 m_unk0x298; // 0x298 - MxS32 m_unk0x29c; // 0x29c + // These two are likely locations in pixel space + MxS32 m_unk0x290[2]; // 0x290 + MxS32 m_unk0x298[2]; // 0x298 MxFloat m_unk0x2a0; // 0x2a0 Mx4DPointFloat m_unk0x2a4; // 0x2a4 @@ -173,8 +189,11 @@ private: // variable name verified by BETA10 0x1006b219 LegoVehicleBuildState* m_buildState; // 0x32c - undefined4 m_unk0x330; // 0x330 - undefined4 m_unk0x334; // 0x334 + undefined4 m_unk0x330; // 0x330 + + // variable name verified by BETA10 0x1006cba7 + LegoGameState::Area m_destLocation; // 0x334 + undefined4 m_unk0x338; // 0x338 MxControlPresenter* m_unk0x33c; // 0x33c undefined4 m_unk0x340; // 0x340 diff --git a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h index 2dbfd20f..8d707eff 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -46,8 +46,9 @@ public: void PutFrame() override; // vtable+0x6c void FUN_10079920(float p_param1); - MxBool FUN_10079ca0(const char* p_param1); - MxBool FUN_10079cf0(const LegoChar* p_name); + MxBool FUN_10079c30(const LegoChar* p_name); + MxBool FUN_10079ca0(const LegoChar* p_name); + MxBool FUN_10079cf0(const LegoChar* p_string); // FUNCTION: BETA10 0x10070180 void SetUnknown0xbc(undefined2 p_unk0xbc) { m_unk0xbc = p_unk0xbc; } diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index f7c00b48..cbb12b61 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -46,9 +46,11 @@ public: MxU8 GetKey() const { return m_key; } // FUNCTION: LEGO1 0x10012190 + // FUNCTION: BETA10 0x10024210 MxS32 GetX() const { return m_x; } // FUNCTION: LEGO1 0x100121a0 + // FUNCTION: BETA10 0x10024240 MxS32 GetY() const { return m_y; } void SetROI(LegoROI* p_roi) { m_roi = p_roi; } diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index ee0a001d..9e8c91fc 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -40,7 +40,7 @@ LegoEntity* PickEntity(MxLong, MxLong); LegoROI* PickROI(MxLong, MxLong); LegoROI* PickParentROI(MxLong p_a, MxLong p_b); void FUN_1003dde0(LegoROI* p_param1, MxFloat p_param2); -MxBool FUN_1003ded0(MxFloat p_param1[3], MxFloat p_param2[3], MxFloat p_param3[3]); +MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]); MxBool TransformWorldToScreen(const MxFloat p_world[3], MxFloat p_screen[4]); MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); void FUN_1003e050(LegoAnimPresenter* p_presenter); diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 5241638d..2d6501c7 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -6,6 +6,7 @@ #include "legoinputmanager.h" #include "legoutils.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxcontrolpresenter.h" #include "mxmisc.h" @@ -13,8 +14,11 @@ #include "mxsoundpresenter.h" #include "mxstillpresenter.h" #include "mxticklemanager.h" +#include "mxtransitionmanager.h" #include "scripts.h" +#include <vec.h> + DECOMP_SIZE_ASSERT(LegoCarBuild, 0x34c) DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) @@ -27,46 +31,45 @@ MxFloat LegoCarBuild::g_unk0x100d65a8 = 0.07; // GLOBAL: LEGO1 0x100f11cc MxS16 LegoCarBuild::g_unk0x100f11cc = -1; -// STUB: LEGO1 0x100226d0 +// FUNCTION: LEGO1 0x100226d0 // FUNCTION: BETA10 0x1006ac10 LegoCarBuild::LegoCarBuild() { - // Not close yet - might be getting there when more of this class is implemented m_unk0x100 = 0; m_unk0x110 = 0; m_unk0xf8 = 0xffffffff; - m_unk0x2d4 = '\0'; + m_unk0x2d4 = FALSE; m_unk0x258 = 0; - m_ColorBook_Bitmap = 0; - m_Yellow_Ctl = 0; - m_Red_Ctl = 0; - m_Blue_Ctl = 0; - m_Green_Ctl = 0; - m_Gray_Ctl = 0; - m_Black_Ctl = 0; - m_Shelf_Sound = 0; - m_PlaceBrick_Sound = 0; - m_GetBrick_Sound = 0; - m_Paint_Sound = 0; - m_Decal_Sound = 0; - m_Decal_Bitmap = 0; - m_Decals_Ctl = 0; - m_Decals_Ctl1 = 0; - m_Decals_Ctl2 = 0; - m_Decals_Ctl3 = 0; - m_Decals_Ctl4 = 0; - m_Decals_Ctl5 = 0; - m_Decals_Ctl6 = 0; + m_ColorBook_Bitmap = NULL; + m_Yellow_Ctl = NULL; + m_Red_Ctl = NULL; + m_Blue_Ctl = NULL; + m_Green_Ctl = NULL; + m_Gray_Ctl = NULL; + m_Black_Ctl = NULL; + m_Shelf_Sound = NULL; + m_PlaceBrick_Sound = NULL; + m_GetBrick_Sound = NULL; + m_Paint_Sound = NULL; + m_Decal_Sound = NULL; + m_Decal_Bitmap = NULL; + m_Decals_Ctl = NULL; + m_Decals_Ctl1 = NULL; + m_Decals_Ctl2 = NULL; + m_Decals_Ctl3 = NULL; + m_Decals_Ctl4 = NULL; + m_Decals_Ctl5 = NULL; + m_Decals_Ctl6 = NULL; m_Decals_Ctl7 = NULL; - m_unk0x33c = 0; - m_buildState = 0; + m_unk0x33c = NULL; + m_buildState = NULL; m_unk0x104 = 0; - m_unk0x109 = '\0'; - m_unk0x108 = '\0'; + m_unk0x109 = 0; + m_unk0x108 = 0; m_unk0x338 = 0; - m_unk0x334 = 0; + m_destLocation = LegoGameState::e_undefined; m_unk0x344 = 0xffffffff; - m_unk0x174 = '\0'; + m_unk0x174 = 0; NotificationManager()->Register(this); } @@ -78,7 +81,7 @@ MxBool LegoCarBuild::VTable0x5c() } // STUB: LEGO1 0x10022a80 -// FUNCTION: BETA10 0x1006aea3 +// STUB: BETA10 0x1006aea3 LegoCarBuild::~LegoCarBuild() { // TODO @@ -106,22 +109,22 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction) if (m_atomId == *g_copterScript) { buildStateClassName = "LegoCopterBuildState"; - GameState()->SetCurrentArea(LegoGameState::Area::e_copterbuild); + GameState()->SetCurrentArea(LegoGameState::e_copterbuild); m_unk0x330 = 1; } else if (m_atomId == *g_dunecarScript) { buildStateClassName = "LegoDuneCarBuildState"; - GameState()->SetCurrentArea(LegoGameState::Area::e_dunecarbuild); + GameState()->SetCurrentArea(LegoGameState::e_dunecarbuild); m_unk0x330 = 2; } else if (m_atomId == *g_jetskiScript) { buildStateClassName = "LegoJetskiBuildState"; - GameState()->SetCurrentArea(LegoGameState::Area::e_jetskibuild); + GameState()->SetCurrentArea(LegoGameState::e_jetskibuild); m_unk0x330 = 3; } else if (m_atomId == *g_racecarScript) { buildStateClassName = "LegoRaceCarBuildState"; - GameState()->SetCurrentArea(LegoGameState::Area::e_racecarbuild); + GameState()->SetCurrentArea(LegoGameState::e_racecarbuild); m_unk0x330 = 4; } @@ -136,7 +139,7 @@ MxResult LegoCarBuild::Create(MxDSAction& p_dsAction) m_buildState = buildState; m_unk0x174 = m_buildState->m_unk0x4d; - GameState()->StopArea(LegoGameState::Area::e_previousArea); + GameState()->StopArea(LegoGameState::e_previousArea); m_buildState->m_animationState = 1; m_unk0x100 = 0; @@ -196,11 +199,24 @@ void LegoCarBuild::InitPresenters() } } -// STUB: LEGO1 0x10022f30 -// STUB: BETA10 0x1006b835 +// FUNCTION: LEGO1 0x10022f30 +// FUNCTION: BETA10 0x1006b835 void LegoCarBuild::FUN_10022f30() { - // TODO + if (m_unk0x110) { + FUN_10024f70(FALSE); + FUN_100250e0(FALSE); + + if (m_unk0x258->FUN_10079ca0(m_unk0x110->GetName())) { + m_PlaceBrick_Sound->Enable(FALSE); + m_PlaceBrick_Sound->Enable(TRUE); + } + + m_unk0x258->SetUnknown0xbc(1); + m_unk0x258->PutFrame(); + m_unk0x110 = NULL; + m_unk0x100 = 0; + } } // FUNCTION: LEGO1 0x10022fc0 @@ -214,7 +230,7 @@ void LegoCarBuild::VTable0x6c() VTable0x70(); } -// STUB: LEGO1 0x10023020 +// FUNCTION: LEGO1 0x10023020 // FUNCTION: BETA10 0x1006b991 void LegoCarBuild::VTable0x70() { @@ -227,8 +243,8 @@ void LegoCarBuild::VTable0x70() TransformWorldToScreen(worldPos, screenPos); - m_unk0x290 = screenPos[0] / screenPos[3]; - m_unk0x294 = screenPos[1] / screenPos[3]; + m_unk0x290[0] = screenPos[0] / screenPos[3]; + m_unk0x290[1] = screenPos[1] / screenPos[3]; worldPos[0] = m_unk0x2bc[0]; worldPos[1] = m_unk0x2bc[1]; @@ -236,20 +252,74 @@ void LegoCarBuild::VTable0x70() TransformWorldToScreen(worldPos, screenPos); - m_unk0x298 = screenPos[0] / screenPos[3]; - m_unk0x29c = screenPos[1] / screenPos[3]; + m_unk0x298[0] = screenPos[0] / screenPos[3]; + m_unk0x298[1] = screenPos[1] / screenPos[3]; - m_unk0x2a0 = sqrt( - (MxFloat) (m_unk0x298 - m_unk0x290) * (m_unk0x298 - m_unk0x290) + - (m_unk0x29c - m_unk0x294) * (m_unk0x29c - m_unk0x294) - ); + m_unk0x2a0 = sqrt((MxDouble) DISTSQRD2(m_unk0x290, m_unk0x298)); m_unk0x25c.Unknown1(m_unk0x178, m_unk0x208); } +// FUNCTION: LEGO1 0x10023130 +// FUNCTION: BETA10 0x1006bb22 +void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y) +{ + if (m_unk0x110) { + MxFloat pfVar3[2]; + MxFloat local30[3]; + MxFloat local84[3]; + + p_x += (m_unk0x290[0] - m_unk0x250[0]); + p_y += (m_unk0x290[1] - m_unk0x250[1]); + + pfVar3[0] = p_x; + pfVar3[1] = p_y; + + if (FUN_1003ded0(pfVar3, local30, local84)) { + MxFloat local18[3]; + MxFloat local8c[2]; + + local8c[0] = p_x; + local8c[1] = p_y; + + local18[0] = 0; + local18[1] = 0; + local18[2] = 0; + + MxMatrix local78; + + if (p_y < m_unk0x290[1]) { + VTable0x74(local8c, local18); + } + else if (p_y > m_unk0x298[1]) { + VTable0x7c(local8c, local18); + } + else if (p_y >= m_unk0x290[1]) { + VTable0x78(local8c, local18); + } + + MxS32 local20[2]; + + local20[0] = p_x - m_unk0x290[0]; + local20[1] = p_y - m_unk0x290[1]; + + MxFloat local1c = sqrt((double) (NORMSQRD2(local20))) / m_unk0x2a0; + + m_unk0x25c.Unknown6(local78, local1c); + + local78[3][0] = m_unk0x178[3][0] + local18[0]; + local78[3][1] = m_unk0x178[3][1] + local18[1]; + local78[3][2] = m_unk0x178[3][2] + local18[2]; + local78[3][3] = 1.0; + + m_unk0x110->WrappedSetLocalTransform(local78); + } + } +} + // FUNCTION: LEGO1 0x10023500 // FUNCTION: BETA10 0x1006bdf6 -void LegoCarBuild::VTable0x74(MxFloat p_param1[3], MxFloat p_param2[3]) +void LegoCarBuild::VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]) { MxFloat fVar1; MxFloat local20[3]; @@ -265,7 +335,7 @@ void LegoCarBuild::VTable0x74(MxFloat p_param1[3], MxFloat p_param2[3]) // FUNCTION: LEGO1 0x10023570 // FUNCTION: BETA10 0x1006be91 -void LegoCarBuild::VTable0x78(MxFloat p_param1[3], MxFloat p_param2[3]) +void LegoCarBuild::VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]) { MxFloat fVar1; MxFloat local18[3]; @@ -273,8 +343,8 @@ void LegoCarBuild::VTable0x78(MxFloat p_param1[3], MxFloat p_param2[3]) FUN_1003ded0(p_param1, local18, localc); - p_param2[2] = - m_unk0x2a4[2] + (m_unk0x2bc[2] - m_unk0x2a4[2]) * ((p_param1[1] - m_unk0x294) / (m_unk0x29c - m_unk0x294)); + p_param2[2] = m_unk0x2a4[2] + + (m_unk0x2bc[2] - m_unk0x2a4[2]) * ((p_param1[1] - m_unk0x290[1]) / (m_unk0x298[1] - m_unk0x290[1])); fVar1 = (p_param2[2] - localc[2]) / local18[2]; p_param2[0] = fVar1 * local18[0] - m_unk0x2a4[0] + localc[0]; p_param2[1] = fVar1 * local18[1] - m_unk0x2a4[1] + localc[1]; @@ -283,7 +353,7 @@ void LegoCarBuild::VTable0x78(MxFloat p_param1[3], MxFloat p_param2[3]) // FUNCTION: LEGO1 0x10023620 // FUNCTION: BETA10 0x1006bfb5 -void LegoCarBuild::VTable0x7c(MxFloat p_param1[3], MxFloat p_param2[3]) +void LegoCarBuild::VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]) { MxFloat local18[3]; MxFloat localc[3]; @@ -428,29 +498,274 @@ MxResult LegoCarBuild::Tickle() return 0; } -// STUB: LEGO1 0x10024050 +// FUNCTION: LEGO1 0x10024050 // FUNCTION: BETA10 0x1006c976 MxLong LegoCarBuild::Notify(MxParam& p_param) +{ + MxLong result = LegoWorld::Notify(p_param); + + if (m_worldStarted) { + switch (((MxNotificationParam*) &p_param)->GetNotification()) { + case c_notificationType0: + FUN_10024c20((LegoEventNotificationParam*) &p_param); + result = 1; + break; + case c_notificationEndAction: + result = FUN_10024480((MxActionNotificationParam*) &p_param); + break; + case c_notificationKeyPress: + result = FUN_10024250((LegoEventNotificationParam*) &p_param); + break; + case c_notificationButtonUp: + result = FUN_100246e0( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + ); + + if (result || m_unk0x10a || m_buildState->m_animationState == 4 || m_buildState->m_animationState == 6) { + m_unk0x109 = 0; + break; + } + + if (++m_unk0x109 > 2) { + FUN_10025720(6); + m_unk0x109 = 0; + } + + break; + case c_notificationButtonDown: + assert(m_buildState); + if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) && + (m_buildState->m_animationState != 2)) { + m_buildState->m_animationState = 0; + result = FUN_100244e0( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + ); + } + + break; + case c_notificationMouseMove: + result = FUN_10024850( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + ); + + if (result == 1) { + m_unk0x109 = 0; + } + + break; + case c_notificationControl: + result = FUN_10024890((LegoEventNotificationParam*) &p_param); + + if (result == 1) { + m_unk0x109 = 0; + } + + break; + case c_notificationEndAnim: + if (m_unk0x108 > 0) { + m_unk0x108 -= 1; + } + + FUN_10025e40(); + m_unk0x10a = 0; + result = 1; + break; + case c_notificationTransitioned: + assert(m_destLocation != LegoGameState::e_undefined); + GameState()->SwitchArea(m_destLocation); + } + } + + return result; +} + +// FUNCTION: LEGO1 0x10024250 +// FUNCTION: BETA10 0x1006cc48 +undefined4 LegoCarBuild::FUN_10024250(LegoEventNotificationParam* p_param) +{ + if (p_param->GetKey() == ' ' && m_buildState->m_animationState != 4 && m_buildState->m_animationState != 2) { + if (m_unk0x108 > 0) { + DeleteObjects(&m_atomId, 500, 0x1fe); + BackgroundAudioManager()->RaiseVolume(); + m_unk0x109 = 0; + } + + return 1; + } + + return 0; +} + +// FUNCTION: LEGO1 0x100242c0 +void LegoCarBuild::ReadyWorld() +{ + m_presentersEnabled = FALSE; + InitPresenters(); + + if (BackgroundAudioManager()->GetEnabled()) { + InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, FUN_10025ee0(m_unk0x330), NULL); + m_buildState->m_animationState = 2; + NotificationManager()->Send(this, MxNotificationParam()); + } + else { + FUN_10024ef0(); + } +} + +// FUNCTION: LEGO1 0x100243a0 +void LegoCarBuild::FUN_100243a0() +{ + switch (m_unk0x330) { + case 1: + if (GameState()->GetCurrentAct() == LegoGameState::Act::e_act2) { + m_destLocation = LegoGameState::Area::e_act3script; + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); + break; + } + else { + m_destLocation = LegoGameState::Area::e_polidoor; + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); + break; + } + case 2: + m_destLocation = LegoGameState::Area::e_garadoor; + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); + break; + case 3: + m_destLocation = LegoGameState::Area::e_unk17; + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); + break; + case 4: + m_destLocation = LegoGameState::Area::e_unk20; + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE); + } +} + +// FUNCTION: LEGO1 0x10024480 +undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param) +{ + MxS32 result = 0; + + switch (m_buildState->m_animationState) { + case 3: + BackgroundAudioManager()->RaiseVolume(); + m_buildState->m_animationState = 0; + result = 1; + break; + case 6: + if (p_param->GetAction()->GetObjectId() == m_unk0x344) { + FUN_100243a0(); + result = 1; + break; + } + } + + return result; +} + +// FUNCTION: LEGO1 0x100244e0 +// FUNCTION: BETA10 0x1006cfb6 +undefined4 LegoCarBuild::FUN_100244e0(MxLong p_x, MxLong p_y) +{ + m_unk0x250[0] = p_x; + m_unk0x250[1] = p_y; + + LegoROI* roi = PickROI(p_x, p_y); + + if (!roi || !m_unk0x258->StringEndsOnYOrN(roi->GetName())) { + return 0; + } + + if (m_unk0x110 != roi) { + FUN_10022f30(); + m_unk0x110 = roi; + FUN_10024f70(TRUE); + FUN_100250e0(TRUE); + } + + if (m_unk0x100 == 5 && m_unk0x258->FUN_10079ca0(m_unk0x110->GetName())) { + m_unk0x2d4 = TRUE; + } + else { + m_unk0x2d4 = FALSE; + } + FUN_10025450(); + VTable0x70(); + + if (m_unk0x258->FUN_10079ca0(m_unk0x110->GetName())) { + if (m_unk0x100 != 5) { + m_unk0x250[0] += m_unk0x290[0] - m_unk0x298[0]; + m_unk0x250[1] += m_unk0x290[1] - m_unk0x298[1]; + } + + if (m_unk0x100 == 0) { + m_unk0x114 = m_unk0x110->GetWorldBoundingSphere(); + } + } + else { + if (m_unk0x258->FUN_10079c30(m_unk0x110->GetName())) { + m_unk0x114 = m_unk0x258->FUN_10079e20(); + } + } + + switch (m_unk0x100) { + case 0: + m_unk0x100 = 4; + break; + case 5: + m_unk0x100 = 3; + break; + } + + m_GetBrick_Sound->Enable(FALSE); + m_GetBrick_Sound->Enable(TRUE); + + m_unk0x258->SetUnknown0xbc(0); + return 1; +} + +// STUB: LEGO1 0x100246e0 +undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y) { // TODO return 0; } -// STUB: LEGO1 0x100242c0 -void LegoCarBuild::ReadyWorld() +// FUNCTION: LEGO1 0x10024850 +// FUNCTION: BETA10 0x1006d48e +MxS32 LegoCarBuild::FUN_10024850(MxLong p_x, MxLong p_y) { - m_presentersEnabled = FALSE; - InitPresenters(); - if (BackgroundAudioManager()->GetEnabled()) { - InvokeAction(Extra::ActionType::e_start, *g_jukeboxScript, FUN_10025ee0(m_unk0x330), NULL); - m_buildState->m_animationState = 2; - MxNotificationParam param; - param.SetNotification(c_notificationStartAction); - NotificationManager()->Send(this, param); - } - else { - FUN_10024ef0(); + MxS32 result = 0; + + switch (m_unk0x100) { + case 3: + case 4: + m_unk0x100 = 6; + case 6: + FUN_10023130(p_x, p_y); + result = 1; + break; } + + return result; +} + +// STUB: LEGO1 0x10024890 +// STUB: BETA10 0x1006d512 +undefined4 LegoCarBuild::FUN_10024890(LegoEventNotificationParam* p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x10024c20 +// STUB: BETA10 0x1006db21 +void LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) +{ + // TODO } // FUNCTION: LEGO1 0x10024ef0 @@ -471,6 +786,15 @@ void LegoCarBuild::FUN_10024f50() m_unk0x258->FUN_10079920(g_unk0x100d65a8); } +// FUNCTION: LEGO1 0x10024f70 +// FUNCTION: BETA10 0x1006e002 +void LegoCarBuild::FUN_10024f70(MxBool p_enabled) +{ + if (m_unk0x258->FUN_10079cf0(m_unk0x110->GetName())) { + SetPresentersEnabled(p_enabled); + } +} + // FUNCTION: LEGO1 0x10024fa0 // FUNCTION: BETA10 0x1006e04f void LegoCarBuild::SetPresentersEnabled(MxBool p_enabled) @@ -497,6 +821,20 @@ void LegoCarBuild::TogglePresentersEnabled() m_Black_Ctl->Enable(!m_Black_Ctl->IsEnabled()); } +// STUB: LEGO1 0x100250e0 +// STUB: BETA10 0x1006e124 +void LegoCarBuild::FUN_100250e0(MxBool p_enabled) +{ + // TODO +} + +// STUB: LEGO1 0x10025450 +// STUB: BETA10 0x1006e599 +void LegoCarBuild::FUN_10025450() +{ + // TODO +} + // FUNCTION: LEGO1 0x100256c0 // FUNCTION: BETA10 0x1006e96c void LegoCarBuild::Enable(MxBool p_enable) @@ -561,6 +899,15 @@ void LegoCarBuild::FUN_10025db0(const char* p_param1, undefined4 p_param2) } } +// FUNCTION: LEGO1 0x10025e40 +void LegoCarBuild::FUN_10025e40() +{ + SetPresentersEnabled(m_presentersEnabled); + if (m_unk0x33c && m_Yellow_Ctl != m_unk0x33c) { + m_unk0x33c->VTable0x6c(0); + } +} + // FUNCTION: LEGO1 0x10025e70 MxBool LegoCarBuild::Escape() { @@ -570,7 +917,7 @@ MxBool LegoCarBuild::Escape() DeleteObjects(&m_atomId, 500, 999); m_buildState->m_animationState = 0; - m_unk0x334 = 2; + m_destLocation = LegoGameState::e_infomain; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index 12944337..2ed86f7b 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -98,12 +98,20 @@ MxBool LegoCarBuildAnimPresenter::StringEndsOnYOrN(const LegoChar* p_string) (p_string[strlen(p_string) - 2] == 'Y') || (p_string[strlen(p_string) - 2] == 'y'); } +// STUB: LEGO1 0x10079c30 +// STUB: BETA10 0x100726a6 +MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name) +{ + // TODO + return FALSE; +} + // FUNCTION: LEGO1 0x10079ca0 // FUNCTION: BETA10 0x10072740 -MxBool LegoCarBuildAnimPresenter::FUN_10079ca0(const char* p_param1) +MxBool LegoCarBuildAnimPresenter::FUN_10079ca0(const LegoChar* p_name) { for (MxS16 i = 0; i < m_unk0xc0; i++) { - if (strcmpi(p_param1, m_unk0x128[i].m_unk0x00) == 0) { + if (strcmpi(p_name, m_unk0x128[i].m_unk0x00) == 0) { return TRUE; } } @@ -119,6 +127,7 @@ MxBool LegoCarBuildAnimPresenter::FUN_10079cf0(const LegoChar* p_string) } // FUNCTION: LEGO1 0x10079e20 +// FUNCTION: BETA10 0x10072959 const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() { LegoROI* roi = m_unk0x140->GetROI(); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 75f0ba2a..a4001bc2 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -792,6 +792,7 @@ inline void LoadIsle() } // FUNCTION: LEGO1 0x1003b060 +// FUNCTION: BETA10 0x10085adf void LegoGameState::SwitchArea(Area p_area) { m_previousArea = m_currentArea; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index eeca0bd0..266ac1b1 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -32,6 +32,7 @@ #include <vec.h> // FUNCTION: LEGO1 0x1003dd70 +// FUNCTION: BETA10 0x100d3410 LegoROI* PickROI(MxLong p_a, MxLong p_b) { LegoVideoManager* videoManager = VideoManager(); @@ -70,7 +71,7 @@ void FUN_1003dde0(LegoROI* p_param1, MxFloat p_param2) // FUNCTION: LEGO1 0x1003ded0 // FUNCTION: BETA10 0x100d3802 -MxBool FUN_1003ded0(MxFloat p_param1[3], MxFloat p_param2[3], MxFloat p_param3[3]) +MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]) { MxFloat local1c[4]; MxFloat local10[3]; diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index b8cdc37e..eafc5e1e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -224,6 +224,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x1001f5e0 +// FUNCTION: BETA10 0x100d9f5f MxLong LegoWorld::Notify(MxParam& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 3e3a3149..523cee3c 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -11,6 +11,7 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) // STUB: LEGO1 0x1004fce0 +// STUB: BETA10 0x1003a5a0 LegoAct2::LegoAct2() { // TODO diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 157b7acd..5df6786c 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -52,6 +52,7 @@ // _sprintf // LIBRARY: LEGO1 0x1008b608 +// LIBRARY: BETA10 0x100f9660 // __ftol // LIBRARY: LEGO1 0x1008b630 @@ -702,4 +703,7 @@ // LIBRARY: BETA10 0x100fe5a0 // abort +// LIBRARY: BETA10 0x100ff82b +// __ctrandisp1 + #endif diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 5f471a8d..5ac9b2be 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -9,6 +9,7 @@ class MxMatrix : public Matrix4 { public: // FUNCTION: LEGO1 0x1006b120 + // FUNCTION: BETA10 0x10015370 MxMatrix() : Matrix4(m_elements) {} // FUNCTION: LEGO1 0x10032770 diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index a0508c4d..181acedf 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -18,6 +18,7 @@ struct UnknownMatrixType { class Matrix4 { public: // FUNCTION: LEGO1 0x10004500 + // FUNCTION: BETA10 0x1000fc70 Matrix4(float (*p_data)[4]) { SetData(p_data); } // Note: virtual function overloads appear in the virtual table @@ -27,6 +28,7 @@ public: virtual void Equals(float (*p_data)[4]) { memcpy(m_data, p_data, sizeof(float) * 4 * 4); } // vtable+0x04 // FUNCTION: LEGO1 0x10002340 + // FUNCTION: BETA10 0x1000fcf0 virtual void Equals(const Matrix4& p_matrix) { memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4); diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 451df324..9946e78e 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -22,6 +22,7 @@ OrientableROI::OrientableROI() // Maybe an overload based on MxMatrix type // FUNCTION: LEGO1 0x100a46a0 +// FUNCTION: BETA10 0x10165268 void OrientableROI::WrappedSetLocalTransform(const Matrix4& p_transform) { SetLocalTransform(p_transform); diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index e263c5b1..3d638feb 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -36,6 +36,9 @@ public: const float& Radius() const { return radius; } float& Radius() { return radius; } + // SYNTHETIC: BETA10 0x1001fb90 + // BoundingSphere::operator= + private: Mx3DPointFloat center; // 0x00 float radius; // 0x14