From c92341527ef4a3acee1c649c149dd02fc6a809a2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 21:42:21 -0400 Subject: [PATCH 01/16] Implement/match FUN_1003ef00 and related (#931) --- .../legoomni/include/legoanimationmanager.h | 2 ++ LEGO1/lego/legoomni/include/legoutils.h | 2 +- .../src/common/legoanimationmanager.cpp | 18 ++++++++++++++++++ LEGO1/lego/legoomni/src/common/legoutils.cpp | 13 ++++++++++--- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 49ee513e..30d4670b 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -85,6 +85,8 @@ class LegoAnimationManager : public MxCore { MxBool FindVehicle(const char* p_name, MxU32& p_index); MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info); MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info); + void FUN_100604d0(MxBool p_unk0x08); + void FUN_10060540(MxBool p_unk0x29); void FUN_10060570(MxBool p_unk0x1a); MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity); MxResult FUN_10060dc0( diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index b02d7a6d..cb710947 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -27,7 +27,7 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); -void FUN_1003ef00(MxBool); +void FUN_1003ef00(MxBool p_enable); void SetAppCursor(WPARAM p_wparam); MxBool FUN_1003ef60(); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 67f2e7bd..54e81dcb 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -874,6 +874,24 @@ void LegoAnimationManager::DeleteAnimations() m_suspended = suspended; } +// FUNCTION: LEGO1 0x100604d0 +// FUNCTION: BETA10 0x10041335 +void LegoAnimationManager::FUN_100604d0(MxBool p_unk0x08) +{ + for (MxS32 i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { + g_characters[i].m_unk0x08 = p_unk0x08; + } +} + +// FUNCTION: LEGO1 0x10060540 +// FUNCTION: BETA10 0x1004140f +void LegoAnimationManager::FUN_10060540(MxBool p_unk0x29) +{ + for (MxS32 i = 0; i < m_animCount; i++) { + m_anims[i].m_unk0x29 = p_unk0x29; + } +} + // FUNCTION: LEGO1 0x10060570 // FUNCTION: BETA10 0x10041463 void LegoAnimationManager::FUN_10060570(MxBool p_unk0x1a) diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 07cdde5b..ef2631b4 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -4,6 +4,7 @@ #include "act1state.h" #include "anim/legoanim.h" #include "islepathactor.h" +#include "legoanimationmanager.h" #include "legoanimpresenter.h" #include "legogamestate.h" #include "legoinputmanager.h" @@ -424,10 +425,16 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor return FALSE; } -// STUB: LEGO1 0x1003ef00 -void FUN_1003ef00(MxBool) +// FUNCTION: LEGO1 0x1003ef00 +void FUN_1003ef00(MxBool p_enable) { - // TODO (something related to animation manager) + if (p_enable) { + AnimationManager()->Resume(); + } + + AnimationManager()->FUN_1005f6d0(p_enable); + AnimationManager()->FUN_10060540(p_enable); + AnimationManager()->FUN_100604d0(p_enable); } // FUNCTION: LEGO1 0x1003ef40 From aab6a17d2f76b3db7b89c46199b4a190186873e4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 18 May 2024 11:48:07 -0400 Subject: [PATCH 02/16] Implement/match LegoAnimationManager::FUN_10064120 (#932) * Implement/match LegoAnimationManager::FUN_10064120 * Fix naming * Fix parentheses --- .../legoomni/include/legoanimationmanager.h | 4 +- .../src/common/legoanimationmanager.cpp | 102 +++++++++++++++++- LEGO1/lego/sources/geom/legounkown100db7f4.h | 20 +++- LEGO1/lego/sources/geom/legowegedge.h | 4 + 4 files changed, 125 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 30d4670b..439b9346 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -15,6 +15,7 @@ class LegoExtraActor; class LegoFile; class LegoPathBoundary; class LegoROIList; +struct LegoUnknown100db7f4; class LegoWorld; struct ModelInfo; class MxDSAction; @@ -151,7 +152,8 @@ class LegoAnimationManager : public MxCore { MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_unk0x14, MxU32 p_characterId); void FUN_10063d10(); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); - MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool, MxBool); + MxBool FUN_10064010(LegoPathBoundary*, LegoUnknown100db7f4*, float); + MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2); MxResult FUN_10064380( const char* p_name, const char* p_boundaryName, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 54e81dcb..b4db53fd 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2085,14 +2085,110 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le return TRUE; } -// STUB: LEGO1 0x10064120 -// FUNCTION: BETA10 0x100454f5 -MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool, MxBool) +// STUB: LEGO1 0x10064010 +// FUNCTION: BETA10 0x100453a5 +MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary*, LegoUnknown100db7f4*, float) { // TODO return TRUE; } +// FUNCTION: LEGO1 0x10064120 +// FUNCTION: BETA10 0x100454f5 +MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2) +{ + MxU32 local2c = 12; + float destScale = ((rand() * 0.5) / 32767.0) + 0.25; + IslePathActor* actor = CurrentActor(); + + if (actor == NULL) { + return FALSE; + } + + LegoPathBoundary* boundary = actor->GetBoundary(); + + if (boundary == NULL) { + return FALSE; + } + + Mx3DPointFloat direction = actor->GetWorldDirection(); + float local4c = 0.0f; + LegoUnknown100db7f4* local50 = NULL; + LegoS32 numEdges = boundary->GetNumEdges(); + Mx3DPointFloat vec; + LegoUnknown100db7f4* e; + MxS32 i; + + for (i = 0; i < numEdges; i++) { + e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; + e->FUN_1002ddc0(*boundary, vec); + float dot = vec.Dot(&direction, &vec); + + if (dot > local4c) { + local50 = e; + local4c = dot; + } + } + + e = local50; + do { + e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(boundary); + if (e->GetMask0x03()) { + break; + } + } while (e != local50); + + if (e == local50) { + return FALSE; + } + + LegoUnknown100db7f4* local34 = e; + LegoUnknown100db7f4* local8 = local50; + + while (local2c--) { + if (local34 != NULL) { + if (local34->Unknown(*boundary, LegoWEGEdge::c_bit1) && FUN_10064010(boundary, local34, destScale) && + (!p_bool2 || FUN_10064010(boundary, local8, destScale))) { + p_boundary->m_srcScale = p_boundary->m_destScale = destScale; + p_boundary->m_name = boundary->GetName(); + numEdges = boundary->GetNumEdges(); + + for (i = 0; i < numEdges; i++) { + LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; + + if (local34 == e) { + p_boundary->m_src = i; + } + else if (local8 == e) { + p_boundary->m_dest = i; + } + } + + return TRUE; + } + + local8 = local34; + boundary = (LegoPathBoundary*) local34->OtherFace(boundary); + local50 = local34; + + do { + if (p_bool1) { + local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(boundary); + } + else { + local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(boundary); + } + } while (!local34->GetMask0x03() && local34 != local50); + + if (local34 == local50) { + return FALSE; + } + } + } + + return FALSE; +} + // FUNCTION: LEGO1 0x10064380 // FUNCTION: BETA10 0x1004583a MxResult LegoAnimationManager::FUN_10064380( diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 0a609d51..9bbffc03 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -2,7 +2,7 @@ #define __LEGOUNKNOWN100DB7F4_H #include "legoedge.h" -#include "legoweedge.h" +#include "legowegedge.h" #include "mxgeometry/mxgeometry3d.h" // VTABLE: LEGO1 0x100db7f4 @@ -34,6 +34,24 @@ struct LegoUnknown100db7f4 : public LegoEdge { return SUCCESS; } + // FUNCTION: BETA10 0x1004a830 + LegoU32 Unknown(LegoWEGEdge& p_face, LegoU8 p_mask) + { + return (p_face.IsEqual(*m_faceB) && (m_flags & c_bit1) && (p_face.GetMask0x03() & p_mask) == p_mask) || + (p_face.IsEqual(*m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask); + } + + // FUNCTION: BETA10 0x1001cbe0 + LegoWEEdge* OtherFace(LegoWEEdge* p_other) + { + if (m_faceA == p_other) { + return m_faceB; + } + else { + return m_faceA; + } + } + LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); } // SYNTHETIC: LEGO1 0x1009a6c0 diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index e8a0c396..d0599d84 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -13,6 +13,8 @@ struct LegoPathStruct; class LegoWEGEdge : public LegoWEEdge { public: enum { + c_bit1 = 0x01, + c_bit2 = 0x02, c_bit3 = 0x04, c_bit5 = 0x10 }; @@ -53,6 +55,8 @@ class LegoWEGEdge : public LegoWEEdge { } } + inline LegoU8 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); } + // SYNTHETIC: LEGO1 0x1009a7e0 // LegoWEGEdge::`scalar deleting destructor' From c1c78cb8aadd598c71b2ab3677ecc2237dd88321 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 18 May 2024 12:26:32 -0400 Subject: [PATCH 03/16] Implement LegoAnimationManager::FUN_10064010 (#933) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 439b9346..fd1c0c9e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -152,7 +152,7 @@ class LegoAnimationManager : public MxCore { MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_unk0x14, MxU32 p_characterId); void FUN_10063d10(); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); - MxBool FUN_10064010(LegoPathBoundary*, LegoUnknown100db7f4*, float); + MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale); MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2); MxResult FUN_10064380( const char* p_name, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index b4db53fd..35a97b8d 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2085,12 +2085,27 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le return TRUE; } -// STUB: LEGO1 0x10064010 +// FUNCTION: LEGO1 0x10064010 // FUNCTION: BETA10 0x100453a5 -MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary*, LegoUnknown100db7f4*, float) +MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale) { - // TODO - return TRUE; + Mx3DPointFloat p1; + Vector3* v1 = p_edge->GetOpposingPoint(p_boundary); + Vector3* v2 = p_edge->GetPoint(p_boundary); + + p1 = *v2; + ((Vector3&) p1).Sub(v1); + ((Vector3&) p1).Mul(p_destScale); + ((Vector3&) p1).Add(v1); + + BoundingBox boundingBox; + Mx3DPointFloat vec(1.0f, 1.0f, 1.0f); + + boundingBox.Min() = p1; + boundingBox.Min().Sub(&vec); + boundingBox.Max() = p1; + boundingBox.Max().Add(&vec); + return GetViewManager()->FUN_100a6150(boundingBox) == FALSE; } // FUNCTION: LEGO1 0x10064120 From 01735bdc286a1aa39dbfc3cf8273b000f27b186a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 18 May 2024 12:27:14 -0400 Subject: [PATCH 04/16] Implement/match ViewManager::FUN_100a6150 (#934) --- LEGO1/viewmanager/viewmanager.cpp | 33 ++++++++++++++++++++++++++++--- LEGO1/viewmanager/viewmanager.h | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 9db4ba6f..e71e3d2f 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -8,6 +8,9 @@ DECOMP_SIZE_ASSERT(ViewManager, 0x1bc) +// GLOBAL: LEGO1 0x100dbc78 +int g_unk0x100dbc78[8][3] = {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {1, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}; + // GLOBAL: LEGO1 0x100dbcd8 int g_unk0x100dbcd8[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6}; @@ -55,11 +58,35 @@ ViewManager::~ViewManager() SetPOVSource(NULL); } -// STUB: LEGO1 0x100a6150 +// FUNCTION: LEGO1 0x100a6150 // FUNCTION: BETA10 0x10172164 -undefined4 ViewManager::FUN_100a6150(const BoundingBox& p_bounding_box) +unsigned int ViewManager::FUN_100a6150(const BoundingBox& p_bounding_box) { - return 1; + const Vector3* box[] = {&p_bounding_box.Min(), &p_bounding_box.Max()}; + + float und[8][3]; + int i, j, k; + + for (i = 0; i < 8; i++) { + for (j = 0; j < 3; j++) { + und[i][j] = box[g_unk0x100dbc78[i][j]]->operator[](j); + } + } + + for (i = 0; i < 6; i++) { + for (k = 0; k < 8; k++) { + if (unk0x150[i][0] * und[k][0] + unk0x150[i][2] * und[k][2] + unk0x150[i][1] * und[k][1] + unk0x150[i][3] >= + 0.0f) { + break; + } + } + + if (k == 8) { + return FALSE; + } + } + + return TRUE; } // FUNCTION: LEGO1 0x100a6410 diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index f2fdcdb4..3f9d1826 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -23,7 +23,7 @@ class ViewManager { void Remove(ViewROI* p_roi); void RemoveAll(ViewROI* p_roi); - undefined4 FUN_100a6150(const BoundingBox& p_bounding_box); + unsigned int FUN_100a6150(const BoundingBox& p_bounding_box); void FUN_100a65b0(ViewROI* p_roi, int p_und); void FUN_100a66a0(ViewROI* p_roi); void SetPOVSource(const OrientableROI* point_of_view); From 732de04433a09517cb114e749cb21f788d21e73c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 18 May 2024 14:43:19 -0400 Subject: [PATCH 05/16] Implement/match PlayCamAnim and CameraTriggerFire (#935) * Implement/match PlayCamAnim and CameraTriggerFire * Fix type * Name var --- LEGO1/lego/legoomni/include/animstate.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 8 +- .../legoomni/include/legoanimationmanager.h | 10 +- LEGO1/lego/legoomni/include/legolocations.h | 3 +- LEGO1/lego/legoomni/include/legotraninfo.h | 4 +- LEGO1/lego/legoomni/include/legoutils.h | 2 +- .../legoomni/src/actors/islepathactor.cpp | 12 +- .../src/common/legoanimationmanager.cpp | 107 +++-- .../src/common/legoanimmmpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 17 +- .../legoomni/src/entity/legolocations.cpp | 421 ++++++++++-------- LEGO1/lego/legoomni/src/worlds/isle.cpp | 4 +- LEGO1/omni/include/mxnotificationparam.h | 1 + .../omni/include/mxtype19notificationparam.h | 22 + 14 files changed, 382 insertions(+), 233 deletions(-) diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index ca1ad20a..8f3eda25 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -17,7 +17,7 @@ struct ModelInfo { struct AnimInfo { char* m_name; // 0x00 MxU32 m_objectId; // 0x04 - MxS16 m_unk0x08; // 0x08 + MxS16 m_location; // 0x08 MxBool m_unk0x0a; // 0x0a MxU8 m_unk0x0b; // 0x0b MxU8 m_unk0x0c; // 0x0c diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 569221f1..6a2c1e78 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -38,7 +38,7 @@ class IslePathActor : public LegoPathActor { float p_srcScale, MxS16 p_dest, float p_destScale, - undefined4 p_unk0x30, + MxU32 p_location, JukeboxScript::Script p_music ) { @@ -50,7 +50,7 @@ class IslePathActor : public LegoPathActor { m_srcScale = p_srcScale; m_dest = p_dest; m_destScale = p_destScale; - m_unk0x30 = p_unk0x30; + m_location = p_location; m_music = p_music; } @@ -65,7 +65,7 @@ class IslePathActor : public LegoPathActor { m_srcScale = p_location.m_srcScale; m_dest = p_location.m_dest; m_destScale = p_location.m_destScale; - m_unk0x30 = p_location.m_unk0x30; + m_location = p_location.m_location; m_music = p_location.m_music; return *this; } @@ -78,7 +78,7 @@ class IslePathActor : public LegoPathActor { float m_srcScale; // 0x24 MxS16 m_dest; // 0x28 float m_destScale; // 0x2c - undefined4 m_unk0x30; // 0x30 + MxU32 m_location; // 0x30 JukeboxScript::Script m_music; // 0x34 }; diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index fd1c0c9e..18479255 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -9,6 +9,7 @@ #include "mxgeometry/mxgeometry3d.h" class AnimState; +class IslePathActor; class LegoAnimPresenter; class LegoEntity; class LegoExtraActor; @@ -81,7 +82,7 @@ class LegoAnimationManager : public MxCore { void Suspend(); void Resume(); void FUN_1005f6d0(MxBool p_unk0x400); - void FUN_1005f700(MxBool p_unk0x3a); + void EnableCamAnims(MxBool p_enableCamAnims); MxResult LoadScriptInfo(MxS32 p_scriptIndex); MxBool FindVehicle(const char* p_name, MxU32& p_index); MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info); @@ -101,6 +102,7 @@ class LegoAnimationManager : public MxCore { MxBool p_param8, MxBool p_param9 ); + void CameraTriggerFire(IslePathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool); void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); @@ -183,8 +185,8 @@ class LegoAnimationManager : public MxCore { MxPresenter* m_unk0x28[2]; // 0x28 MxLong m_unk0x30[2]; // 0x30 MxBool m_unk0x38; // 0x38 - MxBool m_unk0x39; // 0x39 - MxBool m_unk0x3a; // 0x3a + MxBool m_animRunning; // 0x39 + MxBool m_enableCamAnims; // 0x3a Extra m_extras[40]; // 0x3c MxU32 m_lastExtraCharacterId; // 0x3fc MxBool m_unk0x400; // 0x400 @@ -199,7 +201,7 @@ class LegoAnimationManager : public MxCore { undefined4 m_unk0x41c; // 0x41c AnimState* m_animState; // 0x420 LegoROIList* m_unk0x424; // 0x424 - MxBool m_unk0x428; // 0x428 + MxBool m_suspendedEnableCamAnims; // 0x428 MxBool m_unk0x429; // 0x429 MxBool m_unk0x42a; // 0x42a MxBool m_suspended; // 0x42b diff --git a/LEGO1/lego/legoomni/include/legolocations.h b/LEGO1/lego/legoomni/include/legolocations.h index a049dc2f..35806a30 100644 --- a/LEGO1/lego/legoomni/include/legolocations.h +++ b/LEGO1/lego/legoomni/include/legolocations.h @@ -23,7 +23,8 @@ struct LegoLocation { float m_up[3]; // 0x20 Boundary m_boundaryA; // 0x2c Boundary m_boundaryB; // 0x44 - undefined4 m_unk0x5c; // 0x5c + MxBool m_unk0x5c; // 0x5c + MxU8 m_frequency; // 0x5d }; extern LegoLocation g_locations[70]; diff --git a/LEGO1/lego/legoomni/include/legotraninfo.h b/LEGO1/lego/legoomni/include/legotraninfo.h index aa35f31c..d84ac175 100644 --- a/LEGO1/lego/legoomni/include/legotraninfo.h +++ b/LEGO1/lego/legoomni/include/legotraninfo.h @@ -23,7 +23,7 @@ struct LegoTranInfo { m_unk0x08 = NULL; m_unk0x0c = NULL; m_unk0x10 = 0; - m_unk0x12 = -1; + m_location = -1; m_unk0x14 = FALSE; m_unk0x1c = NULL; m_unk0x20 = NULL; @@ -42,7 +42,7 @@ struct LegoTranInfo { LegoROI* m_unk0x08; // 0x08 MxMatrix* m_unk0x0c; // 0x0c MxU8 m_unk0x10; // 0x10 - MxS16 m_unk0x12; // 0x12 + MxS16 m_location; // 0x12 MxBool m_unk0x14; // 0x14 MxBool m_unk0x15; // 0x15 MxU32 m_objectId; // 0x18 diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index cb710947..36364268 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -24,7 +24,7 @@ Extra::ActionType MatchActionString(const char*); void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender); void SetCameraControllerFromIsle(); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); -void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool); +void PlayCamAnim(IslePathActor* p_actor, undefined4 p_unused, MxU32 p_location, MxBool p_bool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool p_enable); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 02411891..91cf9804 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -498,10 +498,10 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p LegoVehicleBuildState* state = NULL; if (p_flags & c_spawnBit1) { - MxBool und = FALSE; + MxBool camAnim = FALSE; IsleScript::Script anim; - switch (g_spawnLocations[i].m_unk0x30) { + switch (g_spawnLocations[i].m_location) { case 0x00: case 0x44: break; @@ -522,7 +522,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p anim = IsleScript::c_irt007in_RunAnim; break; default: - und = TRUE; + camAnim = TRUE; break; } @@ -530,12 +530,12 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p if (AnimationManager()->FUN_10060dc0(anim, NULL, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE) == SUCCESS) { state->m_unk0x4e = TRUE; - und = FALSE; + camAnim = FALSE; } } - if (und) { - FUN_1003ecc0(this, 0, g_spawnLocations[i].m_unk0x30, TRUE); + if (camAnim) { + PlayCamAnim(this, 0, g_spawnLocations[i].m_location, TRUE); } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 35a97b8d..031fe940 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -397,7 +397,7 @@ void LegoAnimationManager::Reset(MxBool p_und) Init(); m_suspended = suspended; - m_unk0x428 = m_unk0x3a; + m_suspendedEnableCamAnims = m_enableCamAnims; m_unk0x429 = m_unk0x400; m_unk0x42a = m_unk0x402; } @@ -417,7 +417,7 @@ void LegoAnimationManager::Suspend() if (!m_suspended) { m_suspended = TRUE; - m_unk0x428 = m_unk0x3a; + m_suspendedEnableCamAnims = m_enableCamAnims; m_unk0x429 = m_unk0x400; m_unk0x42a = m_unk0x402; m_unk0x402 = FALSE; @@ -460,7 +460,7 @@ void LegoAnimationManager::Suspend() m_unk0x18 = 0; m_unk0x1a = FALSE; - m_unk0x3a = FALSE; + m_enableCamAnims = FALSE; m_unk0x400 = FALSE; m_unk0x414 = 0; m_unk0x401 = FALSE; @@ -478,7 +478,7 @@ void LegoAnimationManager::Resume() if (m_suspended) { m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); m_unk0x410 = 5000; - m_unk0x3a = m_unk0x428; + m_enableCamAnims = m_suspendedEnableCamAnims; m_unk0x400 = m_unk0x429; m_unk0x402 = m_unk0x42a; m_suspended = FALSE; @@ -513,8 +513,8 @@ void LegoAnimationManager::Init() } m_unk0x38 = FALSE; - m_unk0x39 = FALSE; - m_unk0x3a = TRUE; + m_animRunning = FALSE; + m_enableCamAnims = TRUE; m_lastExtraCharacterId = 0; m_unk0x400 = FALSE; m_unk0x414 = 0; @@ -564,13 +564,13 @@ void LegoAnimationManager::FUN_1005f6d0(MxBool p_unk0x400) // FUNCTION: LEGO1 0x1005f700 // FUNCTION: BETA10 0x1004024c -void LegoAnimationManager::FUN_1005f700(MxBool p_unk0x3a) +void LegoAnimationManager::EnableCamAnims(MxBool p_enableCamAnims) { if (m_suspended) { - m_unk0x428 = p_unk0x3a; + m_suspendedEnableCamAnims = p_enableCamAnims; } else { - m_unk0x3a = p_unk0x3a; + m_enableCamAnims = p_enableCamAnims; } } @@ -597,7 +597,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) } m_unk0x38 = FALSE; - m_unk0x39 = FALSE; + m_animRunning = FALSE; m_unk0x430 = FALSE; m_unk0x42c = NULL; @@ -681,7 +681,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_anims[j].m_unk0x2a[k] = -1; } - if (m_anims[j].m_unk0x08 == -1) { + if (m_anims[j].m_location == -1) { for (MxS32 l = 0; l < m_anims[j].m_modelCount; l++) { MxS32 index = GetCharacterIndex(m_anims[j].m_models[l].m_name); @@ -714,10 +714,10 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_unk0x402 = TRUE; if (m_suspended) { - m_unk0x428 = m_unk0x3a; + m_suspendedEnableCamAnims = m_enableCamAnims; m_unk0x429 = m_unk0x400; m_unk0x42a = TRUE; - m_unk0x3a = FALSE; + m_enableCamAnims = FALSE; m_unk0x400 = FALSE; m_unk0x402 = FALSE; } @@ -769,7 +769,7 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info) goto done; } - if (p_file->Read(&p_info->m_unk0x08, sizeof(p_info->m_unk0x08)) == FAILURE) { + if (p_file->Read(&p_info->m_location, sizeof(p_info->m_location)) == FAILURE) { goto done; } if (p_file->Read(&p_info->m_unk0x0a, sizeof(p_info->m_unk0x0a)) == FAILURE) { @@ -896,7 +896,7 @@ void LegoAnimationManager::FUN_10060540(MxBool p_unk0x29) // FUNCTION: BETA10 0x10041463 void LegoAnimationManager::FUN_10060570(MxBool p_unk0x1a) { - m_unk0x39 = FALSE; + m_animRunning = FALSE; m_unk0x430 = FALSE; m_unk0x42c = NULL; @@ -938,7 +938,7 @@ MxResult LegoAnimationManager::FUN_100605e0( AnimInfo& animInfo = m_anims[p_index]; if (!p_bool1) { - if (m_unk0x39 || !animInfo.m_unk0x29) { + if (m_animRunning || !animInfo.m_unk0x29) { return FAILURE; } @@ -958,7 +958,7 @@ MxResult LegoAnimationManager::FUN_100605e0( tranInfo->m_index = ++m_unk0x1c; tranInfo->m_unk0x10 = 0; tranInfo->m_unk0x08 = p_roi; - tranInfo->m_unk0x12 = m_anims[p_index].m_unk0x08; + tranInfo->m_location = m_anims[p_index].m_location; tranInfo->m_unk0x14 = p_unk0x0a; tranInfo->m_objectId = animInfo.m_objectId; tranInfo->m_unk0x15 = p_bool2; @@ -1002,7 +1002,7 @@ MxResult LegoAnimationManager::FUN_100605e0( } } - m_unk0x39 = TRUE; + m_animRunning = TRUE; result = SUCCESS; } } @@ -1024,7 +1024,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix info->m_index = ++m_unk0x1c; info->m_unk0x10 = 0; info->m_unk0x08 = NULL; - info->m_unk0x12 = -1; + info->m_location = -1; info->m_unk0x14 = FALSE; info->m_objectId = p_objectId; @@ -1054,7 +1054,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix if (StartActionIfUnknown0x13c(action) == SUCCESS) { BackgroundAudioManager()->LowerVolume(); info->m_flags |= LegoTranInfo::c_bit2; - m_unk0x39 = TRUE; + m_animRunning = TRUE; m_unk0x404 = Timer()->GetTime(); result = SUCCESS; } @@ -1151,6 +1151,49 @@ MxResult LegoAnimationManager::FUN_10060dc0( return result; } +// FUNCTION: LEGO1 0x10060eb0 +// FUNCTION: BETA10 0x1004206c +void LegoAnimationManager::CameraTriggerFire(IslePathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool) +{ + if (Lego()->m_unk0x13c && m_enableCamAnims && !m_animRunning) { + LegoLocation* location = LegoNavController::GetLocation(p_location); + + if (location != NULL) { + if (location->m_frequency == 0) { + return; + } + + if (location->m_unk0x5c && location->m_frequency < rand() % 100) { + return; + } + } + + MxU16 unk0x0e, unk0x10; + if (FUN_100617c0(p_location, unk0x0e, unk0x10) == SUCCESS) { + MxU16 index = unk0x0e; + MxU32 unk0x22 = -1; + MxBool success = FALSE; + + for (MxU16 i = unk0x0e; i <= unk0x10; i++) { + AnimInfo& animInfo = m_anims[i]; + + if ((p_bool || !FUN_100623a0(animInfo)) && !FUN_10062710(animInfo) && animInfo.m_unk0x29 && + animInfo.m_unk0x22 < unk0x22 && (animInfo.m_unk0x22 == 0 || *animInfo.m_name != 'i') && + *animInfo.m_name != 'I') { + index = i; + unk0x22 = animInfo.m_unk0x22; + success = TRUE; + } + } + + if (success) { + FUN_100605e0(index, m_anims[index].m_unk0x0a, NULL, TRUE, NULL, FALSE, TRUE, TRUE, TRUE); + location->m_unk0x5c = TRUE; + } + } + } +} + // FUNCTION: LEGO1 0x10061010 // FUNCTION: BETA10 0x100422cc void LegoAnimationManager::FUN_10061010(MxBool p_und) @@ -1168,7 +1211,7 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und) // TODO: Match MxU32 flags = tranInfo->m_flags; - if (tranInfo->m_unk0x14 && tranInfo->m_unk0x12 != -1 && p_und) { + if (tranInfo->m_unk0x14 && tranInfo->m_location != -1 && p_und) { LegoAnim* anim; if (tranInfo->m_presenter->GetPresenter() != NULL && @@ -1211,7 +1254,7 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und) } } - m_unk0x39 = unk0x39; + m_animRunning = unk0x39; m_unk0x404 = Timer()->GetTime(); } @@ -1245,18 +1288,18 @@ void LegoAnimationManager::FUN_10061530() // FUNCTION: LEGO1 0x100617c0 // FUNCTION: BETA10 0x1004240b -MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10) +MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_location, MxU16& p_unk0x0e, MxU16& p_unk0x10) { MxResult result = FAILURE; MxU16 unk0x0e = 0; MxU16 unk0x10 = 0; MxBool success = FALSE; - if (p_unk0x08 == -1) { + if (p_location == -1) { MxS32 i; for (i = 0; i < m_animCount; i++) { - if (m_anims[i].m_unk0x08 == p_unk0x08) { + if (m_anims[i].m_location == p_location) { unk0x0e = i; success = TRUE; break; @@ -1264,7 +1307,7 @@ MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, M } if (success) { - for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + for (; i < m_animCount && m_anims[i].m_location == p_location; i++) { unk0x10 = i; } } @@ -1272,8 +1315,8 @@ MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, M else { MxS32 i; - for (i = 0; m_animCount > i && m_anims[i].m_unk0x08 != -1; i++) { - if (m_anims[i].m_unk0x08 == p_unk0x08) { + for (i = 0; m_animCount > i && m_anims[i].m_location != -1; i++) { + if (m_anims[i].m_location == p_location) { unk0x0e = i; success = TRUE; break; @@ -1281,7 +1324,7 @@ MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, M } if (success) { - for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + for (; i < m_animCount && m_anims[i].m_location == p_location; i++) { unk0x10 = i; } } @@ -1340,7 +1383,7 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param) BackgroundAudioManager()->RaiseVolume(); } - m_unk0x39 = FALSE; + m_animRunning = FALSE; m_unk0x404 = Timer()->GetTime(); found = TRUE; @@ -1441,7 +1484,7 @@ MxResult LegoAnimationManager::Tickle() FUN_10064b50(time); - if (!m_unk0x39 && time - m_unk0x404 > 10000 && speed < g_unk0x100f74b0[0][0] && speed > g_unk0x100f74b0[5][0]) { + if (!m_animRunning && time - m_unk0x404 > 10000 && speed < g_unk0x100f74b0[0][0] && speed > g_unk0x100f74b0[5][0]) { LegoPathBoundary* boundary = actor->GetBoundary(); Mx3DPointFloat position(roi->GetWorldPosition()); @@ -1809,7 +1852,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) { LegoLocation::Boundary* boundary = NULL; - if (p_und || (!m_unk0x39 && m_unk0x400)) { + if (p_und || (!m_animRunning && m_unk0x400)) { LegoWorld* world = CurrentWorld(); if (world != NULL) { diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 0a3e882b..d1c73605 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -427,7 +427,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) LegoROI* viewROI = VideoManager()->GetViewROI(); IslePathActor* actor = CurrentActor(); - if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_unk0x12 != -1 && actor != NULL) { + if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) { if (m_unk0x64 != NULL) { undefined4 und = 1; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index ef2631b4..0bc11754 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -20,6 +20,7 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstreamer.h" +#include "mxtype19notificationparam.h" #include "mxtypes.h" #include "mxutilities.h" #include "mxvariabletable.h" @@ -341,11 +342,21 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO } } -// STUB: LEGO1 0x1003ecc0 +// FUNCTION: LEGO1 0x1003ecc0 // FUNCTION: BETA10 0x100d4b38 -void FUN_1003ecc0(IslePathActor* p_actor, undefined4, undefined4, MxBool) +void PlayCamAnim(IslePathActor* p_actor, undefined4 p_unused, MxU32 p_location, MxBool p_bool) { - // TODO + LegoWorld* world = CurrentWorld(); + MxLong result = 0; + + if (world != NULL) { + MxType19NotificationParam param(c_notificationType19, p_actor, 0x43, p_location); + result = world->Notify(param); + } + + if (result == 0) { + AnimationManager()->CameraTriggerFire(p_actor, p_unused, p_location, p_bool); + } } // FUNCTION: LEGO1 0x1003eda0 diff --git a/LEGO1/lego/legoomni/src/entity/legolocations.cpp b/LEGO1/lego/legoomni/src/entity/legolocations.cpp index 68627a5d..393f4b68 100644 --- a/LEGO1/lego/legoomni/src/entity/legolocations.cpp +++ b/LEGO1/lego/legoomni/src/entity/legolocations.cpp @@ -16,9 +16,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 0}, {1, "LCAMBA1", 0.852546, @@ -30,9 +31,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_13", 2, 0.75, 0, 0.25, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 10240}, + {"EDG02_13", 2, 0.75, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 40}, {2, "LCAMBA2", 3.505301, @@ -44,9 +46,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_37", 2, 0.75, 0, 0.25, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 5120}, + {"EDG02_37", 2, 0.75, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 20}, {3, "LCAMBA3", -7.472569, @@ -58,9 +61,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_26", 0, 0.75, 2, 0.25, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 5120}, + {"EDG02_26", 0, 0.75, 2, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 20}, {4, "LCAMBA4", 38.55205, @@ -72,9 +76,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_146", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 7680}, + {"EDG00_146", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 30}, {5, "LCAMCA1", -36.778473, @@ -86,8 +91,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"INT01", 2, 0.5, 6, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"INT01", 2, 0.5, 6, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {6, "LCAMCA2", @@ -100,8 +106,9 @@ LegoLocation g_locations[] = { 0.000446, 0.999999, -0.001387, - {"EDG00_104", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG00_104", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {7, "LCAMCA3", @@ -114,8 +121,9 @@ LegoLocation g_locations[] = { -0.000173, 0.999998, 0.001888, - {"EDG02_58", 2, 0.25, 0, 0.75, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG02_58", 2, 0.25, 0, 0.75, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {8, "LCAMGS1", @@ -128,9 +136,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_40", 2, 0.25, 0, 0.25, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 17920}, + {"EDG02_40", 2, 0.25, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 70}, {9, "LCAMGS2", 25.153421, @@ -142,8 +151,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"INT19", 1, 0.75, 0, 0.75, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"INT19", 1, 0.75, 0, 0.75, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {10, "LCAMGS3", @@ -156,8 +166,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_74", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG00_74", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {11, "LCAMHO1", @@ -170,9 +181,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 12800}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 50}, {12, "LCAMHO2", 90.92687, @@ -184,8 +196,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {13, "LCAMHO3", @@ -198,8 +211,9 @@ LegoLocation g_locations[] = { 0.005781, 0.999976, 0.003708, - {"EDG02_27", 1, 0.89, 2, 0.89, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG02_27", 1, 0.89, 2, 0.89, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {14, "LCAMHO4", @@ -212,9 +226,10 @@ LegoLocation g_locations[] = { -0.034088, 0.999355, -0.011255, - {"EDG02_27", 1, 0.89, 2, 0.89, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {"EDG02_27", 1, 0.89, 2, 0.89, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {15, "LCAMIC1", 80.11602, @@ -226,8 +241,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_69", 2, 0.5, 0, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG00_69", 2, 0.5, 0, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {16, "LCAMIC2", @@ -240,8 +256,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_66", 2, 0.5, 0, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG02_66", 2, 0.5, 0, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {17, "LCAMIC3", @@ -254,9 +271,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_68", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 5120}, + {"EDG02_68", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 20}, {18, "LCAMJA1", 95.05279, @@ -268,9 +286,10 @@ LegoLocation g_locations[] = { -0.006372, 0.999977, -0.002478, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {19, "LCAMJA2", 97.214066, @@ -282,8 +301,9 @@ LegoLocation g_locations[] = { -0.010811, 0.999927, 0.005453, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {20, "LCAMJA3", @@ -296,8 +316,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"INT33", 1, 0.9, 3, 0.9, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"INT33", 1, 0.9, 3, 0.9, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {21, "LCAMJA4", @@ -310,8 +331,9 @@ LegoLocation g_locations[] = { -0.001442, 0.999945, 0.010407, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {22, "LCAMJA5", @@ -324,8 +346,9 @@ LegoLocation g_locations[] = { -0.007107, 0.999949, -0.007199, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {23, "LCAMJS1", @@ -338,9 +361,10 @@ LegoLocation g_locations[] = { 0.000653, 0.999999, -0.000932, - {"INT26", 0, 0.5, 3, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {"INT26", 0, 0.5, 3, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {24, "LCAMJS2", 14.753909, @@ -352,9 +376,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {25, "LCAMJS3", 12.373611, @@ -366,9 +391,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {26, "LCAMJS4", 27.136557, @@ -380,8 +406,9 @@ LegoLocation g_locations[] = { -0.000261, 0.999999, -0.001364, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {27, "LCAMMT1", @@ -394,9 +421,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 12800}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 50}, {28, "LCAMMT2", -58.28056, @@ -408,8 +436,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {29, "LCAMPK1", @@ -422,9 +451,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_83", 0, 0.9, 2, 0.9, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 12800}, + {"EDG00_83", 0, 0.9, 2, 0.9, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 50}, {30, "LCAMPK2", 63.75, @@ -436,8 +466,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {31, "LCAMPK4", @@ -450,9 +481,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {32, "LCAMPO1", -24.38507, @@ -464,9 +496,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 5120}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 20}, {33, "LCAMPO2", -41.35899, @@ -478,8 +511,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_191", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG00_191", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {34, "LCAMPS1", @@ -492,9 +526,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_40", 0, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {"EDG02_40", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {35, "LCAMPS2", 70.99095, @@ -506,9 +541,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {36, "LCAMPS3", 73.92391, @@ -520,9 +556,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_66", 1, 0.15, 2, 0.15, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {"EDG02_66", 1, 0.15, 2, 0.15, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {37, "LCAMPS4", 61.471172, @@ -534,8 +571,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG02_40", 0, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG02_40", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {38, "LCAMPZ1", @@ -548,9 +586,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 20480}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 80}, {39, "LCAMPZ2", -21.870003, @@ -562,9 +601,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 23040}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 90}, {40, "LCAMPZ3", -21.860731, @@ -576,9 +616,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG00_24", 0, 0.9, 2, 0.9, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {"EDG00_24", 0, 0.9, 2, 0.9, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {41, "LCAMPZ4", -20.492962, @@ -590,9 +631,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 0}, {42, "LCAMPZ5", -11.0625, @@ -604,9 +646,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 12800}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 50}, {43, "LCAMPZ6", -14.837131, @@ -618,8 +661,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {44, "LCAMPZ7", @@ -632,8 +676,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {45, "LCAMRA1", @@ -646,8 +691,9 @@ LegoLocation g_locations[] = { -0.007751, 0.998685, -0.050677, - {"EDG00_03", 1, 0.5, 3, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG00_03", 1, 0.5, 3, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {46, "LCAMRA2", @@ -660,9 +706,10 @@ LegoLocation g_locations[] = { -0.000078, 1, 0.000105, - {"EDG01_17", 0, 0.5, 3, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {"EDG01_17", 0, 0.5, 3, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {47, "LCAMRA3", -57.06778, @@ -674,8 +721,9 @@ LegoLocation g_locations[] = { -0.000112, 1, 0.000021, - {"EDG01_40", 2, 0.5, 0, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG01_40", 2, 0.5, 0, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {48, "LCAMRA4", @@ -688,9 +736,10 @@ LegoLocation g_locations[] = { 0.035939, 0.999346, -0.00388, - {"EDG01_27", 0, 0.5, 2, 0.5, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {"EDG01_27", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {49, "LCAMRA5", -84.27638, @@ -702,9 +751,10 @@ LegoLocation g_locations[] = { 0.024875, 0.999675, -0.005499, - {"EDG01_08", 2, 0.7, 0, 0.7, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, - 6400}, + {"EDG01_08", 2, 0.7, 0, 0.7, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 25}, {50, "LCAMRA6", -86.96998, @@ -716,8 +766,9 @@ LegoLocation g_locations[] = { 0.000378, 1, 0.000009, - {"EDG01_13", 1, 0.2, 0, 0.2, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG01_13", 1, 0.2, 0, 0.2, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {51, "LCAMRT1", @@ -730,9 +781,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 20480}, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 80}, {52, "LCAMRT2", -2.950222, @@ -744,9 +796,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {53, "LCAMRT3", -0.87654, @@ -758,9 +811,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, {54, "LCAMRT4", 0.4375, @@ -772,9 +826,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 0}, {55, "LCAMRT5", -27.213715, @@ -786,8 +841,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG03_05", 1, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"EDG03_05", 1, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {56, "LCAMRT6", @@ -800,9 +856,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 15360}, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 60}, {57, "LCAMST1", -40.1615, @@ -814,9 +871,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 5120}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 20}, {58, "LCAMST2", -48.750553, @@ -828,8 +886,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {59, "LCAMZG1", @@ -842,8 +901,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {"INT22", 0, 0.4, 2, 0.4, TRUE}, - {NULL, 0, 0, 0, 0, FALSE}, + {"INT22", 0, 0.4, 2, 0.4, 1}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {60, "LCAMZI1", @@ -856,9 +916,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 0}, {61, "LCAMZI2", 93.37283, @@ -870,9 +931,10 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 0}, {62, "LCAMZIE", 93.375, @@ -884,8 +946,9 @@ LegoLocation g_locations[] = { 0.254493, 0.967075, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {63, "LCAMZIN", @@ -898,8 +961,9 @@ LegoLocation g_locations[] = { 0, 0.967203, 0.254006, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {64, "LCAMZIS", @@ -912,8 +976,9 @@ LegoLocation g_locations[] = { 0, 0.966946, -0.254982, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {65, "LCAMZIW", @@ -926,8 +991,9 @@ LegoLocation g_locations[] = { -0.254493, 0.967075, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {66, "LCAMZP1", @@ -940,8 +1006,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {67, "LCAMRT7", @@ -954,8 +1021,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, 0}, {68, "LCAMJS5", @@ -968,8 +1036,9 @@ LegoLocation g_locations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, FALSE}, - {NULL, 0, 0, 0, 0, FALSE}, - 25600}, - {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, {NULL, 0, 0, 0, 0, FALSE}, {NULL, 0, 0, 0, 0, FALSE}, 0} + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + FALSE, + 100}, + {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, FALSE, 0} }; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 21d95cac..555d8317 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -722,7 +722,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 8; AnimationManager()->FUN_1005f6d0(FALSE); - AnimationManager()->FUN_1005f700(FALSE); + AnimationManager()->EnableCamAnims(FALSE); g_unk0x100f1198 &= ~c_bit7; m_towtrack->FUN_1004dab0(); @@ -731,7 +731,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 10; AnimationManager()->FUN_1005f6d0(FALSE); - AnimationManager()->FUN_1005f700(FALSE); + AnimationManager()->EnableCamAnims(FALSE); g_unk0x100f1198 &= ~c_bit7; m_ambulance->FUN_10036e60(); diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index afe2282b..fd0990f9 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -38,6 +38,7 @@ enum NotificationId { // SIZE 0x0c class MxNotificationParam : public MxParam { public: + inline MxNotificationParam() : m_type(c_notificationType0), m_sender(NULL) {} inline MxNotificationParam(NotificationId p_type, MxCore* p_sender) : MxParam(), m_type(p_type), m_sender(p_sender) { } diff --git a/LEGO1/omni/include/mxtype19notificationparam.h b/LEGO1/omni/include/mxtype19notificationparam.h index 51a6a713..0833f299 100644 --- a/LEGO1/omni/include/mxtype19notificationparam.h +++ b/LEGO1/omni/include/mxtype19notificationparam.h @@ -7,9 +7,31 @@ // VTABLE: LEGO1 0x100d6230 // SIZE 0x10 class MxType19NotificationParam : public MxNotificationParam { +public: + MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxU16 p_unk0x0c) + : MxNotificationParam() + { + m_type = p_type; + m_sender = p_sender; + m_unk0x0c = p_unk0x0c; + m_unk0x0e = p_unk0x0e; + } + + // FUNCTION: LEGO1 0x1001bac0 + MxNotificationParam* Clone() const override + { + return new MxType19NotificationParam(m_type, m_sender, m_unk0x0e, m_unk0x0c); + } // vtable+0x04 + protected: MxU16 m_unk0x0c; // 0x0c MxU8 m_unk0x0e; // 0x0e }; +// SYNTHETIC: LEGO1 0x1001bb80 +// MxType19NotificationParam::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001bbf0 +// MxType19NotificationParam::~MxType19NotificationParam + #endif // MXTYPE19NOTIFICATIONPARAM_H From 73844f14fa99cbbba694e0d353a416e7c1b0456c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 18 May 2024 15:05:45 -0400 Subject: [PATCH 06/16] Implement/match LegoAnimationManager::FUN_10063fb0 (#936) --- .../legoomni/src/common/legoanimationmanager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 031fe940..3aee0c1a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2120,12 +2120,18 @@ void LegoAnimationManager::FUN_10063d10() } } -// STUB: LEGO1 0x10063fb0 +// FUNCTION: LEGO1 0x10063fb0 // FUNCTION: BETA10 0x100452a7 MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world) { - // TODO - return TRUE; + if (p_boundary->m_name != NULL) { + Mx3DPointFloat vec; + LegoPathBoundary* boundary = p_world->FindPathBoundary(p_boundary->m_name); + LegoUnknown100db7f4* pSrcE = (LegoUnknown100db7f4*) boundary->GetEdges()[p_boundary->m_src]; + return FUN_10064010(boundary, pSrcE, p_boundary->m_srcScale); + } + + return FALSE; } // FUNCTION: LEGO1 0x10064010 From d106aada11bb19d9d75c6b941dd376c686c9fe2c Mon Sep 17 00:00:00 2001 From: Cameron <25990062+crtdll@users.noreply.github.com> Date: Sat, 18 May 2024 20:20:05 +0100 Subject: [PATCH 07/16] basic name improvements (#930) * basic name improvements * clang-format --------- Co-authored-by: Christian Semmler --- CONFIG/MainDlg.cpp | 7 ++-- CONFIG/config.cpp | 20 ++++++------ CONFIG/config.h | 8 ++--- .../legoomni/include/legocachesoundmanager.h | 4 +-- LEGO1/lego/legoomni/include/skateboard.h | 4 +-- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 2 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 8 ++--- .../src/audio/legocachesoundmanager.cpp | 8 ++--- .../src/audio/legoloadcachesoundpresenter.cpp | 2 +- .../src/build/legobuildingmanager.cpp | 6 ++-- .../src/common/legocharactermanager.cpp | 4 +-- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 4 +-- .../lego/legoomni/src/paths/legopathactor.cpp | 4 +-- .../legoomni/src/video/legomodelpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- LEGO1/omni/include/mxregioncursor.h | 6 ++-- LEGO1/omni/include/mxregionlist.h | 4 +-- LEGO1/omni/src/video/mxregion.cpp | 10 +++--- LEGO1/omni/src/video/mxregioncursor.cpp | 30 ++++++++--------- LEGO1/realtime/orientableroi.cpp | 2 +- LEGO1/realtime/orientableroi.h | 2 +- LEGO1/viewmanager/viewmanager.cpp | 32 +++++++++---------- LEGO1/viewmanager/viewmanager.h | 8 ++--- 23 files changed, 90 insertions(+), 89 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 84083892..58560301 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -177,7 +177,7 @@ void CMainDialog::UpdateInterface() CheckDlgButton(IDC_CHK_FLIP_VIDEO_MEM_PAGES, currentConfigApp->m_flip_surfaces); CheckDlgButton(IDC_CHK_3D_VIDEO_MEMORY, currentConfigApp->m_3d_video_ram); BOOL full_screen = currentConfigApp->m_full_screen; - currentConfigApp->FUN_00403810(); + currentConfigApp->AdjustDisplayBitDepthBasedOnRenderStatus(); if (currentConfigApp->GetHardwareDeviceColorModel()) { CheckDlgButton(IDC_CHK_DRAW_CURSOR, TRUE); } @@ -198,8 +198,9 @@ void CMainDialog::UpdateInterface() CheckDlgButton(IDC_RAD_PALETTE_16BIT, 0); currentConfigApp->m_display_bit_depth = 0; } - GetDlgItem(IDC_RAD_PALETTE_256)->EnableWindow(full_screen && currentConfigApp->FUN_004037a0()); - GetDlgItem(IDC_RAD_PALETTE_16BIT)->EnableWindow(full_screen && currentConfigApp->FUN_004037e0()); + GetDlgItem(IDC_RAD_PALETTE_256) + ->EnableWindow(full_screen && currentConfigApp->GetConditionalDeviceRenderBitDepth()); + GetDlgItem(IDC_RAD_PALETTE_16BIT)->EnableWindow(full_screen && currentConfigApp->GetDeviceRenderBitStatus()); CheckDlgButton(IDC_CHK_3DSOUND, currentConfigApp->m_3d_sound); CheckDlgButton(IDC_CHK_DRAW_CURSOR, currentConfigApp->m_draw_cursor); switch (currentConfigApp->m_model_quality) { diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 78c6b6c2..4e1a2264 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -198,7 +198,7 @@ BOOL CConfigApp::ReadRegInt(LPCSTR p_key, int* p_value) const } // FUNCTION: CONFIG 0x004033d0 -BOOL CConfigApp::FUN_004033d0() const +BOOL CConfigApp::IsDeviceInBasicRGBMode() const { /* * BUG: should be: @@ -286,7 +286,7 @@ BOOL CConfigApp::ValidateSettings() m_full_screen = TRUE; is_modified = TRUE; } - if (FUN_004033d0()) { + if (IsDeviceInBasicRGBMode()) { if (m_3d_video_ram) { m_3d_video_ram = FALSE; is_modified = TRUE; @@ -340,9 +340,9 @@ BOOL CConfigApp::ValidateSettings() } // FUNCTION: CONFIG 0x004037a0 -DWORD CConfigApp::FUN_004037a0() const +DWORD CConfigApp::GetConditionalDeviceRenderBitDepth() const { - if (FUN_004033d0()) { + if (IsDeviceInBasicRGBMode()) { return 0; } if (GetHardwareDeviceColorModel()) { @@ -352,7 +352,7 @@ DWORD CConfigApp::FUN_004037a0() const } // FUNCTION: CONFIG 0x004037e0 -DWORD CConfigApp::FUN_004037e0() const +DWORD CConfigApp::GetDeviceRenderBitStatus() const { if (GetHardwareDeviceColorModel()) { return m_device->m_HWDesc.dwDeviceRenderBitDepth & 0x400; @@ -363,23 +363,23 @@ DWORD CConfigApp::FUN_004037e0() const } // FUNCTION: CONFIG 0x00403810 -BOOL CConfigApp::FUN_00403810() +BOOL CConfigApp::AdjustDisplayBitDepthBasedOnRenderStatus() { if (m_display_bit_depth == 8) { - if (FUN_004037a0()) { + if (GetConditionalDeviceRenderBitDepth()) { return FALSE; } } if (m_display_bit_depth == 16) { - if (FUN_004037e0()) { + if (GetDeviceRenderBitStatus()) { return FALSE; } } - if (FUN_004037a0()) { + if (GetConditionalDeviceRenderBitDepth()) { m_display_bit_depth = 8; return TRUE; } - if (FUN_004037e0()) { + if (GetDeviceRenderBitStatus()) { m_display_bit_depth = 16; return TRUE; } diff --git a/CONFIG/config.h b/CONFIG/config.h index 75195e7e..63f88eaa 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -34,14 +34,14 @@ class CConfigApp : public CWinApp { BOOL ReadReg(LPCSTR p_key, LPCSTR p_value, DWORD p_size) const; BOOL ReadRegBool(LPCSTR p_key, BOOL* p_bool) const; BOOL ReadRegInt(LPCSTR p_key, int* p_value) const; - BOOL FUN_004033d0() const; + BOOL IsDeviceInBasicRGBMode() const; D3DCOLORMODEL GetHardwareDeviceColorModel() const; BOOL IsPrimaryDriver() const; BOOL ReadRegisterSettings(); BOOL ValidateSettings(); - DWORD FUN_004037a0() const; - DWORD FUN_004037e0() const; - BOOL FUN_00403810(); + DWORD GetConditionalDeviceRenderBitDepth() const; + DWORD GetDeviceRenderBitStatus() const; + BOOL AdjustDisplayBitDepthBasedOnRenderStatus(); void CConfigApp::WriteRegisterSettings() const; //{{AFX_MSG(CConfigApp) diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index 67d139ff..e8dbc204 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -54,8 +54,8 @@ class LegoCacheSoundManager { virtual MxResult Tickle(); // vtable+0x00 - LegoCacheSound* FUN_1003d170(const char* p_key); - LegoCacheSound* FUN_1003d290(LegoCacheSound* p_sound); + LegoCacheSound* FindSoundByKey(const char* p_key); + LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); void FUN_1003dc40(LegoCacheSound** p_und); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 63a2bb87..c42d3fe0 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -32,13 +32,13 @@ class SkateBoard : public IslePathActor { MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 void VTable0xe4() override; // vtable+0xe4 - void FUN_10010510(); + void ActivateSceneActions(); // SYNTHETIC: LEGO1 0x1000ff60 // SkateBoard::`scalar deleting destructor' private: - void FUN_10010270(MxBool p_enable); + void EnableScenePresentation(MxBool p_enable); MxBool m_unk0x160; // 0x160 Act1State* m_act1state; // 0x164 diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 0bc064b5..f4a92d51 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -340,7 +340,7 @@ MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param) void Helicopter::VTable0x74(Matrix4& p_transform) { if (m_userNavFlag) { - m_roi->FUN_100a46b0(p_transform); + m_roi->UpdateTransformationRelativeToParent(p_transform); FUN_10010c30(); } else { diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 352e0bba..8b010eb3 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -98,7 +98,7 @@ MxU32 SkateBoard::VTable0xcc() ControlManager()->Register(this); } - FUN_10010270(m_unk0x160); + EnableScenePresentation(m_unk0x160); Vector3 position = m_roi->GetWorldPosition(); AnimationManager()->FUN_10064670(&position); @@ -122,7 +122,7 @@ MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) // FUNCTION: LEGO1 0x10010270 // FUNCTION: BETA10 0x100f5366 -void SkateBoard::FUN_10010270(MxBool p_enable) +void SkateBoard::EnableScenePresentation(MxBool p_enable) { m_act1state = (Act1State*) GameState()->GetState("Act1State"); if (!m_act1state) { @@ -142,12 +142,12 @@ void SkateBoard::FUN_10010270(MxBool p_enable) // FUNCTION: BETA10 0x100f5472 MxU32 SkateBoard::VTable0xd0() { - FUN_10010270(m_unk0x160); + EnableScenePresentation(m_unk0x160); return 1; } // FUNCTION: LEGO1 0x10010510 -void SkateBoard::FUN_10010510() +void SkateBoard::ActivateSceneActions() { if (m_act1state->m_unk0x018 != 3) { PlayMusic(JukeboxScript::c_BeachBlvd_Music); diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index e611484b..8d645dfd 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -61,7 +61,7 @@ MxResult LegoCacheSoundManager::Tickle() } // STUB: LEGO1 0x1003d170 -LegoCacheSound* LegoCacheSoundManager::FUN_1003d170(const char* p_key) +LegoCacheSound* LegoCacheSoundManager::FindSoundByKey(const char* p_key) { // TODO char* x = new char[strlen(p_key) + 1]; @@ -78,7 +78,7 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003d170(const char* p_key) } // FUNCTION: LEGO1 0x1003d290 -LegoCacheSound* LegoCacheSoundManager::FUN_1003d290(LegoCacheSound* p_sound) +LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) { Set100d6b4c::iterator it = m_set.find(LegoCacheSoundEntry(p_sound)); if (it != m_set.end()) { @@ -107,7 +107,7 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003d290(LegoCacheSound* p_sound) LegoCacheSound* LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three) { // DECOMP: Second parameter is LegoRoi::m_name (0xe4) - return FUN_1003db10(FUN_1003d170(p_one), p_two, p_three); + return FUN_1003db10(FindSoundByKey(p_one), p_two, p_three); } // FUNCTION: LEGO1 0x1003db10 @@ -121,7 +121,7 @@ LegoCacheSound* LegoCacheSoundManager::FUN_1003db10(LegoCacheSound* p_one, const LegoCacheSound* result = p_one->FUN_10006960(); if (result) { - LegoCacheSound* t = FUN_1003d290(result); + LegoCacheSound* t = ManageSoundEntry(result); t->FUN_10006a30(p_two, p_three); return t; } diff --git a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp index 59ca793b..7bf31340 100644 --- a/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp @@ -79,7 +79,7 @@ MxResult LegoLoadCacheSoundPresenter::PutData() m_criticalSection.Enter(); if (m_currentTickleState == e_done) { - m_cacheSound = SoundManager()->GetCacheSoundManager()->FUN_1003d290(m_cacheSound); + m_cacheSound = SoundManager()->GetCacheSoundManager()->ManageSoundEntry(m_cacheSound); m_unk0x7c = 1; } diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 5d2c1259..3aeef9bb 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -298,7 +298,7 @@ void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world) AdjustHeight(p_index); MxMatrix mat = roi->GetLocal2World(); mat[3][1] = g_buildingInfo[p_index].m_unk0x014; - roi->FUN_100a46b0(mat); + roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*roi); } } @@ -618,7 +618,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length m_world = CurrentWorld(); if (p_haveSound) { - m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003d170("bcrash"); + m_sound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); m_sound->FUN_10006cb0(35, 60); } @@ -674,7 +674,7 @@ void LegoBuildingManager::FUN_10030590() LegoROI* roi = g_buildingInfo[i].m_entity->GetROI(); MxMatrix mat = roi->GetLocal2World(); mat[3][1] = g_buildingInfo[i].m_unk0x014; - roi->FUN_100a46b0(mat); + roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->Moved(*roi); } } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 891a6471..856ff777 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -609,7 +609,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex lodList = dupLodList; if (head->GetUnknown0xe0() >= 0) { - VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->FUN_100a66a0(head); + VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(head); } head->SetLODList(lodList); @@ -744,7 +744,7 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) lodList = dupLodList; if (childROI->GetUnknown0xe0() >= 0) { - VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->FUN_100a66a0(childROI); + VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(childROI); } childROI->SetLODList(lodList); diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 192fc804..c4a09084 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -130,7 +130,7 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) mat ); - m_roi->FUN_100a46b0(mat); + m_roi->UpdateTransformationRelativeToParent(mat); } m_roi->SetEntity(this); @@ -170,7 +170,7 @@ void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_directi mat ); - m_roi->FUN_100a46b0(mat); + m_roi->UpdateTransformationRelativeToParent(mat); VideoManager()->Get3DManager()->GetLego3DView()->Moved(*m_roi); if (p_und) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index a893ba53..f332a51e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -135,7 +135,7 @@ MxResult LegoPathActor::VTable0x88( } right.EqualsCross(&up, &dir); - m_roi->FUN_100a46b0(matrix); + m_roi->UpdateTransformationRelativeToParent(matrix); if (!m_cameraFlag || !m_userNavFlag) { p5.EqualsCross(p_boundary->GetUnknown0x14(), &p3); @@ -201,7 +201,7 @@ MxResult LegoPathActor::VTable0x84( } right.EqualsCross(&up, &dir); - m_roi->FUN_100a46b0(matrix); + m_roi->UpdateTransformationRelativeToParent(matrix); if (!m_cameraFlag || !m_userNavFlag) { p5.EqualsCross(p_boundary->GetUnknown0x14(), &p3); diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 79c481c4..7395ccfc 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -180,7 +180,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk) Mx3DPointFloat(m_action->GetUp().GetX(), m_action->GetUp().GetY(), m_action->GetUp().GetZ()), mat ); - m_roi->FUN_100a46b0(mat); + m_roi->UpdateTransformationRelativeToParent(mat); result = SUCCESS; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 555d8317..41e1a61c 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -940,7 +940,7 @@ MxLong Isle::HandleTransitionEnd() FUN_10032d30(IsleScript::c_SkatePizza_Bitmap, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { - m_skateboard->FUN_10010510(); + m_skateboard->ActivateSceneActions(); } break; case LegoGameState::e_ambulance: diff --git a/LEGO1/omni/include/mxregioncursor.h b/LEGO1/omni/include/mxregioncursor.h index e114c7ed..692ccce9 100644 --- a/LEGO1/omni/include/mxregioncursor.h +++ b/LEGO1/omni/include/mxregioncursor.h @@ -28,10 +28,10 @@ class MxRegionCursor : public MxCore { virtual void Reset(); // vtable+0x3c private: - void FUN_100c46c0(MxRegionLeftRightList& p_leftRightList); + void ResetAndInitializeCursor(MxRegionLeftRightList& p_leftRightList); void UpdateRect(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom); - void FUN_100c4a20(MxRect32& p_rect); - void FUN_100c4b50(MxRect32& p_rect); + void ProcessRectOverlapAscending(MxRect32& p_rect); + void ProcessOverlapWithRect(MxRect32& p_rect); MxRegion* m_region; // 0x08 MxRect32* m_rect; // 0x0c diff --git a/LEGO1/omni/include/mxregionlist.h b/LEGO1/omni/include/mxregionlist.h index b7eff3ae..0fe2dc56 100644 --- a/LEGO1/omni/include/mxregionlist.h +++ b/LEGO1/omni/include/mxregionlist.h @@ -64,8 +64,8 @@ struct MxRegionTopBottom { ~MxRegionTopBottom() { delete m_leftRightList; } MxRegionTopBottom* Clone(); - void FUN_100c5280(MxS32 p_left, MxS32 p_right); - MxBool FUN_100c57b0(MxRect32& p_rect); + void MergeOrExpandRegions(MxS32 p_left, MxS32 p_right); + MxBool CheckHorizontalOverlap(MxRect32& p_rect); inline MxS32 GetTop() { return m_top; } inline MxS32 GetBottom() { return m_bottom; } diff --git a/LEGO1/omni/src/video/mxregion.cpp b/LEGO1/omni/src/video/mxregion.cpp index ca3698e9..f499d54e 100644 --- a/LEGO1/omni/src/video/mxregion.cpp +++ b/LEGO1/omni/src/video/mxregion.cpp @@ -67,12 +67,12 @@ void MxRegion::VTable0x18(MxRect32& p_rect) MxRegionTopBottom* newTopBottom = topBottom->Clone(); newTopBottom->SetBottom(rect.GetBottom()); topBottom->SetTop(rect.GetBottom()); - newTopBottom->FUN_100c5280(rect.GetLeft(), rect.GetRight()); + newTopBottom->MergeOrExpandRegions(rect.GetLeft(), rect.GetRight()); cursor.Prepend(newTopBottom); rect.SetTop(rect.GetBottom()); } else { - topBottom->FUN_100c5280(rect.GetLeft(), rect.GetRight()); + topBottom->MergeOrExpandRegions(rect.GetLeft(), rect.GetRight()); rect.SetTop(topBottom->GetBottom()); } } @@ -100,7 +100,7 @@ MxBool MxRegion::VTable0x1c(MxRect32& p_rect) if (topBottom->GetTop() >= p_rect.GetBottom()) { return FALSE; } - if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->FUN_100c57b0(p_rect)) { + if (topBottom->GetBottom() > p_rect.GetTop() && topBottom->CheckHorizontalOverlap(p_rect)) { return TRUE; } } @@ -128,7 +128,7 @@ MxRegionTopBottom::MxRegionTopBottom(MxRect32& p_rect) } // FUNCTION: LEGO1 0x100c5280 -void MxRegionTopBottom::FUN_100c5280(MxS32 p_left, MxS32 p_right) +void MxRegionTopBottom::MergeOrExpandRegions(MxS32 p_left, MxS32 p_right) { MxRegionLeftRightListCursor a(m_leftRightList); MxRegionLeftRightListCursor b(m_leftRightList); @@ -190,7 +190,7 @@ MxRegionTopBottom* MxRegionTopBottom::Clone() } // FUNCTION: LEGO1 0x100c57b0 -MxBool MxRegionTopBottom::FUN_100c57b0(MxRect32& p_rect) +MxBool MxRegionTopBottom::CheckHorizontalOverlap(MxRect32& p_rect) { MxRegionLeftRightListCursor cursor(m_leftRightList); MxRegionLeftRight* leftRight; diff --git a/LEGO1/omni/src/video/mxregioncursor.cpp b/LEGO1/omni/src/video/mxregioncursor.cpp index 6b74ee3f..7fd4ddc8 100644 --- a/LEGO1/omni/src/video/mxregioncursor.cpp +++ b/LEGO1/omni/src/video/mxregioncursor.cpp @@ -34,7 +34,7 @@ MxRect32* MxRegionCursor::VTable0x18() MxRegionTopBottom* topBottom; if (m_topBottomCursor->Current(topBottom)) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); MxRegionLeftRight* leftRight; m_leftRightCursor->First(leftRight); @@ -55,7 +55,7 @@ MxRect32* MxRegionCursor::VTable0x20() MxRegionTopBottom* topBottom; if (m_topBottomCursor->Current(topBottom)) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); MxRegionLeftRight* leftRight; m_leftRightCursor->Last(leftRight); @@ -83,7 +83,7 @@ MxRect32* MxRegionCursor::VTable0x28() } if (m_topBottomCursor->Next(topBottom)) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); m_leftRightCursor->First(leftRight); UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); @@ -108,7 +108,7 @@ MxRect32* MxRegionCursor::VTable0x30() } if (m_topBottomCursor->Prev(topBottom)) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); m_leftRightCursor->Last(leftRight); UpdateRect(leftRight->GetLeft(), topBottom->GetTop(), leftRight->GetRight(), topBottom->GetBottom()); @@ -123,7 +123,7 @@ MxRect32* MxRegionCursor::VTable0x30() MxRect32* MxRegionCursor::VTable0x14(MxRect32& p_rect) { m_topBottomCursor->Reset(); - FUN_100c4a20(p_rect); + ProcessRectOverlapAscending(p_rect); return m_rect; } @@ -131,7 +131,7 @@ MxRect32* MxRegionCursor::VTable0x14(MxRect32& p_rect) MxRect32* MxRegionCursor::VTable0x1c(MxRect32& p_rect) { m_topBottomCursor->Reset(); - FUN_100c4b50(p_rect); + ProcessOverlapWithRect(p_rect); return m_rect; } @@ -150,11 +150,11 @@ MxRect32* MxRegionCursor::VTable0x24(MxRect32& p_rect) m_rect->Intersect(p_rect); } else { - FUN_100c4a20(p_rect); + ProcessRectOverlapAscending(p_rect); } } else { - FUN_100c4a20(p_rect); + ProcessRectOverlapAscending(p_rect); } return m_rect; @@ -175,11 +175,11 @@ MxRect32* MxRegionCursor::VTable0x2c(MxRect32& p_rect) m_rect->Intersect(p_rect); } else { - FUN_100c4b50(p_rect); + ProcessOverlapWithRect(p_rect); } } else { - FUN_100c4b50(p_rect); + ProcessOverlapWithRect(p_rect); } return m_rect; @@ -202,7 +202,7 @@ void MxRegionCursor::Reset() } // FUNCTION: LEGO1 0x100c46c0 -void MxRegionCursor::FUN_100c46c0(MxRegionLeftRightList& p_leftRightList) +void MxRegionCursor::ResetAndInitializeCursor(MxRegionLeftRightList& p_leftRightList) { if (m_leftRightCursor) { delete m_leftRightCursor; @@ -225,7 +225,7 @@ void MxRegionCursor::UpdateRect(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 } // FUNCTION: LEGO1 0x100c4a20 -void MxRegionCursor::FUN_100c4a20(MxRect32& p_rect) +void MxRegionCursor::ProcessRectOverlapAscending(MxRect32& p_rect) { MxRegionTopBottom* topBottom; while (m_topBottomCursor->Next(topBottom)) { @@ -235,7 +235,7 @@ void MxRegionCursor::FUN_100c4a20(MxRect32& p_rect) } if (p_rect.GetTop() < topBottom->GetBottom()) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); MxRegionLeftRight* leftRight; while (m_leftRightCursor->Next(leftRight)) { @@ -261,7 +261,7 @@ void MxRegionCursor::FUN_100c4a20(MxRect32& p_rect) } // FUNCTION: LEGO1 0x100c4b50 -void MxRegionCursor::FUN_100c4b50(MxRect32& p_rect) +void MxRegionCursor::ProcessOverlapWithRect(MxRect32& p_rect) { MxRegionTopBottom* topBottom; while (m_topBottomCursor->Prev(topBottom)) { @@ -271,7 +271,7 @@ void MxRegionCursor::FUN_100c4b50(MxRect32& p_rect) } if (topBottom->GetTop() < p_rect.GetBottom()) { - FUN_100c46c0(*topBottom->m_leftRightList); + ResetAndInitializeCursor(*topBottom->m_leftRightList); MxRegionLeftRight* leftRight; while (m_leftRightCursor->Prev(leftRight)) { diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 2d86ab5d..21a6b75a 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -28,7 +28,7 @@ void OrientableROI::WrappedSetLocalTransform(const Matrix4& p_transform) } // FUNCTION: LEGO1 0x100a46b0 -void OrientableROI::FUN_100a46b0(const Matrix4& p_transform) +void OrientableROI::UpdateTransformationRelativeToParent(const Matrix4& p_transform) { MxMatrix mat; diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index d7b9f998..b707bbe3 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -33,7 +33,7 @@ class OrientableROI : public ROI { virtual void UpdateWorldVelocity(); // vtable+0x2c void WrappedSetLocalTransform(const Matrix4& p_transform); - void FUN_100a46b0(const Matrix4& p_transform); + void UpdateTransformationRelativeToParent(const Matrix4& p_transform); void WrappedVTable0x24(const Matrix4& p_transform); void GetLocalTransform(Matrix4& p_transform); void FUN_100a58f0(const Matrix4& p_transform); diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index e71e3d2f..fe6c00a6 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -97,7 +97,7 @@ void ViewManager::Remove(ViewROI* p_roi) rois.erase(it); if (p_roi->GetUnknown0xe0() >= 0) { - FUN_100a66a0(p_roi); + RemoveROIDetailFromScene(p_roi); } const CompoundObject* comp = p_roi->GetComp(); @@ -105,7 +105,7 @@ void ViewManager::Remove(ViewROI* p_roi) if (comp != NULL) { for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { if (((ViewROI*) *it)->GetUnknown0xe0() >= 0) { - FUN_100a66a0((ViewROI*) *it); + RemoveROIDetailFromScene((ViewROI*) *it); } } } @@ -127,7 +127,7 @@ void ViewManager::RemoveAll(ViewROI* p_roi) } else { if (p_roi->GetUnknown0xe0() >= 0) { - FUN_100a66a0(p_roi); + RemoveROIDetailFromScene(p_roi); } p_roi->SetUnknown0xe0(-1); @@ -144,7 +144,7 @@ void ViewManager::RemoveAll(ViewROI* p_roi) } // FUNCTION: LEGO1 0x100a65b0 -void ViewManager::FUN_100a65b0(ViewROI* p_roi, int p_und) +void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) { if (p_roi->GetLODCount() <= p_und) { p_und = p_roi->GetLODCount() - 1; @@ -197,7 +197,7 @@ void ViewManager::FUN_100a65b0(ViewROI* p_roi, int p_und) } // FUNCTION: LEGO1 0x100a66a0 -void ViewManager::FUN_100a66a0(ViewROI* p_roi) +void ViewManager::RemoveROIDetailFromScene(ViewROI* p_roi) { const ViewLOD* lod = (const ViewLOD*) p_roi->GetLOD(p_roi->GetUnknown0xe0()); @@ -218,10 +218,10 @@ void ViewManager::FUN_100a66a0(ViewROI* p_roi) } // FUNCTION: LEGO1 0x100a66f0 -inline void ViewManager::FUN_100a66f0(ViewROI* p_roi, int p_und) +inline void ViewManager::ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und) { if (!p_roi->GetVisibility() && p_und != -2) { - FUN_100a66f0(p_roi, -2); + ManageVisibilityAndDetailRecursively(p_roi, -2); } else { const CompoundObject* comp = p_roi->GetComp(); @@ -235,7 +235,7 @@ inline void ViewManager::FUN_100a66f0(ViewROI* p_roi, int p_und) return; } - FUN_100a66f0(p_roi, -2); + ManageVisibilityAndDetailRecursively(p_roi, -2); return; } @@ -245,19 +245,19 @@ inline void ViewManager::FUN_100a66f0(ViewROI* p_roi, int p_und) if (p_und == -2) { if (p_roi->GetUnknown0xe0() >= 0) { - FUN_100a66a0(p_roi); + RemoveROIDetailFromScene(p_roi); p_roi->SetUnknown0xe0(-2); } if (comp != NULL) { for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { - FUN_100a66f0((ViewROI*) *it, p_und); + ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_und); } } } else if (comp == NULL) { if (p_roi->GetLODs() != NULL && p_roi->GetLODCount() > 0) { - FUN_100a65b0(p_roi, p_und); + UpdateROIDetailBasedOnLOD(p_roi, p_und); return; } } @@ -265,7 +265,7 @@ inline void ViewManager::FUN_100a66f0(ViewROI* p_roi, int p_und) p_roi->SetUnknown0xe0(-1); for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { - FUN_100a66f0((ViewROI*) *it, p_und); + ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_und); } } } @@ -284,11 +284,11 @@ void ViewManager::Update(float p_previousRenderTime, float) Unknown(); } else if (flags & c_bit2) { - FUN_100a6b90(); + UpdateViewTransformations(); } for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) { - FUN_100a66f0((ViewROI*) *it, -1); + ManageVisibilityAndDetailRecursively((ViewROI*) *it, -1); } stopWatch.Stop(); @@ -343,7 +343,7 @@ inline int ViewManager::Unknown() *unk0x90 = fVar3; // clang-format on - FUN_100a6b90(); + UpdateViewTransformations(); return 0; } } @@ -403,7 +403,7 @@ inline int ViewManager::Unknown3(ViewROI* p_roi) } // FUNCTION: LEGO1 0x100a6b90 -void ViewManager::FUN_100a6b90() +void ViewManager::UpdateViewTransformations() { flags &= ~c_bit2; diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 3f9d1826..860d3b2a 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -24,17 +24,17 @@ class ViewManager { void Remove(ViewROI* p_roi); void RemoveAll(ViewROI* p_roi); unsigned int FUN_100a6150(const BoundingBox& p_bounding_box); - void FUN_100a65b0(ViewROI* p_roi, int p_und); - void FUN_100a66a0(ViewROI* p_roi); + void UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und); + void RemoveROIDetailFromScene(ViewROI* p_roi); void SetPOVSource(const OrientableROI* point_of_view); float ProjectedSize(const BoundingSphere& p_bounding_sphere); ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y); void SetResolution(int width, int height); void SetFrustrum(float fov, float front, float back); - inline void FUN_100a66f0(ViewROI* p_roi, int p_und); + inline void ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und); void Update(float p_previousRenderTime, float); inline int Unknown(); - void FUN_100a6b90(); + void UpdateViewTransformations(); inline static int Unknown2(float p_und1, float p_und2, ViewROI* p_roi); inline static int Unknown3(ViewROI* p_roi); From 23cc82c532c35e54b300c9389117bc792d3217f1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 19 May 2024 11:24:09 -0400 Subject: [PATCH 08/16] Implement/match LegoPathBoundary::Intersect (#937) --- .../lego/legoomni/src/paths/legopathactor.cpp | 1 + .../legoomni/src/paths/legopathboundary.cpp | 151 +++++++++++++++++- .../lego/sources/geom/legounkown100db7f4.cpp | 2 +- LEGO1/lego/sources/geom/legounkown100db7f4.h | 2 +- LEGO1/lego/sources/geom/legowegedge.h | 2 +- 5 files changed, 154 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index f332a51e..0a00221b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -224,6 +224,7 @@ MxResult LegoPathActor::VTable0x84( } // FUNCTION: LEGO1 0x1002e100 +// FUNCTION: BETA10 0x100b0520 MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) { if (m_userNavFlag && m_state == 0) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 0ed91f6f..c4a5cacb 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -1,6 +1,7 @@ #include "legopathboundary.h" #include "decomp.h" +#include "geom/legounkown100db7f4.h" #include "legopathactor.h" DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74) @@ -44,7 +45,8 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa { } -// STUB: LEGO1 0x10057950 +// FUNCTION: LEGO1 0x10057950 +// FUNCTION: BETA10 0x100b1adc MxU32 LegoPathBoundary::Intersect( float p_scale, Vector3& p_point1, @@ -53,6 +55,153 @@ MxU32 LegoPathBoundary::Intersect( LegoEdge*& p_edge ) { + LegoUnknown100db7f4* e = NULL; + float localc; + MxU32 local10 = 0; + float len = 0.0f; + Mx3DPointFloat vec; + + for (MxS32 i = 0; i < m_numEdges; i++) { + LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) m_edges[i]; + + if (p_point2.Dot(&m_edgeNormals[i], &p_point2) + m_edgeNormals[i][3] <= -1e-07) { + if (local10 == 0) { + local10 = 1; + vec = p_point2; + ((Vector3&) vec).Sub(&p_point1); + + len = vec.LenSquared(); + if (len <= 0.0f) { + return 0; + } + + len = sqrt(len); + ((Vector3&) vec).Div(len); + } + + float dot = vec.Dot(&vec, &m_edgeNormals[i]); + if (dot != 0.0f) { + float local34 = (-m_edgeNormals[i][3] - p_point1.Dot(&p_point1, &m_edgeNormals[i])) / dot; + + if (local34 >= -0.001 && local34 <= len && (e == NULL || local34 < localc)) { + e = edge; + localc = local34; + } + } + } + } + + if (e != NULL) { + if (localc < 0.0f) { + localc = 0.0f; + } + + Mx3DPointFloat local50; + Mx3DPointFloat local70; + Vector3* local5c = e->GetOpposingPoint(this); + + p_point3 = vec; + p_point3.Mul(localc); + p_point3.Add(&p_point1); + + local50 = p_point2; + ((Vector3&) local50).Sub(local5c); + + e->FUN_1002ddc0(*this, local70); + + float local58 = local50.Dot(&local50, &local70); + LegoUnknown100db7f4* local54 = NULL; + + if (local58 < 0.0f) { + Mx3DPointFloat local84; + + for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(this); e != local88; + local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(this)) { + local88->FUN_1002ddc0(*this, local84); + + if (local84.Dot(&local84, &local70) <= 0.9) { + break; + } + + Vector3* local90 = local88->GetOpposingPoint(this); + Mx3DPointFloat locala4(p_point3); + ((Vector3&) locala4).Sub(local90); + + float local8c = locala4.Dot(&locala4, &local84); + + if (local8c > local58 && local8c < local88->m_unk0x3c) { + local54 = local88; + local58 = local8c; + local70 = local84; + local5c = local90; + } + } + } + else { + if (e->m_unk0x3c < local58) { + Mx3DPointFloat localbc; + + for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(this); + e != locala8; + locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(this)) { + locala8->FUN_1002ddc0(*this, localbc); + + if (localbc.Dot(&localbc, &local70) <= 0.9) { + break; + } + + Vector3* localc4 = locala8->GetOpposingPoint(this); + Mx3DPointFloat locald8(p_point3); + ((Vector3&) locald8).Sub(localc4); + + float localc0 = locald8.Dot(&locald8, &localbc); + + if (localc0 < local58 && localc0 >= 0.0f) { + local54 = locala8; + local58 = localc0; + local70 = localbc; + local5c = localc4; + } + } + } + } + + if (local54 != NULL) { + e = local54; + } + + if (local58 <= 0.0f) { + if (!e->GetMask0x03()) { + p_edge = e->GetClockwiseEdge(this); + } + else { + p_edge = e; + } + + p_point3 = *local5c; + return 2; + } + else if (local58 > 0.0f && e->m_unk0x3c > local58) { + p_point3 = local70; + p_point3.Mul(local58); + p_point3.Add(local5c); + p_edge = e; + return 1; + } + else { + p_point3 = *e->GetPoint(this); + + if (!e->GetMask0x03()) { + p_edge = e->GetCounterclockwiseEdge(this); + } + else { + p_edge = e; + } + + return 2; + } + } + return 0; } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp index eab51447..25740067 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp @@ -8,5 +8,5 @@ LegoUnknown100db7f4::LegoUnknown100db7f4() { m_flags = 0; m_unk0x28.Clear(); - m_unk0x3c = 0; + m_unk0x3c = 0.0f; } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 9bbffc03..7c73a9e3 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -59,7 +59,7 @@ struct LegoUnknown100db7f4 : public LegoEdge { LegoU16 m_flags; // 0x24 Mx3DPointFloat m_unk0x28; // 0x28 - LegoU32 m_unk0x3c; // 0x3c + float m_unk0x3c; // 0x3c }; #endif // __LEGOUNKNOWN100DB7F4_H diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index d0599d84..9ec06692 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -62,7 +62,7 @@ class LegoWEGEdge : public LegoWEEdge { friend class LegoPathController; -private: +protected: LegoU8 m_flags; // 0x0c LegoU8 m_unk0x0d; // 0x0d LegoChar* m_name; // 0x10 From c8a0e4cf8d2204e619c1f642ba3465ac56b8944f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 19 May 2024 14:22:53 -0400 Subject: [PATCH 09/16] Implement LegoPathActor::VTable0x68 (#938) * Implement LegoPathActor::VTable0x68 * Fix naming --- LEGO1/lego/legoomni/include/legopathactor.h | 25 ++++++- .../lego/legoomni/src/paths/legopathactor.cpp | 74 ++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 43b6c480..e800c281 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -10,6 +10,7 @@ struct LegoEdge; class LegoPathBoundary; class LegoPathController; struct LegoUnknown100db7f4; +class LegoWEEdge; // VTABLE: LEGO1 0x100d6e28 // SIZE 0x154 @@ -35,8 +36,8 @@ class LegoPathActor : public LegoActor { return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name); } - void ParseAction(char* p_extra) override; // vtable+0x20 - virtual MxS32 VTable0x68(Vector3&, Vector3&, Vector3&); // vtable+0x68 + void ParseAction(char* p_extra) override; // vtable+0x20 + virtual MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3); // vtable+0x68 virtual MxU32 VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -129,6 +130,17 @@ class LegoPathActor : public LegoActor { // LegoPathActor::`scalar deleting destructor' protected: + inline MxU32 FUN_1002edd0( + list& p_boundaries, + LegoPathBoundary* p_boundary, + Vector3& p_v1, + Vector3& p_v2, + float p_f1, + float p_f2, + Vector3& p_v3, + MxS32 p_und + ); + MxFloat m_BADuration; // 0x78 MxFloat m_unk0x7c; // 0x7c MxFloat m_actorTime; // 0x80 @@ -152,4 +164,13 @@ class LegoPathActor : public LegoActor { MxFloat m_unk0x150; // 0x150 }; +// TEMPLATE: LEGO1 0x1002ef10 +// list >::~list > + +// TEMPLATE: LEGO1 0x1002ef80 +// list >::insert + +// TEMPLATE: LEGO1 0x1002efd0 +// List::~List + #endif // LEGOPATHACTOR_H diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 0a00221b..390f185e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -464,11 +464,77 @@ MxU32 LegoPathActor::VTable0x6c( return 0; } -// STUB: LEGO1 0x1002ebe0 -MxS32 LegoPathActor::VTable0x68(Vector3&, Vector3&, Vector3&) +// FUNCTION: LEGO1 0x1002ebe0 +// FUNCTION: BETA10 0x100af35e +MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) { - // TODO - return 0; + Mx3DPointFloat v2(p_v2); + ((Vector3&) v2).Sub(&p_v1); + + float len = v2.LenSquared(); + + if (len <= 0.001) { + return 0; + } + + len = sqrt(len); + ((Vector3&) v2).Div(len); + + float radius = m_roi->GetWorldBoundingSphere().Radius(); + list boundaries; + + return FUN_1002edd0(boundaries, m_boundary, p_v1, v2, len, radius, p_v3, 0); +} + +// FUNCTION: LEGO1 0x1002edd0 +inline MxU32 LegoPathActor::FUN_1002edd0( + list& p_boundaries, + LegoPathBoundary* p_boundary, + Vector3& p_v1, + Vector3& p_v2, + float p_f1, + float p_f2, + Vector3& p_v3, + MxS32 p_und +) +{ + MxU32 result = VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); + + if (result == 0) { + p_boundaries.push_back(p_boundary); + + if (p_und >= 2) { + return 0; + } + + LegoS32 numEdges = p_boundary->GetNumEdges(); + for (MxS32 i = 0; i < numEdges; i++) { + LegoUnknown100db7f4* edge = ((LegoUnknown100db7f4*) p_boundary->GetEdges()[i]); + LegoPathBoundary* boundary = (LegoPathBoundary*) edge->OtherFace(p_boundary); + + if (boundary != NULL) { + list::iterator it; + + for (it = p_boundaries.begin(); it != p_boundaries.end(); it++) { + if ((*it) == boundary) { + break; + } + } + + if (it == p_boundaries.end()) { + result = FUN_1002edd0(p_boundaries, boundary, p_v1, p_v2, p_f1, p_f2, p_v3, p_und + 1); + + if (result != 0) { + return result; + } + } + } + } + + result = 0; + } + + return result; } // STUB: LEGO1 0x1002f020 From fb16b2c89678d5d5029a46aa6f78de0137275687 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 19 May 2024 15:41:07 -0400 Subject: [PATCH 10/16] Implement/match LegoPathBoundary::FUN_100575b0 (#939) --- LEGO1/lego/legoomni/include/legopathstruct.h | 3 +- .../src/common/legoanimationmanager.cpp | 10 ++-- .../lego/legoomni/src/paths/legopathactor.cpp | 12 ++-- .../legoomni/src/paths/legopathboundary.cpp | 57 +++++++++++++++---- .../legoomni/src/paths/legopathcontroller.cpp | 4 +- .../legoomni/src/paths/legopathstruct.cpp | 2 +- LEGO1/lego/sources/geom/legoedge.cpp | 20 +++---- LEGO1/lego/sources/geom/legoedge.h | 10 ++-- LEGO1/lego/sources/geom/legowegedge.h | 4 +- 9 files changed, 79 insertions(+), 43 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index fd752050..174ad7b8 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -5,6 +5,7 @@ #include "mxatom.h" #include "mxtypes.h" +class LegoPathActor; class LegoWorld; // VTABLE: LEGO1 0x100d7d9c @@ -35,7 +36,7 @@ struct LegoPathStruct : public LegoPathStructBase { // FUNCTION: LEGO1 0x10047470 ~LegoPathStruct() override {} - void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04 + virtual void VTable0x04(LegoPathActor*, undefined4, undefined4); // vtable+0x04 inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 3aee0c1a..ce297e26 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2139,8 +2139,8 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale) { Mx3DPointFloat p1; - Vector3* v1 = p_edge->GetOpposingPoint(p_boundary); - Vector3* v2 = p_edge->GetPoint(p_boundary); + Vector3* v1 = p_edge->GetOpposingPoint(*p_boundary); + Vector3* v2 = p_edge->CCWVertex(*p_boundary); p1 = *v2; ((Vector3&) p1).Sub(v1); @@ -2196,7 +2196,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx e = local50; do { - e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(boundary); + e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*boundary); if (e->GetMask0x03()) { break; } @@ -2237,10 +2237,10 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx do { if (p_bool1) { - local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(boundary); + local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(*boundary); } else { - local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(boundary); + local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(*boundary); } } while (!local34->GetMask0x03() && local34 != local50); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 390f185e..0d1f8438 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -90,10 +90,10 @@ MxResult LegoPathActor::VTable0x88( float p_destScale ) { - Vector3* v1 = p_srcEdge.GetOpposingPoint(p_boundary); - Vector3* v2 = p_srcEdge.GetPoint(p_boundary); - Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary); - Vector3* v4 = p_destEdge.GetPoint(p_boundary); + Vector3* v1 = p_srcEdge.GetOpposingPoint(*p_boundary); + Vector3* v2 = p_srcEdge.CCWVertex(*p_boundary); + Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary); + Vector3* v4 = p_destEdge.CCWVertex(*p_boundary); Mx3DPointFloat p1, p2, p3, p4, p5; @@ -167,8 +167,8 @@ MxResult LegoPathActor::VTable0x84( float p_destScale ) { - Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary); - Vector3* v4 = p_destEdge.GetPoint(p_boundary); + Vector3* v3 = p_destEdge.GetOpposingPoint(*p_boundary); + Vector3* v4 = p_destEdge.CCWVertex(*p_boundary); Mx3DPointFloat p2, p3, p5; diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index c4a5cacb..593c9955 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -3,6 +3,7 @@ #include "decomp.h" #include "geom/legounkown100db7f4.h" #include "legopathactor.h" +#include "legopathstruct.h" DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74) @@ -40,9 +41,43 @@ MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor) return SUCCESS; } -// STUB: LEGO1 0x100575b0 +// FUNCTION: LEGO1 0x100575b0 +// FUNCTION: BETA10 0x100b1598 void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor) { + Vector3* ccwV = NULL; + + if (m_unk0x48 > 0 && m_unk0x50 != NULL) { + ccwV = m_edges[0]->CCWVertex(*this); + Mx3DPointFloat v; + + v = p_point1; + ((Vector3&) v).Sub(ccwV); + float dot1 = v.Dot(&v, m_unk0x50); + + v = p_point2; + ((Vector3&) v).Sub(ccwV); + float dot2 = v.Dot(&v, m_unk0x50); + + if (dot2 > dot1) { + for (MxS32 i = 0; i < m_unk0x48; i++) { + LegoPathStruct* s = m_unk0x4c[i].m_unk0x00; + + if (m_unk0x4c[i].m_unk0x08 >= dot1 && m_unk0x4c[i].m_unk0x08 < dot2) { + s->VTable0x04(p_actor, 1, m_unk0x4c[i].m_unk0x04); + } + } + } + else if (dot2 < dot1) { + for (MxS32 i = 0; i < m_unk0x48; i++) { + LegoPathStruct* s = m_unk0x4c[i].m_unk0x00; + + if (m_unk0x4c[i].m_unk0x08 >= dot2 && m_unk0x4c[i].m_unk0x08 < dot1) { + s->VTable0x04(p_actor, 0, m_unk0x4c[i].m_unk0x04); + } + } + } + } } // FUNCTION: LEGO1 0x10057950 @@ -98,7 +133,7 @@ MxU32 LegoPathBoundary::Intersect( Mx3DPointFloat local50; Mx3DPointFloat local70; - Vector3* local5c = e->GetOpposingPoint(this); + Vector3* local5c = e->GetOpposingPoint(*this); p_point3 = vec; p_point3.Mul(localc); @@ -115,15 +150,15 @@ MxU32 LegoPathBoundary::Intersect( if (local58 < 0.0f) { Mx3DPointFloat local84; - for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(this); e != local88; - local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(this)) { + for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); e != local88; + local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) { local88->FUN_1002ddc0(*this, local84); if (local84.Dot(&local84, &local70) <= 0.9) { break; } - Vector3* local90 = local88->GetOpposingPoint(this); + Vector3* local90 = local88->GetOpposingPoint(*this); Mx3DPointFloat locala4(p_point3); ((Vector3&) locala4).Sub(local90); @@ -141,16 +176,16 @@ MxU32 LegoPathBoundary::Intersect( if (e->m_unk0x3c < local58) { Mx3DPointFloat localbc; - for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(this); + for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); e != locala8; - locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(this)) { + locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) { locala8->FUN_1002ddc0(*this, localbc); if (localbc.Dot(&localbc, &local70) <= 0.9) { break; } - Vector3* localc4 = locala8->GetOpposingPoint(this); + Vector3* localc4 = locala8->GetOpposingPoint(*this); Mx3DPointFloat locald8(p_point3); ((Vector3&) locald8).Sub(localc4); @@ -172,7 +207,7 @@ MxU32 LegoPathBoundary::Intersect( if (local58 <= 0.0f) { if (!e->GetMask0x03()) { - p_edge = e->GetClockwiseEdge(this); + p_edge = e->GetClockwiseEdge(*this); } else { p_edge = e; @@ -189,10 +224,10 @@ MxU32 LegoPathBoundary::Intersect( return 1; } else { - p_point3 = *e->GetPoint(this); + p_point3 = *e->CCWVertex(*this); if (!e->GetMask0x03()) { - p_edge = e->GetCounterclockwiseEdge(this); + p_edge = e->GetCounterclockwiseEdge(*this); } else { p_edge = e; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index a5f1797d..3d3d6c62 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -279,10 +279,10 @@ MxResult LegoPathController::FUN_10046050( if (edge->GetMask0x03()) { Mx3DPointFloat vec; - if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && + if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && vec.Dot(&vec, &p_direction) < 0.0f) { edge = - (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(boundary)->GetCounterclockwiseEdge(boundary); + (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); } if (!edge->GetMask0x03()) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index 2cbf51c4..5b694042 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) // STUB: LEGO1 0x1001b700 // FUNCTION: BETA10 0x100c26c5 -void LegoPathStruct::VTable0x04(undefined4, undefined4, undefined4) +void LegoPathStruct::VTable0x04(LegoPathActor*, undefined4, undefined4) { // TODO } diff --git a/LEGO1/lego/sources/geom/legoedge.cpp b/LEGO1/lego/sources/geom/legoedge.cpp index 63e988c0..1788a0d7 100644 --- a/LEGO1/lego/sources/geom/legoedge.cpp +++ b/LEGO1/lego/sources/geom/legoedge.cpp @@ -23,12 +23,12 @@ LegoEdge::~LegoEdge() } // FUNCTION: LEGO1 0x1009a4d0 -LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge* p_face) +LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge& p_face) { - if (p_face == m_faceA) { + if (&p_face == m_faceA) { return m_cwA; } - else if (p_face == m_faceB) { + else if (&p_face == m_faceB) { return m_cwB; } else { @@ -37,12 +37,12 @@ LegoEdge* LegoEdge::GetClockwiseEdge(LegoWEEdge* p_face) } // FUNCTION: LEGO1 0x1009a4f0 -LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge* p_face) +LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge& p_face) { - if (p_face == m_faceA) { + if (&p_face == m_faceA) { return m_ccwA; } - else if (p_face == m_faceB) { + else if (&p_face == m_faceB) { return m_ccwB; } else { @@ -51,13 +51,13 @@ LegoEdge* LegoEdge::GetCounterclockwiseEdge(LegoWEEdge* p_face) } // FUNCTION: LEGO1 0x1009a510 -Vector3* LegoEdge::GetOpposingPoint(LegoWEEdge* p_face) +Vector3* LegoEdge::GetOpposingPoint(LegoWEEdge& p_face) { - return p_face == m_faceA ? m_pointB : m_pointA; + return &p_face == m_faceA ? m_pointB : m_pointA; } // FUNCTION: LEGO1 0x1009a530 -Vector3* LegoEdge::GetPoint(LegoWEEdge* p_face) +Vector3* LegoEdge::CCWVertex(LegoWEEdge& p_face) { - return p_face == m_faceB ? m_pointB : m_pointA; + return &p_face == m_faceB ? m_pointB : m_pointA; } diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index da440e71..0f238c37 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -12,12 +12,12 @@ struct LegoEdge { LegoEdge(); virtual ~LegoEdge(); // vtable+0x00 - LegoEdge* GetClockwiseEdge(LegoWEEdge* face); - LegoEdge* GetCounterclockwiseEdge(LegoWEEdge* face); - Vector3* GetOpposingPoint(LegoWEEdge* face); - Vector3* GetPoint(LegoWEEdge* face); + LegoEdge* GetClockwiseEdge(LegoWEEdge& p_face); + LegoEdge* GetCounterclockwiseEdge(LegoWEEdge& p_face); + Vector3* GetOpposingPoint(LegoWEEdge& p_face); + Vector3* CCWVertex(LegoWEEdge& p_face); - LegoResult FUN_1002ddc0(LegoWEEdge* p_face, Vector3& p_point); + LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); // SYNTHETIC: LEGO1 0x1009a4a0 // LegoEdge::`scalar deleting destructor' diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 9ec06692..906ec015 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -27,12 +27,12 @@ class LegoWEGEdge : public LegoWEEdge { { m_unk0x00 = NULL; m_unk0x04 = 0; - m_unk0x08 = 0; + m_unk0x08 = 0.0f; } LegoPathStruct* m_unk0x00; // 0x00 undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 + float m_unk0x08; // 0x08 }; LegoWEGEdge(); From 8428cde67f0df440e75457e44001b1bc103d75a2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 19 May 2024 16:36:11 -0400 Subject: [PATCH 11/16] Implement LegoUnknown::FUN_1009a1e0 (#940) --- LEGO1/lego/sources/misc/legounknown.cpp | 50 +++++++++++++++++++++++-- LEGO1/lego/sources/misc/legounknown.h | 2 +- LEGO1/realtime/vector.h | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index 14178e44..6b4a710e 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -27,8 +27,52 @@ void LegoUnknown::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_ } } -// STUB: LEGO1 0x1009a1e0 -LegoResult LegoUnknown::FUN_1009a1e0(float, Matrix4&, Vector3&, LegoU32) +// FUNCTION: LEGO1 0x1009a1e0 +// FUNCTION: BETA10 0x10182d61 +LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und) { - return FAILURE; + Vector3 v1(p_mat[3]); + Vector3 v2(p_mat[0]); + Vector3 v3(p_mat[1]); + Vector3 v4(p_mat[2]); + + if (p_f1 <= 0.001) { + v1 = m_unk0x00[0]; + v4 = m_unk0x00[1]; + } + else if (p_f1 >= 0.999) { + v1 = m_unk0x00[0]; + ((Vector3&) v2).Add(&m_unk0x00[1]); + ((Vector3&) v3).Add(&m_unk0x00[2]); + ((Vector3&) v4).Add(&m_unk0x00[3]); + + for (LegoS32 i = 0; i < 3; i++) { + v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f; + } + } + else { + float local30 = p_f1 * p_f1; + float local34 = local30 * p_f1; + + for (LegoS32 i = 0; i < 3; i++) { + v1[i] = m_unk0x00[0][i] + m_unk0x00[1][i] * p_f1 + m_unk0x00[2][i] * local30 + m_unk0x00[3][i] * local34; + v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * p_f1 * 2.0f + m_unk0x00[3][i] * local30 * 3.0f; + } + } + + if (p_und) { + ((Vector3&) v4).Mul(-1.0f); + } + + if (v4.Unitize() != 0) { + return FAILURE; + } + + v2.EqualsCross(&p_v, &v4); + if (v2.Unitize() != 0) { + return FAILURE; + } + + v3.EqualsCross(&v4, &v2); + return SUCCESS; } diff --git a/LEGO1/lego/sources/misc/legounknown.h b/LEGO1/lego/sources/misc/legounknown.h index 03eafcee..1d0d1aef 100644 --- a/LEGO1/lego/sources/misc/legounknown.h +++ b/LEGO1/lego/sources/misc/legounknown.h @@ -13,7 +13,7 @@ class LegoUnknown { ~LegoUnknown(); void FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4); - LegoResult FUN_1009a1e0(float, Matrix4&, Vector3&, LegoU32); + LegoResult FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und); private: Mx3DPointFloat m_unk0x00[4]; // 0x00 diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 198ed14b..01a15d49 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -104,7 +104,7 @@ class Vector2 { if (sq > 0.0f) { float root = sqrt(sq); - if (root > 0) { + if (root > 0.0f) { DivScalarImpl(&root); return 0; } From 334246432189c7b283fce7b8901ec12f78654d31 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 20 May 2024 11:34:31 -0400 Subject: [PATCH 12/16] Implement/match LegoPathController::FUN_1004a240 (#941) --- LEGO1/lego/legoomni/include/act2actor.h | 2 +- .../lego/legoomni/include/legocarraceactor.h | 2 +- LEGO1/lego/legoomni/include/legoextraactor.h | 2 +- LEGO1/lego/legoomni/include/legojetski.h | 2 +- .../legoomni/include/legojetskiraceactor.h | 2 +- LEGO1/lego/legoomni/include/legopathactor.h | 15 ++++-- .../lego/legoomni/include/legopathboundary.h | 8 ++- .../legoomni/include/legopathcontroller.h | 11 +++++ .../legoomni/include/legopathedgecontainer.h | 49 +++++++++++++++++++ LEGO1/lego/legoomni/include/legoracecar.h | 2 +- LEGO1/lego/legoomni/src/actors/act2actor.cpp | 2 +- .../legoomni/src/entity/legocarraceactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legojetski.cpp | 2 +- .../src/entity/legojetskiraceactor.cpp | 2 +- .../legoomni/src/paths/legoextraactor.cpp | 6 +-- .../lego/legoomni/src/paths/legopathactor.cpp | 21 ++++---- .../legoomni/src/paths/legopathboundary.cpp | 6 +-- .../legoomni/src/paths/legopathcontroller.cpp | 34 +++++++++++++ LEGO1/lego/legoomni/src/race/legoracecar.cpp | 2 +- 19 files changed, 141 insertions(+), 31 deletions(-) create mode 100644 LEGO1/lego/legoomni/include/legopathedgecontainer.h diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index f73c6d07..7ae28781 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -15,7 +15,7 @@ class Act2Actor : public LegoAnimActor { MxS32 VTable0x68(Vector3&, Vector3&, Vector3&) override; // vtable+0x68 void VTable0x70(float p_und) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c MxS32 VTable0xa0() override; // vtable+0xa0 // SYNTHETIC: LEGO1 0x1001a0a0 diff --git a/LEGO1/lego/legoomni/include/legocarraceactor.h b/LEGO1/lego/legoomni/include/legocarraceactor.h index 97e734cb..dc0a74be 100644 --- a/LEGO1/lego/legoomni/include/legocarraceactor.h +++ b/LEGO1/lego/legoomni/include/legocarraceactor.h @@ -39,7 +39,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor { MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 void VTable0x98() override; // vtable+0x98 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_10080590(); diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index ea3fdeb1..2e8bae7d 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -46,7 +46,7 @@ class LegoExtraActor : public virtual LegoAnimActor { void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 MxU32 VTable0x90(float p_float, Matrix4& p_matrix) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4 void VTable0xc4() override; // vtable+0xc4 diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h index 61fd0121..682fbda8 100644 --- a/LEGO1/lego/legoomni/include/legojetski.h +++ b/LEGO1/lego/legoomni/include/legojetski.h @@ -44,7 +44,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 void VTable0x98() override; // vtable+0x98 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_100136f0(float p_worldSpeed); diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h index 388107d1..e4616527 100644 --- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h +++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h @@ -37,7 +37,7 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor { ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x98() override; // vtable+0x98 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c void VTable0x1c() override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10081d40 diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index e800c281..261ee3a6 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -9,6 +9,7 @@ struct LegoEdge; class LegoPathBoundary; class LegoPathController; +struct LegoPathEdgeContainer; struct LegoUnknown100db7f4; class LegoWEEdge; @@ -85,8 +86,8 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d50 virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94 - virtual void VTable0x98(); // vtable+0x98 - virtual MxResult WaitForAnimation(); // vtable+0x9c + virtual void VTable0x98(); // vtable+0x98 + virtual MxResult VTable0x9c(); // vtable+0x9c // FUNCTION: LEGO1 0x10002d60 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 @@ -148,13 +149,13 @@ class LegoPathActor : public LegoActor { LegoPathBoundary* m_boundary; // 0x88 LegoUnknown m_unk0x8c; // 0x8c MxU32 m_state; // 0xdc - LegoEdge* m_destEdge; // 0xe0 + LegoUnknown100db7f4* m_destEdge; // 0xe0 MxFloat m_unk0xe4; // 0xe4 undefined m_unk0xe8; // 0xe8 undefined m_unk0xe9; // 0xe9 MxBool m_userNavFlag; // 0xea MxMatrix m_unk0xec; // 0xec - undefined* m_unk0x134; // 0x134 + LegoPathEdgeContainer* m_grec; // 0x134 LegoPathController* m_controller; // 0x138 MxFloat m_unk0x13c; // 0x13c MxFloat m_unk0x140; // 0x140 @@ -164,6 +165,12 @@ class LegoPathActor : public LegoActor { MxFloat m_unk0x150; // 0x150 }; +// TEMPLATE: LEGO1 0x10018b70 +// List::~List + +// TEMPLATE: LEGO1 0x10018bc0 +// list >::~list > + // TEMPLATE: LEGO1 0x1002ef10 // list >::~list > diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index ba548d4f..448eb37c 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -34,7 +34,13 @@ class LegoPathBoundary : public LegoWEGEdge { MxResult AddActor(LegoPathActor* p_actor); MxResult RemoveActor(LegoPathActor* p_actor); void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor); - MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoEdge*& p_edge); + MxU32 Intersect( + float p_scale, + Vector3& p_point1, + Vector3& p_point2, + Vector3& p_point3, + LegoUnknown100db7f4*& p_edge + ); MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter); MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 46c4935c..10b83de5 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -103,6 +103,14 @@ class LegoPathController : public MxCore { LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); + MxU32 FUN_1004a240( + LegoPathEdgeContainer& p_grec, + Vector3& p_v1, + Vector3& p_v2, + float p_f1, + LegoUnknown100db7f4*& p_edge, + LegoPathBoundary*& p_boundary + ); static MxResult Init(); static MxResult Reset(); @@ -177,6 +185,9 @@ class LegoPathController : public MxCore { // SYNTHETIC: LEGO1 0x10047ae0 // LegoUnknown100db7f4::~LegoUnknown100db7f4 +// TEMPLATE: LEGO1 0x10048f70 +// list >::erase + // TEMPLATE: LEGO1 0x1004a780 // _Construct diff --git a/LEGO1/lego/legoomni/include/legopathedgecontainer.h b/LEGO1/lego/legoomni/include/legopathedgecontainer.h new file mode 100644 index 00000000..2d6f7b38 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legopathedgecontainer.h @@ -0,0 +1,49 @@ +#ifndef LEGOPATHEDGECONTAINER_H +#define LEGOPATHEDGECONTAINER_H + +#include "mxgeometry/mxgeometry3d.h" +#include "mxstl/stlcompat.h" +#include "mxtypes.h" + +class LegoPathBoundary; +struct LegoUnknown100db7f4; + +// SIZE 0x08 +struct LegoBoundaryEdge { + LegoUnknown100db7f4* m_edge; // 0x00 + LegoPathBoundary* m_boundary; // 0x04 + + int operator==(LegoBoundaryEdge) const { return 0; } + int operator<(LegoBoundaryEdge) const { return 0; } +}; + +// SIZE 0x3c +struct LegoPathEdgeContainer : public list { + enum { + c_bit1 = 0x01 + }; + + // FUNCTION: BETA10 0x100118e0 + LegoPathEdgeContainer() + { + m_boundary = NULL; + m_flags = 0; + } + + void SetBit1(MxU32 p_flag) + { + if (p_flag) { + m_flags |= c_bit1; + } + else { + m_flags &= ~c_bit1; + } + } + + Mx3DPointFloat m_unk0x0c; // 0x0c + Mx3DPointFloat m_unk0x20; // 0x20 + LegoPathBoundary* m_boundary; // 0x34 + MxU8 m_flags; // 0x38 +}; + +#endif // LEGOPATHEDGECONTAINER_H diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index d090b686..b8b1f66b 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -43,7 +43,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 void VTable0x98() override; // vtable+0x98 - MxResult WaitForAnimation() override; // vtable+0x9c + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_10012ea0(float p_worldSpeed); virtual void FUN_10012ff0(float); diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index bd187361..bc100885 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -22,7 +22,7 @@ MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool) } // STUB: LEGO1 0x10018a20 -MxResult Act2Actor::WaitForAnimation() +MxResult Act2Actor::VTable0x9c() { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index d724f763..a7d7f3ad 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -78,7 +78,7 @@ void LegoCarRaceActor::VTable0x98() } // STUB: LEGO1 0x10081d30 -MxResult LegoCarRaceActor::WaitForAnimation() +MxResult LegoCarRaceActor::VTable0x9c() { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index 3656e1c7..38d881d1 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -77,7 +77,7 @@ void LegoJetski::VTable0x98() } // STUB: LEGO1 0x10014200 -MxResult LegoJetski::WaitForAnimation() +MxResult LegoJetski::VTable0x9c() { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp index 654c00b1..e19e6cb3 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp @@ -44,7 +44,7 @@ void LegoJetskiRaceActor::VTable0x98() } // STUB: LEGO1 0x100822e0 -MxResult LegoJetskiRaceActor::WaitForAnimation() +MxResult LegoJetskiRaceActor::VTable0x9c() { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index d1600d13..900e7c5c 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -151,7 +151,7 @@ MxResult LegoExtraActor::FUN_1002aae0() m_boundary = oldEdge; } - LegoPathActor::WaitForAnimation(); + LegoPathActor::VTable0x9c(); return SUCCESS; } @@ -280,10 +280,10 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } // FUNCTION: LEGO1 0x1002b290 -MxResult LegoExtraActor::WaitForAnimation() +MxResult LegoExtraActor::VTable0x9c() { LegoPathBoundary* oldBoundary = m_boundary; - MxResult result = LegoPathActor::WaitForAnimation(); + MxResult result = LegoPathActor::VTable0x9c(); if (m_boundary != oldBoundary) { MxU32 b = FALSE; diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 0d1f8438..f30e2136 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -5,6 +5,7 @@ #include "legocameracontroller.h" #include "legonavcontroller.h" #include "legopathboundary.h" +#include "legopathedgecontainer.h" #include "legosoundmanager.h" #include "legoworld.h" #include "misc.h" @@ -15,6 +16,7 @@ #include DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) +DECOMP_SIZE_ASSERT(LegoPathEdgeContainer, 0x3c) #ifndef M_PI #define M_PI 3.1416 @@ -40,21 +42,21 @@ LegoPathActor::LegoPathActor() m_unk0x7c = 0; m_userNavFlag = FALSE; m_state = 0; - m_unk0x134 = NULL; + m_grec = NULL; m_controller = NULL; m_unk0xe8 = 0; m_unk0x148 = 0; m_unk0x14c = 0; - m_unk0x140 = 0.0099999998f; - m_unk0x144 = 0.80000001f; + m_unk0x140 = 0.0099999999f; + m_unk0x144 = 0.8f; m_unk0x150 = 2.0f; } -// STUB: LEGO1 0x1002d820 +// FUNCTION: LEGO1 0x1002d820 LegoPathActor::~LegoPathActor() { - if (m_unk0x134) { - delete m_unk0x134; + if (m_grec) { + delete m_grec; } } @@ -264,7 +266,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) LegoPathBoundary* oldBoundary = m_boundary; if (m_unk0xe9 != 0) { - WaitForAnimation(); + VTable0x9c(); if (m_boundary == oldBoundary) { MxLong time = Timer()->GetTime(); @@ -344,7 +346,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) pos2 = pos1; if (m_unk0xe9 != 0) { - WaitForAnimation(); + VTable0x9c(); } return 0; @@ -544,7 +546,8 @@ void LegoPathActor::ParseAction(char* p_extra) } // STUB: LEGO1 0x1002f1b0 -MxResult LegoPathActor::WaitForAnimation() +// FUNCTION: BETA10 0x100af899 +MxResult LegoPathActor::VTable0x9c() { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 593c9955..dedfc2f4 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -87,7 +87,7 @@ MxU32 LegoPathBoundary::Intersect( Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, - LegoEdge*& p_edge + LegoUnknown100db7f4*& p_edge ) { LegoUnknown100db7f4* e = NULL; @@ -207,7 +207,7 @@ MxU32 LegoPathBoundary::Intersect( if (local58 <= 0.0f) { if (!e->GetMask0x03()) { - p_edge = e->GetClockwiseEdge(*this); + p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); } else { p_edge = e; @@ -227,7 +227,7 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = *e->CCWVertex(*this); if (!e->GetMask0x03()) { - p_edge = e->GetCounterclockwiseEdge(*this); + p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); } else { p_edge = e; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 3d3d6c62..ec7c8530 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -1,5 +1,6 @@ #include "legopathcontroller.h" +#include "legopathedgecontainer.h" #include "legopathstruct.h" #include "misc/legostorage.h" #include "mxmisc.h" @@ -727,3 +728,36 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat& return SUCCESS; } + +// FUNCTION: LEGO1 0x1004a240 +// FUNCTION: BETA10 0x100b9160 +MxU32 LegoPathController::FUN_1004a240( + LegoPathEdgeContainer& p_grec, + Vector3& p_v1, + Vector3& p_v2, + float p_f1, + LegoUnknown100db7f4*& p_edge, + LegoPathBoundary*& p_boundary +) +{ + if (p_grec.size() == 0) { + p_v1 = p_grec.m_unk0x0c; + p_v2 = p_grec.m_unk0x20; + p_boundary = p_grec.m_boundary; + p_grec.SetBit1(FALSE); + return 1; + } + + p_edge = p_grec.front().m_edge; + p_boundary = p_grec.front().m_boundary; + p_grec.pop_front(); + + Mx3DPointFloat vec; + p_v1 = *p_edge->CCWVertex(*p_boundary); + p_v1.Sub(p_edge->GetOpposingPoint(*p_boundary)); + p_v1.Mul(p_f1); + p_v1.Add(p_edge->GetOpposingPoint(*p_boundary)); + p_edge->FUN_1002ddc0(*p_boundary, vec); + p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec); + return 0; +} diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index ccd28cd8..c22310a3 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -97,7 +97,7 @@ void LegoRaceCar::VTable0x98() } // STUB: LEGO1 0x10014580 -MxResult LegoRaceCar::WaitForAnimation() +MxResult LegoRaceCar::VTable0x9c() { // TODO return SUCCESS; From 7538988f50b265f149611d7af93d998798b24e62 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 20 May 2024 12:27:54 -0400 Subject: [PATCH 13/16] Implement LegoPathActor::VTable0x9c (#942) * Implement LegoPathActor::VTable0x9c * Add annotation --- .../lego/legoomni/include/legocarraceactor.h | 5 +- LEGO1/lego/legoomni/include/legojetski.h | 5 +- .../legoomni/include/legojetskiraceactor.h | 7 +- LEGO1/lego/legoomni/include/legopathactor.h | 6 +- .../legoomni/include/legopathcontroller.h | 2 +- .../legoomni/include/legopathedgecontainer.h | 2 + LEGO1/lego/legoomni/include/legoracecar.h | 5 +- .../legoomni/src/entity/legocarraceactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legojetski.cpp | 2 +- .../src/entity/legojetskiraceactor.cpp | 2 +- .../legoomni/src/paths/legoextraactor.cpp | 1 + .../lego/legoomni/src/paths/legopathactor.cpp | 81 ++++++++++++++++++- .../legoomni/src/paths/legopathcontroller.cpp | 2 +- LEGO1/lego/legoomni/src/race/legoracecar.cpp | 2 +- 14 files changed, 105 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocarraceactor.h b/LEGO1/lego/legoomni/include/legocarraceactor.h index dc0a74be..060ac703 100644 --- a/LEGO1/lego/legoomni/include/legocarraceactor.h +++ b/LEGO1/lego/legoomni/include/legocarraceactor.h @@ -38,8 +38,9 @@ class LegoCarRaceActor : public virtual LegoRaceActor { void VTable0x70(float p_float) override; // vtable+0x70 MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98() override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c + void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + override; // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_10080590(); diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h index 682fbda8..a90f817b 100644 --- a/LEGO1/lego/legoomni/include/legojetski.h +++ b/LEGO1/lego/legoomni/include/legojetski.h @@ -43,8 +43,9 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98() override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c + void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + override; // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_100136f0(float p_worldSpeed); diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h index e4616527..d7b58c63 100644 --- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h +++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h @@ -36,9 +36,10 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor { Vector3& p_v3 ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x98() override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c - void VTable0x1c() override; // vtable+0x1c + void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + override; // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c + void VTable0x1c() override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10081d40 // LegoJetskiRaceActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 261ee3a6..fd62fa76 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -86,7 +86,11 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d50 virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94 - virtual void VTable0x98(); // vtable+0x98 + virtual void VTable0x98( + LegoPathBoundary*& p_boundary, + LegoUnknown100db7f4*& p_edge, + float& p_unk0xe4 + ); // vtable+0x98 virtual MxResult VTable0x9c(); // vtable+0x9c // FUNCTION: LEGO1 0x10002d60 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 10b83de5..e5d84e94 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -103,7 +103,7 @@ class LegoPathController : public MxCore { LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); - MxU32 FUN_1004a240( + MxS32 FUN_1004a240( LegoPathEdgeContainer& p_grec, Vector3& p_v1, Vector3& p_v2, diff --git a/LEGO1/lego/legoomni/include/legopathedgecontainer.h b/LEGO1/lego/legoomni/include/legopathedgecontainer.h index 2d6f7b38..c133122c 100644 --- a/LEGO1/lego/legoomni/include/legopathedgecontainer.h +++ b/LEGO1/lego/legoomni/include/legopathedgecontainer.h @@ -40,6 +40,8 @@ struct LegoPathEdgeContainer : public list { } } + MxU32 GetBit1() { return m_flags & c_bit1; } + Mx3DPointFloat m_unk0x0c; // 0x0c Mx3DPointFloat m_unk0x20; // 0x20 LegoPathBoundary* m_boundary; // 0x34 diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index b8b1f66b..6427fbf9 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -42,8 +42,9 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98() override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c + void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + override; // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c virtual void FUN_10012ea0(float p_worldSpeed); virtual void FUN_10012ff0(float); diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index a7d7f3ad..e2f807fc 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -72,7 +72,7 @@ void LegoCarRaceActor::VTable0x70(float p_float) } // STUB: LEGO1 0x10081d20 -void LegoCarRaceActor::VTable0x98() +void LegoCarRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index 38d881d1..8d64dcd9 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -71,7 +71,7 @@ MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } // STUB: LEGO1 0x100141c0 -void LegoJetski::VTable0x98() +void LegoJetski::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp index e19e6cb3..bdb8539f 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp @@ -38,7 +38,7 @@ void LegoJetskiRaceActor::VTable0x70(float p_float) } // STUB: LEGO1 0x100822d0 -void LegoJetskiRaceActor::VTable0x98() +void LegoJetskiRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 900e7c5c..b3118e38 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -400,6 +400,7 @@ void LegoExtraActor::SetWorldSpeed(MxFloat p_worldSpeed) if (m_curAnim == 0 && p_worldSpeed > 0) { VTable0xc4(); } + LegoAnimActor::SetWorldSpeed(p_worldSpeed); } diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index f30e2136..9c608ddf 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -418,7 +418,8 @@ void LegoPathActor::VTable0x70(float p_time) } // STUB: LEGO1 0x1002e8b0 -void LegoPathActor::VTable0x98() +// FUNCTION: BETA10 0x100af2f7 +void LegoPathActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } @@ -545,11 +546,85 @@ void LegoPathActor::ParseAction(char* p_extra) LegoActor::ParseAction(p_extra); } -// STUB: LEGO1 0x1002f1b0 +// FUNCTION: LEGO1 0x1002f1b0 // FUNCTION: BETA10 0x100af899 MxResult LegoPathActor::VTable0x9c() { - // TODO + Mx3DPointFloat local34; + Mx3DPointFloat local48; + MxU32 local1c = 1; + MxU32 local20 = 1; + + if (m_grec != NULL) { + if (m_grec->GetBit1()) { + local1c = 0; + local20 = 0; + + Mx3DPointFloat vec; + switch (m_controller->FUN_1004a240(*m_grec, local34, local48, m_unk0xe4, m_destEdge, m_boundary)) { + case 0: + case 1: + break; + default: + return FAILURE; + } + } + else { + delete m_grec; + m_grec = NULL; + } + } + + if (local1c != 0) { + VTable0x98(m_boundary, m_destEdge, m_unk0xe4); + } + + if (local20 != 0) { + Mx3DPointFloat local78; + + Vector3& v1 = *m_destEdge->GetOpposingPoint(*m_boundary); + Vector3& v2 = *m_destEdge->CCWVertex(*m_boundary); + + LERP3(local34, v1, v2, m_unk0xe4); + + m_destEdge->FUN_1002ddc0(*m_boundary, local78); + local48.EqualsCross(m_boundary->GetUnknown0x14(), &local78); + local48.Unitize(); + } + + Vector3 rightRef(m_unk0xec[0]); + Vector3 upRef(m_unk0xec[1]); + Vector3 dirRef(m_unk0xec[2]); + + upRef = *m_boundary->GetUnknown0x14(); + + rightRef.EqualsCross(&upRef, &dirRef); + rightRef.Unitize(); + + dirRef.EqualsCross(&rightRef, &upRef); + dirRef.Unitize(); + + Mx3DPointFloat localc0(m_unk0xec[3]); + Mx3DPointFloat local84(m_unk0xec[2]); + Mx3DPointFloat local70(local34); + + ((Vector3&) local70).Sub(&localc0); + float len = local70.LenSquared(); + if (len >= 0.0f) { + len = sqrt(len); + ((Vector3&) local84).Mul(len); + ((Vector3&) local48).Mul(len); + } + + if (!m_userNavFlag) { + ((Vector3&) local84).Mul(-1.0f); + } + + if (VTable0x80(localc0, local84, local34, local48) != SUCCESS) { + return FAILURE; + } + + m_unk0x7c = 0.0f; return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index ec7c8530..8894ea40 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -731,7 +731,7 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat& // FUNCTION: LEGO1 0x1004a240 // FUNCTION: BETA10 0x100b9160 -MxU32 LegoPathController::FUN_1004a240( +MxS32 LegoPathController::FUN_1004a240( LegoPathEdgeContainer& p_grec, Vector3& p_v1, Vector3& p_v2, diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index c22310a3..e520317a 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -91,7 +91,7 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } // STUB: LEGO1 0x10014550 -void LegoRaceCar::VTable0x98() +void LegoRaceCar::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } From bc91fd2189017ebab6643fbab1bb20a9107394cd Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 20 May 2024 14:27:00 -0400 Subject: [PATCH 14/16] Implement/match LegoPathActor::SwitchBoundary (#943) * Implement/match LegoPathActor::SwitchBoundary * Rename var --- .../lego/legoomni/include/legocarraceactor.h | 2 +- LEGO1/lego/legoomni/include/legoextraactor.h | 2 +- LEGO1/lego/legoomni/include/legojetski.h | 2 +- .../legoomni/include/legojetskiraceactor.h | 2 +- LEGO1/lego/legoomni/include/legopathactor.h | 8 +- .../lego/legoomni/include/legopathboundary.h | 6 ++ LEGO1/lego/legoomni/include/legoracecar.h | 2 +- .../legoomni/src/entity/legocarraceactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legojetski.cpp | 2 +- .../src/entity/legojetskiraceactor.cpp | 2 +- .../legoomni/src/paths/legoextraactor.cpp | 8 +- .../lego/legoomni/src/paths/legopathactor.cpp | 10 +- .../legoomni/src/paths/legopathboundary.cpp | 97 +++++++++++++++++++ LEGO1/lego/legoomni/src/race/legoracecar.cpp | 2 +- LEGO1/lego/sources/geom/legounkown100db7f4.h | 6 ++ 15 files changed, 131 insertions(+), 22 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocarraceactor.h b/LEGO1/lego/legoomni/include/legocarraceactor.h index 060ac703..41994ea5 100644 --- a/LEGO1/lego/legoomni/include/legocarraceactor.h +++ b/LEGO1/lego/legoomni/include/legocarraceactor.h @@ -38,7 +38,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor { void VTable0x70(float p_float) override; // vtable+0x70 MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index 2e8bae7d..7d75f338 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -47,7 +47,7 @@ class LegoExtraActor : public virtual LegoAnimActor { MxU32 VTable0x90(float p_float, Matrix4& p_matrix) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x9c() override; // vtable+0x9c - void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4 + void VTable0xa4(MxBool& p_und1, MxS32& p_und2) override; // vtable+0xa4 void VTable0xc4() override; // vtable+0xc4 virtual MxResult FUN_1002aae0(); diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h index a90f817b..30000b5d 100644 --- a/LEGO1/lego/legoomni/include/legojetski.h +++ b/LEGO1/lego/legoomni/include/legojetski.h @@ -43,7 +43,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h index d7b58c63..27ba401a 100644 --- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h +++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h @@ -36,7 +36,7 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor { Vector3& p_v3 ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c void VTable0x1c() override; // vtable+0x1c diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index fd62fa76..c43e5877 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -54,7 +54,7 @@ class LegoPathActor : public LegoActor { virtual void SetUserNavFlag(MxBool p_userNavFlag) { m_userNavFlag = p_userNavFlag; } // vtable+0x78 // FUNCTION: LEGO1 0x10002d30 - virtual MxU8 GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c + virtual MxBool GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c virtual MxResult VTable0x80( Vector3& p_point1, @@ -86,7 +86,7 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d50 virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94 - virtual void VTable0x98( + virtual void SwitchBoundary( LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4 @@ -96,8 +96,8 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d60 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 - virtual void VTable0xa4(MxU8&, MxS32&); // vtable+0xa4 - virtual void VTable0xa8(); // vtable+0xa8 + virtual void VTable0xa4(MxBool&, MxS32&); // vtable+0xa4 + virtual void VTable0xa8(); // vtable+0xa8 // FUNCTION: LEGO1 0x10002d70 virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 448eb37c..f46633d7 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -34,6 +34,12 @@ class LegoPathBoundary : public LegoWEGEdge { MxResult AddActor(LegoPathActor* p_actor); MxResult RemoveActor(LegoPathActor* p_actor); void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor); + void SwitchBoundary( + LegoPathActor* p_actor, + LegoPathBoundary*& p_boundary, + LegoUnknown100db7f4*& p_edge, + float& p_unk0xe4 + ); MxU32 Intersect( float p_scale, Vector3& p_point1, diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index 6427fbf9..51c248ca 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -42,7 +42,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index e2f807fc..33c04798 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -72,7 +72,7 @@ void LegoCarRaceActor::VTable0x70(float p_float) } // STUB: LEGO1 0x10081d20 -void LegoCarRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index 8d64dcd9..a0e72803 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -71,7 +71,7 @@ MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } // STUB: LEGO1 0x100141c0 -void LegoJetski::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoJetski::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp index bdb8539f..9faead44 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp @@ -38,7 +38,7 @@ void LegoJetskiRaceActor::VTable0x70(float p_float) } // STUB: LEGO1 0x100822d0 -void LegoJetskiRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoJetskiRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index b3118e38..9b3a6304 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -109,19 +109,19 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform) } // FUNCTION: LEGO1 0x1002aa90 -void LegoExtraActor::VTable0xa4(MxU8& p_und1, MxS32& p_und2) +void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) { switch (m_unk0x0c) { case 1: - p_und1 = 1; + p_und1 = TRUE; p_und2 = 1; break; case 2: - p_und1 = 0; + p_und1 = FALSE; p_und2 = 1; break; default: - p_und1 = 1; + p_und1 = TRUE; p_und2 = rand() % p_und2 + 1; break; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 9c608ddf..ee0da2fa 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -417,11 +417,11 @@ void LegoPathActor::VTable0x70(float p_time) } } -// STUB: LEGO1 0x1002e8b0 +// FUNCTION: LEGO1 0x1002e8b0 // FUNCTION: BETA10 0x100af2f7 -void LegoPathActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { - // TODO + m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); } // FUNCTION: LEGO1 0x1002e8d0 @@ -576,7 +576,7 @@ MxResult LegoPathActor::VTable0x9c() } if (local1c != 0) { - VTable0x98(m_boundary, m_destEdge, m_unk0xe4); + SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4); } if (local20 != 0) { @@ -629,7 +629,7 @@ MxResult LegoPathActor::VTable0x9c() } // STUB: LEGO1 0x1002f650 -void LegoPathActor::VTable0xa4(MxU8&, MxS32&) +void LegoPathActor::VTable0xa4(MxBool&, MxS32&) { // TODO } diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index dedfc2f4..729b1575 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -80,6 +80,103 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa } } +// FUNCTION: LEGO1 0x10057720 +// FUNCTION: BETA10 0x100b17ef +void LegoPathBoundary::SwitchBoundary( + LegoPathActor* p_actor, + LegoPathBoundary*& p_boundary, + LegoUnknown100db7f4*& p_edge, + float& p_unk0xe4 +) +{ + LegoUnknown100db7f4* e = p_edge; + + if (p_edge->Unknown2(*p_boundary)) { + LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary); + + if (newBoundary == NULL) { + newBoundary = p_boundary; + } + + MxS32 local10 = 0; + MxU8 userNavFlag; + + if (e->Unknown(*newBoundary, 1)) { + userNavFlag = p_actor->GetUserNavFlag(); + } + else { + userNavFlag = TRUE; + } + + do { + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); + + if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) { + local10++; + } + } while (p_edge != e); + + MxBool localc = TRUE; + MxS32 local8 = local10 - 1; + + if (local10 <= 1) { + local8 = 0; + } + else if (local10 == 2) { + local8 = 1; + } + else { + p_actor->VTable0xa4(localc, local8); + } + + while (local8 > 0) { + if (localc) { + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + } + else { + p_edge = (LegoUnknown100db7f4*) p_edge->GetClockwiseEdge(*newBoundary); + } + + LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); + + if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) { + local8--; + } + } + + if (p_edge == e) { + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + } + + if (p_boundary != newBoundary) { + p_boundary->RemoveActor(p_actor); + p_boundary = newBoundary; + p_boundary->AddActor(p_actor); + } + else { + p_unk0xe4 = 1.0 - p_unk0xe4; + } + } + else { + do { + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + + if (p_edge->GetMask0x03()) { + break; + } + } while (p_edge != e); + + if (p_edge == e) { + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + } + + p_unk0xe4 = 1.0 - p_unk0xe4; + } +} + // FUNCTION: LEGO1 0x10057950 // FUNCTION: BETA10 0x100b1adc MxU32 LegoPathBoundary::Intersect( diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index e520317a..949ae142 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -91,7 +91,7 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } // STUB: LEGO1 0x10014550 -void LegoRaceCar::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 7c73a9e3..4e6ffead 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -41,6 +41,12 @@ struct LegoUnknown100db7f4 : public LegoEdge { (p_face.IsEqual(*m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask); } + // FUNCTION: BETA10 0x100b53b0 + LegoU32 Unknown2(LegoWEGEdge& p_face) + { + return (p_face.IsEqual(*m_faceA) && (m_flags & c_bit1)) || (p_face.IsEqual(*m_faceB) && (m_flags & c_bit2)); + } + // FUNCTION: BETA10 0x1001cbe0 LegoWEEdge* OtherFace(LegoWEEdge* p_other) { From 8fee73c525662606c84e1bca1396cb99b95c89f3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 21 May 2024 15:03:50 -0400 Subject: [PATCH 15/16] Implement/match LegoPathStruct (#944) * Implement/match LegoPathStruct * Rename some nums * Consistent naming * Naming * relax regex * Name some functions * Improve naming * Rename --- LEGO1/lego/legoomni/include/isle.h | 1 + LEGO1/lego/legoomni/include/jukeboxstate.h | 2 +- .../legoomni/include/legoanimationmanager.h | 4 +- .../legoomni/include/legohideanimpresenter.h | 3 +- .../legoomni/include/legopathcontroller.h | 2 +- LEGO1/lego/legoomni/include/legopathstruct.h | 36 +++- LEGO1/lego/legoomni/include/legoutils.h | 4 +- LEGO1/lego/legoomni/include/legoworld.h | 1 + .../legoomni/src/actors/islepathactor.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- .../legoomni/src/paths/legopathboundary.cpp | 8 +- .../legoomni/src/paths/legopathcontroller.cpp | 9 +- .../legoomni/src/paths/legopathstruct.cpp | 165 +++++++++++++++++- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- LEGO1/lego/sources/geom/legowegedge.cpp | 2 +- LEGO1/lego/sources/geom/legowegedge.h | 18 +- tools/ncc/ncc.style | 2 +- 18 files changed, 225 insertions(+), 40 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 38895964..39ab1527 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -26,6 +26,7 @@ class Isle : public LegoWorld { public: // For g_unk0x100f1198 enum { + c_bit6 = 0x20, c_bit7 = 0x40 }; diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h index dc465dfd..393da756 100644 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ b/LEGO1/lego/legoomni/include/jukeboxstate.h @@ -30,7 +30,7 @@ class JukeBoxState : public LegoState { // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' -protected: + // protected: MxU32 m_state; // 0x08 MxU32 m_active; // 0x0c }; diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 18479255..e4fe914f 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -9,11 +9,11 @@ #include "mxgeometry/mxgeometry3d.h" class AnimState; -class IslePathActor; class LegoAnimPresenter; class LegoEntity; class LegoExtraActor; class LegoFile; +class LegoPathActor; class LegoPathBoundary; class LegoROIList; struct LegoUnknown100db7f4; @@ -102,7 +102,7 @@ class LegoAnimationManager : public MxCore { MxBool p_param8, MxBool p_param9 ); - void CameraTriggerFire(IslePathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool); + void CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool); void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); diff --git a/LEGO1/lego/legoomni/include/legohideanimpresenter.h b/LEGO1/lego/legoomni/include/legohideanimpresenter.h index 0bb652d7..d560f224 100644 --- a/LEGO1/lego/legoomni/include/legohideanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legohideanimpresenter.h @@ -47,10 +47,11 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { void VTable0x8c() override; // vtable+0x8c void VTable0x90() override; // vtable+0x90 + void FUN_1006db40(LegoTime p_time); + private: void Init(); void Destroy(MxBool p_fromDestructor); - void FUN_1006db40(LegoTime p_time); void FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time); void FUN_1006dc10(); void FUN_1006e3f0(LegoHideAnimStructMap& p_map, LegoTreeNode* p_node); diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index e5d84e94..a65a1f34 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -9,7 +9,7 @@ #include "mxstl/stlcompat.h" class LegoAnimPresenter; -struct LegoPathStruct; +class LegoPathStruct; class LegoWorld; class MxAtomId; class Vector3; diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 174ad7b8..062da938 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -12,7 +12,17 @@ class LegoWorld; // SIZE 0x0c struct LegoPathStructBase { public: - LegoPathStructBase() : m_name(NULL), m_unk0x08(0) {} + enum { + c_bit1 = 0x01 << 24, + c_bit2 = 0x02 << 24, + c_bit3 = 0x04 << 24, + c_bit4 = 0x08 << 24, + c_bit5 = 0x10 << 24, + c_bit6 = 0x20 << 24, + c_bit7 = 0x40 << 24 + }; + + LegoPathStructBase() : m_name(NULL), m_flags(0) {} // FUNCTION: LEGO1 0x10047420 virtual ~LegoPathStructBase() @@ -22,25 +32,41 @@ struct LegoPathStructBase { } } - char* m_name; // 0x04 - undefined4 m_unk0x08; // 0x08 + char* m_name; // 0x04 + MxU32 m_flags; // 0x08 }; // VTABLE: LEGO1 0x100d7da0 // SIZE 0x14 -struct LegoPathStruct : public LegoPathStructBase { +class LegoPathStruct : public LegoPathStructBase { public: + enum Trigger { + c_camAnim = 'C', + c_d = 'D', + c_e = 'E', + c_g = 'G', + c_h = 'H', + c_music = 'M', + c_s = 'S', + c_w = 'W' + }; + // FUNCTION: LEGO1 0x100473a0 LegoPathStruct() : m_world(NULL) {} // FUNCTION: LEGO1 0x10047470 ~LegoPathStruct() override {} - virtual void VTable0x04(LegoPathActor*, undefined4, undefined4); // vtable+0x04 + virtual void HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data); // vtable+0x04 inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; } +private: + MxBool HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool); + void FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool); + void PlayMusic(MxBool p_direction, MxU32 p_data); + LegoWorld* m_world; // 0x0c MxAtomId m_atomId; // 0x10 }; diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 36364268..118b6c1d 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -7,12 +7,12 @@ #include -class IslePathActor; class MxAtomId; class LegoEntity; class LegoFile; class LegoAnimPresenter; class LegoNamedTexture; +class LegoPathActor; class LegoROI; class LegoTreeNode; @@ -24,7 +24,7 @@ Extra::ActionType MatchActionString(const char*); void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender); void SetCameraControllerFromIsle(); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); -void PlayCamAnim(IslePathActor* p_actor, undefined4 p_unused, MxU32 p_location, MxBool p_bool); +void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool p_enable); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index cde4f4b1..5e54c748 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -94,6 +94,7 @@ class LegoWorld : public LegoEntity { inline MxS32 GetScriptIndex() { return m_scriptIndex; } inline MxCoreSet& GetUnknown0xd0() { return m_set0xd0; } inline list& GetROIList() { return m_roiList; } + inline LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnimPresenter; } inline void SetScriptIndex(MxS32 p_scriptIndex) { m_scriptIndex = p_scriptIndex; } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 91cf9804..72f558aa 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -535,7 +535,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p } if (camAnim) { - PlayCamAnim(this, 0, g_spawnLocations[i].m_location, TRUE); + PlayCamAnim(this, FALSE, g_spawnLocations[i].m_location, TRUE); } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index ce297e26..5a761d94 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1153,7 +1153,7 @@ MxResult LegoAnimationManager::FUN_10060dc0( // FUNCTION: LEGO1 0x10060eb0 // FUNCTION: BETA10 0x1004206c -void LegoAnimationManager::CameraTriggerFire(IslePathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool) +void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool) { if (Lego()->m_unk0x13c && m_enableCamAnims && !m_animRunning) { LegoLocation* location = LegoNavController::GetLocation(p_location); diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 0bc11754..60d96755 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -344,7 +344,7 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO // FUNCTION: LEGO1 0x1003ecc0 // FUNCTION: BETA10 0x100d4b38 -void PlayCamAnim(IslePathActor* p_actor, undefined4 p_unused, MxU32 p_location, MxBool p_bool) +void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool) { LegoWorld* world = CurrentWorld(); MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 729b1575..67116bf0 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -61,19 +61,19 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa if (dot2 > dot1) { for (MxS32 i = 0; i < m_unk0x48; i++) { - LegoPathStruct* s = m_unk0x4c[i].m_unk0x00; + LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; if (m_unk0x4c[i].m_unk0x08 >= dot1 && m_unk0x4c[i].m_unk0x08 < dot2) { - s->VTable0x04(p_actor, 1, m_unk0x4c[i].m_unk0x04); + s->HandleTrigger(p_actor, TRUE, m_unk0x4c[i].m_data); } } } else if (dot2 < dot1) { for (MxS32 i = 0; i < m_unk0x48; i++) { - LegoPathStruct* s = m_unk0x4c[i].m_unk0x00; + LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; if (m_unk0x4c[i].m_unk0x08 >= dot2 && m_unk0x4c[i].m_unk0x08 < dot1) { - s->VTable0x04(p_actor, 0, m_unk0x4c[i].m_unk0x04); + s->HandleTrigger(p_actor, FALSE, m_unk0x4c[i].m_data); } } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 8894ea40..4dd2afbf 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -528,7 +528,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) m_structs[i].m_name[length] = '\0'; } - if (p_storage->Read(&m_structs[i].m_unk0x08, sizeof(m_structs[i].m_unk0x08)) != SUCCESS) { + if (p_storage->Read(&m_structs[i].m_flags, sizeof(m_structs[i].m_flags)) != SUCCESS) { return FAILURE; } } @@ -678,17 +678,16 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) if (boundary.m_unk0x48 > 0) { boundary.m_unk0x50 = new Mx3DPointFloat; - boundary.m_unk0x4c = new LegoWEGEdge::Path[boundary.m_unk0x48]; + boundary.m_unk0x4c = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48]; for (j = 0; j < boundary.m_unk0x48; j++) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - boundary.m_unk0x4c[j].m_unk0x00 = &m_structs[s]; + boundary.m_unk0x4c[j].m_pathStruct = &m_structs[s]; - if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x04, sizeof(boundary.m_unk0x4c[j].m_unk0x04)) != - SUCCESS) { + if (p_storage->Read(&boundary.m_unk0x4c[j].m_data, sizeof(boundary.m_unk0x4c[j].m_data)) != SUCCESS) { return FAILURE; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index 5b694042..e4150852 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -1,11 +1,168 @@ #include "legopathstruct.h" +#include "isle.h" +#include "jukebox_actions.h" +#include "jukeboxstate.h" +#include "legohideanimpresenter.h" +#include "legopathactor.h" +#include "legoutils.h" +#include "misc.h" +#include "mxbackgroundaudiomanager.h" +#include "mxmisc.h" +#include "mxnotificationmanager.h" +#include "mxtype19notificationparam.h" +#include "scripts.h" + DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c) DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) -// STUB: LEGO1 0x1001b700 -// FUNCTION: BETA10 0x100c26c5 -void LegoPathStruct::VTable0x04(LegoPathActor*, undefined4, undefined4) +// Flags used in isle.cpp +extern MxU32 g_unk0x100f1198; + +// GLOBAL: LEGO1 0x100f119c +MxBool g_unk0x100f119c = FALSE; + +// FUNCTION: LEGO1 0x1001b700 +void LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data) { - // TODO + if (!HandleTrigger(p_actor, p_direction, p_data, FALSE) && g_unk0x100f119c) { + HandleTrigger(p_actor, p_direction, p_data, TRUE); + } +} + +// FUNCTION: LEGO1 0x1001b740 +// FUNCTION: BETA10 0x100c26c5 +MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, MxU32 p_data, MxBool p_bool) +{ + MxBool triggered = FALSE; + MxBool bool2 = p_bool ? !p_direction : p_direction; + + MxU32 flags = bool2 ? c_bit5 : c_bit6; + flags |= p_actor->GetCameraFlag() ? c_bit1 : (c_bit2 | c_bit3 | c_bit4); + + if ((m_flags & flags & (c_bit5 | c_bit6 | c_bit7)) && (m_flags & flags & (c_bit1 | c_bit2 | c_bit3 | c_bit4))) { + triggered = TRUE; + + switch (m_name[2]) { + case c_camAnim: + if (g_unk0x100f1198 & Isle::c_bit6) { + PlayCamAnim(p_actor, bool2, p_data, TRUE); + } + break; + case c_d: { + p_actor->VTable0x58(p_data); + + MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + p_actor->Notify(param); + + LegoWorld* world = CurrentWorld(); + if (world != NULL) { + NotificationManager()->Send(world, param); + } + break; + } + case c_e: + FUN_1001bc40(m_name, p_data, !(p_bool == FALSE)); + break; + case c_g: + break; + case c_h: { + LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter(); + + if (presenter != NULL) { + presenter->FUN_1006db40(p_data * 100); + } + break; + } + case c_music: + if (g_unk0x100f1198 & Isle::c_bit7) { + PlayMusic(p_direction, p_data); + } + break; + case c_s: { + LegoWorld* world = CurrentWorld(); + if (world != NULL) { + MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + + if (world->Notify(param) != 0) { + break; + } + } + + FUN_1001bc40(m_name, p_data, p_bool == FALSE); + break; + } + case c_w: { + LegoWorld* world = CurrentWorld(); + if (world != NULL) { + MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + NotificationManager()->Send(world, param); + } + break; + } + } + } + + return triggered; +} + +// FUNCTION: LEGO1 0x1001bc40 +// FUNCTION: BETA10 0x100c2a6c +void LegoPathStruct::FUN_1001bc40(const char* p_name, MxU32 p_data, MxBool p_bool) +{ + MxDSAction action; + action.SetObjectId(p_data); + action.SetAtomId(m_atomId); + + if (p_bool) { + action.SetUnknown24(-1); + Start(&action); + } + else { + action.SetUnknown24(-2); + DeleteObject(action); + } +} + +// FUNCTION: LEGO1 0x1001bd10 +// FUNCTION: BETA10 0x100c2b4a +void LegoPathStruct::PlayMusic(MxBool p_direction, MxU32 p_data) +{ + JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); + if (state != NULL && state->m_active) { + return; + } + + JukeboxScript::Script music[] = { + JukeboxScript::c_ResidentalArea_Music, + JukeboxScript::c_BeachBlvd_Music, + JukeboxScript::c_Cave_Music, + JukeboxScript::c_CentralRoads_Music, + JukeboxScript::c_Jail_Music, + JukeboxScript::c_Hospital_Music, + JukeboxScript::c_InformationCenter_Music, + JukeboxScript::c_PoliceStation_Music, + JukeboxScript::c_Park_Music, + JukeboxScript::c_CentralNorthRoad_Music, + JukeboxScript::c_GarageArea_Music, + JukeboxScript::c_RaceTrackRoad_Music, + JukeboxScript::c_Beach_Music, + JukeboxScript::c_Quiet_Audio + }; + + MxS16 triggersReff[24][2] = {{11, 10}, {6, 10}, {3, 1}, {4, 1}, {1, 4}, {1, 4}, {13, 2}, {13, 2}, + {13, 2}, {4, 10}, {11, 9}, {9, 7}, {8, 7}, {8, 5}, {5, 2}, {2, 4}, + {4, 2}, {4, 5}, {11, 4}, {12, 10}, {10, 12}, {10, 12}, {14, 2}, {14, 2}}; + + MxDSAction action; + action.SetAtomId(*g_jukeboxScript); + action.SetUnknown24(-1); + + if (p_data <= sizeOfArray(triggersReff)) { + action.SetObjectId(music[triggersReff[p_data - 1][p_direction == FALSE] - 1]); + } + + if (action.GetObjectId() != -1) { + BackgroundAudioManager()->PlayMusic(action, 5, 4); + } } diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 41e1a61c..ba0d822b 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -38,7 +38,7 @@ DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 -undefined4 g_unk0x100f1198 = 0x7f; +MxU32 g_unk0x100f1198 = 0x7f; // FUNCTION: LEGO1 0x10030820 Isle::Isle() diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 1eb88448..480533f6 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -1,7 +1,7 @@ #include "legowegedge.h" DECOMP_SIZE_ASSERT(LegoWEGEdge, 0x54) -DECOMP_SIZE_ASSERT(LegoWEGEdge::Path, 0x0c) +DECOMP_SIZE_ASSERT(LegoWEGEdge::PathWithTrigger, 0x0c) // FUNCTION: LEGO1 0x1009a730 LegoWEGEdge::LegoWEGEdge() diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 906ec015..3617151e 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -5,7 +5,7 @@ #include "legoweedge.h" #include "mxgeometry/mxgeometry3d.h" -struct LegoPathStruct; +class LegoPathStruct; // might be a struct with public members // VTABLE: LEGO1 0x100db7f8 @@ -20,19 +20,19 @@ class LegoWEGEdge : public LegoWEEdge { }; // SIZE 0x0c - struct Path { + struct PathWithTrigger { // FUNCTION: LEGO1 0x10048280 // FUNCTION: BETA10 0x100bd450 - Path() + PathWithTrigger() { - m_unk0x00 = NULL; - m_unk0x04 = 0; + m_pathStruct = NULL; + m_data = 0; m_unk0x08 = 0.0f; } - LegoPathStruct* m_unk0x00; // 0x00 - undefined4 m_unk0x04; // 0x04 - float m_unk0x08; // 0x08 + LegoPathStruct* m_pathStruct; // 0x00 + unsigned int m_data; // 0x04 + float m_unk0x08; // 0x08 }; LegoWEGEdge(); @@ -71,7 +71,7 @@ class LegoWEGEdge : public LegoWEEdge { Mx3DPointFloat m_unk0x30; // 0x30 LegoU32 m_unk0x44; // 0x44 LegoU8 m_unk0x48; // 0x48 - Path* m_unk0x4c; // 0x4c + PathWithTrigger* m_unk0x4c; // 0x4c Mx3DPointFloat* m_unk0x50; // 0x50 }; diff --git a/tools/ncc/ncc.style b/tools/ncc/ncc.style index 5147d6bc..4ddb4f57 100644 --- a/tools/ncc/ncc.style +++ b/tools/ncc/ncc.style @@ -1,7 +1,7 @@ ClassName: '^[A-Z][a-zA-Z0-9]+$' CppMethod: '^operator|^FUN_[a-f0-9]{8}$|^VTable0x[a-f0-9]{1,8}$|^(?!VTable)[A-Z][a-zA-Z0-9]+$' EnumName: '^\(unnamed|^[A-Z][a-zA-Z0-9]+$' -EnumConstantName: '^(c_|e_)[a-z][a-zA-Z0-9]+$' +EnumConstantName: '^(c_|e_)[a-z][a-zA-Z0-9]*$' FunctionName: '^operator|^FUN_[a-f0-9]{8}$|^VTable0x[a-f0-9]{1,8}$|^(?!VTable)[A-Z][a-zA-Z0-9]+$' ParameterName: '^p_(unk0x[a-f0-9]{1,8}$|(?!unk)[a-z][a-zA-Z0-9]*)$|^$' StructName: '^\(anon|^\(unnamed|^[A-Z][a-zA-Z0-9]+$' From 6774784b37ec185297191c0dd87251a53f3c7e4c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 22 May 2024 14:09:06 -0400 Subject: [PATCH 16/16] Implement/match LegoPathActor::VTable0xa4 and VTable0xa8 (#945) * Implement/match LegoPathActor::VTable0xa4 * Implement/match LegoPathActor::VTable0xa8 * Name enum constants --- LEGO1/lego/legoomni/include/isle.h | 5 +-- .../legoomni/include/legoanimationmanager.h | 2 +- LEGO1/lego/legoomni/include/legopathactor.h | 4 +- .../src/common/legoanimationmanager.cpp | 2 +- .../lego/legoomni/src/paths/legopathactor.cpp | 45 ++++++++++++++++--- .../legoomni/src/paths/legopathboundary.cpp | 12 ++--- .../legoomni/src/paths/legopathcontroller.cpp | 13 +++--- .../legoomni/src/paths/legopathstruct.cpp | 6 +-- LEGO1/lego/legoomni/src/worlds/isle.cpp | 6 +-- LEGO1/lego/sources/geom/legowegedge.cpp | 6 +-- LEGO1/lego/sources/geom/legowegedge.h | 20 ++++----- 11 files changed, 79 insertions(+), 42 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 39ab1527..76971271 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -24,10 +24,9 @@ class Act1State; // SIZE 0x140 class Isle : public LegoWorld { public: - // For g_unk0x100f1198 enum { - c_bit6 = 0x20, - c_bit7 = 0x40 + c_playCamAnims = 0x20, + c_playMusic = 0x40 }; Isle(); diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index e4fe914f..52aeb7c6 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -102,7 +102,7 @@ class LegoAnimationManager : public MxCore { MxBool p_param8, MxBool p_param9 ); - void CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool); + void CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU32 p_location, MxBool p_bool); void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index c43e5877..4acc28e7 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -96,8 +96,8 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002d60 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 - virtual void VTable0xa4(MxBool&, MxS32&); // vtable+0xa4 - virtual void VTable0xa8(); // vtable+0xa8 + virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4 + virtual void VTable0xa8(); // vtable+0xa8 // FUNCTION: LEGO1 0x10002d70 virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 5a761d94..2bd84167 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1153,7 +1153,7 @@ MxResult LegoAnimationManager::FUN_10060dc0( // FUNCTION: LEGO1 0x10060eb0 // FUNCTION: BETA10 0x1004206c -void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool) +void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU32 p_location, MxBool p_bool) { if (Lego()->m_unk0x13c && m_enableCamAnims && !m_animRunning) { LegoLocation* location = LegoNavController::GetLocation(p_location); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index ee0da2fa..c26aec13 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -628,14 +628,49 @@ MxResult LegoPathActor::VTable0x9c() return SUCCESS; } -// STUB: LEGO1 0x1002f650 -void LegoPathActor::VTable0xa4(MxBool&, MxS32&) +// FUNCTION: LEGO1 0x1002f650 +// FUNCTION: BETA10 0x100afd67 +void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) { - // TODO + switch (GetActorId()) { + case 1: + p_und1 = TRUE; + p_und2 = 2; + break; + case 2: + p_und1 = FALSE; + p_und2 = 1; + break; + case 3: + p_und1 = TRUE; + p_und2 = 1; + break; + case 4: + case 6: + p_und1 = TRUE; + p_und2 = rand() % p_und2 + 1; + break; + case 5: + p_und1 = FALSE; + p_und2 = 2; + break; + default: + p_und1 = TRUE; + p_und2 = 1; + break; + } } -// STUB: LEGO1 0x1002f700 +// FUNCTION: LEGO1 0x1002f700 +// FUNCTION: BETA10 0x100afe4c void LegoPathActor::VTable0xa8() { - // TODO + m_lastTime = Timer()->GetTime(); + m_roi->FUN_100a58f0(m_unk0xec); + m_roi->VTable0x14(); + + if (m_userNavFlag) { + m_roi->WrappedSetLocalTransform(m_unk0xec); + FUN_10010c30(); + } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 67116bf0..057143ec 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -61,19 +61,19 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa if (dot2 > dot1) { for (MxS32 i = 0; i < m_unk0x48; i++) { - LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; + LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; - if (m_unk0x4c[i].m_unk0x08 >= dot1 && m_unk0x4c[i].m_unk0x08 < dot2) { - s->HandleTrigger(p_actor, TRUE, m_unk0x4c[i].m_data); + if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) { + s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data); } } } else if (dot2 < dot1) { for (MxS32 i = 0; i < m_unk0x48; i++) { - LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; + LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; - if (m_unk0x4c[i].m_unk0x08 >= dot2 && m_unk0x4c[i].m_unk0x08 < dot1) { - s->HandleTrigger(p_actor, FALSE, m_unk0x4c[i].m_data); + if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) { + s->HandleTrigger(p_actor, FALSE, m_pathTrigger[i].m_data); } } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 4dd2afbf..eeed3661 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -678,21 +678,24 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) if (boundary.m_unk0x48 > 0) { boundary.m_unk0x50 = new Mx3DPointFloat; - boundary.m_unk0x4c = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48]; + boundary.m_pathTrigger = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48]; for (j = 0; j < boundary.m_unk0x48; j++) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - boundary.m_unk0x4c[j].m_pathStruct = &m_structs[s]; + boundary.m_pathTrigger[j].m_pathStruct = &m_structs[s]; - if (p_storage->Read(&boundary.m_unk0x4c[j].m_data, sizeof(boundary.m_unk0x4c[j].m_data)) != SUCCESS) { + if (p_storage->Read(&boundary.m_pathTrigger[j].m_data, sizeof(boundary.m_pathTrigger[j].m_data)) != + SUCCESS) { return FAILURE; } - if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x08, sizeof(boundary.m_unk0x4c[j].m_unk0x08)) != - SUCCESS) { + if (p_storage->Read( + &boundary.m_pathTrigger[j].m_unk0x08, + sizeof(boundary.m_pathTrigger[j].m_unk0x08) + ) != SUCCESS) { return FAILURE; } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index e4150852..db2cc767 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -17,7 +17,7 @@ DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c) DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) // Flags used in isle.cpp -extern MxU32 g_unk0x100f1198; +extern MxU32 g_isleFlags; // GLOBAL: LEGO1 0x100f119c MxBool g_unk0x100f119c = FALSE; @@ -45,7 +45,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, switch (m_name[2]) { case c_camAnim: - if (g_unk0x100f1198 & Isle::c_bit6) { + if (g_isleFlags & Isle::c_playCamAnims) { PlayCamAnim(p_actor, bool2, p_data, TRUE); } break; @@ -75,7 +75,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, break; } case c_music: - if (g_unk0x100f1198 & Isle::c_bit7) { + if (g_isleFlags & Isle::c_playMusic) { PlayMusic(p_direction, p_data); } break; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index ba0d822b..9d787a8d 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -38,7 +38,7 @@ DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 -MxU32 g_unk0x100f1198 = 0x7f; +MxU32 g_isleFlags = 0x7f; // FUNCTION: LEGO1 0x10030820 Isle::Isle() @@ -724,7 +724,7 @@ void Isle::Enable(MxBool p_enable) AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->EnableCamAnims(FALSE); - g_unk0x100f1198 &= ~c_bit7; + g_isleFlags &= ~c_playMusic; m_towtrack->FUN_1004dab0(); break; case 9: @@ -733,7 +733,7 @@ void Isle::Enable(MxBool p_enable) AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->EnableCamAnims(FALSE); - g_unk0x100f1198 &= ~c_bit7; + g_isleFlags &= ~c_playMusic; m_ambulance->FUN_10036e60(); break; case 11: diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 480533f6..afbe9ddb 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -12,7 +12,7 @@ LegoWEGEdge::LegoWEGEdge() m_edgeNormals = NULL; m_flags = 0; m_unk0x48 = 0; - m_unk0x4c = NULL; + m_pathTrigger = NULL; m_unk0x50 = NULL; } @@ -29,8 +29,8 @@ LegoWEGEdge::~LegoWEGEdge() if (m_edgeNormals) { delete[] m_edgeNormals; } - if (m_unk0x4c) { - delete m_unk0x4c; + if (m_pathTrigger) { + delete m_pathTrigger; } if (m_unk0x50) { delete m_unk0x50; diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 3617151e..aff336e6 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -63,16 +63,16 @@ class LegoWEGEdge : public LegoWEEdge { friend class LegoPathController; protected: - LegoU8 m_flags; // 0x0c - LegoU8 m_unk0x0d; // 0x0d - LegoChar* m_name; // 0x10 - Mx4DPointFloat m_unk0x14; // 0x14 - Mx4DPointFloat* m_edgeNormals; // 0x2c - Mx3DPointFloat m_unk0x30; // 0x30 - LegoU32 m_unk0x44; // 0x44 - LegoU8 m_unk0x48; // 0x48 - PathWithTrigger* m_unk0x4c; // 0x4c - Mx3DPointFloat* m_unk0x50; // 0x50 + LegoU8 m_flags; // 0x0c + LegoU8 m_unk0x0d; // 0x0d + LegoChar* m_name; // 0x10 + Mx4DPointFloat m_unk0x14; // 0x14 + Mx4DPointFloat* m_edgeNormals; // 0x2c + Mx3DPointFloat m_unk0x30; // 0x30 + LegoU32 m_unk0x44; // 0x44 + LegoU8 m_unk0x48; // 0x48 + PathWithTrigger* m_pathTrigger; // 0x4c + Mx3DPointFloat* m_unk0x50; // 0x50 }; #endif // __LEGOWEGEDGE_H