From 253882bdcb301e6fb2058e3fb84bb09229565693 Mon Sep 17 00:00:00 2001 From: Mark Langen Date: Mon, 6 May 2024 04:15:19 -0700 Subject: [PATCH 01/89] Start work on building save data (#885) * Start work on building save data * Add LegoBuildingData struct to LegoBuildingManager, naming mirrors LegoCharacterData in LegoCharacterManager. * 100% match of many methods in LegoBuildingManager using the struct. * Formatting * Add required includes post merge * Format again * Better follow naming conventions * Format again again * Also fill in template data * Fix data * Change braces * Match functions, consistent style, add missing annotations, some BETA annotations --------- Co-authored-by: Christian Semmler --- .../legoomni/include/legobuildingmanager.h | 50 +- .../src/build/legobuildingmanager.cpp | 489 +++++++++++++++++- .../src/common/legocharactermanager.cpp | 40 +- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 2 +- 4 files changed, 540 insertions(+), 41 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 380a1c99..cd39a01a 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -7,6 +7,32 @@ class LegoEntity; class LegoROI; class LegoStorage; +class LegoWorld; + +// SIZE 0x2c +struct LegoBuildingInfo { + enum { + c_bit1 = 0x01, + c_bit2 = 0x02, + c_bit3 = 0x04, + c_bit4 = 0x08 + }; + + LegoEntity* m_entity; // 0x00 + const char* m_hausName; // 0x04 + MxU32 m_cycle1; // 0x08 + MxU32 m_cycle2; // 0x0c + MxU8 m_cycle3; // 0x10 + MxS8 m_unk0x11; // 0x11 + MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 + MxU8 m_flags; // 0x13 + float m_unk0x014; // 0x14 + const char* m_unk0x18; // 0x18 + float m_x; // 0x1c + float m_y; // 0x20 + float m_z; // 0x24 + undefined* m_unk0x28; // 0x28 +}; // VTABLE: LEGO1 0x100d6f50 // SIZE 0x30 @@ -29,13 +55,21 @@ class LegoBuildingManager : public MxCore { void Init(); void FUN_1002fa00(); + void UpdatePosition(MxS32 p_index, LegoWorld* p_world); void FUN_1002fb30(); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); - MxBool FUN_1002fdb0(LegoEntity* p_entity); + LegoBuildingInfo* GetInfo(LegoEntity* p_entity); + MxBool IncrementVariant(LegoEntity* p_entity); + MxBool FUN_1002fe40(LegoEntity* p_entity); + MxBool FUN_1002fe80(LegoEntity* p_entity); + MxBool FUN_1002fed0(LegoEntity* p_entity); MxU32 FUN_1002ff40(LegoEntity*, MxBool); - void FUN_10030000(LegoEntity* p_entity); + MxBool FUN_10030000(LegoEntity* p_entity); + MxBool FUN_10030030(MxS32 p_index); + MxBool FUN_10030110(LegoBuildingInfo* p_data); void FUN_10030590(); + void AdjustHeight(MxS32 p_index); // SYNTHETIC: LEGO1 0x1002f940 // LegoBuildingManager::`scalar deleting destructor' @@ -43,7 +77,17 @@ class LegoBuildingManager : public MxCore { private: static char* g_customizeAnimFile; - undefined m_unk0x08[0x28]; // 0x08 + MxU8 m_nextVariant; // 0x08 + MxU8 m_unk0x09; // 0x09 + undefined4 m_unk0x0c; // 0x0c + undefined4 m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 + undefined4 m_unk0x18; // 0x18 + undefined4 m_unk0x1c; // 0x1c + MxU8 m_unk0x20; // 0x20 + undefined4 m_unk0x24; // 0x24 + MxU8 m_unk0x28; // 0x28 + undefined4 m_unk0x2c; // 0x2c }; #endif // LEGOBUILDINGMANAGER_H diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 1b7c4273..02e878be 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -1,12 +1,204 @@ #include "legobuildingmanager.h" +#include "3dmanager/lego3dmanager.h" +#include "legoentity.h" +#include "legovideomanager.h" +#include "legoworld.h" +#include "misc.h" +#include "misc/legostorage.h" + DECOMP_SIZE_ASSERT(LegoBuildingManager, 0x30) +DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c) + +// GLOBAL: LEGO1 0x100f3410 +const char* g_buildingDataHausName[5] = { + "haus1", + "haus4", + "haus5", + "haus6", + "haus7", +}; + +// clang-format off +// GLOBAL: LEGO1 0x100f3428 +float g_buildingDataDownshiftScale[16] = { + 0.0f, 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f, +}; + +// GLOBAL: LEGO1 0x100f3468 +MxU8 g_buildingDataDownshift[16] = { + 5, 5, 5, 5, + 3, 5, 5, 5, + 3, 5, 5, 5, + 5, 5, 5, 5, +}; + +// GLOBAL: LEGO1 0x100f3478 +LegoBuildingInfo g_buildingInfoInit[16] = { + { + NULL, "infocen", + 4, 0, 1, + -1, -1, 0x00, + 8.99999f, + "edg02_74", + 84.79617f, 9.0f, -10.2189f, + NULL, + }, + { + NULL, "policsta", + 4, 0, 1, + -1, -1, 0x10, + 0.999992f, + "int33", + 67.28488, 1.0f, -85.3917, + NULL, + }, + { + NULL, "Jail", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "edg02_50", + 93.245659f, 0.0f, -48.7773f, + NULL, + }, + { + NULL, "races", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "int14", + -21.7321f, 0.0f, 11.23354f, + NULL, + }, + { + NULL, "medcntr", + 4, 0, 1, + -1, -1, 0x10, + 3.99071f, + "edg02_27", + 86.020737f, 4.0f, 31.35498f, + NULL, + }, + { + NULL, "gas", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "int24", + 26.32025f, 0.0f, -2.28938f, + NULL, + }, + { + NULL, "beach", + 4, 0, 1, + -1, -1, 0x10, + -1.8125f, + "edg00_46", + 14.375f, -1.3125f, -56.75f, + NULL, + }, + { + NULL, "racef", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "edg03_03", + -4.15951f, 0.0f, 5.2003198f, + NULL, + }, + { + NULL, "racej", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "edg03_03", + -4.15951f, 0.0f, 5.2003198f, + NULL, + }, + { + NULL, "Store", + 4, 0, 1, + -1, -1, 0x3e, + 2.0f, + "edg02_60", + -49.4744f, 2.0f, -56.6276f, + NULL, + }, + { + NULL, "Bank", + 4, 0, 1, + -1, -1, 0x3e, + 0.0f, + "edg02_36", + 18.53531f, 0.0f, -16.6053f, + NULL, + }, + { + NULL, "Post", + 4, 0, 1, + -1, -1, 0x3e, + 0.0f, + "edg02_58", + -33.5413f, 0.0f, -55.1791f, + NULL, + }, + { + NULL, "haus1", + 4, 0, 1, + -1, -1, 0x3f, + 7.0625f, + "int11", + -62.7827f, 7.0f, -45.2215f, + NULL, + }, + { + NULL, "haus2", + 4, 0, 1, + -1, -1, 0x3e, + 8.0f, + "int07", + -69.2376f, 8.0f, -6.8008099f, + NULL, + }, + { + NULL, "haus3", + 4, 0, 1, + -1, -1, 0x3e, + 7.0f, + "edg01_24", + -69.0596f, 7.0f, -24.4928f, + NULL, + }, + { + NULL, "Pizza", + 4, 0, 1, + -1, -1, 0x10, + 0.0f, + "int37", + -17.9438f, 0.0f, -46.827999f, + NULL, + }, +}; +// clang-format on + +// GLOBAL: LEGO1 0x100f3738 +MxU32 g_buildingCycle1Length = 6; // GLOBAL: LEGO1 0x100f37c8 char* LegoBuildingManager::g_customizeAnimFile = NULL; // GLOBAL: LEGO1 0x100f37cc -int g_buildingManagerConfig = 1; +MxS32 g_buildingManagerConfig = 1; + +// GLOBAL: LEGO1 0x10104c30 +LegoBuildingInfo g_buildingInfo[16]; + +// GLOBAL: LEGO1 0x100f3748 +MxS32 g_buildingCycle2Length[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0}; // FUNCTION: LEGO1 0x1002f8b0 void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig) @@ -20,22 +212,72 @@ LegoBuildingManager::LegoBuildingManager() Init(); } -// STUB: LEGO1 0x1002f960 +// FUNCTION: LEGO1 0x1002f960 LegoBuildingManager::~LegoBuildingManager() { - // TODO + delete g_customizeAnimFile; } -// STUB: LEGO1 0x1002f9d0 +// FUNCTION: LEGO1 0x1002f9d0 void LegoBuildingManager::Init() { - // TODO + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + g_buildingInfo[i] = g_buildingInfoInit[i]; + } + + m_nextVariant = 0; + m_unk0x09 = 0; + m_unk0x20 = 0; + m_unk0x24 = 0; + m_unk0x28 = 0; } -// STUB: LEGO1 0x1002fa00 +// FUNCTION: LEGO1 0x1002fa00 +// FUNCTION: BETA10 0x10063ad1 void LegoBuildingManager::FUN_1002fa00() { - // TODO + MxS32 i; + LegoWorld* world = CurrentWorld(); + + for (i = 0; i < _countof(g_buildingInfo); i++) { + UpdatePosition(i, world); + } + + if (g_buildingManagerConfig <= 1) { + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingDataHausName[0]); + if (entity) { + entity->GetROI()->SetVisibility(TRUE); + m_unk0x09 = 0; + } + } + else { + for (i = 0; i < _countof(g_buildingDataHausName); i++) { + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingDataHausName[i]); + if (entity) { + entity->GetROI()->SetVisibility(m_nextVariant == i); + } + } + } + + m_unk0x09 = 0; +} + +// FUNCTION: LEGO1 0x1002fa90 +// FUNCTION: BETA10 0x10063b88 +void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world) +{ + LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_hausName); + + if (entity) { + entity->SetType(LegoEntity::e_building); + g_buildingInfo[p_index].m_entity = entity; + LegoROI* roi = entity->GetROI(); + AdjustHeight(p_index); + MxMatrix mat = roi->GetLocal2World(); + mat[3][1] = g_buildingInfo[p_index].m_unk0x014; + roi->FUN_100a46b0(mat); + VideoManager()->Get3DManager()->Moved(*roi); + } } // STUB: LEGO1 0x1002fb30 @@ -44,25 +286,214 @@ void LegoBuildingManager::FUN_1002fb30() // TODO } -// STUB: LEGO1 0x1002fb80 +// FUNCTION: LEGO1 0x1002fb80 +// FUNCTION: BETA10 0x10063cae MxResult LegoBuildingManager::Write(LegoStorage* p_storage) { - return SUCCESS; + MxResult result = FAILURE; + + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + LegoBuildingInfo* info = &g_buildingInfo[i]; + + if (p_storage->Write(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) { + goto done; + } + } + + if (p_storage->Write(&m_nextVariant, sizeof(m_nextVariant)) != SUCCESS) { + goto done; + } + + result = SUCCESS; + +done: + return result; } -// STUB: LEGO1 0x1002fc10 +// FUNCTION: LEGO1 0x1002fc10 +// FUNCTION: BETA10 0x10063dde MxResult LegoBuildingManager::Read(LegoStorage* p_storage) { - return SUCCESS; + MxResult result = FAILURE; + + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + LegoBuildingInfo* info = &g_buildingInfo[i]; + + if (p_storage->Read(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) { + goto done; + } + + info->m_initialUnk0x11 = info->m_unk0x11; + AdjustHeight(i); + } + + if (p_storage->Read(&m_nextVariant, sizeof(m_nextVariant)) != SUCCESS) { + goto done; + } + + if (g_buildingManagerConfig <= 1) { + m_nextVariant = 0; + } + + result = SUCCESS; + +done: + return result; } -// STUB: LEGO1 0x1002fdb0 -MxBool LegoBuildingManager::FUN_1002fdb0(LegoEntity* p_entity) +// FUNCTION: LEGO1 0x1002fcc0 +// FUNCTION: BETA10 0x10063f1a +void LegoBuildingManager::AdjustHeight(MxS32 p_index) { - // TODO + if (g_buildingInfo[p_index].m_unk0x11 > 0) { + float value = g_buildingDataDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; + g_buildingInfo[p_index].m_unk0x014 = + g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingDataDownshiftScale[p_index]; + } + else if (g_buildingInfo[p_index].m_unk0x11 == 0) { + float value = g_buildingDataDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; + g_buildingInfo[p_index].m_unk0x014 = + g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingDataDownshiftScale[p_index]; + + if (g_buildingInfo[p_index].m_entity != NULL) { + LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI(); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + else { + g_buildingInfo[p_index].m_unk0x014 = g_buildingInfoInit[p_index].m_unk0x014; + } +} + +// FUNCTION: LEGO1 0x1002fd70 +// FUNCTION: BETA10 0x10063fc9 +LegoBuildingInfo* LegoBuildingManager::GetInfo(LegoEntity* p_entity) +{ + MxS32 i; + + for (i = 0; i < _countof(g_buildingInfo); i++) { + if (g_buildingInfo[i].m_entity == p_entity) { + break; + } + } + + if (i < _countof(g_buildingInfo)) { + return &g_buildingInfo[i]; + } + + return NULL; +} + +// FUNCTION: LEGO1 0x1002fdb0 +// FUNCTION: BETA10 0x10064101 +MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) +{ + if (g_buildingManagerConfig <= 1) { + return TRUE; + } + + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) { + LegoROI* roi = p_entity->GetROI(); + if (++m_nextVariant >= _countof(g_buildingDataHausName)) { + m_nextVariant = 0; + } + + roi->SetVisibility(FALSE); + info->m_hausName = g_buildingDataHausName[m_nextVariant]; + UpdatePosition(12, CurrentWorld()); + + if (info->m_entity != NULL) { + info->m_entity->GetROI()->SetVisibility(TRUE); + } + + return TRUE; + } + return FALSE; } +// FUNCTION: LEGO1 0x1002fe40 +// FUNCTION: BETA10 0x100641d3 +MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity) +{ + MxBool result = FALSE; + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit2) { + info->m_cycle1++; + + if (info->m_cycle1 >= g_buildingCycle1Length) { + info->m_cycle1 = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x1002fe80 +// FUNCTION: BETA10 0x10064242 +MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity) +{ + MxBool result = FALSE; + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { + info->m_cycle2++; + + if (info->m_cycle2 >= g_buildingCycle2Length[info - g_buildingInfo]) { + info->m_cycle2 = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x1002fed0 +// FUNCTION: BETA10 0x100642c2 +MxBool LegoBuildingManager::FUN_1002fed0(LegoEntity* p_entity) +{ + MxBool result = FALSE; + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit4) { + info->m_cycle3++; + + if (info->m_cycle3 > 3) { + info->m_cycle3 = 0; + } + + result = TRUE; + } + + return result; +} + // STUB: LEGO1 0x1002ff40 MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity*, MxBool) { @@ -89,10 +520,34 @@ void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value) } } -// STUB: LEGO1 0x10030000 -void LegoBuildingManager::FUN_10030000(LegoEntity* p_entity) +// FUNCTION: LEGO1 0x10030000 +MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity) { - // TODO + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info == NULL) { + return FALSE; + } + + return FUN_10030030(info - g_buildingInfo); +} + +// STUB: LEGO1 0x10030030 +MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) +{ + return TRUE; +} + +// FUNCTION: LEGO1 0x10030110 +MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) +{ + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + if (&g_buildingInfo[i] == p_data) { + return FUN_10030030(i); + } + } + + return FALSE; } // STUB: LEGO1 0x10030220 diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index d5ba428b..a3fc9e2d 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -40,7 +40,7 @@ MxU32 g_unk0x100fc4ec = 2; MxU32 g_unk0x100fc4f0 = 0; // GLOBAL: LEGO1 0x10104f20 -LegoCharacterInfo g_chracterInfo[66]; +LegoCharacterInfo g_characterInfo[66]; // FUNCTION: LEGO1 0x10082a20 LegoCharacterManager::LegoCharacterManager() @@ -55,22 +55,22 @@ LegoCharacterManager::LegoCharacterManager() // FUNCTION: LEGO1 0x10083270 void LegoCharacterManager::Init() { - for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { - g_chracterInfo[i] = g_characterInfoInit[i]; + for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + g_characterInfo[i] = g_characterInfoInit[i]; } } // FUNCTION: LEGO1 0x100832a0 void LegoCharacterManager::FUN_100832a0() { - for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { - LegoCharacterInfo* info = GetInfo(g_chracterInfo[i].m_name); + for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + LegoCharacterInfo* info = GetInfo(g_characterInfo[i].m_name); if (info != NULL) { LegoExtraActor* actor = info->m_actor; if (actor != NULL && actor->IsA("LegoExtraActor")) { - LegoROI* roi = g_chracterInfo[i].m_roi; + LegoROI* roi = g_characterInfo[i].m_roi; MxU32 refCount = GetRefCount(roi); while (refCount != 0) { @@ -87,8 +87,8 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { - LegoCharacterInfo* info = &g_chracterInfo[i]; + for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + LegoCharacterInfo* info = &g_characterInfo[i]; if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; @@ -142,8 +142,8 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_chracterInfo); i++) { - LegoCharacterInfo* info = &g_chracterInfo[i]; + for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + LegoCharacterInfo* info = &g_characterInfo[i]; if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { goto done; @@ -588,8 +588,8 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex // FUNCTION: LEGO1 0x10084c00 MxBool LegoCharacterManager::Exists(const char* p_key) { - for (MxU32 i = 0; i < _countof(g_chracterInfo); i++) { - if (!strcmpi(g_chracterInfo[i].m_name, p_key)) { + for (MxU32 i = 0; i < _countof(g_characterInfo); i++) { + if (!strcmpi(g_characterInfo[i].m_name, p_key)) { return TRUE; } } @@ -614,14 +614,14 @@ LegoCharacterInfo* LegoCharacterManager::GetInfo(const char* p_key) { MxU32 i; - for (i = 0; i < _countof(g_chracterInfo); i++) { - if (!strcmpi(g_chracterInfo[i].m_name, p_key)) { + for (i = 0; i < _countof(g_characterInfo); i++) { + if (!strcmpi(g_characterInfo[i].m_name, p_key)) { break; } } - if (i < _countof(g_chracterInfo)) { - return &g_chracterInfo[i]; + if (i < _countof(g_characterInfo)) { + return &g_characterInfo[i]; } return NULL; @@ -632,14 +632,14 @@ LegoCharacterInfo* LegoCharacterManager::GetInfo(LegoROI* p_roi) { MxU32 i; - for (i = 0; i < _countof(g_chracterInfo); i++) { - if (g_chracterInfo[i].m_roi == p_roi) { + for (i = 0; i < _countof(g_characterInfo); i++) { + if (g_characterInfo[i].m_roi == p_roi) { break; } } - if (i < _countof(g_chracterInfo)) { - return &g_chracterInfo[i]; + if (i < _countof(g_characterInfo)) { + return &g_characterInfo[i]; } return NULL; diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index d1f145c2..192fc804 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -294,7 +294,7 @@ void LegoEntity::VTable0x3c() PlantManager()->FUN_100269e0(this); break; case e_building: - BuildingManager()->FUN_1002fdb0(this); + BuildingManager()->IncrementVariant(this); break; } From bac891cb0cc343d2a333e6abf0b9e85b5cfb17d3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 7 May 2024 10:54:06 -0400 Subject: [PATCH 02/89] Implement/match LegoAnimationManager::FUN_10060570 (#886) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 56efee8c..5683b9d2 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -82,7 +82,7 @@ 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_10060570(MxBool); + void FUN_10060570(MxBool p_unk0x1a); MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity); MxResult FUN_10060dc0( IsleScript::Script p_objectId, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 8f304edf..7e3aedc0 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -667,10 +667,26 @@ void LegoAnimationManager::DeleteAnimations() m_suspended = suspended; } -// STUB: LEGO1 0x10060570 -void LegoAnimationManager::FUN_10060570(MxBool) +// FUNCTION: LEGO1 0x10060570 +// FUNCTION: BETA10 0x10041463 +void LegoAnimationManager::FUN_10060570(MxBool p_unk0x1a) { - // TODO + m_unk0x39 = FALSE; + m_unk0x430 = FALSE; + m_unk0x42c = NULL; + + if (m_unk0x1a != p_unk0x1a && (m_unk0x1a = p_unk0x1a)) { + do { + if (FUN_100605e0(m_unk0x18, TRUE, NULL, TRUE, NULL, FALSE, TRUE, TRUE, TRUE) != FAILURE) { + return; + } + + m_unk0x18++; + } while (m_unk0x18 < m_animCount); + + m_unk0x1a = FALSE; + m_unk0x18 = 0; + } } // FUNCTION: LEGO1 0x100605e0 From 4b386fe73829347224a30c7a59f335c881801610 Mon Sep 17 00:00:00 2001 From: MS Date: Tue, 7 May 2024 13:00:16 -0400 Subject: [PATCH 03/89] Tweak MxOmni::Destroy and add more beta annotations (#887) * Fix long function name * Omni getter beta annotations * MxMisc asserts and beta annotations * Helper function for MxNotificationManager list --- LEGO1/omni/include/mxatom.h | 5 ++-- LEGO1/omni/include/mxnotificationmanager.h | 8 +++++++ LEGO1/omni/include/mxomni.h | 23 ++++++++++++++++++ LEGO1/omni/src/common/mxmisc.cpp | 24 +++++++++++++++++++ LEGO1/omni/src/main/mxomni.cpp | 9 +++---- .../omni/src/notify/mxnotificationmanager.cpp | 1 + 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/LEGO1/omni/include/mxatom.h b/LEGO1/omni/include/mxatom.h index ae3dbba3..bae01cb3 100644 --- a/LEGO1/omni/include/mxatom.h +++ b/LEGO1/omni/include/mxatom.h @@ -118,9 +118,10 @@ class MxAtomId { // _Tree >::_Kfn,MxAtomCompare,allocator >::_Insert // clang-format on +// clang-format off // TEMPLATE: BETA10 0x101237a0 -// _Tree >::_Kfn,MxAtomCompare,allocator -// >::const_iterator::operator* +// _Tree >::_Kfn,MxAtomCompare,allocator >::const_iterator::operator* +// clang-format on // clang-format off // TEMPLATE: LEGO1 0x100af6d0 diff --git a/LEGO1/omni/include/mxnotificationmanager.h b/LEGO1/omni/include/mxnotificationmanager.h index e99f0923..5b1acd50 100644 --- a/LEGO1/omni/include/mxnotificationmanager.h +++ b/LEGO1/omni/include/mxnotificationmanager.h @@ -47,8 +47,13 @@ class MxNotificationManager : public MxCore { MxResult Send(MxCore* p_listener, const MxNotificationParam& p_param); inline MxNotificationPtrList* GetQueue() { return m_queue; } + + // FUNCTION: BETA10 0x10132270 inline void SetActive(MxBool p_active) { m_active = p_active; } + // FUNCTION: BETA10 0x10132230 + inline MxBool IsEmpty() const { return m_queue ? m_queue->empty() : TRUE; } + // SYNTHETIC: LEGO1 0x100ac390 // MxNotificationManager::`scalar deleting destructor' @@ -86,4 +91,7 @@ class MxNotificationManager : public MxCore { // SYNTHETIC: LEGO1 0x100accd0 // MxNotificationPtrList::~MxNotificationPtrList +// TEMPLATE: BETA10 0x10129670 +// list >::empty + #endif // MXNOTIFICATIONMANAGER_H diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index 64365d4c..cb32e8c6 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -59,17 +59,40 @@ class MxOmni : public MxCore { static MxBool ActionSourceEquals(MxDSAction* p_action, const char* p_name); HWND GetWindowHandle() const { return this->m_windowHandle; } + + // FUNCTION: BETA10 0x10125100 MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } + + // FUNCTION: BETA10 0x10125120 MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; } + + // FUNCTION: BETA10 0x10125140 MxTickleManager* GetTickleManager() const { return this->m_tickleManager; } + + // FUNCTION: BETA10 0x10125160 MxTimer* GetTimer() const { return this->m_timer; } + + // FUNCTION: BETA10 0x101251a0 MxStreamer* GetStreamer() const { return this->m_streamer; } + + // FUNCTION: BETA10 0x100e5250 MxSoundManager* GetSoundManager() const { return this->m_soundManager; } + + // FUNCTION: BETA10 0x1009e860 MxVideoManager* GetVideoManager() const { return this->m_videoManager; } + + // FUNCTION: BETA10 0x101251c0 MxVariableTable* GetVariableTable() const { return this->m_variableTable; } + + // FUNCTION: BETA10 0x101251e0 MxMusicManager* GetMusicManager() const { return this->m_musicManager; } + + // FUNCTION: BETA10 0x10125200 MxEventManager* GetEventManager() const { return this->m_eventManager; } + + // FUNCTION: BETA10 0x10125180 MxAtomSet* GetAtomSet() const { return this->m_atomSet; } + MxLong HandleEndAction(MxParam& p_param); // SYNTHETIC: LEGO1 0x100aefd0 diff --git a/LEGO1/omni/src/common/mxmisc.cpp b/LEGO1/omni/src/common/mxmisc.cpp index ce8151c8..8dbab329 100644 --- a/LEGO1/omni/src/common/mxmisc.cpp +++ b/LEGO1/omni/src/common/mxmisc.cpp @@ -5,26 +5,34 @@ #include // FUNCTION: LEGO1 0x100acea0 +// FUNCTION: BETA10 0x10124d30 MxObjectFactory* ObjectFactory() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetObjectFactory(); } // FUNCTION: LEGO1 0x100aceb0 +// FUNCTION: BETA10 0x10124d77 MxNotificationManager* NotificationManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetNotificationManager(); } // FUNCTION: LEGO1 0x100acec0 +// FUNCTION: BETA10 0x10124dbe MxTickleManager* TickleManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetTickleManager(); } // FUNCTION: LEGO1 0x100aced0 +// FUNCTION: BETA10 0x10124e05 MxTimer* Timer() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetTimer(); } @@ -37,49 +45,65 @@ MxAtomSet* AtomSet() } // FUNCTION: LEGO1 0x100acef0 +// FUNCTION: BETA10 0x10124e93 MxStreamer* Streamer() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetStreamer(); } // FUNCTION: LEGO1 0x100acf00 +// FUNCTION: BETA10 0x10124eda MxSoundManager* MSoundManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetSoundManager(); } // FUNCTION: LEGO1 0x100acf10 +// FUNCTION: BETA10 0x10124f21 MxVideoManager* MVideoManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetVideoManager(); } // FUNCTION: LEGO1 0x100acf20 +// FUNCTION: BETA10 0x10124f68 MxVariableTable* VariableTable() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetVariableTable(); } // FUNCTION: LEGO1 0x100acf30 +// FUNCTION: BETA10 0x10124faf MxMusicManager* MusicManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetMusicManager(); } // FUNCTION: LEGO1 0x100acf40 +// FUNCTION: BETA10 0x10124ff6 MxEventManager* EventManager() { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->GetEventManager(); } // FUNCTION: LEGO1 0x100acf50 +// FUNCTION: BETA10 0x1012503d MxResult Start(MxDSAction* p_dsAction) { + assert(MxOmni::GetInstance()); return MxOmni::GetInstance()->Start(p_dsAction); } // FUNCTION: LEGO1 0x100acf70 +// FUNCTION: BETA10 0x10125098 void DeleteObject(MxDSAction& p_dsAction) { + assert(MxOmni::GetInstance()); MxOmni::GetInstance()->DeleteObject(p_dsAction); } diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index c6c83733..29196431 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -188,12 +188,8 @@ void MxOmni::Destroy() DeleteObject(action); } - // TODO: private members if (m_notificationManager) { - while (m_notificationManager->GetQueue()) { - if (m_notificationManager->GetQueue()->size() == 0) { - break; - } + while (!m_notificationManager->IsEmpty()) { m_notificationManager->Tickle(); } @@ -211,7 +207,6 @@ void MxOmni::Destroy() delete m_notificationManager; delete m_tickleManager; - // There could be a tree/iterator function that does this inline if (m_atomSet) { while (m_atomSet->size() != 0) { // Pop each node and delete its value @@ -220,8 +215,10 @@ void MxOmni::Destroy() m_atomSet->erase(begin); delete value; } + delete m_atomSet; } + Init(); } diff --git a/LEGO1/omni/src/notify/mxnotificationmanager.cpp b/LEGO1/omni/src/notify/mxnotificationmanager.cpp index f9c00c3c..58c97e38 100644 --- a/LEGO1/omni/src/notify/mxnotificationmanager.cpp +++ b/LEGO1/omni/src/notify/mxnotificationmanager.cpp @@ -26,6 +26,7 @@ MxNotification::~MxNotification() } // FUNCTION: LEGO1 0x100ac250 +// FUNCTION: BETA10 0x10125805 MxNotificationManager::MxNotificationManager() : MxCore(), m_lock(), m_listenerIds() { m_unk0x2c = 0; From 05edf961863d47490a3578069ba25c44569a7813 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 7 May 2024 15:59:46 -0400 Subject: [PATCH 04/89] Implement LegoAnimationManager::FUN_10061010 (#888) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../legoomni/include/legoanimmmpresenter.h | 4 + .../legoomni/src/actors/islepathactor.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 73 +++++++++++++++++-- .../src/common/legoanimmmpresenter.cpp | 12 +++ .../legoomni/src/entity/legonavcontroller.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../src/gasstation/gasstationentity.cpp | 2 +- .../legoomni/src/hospital/hospitalentity.cpp | 2 +- .../src/infocenter/infocenterentity.cpp | 2 +- .../legoomni/src/isle/beachhouseentity.cpp | 2 +- .../lego/legoomni/src/police/policeentity.cpp | 2 +- .../legoomni/src/race/racestandsentity.cpp | 2 +- 13 files changed, 93 insertions(+), 16 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 5683b9d2..04263461 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -95,7 +95,7 @@ class LegoAnimationManager : public MxCore { MxBool p_param8, MxBool p_param9 ); - void FUN_10061010(undefined4); + void FUN_10061010(MxBool p_und); void FUN_100617c0(MxS32, MxU16&, MxU16&); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 0d90473b..4ca63a7b 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -55,7 +55,11 @@ class LegoAnimMMPresenter : public MxCompositePresenter { // SYNTHETIC: LEGO1 0x1004aa40 // LegoAnimMMPresenter::`scalar deleting destructor' + void FUN_1004b840(); MxBool FUN_1004b8b0(); + void FUN_1004b8c0(); + + inline LegoAnimPresenter* GetPresenter() { return m_presenter; } private: MxBool FUN_1004b450(); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 60c2fa3d..4f03d994 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -83,7 +83,7 @@ void IslePathActor::VTable0xe0() } } - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); if (!m_cameraFlag) { ResetWorldTransform(TRUE); SetUserNavFlag(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 7e3aedc0..8bef9e6b 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1,8 +1,11 @@ #include "legoanimationmanager.h" +#include "anim/legoanim.h" #include "animstate.h" #include "define.h" #include "islepathactor.h" +#include "legoanimmmpresenter.h" +#include "legoanimpresenter.h" #include "legocharactermanager.h" #include "legoendanimnotificationparam.h" #include "legoextraactor.h" @@ -130,7 +133,7 @@ LegoAnimationManager::~LegoAnimationManager() { TickleManager()->UnregisterClient(this); - FUN_10061010(0); + FUN_10061010(FALSE); for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { LegoROI* roi = m_unk0x3c[i].m_roi; @@ -215,7 +218,7 @@ void LegoAnimationManager::Suspend() m_unk0x42a = m_unk0x402; m_unk0x402 = FALSE; - FUN_10061010(0); + FUN_10061010(FALSE); MxS32 i; for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { @@ -919,17 +922,75 @@ MxResult LegoAnimationManager::FUN_10060dc0( } } - if (!found && p_param3 != 0) { + if (!found && p_param3 != FALSE) { result = FUN_100609f0(p_objectId, p_matrix, p_param7, p_param8); } return result; } -// STUB: LEGO1 0x10061010 -void LegoAnimationManager::FUN_10061010(undefined4) +// FUNCTION: LEGO1 0x10061010 +// FUNCTION: BETA10 0x100422cc +void LegoAnimationManager::FUN_10061010(MxBool p_und) { - // TODO + MxBool unk0x39 = FALSE; + + FUN_10064b50(-1); + + if (m_tranInfoList != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList); + LegoTranInfo* tranInfo; + + while (cursor.Next(tranInfo)) { + if (tranInfo->m_presenter != NULL) { + // TODO: Match + MxU32 flags = tranInfo->m_flags; + + if (tranInfo->m_unk0x14 && tranInfo->m_unk0x12 != -1 && p_und) { + LegoAnim* anim; + + if (tranInfo->m_presenter->GetPresenter() != NULL && + (anim = tranInfo->m_presenter->GetPresenter()->GetAnimation()) != NULL && + anim->GetScene() != NULL) { + if (flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + tranInfo->m_flags &= ~LegoTranInfo::c_bit2; + } + + tranInfo->m_presenter->FUN_1004b840(); + tranInfo->m_unk0x14 = FALSE; + } + else { + tranInfo->m_presenter->FUN_1004b8c0(); + tranInfo->m_unk0x14 = FALSE; + unk0x39 = TRUE; + } + } + else { + if (flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + tranInfo->m_flags &= ~LegoTranInfo::c_bit2; + } + + tranInfo->m_presenter->FUN_1004b840(); + } + } + else { + if (m_tranInfoList2 != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList2); + + if (!cursor.Find(tranInfo)) { + m_tranInfoList2->Append(tranInfo); + } + } + + unk0x39 = TRUE; + } + } + } + + m_unk0x39 = unk0x39; + m_unk0x404 = Timer()->GetTime(); } // STUB: LEGO1 0x10061530 diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 9ebaaa8a..206c145f 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -465,9 +465,21 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) return TRUE; } +// STUB: LEGO1 0x1004b840 +void LegoAnimMMPresenter::FUN_1004b840() +{ + // TODO +} + // FUNCTION: LEGO1 0x1004b8b0 // FUNCTION: BETA10 0x1004d104 MxBool LegoAnimMMPresenter::FUN_1004b8b0() { return m_tranInfo != NULL ? m_tranInfo->m_unk0x28 : TRUE; } + +// STUB: LEGO1 0x1004b8c0 +void LegoAnimMMPresenter::FUN_1004b8c0() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index fc18ea5c..f56b1198 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -622,7 +622,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) break; } case VK_SPACE: - AnimationManager()->FUN_10061010(1); + AnimationManager()->FUN_10061010(TRUE); break; case 'Z': // TODO diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index eda48fc6..d109f145 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -618,7 +618,7 @@ void LegoWorld::Enable(MxBool p_enable) if (p_enable && !m_set0xd0.empty()) { if (CurrentWorld() != this) { if (CurrentWorld()) { - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); CurrentWorld()->Enable(FALSE); LegoEntityListCursor cursor(m_entityList); diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp index 012d9eb8..cb15b026 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp @@ -30,7 +30,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_garage); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp index 006d2d05..9b2f4eb0 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp @@ -30,7 +30,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_hospital); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp index 3ebe8e44..4c89044e 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp @@ -53,7 +53,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) break; } - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); return 1; diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp index 8f9d518c..5e11a4bd 100644 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp @@ -28,7 +28,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp index d3beb0e4..936d3859 100644 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ b/LEGO1/lego/legoomni/src/police/policeentity.cpp @@ -30,7 +30,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_police); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp index f7a572b0..91d9a07f 100644 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp @@ -28,7 +28,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } From 5c8249f3346f552ee3e65043e1d6e75396d09fdd Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 8 May 2024 10:28:32 -0400 Subject: [PATCH 05/89] Implement/match LegoAnimationManager::FUN_10061530 (#889) --- .../legoomni/include/legoanimationmanager.h | 3 +++ .../src/common/legoanimationmanager.cpp | 26 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 04263461..75317d89 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -186,4 +186,7 @@ class LegoAnimationManager : public MxCore { UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc }; +// TEMPLATE: LEGO1 0x10061750 +// MxListCursor::MxListCursor + #endif // LEGOANIMATIONMANAGER_H diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 8bef9e6b..fa499d4c 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -993,10 +993,32 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und) m_unk0x404 = Timer()->GetTime(); } -// STUB: LEGO1 0x10061530 +// FUNCTION: LEGO1 0x10061530 void LegoAnimationManager::FUN_10061530() { - // TODO + if (m_tranInfoList2 != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList2); + LegoTranInfo* tranInfo; + + while (cursor.Next(tranInfo)) { + LegoTranInfoListCursor cursor2(m_tranInfoList); + + if (cursor2.Find(tranInfo)) { + if (tranInfo->m_presenter != NULL) { + if (tranInfo->m_flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + tranInfo->m_flags &= ~LegoTranInfo::c_bit2; + } + + tranInfo->m_presenter->FUN_1004b840(); + cursor.Detach(); + } + } + else { + cursor.Detach(); + } + } + } } // STUB: LEGO1 0x100617c0 From 55299229c2c06025fa17ab273f14fee802fd29be Mon Sep 17 00:00:00 2001 From: Mark Langen Date: Thu, 9 May 2024 06:57:38 -0700 Subject: [PATCH 06/89] LegoBuildingManager Round 2 (#890) * LegoBuildingManager Round 2 * 100% match most of the remaining methods, only Tickle and FUN_10030630 remain. * The interesting finding is that the curious members of the LegoBuildingManager form a short embedded fixed-length array used to store info about current animation of buildings. * I saw that you removed the SetY which I had added to MxMatrix. Agree that this method doesn't make sense on MxMatrix, however I've added it back to Matrix4. I see the pattern of setting / getting the Y component used in enough places that I doubt they were just hoping they remembered the subscript correctly every time. Let me know if you agree or still don't think it makes sense to include. * Formatting * Order * Satisfy name checker * Add beta annotations and adjust style/naming * Make function STUB --------- Co-authored-by: Christian Semmler --- .../legoomni/include/legobuildingmanager.h | 65 +++--- LEGO1/lego/legoomni/include/legocachsound.h | 1 + .../legoomni/include/legopathcontroller.h | 9 +- .../legoomni/include/legounknown100d5778.h | 1 + LEGO1/lego/legoomni/include/legoworld.h | 1 + .../lego/legoomni/src/audio/legocachsound.cpp | 6 + .../src/audio/legounknown100d5778.cpp | 7 + .../src/build/legobuildingmanager.cpp | 207 ++++++++++++++++-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 17 ++ .../legoomni/src/paths/legopathcontroller.cpp | 15 ++ LEGO1/lego/sources/geom/legowegedge.h | 1 + 11 files changed, 278 insertions(+), 52 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index cd39a01a..bec82ceb 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -2,12 +2,15 @@ #define LEGOBUILDINGMANAGER_H #include "decomp.h" +#include "misc/legotypes.h" #include "mxcore.h" class LegoEntity; class LegoROI; class LegoStorage; class LegoWorld; +class LegoCacheSound; +class LegoPathBoundary; // SIZE 0x2c struct LegoBuildingInfo { @@ -18,26 +21,35 @@ struct LegoBuildingInfo { c_bit4 = 0x08 }; - LegoEntity* m_entity; // 0x00 - const char* m_hausName; // 0x04 - MxU32 m_cycle1; // 0x08 - MxU32 m_cycle2; // 0x0c - MxU8 m_cycle3; // 0x10 - MxS8 m_unk0x11; // 0x11 - MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 - MxU8 m_flags; // 0x13 - float m_unk0x014; // 0x14 - const char* m_unk0x18; // 0x18 - float m_x; // 0x1c - float m_y; // 0x20 - float m_z; // 0x24 - undefined* m_unk0x28; // 0x28 + LegoEntity* m_entity; // 0x00 + const char* m_hausName; // 0x04 + MxU32 m_cycle1; // 0x08 + MxU32 m_cycle2; // 0x0c + MxU8 m_cycle3; // 0x10 + MxS8 m_unk0x11; // 0x11 + MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 + MxU8 m_flags; // 0x13 + float m_unk0x014; // 0x14 + const char* m_unk0x18; // 0x18 + float m_x; // 0x1c + float m_y; // 0x20 + float m_z; // 0x24 + LegoPathBoundary* m_boundary; // 0x28 }; // VTABLE: LEGO1 0x100d6f50 // SIZE 0x30 class LegoBuildingManager : public MxCore { public: + // SIZE 0x14 + struct AnimEntry { + LegoEntity* m_entity; // 0x00 + LegoROI* m_roi; // 0x04 + LegoTime m_time; // 0x08 + float m_unk0x0c; // 0x0c + MxBool m_muted; // 0x10 + }; + LegoBuildingManager(); ~LegoBuildingManager() override; @@ -64,12 +76,19 @@ class LegoBuildingManager : public MxCore { MxBool FUN_1002fe40(LegoEntity* p_entity); MxBool FUN_1002fe80(LegoEntity* p_entity); MxBool FUN_1002fed0(LegoEntity* p_entity); + MxU32 GetBuildingEntityId(LegoEntity* p_entity); MxU32 FUN_1002ff40(LegoEntity*, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030110(LegoBuildingInfo* p_data); + void ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length, MxBool p_haveSound, MxBool p_unk0x28); void FUN_10030590(); void AdjustHeight(MxS32 p_index); + MxResult FUN_10030630(); + LegoBuildingInfo* GetInfoArray(MxS32& p_length); + void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); + + static void FUN_10030800(); // SYNTHETIC: LEGO1 0x1002f940 // LegoBuildingManager::`scalar deleting destructor' @@ -77,17 +96,13 @@ class LegoBuildingManager : public MxCore { private: static char* g_customizeAnimFile; - MxU8 m_nextVariant; // 0x08 - MxU8 m_unk0x09; // 0x09 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - undefined4 m_unk0x18; // 0x18 - undefined4 m_unk0x1c; // 0x1c - MxU8 m_unk0x20; // 0x20 - undefined4 m_unk0x24; // 0x24 - MxU8 m_unk0x28; // 0x28 - undefined4 m_unk0x2c; // 0x2c + MxU8 m_nextVariant; // 0x08 + MxU8 m_unk0x09; // 0x09 + AnimEntry* m_entries[5]; // 0x0c + MxS8 m_numEntries; // 0x20 + LegoCacheSound* m_sound; // 0x24 + MxBool m_unk0x28; // 0x28 + LegoWorld* m_world; // 0x2c }; #endif // LEGOBUILDINGMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index fc0bb5f5..178430ff 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -37,6 +37,7 @@ class LegoCacheSound : public MxCore { MxResult FUN_10006a30(const char* p_str, MxBool); void FUN_10006b80(); void FUN_10006be0(); + void FUN_10006cb0(undefined4 p_und1, undefined4 p_und2); // SYNTHETIC: LEGO1 0x10006610 // LegoCacheSound::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 392d083c..3a9527cc 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -56,6 +56,7 @@ class LegoPathController : public MxCore { void FUN_100468f0(LegoAnimPresenter* p_presenter); void FUN_10046930(LegoAnimPresenter* p_presenter); MxResult FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value); + LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); @@ -64,10 +65,10 @@ class LegoPathController : public MxCore { undefined4 m_unk0x0c; // 0x0c undefined4 m_unk0x10; // 0x10 undefined4 m_unk0x14; // 0x14 - MxS16 m_numL; // 0x18 - MxS16 m_numE; // 0x1a - MxS16 m_numN; // 0x1c - MxS16 m_numT; // 0x1e + MxU16 m_numL; // 0x18 + MxU16 m_numE; // 0x1a + MxU16 m_numN; // 0x1c + MxU16 m_numT; // 0x1e map m_pfsE; // 0x20 map m_unk0x30; // 0x30 }; diff --git a/LEGO1/lego/legoomni/include/legounknown100d5778.h b/LEGO1/lego/legoomni/include/legounknown100d5778.h index fe5df73f..5ae43070 100644 --- a/LEGO1/lego/legoomni/include/legounknown100d5778.h +++ b/LEGO1/lego/legoomni/include/legounknown100d5778.h @@ -20,6 +20,7 @@ class LegoUnknown100d5778 { void Destroy(); undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer); void FUN_10011ca0(); + MxS32 FUN_10011cf0(undefined4, undefined4); // SYNTHETIC: LEGO1 0x10011650 // LegoUnknown100d5778::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 781a8ac6..782c9212 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -83,6 +83,7 @@ class LegoWorld : public LegoEntity { void FUN_1001fc80(IslePathActor* p_actor); void FUN_1001fda0(LegoAnimPresenter* p_presenter); void FUN_1001fe90(LegoAnimPresenter* p_presenter); + LegoPathBoundary* FindPathBoundary(const char* p_name); void AddPath(LegoPathController* p_controller); MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxCore* Find(const char* p_class, const char* p_name); diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 8689491a..7d4f565c 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -149,6 +149,12 @@ void LegoCacheSound::FUN_10006be0() } } +// FUNCTION: LEGO1 0x10006cb0 +void LegoCacheSound::FUN_10006cb0(undefined4 p_und1, undefined4 p_und2) +{ + m_unk0x10.FUN_10011cf0(p_und1, p_und2); +} + // FUNCTION: LEGO1 0x10006cd0 void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) { diff --git a/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp b/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp index 03fe9752..3ff57585 100644 --- a/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp +++ b/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp @@ -81,3 +81,10 @@ void LegoUnknown100d5778::FUN_10011ca0() { // TODO } + +// STUB: LEGO1 0x10011cf0 +MxS32 LegoUnknown100d5778::FUN_10011cf0(undefined4, undefined4) +{ + // TODO + return 0; +} diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 02e878be..2dc88f9a 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -1,17 +1,24 @@ #include "legobuildingmanager.h" #include "3dmanager/lego3dmanager.h" +#include "legocachesoundmanager.h" #include "legoentity.h" +#include "legopathboundary.h" +#include "legosoundmanager.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" #include "misc/legostorage.h" +#include "mxmisc.h" +#include "mxticklemanager.h" +#include "mxtimer.h" DECOMP_SIZE_ASSERT(LegoBuildingManager, 0x30) DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c) +DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14) // GLOBAL: LEGO1 0x100f3410 -const char* g_buildingDataHausName[5] = { +const char* g_buildingInfoHausName[5] = { "haus1", "haus4", "haus5", @@ -21,7 +28,7 @@ const char* g_buildingDataHausName[5] = { // clang-format off // GLOBAL: LEGO1 0x100f3428 -float g_buildingDataDownshiftScale[16] = { +float g_buildingInfoDownshiftScale[16] = { 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, @@ -29,7 +36,7 @@ float g_buildingDataDownshiftScale[16] = { }; // GLOBAL: LEGO1 0x100f3468 -MxU8 g_buildingDataDownshift[16] = { +MxU8 g_buildingInfoDownshift[16] = { 5, 5, 5, 5, 3, 5, 5, 5, 3, 5, 5, 5, @@ -188,6 +195,22 @@ LegoBuildingInfo g_buildingInfoInit[16] = { // GLOBAL: LEGO1 0x100f3738 MxU32 g_buildingCycle1Length = 6; +// GLOBAL: LEGO1 0x100f373c +MxU32 g_cycleLengthOffset1 = 0x3c; + +// GLOBAL: LEGO1 0x100f3740 +MxU32 g_cycleLengthOffset3 = 0x42; + +// clang-format off +// GLOBAL: LEGO1 0x100f3788 +MxU32 g_buildingEntityId[16] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x46, 0x49, 0x4c, + 0x4f, 0x52, 0x55, 0x00, +}; +// clang-format on + // GLOBAL: LEGO1 0x100f37c8 char* LegoBuildingManager::g_customizeAnimFile = NULL; @@ -227,9 +250,9 @@ void LegoBuildingManager::Init() m_nextVariant = 0; m_unk0x09 = 0; - m_unk0x20 = 0; - m_unk0x24 = 0; - m_unk0x28 = 0; + m_numEntries = 0; + m_sound = NULL; + m_unk0x28 = FALSE; } // FUNCTION: LEGO1 0x1002fa00 @@ -244,15 +267,15 @@ void LegoBuildingManager::FUN_1002fa00() } if (g_buildingManagerConfig <= 1) { - LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingDataHausName[0]); + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[0]); if (entity) { entity->GetROI()->SetVisibility(TRUE); m_unk0x09 = 0; } } else { - for (i = 0; i < _countof(g_buildingDataHausName); i++) { - LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingDataHausName[i]); + for (i = 0; i < _countof(g_buildingInfoHausName); i++) { + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[i]); if (entity) { entity->GetROI()->SetVisibility(m_nextVariant == i); } @@ -280,10 +303,22 @@ void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world) } } -// STUB: LEGO1 0x1002fb30 +// FUNCTION: LEGO1 0x1002fb30 void LegoBuildingManager::FUN_1002fb30() { - // TODO + MxU32 i; + + for (i = 0; i < _countof(g_buildingInfo); i++) { + g_buildingInfo[i].m_entity = NULL; + } + + m_unk0x09 = 0; + + for (i = 0; i < m_numEntries; i++) { + delete m_entries[i]; + } + + m_numEntries = 0; } // FUNCTION: LEGO1 0x1002fb80 @@ -364,14 +399,14 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) void LegoBuildingManager::AdjustHeight(MxS32 p_index) { if (g_buildingInfo[p_index].m_unk0x11 > 0) { - float value = g_buildingDataDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; + float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; g_buildingInfo[p_index].m_unk0x014 = - g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingDataDownshiftScale[p_index]; + g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingInfoDownshiftScale[p_index]; } else if (g_buildingInfo[p_index].m_unk0x11 == 0) { - float value = g_buildingDataDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; + float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11; g_buildingInfo[p_index].m_unk0x014 = - g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingDataDownshiftScale[p_index]; + g_buildingInfoInit[p_index].m_unk0x014 - value * g_buildingInfoDownshiftScale[p_index]; if (g_buildingInfo[p_index].m_entity != NULL) { LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI(); @@ -416,12 +451,12 @@ MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) { LegoROI* roi = p_entity->GetROI(); - if (++m_nextVariant >= _countof(g_buildingDataHausName)) { + if (++m_nextVariant >= _countof(g_buildingInfoHausName)) { m_nextVariant = 0; } roi->SetVisibility(FALSE); - info->m_hausName = g_buildingDataHausName[m_nextVariant]; + info->m_hausName = g_buildingInfoHausName[m_nextVariant]; UpdatePosition(12, CurrentWorld()); if (info->m_entity != NULL) { @@ -494,10 +529,37 @@ MxBool LegoBuildingManager::FUN_1002fed0(LegoEntity* p_entity) return result; } -// STUB: LEGO1 0x1002ff40 -MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity*, MxBool) +// FUNCTION: LEGO1 0x1002ff00 +// FUNCTION: BETA10 0x1006432d +MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity) { - // TODO + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { + return g_buildingEntityId[info - g_buildingInfo] + info->m_cycle2; + } + + return 0; +} + +// FUNCTION: LEGO1 0x1002ff40 +// FUNCTION: BETA10 0x10064398 +MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state) +{ + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_bit2)) { + return 0; + } + + if (p_state) { + return info->m_cycle3 + g_cycleLengthOffset3; + } + + if (info != NULL) { + return info->m_cycle1 + g_cycleLengthOffset1; + } + return 0; } @@ -550,15 +612,114 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) return FALSE; } +// FUNCTION: LEGO1 0x10030150 +void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length, MxBool p_haveSound, MxBool p_unk0x28) +{ + m_world = CurrentWorld(); + + if (p_haveSound) { + m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003d170("bcrash"); + m_sound->FUN_10006cb0(35, 60); + } + + if (m_numEntries == 0) { + m_unk0x28 = p_unk0x28; + TickleManager()->RegisterClient(this, 50); + } + + AnimEntry* entry = m_entries[m_numEntries] = new AnimEntry; + m_numEntries++; + + entry->m_entity = p_entity; + entry->m_roi = p_entity->GetROI(); + entry->m_time = Timer()->GetTime() + p_length + 1000; + entry->m_unk0x0c = entry->m_roi->GetLocal2World()[3][1]; + entry->m_muted = p_haveSound == FALSE; + FUN_100307b0(p_entity, -2); +} + // STUB: LEGO1 0x10030220 MxResult LegoBuildingManager::Tickle() { - // TODO + // WIP, included some of this to understand the AnimEntry array. + LegoTime time = Timer()->GetTime(); + + if (m_numEntries != 0) { + if (m_numEntries > 0) { + for (MxS32 i = 0; i < m_numEntries; i++) { + AnimEntry* entry = m_entries[i]; + if (entry->m_time <= time) { + // Code to animate and play sounds + } + } + } + } + else { + TickleManager()->UnregisterClient(this); + } + return SUCCESS; } -// STUB: LEGO1 0x10030590 +// FUNCTION: LEGO1 0x10030590 +// FUNCTION: BETA10 0x1006474c void LegoBuildingManager::FUN_10030590() { - // TODO + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + g_buildingInfo[i].m_unk0x11 = -1; + g_buildingInfo[i].m_initialUnk0x11 = -1; + AdjustHeight(i); + + if (g_buildingInfo[i].m_entity != NULL) { + LegoROI* roi = g_buildingInfo[i].m_entity->GetROI(); + MxMatrix mat = roi->GetLocal2World(); + mat[3][1] = g_buildingInfo[i].m_unk0x014; + roi->FUN_100a46b0(mat); + VideoManager()->Get3DManager()->Moved(*roi); + } + } +} + +// STUB: LEGO1 0x10030630 +MxResult LegoBuildingManager::FUN_10030630() +{ + return SUCCESS; +} + +// FUNCTION: LEGO1 0x10030790 +LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) +{ + if (m_unk0x09 == 0) { + FUN_10030630(); + } + + p_length = _countof(g_buildingInfo); + return g_buildingInfo; +} + +// FUNCTION: LEGO1 0x100307b0 +void LegoBuildingManager::FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust) +{ + LegoBuildingInfo* info = GetInfo(p_entity); + + if (info != NULL) { + if (info->m_unk0x11 < 0) { + info->m_unk0x11 = g_buildingInfoDownshift[info - g_buildingInfo]; + } + + if (info->m_unk0x11 > 0) { + info->m_unk0x11 += p_adjust; + if (info->m_unk0x11 <= 1 && p_adjust < 0) { + info->m_unk0x11 = 0; + } + } + } +} + +// FUNCTION: LEGO1 0x10030800 +void LegoBuildingManager::FUN_10030800() +{ + for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + g_buildingInfo[i].m_initialUnk0x11 = g_buildingInfo[i].m_unk0x11; + } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index d109f145..fb9ac70e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -358,6 +358,23 @@ void LegoWorld::AddPath(LegoPathController* p_controller) m_list0x68.Append(p_controller); } +// FUNCTION: LEGO1 0x10020020 +LegoPathBoundary* LegoWorld::FindPathBoundary(const char* p_name) +{ + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + LegoPathBoundary* boundary = controller->GetPathBoundary(p_name); + + if (boundary) { + return boundary; + } + } + + return NULL; +} + // FUNCTION: LEGO1 0x10020120 MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 2a7c15e0..5ab492de 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -1,5 +1,7 @@ #include "legopathcontroller.h" +#include "legopathboundary.h" + DECOMP_SIZE_ASSERT(LegoPathController, 0x40) // STUB: LEGO1 0x10044f40 @@ -65,6 +67,19 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_va return SUCCESS; } +// FUNCTION: LEGO1 0x10046b50 +// FUNCTION: BETA10 0x100b7531 +LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name) +{ + for (MxS32 i = 0; i < m_numL; i++) { + if (strcmpi(m_unk0x08[i].GetName(), p_name) == 0) { + return &m_unk0x08[i]; + } + } + + return NULL; +} + // STUB: LEGO1 0x10046bb0 void LegoPathController::FUN_10046bb0(LegoWorld* p_world) { diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 34a285b3..8e44fc48 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -17,6 +17,7 @@ class LegoWEGEdge : public LegoWEEdge { inline LegoU32 GetFlag0x10() { return m_unk0x0c & 0x10 ? FALSE : TRUE; } inline Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; } inline Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; } + inline LegoChar* GetName() { return m_name; } // SYNTHETIC: LEGO1 0x1009a7e0 // LegoWEGEdge::`scalar deleting destructor' From 36d681fde4e9deea4baebc867b1ef5501a9fd871 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 10:30:34 -0400 Subject: [PATCH 07/89] Implement/match LegoAnimationManager::FUN_100617c0 (#891) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 53 +++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 75317d89..bc3200f3 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -96,7 +96,6 @@ class LegoAnimationManager : public MxCore { MxBool p_param9 ); void FUN_10061010(MxBool p_und); - void FUN_100617c0(MxS32, MxU16&, MxU16&); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); void FUN_100627d0(MxBool); @@ -127,6 +126,7 @@ class LegoAnimationManager : public MxCore { MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2); void DeleteAnimations(); void FUN_10061530(); + MxResult FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10); MxU16 FUN_10062110( LegoROI* p_roi, Vector3& p_direction, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index fa499d4c..ae486e93 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1021,10 +1021,57 @@ void LegoAnimationManager::FUN_10061530() } } -// STUB: LEGO1 0x100617c0 -void LegoAnimationManager::FUN_100617c0(MxS32, MxU16&, MxU16&) +// FUNCTION: LEGO1 0x100617c0 +// FUNCTION: BETA10 0x1004240b +MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10) { - // TODO + MxResult result = FAILURE; + MxU16 unk0x0e = 0; + MxU16 unk0x10 = 0; + MxBool success = FALSE; + + if (p_unk0x08 == -1) { + MxS32 i; + + for (i = 0; i < m_animCount; i++) { + if (m_anims[i].m_unk0x08 == p_unk0x08) { + unk0x0e = i; + success = TRUE; + break; + } + } + + if (success) { + for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + unk0x10 = i; + } + } + } + else { + MxS32 i; + + for (i = 0; m_animCount > i && m_anims[i].m_unk0x08 != -1; i++) { + if (m_anims[i].m_unk0x08 == p_unk0x08) { + unk0x0e = i; + success = TRUE; + break; + } + } + + if (success) { + for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + unk0x10 = i; + } + } + } + + if (success) { + p_unk0x0e = unk0x0e; + p_unk0x10 = unk0x10; + result = SUCCESS; + } + + return result; } // FUNCTION: LEGO1 0x100618f0 From 001b46b2aba636d0c00bb432151b8cdf68f8ac1c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 12:49:43 -0400 Subject: [PATCH 08/89] Implement/match LegoAnimationManager::FUN_10062110 (#892) * Implement/match LegoAnimationManager::FUN_10062110 * Fix param name * Return other value in stub --- LEGO1/lego/legoomni/include/animstate.h | 4 +- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 87 ++++++++++++++++--- LEGO1/viewmanager/viewmanager.cpp | 7 ++ LEGO1/viewmanager/viewmanager.h | 1 + 5 files changed, 87 insertions(+), 14 deletions(-) diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index 9d15fd50..1cdf489c 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -24,9 +24,9 @@ struct AnimInfo { MxU8 m_unk0x0d; // 0x0d MxU32 m_unk0x10[4]; // 0x10 MxU8 m_modelCount; // 0x20 - MxS16 m_unk0x22; // 0x22 + MxU16 m_unk0x22; // 0x22 ModelInfo* m_models; // 0x24 - MxU8 m_unk0x28; // 0x28 + MxS8 m_unk0x28; // 0x28 MxBool m_unk0x29; // 0x29 MxS8 m_unk0x2a[3]; // 0x2a }; diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index bc3200f3..9d2122ab 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -133,7 +133,7 @@ class LegoAnimationManager : public MxCore { Vector3& p_position, LegoPathBoundary* p_boundary, float p_speed, - MxU8 p_und, + MxU8 p_unk0x0c, MxBool p_unk0x14 ); MxS8 GetCharacterIndex(const char* p_name); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index ae486e93..64004ef8 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -21,6 +21,7 @@ #include "mxticklemanager.h" #include "mxtimer.h" #include "mxutilities.h" +#include "viewmanager/viewmanager.h" #include @@ -96,10 +97,14 @@ Character g_characters[47] = { }; // GLOBAL: LEGO1 0x100f74b0 -float g_unk0x100f74b0 = 10.0f; - -// GLOBAL: LEGO1 0x100f74ec -float g_unk0x100f74ec = -1.0f; +float g_unk0x100f74b0[6][3] = { + {10.0f, -1.0f, 1.0f}, + {7.0f, 144.0f, 100.0f}, + {5.0f, 100.0f, 36.0f}, + {3.0f, 36.0f, 25.0f}, + {1.0f, 25.0f, 16.0f}, + {-1.0f, 16.0f, 2.0f} +}; // GLOBAL: LEGO1 0x100f74f8 MxS32 g_legoAnimationManagerConfig = 1; @@ -1219,24 +1224,24 @@ MxResult LegoAnimationManager::Tickle() FUN_10064b50(time); - if (!m_unk0x39 && time - m_unk0x404 > 10000 && speed < g_unk0x100f74b0 && speed > g_unk0x100f74ec) { + if (!m_unk0x39 && time - m_unk0x404 > 10000 && speed < g_unk0x100f74b0[0][0] && speed > g_unk0x100f74b0[5][0]) { LegoPathBoundary* boundary = actor->GetBoundary(); Mx3DPointFloat position(roi->GetWorldPosition()); Mx3DPointFloat direction(roi->GetWorldDirection()); - MxU8 und = 0; + MxU8 unk0x0c = 0; MxU8 actorId = GameState()->GetActorId(); if (actorId <= 5) { - und = g_unk0x100d8b28[actorId]; + unk0x0c = g_unk0x100d8b28[actorId]; } for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { LegoROI* roi = m_unk0x3c[i].m_roi; if (roi != NULL) { - MxU16 result = FUN_10062110(roi, direction, position, boundary, speed, und, m_unk0x3c[i].m_unk0x14); + MxU16 result = FUN_10062110(roi, direction, position, boundary, speed, unk0x0c, m_unk0x3c[i].m_unk0x14); if (result) { MxMatrix mat; @@ -1283,7 +1288,7 @@ MxResult LegoAnimationManager::Tickle() return SUCCESS; } -// STUB: LEGO1 0x10062110 +// FUNCTION: LEGO1 0x10062110 // FUNCTION: BETA10 0x10042f41 MxU16 LegoAnimationManager::FUN_10062110( LegoROI* p_roi, @@ -1291,11 +1296,71 @@ MxU16 LegoAnimationManager::FUN_10062110( Vector3& p_position, LegoPathBoundary* p_boundary, float p_speed, - MxU8 p_und, + MxU8 p_unk0x0c, MxBool p_unk0x14 ) { - // TODO + LegoPathActor* actor = (LegoPathActor*) p_roi->GetEntity(); + + if (actor != NULL && actor->GetBoundary() == p_boundary && actor->GetState() == 0) { + if (GetViewManager()->FUN_100a6150(p_roi->GetWorldBoundingBox())) { + Mx3DPointFloat direction(p_roi->GetWorldDirection()); + + if (direction.Dot(&direction, &p_direction) > 0.707) { + Mx3DPointFloat position(p_roi->GetWorldPosition()); + + ((Vector3&) position).Sub(&p_position); + float len = position.LenSquared(); + float min, max; + + for (MxU32 i = 0; i < _countof(g_unk0x100f74b0); i++) { + if (g_unk0x100f74b0[i][0] < p_speed) { + max = g_unk0x100f74b0[i][1]; + min = g_unk0x100f74b0[i][2]; + break; + } + } + + if (len < max && len > min) { + MxS8 index = GetCharacterIndex(p_roi->GetName()); + + for (MxU16 i = m_unk0x0e; i <= m_unk0x10; i++) { + if (m_anims[i].m_unk0x28 == index && m_anims[i].m_unk0x0c & p_unk0x0c && m_anims[i].m_unk0x29) { + MxS32 vehicleId = g_characters[index].m_vehicleId; + if (vehicleId >= 0) { + MxBool found = FALSE; + + for (MxS32 j = 0; j < (MxS32) _countof(m_anims[i].m_unk0x2a); j++) { + if (m_anims[i].m_unk0x2a[j] == vehicleId) { + found = TRUE; + break; + } + } + + if (p_unk0x14 != found) { + continue; + } + } + + MxU16 result = i; + MxU16 unk0x22 = m_anims[i].m_unk0x22; + + for (i = i + 1; i <= m_unk0x10; i++) { + if (m_anims[i].m_unk0x28 == index && m_anims[i].m_unk0x0c & p_unk0x0c && + m_anims[i].m_unk0x29 && m_anims[i].m_unk0x22 < unk0x22) { + result = i; + unk0x22 = m_anims[i].m_unk0x22; + } + } + + return result; + } + } + } + } + } + } + return 0; } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 395e4397..9db4ba6f 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -55,6 +55,13 @@ ViewManager::~ViewManager() SetPOVSource(NULL); } +// STUB: LEGO1 0x100a6150 +// FUNCTION: BETA10 0x10172164 +undefined4 ViewManager::FUN_100a6150(const BoundingBox& p_bounding_box) +{ + return 1; +} + // FUNCTION: LEGO1 0x100a6410 void ViewManager::Remove(ViewROI* p_roi) { diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 8a7e50d0..f2fdcdb4 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -23,6 +23,7 @@ class ViewManager { void Remove(ViewROI* p_roi); void RemoveAll(ViewROI* p_roi); + undefined4 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 5629eb3c85d00344c87aa5301820dcc2221b64e6 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 15:33:48 -0400 Subject: [PATCH 09/89] Implement/match LegoAnimationManager::FUN_100623a0 (#893) --- LEGO1/lego/legoomni/include/animstate.h | 2 +- .../legoomni/include/legoanimationmanager.h | 2 + LEGO1/lego/legoomni/include/legoworld.h | 1 + .../src/common/legoanimationmanager.cpp | 44 ++++++++++++++++++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index 1cdf489c..b1b08fee 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -22,7 +22,7 @@ struct AnimInfo { MxU8 m_unk0x0b; // 0x0b MxU8 m_unk0x0c; // 0x0c MxU8 m_unk0x0d; // 0x0d - MxU32 m_unk0x10[4]; // 0x10 + float m_unk0x10[4]; // 0x10 MxU8 m_modelCount; // 0x20 MxU16 m_unk0x22; // 0x22 ModelInfo* m_models; // 0x24 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 9d2122ab..707af659 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -138,7 +138,9 @@ class LegoAnimationManager : public MxCore { ); MxS8 GetCharacterIndex(const char* p_name); MxBool FUN_100623a0(AnimInfo& p_info); + MxBool FUN_10062520(AnimInfo& p_info, const char*); void FUN_10062580(AnimInfo& p_info); + MxBool FUN_10062650(Vector3&, float, LegoROI*); MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); void FUN_10063d10(); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 782c9212..1c13b099 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -90,6 +90,7 @@ class LegoWorld : public LegoEntity { MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); inline LegoCameraController* GetCamera() { return m_cameraController; } + inline LegoEntityList* GetEntityList() { return m_entityList; } inline MxS32 GetScriptIndex() { return m_scriptIndex; } inline MxCoreSet& GetUnknown0xd0() { return m_set0xd0; } inline list& GetROIList() { return m_roiList; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 64004ef8..441711fa 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1379,14 +1379,47 @@ MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name) return -1; } -// STUB: LEGO1 0x100623a0 +// FUNCTION: LEGO1 0x100623a0 // FUNCTION: BETA10 0x10043342 MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) { - // TODO + LegoWorld* world = CurrentWorld(); + + if (world != NULL) { + LegoEntityList* entityList = world->GetEntityList(); + + if (entityList != NULL) { + Mx3DPointFloat vec(p_info.m_unk0x10[0], p_info.m_unk0x10[1], p_info.m_unk0x10[2]); + float und = p_info.m_unk0x10[3]; + + LegoEntityListCursor cursor(entityList); + LegoEntity* entity; + IslePathActor* actor = CurrentActor(); + + while (cursor.Next(entity)) { + if (entity != actor && entity->IsA("LegoPathActor")) { + LegoROI* roi = entity->GetROI(); + + if (roi->GetVisibility() && FUN_10062650(vec, und, roi)) { + if (!FUN_10062520(p_info, roi->GetName())) { + return TRUE; + } + } + } + } + } + } + return FALSE; } +// STUB: LEGO1 0x10062520 +// FUNCTION: BETA10 0x100434bf +MxBool LegoAnimationManager::FUN_10062520(AnimInfo& p_info, const char*) +{ + return TRUE; +} + // STUB: LEGO1 0x10062580 // FUNCTION: BETA10 0x10043552 void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) @@ -1394,6 +1427,13 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) // TODO } +// STUB: LEGO1 0x10062650 +// FUNCTION: BETA10 0x100436e2 +MxBool LegoAnimationManager::FUN_10062650(Vector3&, float, LegoROI*) +{ + return TRUE; +} + // STUB: LEGO1 0x10062710 // FUNCTION: BETA10 0x10043787 MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info) From 9ae2acbea807fa7c5c67e8a4ee376b0a36587702 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 15:53:13 -0400 Subject: [PATCH 10/89] Implement/match LegoAnimationManager::ModelExists (#894) * Implement/match LegoAnimationManager::FUN_10062520 * Name function --- LEGO1/lego/legoomni/include/animstate.h | 4 +- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 41 ++++++++++++------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index b1b08fee..ca1ad20a 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -5,7 +5,7 @@ // SIZE 0x30 struct ModelInfo { - char* m_modelName; // 0x00 + char* m_name; // 0x00 MxU8 m_unk0x04; // 0x04 float m_location[3]; // 0x08 float m_direction[3]; // 0x14 @@ -15,7 +15,7 @@ struct ModelInfo { // SIZE 0x30 struct AnimInfo { - char* m_animName; // 0x00 + char* m_name; // 0x00 MxU32 m_objectId; // 0x04 MxS16 m_unk0x08; // 0x08 MxBool m_unk0x0a; // 0x0a diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 707af659..6a3af707 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -138,7 +138,7 @@ class LegoAnimationManager : public MxCore { ); MxS8 GetCharacterIndex(const char* p_name); MxBool FUN_100623a0(AnimInfo& p_info); - MxBool FUN_10062520(AnimInfo& p_info, const char*); + MxBool ModelExists(AnimInfo& p_info, const char* p_name); void FUN_10062580(AnimInfo& p_info); MxBool FUN_10062650(Vector3&, float, LegoROI*); MxBool FUN_10062710(AnimInfo& p_info); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 441711fa..1b22c952 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -475,7 +475,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) goto done; } - m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2); + m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_name + strlen(m_anims[j].m_name) - 2); m_anims[j].m_unk0x29 = FALSE; for (k = 0; k < 3; k++) { @@ -484,7 +484,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) if (m_anims[j].m_unk0x08 == -1) { for (MxS32 l = 0; l < m_anims[j].m_modelCount; l++) { - MxS32 index = GetCharacterIndex(m_anims[j].m_models[l].m_modelName); + MxS32 index = GetCharacterIndex(m_anims[j].m_models[l].m_name); if (index >= 0) { g_characters[index].m_active = TRUE; @@ -496,7 +496,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) for (MxS32 m = 0; m < m_anims[j].m_modelCount; m++) { MxU32 n; - if (FindVehicle(m_anims[j].m_models[m].m_modelName, n) && m_anims[j].m_models[m].m_unk0x2c) { + if (FindVehicle(m_anims[j].m_models[m].m_name, n) && m_anims[j].m_models[m].m_unk0x2c) { m_anims[j].m_unk0x2a[count++] = n; if (count > 3) { break; @@ -560,12 +560,12 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info) goto done; } - p_info->m_animName = new char[length + 1]; - if (p_file->Read(p_info->m_animName, length) == FAILURE) { + p_info->m_name = new char[length + 1]; + if (p_file->Read(p_info->m_name, length) == FAILURE) { goto done; } - p_info->m_animName[length] = 0; + p_info->m_name[length] = 0; if (p_file->Read(&p_info->m_objectId, sizeof(p_info->m_objectId)) == FAILURE) { goto done; } @@ -621,12 +621,12 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoFile* p_file, ModelInfo* p_info goto done; } - p_info->m_modelName = new char[length + 1]; - if (p_file->Read(p_info->m_modelName, length) == FAILURE) { + p_info->m_name = new char[length + 1]; + if (p_file->Read(p_info->m_name, length) == FAILURE) { goto done; } - p_info->m_modelName[length] = 0; + p_info->m_name[length] = 0; if (p_file->Read(&p_info->m_unk0x04, sizeof(p_info->m_unk0x04)) == FAILURE) { goto done; } @@ -657,11 +657,11 @@ void LegoAnimationManager::DeleteAnimations() if (m_anims != NULL) { for (MxS32 i = 0; i < m_animCount; i++) { - delete m_anims[i].m_animName; + delete m_anims[i].m_name; if (m_anims[i].m_models != NULL) { for (MxS32 j = 0; j < m_anims[i].m_modelCount; j++) { - delete m_anims[i].m_models[j].m_modelName; + delete m_anims[i].m_models[j].m_name; } delete m_anims[i].m_models; @@ -1401,7 +1401,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) LegoROI* roi = entity->GetROI(); if (roi->GetVisibility() && FUN_10062650(vec, und, roi)) { - if (!FUN_10062520(p_info, roi->GetName())) { + if (!ModelExists(p_info, roi->GetName())) { return TRUE; } } @@ -1413,11 +1413,22 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) return FALSE; } -// STUB: LEGO1 0x10062520 +// FUNCTION: LEGO1 0x10062520 // FUNCTION: BETA10 0x100434bf -MxBool LegoAnimationManager::FUN_10062520(AnimInfo& p_info, const char*) +MxBool LegoAnimationManager::ModelExists(AnimInfo& p_info, const char* p_name) { - return TRUE; + ModelInfo* models = p_info.m_models; + MxU8 modelCount = p_info.m_modelCount; + + if (models != NULL && modelCount) { + for (MxU8 i = 0; i < modelCount; i++) { + if (!strcmpi(models[i].m_name, p_name)) { + return TRUE; + } + } + } + + return FALSE; } // STUB: LEGO1 0x10062580 From 6a8fb3f46b51c3e7f8f1ccfdde60167bb7b6b5cc Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 16:10:00 -0400 Subject: [PATCH 11/89] Implement/match LegoAnimationManager::FUN_10062580 (#895) --- .../src/common/legoanimationmanager.cpp | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 1b22c952..624fd437 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1431,11 +1431,40 @@ MxBool LegoAnimationManager::ModelExists(AnimInfo& p_info, const char* p_name) return FALSE; } -// STUB: LEGO1 0x10062580 +// FUNCTION: LEGO1 0x10062580 // FUNCTION: BETA10 0x10043552 void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) { - // TODO + ModelInfo* models = p_info.m_models; + MxU8 modelCount = p_info.m_modelCount; + + if (models != NULL && modelCount) { + for (MxU8 i = 0; i < modelCount; i++) { + LegoPathActor* actor = CharacterManager()->GetActor(models[i].m_name); + + if (actor) { + LegoPathController* controller = actor->GetController(); + + if (controller) { + controller->FUN_10046770(actor); + actor->ClearController(); + + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + if (m_unk0x3c[i].m_roi == actor->GetROI()) { + MxS32 characterId = m_unk0x3c[i].m_characterId; + g_characters[characterId].m_unk0x07 = TRUE; + MxS32 vehicleId = g_characters[characterId].m_vehicleId; + + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + } + break; + } + } + } + } + } + } } // STUB: LEGO1 0x10062650 From 556cbdaab31808c8c4f9a1f3bcc77242628d372a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 16:24:45 -0400 Subject: [PATCH 12/89] Implement/match LegoAnimationManager::FUN_10062650 (#896) * Implement/match LegoAnimationManager::FUN_10062650 * Shorten code --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 28 +++++++++++++++---- LEGO1/realtime/vector.h | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 6a3af707..2851ee5c 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -140,7 +140,7 @@ class LegoAnimationManager : public MxCore { MxBool FUN_100623a0(AnimInfo& p_info); MxBool ModelExists(AnimInfo& p_info, const char* p_name); void FUN_10062580(AnimInfo& p_info); - MxBool FUN_10062650(Vector3&, float, LegoROI*); + MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); void FUN_10063d10(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 624fd437..c633364f 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1309,6 +1309,7 @@ MxU16 LegoAnimationManager::FUN_10062110( if (direction.Dot(&direction, &p_direction) > 0.707) { Mx3DPointFloat position(p_roi->GetWorldPosition()); + // TODO: Fix call ((Vector3&) position).Sub(&p_position); float len = position.LenSquared(); float min, max; @@ -1389,7 +1390,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) LegoEntityList* entityList = world->GetEntityList(); if (entityList != NULL) { - Mx3DPointFloat vec(p_info.m_unk0x10[0], p_info.m_unk0x10[1], p_info.m_unk0x10[2]); + Mx3DPointFloat position(p_info.m_unk0x10[0], p_info.m_unk0x10[1], p_info.m_unk0x10[2]); float und = p_info.m_unk0x10[3]; LegoEntityListCursor cursor(entityList); @@ -1400,7 +1401,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) if (entity != actor && entity->IsA("LegoPathActor")) { LegoROI* roi = entity->GetROI(); - if (roi->GetVisibility() && FUN_10062650(vec, und, roi)) { + if (roi->GetVisibility() && FUN_10062650(position, und, roi)) { if (!ModelExists(p_info, roi->GetName())) { return TRUE; } @@ -1467,11 +1468,28 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) } } -// STUB: LEGO1 0x10062650 +// FUNCTION: LEGO1 0x10062650 // FUNCTION: BETA10 0x100436e2 -MxBool LegoAnimationManager::FUN_10062650(Vector3&, float, LegoROI*) +MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi) { - return TRUE; + if (p_roi != NULL) { + Mx3DPointFloat position(p_position); + + // TODO: Fix call + ((Vector3&) position).Sub(p_roi->GetWorldPosition()); + + float len = position.LenSquared(); + if (len <= 0.0f) { + return TRUE; + } + + len = sqrt(len); + if (p_roi->GetWorldBoundingSphere().Radius() + p_und >= len) { + return TRUE; + } + } + + return FALSE; } // STUB: LEGO1 0x10062710 diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 06d3acc5..7d7a06e4 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -123,7 +123,7 @@ class Vector2 { virtual void Add(Vector2* p_other) { AddImpl(p_other->m_data); } // vtable+0x48 // FUNCTION: LEGO1 0x100021f0 - virtual void Sub(float* p_other) { SubImpl(p_other); } // vtable+0x58 + virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58 // FUNCTION: LEGO1 0x10002200 virtual void Sub(const Vector2* p_other) { SubImpl((float*) p_other->m_data); } // vtable+0x54 From 172db7b5d81f702e6331ad1821342c75f40abdd4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 16:32:06 -0400 Subject: [PATCH 13/89] Implement/match LegoAnimationManager::FUN_10062710 (#897) --- LEGO1/lego/legoomni/include/legogamestate.h | 6 ++++++ .../src/common/legoanimationmanager.cpp | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 05f24c5f..b1a9051f 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -16,6 +16,8 @@ class MxVariable; class MxVariableTable; class MxString; +extern const char* g_actorNames[7]; + // SIZE 0x08 struct ColorStringStruct { const char* m_targetName; // 0x00 @@ -164,6 +166,10 @@ class LegoGameState { void Init(); inline MxU8 GetActorId() { return m_actorId; } + + // FUNCTION: BETA10 0x1004a2d0 + inline const char* GetActorName() { return g_actorNames[GetActorId()]; } + inline Act GetCurrentAct() { return m_currentAct; } inline Act GetLoadedAct() { return m_loadedAct; } inline Area GetCurrentArea() { return m_currentArea; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index c633364f..d6f5760f 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1492,11 +1492,25 @@ MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, Lego return FALSE; } -// STUB: LEGO1 0x10062710 +// FUNCTION: LEGO1 0x10062710 // FUNCTION: BETA10 0x10043787 MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info) { - // TODO + MxU8 und = 0; + MxU8 actorId = GameState()->GetActorId(); + + if (actorId <= 5) { + und = g_unk0x100d8b28[actorId]; + } + + if (!(und & p_info.m_unk0x0c)) { + return TRUE; + } + + if (ModelExists(p_info, GameState()->GetActorName())) { + return TRUE; + } + return FALSE; } From 79791be57483e2e4b348d1f91317570bfc6ca146 Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 9 May 2024 22:16:12 -0400 Subject: [PATCH 14/89] Beta addrs for ViewLODList (#898) * Beta addrs for ViewLODList * unsigned char --- LEGO1/realtime/lodlist.h | 26 ++++++++++ LEGO1/viewmanager/viewlodlist.cpp | 60 +++++++++++++++++++---- LEGO1/viewmanager/viewlodlist.h | 79 +++++++++++++++++++++++++------ 3 files changed, 141 insertions(+), 24 deletions(-) diff --git a/LEGO1/realtime/lodlist.h b/LEGO1/realtime/lodlist.h index 544434b8..66854887 100644 --- a/LEGO1/realtime/lodlist.h +++ b/LEGO1/realtime/lodlist.h @@ -20,6 +20,7 @@ class LODObject; // // VTABLE: LEGO1 0x100dbdc8 +// VTABLE: BETA10 0x101c3500 // SIZE 0x10 class LODListBase { protected: @@ -39,6 +40,7 @@ class LODListBase { size_t Capacity() const; // SYNTHETIC: LEGO1 0x100a77b0 + // SYNTHETIC: BETA10 0x1017b410 // LODListBase::`scalar deleting destructor' #ifdef _DEBUG @@ -76,6 +78,7 @@ class LODList : public LODListBase { // // LODListBase implementation +// FUNCTION: BETA10 0x1017b390 inline LODListBase::LODListBase(size_t capacity) : m_capacity(capacity), m_size(0), m_ppLODObject(new const LODObject*[capacity]) { @@ -88,6 +91,8 @@ inline LODListBase::LODListBase(size_t capacity) #endif } +// FUNCTION: LEGO1 0x100a77e0 +// FUNCTION: BETA10 0x1017b450 inline LODListBase::~LODListBase() { // all LODObject* should have been popped by client @@ -96,16 +101,19 @@ inline LODListBase::~LODListBase() delete[] m_ppLODObject; } +// FUNCTION: BETA10 0x1005c480 inline size_t LODListBase::Size() const { return m_size; } +// FUNCTION: BETA10 0x10178b40 inline size_t LODListBase::Capacity() const { return m_capacity; } +// FUNCTION: BETA10 0x1007b6a0 inline const LODObject* LODListBase::operator[](int i) const { assert((0 <= i) && (i < (int) m_size)); @@ -113,6 +121,7 @@ inline const LODObject* LODListBase::operator[](int i) const return m_ppLODObject[i]; } +// FUNCTION: BETA10 0x1007bb40 inline const LODObject* LODListBase::PushBack(const LODObject* pLOD) { assert(m_size < m_capacity); @@ -121,6 +130,7 @@ inline const LODObject* LODListBase::PushBack(const LODObject* pLOD) return pLOD; } +// FUNCTION: BETA10 0x10178b60 inline const LODObject* LODListBase::PopBack() { const LODObject* pLOD; @@ -137,6 +147,7 @@ inline const LODObject* LODListBase::PopBack() } #ifdef _DEBUG +// FUNCTION: BETA10 0x1017b4c0 inline void LODListBase::Dump(void (*pTracer)(const char*, ...)) const { int i; @@ -181,11 +192,26 @@ inline const T* LODList::PopBack() } // VTABLE: LEGO1 0x100dbdc0 +// VTABLE: BETA10 0x101c34f8 // class LODList // SYNTHETIC: LEGO1 0x100a7740 +// SYNTHETIC: BETA10 0x1017b350 // LODList::`scalar deleting destructor' +// TEMPLATE: BETA10 0x10178b20 +// LODList::PopBack + +// TEMPLATE: BETA10 0x1017b2d0 +// LODList::LODList + +// TEMPLATE: LEGO1 0x100a8160 +// TEMPLATE: BETA10 0x1017b5d0 +// LODList::~LODList + +// TEMPLATE: BETA10 0x1007bae0 +// LODList::operator[] + // re-enable: identifier was truncated to '255' characters in the debug information #pragma warning(default : 4786) diff --git a/LEGO1/viewmanager/viewlodlist.cpp b/LEGO1/viewmanager/viewlodlist.cpp index 920444e9..ca57bc01 100644 --- a/LEGO1/viewmanager/viewlodlist.cpp +++ b/LEGO1/viewmanager/viewlodlist.cpp @@ -11,14 +11,31 @@ DECOMP_SIZE_ASSERT(LODList, 0x10) DECOMP_SIZE_ASSERT(ViewLODList, 0x18) // GLOBAL: LEGO1 0x10101064 -int g_unk0x10101064 = 0; +// GLOBAL: BETA10 0x10205d08 +int ViewLODListManager::g_ROINameUID = 0; + +#ifdef _DEBUG +// FUNCTION: BETA10 0x10178310 +inline void ViewLODList::Dump(void (*pTracer)(const char*, ...)) const +{ + pTracer(" ViewLODList<0x%x>: Capacity=%d, Size=%d, RefCount=%d\n", this, Capacity(), Size(), m_refCount); + + for (int i = 0; i < (int) Size(); i++) { + ViewLOD* lod = const_cast(this->operator[](i)); + pTracer(" [%d]: ViewLOD<0x%x>: Vertices=%d\n", i, lod, lod->NVerts()); + } +} +#endif // FUNCTION: LEGO1 0x100a6fd0 +// FUNCTION: BETA10 0x101783a3 ViewLODListManager::ViewLODListManager() { } // FUNCTION: LEGO1 0x100a7130 +// FUNCTION: BETA10 0x1017841c +// FUNCTION: ALPHA 0x100e3402 ViewLODListManager::~ViewLODListManager() { ViewLODListMap::iterator iterator; @@ -28,9 +45,6 @@ ViewLODListManager::~ViewLODListManager() const ROIName& rROIName = (*iterator).first; ViewLODList* pLODList = (*iterator).second; - // LODList's refCount should be 0 - assert(pLODList->m_refCount == 0); - // ???who pops and deletes LODObjects while (pLODList->Size() > 0) { delete const_cast(pLODList->PopBack()); @@ -48,6 +62,8 @@ ViewLODListManager::~ViewLODListManager() } // FUNCTION: LEGO1 0x100a72c0 +// FUNCTION: BETA10 0x101785ef +// FUNCTION: ALPHA 0x100e35d2 ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) { // returned ViewLODList has a refCount of 1, i.e. caller must call Release() @@ -57,7 +73,7 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) int refCount; char* pROIName; - assert(!Lookup(rROIName)); + // assert(!Lookup(rROIName)); // alpha only pLODList = new ViewLODList(lodCount, this); refCount = pLODList->AddRef(); @@ -68,11 +84,11 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) list->Release(); char num[12]; - sprintf(num, "%d", g_unk0x10101064); + sprintf(num, "%d", g_ROINameUID); pROIName = new char[strlen(rROIName) + strlen(num) + 1]; strcpy(pROIName, rROIName); strcat(pROIName, num); - g_unk0x10101064++; + g_ROINameUID++; } else { pROIName = new char[strlen(rROIName) + 1]; @@ -82,12 +98,13 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) m_map[pROIName] = pLODList; // NOTE: Lookup() adds a refCount - assert((Lookup(rROIName) == pLODList) && (pLODList->Release() == 1)); + assert((Lookup(pROIName) == pLODList) && (pLODList->Release() == 1)); return pLODList; } // FUNCTION: LEGO1 0x100a75b0 +// FUNCTION: BETA10 0x101787d8 ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const { // returned ViewLODList's refCount is increased, i.e. caller must call Release() @@ -106,7 +123,30 @@ ViewLODList* ViewLODListManager::Lookup(const ROIName& p_roiName) const return pLODList; } -// STUB: LEGO1 0x100a7680 -void ViewLODListManager::Destroy(ViewLODList* lodList) +// FUNCTION: LEGO1 0x100a7680 +// FUNCTION: BETA10 0x1017886b +unsigned char ViewLODListManager::Destroy(ViewLODList* lodList) { + ViewLODListMap::iterator iterator; + char deleted = FALSE; + + for (iterator = m_map.begin(); !(iterator == m_map.end()); ++iterator) { + const ROIName& rROIName = (*iterator).first; + ViewLODList* pLODList = (*iterator).second; + + if (lodList == pLODList) { + while (pLODList->Size() > 0) { + delete const_cast(pLODList->PopBack()); + } + + delete pLODList; + delete[] const_cast(rROIName); + m_map.erase(iterator); + + deleted = TRUE; + break; + } + } + + return deleted; } diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index 930dbb96..187d6feb 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -23,6 +23,7 @@ class ViewLODListManager; // // VTABLE: LEGO1 0x100dbdc4 +// VTABLE: BETA10 0x101c34f0 // SIZE 0x18 class ViewLODList : public LODList { friend ViewLODListManager; @@ -32,6 +33,7 @@ class ViewLODList : public LODList { ~ViewLODList() override; // SYNTHETIC: LEGO1 0x100a80f0 + // SYNTHETIC: BETA10 0x1017b590 // ViewLODList::`scalar deleting destructor' public: @@ -53,6 +55,7 @@ class ViewLODList : public LODList { // ??? for now, until we have symbol management typedef const char* ROIName; struct ROINameComparator { + // FUNCTION: BETA10 0x101794c0 unsigned char operator()(const ROIName& rName1, const ROIName& rName2) const { return strcmp((const char*) rName1, (const char*) rName2) > 0; @@ -68,6 +71,7 @@ struct ROINameComparator { // the ViewLODList belongs. // VTABLE: LEGO1 0x100dbdbc +// VTABLE: BETA10 0x101c34ec // SIZE 0x14 class ViewLODListManager { @@ -88,29 +92,31 @@ class ViewLODListManager { // returned LODList's refCount is increased, i.e. caller must call Release() // when it no longer holds on to the list ViewLODList* Lookup(const ROIName&) const; - void Destroy(ViewLODList* lodList); + unsigned char Destroy(ViewLODList* lodList); #ifdef _DEBUG void Dump(void (*pTracer)(const char*, ...)) const; #endif // SYNTHETIC: LEGO1 0x100a70c0 + // SYNTHETIC: BETA10 0x10178a80 // ViewLODListManager::`scalar deleting destructor' private: + static int g_ROINameUID; + ViewLODListMap m_map; }; // clang-format off // FUNCTION: LEGO1 0x1001dde0 +// FUNCTION: BETA10 0x100223c0 // _Lockit::~_Lockit // TEMPLATE: LEGO1 0x100a70e0 +// TEMPLATE: BETA10 0x10178ac0 // Map::~Map -// TEMPLATE: LEGO1 0x100a77e0 -// LODListBase::~LODListBase - // TEMPLATE: LEGO1 0x100a7800 // _Tree,map >::_Kfn,ROINameComparator,allocator >::iterator::_Dec @@ -121,28 +127,76 @@ class ViewLODListManager { // _Tree,map >::_Kfn,ROINameComparator,allocator >::~_Tree,map,map >::_Kfn,ROINameComparator,allocator >::erase // TEMPLATE: LEGO1 0x100a7db0 +// TEMPLATE: BETA10 0x1017aca0 // _Tree,map >::_Kfn,ROINameComparator,allocator >::_Erase // TEMPLATE: LEGO1 0x100a7df0 +// TEMPLATE: BETA10 0x101796b0 // _Tree,map >::_Kfn,ROINameComparator,allocator >::_Insert // TEMPLATE: LEGO1 0x100a80a0 +// TEMPLATE: BETA10 0x1017b1e0 // map >::~map > -// TEMPLATE: LEGO1 0x100a8160 -// LODList::~LODList - // GLOBAL: LEGO1 0x10101068 +// GLOBAL: BETA10 0x10205eb4 // _Tree,map >::_Kfn,ROINameComparator,allocator >::_Nil + +// TEMPLATE: BETA10 0x101791f0 +// map >::operator[] + +// TEMPLATE: BETA10 0x10178c80 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::iterator::operator== + +// TEMPLATE: BETA10 0x10178ef0 +// map >::begin + +// TEMPLATE: BETA10 0x10179070 +// map >::end + +// TEMPLATE: BETA10 0x10179250 +// pair::pair + +// TEMPLATE: BETA10 0x10179280 +// map >::insert + +// TEMPLATE: BETA10 0x101792c0 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::insert + +// TEMPLATE: BETA10 0x10178c00 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::iterator::operator* + +// TEMPLATE: BETA10 0x1017ab10 +// map >::erase +// Two iterators + +// TEMPLATE: BETA10 0x1017a040 +// map >::erase +// One iterator + +// TEMPLATE: BETA10 0x10178f80 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::_Lmost + +// TEMPLATE: BETA10 0x10179e70 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::_Rmost + +// TEMPLATE: BETA10 0x10179670 +// _Tree,map >::_Kfn,ROINameComparator,allocator >::_Color + +// TEMPLATE: BETA10 0x1017aa30 +// ?swap@@YAXAAW4_Redbl@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@0@Z + // clang-format on ////////////////////////////////////////////////////////////////////////////// // // ViewLODList implementation +// FUNCTION: BETA10 0x1017b240 inline ViewLODList::ViewLODList(size_t capacity, ViewLODListManager* owner) : LODList(capacity), m_refCount(0) { m_owner = owner; @@ -153,25 +207,22 @@ inline ViewLODList::~ViewLODList() assert(m_refCount == 0); } +// FUNCTION: BETA10 0x1007b5b0 inline int ViewLODList::AddRef() { return ++m_refCount; } +// FUNCTION: BETA10 0x1007ad70 inline int ViewLODList::Release() { assert(m_refCount > 0); if (!--m_refCount) { m_owner->Destroy(this); + return 0; } + return m_refCount; } -#ifdef _DEBUG -inline void ViewLODList::Dump(void (*pTracer)(const char*, ...)) const -{ - // FIXME: dump something -} -#endif - #endif // VIEWLODLIST_H From f5ffd3aba3cc755779570c31125f7df16e3f3e0f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 10 May 2024 09:11:35 -0400 Subject: [PATCH 15/89] Implement/match LegoAnimationManager::FUN_100627d0 (#899) --- .../legoomni/include/legoanimationmanager.h | 20 +++---- .../src/common/legoanimationmanager.cpp | 55 ++++++++++++++++++- 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 2851ee5c..33ab9b20 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -26,7 +26,7 @@ struct Character { MxBool m_unk0x08; // 0x08 MxBool m_unk0x09; // 0x09 MxU32 m_unk0x0c; // 0x0c - MxU32 m_unk0x10; // 0x10 + MxS32 m_unk0x10; // 0x10 MxBool m_active; // 0x14 MxU8 m_unk0x15; // 0x15 MxU8 m_unk0x16; // 0x16 @@ -41,13 +41,13 @@ struct Vehicle { // SIZE 0x18 struct Unknown0x3c { - LegoROI* m_roi; // 0x00 - MxS32 m_characterId; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c - MxBool m_unk0x0d; // 0x0d - float m_unk0x10; // 0x10 - MxBool m_unk0x14; // 0x14 + LegoROI* m_roi; // 0x00 + MxS32 m_characterId; // 0x04 + MxLong m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0d; // 0x0d + float m_unk0x10; // 0x10 + MxBool m_unk0x14; // 0x14 }; // VTABLE: LEGO1 0x100d8c18 @@ -98,7 +98,7 @@ class LegoAnimationManager : public MxCore { void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); - void FUN_100627d0(MxBool); + void FUN_100627d0(MxBool p_und); void FUN_100629b0(MxU32, MxBool); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); @@ -171,7 +171,7 @@ class LegoAnimationManager : public MxCore { MxLong m_unk0x408; // 0x408 MxLong m_unk0x40c; // 0x40c MxLong m_unk0x410; // 0x410 - undefined4 m_unk0x414; // 0x414 + MxLong m_unk0x414; // 0x414 MxU32 m_numAllowedExtras; // 0x418 undefined4 m_unk0x41c; // 0x41c AnimState* m_animState; // 0x420 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index d6f5760f..722ae378 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1531,10 +1531,59 @@ void LegoAnimationManager::FUN_10062770() } } -// STUB: LEGO1 0x100627d0 -void LegoAnimationManager::FUN_100627d0(MxBool) +// FUNCTION: LEGO1 0x100627d0 +// FUNCTION: BETA10 0x1004389d +void LegoAnimationManager::FUN_100627d0(MxBool p_und) { - // TODO + ViewManager* viewManager = GetViewManager(); + + if (p_und || viewManager != NULL) { + MxLong time = Timer()->GetTime(); + + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL) { + MxU16 prefix = *(MxU16*) roi->GetName(); + MxLong und = ((m_numAllowedExtras - 2) * 280000 / 18) + 20000; + MxBool maOrPa = prefix == TWOCC('m', 'a') || prefix == TWOCC('p', 'a'); + + if ((p_und && !maOrPa) || + (g_characters[m_unk0x3c[i].m_characterId].m_unk0x10 >= 0 && time - m_unk0x3c[i].m_unk0x08 > und && + CharacterManager()->GetRefCount(roi) == 1 && + !viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) { + m_unk0x414--; + + LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL && actor->GetController() != NULL) { + actor->GetController()->FUN_10046770(actor); + actor->ClearController(); + } + + CharacterManager()->FUN_10083db0(roi); + + if (m_unk0x3c[i].m_unk0x14) { + m_unk0x3c[i].m_unk0x14 = FALSE; + + MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + + LegoROI* roi = Lego()->FindROI(g_vehicles[vehicleId].m_name); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + + m_unk0x3c[i].m_roi = NULL; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x07 = FALSE; + m_unk0x3c[i].m_characterId = -1; + } + } + } + } } // STUB: LEGO1 0x100629b0 From a1388adcd730ba92136100a4983f050b30c92ddb Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 10 May 2024 10:23:47 -0400 Subject: [PATCH 16/89] Refactor camera locations and other structs, name functions based on BETA (#900) * Refactor camera locations and other structs, name functions based on BETA * Add size assert * Fix member name --- .../legoomni/include/legoanimationmanager.h | 74 +- .../legoomni/include/legocameralocations.h | 36 +- .../lego/legoomni/include/legonavcontroller.h | 3 + .../src/common/legoanimationmanager.cpp | 116 +- .../src/entity/legocameralocations.cpp | 1040 ++++++++++++++--- .../legoomni/src/entity/legonavcontroller.cpp | 11 + LEGO1/lego/legoomni/src/worlds/isle.cpp | 12 +- 7 files changed, 1036 insertions(+), 256 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 33ab9b20..a1862c14 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -16,44 +16,44 @@ class LegoROIList; struct ModelInfo; class MxDSAction; -// SIZE 0x18 -struct Character { - char* m_name; // 0x00 - MxBool m_unk0x04; // 0x04 - MxS8 m_vehicleId; // 0x05 - undefined m_unk0x06; // 0x06 (unused?) - MxBool m_unk0x07; // 0x07 - MxBool m_unk0x08; // 0x08 - MxBool m_unk0x09; // 0x09 - MxU32 m_unk0x0c; // 0x0c - MxS32 m_unk0x10; // 0x10 - MxBool m_active; // 0x14 - MxU8 m_unk0x15; // 0x15 - MxU8 m_unk0x16; // 0x16 -}; - -// SIZE 0x08 -struct Vehicle { - char* m_name; // 0x00 - undefined m_unk0x04; // 0x04 - MxBool m_unk0x05; // 0x05 -}; - -// SIZE 0x18 -struct Unknown0x3c { - LegoROI* m_roi; // 0x00 - MxS32 m_characterId; // 0x04 - MxLong m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c - MxBool m_unk0x0d; // 0x0d - float m_unk0x10; // 0x10 - MxBool m_unk0x14; // 0x14 -}; - // VTABLE: LEGO1 0x100d8c18 // SIZE 0x500 class LegoAnimationManager : public MxCore { public: + // SIZE 0x18 + struct Character { + char* m_name; // 0x00 + MxBool m_unk0x04; // 0x04 + MxS8 m_vehicleId; // 0x05 + undefined m_unk0x06; // 0x06 (unused?) + MxBool m_unk0x07; // 0x07 + MxBool m_unk0x08; // 0x08 + MxBool m_unk0x09; // 0x09 + MxU32 m_unk0x0c; // 0x0c + MxS32 m_unk0x10; // 0x10 + MxBool m_active; // 0x14 + MxU8 m_unk0x15; // 0x15 + MxU8 m_unk0x16; // 0x16 + }; + + // SIZE 0x08 + struct Vehicle { + char* m_name; // 0x00 + undefined m_unk0x04; // 0x04 + MxBool m_unk0x05; // 0x05 + }; + + // SIZE 0x18 + struct Extra { + LegoROI* m_roi; // 0x00 + MxS32 m_characterId; // 0x04 + MxLong m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0d; // 0x0d + float m_unk0x10; // 0x10 + MxBool m_unk0x14; // 0x14 + }; + LegoAnimationManager(); ~LegoAnimationManager() override; @@ -98,8 +98,8 @@ class LegoAnimationManager : public MxCore { void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); - void FUN_100627d0(MxBool p_und); - void FUN_100629b0(MxU32, MxBool); + void PurgeExtra(MxBool p_und); + void AddExtra(MxU32 p_cameraLocation, MxBool p_und); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); void FUN_10064670(Vector3*); @@ -162,7 +162,7 @@ class LegoAnimationManager : public MxCore { MxBool m_unk0x38; // 0x38 MxBool m_unk0x39; // 0x39 MxBool m_unk0x3a; // 0x3a - Unknown0x3c m_unk0x3c[40]; // 0x3c + Extra m_extras[40]; // 0x3c undefined4 m_unk0x3fc; // 0x3fc MxBool m_unk0x400; // 0x400 MxBool m_unk0x401; // 0x401 diff --git a/LEGO1/lego/legoomni/include/legocameralocations.h b/LEGO1/lego/legoomni/include/legocameralocations.h index 480e7d67..bf6608fd 100644 --- a/LEGO1/lego/legoomni/include/legocameralocations.h +++ b/LEGO1/lego/legoomni/include/legocameralocations.h @@ -6,24 +6,24 @@ // SIZE 0x60 struct LegoCameraLocation { - MxU32 m_index; // 0x00 - const char* m_name; // 0x04 - float m_position[3]; // 0x08 - float m_direction[3]; // 0x14 - float m_up[3]; // 0x20 - const char* m_edgeName; // 0x2c - undefined4 m_unk0x30; // 0x30 - float m_unk0x34; // 0x34 - undefined4 m_unk0x38; // 0x38 - float m_unk0x3c; // 0x3c - undefined4 m_unk0x40; // 0x40 - undefined4 m_unk0x44; // 0x44 - undefined4 m_unk0x48; // 0x48 - undefined4 m_unk0x4c; // 0x4c - undefined4 m_unk0x50; // 0x50 - undefined4 m_unk0x54; // 0x54 - undefined4 m_unk0x58; // 0x58 - undefined4 m_unk0x5c; // 0x5c + // SIZE 0x18 + struct Path { + const char* m_name; // 0x00 + MxS32 m_src; // 0x04 + float m_srcScale; // 0x08 + MxS32 m_dest; // 0x0c + float m_destScale; // 0x10 + undefined4 m_unk0x10; // 0x14 + }; + + MxU32 m_index; // 0x00 + const char* m_name; // 0x04 + float m_position[3]; // 0x08 + float m_direction[3]; // 0x14 + float m_up[3]; // 0x20 + Path m_pathA; // 0x2c + Path m_pathB; // 0x44 + undefined4 m_unk0x5c; // 0x5c }; extern LegoCameraLocation g_cameraLocations[70]; diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index fdf0b5f3..89116a3e 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -5,6 +5,7 @@ #include "mxcore.h" #include "mxtypes.h" +struct LegoCameraLocation; class Vector3; ////////////////////////////////////////////////////////////////////////////// @@ -73,6 +74,8 @@ class LegoNavController : public MxCore { ); static MxResult UpdateCameraLocation(MxU32 p_location); static MxResult UpdateCameraLocation(const char* p_location); + static LegoCameraLocation* GetCameraLocation(MxU32 p_location); + inline void SetLinearVel(MxFloat p_linearVel) { m_linearVel = p_linearVel; } inline MxFloat GetLinearVel() { return m_linearVel; } inline MxFloat GetRotationalVel() { return m_rotationalVel; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 722ae378..468b28eb 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -26,16 +26,16 @@ #include DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500) -DECOMP_SIZE_ASSERT(Character, 0x18) -DECOMP_SIZE_ASSERT(Vehicle, 0x08) -DECOMP_SIZE_ASSERT(Unknown0x3c, 0x18) +DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) +DECOMP_SIZE_ASSERT(LegoAnimationManager::Vehicle, 0x08) +DECOMP_SIZE_ASSERT(LegoAnimationManager::Extra, 0x18) DECOMP_SIZE_ASSERT(LegoTranInfo, 0x78) // GLOBAL: LEGO1 0x100d8b28 MxU8 g_unk0x100d8b28[] = {0, 1, 2, 4, 8, 16}; // GLOBAL: LEGO1 0x100f6d20 -Vehicle g_vehicles[] = { +LegoAnimationManager::Vehicle g_vehicles[] = { {"bikebd", 0, FALSE}, {"bikepg", 0, FALSE}, {"bikerd", 0, FALSE}, @@ -46,7 +46,7 @@ Vehicle g_vehicles[] = { }; // GLOBAL: LEGO1 0x100f7048 -Character g_characters[47] = { +LegoAnimationManager::Character g_characters[47] = { {"pepper", FALSE, 6, 0, FALSE, FALSE, TRUE, 1500, 20000, FALSE, 50, 1}, {"mama", FALSE, -1, 0, FALSE, FALSE, FALSE, 1500, 20000, FALSE, 0, 2}, {"papa", FALSE, -1, 0, FALSE, FALSE, FALSE, 1500, 20000, FALSE, 0, 3}, @@ -140,8 +140,8 @@ LegoAnimationManager::~LegoAnimationManager() FUN_10061010(FALSE); - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); @@ -226,8 +226,8 @@ void LegoAnimationManager::Suspend() FUN_10061010(FALSE); MxS32 i; - for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); @@ -240,10 +240,10 @@ void LegoAnimationManager::Suspend() CharacterManager()->FUN_10083db0(roi); } - if (m_unk0x3c[i].m_unk0x14) { - m_unk0x3c[i].m_unk0x14 = FALSE; + if (m_extras[i].m_unk0x14) { + m_extras[i].m_unk0x14 = FALSE; - MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + MxS32 vehicleId = g_characters[m_extras[i].m_characterId].m_vehicleId; if (vehicleId >= 0) { g_vehicles[vehicleId].m_unk0x05 = FALSE; @@ -254,9 +254,9 @@ void LegoAnimationManager::Suspend() } } - m_unk0x3c[i].m_roi = NULL; - m_unk0x3c[i].m_characterId = -1; - m_unk0x3c[i].m_unk0x10 = -1.0f; + m_extras[i].m_roi = NULL; + m_extras[i].m_characterId = -1; + m_extras[i].m_unk0x10 = -1.0f; } m_unk0x18 = 0; @@ -306,11 +306,11 @@ void LegoAnimationManager::Init() m_unk0x30[i] = 0; } - for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - m_unk0x3c[i].m_roi = NULL; - m_unk0x3c[i].m_characterId = -1; - m_unk0x3c[i].m_unk0x10 = -1.0f; - m_unk0x3c[i].m_unk0x14 = FALSE; + for (i = 0; i < (MxS32) _countof(m_extras); i++) { + m_extras[i].m_roi = NULL; + m_extras[i].m_characterId = -1; + m_extras[i].m_unk0x10 = -1.0f; + m_extras[i].m_unk0x14 = FALSE; } m_unk0x38 = FALSE; @@ -358,7 +358,7 @@ void LegoAnimationManager::FUN_1005f6d0(MxBool p_unk0x400) m_unk0x400 = p_unk0x400; if (!p_unk0x400) { - FUN_100627d0(TRUE); + PurgeExtra(TRUE); } } } @@ -714,7 +714,7 @@ MxResult LegoAnimationManager::FUN_100605e0( MxResult result = FAILURE; if (m_scriptIndex != -1 && p_index < m_animCount && m_tranInfoList != NULL) { - FUN_100627d0(FALSE); + PurgeExtra(FALSE); FUN_10062770(); MxDSAction action; @@ -800,7 +800,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix MxResult result = FAILURE; MxDSAction action; - FUN_100627d0(FALSE); + PurgeExtra(FALSE); LegoTranInfo* info = new LegoTranInfo(); info->m_animInfo = NULL; @@ -861,9 +861,9 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt controller->FUN_10046770(actor); actor->ClearController(); - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - if (m_unk0x3c[i].m_roi == roi) { - MxS32 characterId = m_unk0x3c[i].m_characterId; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + if (m_extras[i].m_roi == roi) { + MxS32 characterId = m_extras[i].m_characterId; g_characters[characterId].m_unk0x07 = TRUE; MxS32 vehicleId = g_characters[characterId].m_vehicleId; @@ -1130,8 +1130,8 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param) cursor.Detach(); delete tranInfo; - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); @@ -1180,10 +1180,10 @@ MxResult LegoAnimationManager::Tickle() } if (m_unk0x401) { - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; - if (roi != NULL && m_unk0x3c[i].m_unk0x0d) { + if (roi != NULL && m_extras[i].m_unk0x0d) { LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { @@ -1193,10 +1193,10 @@ MxResult LegoAnimationManager::Tickle() CharacterManager()->FUN_10083db0(roi); - if (m_unk0x3c[i].m_unk0x14) { - m_unk0x3c[i].m_unk0x14 = FALSE; + if (m_extras[i].m_unk0x14) { + m_extras[i].m_unk0x14 = FALSE; - MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + MxS32 vehicleId = g_characters[m_extras[i].m_characterId].m_vehicleId; if (vehicleId >= 0) { g_vehicles[vehicleId].m_unk0x05 = FALSE; @@ -1207,11 +1207,11 @@ MxResult LegoAnimationManager::Tickle() } } - m_unk0x3c[i].m_roi = NULL; - g_characters[m_unk0x3c[i].m_characterId].m_unk0x04 = FALSE; - g_characters[m_unk0x3c[i].m_characterId].m_unk0x07 = FALSE; - m_unk0x3c[i].m_characterId = -1; - m_unk0x3c[i].m_unk0x0d = FALSE; + m_extras[i].m_roi = NULL; + g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; + m_extras[i].m_characterId = -1; + m_extras[i].m_unk0x0d = FALSE; m_unk0x414--; } } @@ -1237,11 +1237,11 @@ MxResult LegoAnimationManager::Tickle() unk0x0c = g_unk0x100d8b28[actorId]; } - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { - MxU16 result = FUN_10062110(roi, direction, position, boundary, speed, unk0x0c, m_unk0x3c[i].m_unk0x14); + MxU16 result = FUN_10062110(roi, direction, position, boundary, speed, unk0x0c, m_extras[i].m_unk0x14); if (result) { MxMatrix mat; @@ -1269,7 +1269,7 @@ MxResult LegoAnimationManager::Tickle() m_unk0x408 = time; if (time - m_unk0x404 > 10000) { - FUN_100629b0(-1, FALSE); + AddExtra(-1, FALSE); } double elapsedSeconds = VideoManager()->GetElapsedSeconds(); @@ -1450,9 +1450,9 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) controller->FUN_10046770(actor); actor->ClearController(); - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - if (m_unk0x3c[i].m_roi == actor->GetROI()) { - MxS32 characterId = m_unk0x3c[i].m_characterId; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + if (m_extras[i].m_roi == actor->GetROI()) { + MxS32 characterId = m_extras[i].m_characterId; g_characters[characterId].m_unk0x07 = TRUE; MxS32 vehicleId = g_characters[characterId].m_vehicleId; @@ -1533,15 +1533,15 @@ void LegoAnimationManager::FUN_10062770() // FUNCTION: LEGO1 0x100627d0 // FUNCTION: BETA10 0x1004389d -void LegoAnimationManager::FUN_100627d0(MxBool p_und) +void LegoAnimationManager::PurgeExtra(MxBool p_und) { ViewManager* viewManager = GetViewManager(); if (p_und || viewManager != NULL) { MxLong time = Timer()->GetTime(); - for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { - LegoROI* roi = m_unk0x3c[i].m_roi; + for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { MxU16 prefix = *(MxU16*) roi->GetName(); @@ -1549,7 +1549,7 @@ void LegoAnimationManager::FUN_100627d0(MxBool p_und) MxBool maOrPa = prefix == TWOCC('m', 'a') || prefix == TWOCC('p', 'a'); if ((p_und && !maOrPa) || - (g_characters[m_unk0x3c[i].m_characterId].m_unk0x10 >= 0 && time - m_unk0x3c[i].m_unk0x08 > und && + (g_characters[m_extras[i].m_characterId].m_unk0x10 >= 0 && time - m_extras[i].m_unk0x08 > und && CharacterManager()->GetRefCount(roi) == 1 && !viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) { m_unk0x414--; @@ -1562,10 +1562,10 @@ void LegoAnimationManager::FUN_100627d0(MxBool p_und) CharacterManager()->FUN_10083db0(roi); - if (m_unk0x3c[i].m_unk0x14) { - m_unk0x3c[i].m_unk0x14 = FALSE; + if (m_extras[i].m_unk0x14) { + m_extras[i].m_unk0x14 = FALSE; - MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + MxS32 vehicleId = g_characters[m_extras[i].m_characterId].m_vehicleId; if (vehicleId >= 0) { g_vehicles[vehicleId].m_unk0x05 = FALSE; @@ -1576,10 +1576,10 @@ void LegoAnimationManager::FUN_100627d0(MxBool p_und) } } - m_unk0x3c[i].m_roi = NULL; - g_characters[m_unk0x3c[i].m_characterId].m_unk0x04 = FALSE; - g_characters[m_unk0x3c[i].m_characterId].m_unk0x07 = FALSE; - m_unk0x3c[i].m_characterId = -1; + m_extras[i].m_roi = NULL; + g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; + m_extras[i].m_characterId = -1; } } } @@ -1588,7 +1588,7 @@ void LegoAnimationManager::FUN_100627d0(MxBool p_und) // STUB: LEGO1 0x100629b0 // FUNCTION: BETA10 0x10043c10 -void LegoAnimationManager::FUN_100629b0(MxU32, MxBool) +void LegoAnimationManager::AddExtra(MxU32 p_cameraLocation, MxBool p_und) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp b/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp index 07c8abd2..9c887e68 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp @@ -1,144 +1,910 @@ #include "legocameralocations.h" DECOMP_SIZE_ASSERT(LegoCameraLocation, 0x60) +DECOMP_SIZE_ASSERT(LegoCameraLocation::Path, 0x18) // GLOBAL: LEGO1 0x100f4c60 LegoCameraLocation g_cameraLocations[] = { - {0, "look at origin from z=-8", 0, 1.25, -8, 0, 0, 1, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, "LCAMBA1", 0.852546, 1.25, -17.078703, 0.990515, 0, -0.137405, 0, 1, 0, "EDG02_13", - 2, 0.75, 0, 0.25, 1, 0, 0, 0, 0, 0, 0, 10240}, - {2, "LCAMBA2", 3.505301, 1.25, -27.955006, -0.002102, 0, 0.999998, 0, 1, 0, "EDG02_37", - 2, 0.75, 0, 0.25, 1, 0, 0, 0, 0, 0, 0, 5120}, - {3, "LCAMBA3", -7.472569, 1.25, -16.129034, 1, 0, 0.000926, 0, 1, 0, "EDG02_26", - 0, 0.75, 2, 0.25, 1, 0, 0, 0, 0, 0, 0, 5120}, - {4, "LCAMBA4", 38.55205, 1.25, -16.129, -0.999997, 0, 0.002449, 0, 1, 0, "EDG00_146", - 0, 0.5, 2, 0.5, 1, 0, 0, 0, 0, 0, 0, 7680}, - {5, "LCAMCA1", -36.778473, -1.996432, 30.392212, 0.001013, 0, -0.999999, 0, 1, 0, "INT01", - 2, 0.5, 6, 0.5, 1, 0, 0, 0, 0, 0, 0, 0}, - {6, "LCAMCA2", -36.774277, -1.996432, 24.695135, -0.305789, 0.001457, 0.952098, - 0.000446, 0.999999, -0.001387, "EDG00_104", 0, 0.5, 2, 0.5, - 1, 0, 0, 0, 0, 0, 0, 0}, - {7, "LCAMCA3", -36.888363, 0.5625, 33.169434, -0.091475, -0.001896, 0.995806, - -0.000173, 0.999998, 0.001888, "EDG02_58", 2, 0.25, 0, 0.75, - 1, 0, 0, 0, 0, 0, 0, 0}, - {8, "LCAMGS1", 27.647768, 1.25, -4.07201, 0, 0, 1, 0, 1, 0, "EDG02_40", - 2, 0.25, 0, 0.25, 1, 0, 0, 0, 0, 0, 0, 17920}, - {9, "LCAMGS2", 25.153421, 1.25, 6.101026, 0, 0, -1, 0, 1, 0, "INT19", 1, 0.75, 0, 0.75, 1, 0, 0, 0, 0, 0, 0, 0}, - {10, "LCAMGS3", 29.506308, 1.25, -1.23529, -1, 0, 0, 0, 1, 0, "EDG00_74", 0, 0.5, 2, 0.5, 1, 0, 0, 0, 0, 0, 0, 0}, - {11, "LCAMHO1", 84.22306, 4.78298, 29.150623, 0.779248, 0, -0.626715, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12800}, - {12, "LCAMHO2", 90.92687, 4.78298, 23.340658, -0.983254, 0, 0.182241, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {13, "LCAMHO3", 87.66666, 4.829471, 20.905437, 0.841755, -0.006868, 0.539817, - 0.005781, 0.999976, 0.003708, "EDG02_27", 1, 0.89, 2, 0.89, - 0, 0, 0, 0, 0, 0, 0, 0}, - {14, "LCAMHO4", 86.33506, 4.814447, 20.489912, 0.948965, 0.035898, 0.313331, - -0.034088, 0.999355, -0.011255, "EDG02_27", 1, 0.89, 2, 0.89, - 0, 0, 0, 0, 0, 0, 0, 25600}, - {15, "LCAMIC1", 80.11602, 10.193289, -17.946644, 0.664706, 0, 0.747105, 0, 1, 0, "EDG00_69", - 2, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0}, - {16, "LCAMIC2", 86.31804, 10.193289, -11.24872, -0.936663, 0, -0.350231, 0, 1, 0, "EDG02_66", - 2, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0}, - {17, "LCAMIC3", 86.82608, 10.193289, -4.398705, 0.466761, 0, -0.884383, 0, 1, 0, "EDG02_68", - 0, 0.5, 2, 0.5, 1, 0, 0, 0, 0, 0, 0, 5120}, - {18, "LCAMJA1", 95.05279, 1.318484, -46.451622, 0.93196, 0.006837, 0.362497, -0.006372, 0.999977, -0.002478, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25600}, - {19, "LCAMJA2", 97.214066, 1.318484, -49.035267, -0.892783, -0.012109, 0.450324, - -0.010811, 0.999927, 0.005453, NULL, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0}, - {20, "LCAMJA3", 94.12146, 1.25, -48.242523, -1, 0, -0.000415, 0, 1, 0, "INT33", - 1, 0.9, 3, 0.9, 0, 0, 0, 0, 0, 0, 0, 0}, - {21, "LCAMJA4", 95.58649, 1.17483, -43.42485, 0.137268, 0.010506, -0.990478, -0.001442, 0.999945, 0.010407, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {22, "LCAMJA5", 91.586105, 1.17483, -48.882996, 0.702508, 0.010117, 0.711604, -0.007107, 0.999949, -0.007199, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {23, "LCAMJS1", 9.885858, 0.154871, -54.080086, 0.573803, -0.001138, -0.818993, - 0.000653, 0.999999, -0.000932, "INT26", 0, 0.5, 3, 0.5, - 0, 0, 0, 0, 0, 0, 0, 25600}, - {24, "LCAMJS2", 14.753909, 0.125, -55.5238, -0.789437, 0, -0.613832, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25600}, - {25, "LCAMJS3", 12.373611, 0.925977, -64.69941, 0.114162, 0, 0.993462, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25600}, - {26, "LCAMJS4", 27.136557, 1.125, -41.8613, -0.187784, -0.001389, -0.982209, -0.000261, 0.999999, -0.001364, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {27, "LCAMMT1", -63.277508, 15.25, 23.717245, -0.985194, 0, 0.171445, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12800}, - {28, "LCAMMT2", -58.28056, 15.25, 22.75, 0.829409, 0, -0.558642, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {29, "LCAMPK1", 39.875, 1.25, -1, 0.587492, 0, -0.80923, 0, 1, 0, "EDG00_83", - 0, 0.9, 2, 0.9, 0, 0, 0, 0, 0, 0, 0, 12800}, - {30, "LCAMPK2", 63.75, 1.25, 15.5625, -0.968277, 0, -0.249878, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {31, "LCAMPK4", 49.5625, 1.25, 0, -0.480011, 0, -0.877262, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6400}, - {32, "LCAMPO1", -24.38507, 1.25, -55.71749, -1, 0, 0.000066, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5120}, - {33, "LCAMPO2", -41.35899, 1.790912, -56.728477, 0.967347, 0, 0.253455, 0, 1, 0, "EDG00_191", - 0, 0.5, 2, 0.5, 1, 0, 0, 0, 0, 0, 0, 0}, - {34, "LCAMPS1", 63.1466, 2.25, -81.58665, 0.860361, 0, -0.509685, 0, 1, 0, "EDG02_40", - 0, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 6400}, - {35, "LCAMPS2", 70.99095, 2.25, -87.82898, -0.746009, 0, 0.665936, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6400}, - {36, "LCAMPS3", 73.92391, 2.25, -71.65845, -0.480404, 0, -0.877047, 0, 1, 0, "EDG02_66", - 1, 0.15, 2, 0.15, 0, 0, 0, 0, 0, 0, 0, 6400}, - {37, "LCAMPS4", 61.471172, 1.829919, -74.37842, 0.812146, 0, -0.583455, 0, 1, 0, "EDG02_40", - 0, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 0}, - {38, "LCAMPZ1", -19.517637, 1.25, -44.645412, -0.582251, 0, 0.813009, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20480}, - {39, "LCAMPZ2", -21.870003, 1.25, -41.47747, 0.310142, 0, 0.95069, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23040}, - {40, "LCAMPZ3", -21.860731, 1.25, -41.47234, 0.877738, 0, -0.479141, 0, 1, 0, "EDG00_24", - 0, 0.9, 2, 0.9, 1, 0, 0, 0, 0, 0, 0, 25600}, - {41, "LCAMPZ4", -20.492962, 1.25, -43.951485, 0, 0, 1, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {42, "LCAMPZ5", -11.0625, 1.25, -45.75, -0.998358, 0, -0.057283, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12800}, - {43, "LCAMPZ6", -14.837131, 1.25, -41.580185, -0.485221, 0, 0.874392, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {44, "LCAMPZ7", -22.17942, 1.25, -41.132347, 0.697186, 0, 0.716891, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {45, "LCAMRA1", -68.90462, 10.238018, -15.521397, -0.150999, -0.051266, -0.987204, - -0.007751, 0.998685, -0.050677, "EDG00_03", 1, 0.5, 3, 0.5, - 1, 0, 0, 0, 0, 0, 0, 0}, - {46, "LCAMRA2", -67.931305, 7.883309, -28.911201, -0.596641, -0.000131, 0.802509, - -0.000078, 1, 0.000105, "EDG01_17", 0, 0.5, 3, 0.5, - 1, 0, 0, 0, 0, 0, 0, 6400}, - {47, "LCAMRA3", -57.06778, 7.883309, -45.567757, -0.982252, -0.000114, 0.187564, -0.000112, 1, 0.000021, "EDG01_40", - 2, 0.5, 0, 0.5, 1, 0, 0, 0, 0, 0, 0, 0}, - {48, "LCAMRA4", -72.23135, 7.912604, -45.26192, 0.993571, -0.036148, -0.10728, - 0.035939, 0.999346, -0.00388, "EDG01_27", 0, 0.5, 2, 0.5, - 1, 0, 0, 0, 0, 0, 0, 6400}, - {49, "LCAMRA5", -84.27638, 4.683791, -52.99282, 0.976109, -0.025475, -0.215783, - 0.024875, 0.999675, -0.005499, "EDG01_08", 2, 0.7, 0, 0.7, - 1, 0, 0, 0, 0, 0, 0, 6400}, - {50, "LCAMRA6", -86.96998, 5.265254, -16.33013, -0.999696, 0.000378, -0.024655, 0.000378, 1, 0.000009, "EDG01_13", - 1, 0.2, 0, 0.2, 1, 0, 0, 0, 0, 0, 0, 0}, - {51, "LCAMRT1", -11.308265, 1.25, 9.629765, 1, 0, 0, 0, 1, 0, "EDG03_10", - 0, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 20480}, - {52, "LCAMRT2", -2.950222, 1.25, 12.345603, 0.816763, 0, -0.576974, 0, 1, 0, "EDG03_10", - 0, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 25600}, - {53, "LCAMRT3", -0.87654, 1.25, 11.844613, 0.006162, 0, -0.999981, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25600}, - {54, "LCAMRT4", 0.4375, 1.25, 7, -0.748454, 0, -0.663187, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {55, "LCAMRT5", -27.213715, 1.25, 13.280918, -0.670318, 0, -0.742074, 0, 1, 0, "EDG03_05", - 1, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 0}, - {56, "LCAMRT6", -21.811115, 1.25, 9.006517, 0.97496, 0, 0.222379, 0, 1, 0, "EDG03_10", - 0, 0.5, 2, 0.5, 0, 0, 0, 0, 0, 0, 0, 15360}, - {57, "LCAMST1", -40.1615, 2.02756, -56.701893, -0.958601, 0, -0.284751, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5120}, - {58, "LCAMST2", -48.750553, 2.703701, -55.472034, -0.032008, 0, -0.999488, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {59, "LCAMZG1", 31.694365, 1.25, -2.814015, -0.650445, 0, 0.759553, 0, 1, 0, "INT22", - 0, 0.4, 2, 0.4, 1, 0, 0, 0, 0, 0, 0, 0}, - {60, "LCAMZI1", 93.37283, 10.1875, -10.382307, 0, 0, 1, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {61, "LCAMZI2", 93.37283, 19.4375, -10.382307, 0, 0, 1, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {62, "LCAMZIE", 93.375, 19.4375, -10.375, 0.967075, -0.254493, 0, 0.254493, 0.967075, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {63, "LCAMZIN", 93.37283, 19.4375, -10.382307, 0, -0.254006, 0.967203, 0, 0.967203, 0.254006, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {64, "LCAMZIS", 93.37283, 19.4375, -10.382307, 0, -0.254982, -0.966946, 0, 0.966946, -0.254982, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {65, "LCAMZIW", 93.375, 19.4375, -10.375, -0.967075, -0.254493, 0, -0.254493, 0.967075, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {66, "LCAMZP1", 73.70144, 2.25, -88.91317, -0.911398, 0, 0.411526, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {67, "LCAMRT7", -1.170637, 1.25, 5.082029, -1, 0, -0.000599, 0, 1, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {68, "LCAMJS5", -1.734375, -0.625, -61.8125, -0.454574, 0, -0.890709, 0, 1, 0, NULL, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25600}, - {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + {0, "look at origin from z=-8", 0, 1.25, -8, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {1, + "LCAMBA1", + 0.852546, + 1.25, + -17.078703, + 0.990515, + 0, + -0.137405, + 0, + 1, + 0, + {"EDG02_13", 2, 0.75, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + 10240}, + {2, + "LCAMBA2", + 3.505301, + 1.25, + -27.955006, + -0.002102, + 0, + 0.999998, + 0, + 1, + 0, + {"EDG02_37", 2, 0.75, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + 5120}, + {3, + "LCAMBA3", + -7.472569, + 1.25, + -16.129034, + 1, + 0, + 0.000926, + 0, + 1, + 0, + {"EDG02_26", 0, 0.75, 2, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + 5120}, + {4, + "LCAMBA4", + 38.55205, + 1.25, + -16.129, + -0.999997, + 0, + 0.002449, + 0, + 1, + 0, + {"EDG00_146", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 7680}, + {5, + "LCAMCA1", + -36.778473, + -1.996432, + 30.392212, + 0.001013, + 0, + -0.999999, + 0, + 1, + 0, + {"INT01", 2, 0.5, 6, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {6, + "LCAMCA2", + -36.774277, + -1.996432, + 24.695135, + -0.305789, + 0.001457, + 0.952098, + 0.000446, + 0.999999, + -0.001387, + {"EDG00_104", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {7, + "LCAMCA3", + -36.888363, + 0.5625, + 33.169434, + -0.091475, + -0.001896, + 0.995806, + -0.000173, + 0.999998, + 0.001888, + {"EDG02_58", 2, 0.25, 0, 0.75, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {8, + "LCAMGS1", + 27.647768, + 1.25, + -4.07201, + 0, + 0, + 1, + 0, + 1, + 0, + {"EDG02_40", 2, 0.25, 0, 0.25, 1}, + {NULL, 0, 0, 0, 0, 0}, + 17920}, + {9, + "LCAMGS2", + 25.153421, + 1.25, + 6.101026, + 0, + 0, + -1, + 0, + 1, + 0, + {"INT19", 1, 0.75, 0, 0.75, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {10, + "LCAMGS3", + 29.506308, + 1.25, + -1.23529, + -1, + 0, + 0, + 0, + 1, + 0, + {"EDG00_74", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {11, + "LCAMHO1", + 84.22306, + 4.78298, + 29.150623, + 0.779248, + 0, + -0.626715, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 12800}, + {12, + "LCAMHO2", + 90.92687, + 4.78298, + 23.340658, + -0.983254, + 0, + 0.182241, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {13, + "LCAMHO3", + 87.66666, + 4.829471, + 20.905437, + 0.841755, + -0.006868, + 0.539817, + 0.005781, + 0.999976, + 0.003708, + {"EDG02_27", 1, 0.89, 2, 0.89, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {14, + "LCAMHO4", + 86.33506, + 4.814447, + 20.489912, + 0.948965, + 0.035898, + 0.313331, + -0.034088, + 0.999355, + -0.011255, + {"EDG02_27", 1, 0.89, 2, 0.89, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {15, + "LCAMIC1", + 80.11602, + 10.193289, + -17.946644, + 0.664706, + 0, + 0.747105, + 0, + 1, + 0, + {"EDG00_69", 2, 0.5, 0, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {16, + "LCAMIC2", + 86.31804, + 10.193289, + -11.24872, + -0.936663, + 0, + -0.350231, + 0, + 1, + 0, + {"EDG02_66", 2, 0.5, 0, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {17, + "LCAMIC3", + 86.82608, + 10.193289, + -4.398705, + 0.466761, + 0, + -0.884383, + 0, + 1, + 0, + {"EDG02_68", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 5120}, + {18, + "LCAMJA1", + 95.05279, + 1.318484, + -46.451622, + 0.93196, + 0.006837, + 0.362497, + -0.006372, + 0.999977, + -0.002478, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {19, + "LCAMJA2", + 97.214066, + 1.318484, + -49.035267, + -0.892783, + -0.012109, + 0.450324, + -0.010811, + 0.999927, + 0.005453, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {20, + "LCAMJA3", + 94.12146, + 1.25, + -48.242523, + -1, + 0, + -0.000415, + 0, + 1, + 0, + {"INT33", 1, 0.9, 3, 0.9, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {21, + "LCAMJA4", + 95.58649, + 1.17483, + -43.42485, + 0.137268, + 0.010506, + -0.990478, + -0.001442, + 0.999945, + 0.010407, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {22, + "LCAMJA5", + 91.586105, + 1.17483, + -48.882996, + 0.702508, + 0.010117, + 0.711604, + -0.007107, + 0.999949, + -0.007199, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {23, + "LCAMJS1", + 9.885858, + 0.154871, + -54.080086, + 0.573803, + -0.001138, + -0.818993, + 0.000653, + 0.999999, + -0.000932, + {"INT26", 0, 0.5, 3, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {24, + "LCAMJS2", + 14.753909, + 0.125, + -55.5238, + -0.789437, + 0, + -0.613832, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {25, + "LCAMJS3", + 12.373611, + 0.925977, + -64.69941, + 0.114162, + 0, + 0.993462, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {26, + "LCAMJS4", + 27.136557, + 1.125, + -41.8613, + -0.187784, + -0.001389, + -0.982209, + -0.000261, + 0.999999, + -0.001364, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {27, + "LCAMMT1", + -63.277508, + 15.25, + 23.717245, + -0.985194, + 0, + 0.171445, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 12800}, + {28, + "LCAMMT2", + -58.28056, + 15.25, + 22.75, + 0.829409, + 0, + -0.558642, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {29, + "LCAMPK1", + 39.875, + 1.25, + -1, + 0.587492, + 0, + -0.80923, + 0, + 1, + 0, + {"EDG00_83", 0, 0.9, 2, 0.9, 0}, + {NULL, 0, 0, 0, 0, 0}, + 12800}, + {30, + "LCAMPK2", + 63.75, + 1.25, + 15.5625, + -0.968277, + 0, + -0.249878, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {31, + "LCAMPK4", + 49.5625, + 1.25, + 0, + -0.480011, + 0, + -0.877262, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {32, + "LCAMPO1", + -24.38507, + 1.25, + -55.71749, + -1, + 0, + 0.000066, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 5120}, + {33, + "LCAMPO2", + -41.35899, + 1.790912, + -56.728477, + 0.967347, + 0, + 0.253455, + 0, + 1, + 0, + {"EDG00_191", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {34, + "LCAMPS1", + 63.1466, + 2.25, + -81.58665, + 0.860361, + 0, + -0.509685, + 0, + 1, + 0, + {"EDG02_40", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {35, + "LCAMPS2", + 70.99095, + 2.25, + -87.82898, + -0.746009, + 0, + 0.665936, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {36, + "LCAMPS3", + 73.92391, + 2.25, + -71.65845, + -0.480404, + 0, + -0.877047, + 0, + 1, + 0, + {"EDG02_66", 1, 0.15, 2, 0.15, 0}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {37, + "LCAMPS4", + 61.471172, + 1.829919, + -74.37842, + 0.812146, + 0, + -0.583455, + 0, + 1, + 0, + {"EDG02_40", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {38, + "LCAMPZ1", + -19.517637, + 1.25, + -44.645412, + -0.582251, + 0, + 0.813009, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 20480}, + {39, + "LCAMPZ2", + -21.870003, + 1.25, + -41.47747, + 0.310142, + 0, + 0.95069, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 23040}, + {40, + "LCAMPZ3", + -21.860731, + 1.25, + -41.47234, + 0.877738, + 0, + -0.479141, + 0, + 1, + 0, + {"EDG00_24", 0, 0.9, 2, 0.9, 1}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {41, "LCAMPZ4", -20.492962, 1.25, -43.951485, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {42, + "LCAMPZ5", + -11.0625, + 1.25, + -45.75, + -0.998358, + 0, + -0.057283, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 12800}, + {43, + "LCAMPZ6", + -14.837131, + 1.25, + -41.580185, + -0.485221, + 0, + 0.874392, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {44, + "LCAMPZ7", + -22.17942, + 1.25, + -41.132347, + 0.697186, + 0, + 0.716891, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {45, + "LCAMRA1", + -68.90462, + 10.238018, + -15.521397, + -0.150999, + -0.051266, + -0.987204, + -0.007751, + 0.998685, + -0.050677, + {"EDG00_03", 1, 0.5, 3, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {46, + "LCAMRA2", + -67.931305, + 7.883309, + -28.911201, + -0.596641, + -0.000131, + 0.802509, + -0.000078, + 1, + 0.000105, + {"EDG01_17", 0, 0.5, 3, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {47, + "LCAMRA3", + -57.06778, + 7.883309, + -45.567757, + -0.982252, + -0.000114, + 0.187564, + -0.000112, + 1, + 0.000021, + {"EDG01_40", 2, 0.5, 0, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {48, + "LCAMRA4", + -72.23135, + 7.912604, + -45.26192, + 0.993571, + -0.036148, + -0.10728, + 0.035939, + 0.999346, + -0.00388, + {"EDG01_27", 0, 0.5, 2, 0.5, 1}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {49, + "LCAMRA5", + -84.27638, + 4.683791, + -52.99282, + 0.976109, + -0.025475, + -0.215783, + 0.024875, + 0.999675, + -0.005499, + {"EDG01_08", 2, 0.7, 0, 0.7, 1}, + {NULL, 0, 0, 0, 0, 0}, + 6400}, + {50, + "LCAMRA6", + -86.96998, + 5.265254, + -16.33013, + -0.999696, + 0.000378, + -0.024655, + 0.000378, + 1, + 0.000009, + {"EDG01_13", 1, 0.2, 0, 0.2, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {51, + "LCAMRT1", + -11.308265, + 1.25, + 9.629765, + 1, + 0, + 0, + 0, + 1, + 0, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 20480}, + {52, + "LCAMRT2", + -2.950222, + 1.25, + 12.345603, + 0.816763, + 0, + -0.576974, + 0, + 1, + 0, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {53, + "LCAMRT3", + -0.87654, + 1.25, + 11.844613, + 0.006162, + 0, + -0.999981, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {54, "LCAMRT4", 0.4375, 1.25, 7, -0.748454, 0, -0.663187, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {55, + "LCAMRT5", + -27.213715, + 1.25, + 13.280918, + -0.670318, + 0, + -0.742074, + 0, + 1, + 0, + {"EDG03_05", 1, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {56, + "LCAMRT6", + -21.811115, + 1.25, + 9.006517, + 0.97496, + 0, + 0.222379, + 0, + 1, + 0, + {"EDG03_10", 0, 0.5, 2, 0.5, 0}, + {NULL, 0, 0, 0, 0, 0}, + 15360}, + {57, + "LCAMST1", + -40.1615, + 2.02756, + -56.701893, + -0.958601, + 0, + -0.284751, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 5120}, + {58, + "LCAMST2", + -48.750553, + 2.703701, + -55.472034, + -0.032008, + 0, + -0.999488, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {59, + "LCAMZG1", + 31.694365, + 1.25, + -2.814015, + -0.650445, + 0, + 0.759553, + 0, + 1, + 0, + {"INT22", 0, 0.4, 2, 0.4, 1}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {60, "LCAMZI1", 93.37283, 10.1875, -10.382307, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {61, "LCAMZI2", 93.37283, 19.4375, -10.382307, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {62, + "LCAMZIE", + 93.375, + 19.4375, + -10.375, + 0.967075, + -0.254493, + 0, + 0.254493, + 0.967075, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {63, + "LCAMZIN", + 93.37283, + 19.4375, + -10.382307, + 0, + -0.254006, + 0.967203, + 0, + 0.967203, + 0.254006, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {64, + "LCAMZIS", + 93.37283, + 19.4375, + -10.382307, + 0, + -0.254982, + -0.966946, + 0, + 0.966946, + -0.254982, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {65, + "LCAMZIW", + 93.375, + 19.4375, + -10.375, + -0.967075, + -0.254493, + 0, + -0.254493, + 0.967075, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {66, + "LCAMZP1", + 73.70144, + 2.25, + -88.91317, + -0.911398, + 0, + 0.411526, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {67, + "LCAMRT7", + -1.170637, + 1.25, + 5.082029, + -1, + 0, + -0.000599, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 0}, + {68, + "LCAMJS5", + -1.734375, + -0.625, + -61.8125, + -0.454574, + 0, + -0.890709, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, 0}, + 25600}, + {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0} }; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index f56b1198..37436736 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -476,6 +476,17 @@ MxResult LegoNavController::UpdateCameraLocation(MxU32 p_location) return result; } +// FUNCTION: LEGO1 0x10055720 +// FUNCTION: BETA10 0x1009c259 +LegoCameraLocation* LegoNavController::GetCameraLocation(MxU32 p_location) +{ + if (p_location < _countof(g_cameraLocations)) { + return &g_cameraLocations[p_location]; + } + + return NULL; +} + // FUNCTION: LEGO1 0x10055750 MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) { diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f87b3412..bafe2e99 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -487,15 +487,15 @@ void Isle::Enable(MxBool p_enable) FUN_1003ef00(TRUE); if (m_act1state->m_unk0x018 == 0) { - MxU32 und[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + MxU32 cameraLocations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; for (MxU32 i = 0; i < 5; i++) { - MxS32 und2 = rand() % 5; + MxS32 r = rand() % 5; - for (MxU32 j = 0; j < _countof(und); j++) { - if (und[j] != 0 && und2-- == 0) { - AnimationManager()->FUN_100629b0(und[j], TRUE); - und[j] = 0; + for (MxU32 j = 0; j < _countof(cameraLocations); j++) { + if (cameraLocations[j] != 0 && r-- == 0) { + AnimationManager()->AddExtra(cameraLocations[j], TRUE); + cameraLocations[j] = 0; break; } } From d9a82323ca2da38cc7ef930727695605c8ad6362 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 10 May 2024 14:07:38 -0400 Subject: [PATCH 17/89] Implement/match LegoAnimationManager::AddExtra (#901) * Implement/match LegoAnimationManager::AddExtra * Rename member * Fix param names * Remove space --- CMakeLists.txt | 2 +- .../legoomni/include/legoanimationmanager.h | 18 +- .../legoomni/include/legocameralocations.h | 31 -- .../legoomni/include/legocharactermanager.h | 2 + LEGO1/lego/legoomni/include/legoextraactor.h | 4 +- LEGO1/lego/legoomni/include/legolocations.h | 31 ++ .../lego/legoomni/include/legonavcontroller.h | 8 +- .../legoomni/include/legopathcontroller.h | 2 +- LEGO1/lego/legoomni/include/legoworld.h | 6 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 226 +++++++++++- .../src/common/legocharactermanager.cpp | 16 + .../legoomni/src/common/legogamestate.cpp | 2 +- .../legoomni/src/common/legovariables.cpp | 2 +- ...ocameralocations.cpp => legolocations.cpp} | 341 +++++++++++------- .../legoomni/src/entity/legonavcontroller.cpp | 31 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 8 +- .../legoomni/src/paths/legoextraactor.cpp | 4 +- .../legoomni/src/paths/legopathcontroller.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 10 +- 20 files changed, 522 insertions(+), 226 deletions(-) delete mode 100644 LEGO1/lego/legoomni/include/legocameralocations.h create mode 100644 LEGO1/lego/legoomni/include/legolocations.h rename LEGO1/lego/legoomni/src/entity/{legocameralocations.cpp => legolocations.cpp} (59%) diff --git a/CMakeLists.txt b/CMakeLists.txt index db8739cf..3856f024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,12 +345,12 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/entity/legoactor.cpp LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp - LEGO1/lego/legoomni/src/entity/legocameralocations.cpp LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp LEGO1/lego/legoomni/src/entity/legoentity.cpp LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp LEGO1/lego/legoomni/src/entity/legojetski.cpp LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp + LEGO1/lego/legoomni/src/entity/legolocations.cpp LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp LEGO1/lego/legoomni/src/entity/legoworld.cpp diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index a1862c14..30d72d41 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -3,6 +3,7 @@ #include "actionsfwd.h" #include "decomp.h" +#include "legolocations.h" #include "legotraninfolist.h" #include "mxcore.h" #include "mxgeometry/mxgeometry3d.h" @@ -10,9 +11,11 @@ class AnimState; class LegoAnimPresenter; class LegoEntity; +class LegoExtraActor; class LegoFile; class LegoPathBoundary; class LegoROIList; +class LegoWorld; struct ModelInfo; class MxDSAction; @@ -38,9 +41,9 @@ class LegoAnimationManager : public MxCore { // SIZE 0x08 struct Vehicle { - char* m_name; // 0x00 - undefined m_unk0x04; // 0x04 - MxBool m_unk0x05; // 0x05 + char* m_name; // 0x00 + MxBool m_unk0x04; // 0x04 + MxBool m_unk0x05; // 0x05 }; // SIZE 0x18 @@ -99,7 +102,7 @@ class LegoAnimationManager : public MxCore { LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); void PurgeExtra(MxBool p_und); - void AddExtra(MxU32 p_cameraLocation, MxBool p_und); + void AddExtra(MxS32 p_location, MxBool p_und); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); void FUN_10064670(Vector3*); @@ -143,7 +146,10 @@ class LegoAnimationManager : public MxCore { MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); + 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); void FUN_100648f0(LegoTranInfo*, MxLong); void FUN_10064b50(MxLong p_time); @@ -163,7 +169,7 @@ class LegoAnimationManager : public MxCore { MxBool m_unk0x39; // 0x39 MxBool m_unk0x3a; // 0x3a Extra m_extras[40]; // 0x3c - undefined4 m_unk0x3fc; // 0x3fc + MxU32 m_lastExtraCharacterId; // 0x3fc MxBool m_unk0x400; // 0x400 MxBool m_unk0x401; // 0x401 MxBool m_unk0x402; // 0x402 @@ -171,7 +177,7 @@ class LegoAnimationManager : public MxCore { MxLong m_unk0x408; // 0x408 MxLong m_unk0x40c; // 0x40c MxLong m_unk0x410; // 0x410 - MxLong m_unk0x414; // 0x414 + MxU32 m_unk0x414; // 0x414 MxU32 m_numAllowedExtras; // 0x418 undefined4 m_unk0x41c; // 0x41c AnimState* m_animState; // 0x420 diff --git a/LEGO1/lego/legoomni/include/legocameralocations.h b/LEGO1/lego/legoomni/include/legocameralocations.h deleted file mode 100644 index bf6608fd..00000000 --- a/LEGO1/lego/legoomni/include/legocameralocations.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef LEGOCAMERALOCATIONS_H -#define LEGOCAMERALOCATIONS_H - -#include "decomp.h" -#include "mxtypes.h" - -// SIZE 0x60 -struct LegoCameraLocation { - // SIZE 0x18 - struct Path { - const char* m_name; // 0x00 - MxS32 m_src; // 0x04 - float m_srcScale; // 0x08 - MxS32 m_dest; // 0x0c - float m_destScale; // 0x10 - undefined4 m_unk0x10; // 0x14 - }; - - MxU32 m_index; // 0x00 - const char* m_name; // 0x04 - float m_position[3]; // 0x08 - float m_direction[3]; // 0x14 - float m_up[3]; // 0x20 - Path m_pathA; // 0x2c - Path m_pathB; // 0x44 - undefined4 m_unk0x5c; // 0x5c -}; - -extern LegoCameraLocation g_cameraLocations[70]; - -#endif // LEGOCAMERALOCATIONS_H diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 7bd6e987..4db8a5ba 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -59,6 +59,7 @@ class LegoCharacterManager { static MxBool Exists(const char* p_key); void FUN_100832a0(); + MxBool FUN_10083b20(const char* p_name); MxU32 GetRefCount(LegoROI* p_roi); void FUN_10083c30(const char* p_name); void FUN_10083db0(LegoROI* p_roi); @@ -69,6 +70,7 @@ class LegoCharacterManager { LegoCharacterInfo* GetInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); + MxU8 FUN_10085180(LegoROI* p_roi); LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index 696a3a50..d2c846f3 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -49,11 +49,13 @@ class LegoExtraActor : public virtual LegoAnimActor { MxResult WaitForAnimation() override; // vtable+0x9c void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4 void VTable0xc4() override; // vtable+0xc4 + virtual MxResult VTable0xc8(); // vtable+0xc8 - virtual MxResult FUN_1002aae0(); void Restart(); inline void FUN_1002ad8a(); + inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + // SYNTHETIC: LEGO1 0x1002b760 // LegoExtraActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legolocations.h b/LEGO1/lego/legoomni/include/legolocations.h new file mode 100644 index 00000000..a049dc2f --- /dev/null +++ b/LEGO1/lego/legoomni/include/legolocations.h @@ -0,0 +1,31 @@ +#ifndef LEGOLOCATIONS_H +#define LEGOLOCATIONS_H + +#include "decomp.h" +#include "mxtypes.h" + +// SIZE 0x60 +struct LegoLocation { + // SIZE 0x18 + struct Boundary { + const char* m_name; // 0x00 + MxS32 m_src; // 0x04 + float m_srcScale; // 0x08 + MxS32 m_dest; // 0x0c + float m_destScale; // 0x10 + MxBool m_unk0x10; // 0x14 + }; + + MxU32 m_index; // 0x00 + const char* m_name; // 0x04 + float m_position[3]; // 0x08 + float m_direction[3]; // 0x14 + float m_up[3]; // 0x20 + Boundary m_boundaryA; // 0x2c + Boundary m_boundaryB; // 0x44 + undefined4 m_unk0x5c; // 0x5c +}; + +extern LegoLocation g_locations[70]; + +#endif // LEGOLOCATIONS_H diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 89116a3e..8e54bd1e 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -5,7 +5,7 @@ #include "mxcore.h" #include "mxtypes.h" -struct LegoCameraLocation; +struct LegoLocation; class Vector3; ////////////////////////////////////////////////////////////////////////////// @@ -72,9 +72,9 @@ class LegoNavController : public MxCore { float p_rs, MxBool p_urs ); - static MxResult UpdateCameraLocation(MxU32 p_location); - static MxResult UpdateCameraLocation(const char* p_location); - static LegoCameraLocation* GetCameraLocation(MxU32 p_location); + static MxResult UpdateLocation(MxU32 p_location); + static MxResult UpdateLocation(const char* p_location); + static LegoLocation* GetLocation(MxU32 p_location); inline void SetLinearVel(MxFloat p_linearVel) { m_linearVel = p_linearVel; } inline MxFloat GetLinearVel() { return m_linearVel; } diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 3a9527cc..fb4efe77 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -46,7 +46,7 @@ class LegoPathController : public MxCore { MxResult FUN_10045c20( LegoPathActor* p_actor, - const char* p_path, + const char* p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 1c13b099..d2179266 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -65,9 +65,9 @@ class LegoWorld : public LegoEntity { MxBool PresentersPending(); void Remove(MxCore* p_object); - MxResult FUN_1001f720( - IslePathActor* p_actor, - const char* p_path, + MxResult PlaceActor( + LegoPathActor* p_actor, + const char* p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 4f03d994..91a3c105 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -482,7 +482,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p VTable0xe0(); } - m_world->FUN_1001f720( + m_world->PlaceActor( this, g_spawnLocations[i].m_path, g_spawnLocations[i].m_src, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 468b28eb..d0921a21 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -11,6 +11,7 @@ #include "legoextraactor.h" #include "legogamestate.h" #include "legomain.h" +#include "legonavcontroller.h" #include "legoroilist.h" #include "legovideomanager.h" #include "legoworld.h" @@ -112,6 +113,9 @@ MxS32 g_legoAnimationManagerConfig = 1; // GLOBAL: LEGO1 0x100f7500 float g_unk0x100f7500 = 0.1f; +// GLOBAL: LEGO1 0x100f7504 +MxS32 g_unk0x100f7504 = 0; + // FUNCTION: LEGO1 0x1005eb50 void LegoAnimationManager::configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig) { @@ -213,7 +217,7 @@ void LegoAnimationManager::Suspend() } if (m_scriptIndex == 0) { - m_animState->FUN_10065240(m_animCount, m_anims, m_unk0x3fc); + m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); } if (!m_suspended) { @@ -316,7 +320,7 @@ void LegoAnimationManager::Init() m_unk0x38 = FALSE; m_unk0x39 = FALSE; m_unk0x3a = TRUE; - m_unk0x3fc = 0; + m_lastExtraCharacterId = 0; m_unk0x400 = FALSE; m_unk0x414 = 0; m_numAllowedExtras = 5; @@ -335,7 +339,7 @@ void LegoAnimationManager::Init() } for (i = 0; i < (MxS32) _countof(g_vehicles); i++) { - g_vehicles[i].m_unk0x04 = 0; + g_vehicles[i].m_unk0x04 = FALSE; g_vehicles[i].m_unk0x05 = FALSE; } @@ -412,7 +416,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) } if (m_scriptIndex == 0) { - m_animState->FUN_10065240(m_animCount, m_anims, m_unk0x3fc); + m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); } DeleteAnimations(); @@ -524,7 +528,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) } if (p_scriptIndex == 0) { - m_animState->FUN_100651d0(m_animCount, m_anims, m_unk0x3fc); + m_animState->FUN_100651d0(m_animCount, m_anims, m_lastExtraCharacterId); } } @@ -1586,11 +1590,188 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) } } -// STUB: LEGO1 0x100629b0 +// FUNCTION: LEGO1 0x100629b0 // FUNCTION: BETA10 0x10043c10 -void LegoAnimationManager::AddExtra(MxU32 p_cameraLocation, MxBool p_und) +void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) { - // TODO + LegoLocation::Boundary* boundary = NULL; + + if (p_und || (!m_unk0x39 && m_unk0x400)) { + LegoWorld* world = CurrentWorld(); + + if (world != NULL) { + PurgeExtra(FALSE); + + IslePathActor* actor = CurrentActor(); + if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) { + MxU32 i; + for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) { + } + + if (i != m_numAllowedExtras) { + MxU8 und = rand() % 2 != 0 ? 1 : 2; + MxBool bool1, bool2; + + switch (g_unk0x100f7504 % 4) { + case 0: + bool1 = FALSE; + bool2 = FALSE; + break; + case 1: + bool1 = FALSE; + bool2 = TRUE; + break; + default: + bool1 = TRUE; + bool2 = FALSE; + break; + } + + if (p_location < 0) { + boundary = new LegoLocation::Boundary; + + if (!FUN_10064120(boundary, und == 2, bool2)) { + delete boundary; + boundary = NULL; + } + } + else { + LegoLocation* location = LegoNavController::GetLocation(p_location); + + if (location != NULL) { + if (location->m_boundaryA.m_unk0x10 || FUN_10063fb0(&location->m_boundaryA, world)) { + boundary = &location->m_boundaryA; + } + else if (location->m_boundaryB.m_unk0x10 || FUN_10063fb0(&location->m_boundaryB, world)) { + boundary = &location->m_boundaryB; + } + } + + bool1 = FALSE; + } + + if (boundary != NULL) { + for (i = 0; i < m_numAllowedExtras; i++) { + if (m_extras[i].m_roi == NULL) { + m_lastExtraCharacterId++; + + if (m_lastExtraCharacterId >= _countof(g_characters)) { + m_lastExtraCharacterId = 0; + } + + MxU32 characterIdStart = m_lastExtraCharacterId; + + MxBool active; + if (bool1) { + active = TRUE; + } + else { + active = rand() % 100 < 50; + } + + nextCharacter: + if (g_characters[m_lastExtraCharacterId].m_unk0x09 && + g_characters[m_lastExtraCharacterId].m_unk0x08 && + !g_characters[m_lastExtraCharacterId].m_unk0x04 && + g_characters[m_lastExtraCharacterId].m_active == active) { + if (!CharacterManager()->FUN_10083b20(g_characters[m_lastExtraCharacterId].m_name + )) { + m_extras[i].m_roi = CharacterManager()->GetROI( + g_characters[m_lastExtraCharacterId].m_name, + TRUE + ); + + LegoExtraActor* actor = + CharacterManager()->GetActor(g_characters[m_lastExtraCharacterId].m_name); + + switch (g_unk0x100f7504++ % 4) { + case 0: + actor->SetUnknown0x0c(und != 1 ? 1 : 2); + break; + case 1: { + actor->SetUnknown0x0c(und); + MxS32 src = boundary->m_src; + boundary->m_src = boundary->m_dest; + boundary->m_dest = src; + break; + } + default: + actor->SetUnknown0x0c(und); + break; + } + + if (world->PlaceActor( + actor, + boundary->m_name, + boundary->m_src, + boundary->m_srcScale, + boundary->m_dest, + boundary->m_destScale + ) == SUCCESS) { + + MxS32 vehicleId = g_characters[m_lastExtraCharacterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x04 = + rand() % 100 < g_characters[m_lastExtraCharacterId].m_unk0x15; + } + + if (FUN_10063b90( + world, + actor, + CharacterManager()->FUN_10085180(m_extras[i].m_roi), + m_lastExtraCharacterId + )) { + m_extras[i].m_unk0x14 = TRUE; + g_vehicles[vehicleId].m_unk0x05 = TRUE; + } + else { + m_extras[i].m_unk0x14 = FALSE; + } + + float speed; + if (m_extras[i].m_unk0x14) { + speed = ((float) (rand() * 1.5) / 32767.0f) + 0.9; + } + else { + speed = ((float) (rand() * 1.4) / 32767.0f) + 0.6; + } + + actor->SetWorldSpeed(speed); + + m_extras[i].m_characterId = m_lastExtraCharacterId; + g_characters[m_lastExtraCharacterId].m_unk0x04 = TRUE; + m_extras[i].m_unk0x08 = Timer()->GetTime(); + m_extras[i].m_unk0x10 = -1; + m_extras[i].m_unk0x0d = FALSE; + m_unk0x414++; + return; + } + else { + CharacterManager()->FUN_10083db0(m_extras[i].m_roi); + m_extras[i].m_roi = NULL; + continue; + } + } + } + + m_lastExtraCharacterId++; + + if (m_lastExtraCharacterId >= _countof(g_characters)) { + m_lastExtraCharacterId = 0; + } + + if (m_lastExtraCharacterId == characterIdStart) { + return; + } + + goto nextCharacter; + } + } + } + } + } + } + } } // STUB: LEGO1 0x10063270 @@ -1628,6 +1809,19 @@ void LegoAnimationManager::FUN_10063aa0() } } +// STUB: LEGO1 0x10063b90 +// FUNCTION: BETA10 0x10044d46 +MxBool LegoAnimationManager::FUN_10063b90( + LegoWorld* p_world, + LegoExtraActor* p_actor, + MxU8 p_unk0x14, + MxU32 p_characterId +) +{ + // TODO + return TRUE; +} + // STUB: LEGO1 0x10063d10 // FUNCTION: BETA10 0x10045034 void LegoAnimationManager::FUN_10063d10() @@ -1635,6 +1829,22 @@ void LegoAnimationManager::FUN_10063d10() // TODO } +// STUB: LEGO1 0x10063fb0 +// FUNCTION: BETA10 0x100452a7 +MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world) +{ + // TODO + return TRUE; +} + +// STUB: LEGO1 0x10064120 +// FUNCTION: BETA10 0x100454f5 +MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool, MxBool) +{ + // TODO + return TRUE; +} + // STUB: LEGO1 0x10064670 void LegoAnimationManager::FUN_10064670(Vector3*) { diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index a3fc9e2d..032b6969 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -245,6 +245,14 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) return NULL; } +// STUB: LEGO1 0x10083b20 +// FUNCTION: BETA10 0x10074608 +MxBool LegoCharacterManager::FUN_10083b20(const char* p_name) +{ + // TODO + return FALSE; +} + // FUNCTION: LEGO1 0x10083bc0 MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi) { @@ -736,6 +744,14 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) return 0; } +// STUB: LEGO1 0x10085180 +// FUNCTION: BETA10 0x100768c5 +MxU8 LegoCharacterManager::FUN_10085180(LegoROI* p_roi) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x100851a0 void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value) { diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index cedf5482..a8cc6d9c 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -889,7 +889,7 @@ void LegoGameState::SwitchArea(Area p_area) LoadIsle(); VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); CurrentActor()->ResetWorldTransform(FALSE); - NavController()->UpdateCameraLocation(59); // LCAMZG1 in g_cameraLocations + NavController()->UpdateLocation(59); // LCAMZG1 in g_cameraLocations VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL); break; diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 993b0129..7dc427b8 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -105,7 +105,7 @@ void CameraLocationVariable::SetValue(const char* p_value) strcpy(buffer, p_value); char* location = strtok(buffer, ","); - NavController()->UpdateCameraLocation(location); + NavController()->UpdateLocation(location); location = strtok(NULL, ","); if (location) { diff --git a/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp b/LEGO1/lego/legoomni/src/entity/legolocations.cpp similarity index 59% rename from LEGO1/lego/legoomni/src/entity/legocameralocations.cpp rename to LEGO1/lego/legoomni/src/entity/legolocations.cpp index 9c887e68..68627a5d 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameralocations.cpp +++ b/LEGO1/lego/legoomni/src/entity/legolocations.cpp @@ -1,11 +1,24 @@ -#include "legocameralocations.h" +#include "legolocations.h" -DECOMP_SIZE_ASSERT(LegoCameraLocation, 0x60) -DECOMP_SIZE_ASSERT(LegoCameraLocation::Path, 0x18) +DECOMP_SIZE_ASSERT(LegoLocation, 0x60) +DECOMP_SIZE_ASSERT(LegoLocation::Boundary, 0x18) // GLOBAL: LEGO1 0x100f4c60 -LegoCameraLocation g_cameraLocations[] = { - {0, "look at origin from z=-8", 0, 1.25, -8, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, +LegoLocation g_locations[] = { + {0, + "look at origin from z=-8", + 0, + 1.25, + -8, + 0, + 0, + 1, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, + FALSE}, {1, "LCAMBA1", 0.852546, @@ -17,8 +30,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_13", 2, 0.75, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_13", 2, 0.75, 0, 0.25, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 10240}, {2, "LCAMBA2", @@ -31,8 +44,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_37", 2, 0.75, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_37", 2, 0.75, 0, 0.25, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 5120}, {3, "LCAMBA3", @@ -45,8 +58,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_26", 0, 0.75, 2, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_26", 0, 0.75, 2, 0.25, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 5120}, {4, "LCAMBA4", @@ -59,8 +72,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_146", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_146", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 7680}, {5, "LCAMCA1", @@ -73,8 +86,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"INT01", 2, 0.5, 6, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"INT01", 2, 0.5, 6, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {6, "LCAMCA2", @@ -87,8 +100,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.000446, 0.999999, -0.001387, - {"EDG00_104", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_104", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {7, "LCAMCA3", @@ -101,8 +114,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.000173, 0.999998, 0.001888, - {"EDG02_58", 2, 0.25, 0, 0.75, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_58", 2, 0.25, 0, 0.75, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {8, "LCAMGS1", @@ -115,8 +128,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_40", 2, 0.25, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_40", 2, 0.25, 0, 0.25, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 17920}, {9, "LCAMGS2", @@ -129,8 +142,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"INT19", 1, 0.75, 0, 0.75, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"INT19", 1, 0.75, 0, 0.75, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {10, "LCAMGS3", @@ -143,8 +156,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_74", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_74", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {11, "LCAMHO1", @@ -157,8 +170,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 12800}, {12, "LCAMHO2", @@ -171,8 +184,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {13, "LCAMHO3", @@ -185,8 +198,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.005781, 0.999976, 0.003708, - {"EDG02_27", 1, 0.89, 2, 0.89, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_27", 1, 0.89, 2, 0.89, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {14, "LCAMHO4", @@ -199,8 +212,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.034088, 0.999355, -0.011255, - {"EDG02_27", 1, 0.89, 2, 0.89, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_27", 1, 0.89, 2, 0.89, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {15, "LCAMIC1", @@ -213,8 +226,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_69", 2, 0.5, 0, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_69", 2, 0.5, 0, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {16, "LCAMIC2", @@ -227,8 +240,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_66", 2, 0.5, 0, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_66", 2, 0.5, 0, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {17, "LCAMIC3", @@ -241,8 +254,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_68", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_68", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 5120}, {18, "LCAMJA1", @@ -255,8 +268,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.006372, 0.999977, -0.002478, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {19, "LCAMJA2", @@ -269,8 +282,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.010811, 0.999927, 0.005453, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {20, "LCAMJA3", @@ -283,8 +296,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"INT33", 1, 0.9, 3, 0.9, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"INT33", 1, 0.9, 3, 0.9, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {21, "LCAMJA4", @@ -297,8 +310,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.001442, 0.999945, 0.010407, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {22, "LCAMJA5", @@ -311,8 +324,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.007107, 0.999949, -0.007199, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {23, "LCAMJS1", @@ -325,8 +338,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.000653, 0.999999, -0.000932, - {"INT26", 0, 0.5, 3, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"INT26", 0, 0.5, 3, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {24, "LCAMJS2", @@ -339,8 +352,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {25, "LCAMJS3", @@ -353,8 +366,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {26, "LCAMJS4", @@ -367,8 +380,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.000261, 0.999999, -0.001364, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {27, "LCAMMT1", @@ -381,8 +394,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 12800}, {28, "LCAMMT2", @@ -395,8 +408,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {29, "LCAMPK1", @@ -409,8 +422,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_83", 0, 0.9, 2, 0.9, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_83", 0, 0.9, 2, 0.9, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 12800}, {30, "LCAMPK2", @@ -423,8 +436,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {31, "LCAMPK4", @@ -437,8 +450,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {32, "LCAMPO1", @@ -451,8 +464,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 5120}, {33, "LCAMPO2", @@ -465,8 +478,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_191", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_191", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {34, "LCAMPS1", @@ -479,8 +492,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_40", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_40", 0, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {35, "LCAMPS2", @@ -493,8 +506,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {36, "LCAMPS3", @@ -507,8 +520,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_66", 1, 0.15, 2, 0.15, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_66", 1, 0.15, 2, 0.15, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {37, "LCAMPS4", @@ -521,8 +534,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG02_40", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG02_40", 0, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {38, "LCAMPZ1", @@ -535,8 +548,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 20480}, {39, "LCAMPZ2", @@ -549,8 +562,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 23040}, {40, "LCAMPZ3", @@ -563,10 +576,23 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG00_24", 0, 0.9, 2, 0.9, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_24", 0, 0.9, 2, 0.9, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, - {41, "LCAMPZ4", -20.492962, 1.25, -43.951485, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {41, + "LCAMPZ4", + -20.492962, + 1.25, + -43.951485, + 0, + 0, + 1, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, + FALSE}, {42, "LCAMPZ5", -11.0625, @@ -578,8 +604,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 12800}, {43, "LCAMPZ6", @@ -592,8 +618,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {44, "LCAMPZ7", @@ -606,8 +632,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {45, "LCAMRA1", @@ -620,8 +646,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.007751, 0.998685, -0.050677, - {"EDG00_03", 1, 0.5, 3, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG00_03", 1, 0.5, 3, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {46, "LCAMRA2", @@ -634,8 +660,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.000078, 1, 0.000105, - {"EDG01_17", 0, 0.5, 3, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG01_17", 0, 0.5, 3, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {47, "LCAMRA3", @@ -648,8 +674,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.000112, 1, 0.000021, - {"EDG01_40", 2, 0.5, 0, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG01_40", 2, 0.5, 0, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {48, "LCAMRA4", @@ -662,8 +688,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.035939, 0.999346, -0.00388, - {"EDG01_27", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG01_27", 0, 0.5, 2, 0.5, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {49, "LCAMRA5", @@ -676,8 +702,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.024875, 0.999675, -0.005499, - {"EDG01_08", 2, 0.7, 0, 0.7, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG01_08", 2, 0.7, 0, 0.7, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 6400}, {50, "LCAMRA6", @@ -690,8 +716,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.000378, 1, 0.000009, - {"EDG01_13", 1, 0.2, 0, 0.2, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG01_13", 1, 0.2, 0, 0.2, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {51, "LCAMRT1", @@ -704,8 +730,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 20480}, {52, "LCAMRT2", @@ -718,8 +744,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, {53, "LCAMRT3", @@ -732,10 +758,23 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 25600}, - {54, "LCAMRT4", 0.4375, 1.25, 7, -0.748454, 0, -0.663187, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {54, + "LCAMRT4", + 0.4375, + 1.25, + 7, + -0.748454, + 0, + -0.663187, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, + FALSE}, {55, "LCAMRT5", -27.213715, @@ -747,8 +786,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG03_05", 1, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG03_05", 1, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {56, "LCAMRT6", @@ -761,8 +800,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + {"EDG03_10", 0, 0.5, 2, 0.5, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 15360}, {57, "LCAMST1", @@ -775,8 +814,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 5120}, {58, "LCAMST2", @@ -789,8 +828,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {59, "LCAMZG1", @@ -803,11 +842,37 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {"INT22", 0, 0.4, 2, 0.4, 1}, - {NULL, 0, 0, 0, 0, 0}, + {"INT22", 0, 0.4, 2, 0.4, TRUE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, - {60, "LCAMZI1", 93.37283, 10.1875, -10.382307, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, - {61, "LCAMZI2", 93.37283, 19.4375, -10.382307, 0, 0, 1, 0, 1, 0, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, 0}, + {60, + "LCAMZI1", + 93.37283, + 10.1875, + -10.382307, + 0, + 0, + 1, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, + FALSE}, + {61, + "LCAMZI2", + 93.37283, + 19.4375, + -10.382307, + 0, + 0, + 1, + 0, + 1, + 0, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, + FALSE}, {62, "LCAMZIE", 93.375, @@ -819,8 +884,8 @@ LegoCameraLocation g_cameraLocations[] = { 0.254493, 0.967075, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {63, "LCAMZIN", @@ -833,8 +898,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 0.967203, 0.254006, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {64, "LCAMZIS", @@ -847,8 +912,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 0.966946, -0.254982, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {65, "LCAMZIW", @@ -861,8 +926,8 @@ LegoCameraLocation g_cameraLocations[] = { -0.254493, 0.967075, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {66, "LCAMZP1", @@ -875,8 +940,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {67, "LCAMRT7", @@ -889,8 +954,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + {NULL, 0, 0, 0, 0, FALSE}, + {NULL, 0, 0, 0, 0, FALSE}, 0}, {68, "LCAMJS5", @@ -903,8 +968,8 @@ LegoCameraLocation g_cameraLocations[] = { 0, 1, 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 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, 0}, {NULL, 0, 0, 0, 0, 0}, 0} + {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, {NULL, 0, 0, 0, 0, FALSE}, {NULL, 0, 0, 0, 0, FALSE}, 0} }; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 37436736..2ecdff71 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -4,9 +4,9 @@ #include "infocenterstate.h" #include "legoanimationmanager.h" #include "legocameracontroller.h" -#include "legocameralocations.h" #include "legogamestate.h" #include "legoinputmanager.h" +#include "legolocations.h" #include "legomain.h" #include "legosoundmanager.h" #include "legoutils.h" @@ -403,21 +403,16 @@ MxBool LegoNavController::CalculateNewPosDir( } // FUNCTION: LEGO1 0x10055500 -MxResult LegoNavController::UpdateCameraLocation(const char* p_location) +MxResult LegoNavController::UpdateLocation(const char* p_location) { MxResult result = FAILURE; - for (MxS32 i = 0; i < (MxS32) _countof(g_cameraLocations); i++) { - if (!strcmpi(p_location, g_cameraLocations[i].m_name)) { + for (MxS32 i = 0; i < (MxS32) _countof(g_locations); i++) { + if (!strcmpi(p_location, g_locations[i].m_name)) { MxMatrix mat; LegoROI* viewROI = VideoManager()->GetViewROI(); - CalcLocalTransform( - g_cameraLocations[i].m_position, - g_cameraLocations[i].m_direction, - g_cameraLocations[i].m_up, - mat - ); + CalcLocalTransform(g_locations[i].m_position, g_locations[i].m_direction, g_locations[i].m_up, mat); Mx3DPointFloat vec; vec.Clear(); @@ -441,18 +436,18 @@ MxResult LegoNavController::UpdateCameraLocation(const char* p_location) } // FUNCTION: LEGO1 0x10055620 -MxResult LegoNavController::UpdateCameraLocation(MxU32 p_location) +MxResult LegoNavController::UpdateLocation(MxU32 p_location) { MxResult result = FAILURE; - if (p_location < _countof(g_cameraLocations)) { + if (p_location < _countof(g_locations)) { MxMatrix mat; LegoROI* viewROI = VideoManager()->GetViewROI(); CalcLocalTransform( - g_cameraLocations[p_location].m_position, - g_cameraLocations[p_location].m_direction, - g_cameraLocations[p_location].m_up, + g_locations[p_location].m_position, + g_locations[p_location].m_direction, + g_locations[p_location].m_up, mat ); @@ -478,10 +473,10 @@ MxResult LegoNavController::UpdateCameraLocation(MxU32 p_location) // FUNCTION: LEGO1 0x10055720 // FUNCTION: BETA10 0x1009c259 -LegoCameraLocation* LegoNavController::GetCameraLocation(MxU32 p_location) +LegoLocation* LegoNavController::GetLocation(MxU32 p_location) { - if (p_location < _countof(g_cameraLocations)) { - return &g_cameraLocations[p_location]; + if (p_location < _countof(g_locations)) { + return &g_locations[p_location]; } return NULL; diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index fb9ac70e..d776b0e1 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -274,9 +274,9 @@ LegoCameraController* LegoWorld::VTable0x54() // FUNCTION: LEGO1 0x1001f720 // FUNCTION: BETA10 0x100da24b -MxResult LegoWorld::FUN_1001f720( - IslePathActor* p_actor, - const char* p_path, +MxResult LegoWorld::PlaceActor( + LegoPathActor* p_actor, + const char* p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, @@ -287,7 +287,7 @@ MxResult LegoWorld::FUN_1001f720( LegoPathController* controller; while (cursor.Next(controller)) { - if (controller->FUN_10045c20(p_actor, p_path, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) { + if (controller->FUN_10045c20(p_actor, p_name, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) { return SUCCESS; } } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 9da6e219..1f68645e 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -128,7 +128,7 @@ void LegoExtraActor::VTable0xa4(MxU8& p_und1, MxS32& p_und2) } // FUNCTION: LEGO1 0x1002aae0 -MxResult LegoExtraActor::FUN_1002aae0() +MxResult LegoExtraActor::VTable0xc8() { LegoPathBoundary* oldEdge = m_boundary; Vector3 rightRef(m_unk0xec[0]); @@ -203,7 +203,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } m_unk0x15 = 100; - FUN_1002aae0(); + VTable0xc8(); } else { MxU32 b = FALSE; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 5ab492de..66e7dc26 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -33,7 +33,7 @@ MxResult LegoPathController::Tickle() // FUNCTION: BETA10 0x100b6d80 MxResult LegoPathController::FUN_10045c20( LegoPathActor* p_actor, - const char* p_path, + const char* p_name, MxS32 p_src, float p_srcScale, MxS32 p_dest, diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index bafe2e99..89a7a8ee 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -487,15 +487,15 @@ void Isle::Enable(MxBool p_enable) FUN_1003ef00(TRUE); if (m_act1state->m_unk0x018 == 0) { - MxU32 cameraLocations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; for (MxU32 i = 0; i < 5; i++) { MxS32 r = rand() % 5; - for (MxU32 j = 0; j < _countof(cameraLocations); j++) { - if (cameraLocations[j] != 0 && r-- == 0) { - AnimationManager()->AddExtra(cameraLocations[j], TRUE); - cameraLocations[j] = 0; + for (MxU32 j = 0; j < _countof(locations); j++) { + if (locations[j] != 0 && r-- == 0) { + AnimationManager()->AddExtra(locations[j], TRUE); + locations[j] = 0; break; } } From c77dd44105a3f32917d6459f3339dbbfa84c330a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 08:13:27 -0400 Subject: [PATCH 18/89] Implement/match LegoCharacterManager::FUN_10083b20 and FUN_10085180 (#902) --- .../legoomni/include/legocharactermanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 5 ++--- .../src/common/legocharactermanager.cpp | 21 ++++++++++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 4db8a5ba..878e1f41 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -59,7 +59,7 @@ class LegoCharacterManager { static MxBool Exists(const char* p_key); void FUN_100832a0(); - MxBool FUN_10083b20(const char* p_name); + MxBool FUN_10083b20(const char* p_key); MxU32 GetRefCount(LegoROI* p_roi); void FUN_10083c30(const char* p_name); void FUN_10083db0(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index d0921a21..515e8aec 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1669,7 +1669,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) active = rand() % 100 < 50; } - nextCharacter: + tryNextCharacter: if (g_characters[m_lastExtraCharacterId].m_unk0x09 && g_characters[m_lastExtraCharacterId].m_unk0x08 && !g_characters[m_lastExtraCharacterId].m_unk0x04 && @@ -1708,7 +1708,6 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) boundary->m_dest, boundary->m_destScale ) == SUCCESS) { - MxS32 vehicleId = g_characters[m_lastExtraCharacterId].m_vehicleId; if (vehicleId >= 0) { g_vehicles[vehicleId].m_unk0x04 = @@ -1764,7 +1763,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) return; } - goto nextCharacter; + goto tryNextCharacter; } } } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 032b6969..3548529e 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -245,11 +245,17 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) return NULL; } -// STUB: LEGO1 0x10083b20 +// FUNCTION: LEGO1 0x10083b20 // FUNCTION: BETA10 0x10074608 -MxBool LegoCharacterManager::FUN_10083b20(const char* p_name) +MxBool LegoCharacterManager::FUN_10083b20(const char* p_key) { - // TODO + LegoCharacter* character = NULL; + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_key)); + + if (it != m_characters->end()) { + return TRUE; + } + return FALSE; } @@ -744,11 +750,16 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) return 0; } -// STUB: LEGO1 0x10085180 +// FUNCTION: LEGO1 0x10085180 // FUNCTION: BETA10 0x100768c5 MxU8 LegoCharacterManager::FUN_10085180(LegoROI* p_roi) { - // TODO + LegoCharacterInfo* info = GetInfo(p_roi); + + if (info != NULL) { + return info->m_unk0x14; + } + return 0; } From 5df947dbb9bdb0989a483a45f7bc029073701139 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 09:32:11 -0400 Subject: [PATCH 19/89] Implement/match LegoPathController::FUN_10045c20 and LegoPathController ctor (#903) * Implement/match LegoPathController::FUN_10045c20 and LegoPathController ctor * Remove obsolete struct --- LEGO1/lego/legoomni/include/islepathactor.h | 8 ++-- LEGO1/lego/legoomni/include/legopathactor.h | 2 +- .../legoomni/include/legopathcontroller.h | 38 +++++++++++++------ .../legoomni/src/actors/islepathactor.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 12 +++--- .../lego/legoomni/src/paths/legopathactor.cpp | 1 + .../legoomni/src/paths/legopathcontroller.cpp | 37 +++++++++++++++--- LEGO1/lego/sources/geom/legounkown100db7f4.h | 1 + LEGO1/lego/sources/geom/legoweedge.h | 1 + 9 files changed, 73 insertions(+), 29 deletions(-) diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index e834eff1..569221f1 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -33,7 +33,7 @@ class IslePathActor : public LegoPathActor { LegoGameState::Area p_area, MxAtomId* p_script, MxS32 p_entityId, - const char* p_path, + const char* p_name, MxS16 p_src, float p_srcScale, MxS16 p_dest, @@ -45,7 +45,7 @@ class IslePathActor : public LegoPathActor { m_area = p_area; m_script = p_script; m_entityId = p_entityId; - strcpy(m_path, p_path); + strcpy(m_name, p_name); m_src = p_src; m_srcScale = p_srcScale; m_dest = p_dest; @@ -60,7 +60,7 @@ class IslePathActor : public LegoPathActor { m_area = p_location.m_area; m_script = p_location.m_script; m_entityId = p_location.m_entityId; - strcpy(m_path, p_location.m_path); + strcpy(m_name, p_location.m_name); m_src = p_location.m_src; m_srcScale = p_location.m_srcScale; m_dest = p_location.m_dest; @@ -73,7 +73,7 @@ class IslePathActor : public LegoPathActor { LegoGameState::Area m_area; // 0x00 MxAtomId* m_script; // 0x04 MxS32 m_entityId; // 0x08 - char m_path[20]; // 0x0c + char m_name[20]; // 0x0c MxS16 m_src; // 0x20 float m_srcScale; // 0x24 MxS16 m_dest; // 0x28 diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 86b67ac2..06eb4103 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -119,7 +119,7 @@ class LegoPathActor : public LegoActor { inline void SetBoundary(LegoPathBoundary* p_boundary) { m_boundary = p_boundary; } inline void SetState(MxU32 p_state) { m_state = p_state; } - inline void ClearController() { m_controller = NULL; } + inline void SetController(LegoPathController* p_controller) { m_controller = p_controller; } // SYNTHETIC: LEGO1 0x1002d800 // LegoPathActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index fb4efe77..069912d2 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -2,12 +2,12 @@ #define LEGOPATHCONTROLLER_H #include "decomp.h" +#include "legopathactor.h" +#include "legopathboundary.h" #include "mxcore.h" #include "mxstl/stlcompat.h" class LegoAnimPresenter; -class LegoPathActor; -class LegoPathBoundary; class LegoWorld; class MxAtomId; class Vector3; @@ -61,16 +61,30 @@ class LegoPathController : public MxCore { void FUN_10046bb0(LegoWorld* p_world); private: - LegoPathBoundary* m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - MxU16 m_numL; // 0x18 - MxU16 m_numE; // 0x1a - MxU16 m_numN; // 0x1c - MxU16 m_numT; // 0x1e - map m_pfsE; // 0x20 - map m_unk0x30; // 0x30 + LegoPathBoundary* m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + undefined4 m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 + MxU16 m_numL; // 0x18 + MxU16 m_numE; // 0x1a + MxU16 m_numN; // 0x1c + MxU16 m_numT; // 0x1e + set m_pfsE; // 0x20 + LegoPathActorSet m_actors; // 0x30 }; +// clang-format off +// TEMPLATE: LEGO1 0x100451a0 +// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::~_Tree::~Set + +// TEMPLATE: LEGO1 0x10045830 +// set >::~set > + +// GLOBAL: LEGO1 0x100f4360 +// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::_Nil +// clang-format on + #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 91a3c105..61b203e9 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -484,7 +484,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p m_world->PlaceActor( this, - g_spawnLocations[i].m_path, + g_spawnLocations[i].m_name, g_spawnLocations[i].m_src, g_spawnLocations[i].m_srcScale, g_spawnLocations[i].m_dest, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 515e8aec..3f4947a2 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -152,7 +152,7 @@ LegoAnimationManager::~LegoAnimationManager() if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) { CurrentWorld()->FUN_1001fc80((IslePathActor*) actor); - actor->ClearController(); + actor->SetController(NULL); } CharacterManager()->FUN_10083db0(roi); @@ -238,7 +238,7 @@ void LegoAnimationManager::Suspend() if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->FUN_10046770(actor); - actor->ClearController(); + actor->SetController(NULL); } CharacterManager()->FUN_10083db0(roi); @@ -863,7 +863,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt if (controller) { controller->FUN_10046770(actor); - actor->ClearController(); + actor->SetController(NULL); for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { if (m_extras[i].m_roi == roi) { @@ -1192,7 +1192,7 @@ MxResult LegoAnimationManager::Tickle() if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->FUN_10046770(actor); - actor->ClearController(); + actor->SetController(NULL); } CharacterManager()->FUN_10083db0(roi); @@ -1452,7 +1452,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) if (controller) { controller->FUN_10046770(actor); - actor->ClearController(); + actor->SetController(NULL); for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { if (m_extras[i].m_roi == actor->GetROI()) { @@ -1561,7 +1561,7 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { actor->GetController()->FUN_10046770(actor); - actor->ClearController(); + actor->SetController(NULL); } CharacterManager()->FUN_10083db0(roi); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 400f165d..6d393746 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -80,6 +80,7 @@ MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3 } // FUNCTION: LEGO1 0x1002d9c0 +// FUNCTION: BETA10 0x100ae9da MxResult LegoPathActor::VTable0x88( LegoPathBoundary* p_boundary, float p_time, diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 66e7dc26..c3d89b98 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -1,13 +1,22 @@ #include "legopathcontroller.h" -#include "legopathboundary.h" +#include "mxmisc.h" +#include "mxtimer.h" DECOMP_SIZE_ASSERT(LegoPathController, 0x40) -// STUB: LEGO1 0x10044f40 +// FUNCTION: LEGO1 0x10044f40 +// FUNCTION: BETA10 0x100b6860 LegoPathController::LegoPathController() { - // TODO + m_unk0x08 = NULL; + m_unk0x0c = 0; + m_unk0x10 = 0; + m_unk0x14 = 0; + m_numL = 0; + m_numE = 0; + m_numN = 0; + m_numT = 0; } // STUB: LEGO1 0x10045880 @@ -29,7 +38,7 @@ MxResult LegoPathController::Tickle() return SUCCESS; } -// STUB: LEGO1 0x10045c20 +// FUNCTION: LEGO1 0x10045c20 // FUNCTION: BETA10 0x100b6d80 MxResult LegoPathController::FUN_10045c20( LegoPathActor* p_actor, @@ -40,10 +49,28 @@ MxResult LegoPathController::FUN_10045c20( float p_destScale ) { + if (p_actor->GetController() != NULL) { + p_actor->GetController()->FUN_10046770(p_actor); + p_actor->SetController(NULL); + } + + LegoPathBoundary* pBoundary = GetPathBoundary(p_name); + LegoEdge* pSrcE = pBoundary->GetEdges()[p_src]; + LegoEdge* pDestE = pBoundary->GetEdges()[p_dest]; + float time = Timer()->GetTime(); + + if (p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoUnknown100db7f4&) *pDestE, p_destScale) != + SUCCESS) { + return FAILURE; + } + + p_actor->SetController(this); + m_actors.insert(p_actor); return SUCCESS; } // STUB: LEGO1 0x10046770 +// FUNCTION: BETA10 0x100b7264 undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor) { return 0; @@ -72,7 +99,7 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_va LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name) { for (MxS32 i = 0; i < m_numL; i++) { - if (strcmpi(m_unk0x08[i].GetName(), p_name) == 0) { + if (!strcmpi(m_unk0x08[i].GetName(), p_name)) { return &m_unk0x08[i]; } } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index d1cfa324..8cf8934f 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -10,6 +10,7 @@ class LegoUnknown100db7f4 : public LegoEdge { public: // FUNCTION: LEGO1 0x1002ddc0 + // FUNCTION: BETA10 0x100372a0 LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) { if (p_f.IsEqual(*m_faceA)) { diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index f02b0cac..c743479d 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -15,6 +15,7 @@ class LegoWEEdge { virtual LegoResult VTable0x04(); // vtable+0x04 inline LegoU8 GetNumEdges() { return m_numEdges; } + inline LegoEdge** GetEdges() { return m_edges; } inline LegoU32 IsEqual(LegoWEEdge& p_other) { return this == &p_other; } // SYNTHETIC: LEGO1 0x1009a570 From f442f1a2f79fe46d37eef8b7f1d3f16038522a7f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 12:23:18 -0400 Subject: [PATCH 20/89] Implement/match LegoPathController::Read (#904) * Implement/match LegoPathController::Read * Add size asserts --- CMakeLists.txt | 1 + .../lego/legoomni/include/legopathboundary.h | 3 +- .../legoomni/include/legopathcontroller.h | 83 ++++++++++---- LEGO1/lego/legoomni/include/legopathstruct.h | 50 +++++++++ .../legoomni/src/paths/legopathboundary.cpp | 7 ++ .../legoomni/src/paths/legopathcontroller.cpp | 102 +++++++++++++++++- .../legoomni/src/paths/legopathpresenter.cpp | 8 +- .../legoomni/src/paths/legopathstruct.cpp | 11 ++ .../lego/sources/geom/legounkown100db7f4.cpp | 9 ++ LEGO1/lego/sources/geom/legounkown100db7f4.h | 5 + LEGO1/library_msvc.h | 24 +++++ 11 files changed, 276 insertions(+), 27 deletions(-) create mode 100644 LEGO1/lego/legoomni/include/legopathstruct.h create mode 100644 LEGO1/lego/legoomni/src/paths/legopathstruct.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3856f024..259ec560 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/paths/legopathboundary.cpp LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp + LEGO1/lego/legoomni/src/paths/legopathstruct.cpp LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp LEGO1/lego/legoomni/src/police/policeentity.cpp diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 393ab9ed..6eae5ae6 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -26,6 +26,7 @@ typedef set LegoAnimPresenterSe class LegoPathBoundary : public LegoWEGEdge { public: LegoPathBoundary(); + ~LegoPathBoundary() override; MxResult AddActor(LegoPathActor* p_actor); void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor); @@ -35,7 +36,7 @@ class LegoPathBoundary : public LegoWEGEdge { inline LegoAnimPresenterSet* GetPresenters() { return &m_presenters; } // SYNTHETIC: LEGO1 0x10047a80 - // LegoPathBoundary::`scalar deleting destructor' + // LegoPathBoundary::`vector deleting destructor' private: LegoPathActorSet m_actors; // 0x54 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 069912d2..7149300b 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -2,20 +2,31 @@ #define LEGOPATHCONTROLLER_H #include "decomp.h" +#include "geom/legounkown100db7f4.h" #include "legopathactor.h" #include "legopathboundary.h" #include "mxcore.h" #include "mxstl/stlcompat.h" class LegoAnimPresenter; +class LegoPathStruct; class LegoWorld; class MxAtomId; class Vector3; -struct LegoPathControllerComparator { - MxBool operator()(const undefined*, const undefined*) const { return 0; } +// VTABLE: LEGO1 0x100d7da8 +// SIZE 0x40 +class LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; + +struct LegoPathCtrlEdgeCompare { + MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const + { + return (MxS32) p_lhs < (MxS32) p_rhs; + } }; +typedef set LegoPathCtrlEdgeSet; + // VTABLE: LEGO1 0x100d7d60 // SIZE 0x40 class LegoPathController : public MxCore { @@ -41,8 +52,8 @@ class LegoPathController : public MxCore { // SYNTHETIC: LEGO1 0x10045740 // LegoPathController::`scalar deleting destructor' - virtual void VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 - virtual void Destroy(); // vtable+0x18 + virtual void Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 + virtual void Destroy(); // vtable+0x18 MxResult FUN_10045c20( LegoPathActor* p_actor, @@ -61,30 +72,66 @@ class LegoPathController : public MxCore { void FUN_10046bb0(LegoWorld* p_world); private: - LegoPathBoundary* m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - MxU16 m_numL; // 0x18 - MxU16 m_numE; // 0x1a - MxU16 m_numN; // 0x1c - MxU16 m_numT; // 0x1e - set m_pfsE; // 0x20 - LegoPathActorSet m_actors; // 0x30 + MxResult Read(LegoStorage* p_storage); + MxResult FUN_10047b30(LegoStorage* p_storage); + MxResult FUN_10047c10(LegoStorage* p_storage); + MxResult FUN_10047e90(LegoStorage* p_storage); + static MxResult FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&); + + LegoPathBoundary* m_unk0x08; // 0x08 + LegoPathCtrlEdge* m_unk0x0c; // 0x0c + Mx3DPointFloat* m_unk0x10; // 0x10 + LegoPathStruct* m_unk0x14; // 0x14 + MxU16 m_numL; // 0x18 + MxU16 m_numE; // 0x1a + MxU16 m_numN; // 0x1c + MxU16 m_numT; // 0x1e + LegoPathCtrlEdgeSet m_pfsE; // 0x20 + LegoPathActorSet m_actors; // 0x30 }; // clang-format off // TEMPLATE: LEGO1 0x100451a0 -// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::~_Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::~_Tree::~Set +// Set::~Set // TEMPLATE: LEGO1 0x10045830 -// set >::~set > +// set >::~set > + +// TEMPLATE: LEGO1 0x10047550 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Insert + +// TEMPLATE: LEGO1 0x100474e0 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::iterator::_Dec + +// TEMPLATE: LEGO1 0x10047530 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Buynode + +// TEMPLATE: LEGO1 0x100477d0 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Lrotate + +// TEMPLATE: LEGO1 0x10047830 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Rrotate + +// SYNTHETIC: LEGO1 0x10047940 +// LegoPathCtrlEdge::`vector deleting destructor' + +// SYNTHETIC: LEGO1 0x100479d0 +// LegoPathCtrlEdge::LegoPathCtrlEdge + +// SYNTHETIC: LEGO1 0x10047a30 +// LegoPathCtrlEdge::~LegoPathCtrlEdge + +// SYNTHETIC: LEGO1 0x10047ae0 +// LegoUnknown100db7f4::~LegoUnknown100db7f4 + +// TEMPLATE: LEGO1 0x1004a780 +// _Construct // GLOBAL: LEGO1 0x100f4360 -// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::_Nil +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Nil // clang-format on #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h new file mode 100644 index 00000000..b85d7d52 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -0,0 +1,50 @@ +#ifndef LEGOPATHSTRUCT_H +#define LEGOPATHSTRUCT_H + +#include "decomp.h" +#include "mxatom.h" +#include "mxtypes.h" + +// VTABLE: LEGO1 0x100d7d9c +// SIZE 0x0c +class LegoPathStructBase { +public: + LegoPathStructBase() : m_unk0x04(NULL), m_unk0x08(0) {} + + // FUNCTION: LEGO1 0x10047420 + virtual ~LegoPathStructBase() + { + if (m_unk0x04 != NULL) { + delete m_unk0x04; + } + } + +private: + undefined* m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 +}; + +// VTABLE: LEGO1 0x100d7da0 +// SIZE 0x14 +class LegoPathStruct : public LegoPathStructBase { +public: + // FUNCTION: LEGO1 0x100473a0 + LegoPathStruct() : m_unk0x0c(0) {} + + // FUNCTION: LEGO1 0x10047470 + ~LegoPathStruct() override {} + + void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04 + +private: + undefined4 m_unk0x0c; // 0x0c + MxAtomId m_atomId; // 0x10 +}; + +// SYNTHETIC: LEGO1 0x10047440 +// LegoPathStructBase::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10047890 +// LegoPathStruct::`vector deleting destructor' + +#endif // LEGOPATHSTRUCT_H diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 0da8541d..dc1dc21d 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -8,6 +8,13 @@ DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74) // STUB: LEGO1 0x10056a70 LegoPathBoundary::LegoPathBoundary() { + // TODO +} + +// STUB: LEGO1 0x10057260 +LegoPathBoundary::~LegoPathBoundary() +{ + // TODO } // FUNCTION: LEGO1 0x100573f0 diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index c3d89b98..3a2cf6ae 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -1,18 +1,21 @@ #include "legopathcontroller.h" +#include "legopathstruct.h" +#include "misc/legostorage.h" #include "mxmisc.h" #include "mxtimer.h" DECOMP_SIZE_ASSERT(LegoPathController, 0x40) +DECOMP_SIZE_ASSERT(LegoPathCtrlEdge, 0x40) // FUNCTION: LEGO1 0x10044f40 // FUNCTION: BETA10 0x100b6860 LegoPathController::LegoPathController() { m_unk0x08 = NULL; - m_unk0x0c = 0; - m_unk0x10 = 0; - m_unk0x14 = 0; + m_unk0x0c = NULL; + m_unk0x10 = NULL; + m_unk0x14 = NULL; m_numL = 0; m_numE = 0; m_numN = 0; @@ -20,7 +23,7 @@ LegoPathController::LegoPathController() } // STUB: LEGO1 0x10045880 -void LegoPathController::VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) +void LegoPathController::Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) { // TODO } @@ -118,3 +121,94 @@ void LegoPathController::Enable(MxBool p_enable) { // TODO } + +// FUNCTION: LEGO1 0x10046e50 +// FUNCTION: BETA10 0x100b781f +MxResult LegoPathController::Read(LegoStorage* p_storage) +{ + if (p_storage->Read(&m_numT, sizeof(m_numT)) != SUCCESS) { + return FAILURE; + } + if (m_numT > 0) { + m_unk0x14 = new LegoPathStruct[m_numT]; + } + + if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) { + return FAILURE; + } + if (m_numN > 0) { + m_unk0x10 = new Mx3DPointFloat[m_numN]; + } + + if (p_storage->Read(&m_numE, sizeof(m_numE)) != SUCCESS) { + return FAILURE; + } + if (m_numE > 0) { + m_unk0x0c = new LegoPathCtrlEdge[m_numE]; + } + + if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) { + return FAILURE; + } + if (m_numL > 0) { + m_unk0x08 = new LegoPathBoundary[m_numL]; + } + + if (m_numT > 0 && FUN_10047b30(p_storage) != SUCCESS) { + return FAILURE; + } + + if (m_numN > 0) { + for (MxS32 i = 0; i < m_numN; i++) { + if (FUN_100482b0(p_storage, m_unk0x10[i]) != SUCCESS) { + return FAILURE; + } + } + } + + if (m_numE > 0 && FUN_10047c10(p_storage) != SUCCESS) { + return FAILURE; + } + + if (m_numL > 0 && FUN_10047e90(p_storage) != SUCCESS) { + return FAILURE; + } + + for (MxS32 j = 0; j < m_numE; j++) { + m_pfsE.insert(&m_unk0x0c[j]); + } + + return SUCCESS; +} + +// STUB: LEGO1 0x10047b30 +// FUNCTION: BETA10 0x100b7cd6 +MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10047c10 +// FUNCTION: BETA10 0x1100b7df3 +MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10047e90 +// FUNCTION: BETA10 0x100b8293 +MxResult LegoPathController::FUN_10047e90(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x100482b0 +// FUNCTION: BETA10 0x100b8864 +MxResult LegoPathController::FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&) +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index 7542192b..4b935c7f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -70,9 +70,9 @@ void LegoPathPresenter::Destroy() // FUNCTION: LEGO1 0x10044c20 void LegoPathPresenter::ReadyTickle() { - LegoWorld* currentWorld = CurrentWorld(); + LegoWorld* world = CurrentWorld(); - if (currentWorld) { + if (world) { MxStreamChunk* chunk = m_subscriber->PopData(); if (chunk) { @@ -84,8 +84,8 @@ void LegoPathPresenter::ReadyTickle() else { ParseExtra(); - controller->VTable0x14(chunk->GetData(), m_action->GetLocation(), m_trigger); - currentWorld->AddPath(controller); + controller->Create(chunk->GetData(), m_action->GetLocation(), m_trigger); + world->AddPath(controller); m_subscriber->FreeDataChunk(chunk); ProgressTickleState(MxPresenter::e_starting); diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp new file mode 100644 index 00000000..2cbf51c4 --- /dev/null +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -0,0 +1,11 @@ +#include "legopathstruct.h" + +DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c) +DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) + +// STUB: LEGO1 0x1001b700 +// FUNCTION: BETA10 0x100c26c5 +void LegoPathStruct::VTable0x04(undefined4, undefined4, undefined4) +{ + // TODO +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp index 79ba66cb..4262da76 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp @@ -1,3 +1,12 @@ #include "legounkown100db7f4.h" DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40) + +// FUNCTION: LEGO1 0x1009a630 +// FUNCTION: BETA10 0x10183050 +LegoUnknown100db7f4::LegoUnknown100db7f4() +{ + m_unk0x24 = 0; + m_unk0x28.Clear(); + m_unk0x3c = 0; +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 8cf8934f..fa0dd995 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -9,6 +9,8 @@ // SIZE 0x40 class LegoUnknown100db7f4 : public LegoEdge { public: + LegoUnknown100db7f4(); + // FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: BETA10 0x100372a0 LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) @@ -25,6 +27,9 @@ class LegoUnknown100db7f4 : public LegoEdge { return SUCCESS; } + // SYNTHETIC: LEGO1 0x1009a6c0 + // LegoUnknown100db7f4::`scalar deleting destructor' + private: LegoU16 m_unk0x24; // 0x24 Mx3DPointFloat m_unk0x28; // 0x28 diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 4ef49f94..7a4153b6 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -18,6 +18,15 @@ // LIBRARY: LEGO1 0x1008b020 // ___CxxFrameHandler +// LIBRARY: LEGO1 0x1008b24c +// __global_unwind2 + +// LIBRARY: LEGO1 0x1008b28e +// __local_unwind2 + +// LIBRARY: LEGO1 0x1008b322 +// __NLG_Notify + // LIBRARY: LEGO1 0x1008b3dc // __CIacos @@ -81,6 +90,15 @@ // LIBRARY: LEGO1 0x1008c200 // _sscanf +// LIBRARY: LEGO1 0x1008c250 +// ??_L@YGXPAXIHP6EX0@Z1@Z + +// LIBRARY: LEGO1 0x1008c2e0 +// ??_M@YGXPAXIHP6EX0@Z@Z + +// LIBRARY: LEGO1 0x1008c370 +// ?__ArrayUnwind@@YGXPAXIHP6EX0@Z@Z + // LIBRARY: LEGO1 0x1008c410 // _strlwr @@ -93,6 +111,9 @@ // LIBRARY: LEGO1 0x1008c6a0 // _isdigit +// LIBRARY: LEGO1 0x1008c980 +// __except_handler3 + // LIBRARY: LEGO1 0x1008ca60 // _abort @@ -120,4 +141,7 @@ // LIBRARY: LEGO1 0x100d2270 // __beginthreadex +// LIBRARY: LEGO1 0x100fc8bc +// __NLG_Destination + #endif From b3d6319656dc95f988a9c1b43b926da3f78ed97d Mon Sep 17 00:00:00 2001 From: MS Date: Sat, 11 May 2024 12:27:06 -0400 Subject: [PATCH 21/89] Beta addrs for TglSurface and related (#905) --- LEGO1/lego/sources/3dmanager/legoview1.cpp | 24 +++++++++++++++++---- LEGO1/lego/sources/3dmanager/legoview1.h | 4 ++++ LEGO1/lego/sources/3dmanager/tglsurface.cpp | 12 +++++++++-- LEGO1/lego/sources/3dmanager/tglsurface.h | 7 ++++++ LEGO1/mxdirectx/mxstopwatch.h | 14 ++++++++++++ 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/sources/3dmanager/legoview1.cpp b/LEGO1/lego/sources/3dmanager/legoview1.cpp index 71cb4703..cfc70a3b 100644 --- a/LEGO1/lego/sources/3dmanager/legoview1.cpp +++ b/LEGO1/lego/sources/3dmanager/legoview1.cpp @@ -26,6 +26,7 @@ float g_ambientLightRGB = 0.3; // LegoView // FUNCTION: LEGO1 0x100ab510 +// FUNCTION: BETA10 0x1017bb90 LegoView::LegoView() { m_pScene = 0; @@ -33,18 +34,17 @@ LegoView::LegoView() } // FUNCTION: LEGO1 0x100ab5a0 +// FUNCTION: BETA10 0x1017bc19 LegoView::~LegoView() { Destroy(); } // FUNCTION: LEGO1 0x100ab600 +// FUNCTION: BETA10 0x1017bc89 BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer) { float viewAngle = 45; - if (rCreateStruct.m_isWideViewAngle) { - viewAngle = 90; - } float frontClippingDistance = 0.1; float backClippingDistance = 500; @@ -53,6 +53,10 @@ BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Render assert(!m_pCamera); assert(pRenderer); + if (rCreateStruct.m_isWideViewAngle) { + viewAngle = 90; + } + m_pScene = pRenderer->CreateGroup(); assert(m_pScene); // TglSurface::Create() calls CreateView(), and we need the camera in @@ -78,6 +82,7 @@ BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Render } // FUNCTION: LEGO1 0x100ab6c0 +// FUNCTION: BETA10 0x1017befd Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice) { assert(pRenderer); @@ -87,6 +92,7 @@ Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice) } // FUNCTION: LEGO1 0x100ab6f0 +// FUNCTION: BETA10 0x1017bf96 void LegoView::Destroy() { delete m_pScene; @@ -102,6 +108,7 @@ void LegoView::Destroy() // LegoView1 // FUNCTION: LEGO1 0x100ab730 +// FUNCTION: BETA10 0x1017c028 LegoView1::LegoView1() { m_pSunLight = 0; @@ -110,14 +117,17 @@ LegoView1::LegoView1() } // FUNCTION: LEGO1 0x100ab7c0 +// FUNCTION: BETA10 0x1017c0be LegoView1::~LegoView1() { Destroy(); } // FUNCTION: LEGO1 0x100ab820 +// FUNCTION: BETA10 0x1017c12e BOOL LegoView1::AddLightsToViewport() { + assert(GetView()); GetView()->Add(m_pSunLight); GetView()->Add(m_pDirectionalLight); GetView()->Add(m_pAmbientLight); @@ -125,6 +135,7 @@ BOOL LegoView1::AddLightsToViewport() } // FUNCTION: LEGO1 0x100ab860 +// FUNCTION: BETA10 0x1017c1ea BOOL LegoView1::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer) { if (!LegoView::Create(rCreateStruct, pRenderer)) { @@ -154,12 +165,13 @@ BOOL LegoView1::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Rende SETMAT4(in, transform); m_pSunLight->SetTransformation(matrix); - assert(GetView()); + // assert(GetView()); return AddLightsToViewport(); } // FUNCTION: LEGO1 0x100abad0 +// FUNCTION: BETA10 0x1017c912 void LegoView1::Destroy() { if (m_pSunLight) { @@ -184,6 +196,7 @@ void LegoView1::Destroy() } // FUNCTION: LEGO1 0x100abb60 +// FUNCTION: BETA10 0x1017ca80 void LegoView1::SetLightTransform(BOOL bDirectionalLight, Tgl::FloatMatrix4& rMatrix) { Tgl::Light* pLight; @@ -199,12 +212,14 @@ void LegoView1::SetLightTransform(BOOL bDirectionalLight, Tgl::FloatMatrix4& rMa } // FUNCTION: LEGO1 0x100abb80 +// FUNCTION: BETA10 0x1017cacf void LegoView1::SetLightTransform(Tgl::Light* pLight, Tgl::FloatMatrix4& rMatrix) { pLight->SetTransformation(rMatrix); } // FUNCTION: LEGO1 0x100abba0 +// FUNCTION: BETA10 0x1017caf6 void LegoView1::SetLightColor(BOOL bDirectionalLight, float red, float green, float blue) { Tgl::Light* pLight; @@ -220,6 +235,7 @@ void LegoView1::SetLightColor(BOOL bDirectionalLight, float red, float green, fl } // FUNCTION: LEGO1 0x100abbd0 +// FUNCTION: BETA10 0x1017cb4d void LegoView1::SetLightColor(Tgl::Light* pLight, float red, float green, float blue) { pLight->SetColor(red, green, blue); diff --git a/LEGO1/lego/sources/3dmanager/legoview1.h b/LEGO1/lego/sources/3dmanager/legoview1.h index fb1aa5bd..0c90263b 100644 --- a/LEGO1/lego/sources/3dmanager/legoview1.h +++ b/LEGO1/lego/sources/3dmanager/legoview1.h @@ -15,6 +15,7 @@ class Light; // LegoView // VTABLE: LEGO1 0x100dc000 +// VTABLE: BETA10 0x101c3578 // SIZE 0x78 class LegoView : public TglSurface { public: @@ -49,12 +50,14 @@ inline Tgl::Camera* LegoView::GetCamera() const } // SYNTHETIC: LEGO1 0x100ab580 +// SYNTHETIC: BETA10 0x1017cb80 // LegoView::`scalar deleting destructor' ///////////////////////////////////////////////////////////////////////////// // LegoView1 // VTABLE: LEGO1 0x100dc018 +// VTABLE: BETA10 0x101c3590 // SIZE 0x88 class LegoView1 : public LegoView { public: @@ -78,6 +81,7 @@ class LegoView1 : public LegoView { }; // SYNTHETIC: LEGO1 0x100ab7a0 +// SYNTHETIC: BETA10 0x1017cc00 // LegoView1::`scalar deleting destructor' #endif /* _LegoView1_h */ diff --git a/LEGO1/lego/sources/3dmanager/tglsurface.cpp b/LEGO1/lego/sources/3dmanager/tglsurface.cpp index 9664b2b2..f03206d9 100644 --- a/LEGO1/lego/sources/3dmanager/tglsurface.cpp +++ b/LEGO1/lego/sources/3dmanager/tglsurface.cpp @@ -12,6 +12,7 @@ using namespace Tgl; // TglSurface // FUNCTION: LEGO1 0x100abbf0 +// FUNCTION: BETA10 0x1017d490 TglSurface::TglSurface() { m_pRenderer = 0; @@ -33,12 +34,14 @@ TglSurface::TglSurface() } // FUNCTION: LEGO1 0x100abd60 +// FUNCTION: BETA10 0x1017d5a2 TglSurface::~TglSurface() { Destroy(); } // FUNCTION: LEGO1 0x100abde0 +// FUNCTION: BETA10 0x1017d647 void TglSurface::Destroy() { DestroyView(); @@ -52,6 +55,7 @@ void TglSurface::Destroy() // ??? // FUNCTION: LEGO1 0x100abe10 +// FUNCTION: BETA10 0x1017d6b0 int GetBitsPerPixel(IDirectDrawSurface* pSurface) { DDPIXELFORMAT pixelFormat; @@ -68,6 +72,7 @@ int GetBitsPerPixel(IDirectDrawSurface* pSurface) } // FUNCTION: LEGO1 0x100abe50 +// FUNCTION: BETA10 0x1017d742 BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer, Group* pScene) { DeviceDirect3DCreateData createData = {rCreateStruct.m_direct3d, rCreateStruct.m_d3dDevice}; @@ -97,15 +102,16 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer, textureShadeCount = 4; } else if (bitsPerPixel == 8) { + shadeCount = 32; shadeCount = 16; dither = FALSE; - textureShadeCount = 16; + textureShadeCount = shadeCount; textureColorCount = 256; } else if (bitsPerPixel == 16) { shadeCount = 32; dither = FALSE; - textureShadeCount = 32; + textureShadeCount = shadeCount; textureColorCount = 256; } else if (bitsPerPixel >= 24) { @@ -161,6 +167,7 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer, } // FUNCTION: LEGO1 0x100ac030 +// FUNCTION: BETA10 0x1017db86 void TglSurface::DestroyView() { delete m_pView; @@ -168,6 +175,7 @@ void TglSurface::DestroyView() } // FUNCTION: LEGO1 0x100ac050 +// FUNCTION: BETA10 0x1017dbd0 double TglSurface::Render() { MxStopWatch renderTimer; diff --git a/LEGO1/lego/sources/3dmanager/tglsurface.h b/LEGO1/lego/sources/3dmanager/tglsurface.h index 2b97db50..0ee9a61c 100644 --- a/LEGO1/lego/sources/3dmanager/tglsurface.h +++ b/LEGO1/lego/sources/3dmanager/tglsurface.h @@ -16,6 +16,7 @@ class Group; // TglSurface // VTABLE: LEGO1 0x100dc060 +// VTABLE: BETA10 0x101c3648 // SIZE 0x70 class TglSurface { public: @@ -43,10 +44,15 @@ class TglSurface { Tgl::Renderer* GetRenderer() const { return m_pRenderer; } Tgl::Device* GetDevice() const { return m_pDevice; } + + // FUNCTION: BETA10 0x100d5570 Tgl::View* GetView() const { return m_pView; } Tgl::Group* GetScene() const { return m_pScene; } + // FUNCTION: BETA10 0x1017cbc0 unsigned long GetWidth() const { return m_width; } + + // FUNCTION: BETA10 0x1017cbe0 unsigned long GetHeight() const { return m_height; } double GetRenderingRate() const { return m_renderingRateMeter.Frequency(); } @@ -85,6 +91,7 @@ class TglSurface { ///////////////////////////////////////////////////////////////////////////// // SYNTHETIC: LEGO1 0x100abcf0 +// SYNTHETIC: BETA10 0x1017de00 // TglSurface::`scalar deleting destructor' #endif /* _TglSurface_h */ diff --git a/LEGO1/mxdirectx/mxstopwatch.h b/LEGO1/mxdirectx/mxstopwatch.h index 5a86b283..fcd761a6 100644 --- a/LEGO1/mxdirectx/mxstopwatch.h +++ b/LEGO1/mxdirectx/mxstopwatch.h @@ -39,17 +39,20 @@ class MxStopWatch { unsigned long m_ticksPerSeconds; // 0x14 }; +// FUNCTION: BETA10 0x100d8ba0 inline MxStopWatch::MxStopWatch() { Reset(); m_ticksPerSeconds = TicksPerSeconds(); } +// FUNCTION: BETA10 0x100d8be0 inline void MxStopWatch::Start() { QueryPerformanceCounter(&m_startTick); } +// FUNCTION: BETA10 0x100d8f50 inline void MxStopWatch::Stop() { LARGE_INTEGER endTick; @@ -67,6 +70,7 @@ inline void MxStopWatch::Stop() } } +// FUNCTION: BETA10 0x100d8c10 inline void MxStopWatch::Reset() { m_startTick.LowPart = 0; @@ -74,6 +78,7 @@ inline void MxStopWatch::Reset() m_elapsedSeconds = 0; } +// FUNCTION: BETA10 0x100d8c60 inline unsigned long MxStopWatch::TicksPerSeconds() const { LARGE_INTEGER ticksPerSeconds; @@ -93,12 +98,14 @@ inline unsigned long MxStopWatch::TicksPerSeconds() const } } +// FUNCTION: BETA10 0x100d9020 inline double MxStopWatch::ElapsedSeconds() const { return m_elapsedSeconds; } // SYNTHETIC: LEGO1 0x100a6fc0 +// SYNTHETIC: BETA10 0x100d8e70 // MxStopWatch::~MxStopWatch ////////////////////////////////////////////////////////////////////////////// @@ -131,15 +138,18 @@ class MxFrequencyMeter { // MxFrequencyMeter implementation // +// FUNCTION: BETA10 0x1017dd80 inline MxFrequencyMeter::MxFrequencyMeter() : m_operationCount(0) { } +// FUNCTION: BETA10 0x1017deb0 inline void MxFrequencyMeter::StartOperation() { m_stopWatch.Start(); } +// FUNCTION: BETA10 0x1017df10 inline void MxFrequencyMeter::EndOperation() { m_stopWatch.Stop(); @@ -165,6 +175,7 @@ inline double MxFrequencyMeter::Frequency() const } } +// FUNCTION: BETA10 0x1017dee0 inline void MxFrequencyMeter::Reset() { m_stopWatch.Reset(); @@ -176,17 +187,20 @@ inline unsigned long MxFrequencyMeter::OperationCount() const return m_operationCount; } +// FUNCTION: BETA10 0x1017df40 inline void MxFrequencyMeter::IncreaseOperationCount(unsigned long delta) { m_operationCount += delta; } +// FUNCTION: BETA10 0x1017df60 inline double MxFrequencyMeter::ElapsedSeconds() const { return m_stopWatch.ElapsedSeconds(); } // SYNTHETIC: LEGO1 0x100abd10 +// SYNTHETIC: BETA10 0x1017de40 // MxFrequencyMeter::~MxFrequencyMeter #endif /* _MxStopWatch_h */ From 09394c3512f3d2272a5901cd575adcd3159d3188 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 12:57:07 -0400 Subject: [PATCH 22/89] Implement/match LegoPathController::FUN_10047b30 (#906) * Implement/match LegoPathController::FUN_10047b30 * Fix delete --- LEGO1/lego/legoomni/include/legopathstruct.h | 12 ++++++--- .../legoomni/src/paths/legopathcontroller.cpp | 27 ++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index b85d7d52..6ffdb20f 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -5,22 +5,26 @@ #include "mxatom.h" #include "mxtypes.h" +class LegoPathController; + // VTABLE: LEGO1 0x100d7d9c // SIZE 0x0c class LegoPathStructBase { public: - LegoPathStructBase() : m_unk0x04(NULL), m_unk0x08(0) {} + LegoPathStructBase() : m_name(NULL), m_unk0x08(0) {} // FUNCTION: LEGO1 0x10047420 virtual ~LegoPathStructBase() { - if (m_unk0x04 != NULL) { - delete m_unk0x04; + if (m_name != NULL) { + delete[] m_name; } } + friend class LegoPathController; + private: - undefined* m_unk0x04; // 0x04 + char* m_name; // 0x04 undefined4 m_unk0x08; // 0x08 }; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 3a2cf6ae..c6c70780 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -181,16 +181,37 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) return SUCCESS; } -// STUB: LEGO1 0x10047b30 +// FUNCTION: LEGO1 0x10047b30 // FUNCTION: BETA10 0x100b7cd6 MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage) { - // TODO + for (MxS32 i = 0; i < m_numT; i++) { + MxU8 length = 0; + + if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + return FAILURE; + } + + if (length > 0) { + m_unk0x14[i].m_name = new char[length + 1]; + + if (p_storage->Read(m_unk0x14[i].m_name, length) != SUCCESS) { + return FAILURE; + } + + m_unk0x14[i].m_name[length] = '\0'; + } + + if (p_storage->Read(&m_unk0x14[i].m_unk0x08, sizeof(m_unk0x14[i].m_unk0x08)) != SUCCESS) { + return FAILURE; + } + } + return SUCCESS; } // STUB: LEGO1 0x10047c10 -// FUNCTION: BETA10 0x1100b7df3 +// FUNCTION: BETA10 0x100b7df3 MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage) { // TODO From 1f0a2a50ce33b366fd06d69a0a1567581ea6e443 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 13:45:13 -0400 Subject: [PATCH 23/89] Implement/match LegoPathController::ReadEdge (#907) * Implement/match LegoPathController::ReadEdge * Fix * Rename * Add 100482b0 * Rename --- LEGO1/lego/legoomni/include/legopathactor.h | 2 +- .../legoomni/include/legopathcontroller.h | 8 +- .../legoomni/src/paths/legopathcontroller.cpp | 83 ++++++++++++++++--- .../lego/sources/geom/legounkown100db7f4.cpp | 2 +- LEGO1/lego/sources/geom/legounkown100db7f4.h | 10 ++- 5 files changed, 86 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 06eb4103..2051a1b8 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -9,7 +9,7 @@ struct LegoEdge; class LegoPathBoundary; class LegoPathController; -class LegoUnknown100db7f4; +struct LegoUnknown100db7f4; // VTABLE: LEGO1 0x100d6e28 // SIZE 0x154 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 7149300b..53a4ef36 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -16,7 +16,7 @@ class Vector3; // VTABLE: LEGO1 0x100d7da8 // SIZE 0x40 -class LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; +struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; struct LegoPathCtrlEdgeCompare { MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const @@ -73,10 +73,10 @@ class LegoPathController : public MxCore { private: MxResult Read(LegoStorage* p_storage); - MxResult FUN_10047b30(LegoStorage* p_storage); - MxResult FUN_10047c10(LegoStorage* p_storage); + MxResult ReadStructs(LegoStorage* p_storage); + MxResult ReadEdges(LegoStorage* p_storage); MxResult FUN_10047e90(LegoStorage* p_storage); - static MxResult FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&); + static MxResult ReadVector(LegoStorage* p_storage, Mx3DPointFloat&); LegoPathBoundary* m_unk0x08; // 0x08 LegoPathCtrlEdge* m_unk0x0c; // 0x0c diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index c6c70780..1889e391 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -154,19 +154,19 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) m_unk0x08 = new LegoPathBoundary[m_numL]; } - if (m_numT > 0 && FUN_10047b30(p_storage) != SUCCESS) { + if (m_numT > 0 && ReadStructs(p_storage) != SUCCESS) { return FAILURE; } if (m_numN > 0) { for (MxS32 i = 0; i < m_numN; i++) { - if (FUN_100482b0(p_storage, m_unk0x10[i]) != SUCCESS) { + if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) { return FAILURE; } } } - if (m_numE > 0 && FUN_10047c10(p_storage) != SUCCESS) { + if (m_numE > 0 && ReadEdges(p_storage) != SUCCESS) { return FAILURE; } @@ -183,7 +183,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) // FUNCTION: LEGO1 0x10047b30 // FUNCTION: BETA10 0x100b7cd6 -MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage) +MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) { for (MxS32 i = 0; i < m_numT; i++) { MxU8 length = 0; @@ -210,11 +210,71 @@ MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage) return SUCCESS; } -// STUB: LEGO1 0x10047c10 +// FUNCTION: LEGO1 0x10047c10 // FUNCTION: BETA10 0x100b7df3 -MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage) +MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) { - // TODO + for (MxS32 i = 0; i < m_numE; i++) { + LegoPathCtrlEdge& edge = m_unk0x0c[i]; + MxU16 s; + + if (p_storage->Read(&edge.m_flags, sizeof(edge.m_flags)) != SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_pointA = &m_unk0x10[s]; + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_pointB = &m_unk0x10[s]; + + if (edge.m_flags & LegoUnknown100db7f4::c_bit3) { + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_faceA = &m_unk0x08[s]; + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_ccwA = &m_unk0x0c[s]; + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_cwA = &m_unk0x0c[s]; + } + + if (edge.m_flags & LegoUnknown100db7f4::c_bit4) { + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_faceB = &m_unk0x08[s]; + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_ccwB = &m_unk0x0c[s]; + + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + edge.m_cwB = &m_unk0x0c[s]; + } + + if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&edge.m_unk0x3c, sizeof(edge.m_unk0x3c)) != SUCCESS) { + return FAILURE; + } + } + return SUCCESS; } @@ -226,10 +286,13 @@ MxResult LegoPathController::FUN_10047e90(LegoStorage* p_storage) return SUCCESS; } -// STUB: LEGO1 0x100482b0 +// FUNCTION: LEGO1 0x100482b0 // FUNCTION: BETA10 0x100b8864 -MxResult LegoPathController::FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&) +MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx3DPointFloat& p_vec) { - // TODO + if (p_storage->Read(p_vec.GetData(), sizeof(float) * 3) != SUCCESS) { + return FAILURE; + } + return SUCCESS; } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp index 4262da76..eab51447 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp @@ -6,7 +6,7 @@ DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40) // FUNCTION: BETA10 0x10183050 LegoUnknown100db7f4::LegoUnknown100db7f4() { - m_unk0x24 = 0; + m_flags = 0; m_unk0x28.Clear(); m_unk0x3c = 0; } diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index fa0dd995..be51e2d1 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -7,8 +7,13 @@ // VTABLE: LEGO1 0x100db7f4 // SIZE 0x40 -class LegoUnknown100db7f4 : public LegoEdge { +struct LegoUnknown100db7f4 : public LegoEdge { public: + enum { + c_bit3 = 0x04, + c_bit4 = 0x08 + }; + LegoUnknown100db7f4(); // FUNCTION: LEGO1 0x1002ddc0 @@ -30,8 +35,7 @@ class LegoUnknown100db7f4 : public LegoEdge { // SYNTHETIC: LEGO1 0x1009a6c0 // LegoUnknown100db7f4::`scalar deleting destructor' -private: - LegoU16 m_unk0x24; // 0x24 + LegoU16 m_flags; // 0x24 Mx3DPointFloat m_unk0x28; // 0x28 LegoU32 m_unk0x3c; // 0x3c }; From f88f7b115e16d003957697899221405d11720950 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 13:55:28 -0400 Subject: [PATCH 24/89] Implement/match LegoPathController::ReadBoundaries (#908) * Implement/match LegoPathController::ReadBoundaries * Allow spawn --- .../legoomni/include/legopathcontroller.h | 7 +- LEGO1/lego/legoomni/include/legopathstruct.h | 10 +- .../legoomni/src/paths/legopathcontroller.cpp | 117 +++++++++++++++++- LEGO1/lego/sources/geom/legoweedge.h | 7 ++ LEGO1/lego/sources/geom/legowegedge.cpp | 1 + LEGO1/lego/sources/geom/legowegedge.h | 25 +++- LEGO1/mxgeometry/mxgeometry3d.h | 2 + 7 files changed, 152 insertions(+), 17 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 53a4ef36..424523bb 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; -class LegoPathStruct; +struct LegoPathStruct; class LegoWorld; class MxAtomId; class Vector3; @@ -75,8 +75,9 @@ class LegoPathController : public MxCore { MxResult Read(LegoStorage* p_storage); MxResult ReadStructs(LegoStorage* p_storage); MxResult ReadEdges(LegoStorage* p_storage); - MxResult FUN_10047e90(LegoStorage* p_storage); - static MxResult ReadVector(LegoStorage* p_storage, Mx3DPointFloat&); + MxResult ReadBoundaries(LegoStorage* p_storage); + static MxResult ReadVector(LegoStorage* p_storage, Mx3DPointFloat& p_vec); + static MxResult ReadVector(LegoStorage* p_storage, Mx4DPointFloat& p_vec); LegoPathBoundary* m_unk0x08; // 0x08 LegoPathCtrlEdge* m_unk0x0c; // 0x0c diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 6ffdb20f..99053266 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -5,11 +5,9 @@ #include "mxatom.h" #include "mxtypes.h" -class LegoPathController; - // VTABLE: LEGO1 0x100d7d9c // SIZE 0x0c -class LegoPathStructBase { +struct LegoPathStructBase { public: LegoPathStructBase() : m_name(NULL), m_unk0x08(0) {} @@ -21,16 +19,13 @@ class LegoPathStructBase { } } - friend class LegoPathController; - -private: char* m_name; // 0x04 undefined4 m_unk0x08; // 0x08 }; // VTABLE: LEGO1 0x100d7da0 // SIZE 0x14 -class LegoPathStruct : public LegoPathStructBase { +struct LegoPathStruct : public LegoPathStructBase { public: // FUNCTION: LEGO1 0x100473a0 LegoPathStruct() : m_unk0x0c(0) {} @@ -40,7 +35,6 @@ class LegoPathStruct : public LegoPathStructBase { void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04 -private: undefined4 m_unk0x0c; // 0x0c MxAtomId m_atomId; // 0x10 }; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 1889e391..940c144a 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -26,6 +26,9 @@ LegoPathController::LegoPathController() void LegoPathController::Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) { // TODO + + LegoMemory storage(p_data); + Read(&storage); } // STUB: LEGO1 0x10045b20 @@ -170,7 +173,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) return FAILURE; } - if (m_numL > 0 && FUN_10047e90(p_storage) != SUCCESS) { + if (m_numL > 0 && ReadBoundaries(p_storage) != SUCCESS) { return FAILURE; } @@ -278,11 +281,106 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) return SUCCESS; } -// STUB: LEGO1 0x10047e90 +// FUNCTION: LEGO1 0x10047e90 // FUNCTION: BETA10 0x100b8293 -MxResult LegoPathController::FUN_10047e90(LegoStorage* p_storage) +MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) { - // TODO + for (MxS32 i = 0; i < m_numL; i++) { + LegoPathBoundary& boundary = m_unk0x08[i]; + MxU8 numE; + MxU16 s; + MxU8 j; + + if (p_storage->Read(&numE, sizeof(numE)) != SUCCESS) { + return FAILURE; + } + + boundary.m_edgeNormals = new Mx4DPointFloat[numE]; + + LegoEdge** edges = new LegoEdge*[numE]; + boundary.SetEdges(edges, numE); + + for (j = 0; j < numE; j++) { + if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + return FAILURE; + } + + edges[j] = &m_unk0x0c[s]; + } + + if (p_storage->Read(&boundary.m_unk0x0c, sizeof(boundary.m_unk0x0c)) != SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&boundary.m_unk0x0d, sizeof(boundary.m_unk0x0d)) != SUCCESS) { + return FAILURE; + } + + MxU8 length; + if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + return FAILURE; + } + + if (length > 0) { + boundary.m_name = new char[length + 1]; + + if (p_storage->Read(boundary.m_name, length) != SUCCESS) { + return FAILURE; + } + + boundary.m_name[length] = '\0'; + } + + if (ReadVector(p_storage, boundary.m_unk0x14) != SUCCESS) { + return FAILURE; + } + + for (j = 0; j < numE; j++) { + if (ReadVector(p_storage, boundary.m_edgeNormals[j]) != SUCCESS) { + return FAILURE; + } + } + + if (ReadVector(p_storage, boundary.m_unk0x30) != SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&boundary.m_unk0x44, sizeof(boundary.m_unk0x44)) != SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&boundary.m_unk0x48, sizeof(boundary.m_unk0x48)) != SUCCESS) { + return FAILURE; + } + + if (boundary.m_unk0x48 > 0) { + boundary.m_unk0x50 = new Mx3DPointFloat; + boundary.m_unk0x4c = new LegoWEGEdge::Path[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_unk0x14[s]; + + if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x04, sizeof(boundary.m_unk0x4c[j].m_unk0x04)) != + SUCCESS) { + return FAILURE; + } + + if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x08, sizeof(boundary.m_unk0x4c[j].m_unk0x08)) != + SUCCESS) { + return FAILURE; + } + } + + if (ReadVector(p_storage, *boundary.m_unk0x50) != SUCCESS) { + return FAILURE; + } + } + } + return SUCCESS; } @@ -296,3 +394,14 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx3DPointFloat& return SUCCESS; } + +// FUNCTION: LEGO1 0x100482e0 +// FUNCTION: BETA10 0x100b88a1 +MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat& p_vec) +{ + if (p_storage->Read(p_vec.GetData(), sizeof(float) * 4) != SUCCESS) { + return FAILURE; + } + + return SUCCESS; +} diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index c743479d..f433aa63 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -5,6 +5,7 @@ #include "legoedge.h" #include "misc/legotypes.h" +// might be a struct with public members // VTABLE: LEGO1 0x100db7c0 // SIZE 0x0c class LegoWEEdge { @@ -18,6 +19,12 @@ class LegoWEEdge { inline LegoEdge** GetEdges() { return m_edges; } inline LegoU32 IsEqual(LegoWEEdge& p_other) { return this == &p_other; } + inline void SetEdges(LegoEdge** p_edges, LegoU8 p_numEdges) + { + m_edges = p_edges; + m_numEdges = p_numEdges; + } + // SYNTHETIC: LEGO1 0x1009a570 // LegoWEEdge::`scalar deleting destructor' diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 36157313..21fee167 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -1,6 +1,7 @@ #include "legowegedge.h" DECOMP_SIZE_ASSERT(LegoWEGEdge, 0x54) +DECOMP_SIZE_ASSERT(LegoWEGEdge::Path, 0x0c) // FUNCTION: LEGO1 0x1009a730 LegoWEGEdge::LegoWEGEdge() diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 8e44fc48..018c9cf8 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -5,10 +5,29 @@ #include "legoweedge.h" #include "mxgeometry/mxgeometry3d.h" +struct LegoPathStruct; + +// might be a struct with public members // VTABLE: LEGO1 0x100db7f8 // SIZE 0x54 class LegoWEGEdge : public LegoWEEdge { public: + // SIZE 0x0c + struct Path { + // FUNCTION: LEGO1 0x10048280 + // FUNCTION: BETA10 0x100bd450 + Path() + { + m_unk0x00 = NULL; + m_unk0x04 = 0; + m_unk0x08 = 0; + } + + LegoPathStruct* m_unk0x00; // 0x00 + undefined4 m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 + }; + LegoWEGEdge(); ~LegoWEGEdge() override; @@ -22,6 +41,8 @@ class LegoWEGEdge : public LegoWEEdge { // SYNTHETIC: LEGO1 0x1009a7e0 // LegoWEGEdge::`scalar deleting destructor' + friend class LegoPathController; + private: LegoU8 m_unk0x0c; // 0x0c LegoU8 m_unk0x0d; // 0x0d @@ -31,8 +52,8 @@ class LegoWEGEdge : public LegoWEEdge { Mx3DPointFloat m_unk0x30; // 0x30 LegoU32 m_unk0x44; // 0x44 LegoU8 m_unk0x48; // 0x48 - undefined* m_unk0x4c; // 0x4c - undefined* m_unk0x50; // 0x50 + Path* m_unk0x4c; // 0x4c + Mx3DPointFloat* m_unk0x50; // 0x50 }; #endif // __LEGOWEGEDGE_H diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 5d6d3acc..2fc02932 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -46,7 +46,9 @@ class Mx3DPointFloat : public Vector3 { // SIZE 0x18 class Mx4DPointFloat : public Vector4 { public: + // FUNCTION: LEGO1 0x10048290 inline Mx4DPointFloat() : Vector4(m_elements) {} + inline Mx4DPointFloat(float p_x, float p_y, float p_z, float p_a) : Vector4(m_elements) { m_elements[0] = p_x; From 119ff93461126585da9bdc0990159c2d30dbafd0 Mon Sep 17 00:00:00 2001 From: MS Date: Sat, 11 May 2024 18:40:31 -0400 Subject: [PATCH 25/89] Parser bugfix: vtable namespace (#910) --- tools/isledecomp/isledecomp/parser/util.py | 37 +++++++++++++--------- tools/isledecomp/tests/test_parser.py | 15 +++++++++ tools/isledecomp/tests/test_parser_util.py | 1 + 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/tools/isledecomp/isledecomp/parser/util.py b/tools/isledecomp/isledecomp/parser/util.py index bfe3803c..fbc78e10 100644 --- a/tools/isledecomp/isledecomp/parser/util.py +++ b/tools/isledecomp/isledecomp/parser/util.py @@ -69,32 +69,39 @@ def is_blank_or_comment(line: str) -> bool: ) -template_class_decl_regex = re.compile( - r"\s*(?:\/\/)?\s*(?:class|struct) (\w+)<([\w]+)\s*(\*+)?\s*>" +template_regex = re.compile(r"<(?P[\w]+)\s*(?P\*+)?\s*>") + + +class_decl_regex = re.compile( + r"\s*(?:\/\/)?\s*(?:class|struct) ((?:\w+(?:<.+>)?(?:::)?)+)" ) -class_decl_regex = re.compile(r"\s*(?:\/\/)?\s*(?:class|struct) (\w+)") +def template_replace(match: re.Match) -> str: + (type_name, asterisks) = match.groups() + if asterisks is None: + return f"<{type_name}>" + + return f"<{type_name} {asterisks}>" + + +def fix_template_type(class_name: str) -> str: + """For template classes, we should reformat the class name so it matches + the output from cvdump: one space between the template type and any asterisks + if it is a pointer type.""" + if "<" not in class_name: + return class_name + + return template_regex.sub(template_replace, class_name) def get_class_name(line: str) -> Optional[str]: """For VTABLE markers, extract the class name from the code line or comment where it appears.""" - match = template_class_decl_regex.match(line) - if match is not None: - # For template classes, we should reformat the class name so it matches - # the output from cvdump: one space between the template type and any asterisks - # if it is a pointer type. - (class_name, template_type, asterisks) = match.groups() - if asterisks is not None: - return f"{class_name}<{template_type} {asterisks}>" - - return f"{class_name}<{template_type}>" - match = class_decl_regex.match(line) if match is not None: - return match.group(1) + return fix_template_type(match.group(1)) return None diff --git a/tools/isledecomp/tests/test_parser.py b/tools/isledecomp/tests/test_parser.py index e748741a..c7905627 100644 --- a/tools/isledecomp/tests/test_parser.py +++ b/tools/isledecomp/tests/test_parser.py @@ -756,3 +756,18 @@ def test_virtual_inheritance(parser): assert parser.vtables[1].base_class == "Greetings" assert parser.vtables[2].base_class == "Howdy" assert all(v.name == "HiThere" for v in parser.vtables) + + +def test_namespace_in_comment(parser): + parser.read_lines( + [ + "// VTABLE: HELLO 0x1234", + "// class Tgl::Object", + "// VTABLE: HELLO 0x5555", + "// class TglImpl::RendererImpl", + ] + ) + + assert len(parser.vtables) == 2 + assert parser.vtables[0].name == "Tgl::Object" + assert parser.vtables[1].name == "TglImpl::RendererImpl" diff --git a/tools/isledecomp/tests/test_parser_util.py b/tools/isledecomp/tests/test_parser_util.py index 9936c5bc..e60f505c 100644 --- a/tools/isledecomp/tests/test_parser_util.py +++ b/tools/isledecomp/tests/test_parser_util.py @@ -126,6 +126,7 @@ def test_marker_dict_type_replace(): ("// class MxList", "MxList"), # I don't know if this would ever come up, but sure, why not? ("// class MxList", "MxList"), + ("// class Many::Name::Spaces", "Many::Name::Spaces"), ] From dcaa07cc4983f1b29e439baaaf6c59f8a0dcefca Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 May 2024 14:33:20 -0400 Subject: [PATCH 26/89] Implement/match LegoPathController::Create and Init (#911) --- .../legoomni/include/legopathcontroller.h | 51 ++++-- LEGO1/lego/legoomni/include/legopathstruct.h | 2 + LEGO1/lego/legoomni/src/main/legomain.cpp | 2 +- .../legoomni/src/paths/legopathcontroller.cpp | 171 +++++++++++++++--- LEGO1/realtime/vector.h | 2 +- 5 files changed, 186 insertions(+), 42 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 424523bb..a5957f26 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -31,6 +31,32 @@ typedef set LegoPathCtrlEdgeSet; // SIZE 0x40 class LegoPathController : public MxCore { public: + // SIZE 0x08 + struct CtrlBoundary { + // FUNCTION: LEGO1 0x10046dc0 + CtrlBoundary() + { + m_controller = NULL; + m_boundary = NULL; + } + + LegoPathController* m_controller; // 0x00 + LegoPathBoundary* m_boundary; // 0x04 + }; + + // SIZE 0x08 + struct CtrlEdge { + // FUNCTION: LEGO1 0x10046dd0 + CtrlEdge() + { + m_controller = NULL; + m_edge = NULL; + } + + LegoPathController* m_controller; // 0x00 + LegoEdge* m_edge; // 0x04 + }; + LegoPathController(); ~LegoPathController() override { Destroy(); } @@ -52,8 +78,8 @@ class LegoPathController : public MxCore { // SYNTHETIC: LEGO1 0x10045740 // LegoPathController::`scalar deleting destructor' - virtual void Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 - virtual void Destroy(); // vtable+0x18 + virtual MxResult Create(MxU8* p_data, const Vector3& p_location, const MxAtomId& p_trigger); // vtable+0x14 + virtual void Destroy(); // vtable+0x18 MxResult FUN_10045c20( LegoPathActor* p_actor, @@ -70,6 +96,7 @@ class LegoPathController : public MxCore { LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); + static MxResult Init(); private: MxResult Read(LegoStorage* p_storage); @@ -79,16 +106,16 @@ class LegoPathController : public MxCore { static MxResult ReadVector(LegoStorage* p_storage, Mx3DPointFloat& p_vec); static MxResult ReadVector(LegoStorage* p_storage, Mx4DPointFloat& p_vec); - LegoPathBoundary* m_unk0x08; // 0x08 - LegoPathCtrlEdge* m_unk0x0c; // 0x0c - Mx3DPointFloat* m_unk0x10; // 0x10 - LegoPathStruct* m_unk0x14; // 0x14 - MxU16 m_numL; // 0x18 - MxU16 m_numE; // 0x1a - MxU16 m_numN; // 0x1c - MxU16 m_numT; // 0x1e - LegoPathCtrlEdgeSet m_pfsE; // 0x20 - LegoPathActorSet m_actors; // 0x30 + LegoPathBoundary* m_boundaries; // 0x08 + LegoPathCtrlEdge* m_edges; // 0x0c + Mx3DPointFloat* m_unk0x10; // 0x10 + LegoPathStruct* m_structs; // 0x14 + MxU16 m_numL; // 0x18 + MxU16 m_numE; // 0x1a + MxU16 m_numN; // 0x1c + MxU16 m_numT; // 0x1e + LegoPathCtrlEdgeSet m_pfsE; // 0x20 + LegoPathActorSet m_actors; // 0x30 }; // clang-format off diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 99053266..587972ba 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -35,6 +35,8 @@ struct LegoPathStruct : public LegoPathStructBase { void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04 + inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; } + undefined4 m_unk0x0c; // 0x0c MxAtomId m_atomId; // 0x10 }; diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 0dc851a6..7635ca2c 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -200,7 +200,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) m_viewLODListManager = new ViewLODListManager(); m_textureContainer = new LegoTextureContainer(); m_textureContainer->SetOwnership(FALSE); - // FUN_10046c10 + LegoPathController::Init(); m_characterManager = new LegoCharacterManager(); m_plantManager = new LegoPlantManager(); diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 940c144a..f04ddc75 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -3,32 +3,132 @@ #include "legopathstruct.h" #include "misc/legostorage.h" #include "mxmisc.h" +#include "mxticklemanager.h" #include "mxtimer.h" DECOMP_SIZE_ASSERT(LegoPathController, 0x40) DECOMP_SIZE_ASSERT(LegoPathCtrlEdge, 0x40) +DECOMP_SIZE_ASSERT(LegoPathController::CtrlBoundary, 0x08) +DECOMP_SIZE_ASSERT(LegoPathController::CtrlEdge, 0x08) + +// GLOBAL: LEGO1 0x100d7cc8 +MxU32 g_unk0x100d7cc8[] = {2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0}; + +// GLOBAL: LEGO1 0x100d7d08 +MxU32 g_unk0x100d7d08[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +// GLOBAL: LEGO1 0x100f42e8 +LegoPathController::CtrlBoundary* g_ctrlBoundariesA = NULL; + +// GLOBAL: LEGO1 0x100f42ec +LegoPathController::CtrlEdge* g_ctrlEdgesA = NULL; + +// GLOBAL: LEGO1 0x100f42f0 +const char* g_unk0x100f42f0[] = { + "edg03_21", + "edg03_23", + "edg03_30", + "edg03_31", + "edg03_39", + "edg03_40", + "edg03_91", + "edg03_92", + "edg03_99", + "edg03_100", + "edg03_112", + "edg03_113", + "edg10_61", + "edg10_62", + "edg10_55", + "edg10_58" +}; + +// GLOBAL: LEGO1 0x100f4330 +const char* g_unk0x100f4330[] = { + "edg03_06", + "edg03_21", + "edg03_30", + "edg03_148", + "edg03_39", + "edg03_91", + "edg03_99", + "edg03_112", + "edg03_800", + "edg03_135" +}; + +// GLOBAL: LEGO1 0x100f4358 +LegoPathController::CtrlBoundary* g_ctrlBoundariesB = NULL; + +// GLOBAL: LEGO1 0x100f435c +LegoPathController::CtrlEdge* g_ctrlEdgesB = NULL; // FUNCTION: LEGO1 0x10044f40 // FUNCTION: BETA10 0x100b6860 LegoPathController::LegoPathController() { - m_unk0x08 = NULL; - m_unk0x0c = NULL; + m_boundaries = NULL; + m_edges = NULL; m_unk0x10 = NULL; - m_unk0x14 = NULL; + m_structs = NULL; m_numL = 0; m_numE = 0; m_numN = 0; m_numT = 0; } -// STUB: LEGO1 0x10045880 -void LegoPathController::Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) +// FUNCTION: LEGO1 0x10045880 +// FUNCTION: BETA10 0x100b6959 +MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, const MxAtomId& p_trigger) { - // TODO - + MxResult result = FAILURE; LegoMemory storage(p_data); - Read(&storage); + + if ((result = Read(&storage)) == SUCCESS) { + MxS32 i; + + for (i = 0; i < m_numT; i++) { + m_structs[i].SetAtomId(p_trigger); + } + + for (i = 0; i < m_numN; i++) { + // TODO: Fix call + ((Vector3&) m_unk0x10[i]).Add(&p_location); + } + + for (i = 0; i < m_numL; i++) { + LegoPathBoundary& boundary = m_boundaries[i]; + MxS32 j; + + for (j = 0; j < _countof(g_unk0x100f42f0); j++) { + if (!strcmpi(g_unk0x100f42f0[j], boundary.GetName())) { + g_ctrlBoundariesA[j].m_controller = this; + g_ctrlBoundariesA[j].m_boundary = &boundary; + + MxU32 edge = g_unk0x100d7cc8[j]; + g_ctrlEdgesA[j].m_controller = this; + g_ctrlEdgesA[j].m_edge = boundary.GetEdges()[edge]; + } + } + + for (j = 0; j < _countof(g_unk0x100f4330); j++) { + if (!strcmpi(g_unk0x100f4330[j], boundary.GetName())) { + g_ctrlBoundariesB[j].m_controller = this; + g_ctrlBoundariesB[j].m_boundary = &boundary; + g_ctrlEdgesB[j].m_controller = this; + g_ctrlEdgesB[j].m_edge = boundary.GetEdges()[g_unk0x100d7d08[j]]; + } + } + } + + TickleManager()->RegisterClient(this, 10); + } + + if (result != SUCCESS) { + Destroy(); + } + + return result; } // STUB: LEGO1 0x10045b20 @@ -105,8 +205,8 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_va LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name) { for (MxS32 i = 0; i < m_numL; i++) { - if (!strcmpi(m_unk0x08[i].GetName(), p_name)) { - return &m_unk0x08[i]; + if (!strcmpi(m_boundaries[i].GetName(), p_name)) { + return &m_boundaries[i]; } } @@ -125,6 +225,21 @@ void LegoPathController::Enable(MxBool p_enable) // TODO } +// FUNCTION: LEGO1 0x10046c10 +// FUNCTION: BETA10 0x100b767a +MxResult LegoPathController::Init() +{ + if (g_ctrlBoundariesA != NULL || g_ctrlEdgesA != NULL || g_ctrlBoundariesB != NULL || g_ctrlEdgesB != NULL) { + return FAILURE; + } + + g_ctrlBoundariesA = new CtrlBoundary[_countof(g_unk0x100f42f0)]; + g_ctrlEdgesA = new CtrlEdge[_countof(g_unk0x100f42f0)]; + g_ctrlBoundariesB = new CtrlBoundary[_countof(g_unk0x100f4330)]; + g_ctrlEdgesB = new CtrlEdge[_countof(g_unk0x100f4330)]; + return SUCCESS; +} + // FUNCTION: LEGO1 0x10046e50 // FUNCTION: BETA10 0x100b781f MxResult LegoPathController::Read(LegoStorage* p_storage) @@ -133,7 +248,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) return FAILURE; } if (m_numT > 0) { - m_unk0x14 = new LegoPathStruct[m_numT]; + m_structs = new LegoPathStruct[m_numT]; } if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) { @@ -147,14 +262,14 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) return FAILURE; } if (m_numE > 0) { - m_unk0x0c = new LegoPathCtrlEdge[m_numE]; + m_edges = new LegoPathCtrlEdge[m_numE]; } if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) { return FAILURE; } if (m_numL > 0) { - m_unk0x08 = new LegoPathBoundary[m_numL]; + m_boundaries = new LegoPathBoundary[m_numL]; } if (m_numT > 0 && ReadStructs(p_storage) != SUCCESS) { @@ -178,7 +293,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) } for (MxS32 j = 0; j < m_numE; j++) { - m_pfsE.insert(&m_unk0x0c[j]); + m_pfsE.insert(&m_edges[j]); } return SUCCESS; @@ -196,16 +311,16 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) } if (length > 0) { - m_unk0x14[i].m_name = new char[length + 1]; + m_structs[i].m_name = new char[length + 1]; - if (p_storage->Read(m_unk0x14[i].m_name, length) != SUCCESS) { + if (p_storage->Read(m_structs[i].m_name, length) != SUCCESS) { return FAILURE; } - m_unk0x14[i].m_name[length] = '\0'; + m_structs[i].m_name[length] = '\0'; } - if (p_storage->Read(&m_unk0x14[i].m_unk0x08, sizeof(m_unk0x14[i].m_unk0x08)) != SUCCESS) { + if (p_storage->Read(&m_structs[i].m_unk0x08, sizeof(m_structs[i].m_unk0x08)) != SUCCESS) { return FAILURE; } } @@ -218,7 +333,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) { for (MxS32 i = 0; i < m_numE; i++) { - LegoPathCtrlEdge& edge = m_unk0x0c[i]; + LegoPathCtrlEdge& edge = m_edges[i]; MxU16 s; if (p_storage->Read(&edge.m_flags, sizeof(edge.m_flags)) != SUCCESS) { @@ -239,34 +354,34 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_faceA = &m_unk0x08[s]; + edge.m_faceA = &m_boundaries[s]; if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_ccwA = &m_unk0x0c[s]; + edge.m_ccwA = &m_edges[s]; if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_cwA = &m_unk0x0c[s]; + edge.m_cwA = &m_edges[s]; } if (edge.m_flags & LegoUnknown100db7f4::c_bit4) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_faceB = &m_unk0x08[s]; + edge.m_faceB = &m_boundaries[s]; if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_ccwB = &m_unk0x0c[s]; + edge.m_ccwB = &m_edges[s]; if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { return FAILURE; } - edge.m_cwB = &m_unk0x0c[s]; + edge.m_cwB = &m_edges[s]; } if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) { @@ -286,7 +401,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) { for (MxS32 i = 0; i < m_numL; i++) { - LegoPathBoundary& boundary = m_unk0x08[i]; + LegoPathBoundary& boundary = m_boundaries[i]; MxU8 numE; MxU16 s; MxU8 j; @@ -305,7 +420,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } - edges[j] = &m_unk0x0c[s]; + edges[j] = &m_edges[s]; } if (p_storage->Read(&boundary.m_unk0x0c, sizeof(boundary.m_unk0x0c)) != SUCCESS) { @@ -362,7 +477,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } - boundary.m_unk0x4c[j].m_unk0x00 = &m_unk0x14[s]; + boundary.m_unk0x4c[j].m_unk0x00 = &m_structs[s]; if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x04, sizeof(boundary.m_unk0x4c[j].m_unk0x04)) != SUCCESS) { diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 7d7a06e4..198ed14b 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -120,7 +120,7 @@ class Vector2 { virtual void Add(float* p_other) { AddImpl(p_other); } // vtable+0x4c // FUNCTION: LEGO1 0x100021e0 - virtual void Add(Vector2* p_other) { AddImpl(p_other->m_data); } // vtable+0x48 + virtual void Add(const Vector2* p_other) { AddImpl((float*) p_other->m_data); } // vtable+0x48 // FUNCTION: LEGO1 0x100021f0 virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58 From 32a3373360116fd4f2ca4051ab36a5f17665261e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 May 2024 14:48:50 -0400 Subject: [PATCH 27/89] Implement/match LegoPathController::Destroy (#912) --- .../legoomni/src/paths/legopathcontroller.cpp | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index f04ddc75..eea3b19b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -131,10 +131,60 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con return result; } -// STUB: LEGO1 0x10045b20 +// FUNCTION: LEGO1 0x10045b20 +// FUNCTION: BETA10 0x100b6b8a void LegoPathController::Destroy() { - // TODO + TickleManager()->UnregisterClient(this); + + if (m_boundaries != NULL) { + delete[] m_boundaries; + } + m_boundaries = NULL; + m_numL = 0; + + if (m_unk0x10 != NULL) { + delete[] m_unk0x10; + } + m_unk0x10 = NULL; + m_numN = 0; + + if (m_structs != NULL) { + delete[] m_structs; + } + m_structs = NULL; + m_numT = 0; + + if (m_edges != NULL) { + delete[] m_edges; + } + m_edges = NULL; + m_numE = 0; + + MxS32 j; + for (j = 0; j < _countof(g_unk0x100f42f0); j++) { + if (g_ctrlBoundariesA[j].m_controller == this) { + g_ctrlBoundariesA[j].m_controller = NULL; + g_ctrlBoundariesA[j].m_boundary = NULL; + } + + if (g_ctrlEdgesA[j].m_controller == this) { + g_ctrlEdgesA[j].m_controller = NULL; + g_ctrlEdgesA[j].m_edge = NULL; + } + } + + for (j = 0; j < _countof(g_unk0x100f4330); j++) { + if (g_ctrlBoundariesB[j].m_controller == this) { + g_ctrlBoundariesB[j].m_controller = NULL; + g_ctrlBoundariesB[j].m_boundary = NULL; + } + + if (g_ctrlEdgesB[j].m_controller == this) { + g_ctrlEdgesB[j].m_controller = NULL; + g_ctrlEdgesB[j].m_edge = NULL; + } + } } // STUB: LEGO1 0x10045c10 From b6fc8e27b17e3d4891d3ce547f9faf987572f985 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 May 2024 15:10:26 -0400 Subject: [PATCH 28/89] Implement/match LegoPathController::Tickle (#913) --- LEGO1/lego/legoomni/include/legopathactor.h | 4 ++++ .../legoomni/include/legopathcontroller.h | 4 ++++ .../legoomni/src/paths/legopathcontroller.cpp | 24 +++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 2051a1b8..43b6c480 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -15,6 +15,10 @@ struct LegoUnknown100db7f4; // SIZE 0x154 class LegoPathActor : public LegoActor { public: + enum { + c_bit3 = 0x04 + }; + LegoPathActor(); ~LegoPathActor() override; diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index a5957f26..74957fb7 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -99,6 +99,7 @@ class LegoPathController : public MxCore { static MxResult Init(); private: + void FUN_10046970(); MxResult Read(LegoStorage* p_storage); MxResult ReadStructs(LegoStorage* p_storage); MxResult ReadEdges(LegoStorage* p_storage); @@ -119,6 +120,9 @@ class LegoPathController : public MxCore { }; // clang-format off +// TEMPLATE: LEGO1 0x1002c4a0 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Buynode + // TEMPLATE: LEGO1 0x100451a0 // _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::~_TreeGetTime(); + + LegoPathActorSet lpas(m_actors); + + for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) { + LegoPathActor* actor = *itpa; + + if (m_actors.find(actor) != m_actors.end()) { + if (!((MxU8) actor->GetState() & LegoPathActor::c_bit3)) { + actor->VTable0x70(time); + } + } + } +} + // STUB: LEGO1 0x10046b30 MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value) { From 91fe09af3c43decba70798f7c7b0652c5adb2ad7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 May 2024 15:30:34 -0400 Subject: [PATCH 29/89] Implement various small LegoPathController functions (#914) * Implement/match LegoPathController::Tickle * Implement various small LegoPathController functions * Add 0x10046b30 --- .../lego/legoomni/include/legopathboundary.h | 2 + .../legoomni/include/legopathcontroller.h | 2 +- LEGO1/lego/legoomni/include/legopathstruct.h | 9 +++-- LEGO1/lego/legoomni/include/legoworld.h | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 4 +- .../legoomni/src/paths/legopathboundary.cpp | 16 ++++++++ .../legoomni/src/paths/legopathcontroller.cpp | 37 ++++++++++++++----- LEGO1/lego/sources/geom/legowegedge.cpp | 2 +- LEGO1/lego/sources/geom/legowegedge.h | 9 ++++- 9 files changed, 64 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 6eae5ae6..9adf1474 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -31,6 +31,8 @@ class LegoPathBoundary : public LegoWEGEdge { MxResult AddActor(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 FUN_10057fe0(LegoAnimPresenter* p_presenter); + MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); inline LegoPathActorSet* GetActors() { return &m_actors; } inline LegoAnimPresenterSet* GetPresenters() { return &m_presenters; } diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 74957fb7..43c4a419 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -92,7 +92,7 @@ class LegoPathController : public MxCore { undefined4 FUN_10046770(LegoPathActor* p_actor); void FUN_100468f0(LegoAnimPresenter* p_presenter); void FUN_10046930(LegoAnimPresenter* p_presenter); - MxResult FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value); + MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL); LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 587972ba..fd752050 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -5,6 +5,8 @@ #include "mxatom.h" #include "mxtypes.h" +class LegoWorld; + // VTABLE: LEGO1 0x100d7d9c // SIZE 0x0c struct LegoPathStructBase { @@ -28,17 +30,18 @@ struct LegoPathStructBase { struct LegoPathStruct : public LegoPathStructBase { public: // FUNCTION: LEGO1 0x100473a0 - LegoPathStruct() : m_unk0x0c(0) {} + LegoPathStruct() : m_world(NULL) {} // FUNCTION: LEGO1 0x10047470 ~LegoPathStruct() override {} void VTable0x04(undefined4, 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; } - undefined4 m_unk0x0c; // 0x0c - MxAtomId m_atomId; // 0x10 + LegoWorld* m_world; // 0x0c + MxAtomId m_atomId; // 0x10 }; // SYNTHETIC: LEGO1 0x10047440 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index d2179266..c0121f2b 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -85,7 +85,7 @@ class LegoWorld : public LegoEntity { void FUN_1001fe90(LegoAnimPresenter* p_presenter); LegoPathBoundary* FindPathBoundary(const char* p_name); void AddPath(LegoPathController* p_controller); - MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); + MxResult GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL); MxCore* Find(const char* p_class, const char* p_name); MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index d776b0e1..e4974ba7 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -376,7 +376,7 @@ LegoPathBoundary* LegoWorld::FindPathBoundary(const char* p_name) } // FUNCTION: LEGO1 0x10020120 -MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) +MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL) { LegoPathControllerListCursor cursor(&m_list0x68); LegoPathController* controller; @@ -387,7 +387,7 @@ MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) return FAILURE; } - return controller->FUN_10046b30(p_path, p_value); + return controller->FUN_10046b30(*p_boundaries, p_numL); } // FUNCTION: LEGO1 0x10020220 diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index dc1dc21d..f8242c19 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -41,3 +41,19 @@ MxU32 LegoPathBoundary::Intersect( { return 0; } + +// STUB: LEGO1 0x10057fe0 +// FUNCTION: BETA10 0x100b2220 +MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x100586e0 +// FUNCTION: BETA10 0x100b22d1 +MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter) +{ + // TODO + return 0; +} diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 48ac9249..decfa9f6 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -233,16 +233,24 @@ undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor) return 0; } -// STUB: LEGO1 0x100468f0 +// FUNCTION: LEGO1 0x100468f0 // FUNCTION: BETA10 0x100b72f7 void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter) { + for (MxS32 i = 0; i < m_numL; i++) { + if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) { + m_boundaries[i].FUN_10057fe0(p_presenter); + } + } } -// STUB: LEGO1 0x10046930 +// FUNCTION: LEGO1 0x10046930 // FUNCTION: BETA10 0x100b737b void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter) { + for (MxS32 i = 0; i < m_numL; i++) { + m_boundaries[i].FUN_100586e0(p_presenter); + } } // FUNCTION: LEGO1 0x10046970 @@ -264,9 +272,11 @@ void LegoPathController::FUN_10046970() } } -// STUB: LEGO1 0x10046b30 -MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value) +// FUNCTION: LEGO1 0x10046b30 +MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL) { + p_boundaries = m_boundaries; + p_numL = m_numL; return SUCCESS; } @@ -283,16 +293,25 @@ LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name) return NULL; } -// STUB: LEGO1 0x10046bb0 +// FUNCTION: LEGO1 0x10046bb0 +// FUNCTION: BETA10 0x100b75bc void LegoPathController::FUN_10046bb0(LegoWorld* p_world) { - // TODO + for (MxS32 i = 0; i < m_numT; i++) { + m_structs[i].SetWorld(p_world); + } } -// STUB: LEGO1 0x10046be0 +// FUNCTION: LEGO1 0x10046be0 +// FUNCTION: BETA10 0x100b7614 void LegoPathController::Enable(MxBool p_enable) { - // TODO + if (p_enable) { + TickleManager()->RegisterClient(this, 10); + } + else { + TickleManager()->UnregisterClient(this); + } } // FUNCTION: LEGO1 0x10046c10 @@ -493,7 +512,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) edges[j] = &m_edges[s]; } - if (p_storage->Read(&boundary.m_unk0x0c, sizeof(boundary.m_unk0x0c)) != SUCCESS) { + if (p_storage->Read(&boundary.m_flags, sizeof(boundary.m_flags)) != SUCCESS) { return FAILURE; } diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 21fee167..1eb88448 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -10,7 +10,7 @@ LegoWEGEdge::LegoWEGEdge() m_name = NULL; m_unk0x14.Clear(); m_edgeNormals = NULL; - m_unk0x0c = 0; + m_flags = 0; m_unk0x48 = 0; m_unk0x4c = NULL; m_unk0x50 = NULL; diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 018c9cf8..e34dfcdf 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -12,6 +12,11 @@ struct LegoPathStruct; // SIZE 0x54 class LegoWEGEdge : public LegoWEEdge { public: + enum { + c_bit3 = 0x04, + c_bit5 = 0x10 + }; + // SIZE 0x0c struct Path { // FUNCTION: LEGO1 0x10048280 @@ -33,7 +38,7 @@ class LegoWEGEdge : public LegoWEEdge { LegoResult VTable0x04() override; // vtable+0x04 - inline LegoU32 GetFlag0x10() { return m_unk0x0c & 0x10 ? FALSE : TRUE; } + inline LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; } inline Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; } inline Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; } inline LegoChar* GetName() { return m_name; } @@ -44,7 +49,7 @@ class LegoWEGEdge : public LegoWEEdge { friend class LegoPathController; private: - LegoU8 m_unk0x0c; // 0x0c + LegoU8 m_flags; // 0x0c LegoU8 m_unk0x0d; // 0x0d LegoChar* m_name; // 0x10 Mx4DPointFloat m_unk0x14; // 0x14 From 5f34d2e877a5c0544d866ab5f853cc9f6bc9729d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 13 May 2024 06:46:59 -0400 Subject: [PATCH 30/89] Implement/match LegoPathController::AddActor and RemoveActor (#915) * Implement/match LegoPathController::AddActor and RemoveActor * Fix types --- .../lego/legoomni/include/legopathboundary.h | 5 +- .../legoomni/include/legopathcontroller.h | 15 ++++- LEGO1/lego/legoomni/include/legoworld.h | 8 +-- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 4 +- .../legoomni/src/actors/islepathactor.cpp | 6 +- .../src/common/legoanimationmanager.cpp | 12 ++-- .../src/common/legoanimmmpresenter.cpp | 4 +- .../legoomni/src/common/legogamestate.cpp | 8 +-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 64 ++++++++++++------- .../legoomni/src/paths/legoextraactor.cpp | 8 +-- .../lego/legoomni/src/paths/legopathactor.cpp | 10 +-- .../legoomni/src/paths/legopathboundary.cpp | 8 +++ .../legoomni/src/paths/legopathcontroller.cpp | 48 ++++++++++++-- LEGO1/lego/legoomni/src/worlds/isle.cpp | 14 ++-- 14 files changed, 145 insertions(+), 69 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 9adf1474..7ce0e200 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -29,13 +29,14 @@ class LegoPathBoundary : public LegoWEGEdge { ~LegoPathBoundary() override; 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 FUN_10057fe0(LegoAnimPresenter* p_presenter); MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); - inline LegoPathActorSet* GetActors() { return &m_actors; } - inline LegoAnimPresenterSet* GetPresenters() { return &m_presenters; } + inline LegoPathActorSet& GetActors() { return m_actors; } + inline LegoAnimPresenterSet& GetPresenters() { return m_presenters; } // SYNTHETIC: LEGO1 0x10047a80 // LegoPathBoundary::`vector deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 43c4a419..23e6c740 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -89,7 +89,14 @@ class LegoPathController : public MxCore { MxS32 p_dest, float p_destScale ); - undefined4 FUN_10046770(LegoPathActor* p_actor); + MxResult FUN_10046050( + LegoPathActor* p_actor, + LegoAnimPresenter* p_presenter, + Vector3& p_position, + Vector3& p_direction + ); + MxResult AddActor(LegoPathActor* p_actor); + MxResult RemoveActor(LegoPathActor* p_actor); void FUN_100468f0(LegoAnimPresenter* p_presenter); void FUN_10046930(LegoAnimPresenter* p_presenter); MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL); @@ -120,6 +127,9 @@ class LegoPathController : public MxCore { }; // clang-format off +// TEMPLATE: LEGO1 0x1001fd70 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Lbound + // TEMPLATE: LEGO1 0x1002c4a0 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Buynode @@ -132,6 +142,9 @@ class LegoPathController : public MxCore { // TEMPLATE: LEGO1 0x10045830 // set >::~set > +// TEMPLATE: LEGO1 0x100468c0 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Ubound + // TEMPLATE: LEGO1 0x10047550 // _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Insert diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index c0121f2b..cde4f4b1 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -73,14 +73,14 @@ class LegoWorld : public LegoEntity { MxS32 p_dest, float p_destScale ); - undefined4 FUN_1001fa70(IslePathActor* p_actor); - undefined4 FUN_1001fb70( - IslePathActor* p_actor, + MxResult AddPathActor(LegoPathActor* p_actor); + MxResult FUN_1001fb70( + LegoPathActor* p_actor, LegoAnimPresenter* p_presenter, Vector3& p_position, Vector3& p_direction ); - void FUN_1001fc80(IslePathActor* p_actor); + void RemovePathActor(LegoPathActor* p_actor); void FUN_1001fda0(LegoAnimPresenter* p_presenter); void FUN_1001fe90(LegoAnimPresenter* p_presenter); LegoPathBoundary* FindPathBoundary(const char* p_name); diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 0dd71005..ee3b6177 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -190,7 +190,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) if (m_state->GetUnkown8() == 0) { state->SetUnknown18(4); m_state->SetUnknown8(1); - m_world->FUN_1001fc80(this); + m_world->RemovePathActor(this); InvokeAction(Extra::ActionType::e_start, script, 0x20, NULL); SetState(0); } @@ -203,7 +203,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) } if (m_state->GetUnkown8() == 2) { m_state->SetUnknown8(3); - m_world->FUN_1001fc80(this); + m_world->RemovePathActor(this); InvokeAction(Extra::ActionType::e_start, script, 0x21, NULL); SetState(4); } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 61b203e9..02411891 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -471,7 +471,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p assert(world); if (m_world != NULL) { - m_world->FUN_1001fc80(this); + m_world->RemovePathActor(this); m_world->Remove(this); VideoManager()->Get3DManager()->Remove(*m_roi); } @@ -556,7 +556,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset) { if (m_world) { - m_world->FUN_1001fc80(this); + m_world->RemovePathActor(this); m_world->Remove(this); VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); } @@ -566,7 +566,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar VTable0xe0(); } - m_world->FUN_1001fa70(this); + m_world->AddPathActor(this); p_boundary->AddActor(this); if (m_actorId != GameState()->GetActorId()) { m_world->Add(this); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 3f4947a2..912e9d3d 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -151,7 +151,7 @@ LegoAnimationManager::~LegoAnimationManager() LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) { - CurrentWorld()->FUN_1001fc80((IslePathActor*) actor); + CurrentWorld()->RemovePathActor(actor); actor->SetController(NULL); } @@ -237,7 +237,7 @@ void LegoAnimationManager::Suspend() LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { - actor->GetController()->FUN_10046770(actor); + actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } @@ -862,7 +862,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt LegoPathController* controller = actor->GetController(); if (controller) { - controller->FUN_10046770(actor); + controller->RemoveActor(actor); actor->SetController(NULL); for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { @@ -1191,7 +1191,7 @@ MxResult LegoAnimationManager::Tickle() LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { - actor->GetController()->FUN_10046770(actor); + actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } @@ -1451,7 +1451,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) LegoPathController* controller = actor->GetController(); if (controller) { - controller->FUN_10046770(actor); + controller->RemoveActor(actor); actor->SetController(NULL); for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { @@ -1560,7 +1560,7 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL) { - actor->GetController()->FUN_10046770(actor); + actor->GetController()->RemoveActor(actor); actor->SetController(NULL); } diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 206c145f..0a3e882b 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -432,7 +432,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) undefined4 und = 1; if (m_presenter != NULL) { - m_unk0x64->FUN_1001fc80(actor); + m_unk0x64->RemovePathActor(actor); if (m_tranInfo->m_unk0x29) { Mx3DPointFloat position, direction; @@ -451,7 +451,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) if (und != 0) { viewROI->WrappedSetLocalTransform(m_tranInfo->m_unk0x2c); VideoManager()->Get3DManager()->Moved(*viewROI); - m_unk0x64->FUN_1001fa70(actor); + m_unk0x64->AddPathActor(actor); } if (m_tranInfo->m_unk0x29) { diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index a8cc6d9c..c07a1871 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1100,28 +1100,28 @@ void LegoGameState::Init() Helicopter* copter = (Helicopter*) isle->Find(*g_copterScript, CopterScript::c_Helicopter_Actor); if (copter) { - isle->FUN_1001fc80(copter); + isle->RemovePathActor(copter); isle->VTable0x6c(copter); delete copter; } DuneBuggy* dunebuggy = (DuneBuggy*) isle->Find(*g_dunecarScript, DunecarScript::c_DuneBugy_Actor); if (dunebuggy) { - isle->FUN_1001fc80(dunebuggy); + isle->RemovePathActor(dunebuggy); isle->VTable0x6c(dunebuggy); delete dunebuggy; } Jetski* jetski = (Jetski*) isle->Find(*g_jetskiScript, JetskiScript::c_Jetski_Actor); if (jetski) { - isle->FUN_1001fc80(jetski); + isle->RemovePathActor(jetski); isle->VTable0x6c(jetski); delete jetski; } RaceCar* racecar = (RaceCar*) isle->Find(*g_racecarScript, RacecarScript::c_RaceCar_Actor); if (racecar) { - isle->FUN_1001fc80(racecar); + isle->RemovePathActor(racecar); isle->VTable0x6c(racecar); delete racecar; } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index e4974ba7..0455f1a7 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -295,33 +295,49 @@ MxResult LegoWorld::PlaceActor( return FAILURE; } -// STUB: LEGO1 0x1001fa70 -undefined4 LegoWorld::FUN_1001fa70(IslePathActor* p_actor) -{ - // TODO - return 0; -} - -// STUB: LEGO1 0x1001fb70 -undefined4 LegoWorld::FUN_1001fb70( - IslePathActor* p_actor, - LegoAnimPresenter* p_presenter, - Vector3& p_position, - Vector3& p_direction -) -{ - // TODO - return 0; -} - -// FUNCTION: LEGO1 0x1001fc80 -void LegoWorld::FUN_1001fc80(IslePathActor* p_actor) +// FUNCTION: LEGO1 0x1001fa70 +MxResult LegoWorld::AddPathActor(LegoPathActor* p_actor) { LegoPathControllerListCursor cursor(&m_list0x68); LegoPathController* controller; while (cursor.Next(controller)) { - if (!controller->FUN_10046770(p_actor)) { + if (controller->AddActor(p_actor) == SUCCESS) { + return SUCCESS; + } + } + + return FAILURE; +} + +// FUNCTION: LEGO1 0x1001fb70 +MxResult LegoWorld::FUN_1001fb70( + LegoPathActor* p_actor, + LegoAnimPresenter* p_presenter, + Vector3& p_position, + Vector3& p_direction +) +{ + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + if (controller->FUN_10046050(p_actor, p_presenter, p_position, p_direction) == SUCCESS) { + return SUCCESS; + } + } + + return FAILURE; +} + +// FUNCTION: LEGO1 0x1001fc80 +void LegoWorld::RemovePathActor(LegoPathActor* p_actor) +{ + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + if (controller->RemoveActor(p_actor) == SUCCESS) { break; } } @@ -487,7 +503,7 @@ void LegoWorld::Remove(MxCore* p_object) } else if (p_object->IsA("MxEntity")) { if (p_object->IsA("LegoPathActor")) { - FUN_1001fc80((IslePathActor*) p_object); + RemovePathActor((LegoPathActor*) p_object); } if (m_entityList) { @@ -688,7 +704,7 @@ void LegoWorld::Enable(MxBool p_enable) IslePathActor* actor = CurrentActor(); if (actor) { - FUN_1001fc80(actor); + RemovePathActor(actor); } AnimationManager()->Reset(FALSE); diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 1f68645e..a88ca7b3 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -287,9 +287,9 @@ MxResult LegoExtraActor::WaitForAnimation() if (m_boundary != oldBoundary) { MxU32 b = FALSE; - LegoAnimPresenterSet* set = m_boundary->GetPresenters(); + LegoAnimPresenterSet& set = m_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) { + for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) { MxU32 roiMapSize; if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; @@ -312,9 +312,9 @@ void LegoExtraActor::Restart() { if (m_unk0x0e != 0) { MxU32 b = FALSE; - LegoAnimPresenterSet* set = m_boundary->GetPresenters(); + LegoAnimPresenterSet& set = m_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) { + for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) { MxU32 roiMapSize; if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 6d393746..a893ba53 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -431,19 +431,19 @@ MxU32 LegoPathActor::VTable0x6c( Vector3& p_v3 ) { - LegoAnimPresenterSet* laps = p_boundary->GetPresenters(); + LegoAnimPresenterSet& laps = p_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator itap = laps->begin(); itap != laps->end(); itap++) { + for (LegoAnimPresenterSet::iterator itap = laps.begin(); itap != laps.end(); itap++) { if ((*itap)->VTable0x94(p_v1, p_v2, p_f1, p_f2, p_v3)) { return 1; } } - LegoPathActorSet* plpas = p_boundary->GetActors(); - LegoPathActorSet lpas(*plpas); + LegoPathActorSet& plpas = p_boundary->GetActors(); + LegoPathActorSet lpas(plpas); for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) { - if (plpas->find(*itpa) != plpas->end()) { + if (plpas.find(*itpa) != plpas.end()) { LegoPathActor* actor = *itpa; if (this != actor && !(actor->GetState() & 0x100)) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index f8242c19..25df258f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -25,6 +25,14 @@ MxResult LegoPathBoundary::AddActor(LegoPathActor* p_actor) return SUCCESS; } +// FUNCTION: LEGO1 0x100574a0 +// FUNCTION: BETA10 0x100b156f +MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor) +{ + m_actors.erase(p_actor); + return SUCCESS; +} + // STUB: LEGO1 0x100575b0 void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index decfa9f6..5e5d5451 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -207,7 +207,7 @@ MxResult LegoPathController::FUN_10045c20( ) { if (p_actor->GetController() != NULL) { - p_actor->GetController()->FUN_10046770(p_actor); + p_actor->GetController()->RemoveActor(p_actor); p_actor->SetController(NULL); } @@ -226,11 +226,49 @@ MxResult LegoPathController::FUN_10045c20( return SUCCESS; } -// STUB: LEGO1 0x10046770 -// FUNCTION: BETA10 0x100b7264 -undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor) +// STUB: LEGO1 0x10046050 +// FUNCTION: BETA10 0x100b6f35 +MxResult LegoPathController::FUN_10046050( + LegoPathActor* p_actor, + LegoAnimPresenter* p_presenter, + Vector3& p_position, + Vector3& p_direction +) { - return 0; + // TODO + return SUCCESS; +} + +// FUNCTION: LEGO1 0x100466a0 +// FUNCTION: BETA10 0x100b71fe +MxResult LegoPathController::AddActor(LegoPathActor* p_actor) +{ + if (p_actor->GetController() != NULL) { + p_actor->GetController()->RemoveActor(p_actor); + p_actor->SetController(NULL); + } + + m_actors.insert(p_actor); + p_actor->SetController(this); + return SUCCESS; +} + +// FUNCTION: LEGO1 0x10046770 +// FUNCTION: BETA10 0x100b7264 +MxResult LegoPathController::RemoveActor(LegoPathActor* p_actor) +{ + MxResult result = FAILURE; + + p_actor->VTable0xc4(); + m_actors.erase(p_actor); + + for (MxS32 i = 0; i < m_numL; i++) { + if (m_boundaries[i].RemoveActor(p_actor) == SUCCESS) { + result = SUCCESS; + } + } + + return result; } // FUNCTION: LEGO1 0x100468f0 diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 89a7a8ee..df5b09f3 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -526,7 +526,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 5; } - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -549,7 +549,7 @@ void Isle::Enable(MxBool p_enable) SetIsWorldActive(FALSE); break; case LegoGameState::e_bike: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -562,7 +562,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_dunecar: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -575,7 +575,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_motocycle: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -588,7 +588,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_copter: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -601,7 +601,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_skateboard: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -614,7 +614,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_jetski: - FUN_1001fa70(CurrentActor()); + AddPathActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE From ccf33575db364bc472cdea20ee2820a0e6cdb06b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 13 May 2024 08:39:43 -0400 Subject: [PATCH 31/89] Implement/match LegoPathController::FUN_10046050 (#916) --- .../lego/legoomni/include/legopathboundary.h | 17 ++++- .../legoomni/include/legopathcontroller.h | 3 + .../legoomni/src/paths/legopathcontroller.cpp | 67 ++++++++++++++++++- LEGO1/lego/sources/geom/legounkown100db7f4.h | 4 ++ LEGO1/mxgeometry/mxgeometry3d.h | 2 + 5 files changed, 89 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 7ce0e200..7d300feb 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -15,7 +15,10 @@ struct LegoPathActorSetCompare { }; struct LegoAnimPresenterSetCompare { - MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const { return 0; } + MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const + { + return (MxS32) p_lhs < (MxS32) p_rhs; + } }; typedef set LegoPathActorSet; @@ -83,6 +86,18 @@ class LegoPathBoundary : public LegoWEGEdge { // TEMPLATE: LEGO1 0x10045dd0 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Insert +// TEMPLATE: LEGO1 0x10046310 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::insert + +// TEMPLATE: LEGO1 0x10046580 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Lrotate + +// TEMPLATE: LEGO1 0x100465e0 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Rrotate + +// TEMPLATE: LEGO1 0x1004a7a0 +// _Construct + // GLOBAL: LEGO1 0x100f11a4 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Nil diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 23e6c740..aeb8c03c 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -142,6 +142,9 @@ class LegoPathController : public MxCore { // TEMPLATE: LEGO1 0x10045830 // set >::~set > +// TEMPLATE: LEGO1 0x10046640 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::find + // TEMPLATE: LEGO1 0x100468c0 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Ubound diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 5e5d5451..bc692002 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -226,7 +226,7 @@ MxResult LegoPathController::FUN_10045c20( return SUCCESS; } -// STUB: LEGO1 0x10046050 +// FUNCTION: LEGO1 0x10046050 // FUNCTION: BETA10 0x100b6f35 MxResult LegoPathController::FUN_10046050( LegoPathActor* p_actor, @@ -235,8 +235,69 @@ MxResult LegoPathController::FUN_10046050( Vector3& p_direction ) { - // TODO - return SUCCESS; + LegoPathBoundary* boundary = NULL; + float time = Timer()->GetTime(); + + if (p_actor->GetController() != NULL) { + p_actor->GetController()->RemoveActor(p_actor); + p_actor->SetController(NULL); + } + + for (MxS32 i = 0; i < m_numL; i++) { + LegoPathBoundary& b = m_boundaries[i]; + LegoAnimPresenterSet& presenters = b.GetPresenters(); + LegoAnimPresenter* presenter = p_presenter; + + if (presenters.find(presenter) != presenters.end()) { + MxS32 j; + + for (j = 0; j < b.GetNumEdges(); j++) { + Mx4DPointFloat normal(*b.GetEdgeNormal(j)); + + if (p_position.Dot(&p_position, &normal) + normal[3] < 0.0f) { + break; + } + } + + if (b.GetNumEdges() == j) { + if (boundary != NULL) { + return FAILURE; + } + + boundary = &b; + } + } + } + + if (boundary == NULL) { + return FAILURE; + } + + for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { + LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) boundary->GetEdges()[j]; + + if (edge->GetMask0x03()) { + Mx3DPointFloat vec; + + if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && + vec.Dot(&vec, &p_direction) < 0.0f) { + edge = + (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(boundary)->GetCounterclockwiseEdge(boundary); + } + + if (!edge->GetMask0x03()) { + return FAILURE; + } + + if (p_actor->VTable0x84(boundary, time, p_position, p_direction, *edge, 0.5f) == SUCCESS) { + p_actor->SetController(this); + m_actors.insert(p_actor); + return SUCCESS; + } + } + } + + return FAILURE; } // FUNCTION: LEGO1 0x100466a0 diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index be51e2d1..0a609d51 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -10,6 +10,8 @@ struct LegoUnknown100db7f4 : public LegoEdge { public: enum { + c_bit1 = 0x01, + c_bit2 = 0x02, c_bit3 = 0x04, c_bit4 = 0x08 }; @@ -32,6 +34,8 @@ struct LegoUnknown100db7f4 : public LegoEdge { return SUCCESS; } + LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); } + // SYNTHETIC: LEGO1 0x1009a6c0 // LegoUnknown100db7f4::`scalar deleting destructor' diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 2fc02932..a214e25a 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -57,6 +57,8 @@ class Mx4DPointFloat : public Vector4 { m_elements[3] = p_a; } + inline Mx4DPointFloat(const Mx4DPointFloat& p_other) : Vector4(m_elements) { EqualsImpl(p_other.m_data); } + // FUNCTION: LEGO1 0x10003200 virtual void operator=(const Vector4& p_impl) { EqualsImpl(p_impl.m_data); } // vtable+0x98 From 939c09139f5ddac54353296d0f3c30e487cce704 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 08:13:27 -0400 Subject: [PATCH 32/89] Match LegoOmni::Destroy and related (#917) * Match LegoOmni::Destroy and related * Write COMPAT_MODE macro differently * fix lint issue --- .../legoomni/include/legocharactermanager.h | 1 + .../legoomni/include/legopathcontroller.h | 2 ++ .../src/common/legocharactermanager.cpp | 20 +++++++++++++++++++ LEGO1/lego/legoomni/src/main/legomain.cpp | 13 +++++------- .../legoomni/src/paths/legopathcontroller.cpp | 19 ++++++++++++++++++ LEGO1/lego/sources/misc/legocontainer.h | 12 +++++++++++ tools/decomplint/decomplint.py | 1 + 7 files changed, 60 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 878e1f41..aaeb584d 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -49,6 +49,7 @@ typedef map LegoCharacterMap; class LegoCharacterManager { public: LegoCharacterManager(); + ~LegoCharacterManager(); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index aeb8c03c..46c4935c 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -103,7 +103,9 @@ class LegoPathController : public MxCore { LegoPathBoundary* GetPathBoundary(const char* p_name); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); + static MxResult Init(); + static MxResult Reset(); private: void FUN_10046970(); diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 3548529e..7b0c3995 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -52,6 +52,26 @@ LegoCharacterManager::LegoCharacterManager() VariableTable()->SetVariable(m_customizeAnimFile); } +// FUNCTION: LEGO1 0x10083180 +// FUNCTION: BETA10 0x10073dad +LegoCharacterManager::~LegoCharacterManager() +{ + LegoCharacter* character = NULL; + LegoCharacterMap::iterator it; + + for (it = m_characters->begin(); it != m_characters->end(); it++) { + character = (*it).second; + + RemoveROI(character->m_roi); + + delete[] (*it).first; + delete (*it).second; + } + + delete m_characters; + delete[] g_customizeAnimFile; +} + // FUNCTION: LEGO1 0x10083270 void LegoCharacterManager::Init() { diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 7635ca2c..7b559faa 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -114,6 +114,7 @@ void LegoOmni::Destroy() } if (m_textureContainer) { + m_textureContainer->Clear(); delete m_textureContainer; m_textureContainer = NULL; } @@ -128,16 +129,10 @@ void LegoOmni::Destroy() m_inputManager = NULL; } - if (m_inputManager) { - delete m_inputManager; - m_inputManager = NULL; - } - - // todo FUN_10046de0 + LegoPathController::Reset(); if (m_bkgAudioManager) { m_bkgAudioManager->Stop(); - delete m_bkgAudioManager; m_bkgAudioManager = NULL; } @@ -150,7 +145,9 @@ void LegoOmni::Destroy() m_action.ClearAtom(); DestroyScripts(); - delete[] m_scripts; + if (m_scripts) { + delete[] m_scripts; + } MxOmni::Destroy(); } diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index bc692002..2f8eefe8 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -428,6 +428,25 @@ MxResult LegoPathController::Init() return SUCCESS; } +// FUNCTION: LEGO1 0x10046de0 +// FUNCTION: BETA10 0x100b779e +MxResult LegoPathController::Reset() +{ + if (g_ctrlBoundariesA == NULL || g_ctrlEdgesA == NULL) { + return FAILURE; + } + + delete[] g_ctrlBoundariesA; + delete[] g_ctrlEdgesA; + delete[] g_ctrlBoundariesB; + delete[] g_ctrlEdgesB; + g_ctrlBoundariesA = NULL; + g_ctrlEdgesA = NULL; + g_ctrlBoundariesB = NULL; + g_ctrlEdgesB = NULL; + return SUCCESS; +} + // FUNCTION: LEGO1 0x10046e50 // FUNCTION: BETA10 0x100b781f MxResult LegoPathController::Read(LegoStorage* p_storage) diff --git a/LEGO1/lego/sources/misc/legocontainer.h b/LEGO1/lego/sources/misc/legocontainer.h index 2b5fc0e1..7ddad1de 100644 --- a/LEGO1/lego/sources/misc/legocontainer.h +++ b/LEGO1/lego/sources/misc/legocontainer.h @@ -45,6 +45,18 @@ class LegoContainer { } } + void Clear() + { +#ifdef COMPAT_MODE + for (typename LegoContainerInfo::iterator it = m_map.begin(); it != m_map.end(); it++) +#else + for (LegoContainerInfo::iterator it = m_map.begin(); it != m_map.end(); it++) +#endif + { + delete (*it).second; + } + } + // FUNCTION: BETA10 0x1007bc00 inline T* Get(const char* p_name) { diff --git a/tools/decomplint/decomplint.py b/tools/decomplint/decomplint.py index 6c7c1b4c..4ff28168 100755 --- a/tools/decomplint/decomplint.py +++ b/tools/decomplint/decomplint.py @@ -81,6 +81,7 @@ def process_files(files, module=None): def main(): args = parse_args() + files_to_check = [] if os.path.isdir(args.target): files_to_check = list(walk_source_dir(args.target)) elif os.path.isfile(args.target) and is_file_cpp(args.target): From 0b2d4914eeb84a9c67f13d025155435eee064c0a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 08:36:44 -0400 Subject: [PATCH 33/89] Match LegoVideoManager::Destroy (#918) --- .../lego/legoomni/include/legovideomanager.h | 2 +- .../legoomni/src/video/legovideomanager.cpp | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index eb7a0b90..ffdcbdcc 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -88,7 +88,7 @@ class LegoVideoManager : public MxVideoManager { MxS32 m_cursorY; // 0x510 LPDIRECTDRAWSURFACE m_cursorSurface; // 0x514 RECT m_cursorRect; // 0x518 - undefined4 m_unk0x528; // 0x528 + LPDIRECTDRAWSURFACE m_unk0x528; // 0x528 MxBool m_drawFPS; // 0x52c RECT m_fpsRect; // 0x530 HFONT m_arialFont; // 0x540 diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index f790c7da..d1767f16 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -43,7 +43,7 @@ LegoVideoManager::LegoVideoManager() m_cursorSurface = NULL; m_fullScreenMovie = FALSE; m_drawFPS = FALSE; - m_unk0x528 = 0; + m_unk0x528 = NULL; m_arialFont = NULL; m_unk0xe5 = FALSE; m_unk0x554 = FALSE; @@ -220,17 +220,34 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM // FUNCTION: LEGO1 0x1007b5e0 void LegoVideoManager::Destroy() { - // todo: delete m_unk0x512 - // todo: delete m_unk0x258 + if (m_cursorSurface != NULL) { + m_cursorSurface->Release(); + m_cursorSurface = NULL; + } + + if (m_unk0x528 != NULL) { + m_unk0x528->Release(); + m_unk0x528 = NULL; + } + if (m_arialFont != NULL) { DeleteObject(m_arialFont); m_arialFont = NULL; } - // delete m_unk0x64; //TODO: delete d3drm + delete m_renderer; + + if (m_viewROI != NULL) { + if (m_3dManager != NULL) { + m_3dManager->Remove(*m_viewROI); + } + + delete m_viewROI; + } delete m_3dManager; MxVideoManager::Destroy(); + delete m_phonemeRefList; delete m_stopWatch; } From a1be306df70fa39ffbd3fee1055a104c86f44a30 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 09:42:44 -0400 Subject: [PATCH 34/89] Implement/match LegoPathBoundary ctor/dtor (#919) * Implement/match LegoPathBoundary ctor/dtor * Add missing BETA annotation --- .../lego/legoomni/include/legopathboundary.h | 21 +++++++++++++++++++ .../legoomni/src/paths/legopathboundary.cpp | 14 +++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 7d300feb..ba548d4f 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -98,6 +98,27 @@ class LegoPathBoundary : public LegoWEGEdge { // TEMPLATE: LEGO1 0x1004a7a0 // _Construct +// TEMPLATE: LEGO1 0x10056c20 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::~_Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::iterator::_Inc + +// TEMPLATE: LEGO1 0x10056d30 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::erase + +// TEMPLATE: LEGO1 0x10057180 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Erase + +// TEMPLATE: LEGO1 0x100571c0 +// set >::~set > + +// TEMPLATE: LEGO1 0x10057210 +// Set::~Set + +// TEMPLATE: LEGO1 0x100573e0 +// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::begin + // GLOBAL: LEGO1 0x100f11a4 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Nil diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 25df258f..0ed91f6f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -5,19 +5,25 @@ DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74) -// STUB: LEGO1 0x10056a70 +// FUNCTION: LEGO1 0x10056a70 +// FUNCTION: BETA10 0x100b1360 LegoPathBoundary::LegoPathBoundary() { - // TODO } -// STUB: LEGO1 0x10057260 +// FUNCTION: LEGO1 0x10057260 +// FUNCTION: BETA10 0x100b140d LegoPathBoundary::~LegoPathBoundary() { - // TODO + for (LegoPathActorSet::iterator it = m_actors.begin(); !(it == m_actors.end()); it++) { + (*it)->SetBoundary(NULL); + } + + m_actors.erase(m_actors.begin(), m_actors.end()); } // FUNCTION: LEGO1 0x100573f0 +// FUNCTION: BETA10 0x100b1536 MxResult LegoPathBoundary::AddActor(LegoPathActor* p_actor) { m_actors.insert(p_actor); From 95ed90aacbbcfd4c04d77f8b7d50872b7cfed3e7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 10:15:35 -0400 Subject: [PATCH 35/89] Implement/match some LegoHideAnimPresenter functions (#920) --- .../legoomni/include/legohideanimpresenter.h | 2 + .../src/video/legohideanimpresenter.cpp | 61 +++++++++++++++---- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legohideanimpresenter.h b/LEGO1/lego/legoomni/include/legohideanimpresenter.h index 6c4a9791..7dfab184 100644 --- a/LEGO1/lego/legoomni/include/legohideanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legohideanimpresenter.h @@ -36,6 +36,8 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { private: void Init(); void Destroy(MxBool p_fromDestructor); + void FUN_1006db40(undefined4); + void FUN_1006dc10(); undefined4* m_unk0xc0; // 0xc0 }; diff --git a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp index 19b2e3a4..b5d06b82 100644 --- a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp @@ -1,5 +1,9 @@ #include "legohideanimpresenter.h" +#include "legomain.h" +#include "legoworld.h" +#include "misc.h" + DECOMP_SIZE_ASSERT(LegoHideAnimPresenter, 0xc4) // FUNCTION: LEGO1 0x1006d7e0 @@ -8,16 +12,14 @@ LegoHideAnimPresenter::LegoHideAnimPresenter() Init(); } -// STUB: LEGO1 0x1006d860 +// FUNCTION: LEGO1 0x1006d860 void LegoHideAnimPresenter::VTable0x8c() { - // TODO } -// STUB: LEGO1 0x1006d870 +// FUNCTION: LEGO1 0x1006d870 void LegoHideAnimPresenter::VTable0x90() { - // TODO } // FUNCTION: LEGO1 0x1006d9f0 @@ -62,26 +64,61 @@ void LegoHideAnimPresenter::Destroy() Destroy(FALSE); } -// STUB: LEGO1 0x1006dad0 +// FUNCTION: LEGO1 0x1006dad0 void LegoHideAnimPresenter::PutFrame() { - // TODO } -// STUB: LEGO1 0x1006dae0 +// FUNCTION: LEGO1 0x1006dae0 +// FUNCTION: BETA10 0x100530f4 void LegoHideAnimPresenter::ReadyTickle() { - // TODO + LegoLoopingAnimPresenter::ReadyTickle(); + + if (m_currentWorld) { + if (m_currentTickleState == e_starting && m_compositePresenter != NULL) { + SendToCompositePresenter(Lego()); + } + + m_currentWorld->Add(this); + } } -// STUB: LEGO1 0x1006db20 +// FUNCTION: LEGO1 0x1006db20 +// FUNCTION: BETA10 0x1005316b void LegoHideAnimPresenter::StartingTickle() { - // TODO + LegoLoopingAnimPresenter::StartingTickle(); + + if (m_currentTickleState == e_streaming) { + FUN_1006dc10(); + FUN_1006db40(0); + } } -// STUB: LEGO1 0x1006e9e0 -void LegoHideAnimPresenter::EndAction() +// STUB: LEGO1 0x1006db40 +// FUNCTION: BETA10 0x100531ab +void LegoHideAnimPresenter::FUN_1006db40(undefined4) { // TODO } + +// STUB: LEGO1 0x1006dc10 +// FUNCTION: BETA10 0x100532fd +void LegoHideAnimPresenter::FUN_1006dc10() +{ + // TODO +} + +// FUNCTION: LEGO1 0x1006e9e0 +// FUNCTION: BETA10 0x100535ef +void LegoHideAnimPresenter::EndAction() +{ + if (m_action) { + MxVideoPresenter::EndAction(); + + if (m_currentWorld) { + m_currentWorld->Remove(this); + } + } +} From e32e06321ab3875ccd77f5dfa455aaa18766b283 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 10:35:22 -0400 Subject: [PATCH 36/89] Rename _countof to sizeOfArray (#921) --- LEGO1/lego/legoomni/include/infocenterstate.h | 2 +- LEGO1/lego/legoomni/src/act1/act1state.cpp | 2 +- .../src/build/legobuildingmanager.cpp | 26 +++++------ .../src/common/legoanimationmanager.cpp | 44 +++++++++---------- .../src/common/legocharactermanager.cpp | 22 +++++----- .../legoomni/src/common/legogamestate.cpp | 4 +- .../legoomni/src/common/legotextureinfo.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 6 +-- .../src/infocenter/infocenterstate.cpp | 18 ++++---- .../legoomni/src/input/legoinputmanager.cpp | 4 +- .../legoomni/src/paths/legopathcontroller.cpp | 16 +++---- .../src/video/legolocomotionanimpresenter.cpp | 2 +- .../lego/legoomni/src/worlds/historybook.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- LEGO1/lego/sources/misc/legounknown.cpp | 2 +- LEGO1/lego/sources/roi/legolod.cpp | 12 ++--- LEGO1/lego/sources/roi/legoroi.cpp | 2 +- LEGO1/mxdirectx/mxdirectdraw.cpp | 4 +- util/decomp.h | 4 +- 20 files changed, 89 insertions(+), 89 deletions(-) diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h index 05b0ed83..b1c418f1 100644 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ b/LEGO1/lego/legoomni/include/infocenterstate.h @@ -30,7 +30,7 @@ class InfocenterState : public LegoState { // FUNCTION: LEGO1 0x10071830 MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - inline MxS16 GetMaxNameLength() { return _countof(m_letters); } + inline MxS16 GetMaxNameLength() { return sizeOfArray(m_letters); } inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; } inline void SetNameLetter(MxS32 p_index, MxStillPresenter* p_letter) { m_letters[p_index] = p_letter; } inline MxBool HasRegistered() { return m_letters[0] != NULL; } diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index 98c167fe..013347d3 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -34,7 +34,7 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x m_unk0x1b0 = NULL; m_unk0x021 = 1; m_elevFloor = Act1State::c_floor1; - m_unk0x00c = _countof(g_unk0x100f37f0); + m_unk0x00c = sizeOfArray(g_unk0x100f37f0); m_unk0x1b4 = NULL; m_unk0x1b8 = NULL; m_unk0x208 = NULL; diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 2dc88f9a..5d2c1259 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -244,7 +244,7 @@ LegoBuildingManager::~LegoBuildingManager() // FUNCTION: LEGO1 0x1002f9d0 void LegoBuildingManager::Init() { - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { g_buildingInfo[i] = g_buildingInfoInit[i]; } @@ -262,7 +262,7 @@ void LegoBuildingManager::FUN_1002fa00() MxS32 i; LegoWorld* world = CurrentWorld(); - for (i = 0; i < _countof(g_buildingInfo); i++) { + for (i = 0; i < sizeOfArray(g_buildingInfo); i++) { UpdatePosition(i, world); } @@ -274,7 +274,7 @@ void LegoBuildingManager::FUN_1002fa00() } } else { - for (i = 0; i < _countof(g_buildingInfoHausName); i++) { + for (i = 0; i < sizeOfArray(g_buildingInfoHausName); i++) { LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[i]); if (entity) { entity->GetROI()->SetVisibility(m_nextVariant == i); @@ -308,7 +308,7 @@ void LegoBuildingManager::FUN_1002fb30() { MxU32 i; - for (i = 0; i < _countof(g_buildingInfo); i++) { + for (i = 0; i < sizeOfArray(g_buildingInfo); i++) { g_buildingInfo[i].m_entity = NULL; } @@ -327,7 +327,7 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; if (p_storage->Write(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { @@ -360,7 +360,7 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; if (p_storage->Read(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { @@ -426,13 +426,13 @@ LegoBuildingInfo* LegoBuildingManager::GetInfo(LegoEntity* p_entity) { MxS32 i; - for (i = 0; i < _countof(g_buildingInfo); i++) { + for (i = 0; i < sizeOfArray(g_buildingInfo); i++) { if (g_buildingInfo[i].m_entity == p_entity) { break; } } - if (i < _countof(g_buildingInfo)) { + if (i < sizeOfArray(g_buildingInfo)) { return &g_buildingInfo[i]; } @@ -451,7 +451,7 @@ MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) { LegoROI* roi = p_entity->GetROI(); - if (++m_nextVariant >= _countof(g_buildingInfoHausName)) { + if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) { m_nextVariant = 0; } @@ -603,7 +603,7 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index) // FUNCTION: LEGO1 0x10030110 MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) { - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { if (&g_buildingInfo[i] == p_data) { return FUN_10030030(i); } @@ -665,7 +665,7 @@ MxResult LegoBuildingManager::Tickle() // FUNCTION: BETA10 0x1006474c void LegoBuildingManager::FUN_10030590() { - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { g_buildingInfo[i].m_unk0x11 = -1; g_buildingInfo[i].m_initialUnk0x11 = -1; AdjustHeight(i); @@ -693,7 +693,7 @@ LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length) FUN_10030630(); } - p_length = _countof(g_buildingInfo); + p_length = sizeOfArray(g_buildingInfo); return g_buildingInfo; } @@ -719,7 +719,7 @@ void LegoBuildingManager::FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust) // FUNCTION: LEGO1 0x10030800 void LegoBuildingManager::FUN_10030800() { - for (MxS32 i = 0; i < _countof(g_buildingInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { g_buildingInfo[i].m_initialUnk0x11 = g_buildingInfo[i].m_unk0x11; } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 912e9d3d..812d9d93 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -144,7 +144,7 @@ LegoAnimationManager::~LegoAnimationManager() FUN_10061010(FALSE); - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { @@ -230,7 +230,7 @@ void LegoAnimationManager::Suspend() FUN_10061010(FALSE); MxS32 i; - for (i = 0; i < (MxS32) _countof(m_extras); i++) { + for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { @@ -270,7 +270,7 @@ void LegoAnimationManager::Suspend() m_unk0x414 = 0; m_unk0x401 = FALSE; - for (i = 0; i < (MxS32) _countof(g_characters); i++) { + for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { g_characters[i].m_unk0x04 = FALSE; } } @@ -305,12 +305,12 @@ void LegoAnimationManager::Init() m_unk0x41c = g_legoAnimationManagerConfig <= 1 ? 10 : 20; MxS32 i; - for (i = 0; i < (MxS32) _countof(m_unk0x28); i++) { + for (i = 0; i < (MxS32) sizeOfArray(m_unk0x28); i++) { m_unk0x28[i] = NULL; m_unk0x30[i] = 0; } - for (i = 0; i < (MxS32) _countof(m_extras); i++) { + for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { m_extras[i].m_roi = NULL; m_extras[i].m_characterId = -1; m_extras[i].m_unk0x10 = -1.0f; @@ -333,12 +333,12 @@ void LegoAnimationManager::Init() m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); m_unk0x410 = 5000; - for (i = 0; i < (MxS32) _countof(g_characters); i++) { + for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { g_characters[i].m_active = FALSE; g_characters[i].m_unk0x04 = FALSE; } - for (i = 0; i < (MxS32) _countof(g_vehicles); i++) { + for (i = 0; i < (MxS32) sizeOfArray(g_vehicles); i++) { g_vehicles[i].m_unk0x04 = FALSE; g_vehicles[i].m_unk0x05 = FALSE; } @@ -396,7 +396,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_tranInfoList2 = NULL; } - for (i = 0; i < (MxS32) _countof(m_unk0x28); i++) { + for (i = 0; i < (MxS32) sizeOfArray(m_unk0x28); i++) { m_unk0x28[i] = NULL; m_unk0x30[i] = 0; } @@ -406,7 +406,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_unk0x430 = FALSE; m_unk0x42c = NULL; - for (j = 0; j < (MxS32) _countof(g_characters); j++) { + for (j = 0; j < (MxS32) sizeOfArray(g_characters); j++) { g_characters[j].m_active = FALSE; } @@ -543,7 +543,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) // FUNCTION: LEGO1 0x10060140 MxBool LegoAnimationManager::FindVehicle(const char* p_name, MxU32& p_index) { - for (MxS32 i = 0; i < _countof(g_vehicles); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_vehicles); i++) { if (!strcmpi(p_name, g_vehicles[i].m_name)) { p_index = i; return TRUE; @@ -590,7 +590,7 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info) goto done; } - for (i = 0; i < (MxS32) _countof(p_info->m_unk0x10); i++) { + for (i = 0; i < (MxS32) sizeOfArray(p_info->m_unk0x10); i++) { if (p_file->Read(&p_info->m_unk0x10[i], sizeof(*p_info->m_unk0x10)) != SUCCESS) { goto done; } @@ -865,7 +865,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt controller->RemoveActor(actor); actor->SetController(NULL); - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { if (m_extras[i].m_roi == roi) { MxS32 characterId = m_extras[i].m_characterId; g_characters[characterId].m_unk0x07 = TRUE; @@ -1134,7 +1134,7 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param) cursor.Detach(); delete tranInfo; - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { @@ -1184,7 +1184,7 @@ MxResult LegoAnimationManager::Tickle() } if (m_unk0x401) { - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL && m_extras[i].m_unk0x0d) { @@ -1241,7 +1241,7 @@ MxResult LegoAnimationManager::Tickle() unk0x0c = g_unk0x100d8b28[actorId]; } - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { @@ -1318,7 +1318,7 @@ MxU16 LegoAnimationManager::FUN_10062110( float len = position.LenSquared(); float min, max; - for (MxU32 i = 0; i < _countof(g_unk0x100f74b0); i++) { + for (MxU32 i = 0; i < sizeOfArray(g_unk0x100f74b0); i++) { if (g_unk0x100f74b0[i][0] < p_speed) { max = g_unk0x100f74b0[i][1]; min = g_unk0x100f74b0[i][2]; @@ -1335,7 +1335,7 @@ MxU16 LegoAnimationManager::FUN_10062110( if (vehicleId >= 0) { MxBool found = FALSE; - for (MxS32 j = 0; j < (MxS32) _countof(m_anims[i].m_unk0x2a); j++) { + for (MxS32 j = 0; j < (MxS32) sizeOfArray(m_anims[i].m_unk0x2a); j++) { if (m_anims[i].m_unk0x2a[j] == vehicleId) { found = TRUE; break; @@ -1375,7 +1375,7 @@ MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name) { MxS8 i; - for (i = 0; i < _countof(g_characters); i++) { + for (i = 0; i < sizeOfArray(g_characters); i++) { if (!strnicmp(p_name, g_characters[i].m_name, 2)) { return i; } @@ -1454,7 +1454,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info) controller->RemoveActor(actor); actor->SetController(NULL); - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { if (m_extras[i].m_roi == actor->GetROI()) { MxS32 characterId = m_extras[i].m_characterId; g_characters[characterId].m_unk0x07 = TRUE; @@ -1544,7 +1544,7 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) if (p_und || viewManager != NULL) { MxLong time = Timer()->GetTime(); - for (MxS32 i = 0; i < (MxS32) _countof(m_extras); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { LegoROI* roi = m_extras[i].m_roi; if (roi != NULL) { @@ -1655,7 +1655,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) if (m_extras[i].m_roi == NULL) { m_lastExtraCharacterId++; - if (m_lastExtraCharacterId >= _countof(g_characters)) { + if (m_lastExtraCharacterId >= sizeOfArray(g_characters)) { m_lastExtraCharacterId = 0; } @@ -1755,7 +1755,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) m_lastExtraCharacterId++; - if (m_lastExtraCharacterId >= _countof(g_characters)) { + if (m_lastExtraCharacterId >= sizeOfArray(g_characters)) { m_lastExtraCharacterId = 0; } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 7b0c3995..891a6471 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -75,7 +75,7 @@ LegoCharacterManager::~LegoCharacterManager() // FUNCTION: LEGO1 0x10083270 void LegoCharacterManager::Init() { - for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { g_characterInfo[i] = g_characterInfoInit[i]; } } @@ -83,7 +83,7 @@ void LegoCharacterManager::Init() // FUNCTION: LEGO1 0x100832a0 void LegoCharacterManager::FUN_100832a0() { - for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { LegoCharacterInfo* info = GetInfo(g_characterInfo[i].m_name); if (info != NULL) { @@ -107,7 +107,7 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { LegoCharacterInfo* info = &g_characterInfo[i]; if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { @@ -162,7 +162,7 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) { MxResult result = FAILURE; - for (MxS32 i = 0; i < _countof(g_characterInfo); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_characterInfo); i++) { LegoCharacterInfo* info = &g_characterInfo[i]; if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { @@ -451,7 +451,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) info->m_unk0x10 = pepper->m_unk0x10; info->m_unk0x14 = pepper->m_unk0x14; - for (i = 0; i < _countof(info->m_parts); i++) { + for (i = 0; i < sizeOfArray(info->m_parts); i++) { info->m_parts[i] = pepper->m_parts[i]; } } @@ -476,7 +476,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) comp = new CompoundObject(); roi->SetComp(comp); - for (i = 0; i < _countof(g_characterLODs) - 1; i++) { + for (i = 0; i < sizeOfArray(g_characterLODs) - 1; i++) { char lodName[256]; LegoCharacterInfo::Part& part = info->m_parts[i]; @@ -622,7 +622,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex // FUNCTION: LEGO1 0x10084c00 MxBool LegoCharacterManager::Exists(const char* p_key) { - for (MxU32 i = 0; i < _countof(g_characterInfo); i++) { + for (MxU32 i = 0; i < sizeOfArray(g_characterInfo); i++) { if (!strcmpi(g_characterInfo[i].m_name, p_key)) { return TRUE; } @@ -648,13 +648,13 @@ LegoCharacterInfo* LegoCharacterManager::GetInfo(const char* p_key) { MxU32 i; - for (i = 0; i < _countof(g_characterInfo); i++) { + for (i = 0; i < sizeOfArray(g_characterInfo); i++) { if (!strcmpi(g_characterInfo[i].m_name, p_key)) { break; } } - if (i < _countof(g_characterInfo)) { + if (i < sizeOfArray(g_characterInfo)) { return &g_characterInfo[i]; } @@ -666,13 +666,13 @@ LegoCharacterInfo* LegoCharacterManager::GetInfo(LegoROI* p_roi) { MxU32 i; - for (i = 0; i < _countof(g_characterInfo); i++) { + for (i = 0; i < sizeOfArray(g_characterInfo); i++) { if (g_characterInfo[i].m_roi == p_roi) { break; } } - if (i < _countof(g_characterInfo)) { + if (i < sizeOfArray(g_characterInfo)) { return &g_characterInfo[i]; } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index c07a1871..101a3e6a 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -251,7 +251,7 @@ MxResult LegoGameState::Save(MxULong p_slot) Write(&fileStorage, (MxU16) m_currentAct); Write(&fileStorage, m_actorId); - for (i = 0; i < _countof(g_colorSaveData); i++) { + for (i = 0; i < sizeOfArray(g_colorSaveData); i++) { if (WriteVariable(&fileStorage, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) { goto done; } @@ -997,7 +997,7 @@ void LegoGameState::SetColors() { MxVariableTable* variableTable = VariableTable(); - for (MxS32 i = 0; i < _countof(g_colorSaveData); i++) { + for (MxS32 i = 0; i < sizeOfArray(g_colorSaveData); i++) { variableTable->SetVariable(g_colorSaveData[i].m_targetName, g_colorSaveData[i].m_colorName); } } diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index 520a0070..51775a03 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -104,7 +104,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text PALETTEENTRY entries[256]; memset(entries, 0, sizeof(entries)); - for (i = 0; i < _countof(entries); i++) { + for (i = 0; i < sizeOfArray(entries); i++) { if (i < image->GetCount()) { entries[i].peFlags = 0; entries[i].peRed = image->GetPaletteEntry(i).GetRed(); diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 58df76c4..6c455909 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -127,7 +127,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) if (p_roi) { const char* name = p_roi->GetName(); - for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) { + for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) { if (!strcmpi(name, g_actorNames[i])) { m_type = e_character; m_actorId = i; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 2ecdff71..d3d940d3 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -407,7 +407,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location) { MxResult result = FAILURE; - for (MxS32 i = 0; i < (MxS32) _countof(g_locations); i++) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(g_locations); i++) { if (!strcmpi(p_location, g_locations[i].m_name)) { MxMatrix mat; LegoROI* viewROI = VideoManager()->GetViewROI(); @@ -440,7 +440,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location) { MxResult result = FAILURE; - if (p_location < _countof(g_locations)) { + if (p_location < sizeOfArray(g_locations)) { MxMatrix mat; LegoROI* viewROI = VideoManager()->GetViewROI(); @@ -475,7 +475,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location) // FUNCTION: BETA10 0x1009c259 LegoLocation* LegoNavController::GetLocation(MxU32 p_location) { - if (p_location < _countof(g_locations)) { + if (p_location < sizeOfArray(g_locations)) { return &g_locations[p_location]; } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp index a6159d62..0fd99839 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp @@ -93,28 +93,28 @@ InfomainScript::Script g_bricksterDialogue[2] = { // FUNCTION: LEGO1 0x10071600 InfocenterState::InfocenterState() { - m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, _countof(g_exitDialogueAct1)); - m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, _countof(g_exitDialogueAct23) - 1); + m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, sizeOfArray(g_exitDialogueAct1)); + m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, sizeOfArray(g_exitDialogueAct23) - 1); m_returnDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_returnDialogueAct1, _countof(g_returnDialogueAct1) - 1); + LegoState::Playlist((MxU32*) g_returnDialogueAct1, sizeOfArray(g_returnDialogueAct1) - 1); m_returnDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_returnDialogueAct2, _countof(g_returnDialogueAct2) - 1); + LegoState::Playlist((MxU32*) g_returnDialogueAct2, sizeOfArray(g_returnDialogueAct2) - 1); m_returnDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_returnDialogueAct3, _countof(g_returnDialogueAct3)); + LegoState::Playlist((MxU32*) g_returnDialogueAct3, sizeOfArray(g_returnDialogueAct3)); m_leaveDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct1, _countof(g_leaveDialogueAct1)); + LegoState::Playlist((MxU32*) g_leaveDialogueAct1, sizeOfArray(g_leaveDialogueAct1)); m_leaveDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct2, _countof(g_leaveDialogueAct2)); + LegoState::Playlist((MxU32*) g_leaveDialogueAct2, sizeOfArray(g_leaveDialogueAct2)); m_leaveDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct3, _countof(g_leaveDialogueAct3) - 1); + LegoState::Playlist((MxU32*) g_leaveDialogueAct3, sizeOfArray(g_leaveDialogueAct3) - 1); - m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, _countof(g_bricksterDialogue)); + m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, sizeOfArray(g_bricksterDialogue)); memset(m_letters, 0, sizeof(m_letters)); } diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 3d683dea..9149835d 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -147,11 +147,11 @@ void LegoInputManager::FUN_1005c0f0() m_unk0x94 = FALSE; if (m_directInputDevice) { - HRESULT hr = m_directInputDevice->GetDeviceState(_countof(m_unk0x95), &m_unk0x95); + HRESULT hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95); if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) { if (m_directInputDevice->Acquire() == S_OK) { - hr = m_directInputDevice->GetDeviceState(_countof(m_unk0x95), &m_unk0x95); + hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95); } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 2f8eefe8..a5f1797d 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -100,7 +100,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con LegoPathBoundary& boundary = m_boundaries[i]; MxS32 j; - for (j = 0; j < _countof(g_unk0x100f42f0); j++) { + for (j = 0; j < sizeOfArray(g_unk0x100f42f0); j++) { if (!strcmpi(g_unk0x100f42f0[j], boundary.GetName())) { g_ctrlBoundariesA[j].m_controller = this; g_ctrlBoundariesA[j].m_boundary = &boundary; @@ -111,7 +111,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con } } - for (j = 0; j < _countof(g_unk0x100f4330); j++) { + for (j = 0; j < sizeOfArray(g_unk0x100f4330); j++) { if (!strcmpi(g_unk0x100f4330[j], boundary.GetName())) { g_ctrlBoundariesB[j].m_controller = this; g_ctrlBoundariesB[j].m_boundary = &boundary; @@ -162,7 +162,7 @@ void LegoPathController::Destroy() m_numE = 0; MxS32 j; - for (j = 0; j < _countof(g_unk0x100f42f0); j++) { + for (j = 0; j < sizeOfArray(g_unk0x100f42f0); j++) { if (g_ctrlBoundariesA[j].m_controller == this) { g_ctrlBoundariesA[j].m_controller = NULL; g_ctrlBoundariesA[j].m_boundary = NULL; @@ -174,7 +174,7 @@ void LegoPathController::Destroy() } } - for (j = 0; j < _countof(g_unk0x100f4330); j++) { + for (j = 0; j < sizeOfArray(g_unk0x100f4330); j++) { if (g_ctrlBoundariesB[j].m_controller == this) { g_ctrlBoundariesB[j].m_controller = NULL; g_ctrlBoundariesB[j].m_boundary = NULL; @@ -421,10 +421,10 @@ MxResult LegoPathController::Init() return FAILURE; } - g_ctrlBoundariesA = new CtrlBoundary[_countof(g_unk0x100f42f0)]; - g_ctrlEdgesA = new CtrlEdge[_countof(g_unk0x100f42f0)]; - g_ctrlBoundariesB = new CtrlBoundary[_countof(g_unk0x100f4330)]; - g_ctrlEdgesB = new CtrlEdge[_countof(g_unk0x100f4330)]; + g_ctrlBoundariesA = new CtrlBoundary[sizeOfArray(g_unk0x100f42f0)]; + g_ctrlEdgesA = new CtrlEdge[sizeOfArray(g_unk0x100f42f0)]; + g_ctrlBoundariesB = new CtrlBoundary[sizeOfArray(g_unk0x100f4330)]; + g_ctrlEdgesB = new CtrlEdge[sizeOfArray(g_unk0x100f4330)]; return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index c5da3ffe..a5302e47 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -80,7 +80,7 @@ void LegoLocomotionAnimPresenter::PutFrame() // FUNCTION: LEGO1 0x1006d5d0 void LegoLocomotionAnimPresenter::ReadyTickle() { - LegoAnimPresenter::ReadyTickle(); + LegoLoopingAnimPresenter::ReadyTickle(); if (m_currentWorld != NULL && m_currentTickleState == e_starting) { m_currentWorld->Add(this); diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index 7534623a..56e09bed 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -127,7 +127,7 @@ void HistoryBook::ReadyWorld() (*scorebox)->SetTickleState(MxPresenter::e_repeating); (*scorebox)->SetPosition(scoreX + 0xa1, scoreY); - for (MxS16 letterIndex = 0; letterIndex < (MxS16) _countof(m_names[0]);) { + for (MxS16 letterIndex = 0; letterIndex < (MxS16) sizeOfArray(m_names[0]);) { MxS16 letter = score->m_name.m_letters[letterIndex]; if (letter == -1) { diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index df5b09f3..21d95cac 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -492,7 +492,7 @@ void Isle::Enable(MxBool p_enable) for (MxU32 i = 0; i < 5; i++) { MxS32 r = rand() % 5; - for (MxU32 j = 0; j < _countof(locations); j++) { + for (MxU32 j = 0; j < sizeOfArray(locations); j++) { if (locations[j] != 0 && r-- == 0) { AnimationManager()->AddExtra(locations[j], TRUE); locations[j] = 0; diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index e9210dc7..14178e44 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(LegoUnknown, 0x50) // FUNCTION: LEGO1 0x1009a0f0 LegoUnknown::LegoUnknown() { - for (LegoS32 i = 0; i < _countof(m_unk0x00); i++) { + for (LegoS32 i = 0; i < sizeOfArray(m_unk0x00); i++) { m_unk0x00[i].Clear(); } } diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index e9997907..2170c101 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -108,21 +108,21 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } if (numVerts > 0) { - vertices = new float[numVerts][_countof(*vertices)]; + vertices = new float[numVerts][sizeOfArray(*vertices)]; if (p_storage->Read(vertices, numVerts * sizeof(*vertices)) != SUCCESS) { goto done; } } if (numNormals > 0) { - normals = new float[numNormals][_countof(*normals)]; + normals = new float[numNormals][sizeOfArray(*normals)]; if (p_storage->Read(normals, numNormals * sizeof(*normals)) != SUCCESS) { goto done; } } if (numTextureVertices > 0) { - textureVertices = new float[numTextureVertices][_countof(*textureVertices)]; + textureVertices = new float[numTextureVertices][sizeOfArray(*textureVertices)]; if (p_storage->Read(textureVertices, numTextureVertices * sizeof(*textureVertices)) != SUCCESS) { goto done; } @@ -143,7 +143,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text goto done; } - polyIndices = new LegoU32[numPolys & MAXWORD][_countof(*polyIndices)]; + polyIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*polyIndices)]; if (p_storage->Read(polyIndices, (numPolys & MAXWORD) * sizeof(*polyIndices)) != SUCCESS) { goto done; } @@ -153,7 +153,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } if (numTextureIndices > 0) { - textureIndices = new LegoU32[numPolys & MAXWORD][_countof(*textureIndices)]; + textureIndices = new LegoU32[numPolys & MAXWORD][sizeOfArray(*textureIndices)]; if (p_storage->Read(textureIndices, (numPolys & MAXWORD) * sizeof(*textureIndices)) != SUCCESS) { goto done; } @@ -212,7 +212,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text if (textureName != NULL) { if (mesh->GetUnknown0x21()) { - LegoROI::FUN_100a9cf0(textureName, paletteEntries, _countof(paletteEntries)); + LegoROI::FUN_100a9cf0(textureName, paletteEntries, sizeOfArray(paletteEntries)); } textureInfo = p_textureContainer->Get(mesh->GetTextureName()); diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 7bee2c40..33fbbb8e 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -609,7 +609,7 @@ LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_g // FUNCTION: LEGO1 0x100a9c50 LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha) { - for (MxU32 i = 0; i < _countof(g_roiColorAliases); i++) { + for (MxU32 i = 0; i < sizeOfArray(g_roiColorAliases); i++) { if (strcmpi(g_roiColorAliases[i].m_name, p_param) == 0) { p_red = g_roiColorAliases[i].m_red / 255.0; p_green = g_roiColorAliases[i].m_green / 255.0; diff --git a/LEGO1/mxdirectx/mxdirectdraw.cpp b/LEGO1/mxdirectx/mxdirectdraw.cpp index 0b3d05ff..cdd5f3b7 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.cpp +++ b/LEGO1/mxdirectx/mxdirectdraw.cpp @@ -147,7 +147,7 @@ BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int pa { int reservedLowEntryCount = 10; int reservedHighEntryCount = 10; - int arraySize = _countof(m_paletteEntries); + int arraySize = sizeOfArray(m_paletteEntries); HDC hdc; int i; @@ -184,7 +184,7 @@ BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int pa if (m_pPalette) { HRESULT result; - result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries); + result = m_pPalette->SetEntries(0, 0, sizeOfArray(m_paletteEntries), m_paletteEntries); if (result != DD_OK) { Error("SetEntries failed", result); return FALSE; diff --git a/util/decomp.h b/util/decomp.h index 100f9f21..81cb1d13 100644 --- a/util/decomp.h +++ b/util/decomp.h @@ -13,8 +13,8 @@ #define DECOMP_SIZE_ASSERT(T, S) #endif -#ifndef _countof -#define _countof(arr) (sizeof(arr) / sizeof(arr[0])) +#ifndef sizeOfArray +#define sizeOfArray(arr) (sizeof(arr) / sizeof(arr[0])) #endif typedef unsigned char undefined; From e4a899350e3d4c3924b26cb32f6eb7240139e550 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 10:43:06 -0400 Subject: [PATCH 37/89] Move strings to proper location in define.cpp (#922) --- LEGO1/define.cpp | 60 +++++++++++++++++++ LEGO1/define.h | 15 +++++ .../src/common/mxcontrolpresenter.cpp | 24 ++------ .../src/control/legometerpresenter.cpp | 43 +++---------- .../legoomni/src/paths/legopathpresenter.cpp | 7 +-- .../legoomni/src/video/legomodelpresenter.cpp | 12 +--- LEGO1/omni/src/video/mxstillpresenter.cpp | 6 +- 7 files changed, 92 insertions(+), 75 deletions(-) diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index cdc2def9..89d70dd0 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -12,6 +12,38 @@ const char* g_strANIMATION = "ANIMATION"; // STRING: LEGO1 0x10102024 const char* g_strATTACH_CAMERA = "ATTACH_CAMERA"; +// GLOBAL: LEGO1 0x10102054 +// STRING: LEGO1 0x10102018 +const char* g_strAUTO_CREATE = "AUTO_CREATE"; + +// GLOBAL: LEGO1 0x1010205c +// STRING: LEGO1 0x10102000 +const char* g_strBOTTOM_TO_TOP = "BOTTOM_TO_TOP"; + +// GLOBAL: LEGO1 0x10102064 +// STRING: LEGO1 0x10101fec +const char* g_strSTYLE = "STYLE"; + +// GLOBAL: LEGO1 0x10102068 +// STRING: LEGO1 0x10101fe4 +const char* g_strGRID = "GRID"; + +// GLOBAL: LEGO1 0x1010206c +// STRING: LEGO1 0x10101fe0 +const char* g_strMAP = "MAP"; + +// GLOBAL: LEGO1 0x10102074 +// STRING: LEGO1 0x10101fd0 +const char* g_strTOGGLE = "TOGGLE"; + +// GLOBAL: LEGO1 0x10102078 +// STRING: LEGO1 0x10101fc4 +const char* g_strDB_CREATE = "DB_CREATE"; + +// GLOBAL: LEGO1 0x1010207c +// STRING: LEGO1 0x10101fb4 +const char* g_strFILLER_INDEX = "FILLER_INDEX"; + // GLOBAL: LEGO1 0x10102080 // STRING: LEGO1 0x100f4368 const char* g_strFROM_PARENT = "FROM_PARENT"; @@ -20,6 +52,14 @@ const char* g_strFROM_PARENT = "FROM_PARENT"; // STRING: LEGO1 0x10101fa4 const char* g_strHIDE_ON_STOP = "HIDE_ON_STOP"; +// GLOBAL: LEGO1 0x10102088 +// STRING: LEGO1 0x10101f94 +const char* g_strLEFT_TO_RIGHT = "LEFT_TO_RIGHT"; + +// GLOBAL: LEGO1 0x10102094 +// STRING: LEGO1 0x10101f70 +const char* g_strTYPE = "TYPE"; + // GLOBAL: LEGO1 0x10102098 // STRING: LEGO1 0x10101f60 const char* g_strMUST_SUCCEED = "MUST_SUCCEED"; @@ -32,6 +72,10 @@ const char* g_strOBJECT = "OBJECT"; // STRING: LEGO1 0x10101f38 const char* g_strPTATCAM = "PTATCAM"; +// GLOBAL: LEGO1 0x101020ac +// STRING: LEGO1 0x10101f28 +const char* g_strRIGHT_TO_LEFT = "RIGHT_TO_LEFT"; + // GLOBAL: LEGO1 0x101020b0 // STRING: LEGO1 0x10101f20 const char* g_strSOUND = "SOUND"; @@ -48,6 +92,18 @@ const char* g_strSPEED = "SPEED"; // STRING: LEGO1 0x10101f10 const char* g_strSUBST = "SUBST"; +// GLOBAL: LEGO1 0x101020c0 +// STRING: LEGO1 0x10101f00 +const char* g_strTOP_TO_BOTTOM = "TOP_TO_BOTTOM"; + +// GLOBAL: LEGO1 0x101020c4 +// STRING: LEGO1 0x10101ef0 +const char* g_strTRIGGERS_SOURCE = "TRIGGERS_SOURCE"; + +// GLOBAL: LEGO1 0x101020c8 +// STRING: LEGO1 0x10101ee4 +const char* g_strVARIABLE = "VARIABLE"; + // GLOBAL: LEGO1 0x101020cc // STRING: LEGO1 0x100f3808 const char* g_strVISIBILITY = "VISIBILITY"; @@ -60,6 +116,10 @@ const char* g_strWORLD = "WORLD"; // STRING: LEGO1 0x10101ed0 const char* g_strANIMMAN_ID = "ANIMMAN_ID"; +// GLOBAL: LEGO1 0x101020e0 +// STRING: LEGO1 0x10101eb0 +const char* g_strBMP_ISMAP = "BMP_ISMAP"; + // GLOBAL: LEGO1 0x101020e4 // STRING: LEGO1 0x10101eac const char* g_parseExtraTokens = ":;"; diff --git a/LEGO1/define.h b/LEGO1/define.h index d975d1fb..9bb1962a 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -18,6 +18,21 @@ extern const char* g_strFROM_PARENT; extern const char* g_strHIDE_ON_STOP; extern const char* g_strMUST_SUCCEED; extern const char* g_strSUBST; +extern const char* g_strTRIGGERS_SOURCE; extern const char* g_strPTATCAM; +extern const char* g_strTOGGLE; +extern const char* g_strMAP; +extern const char* g_strGRID; +extern const char* g_strSTYLE; +extern const char* g_strTYPE; +extern const char* g_strLEFT_TO_RIGHT; +extern const char* g_strRIGHT_TO_LEFT; +extern const char* g_strBOTTOM_TO_TOP; +extern const char* g_strTOP_TO_BOTTOM; +extern const char* g_strFILLER_INDEX; +extern const char* g_strVARIABLE; +extern const char* g_strBMP_ISMAP; +extern const char* g_strAUTO_CREATE; +extern const char* g_strDB_CREATE; #endif // DEFINE_H diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index b4f8c75a..5c2eec3d 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -11,22 +11,6 @@ DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c) -// GLOBAL: LEGO1 0x10102064 -// STRING: LEGO1 0x10101fec -const char* g_style = "STYLE"; - -// GLOBAL: LEGO1 0x10102068 -// STRING: LEGO1 0x10101fe4 -const char* g_grid = "GRID"; - -// GLOBAL: LEGO1 0x1010206c -// STRING: LEGO1 0x10101fe0 -const char* g_map = "MAP"; - -// GLOBAL: LEGO1 0x10102074 -// STRING: LEGO1 0x10101fd0 -const char* g_toggle = "TOGGLE"; - // FUNCTION: LEGO1 0x10043f50 MxControlPresenter::MxControlPresenter() { @@ -266,18 +250,18 @@ void MxControlPresenter::ParseExtra() extraCopy[extraLength & MAXWORD] = '\0'; char output[256]; - if (KeyValueStringParse(output, g_style, extraCopy)) { + if (KeyValueStringParse(output, g_strSTYLE, extraCopy)) { char* str = strtok(output, g_parseExtraTokens); - if (!strcmpi(str, g_toggle)) { + if (!strcmpi(str, g_strTOGGLE)) { m_unk0x4c = 1; } - else if (!strcmpi(str, g_grid)) { + else if (!strcmpi(str, g_strGRID)) { m_unk0x4c = 2; m_unk0x52 = atoi(strtok(NULL, g_parseExtraTokens)); m_unk0x54 = atoi(strtok(NULL, g_parseExtraTokens)); } - else if (!strcmpi(str, g_map)) { + else if (!strcmpi(str, g_strMAP)) { m_unk0x4c = 3; str = strtok(NULL, g_parseExtraTokens); diff --git a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index e94d02d8..d6dd5dd8 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -1,40 +1,13 @@ #include "legometerpresenter.h" #include "decomp.h" +#include "define.h" #include "mxbitmap.h" #include "mxdsaction.h" #include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94) -// GLOBAL: LEGO1 0x1010207c -// STRING: LEGO1 0x10101fb4 -const char* g_filterIndex = "FILLER_INDEX"; - -// GLOBAL: LEGO1 0x10102094 -// STRING: LEGO1 0x10101f70 -const char* g_type = "TYPE"; - -// GLOBAL: LEGO1 0x10102088 -// STRING: LEGO1 0x10101f94 -const char* g_leftToRight = "LEFT_TO_RIGHT"; - -// GLOBAL: LEGO1 0x101020ac -// STRING: LEGO1 0x10101f28 -const char* g_rightToLeft = "RIGHT_TO_LEFT"; - -// GLOBAL: LEGO1 0x1010205c -// STRING: LEGO1 0x10102000 -const char* g_bottomToTop = "BOTTOM_TO_TOP"; - -// GLOBAL: LEGO1 0x101020c0 -// STRING: LEGO1 0x10101f00 -const char* g_topToBottom = "TOP_TO_BOTTOM"; - -// GLOBAL: LEGO1 0x101020c8 -// STRING: LEGO1 0x10101ee4 -const char* g_variable = "VARIABLE"; - // FUNCTION: LEGO1 0x10043430 LegoMeterPresenter::LegoMeterPresenter() { @@ -66,26 +39,26 @@ void LegoMeterPresenter::ParseExtra() extraCopy[extraLength & MAXWORD] = '\0'; char output[256]; - if (KeyValueStringParse(extraCopy, g_type, output)) { - if (!strcmpi(output, g_leftToRight)) { + if (KeyValueStringParse(extraCopy, g_strTYPE, output)) { + if (!strcmpi(output, g_strLEFT_TO_RIGHT)) { m_layout = 0; } - else if (!strcmpi(output, g_rightToLeft)) { + else if (!strcmpi(output, g_strRIGHT_TO_LEFT)) { m_layout = 1; } - else if (!strcmpi(output, g_bottomToTop)) { + else if (!strcmpi(output, g_strBOTTOM_TO_TOP)) { m_layout = 2; } - else if (!strcmpi(output, g_topToBottom)) { + else if (!strcmpi(output, g_strTOP_TO_BOTTOM)) { m_layout = 3; } } - if (KeyValueStringParse(extraCopy, g_filterIndex, output)) { + if (KeyValueStringParse(extraCopy, g_strFILLER_INDEX, output)) { m_type = atoi(output); } - if (KeyValueStringParse(extraCopy, g_variable, output)) { + if (KeyValueStringParse(extraCopy, g_strVARIABLE, output)) { m_variable = output; } else { diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index 4b935c7f..baba9f0f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -1,5 +1,6 @@ #include "legopathpresenter.h" +#include "define.h" #include "legopathcontroller.h" #include "legovideomanager.h" #include "legoworld.h" @@ -10,10 +11,6 @@ DECOMP_SIZE_ASSERT(LegoPathPresenter, 0x54) -// STRING: LEGO1 0x10101ef0 -// GLOBAL: LEGO1 0x101020c4 -const char* g_triggersSource = "TRIGGERS_SOURCE"; - // FUNCTION: LEGO1 0x100448d0 LegoPathPresenter::LegoPathPresenter() { @@ -132,7 +129,7 @@ void LegoPathPresenter::ParseExtra() strupr(extraCopy); - if (KeyValueStringParse(output, g_triggersSource, extraCopy) != FALSE) { + if (KeyValueStringParse(output, g_strTRIGGERS_SOURCE, extraCopy) != FALSE) { m_trigger = MxAtomId(output, e_lowerCase2); } } diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 974c2e16..79c481c4 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -24,14 +24,6 @@ DECOMP_SIZE_ASSERT(LegoModelPresenter, 0x6c) // GLOBAL: LEGO1 0x100f7ae0 MxS32 g_modelPresenterConfig = 1; -// GLOBAL: LEGO1 0x10102054 -// STRING: LEGO1 0x10102018 -char* g_autoCreate = "AUTO_CREATE"; - -// GLOBAL: LEGO1 0x10102078 -// STRING: LEGO1 0x10101fc4 -char* g_dbCreate = "DB_CREATE"; - // FUNCTION: LEGO1 0x1000cca0 void LegoModelPresenter::Destroy() { @@ -310,7 +302,7 @@ void LegoModelPresenter::ParseExtra() memcpy(extraCopy, extraData, extraLength & MAXWORD); extraCopy[extraLength & MAXWORD] = '\0'; - if (KeyValueStringParse(output, g_autoCreate, extraCopy) != 0) { + if (KeyValueStringParse(output, g_strAUTO_CREATE, extraCopy) != 0) { char* token = strtok(output, g_parseExtraTokens); if (m_roi == NULL) { @@ -318,7 +310,7 @@ void LegoModelPresenter::ParseExtra() m_addedToView = FALSE; } } - else if (KeyValueStringParse(output, g_dbCreate, extraCopy) != 0 && m_roi == NULL) { + else if (KeyValueStringParse(output, g_strDB_CREATE, extraCopy) != 0 && m_roi == NULL) { LegoWorld* currentWorld = CurrentWorld(); list& roiList = currentWorld->GetROIList(); diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index f2c8ba6e..53fb3b35 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -14,10 +14,6 @@ DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c); -// GLOBAL: LEGO1 0x101020e0 -// STRING: LEGO1 0x10101eb0 -const char* g_strBmpIsmap = "BMP_ISMAP"; - // FUNCTION: LEGO1 0x100b9c70 void MxStillPresenter::Destroy(MxBool p_fromDestructor) { @@ -218,7 +214,7 @@ void MxStillPresenter::ParseExtra() } } - if (KeyValueStringParse(output, g_strBmpIsmap, extraCopy)) { + if (KeyValueStringParse(output, g_strBMP_ISMAP, extraCopy)) { SetBit4(TRUE); SetBit1(FALSE); SetBit2(FALSE); From 29a0e32739399ee2bc942f630cf388e04b12713c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 14 May 2024 14:50:37 -0400 Subject: [PATCH 38/89] Implement/match remaining LegoHideAnimPresenter functions (#923) * Implement/match remaining LegoHideAnimPresenter functions * Fix type * Fix marker * Fix type --- .../lego/legoomni/include/legoanimpresenter.h | 6 +- .../legoomni/include/legohideanimpresenter.h | 55 +++++++- .../legoomni/src/video/legoanimpresenter.cpp | 10 +- .../src/video/legohideanimpresenter.cpp | 119 ++++++++++++++++-- LEGO1/lego/sources/anim/legoanim.h | 10 +- LEGO1/lego/sources/geom/legowegedge.h | 10 ++ 6 files changed, 188 insertions(+), 22 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 4e51ebb4..a4909b5d 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -26,7 +26,7 @@ struct LegoAnimStruct { MxU32 m_index; // 0x04 }; -typedef map LegoAnimPresenterMap; +typedef map LegoAnimStructMap; typedef map LegoAnimSubstMap; // VTABLE: LEGO1 0x100d90c8 @@ -95,8 +95,8 @@ class LegoAnimPresenter : public MxVideoPresenter { LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2); LegoROI* FUN_100699e0(const LegoChar* p_und); void FUN_10069b10(); - void FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi); - void FUN_1006a4f0(LegoAnimPresenterMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi); + void FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi); + void FUN_1006a4f0(LegoAnimStructMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi); void FUN_1006aa60(); void FUN_1006ab70(); LegoBool FUN_1006aba0(); diff --git a/LEGO1/lego/legoomni/include/legohideanimpresenter.h b/LEGO1/lego/legoomni/include/legohideanimpresenter.h index 7dfab184..0bb652d7 100644 --- a/LEGO1/lego/legoomni/include/legohideanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legohideanimpresenter.h @@ -4,6 +4,20 @@ #include "decomp.h" #include "legoloopinganimpresenter.h" +class LegoPathBoundary; + +struct LegoHideAnimStructComparator { + MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmp(p_a, p_b) < 0; } +}; + +// SIZE 0x08 +struct LegoHideAnimStruct { + LegoPathBoundary* m_boundary; // 0x00 + MxU32 m_index; // 0x04 +}; + +typedef map LegoHideAnimStructMap; + // VTABLE: LEGO1 0x100d9278 // SIZE 0xc4 class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { @@ -36,13 +50,50 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { private: void Init(); void Destroy(MxBool p_fromDestructor); - void FUN_1006db40(undefined4); + 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); + void FUN_1006e470( + LegoHideAnimStructMap& p_map, + LegoAnimNodeData* p_data, + const char* p_name, + LegoPathBoundary* p_boundary + ); - undefined4* m_unk0xc0; // 0xc0 + LegoPathBoundary** m_boundaryMap; // 0xc0 }; +// clang-format off // SYNTHETIC: LEGO1 0x1006d9d0 // LegoHideAnimPresenter::`scalar deleting destructor' +// TEMPLATE: LEGO1 0x1006ddb0 +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::~_Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::iterator::_Inc + +// TEMPLATE: LEGO1 0x1006dec0 +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::erase + +// TEMPLATE: LEGO1 0x1006e310 +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::_Erase + +// TEMPLATE: LEGO1 0x1006e350 +// Map::~Map + +// TEMPLATE: LEGO1 0x1006e3a0 +// map >::~map > + +// TEMPLATE: LEGO1 0x1006e6d0 +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::iterator::_Dec + +// TEMPLATE: LEGO1 0x1006e720 +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::_Insert + +// GLOBAL: LEGO1 0x100f768c +// _Tree,map >::_Kfn,LegoHideAnimStructComparator,allocator >::_Nil +// clang-format on + #endif // LEGOHIDEANIMPRESENTER_H diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 32a8d26f..99aa243d 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -402,7 +402,7 @@ LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar* p_und) // FUNCTION: LEGO1 0x10069b10 void LegoAnimPresenter::FUN_10069b10() { - LegoAnimPresenterMap map; + LegoAnimStructMap map; if (m_unk0x8c != NULL) { memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c)); @@ -419,7 +419,7 @@ void LegoAnimPresenter::FUN_10069b10() m_roiMap = new LegoROI*[map.size() + 1]; memset(m_roiMap, 0, (map.size() + 1) * sizeof(*m_roiMap)); - for (LegoAnimPresenterMap::iterator it = map.begin(); it != map.end();) { + for (LegoAnimStructMap::iterator it = map.begin(); it != map.end();) { MxU32 index = (*it).second.m_index; m_roiMap[index] = (*it).second.m_roi; @@ -441,7 +441,7 @@ void LegoAnimPresenter::FUN_10069b10() } // FUNCTION: LEGO1 0x1006a3c0 -void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi) +void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi) { LegoROI* roi = p_roi; LegoChar* und = NULL; @@ -494,13 +494,13 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* // FUNCTION: LEGO1 0x1006a4f0 void LegoAnimPresenter::FUN_1006a4f0( - LegoAnimPresenterMap& p_map, + LegoAnimStructMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi ) { - LegoAnimPresenterMap::iterator it; + LegoAnimStructMap::iterator it; it = p_map.find(p_und); if (it == p_map.end()) { diff --git a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp index b5d06b82..51e62448 100644 --- a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp @@ -1,10 +1,12 @@ #include "legohideanimpresenter.h" +#include "anim/legoanim.h" #include "legomain.h" #include "legoworld.h" #include "misc.h" DECOMP_SIZE_ASSERT(LegoHideAnimPresenter, 0xc4) +DECOMP_SIZE_ASSERT(LegoHideAnimStruct, 0x08) // FUNCTION: LEGO1 0x1006d7e0 LegoHideAnimPresenter::LegoHideAnimPresenter() @@ -31,7 +33,7 @@ LegoHideAnimPresenter::~LegoHideAnimPresenter() // FUNCTION: LEGO1 0x1006da50 void LegoHideAnimPresenter::Init() { - m_unk0xc0 = NULL; + m_boundaryMap = NULL; } // FUNCTION: LEGO1 0x1006da60 @@ -39,8 +41,8 @@ void LegoHideAnimPresenter::Destroy(MxBool p_fromDestructor) { m_criticalSection.Enter(); - if (m_unk0xc0) { - delete m_unk0xc0; + if (m_boundaryMap) { + delete[] m_boundaryMap; } Init(); @@ -96,18 +98,119 @@ void LegoHideAnimPresenter::StartingTickle() } } -// STUB: LEGO1 0x1006db40 +// FUNCTION: LEGO1 0x1006db40 // FUNCTION: BETA10 0x100531ab -void LegoHideAnimPresenter::FUN_1006db40(undefined4) +void LegoHideAnimPresenter::FUN_1006db40(LegoTime p_time) { - // TODO + FUN_1006db60(m_anim->GetRoot(), p_time); } -// STUB: LEGO1 0x1006dc10 +// FUNCTION: LEGO1 0x1006db60 +// FUNCTION: BETA10 0x100531de +void LegoHideAnimPresenter::FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time) +{ + LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); + MxBool newB = FALSE; + MxBool previousB = FALSE; + + if (m_roiMap != NULL) { + LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; + + if (roi != NULL) { + newB = data->FUN_100a0990(p_time); + previousB = roi->GetVisibility(); + roi->SetVisibility(newB); + } + } + + if (m_boundaryMap != NULL) { + LegoPathBoundary* boundary = m_boundaryMap[data->GetUnknown0x22()]; + + if (boundary != NULL) { + newB = data->FUN_100a0990(p_time); + boundary->GetFlag0x10(); + // TODO: Match + boundary->SetFlag0x10(newB); + } + } + + for (MxS32 i = 0; i < p_node->GetNumChildren(); i++) { + FUN_1006db60(p_node->GetChild(i), p_time); + } +} + +// FUNCTION: LEGO1 0x1006dc10 // FUNCTION: BETA10 0x100532fd void LegoHideAnimPresenter::FUN_1006dc10() { - // TODO + LegoHideAnimStructMap map; + + FUN_1006e3f0(map, m_anim->GetRoot()); + + if (m_boundaryMap != NULL) { + delete[] m_boundaryMap; + } + + m_boundaryMap = new LegoPathBoundary*[map.size() + 1]; + m_boundaryMap[0] = NULL; + + for (LegoHideAnimStructMap::iterator it = map.begin(); !(it == map.end()); it++) { + m_boundaryMap[(*it).second.m_index] = (*it).second.m_boundary; + delete[] const_cast((*it).first); + } +} + +// FUNCTION: LEGO1 0x1006e3f0 +// FUNCTION: BETA10 0x1005345e +void LegoHideAnimPresenter::FUN_1006e3f0(LegoHideAnimStructMap& p_map, LegoTreeNode* p_node) +{ + LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); + const char* name = data->GetName(); + + if (name != NULL) { + LegoPathBoundary* boundary = m_currentWorld->FindPathBoundary(name); + + if (boundary != NULL) { + FUN_1006e470(p_map, data, name, boundary); + } + else { + data->SetUnknown0x22(0); + } + } + + MxS32 count = p_node->GetNumChildren(); + for (MxS32 i = 0; i < count; i++) { + FUN_1006e3f0(p_map, p_node->GetChild(i)); + } +} + +// FUNCTION: LEGO1 0x1006e470 +// FUNCTION: BETA10 0x10053520 +void LegoHideAnimPresenter::FUN_1006e470( + LegoHideAnimStructMap& p_map, + LegoAnimNodeData* p_data, + const char* p_name, + LegoPathBoundary* p_boundary +) +{ + LegoHideAnimStructMap::iterator it; + + it = p_map.find(p_name); + if (it == p_map.end()) { + LegoHideAnimStruct animStruct; + animStruct.m_index = p_map.size() + 1; + animStruct.m_boundary = p_boundary; + + p_data->SetUnknown0x22(animStruct.m_index); + + char* name = new char[strlen(p_name) + 1]; + strcpy(name, p_name); + + p_map[name] = animStruct; + } + else { + p_data->SetUnknown0x22((*it).second.m_index); + } } // FUNCTION: LEGO1 0x1006e9e0 diff --git a/LEGO1/lego/sources/anim/legoanim.h b/LEGO1/lego/sources/anim/legoanim.h index 9dd23a55..ae6f3bb6 100644 --- a/LEGO1/lego/sources/anim/legoanim.h +++ b/LEGO1/lego/sources/anim/legoanim.h @@ -124,13 +124,15 @@ class LegoAnimNodeData : public LegoTreeNodeData { LegoU32 GetRotationIndex() { return m_rotationIndex; } LegoU32 GetScaleIndex() { return m_scaleIndex; } LegoU32 GetMorphIndex() { return m_morphIndex; } - undefined2 GetUnknown0x20() { return m_unk0x20; } + LegoU16 GetUnknown0x20() { return m_unk0x20; } + LegoU16 GetUnknown0x22() { return m_unk0x22; } void SetTranslationIndex(LegoU32 p_translationIndex) { m_translationIndex = p_translationIndex; } void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; } void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; } void SetMorphIndex(LegoU32 p_morphIndex) { m_morphIndex = p_morphIndex; } - void SetUnknown0x20(undefined2 p_unk0x20) { m_unk0x20 = p_unk0x20; } + void SetUnknown0x20(LegoU16 p_unk0x20) { m_unk0x20 = p_unk0x20; } + void SetUnknown0x22(LegoU16 p_unk0x22) { m_unk0x22 = p_unk0x22; } LegoResult CreateLocalTransform(LegoTime p_time, Matrix4& p_matrix) { @@ -190,8 +192,8 @@ class LegoAnimNodeData : public LegoTreeNodeData { LegoRotationKey* m_rotationKeys; // 0x14 LegoScaleKey* m_scaleKeys; // 0x18 LegoMorphKey* m_morphKeys; // 0x1c - undefined2 m_unk0x20; // 0x20 - undefined2 m_unk0x22; // 0x22 + LegoU16 m_unk0x20; // 0x20 + LegoU16 m_unk0x22; // 0x22 LegoU32 m_translationIndex; // 0x24 LegoU32 m_rotationIndex; // 0x28 LegoU32 m_scaleIndex; // 0x2c diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index e34dfcdf..e8a0c396 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -43,6 +43,16 @@ class LegoWEGEdge : public LegoWEEdge { inline Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; } inline LegoChar* GetName() { return m_name; } + inline void SetFlag0x10(LegoU32 p_disable) + { + if (p_disable) { + m_flags &= ~c_bit5; + } + else { + m_flags |= c_bit5; + } + } + // SYNTHETIC: LEGO1 0x1009a7e0 // LegoWEGEdge::`scalar deleting destructor' From 9a05edd0a75df5e88bfb02d4366ec50402d1ec40 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 15 May 2024 14:34:36 -0400 Subject: [PATCH 39/89] Implement/match LegoLoopingAnimPresenter (#924) --- .../lego/legoomni/include/legoanimpresenter.h | 2 +- .../legoomni/src/paths/legopathpresenter.cpp | 2 +- .../legoomni/src/video/legoanimpresenter.cpp | 4 +- .../src/video/legoloopinganimpresenter.cpp | 81 ++++++++++++++++++- LEGO1/omni/include/mxdschunk.h | 18 ++--- LEGO1/omni/src/audio/mxwavepresenter.cpp | 7 +- LEGO1/omni/src/common/mxmediapresenter.cpp | 6 +- LEGO1/omni/src/stream/mxdsbuffer.cpp | 6 +- LEGO1/omni/src/stream/mxdschunk.cpp | 2 +- LEGO1/omni/src/stream/mxdssubscriber.cpp | 2 +- LEGO1/omni/src/stream/mxramstreamprovider.cpp | 10 +-- LEGO1/omni/src/stream/mxstreamchunk.cpp | 2 +- LEGO1/omni/src/stream/mxstreamcontroller.cpp | 2 +- .../omni/src/video/mxloopingflcpresenter.cpp | 2 +- .../omni/src/video/mxloopingsmkpresenter.cpp | 2 +- LEGO1/omni/src/video/mxvideopresenter.cpp | 2 +- 16 files changed, 111 insertions(+), 39 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index a4909b5d..09fd00a8 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -119,7 +119,7 @@ class LegoAnimPresenter : public MxVideoPresenter { LegoROI** m_unk0x8c; // 0x8c char** m_unk0x90; // 0x90 MxU8 m_unk0x94; // 0x94 - undefined m_unk0x95; // 0x95 + MxBool m_unk0x95; // 0x95 MxBool m_unk0x96; // 0x96 undefined m_unk0x97; // 0x97 LegoAnimSubstMap* m_substMap; // 0x98 diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index baba9f0f..f5cb137b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -97,7 +97,7 @@ void LegoPathPresenter::StreamingTickle() MxStreamChunk* chunk = m_subscriber->PopData(); if (chunk) { - if (chunk->GetFlags() & MxStreamChunk::c_end) { + if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { ProgressTickleState(e_repeating); } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 99aa243d..747cbf4e 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -53,7 +53,7 @@ void LegoAnimPresenter::Init() m_unk0xa8.Clear(); m_unk0xa4 = 0; m_currentWorld = NULL; - m_unk0x95 = 0; + m_unk0x95 = FALSE; m_worldId = -1; m_substMap = NULL; m_worldAtom.Clear(); @@ -806,7 +806,7 @@ void LegoAnimPresenter::StreamingTickle() } else { if (m_action->GetElapsedTime() > m_anim->GetDuration() + m_action->GetStartTime()) { - m_unk0x95 = 1; + m_unk0x95 = TRUE; } } } diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index dea9aa45..eaba5d98 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -1,15 +1,88 @@ #include "legoloopinganimpresenter.h" +#include "anim/legoanim.h" +#include "legocameracontroller.h" +#include "legoworld.h" +#include "mxcompositepresenter.h" +#include "mxdsaction.h" +#include "mxdssubscriber.h" + DECOMP_SIZE_ASSERT(LegoLoopingAnimPresenter, 0xc0) -// STUB: LEGO1 0x1006caa0 +// FUNCTION: LEGO1 0x1006caa0 +// FUNCTION: BETA10 0x1005223d void LegoLoopingAnimPresenter::StreamingTickle() { - // TODO + if (m_subscriber->PeekData()) { + MxStreamChunk* chunk = m_subscriber->PopData(); + m_subscriber->FreeDataChunk(chunk); + } + + if (m_unk0x95) { + ProgressTickleState(e_done); + if (m_compositePresenter) { + if (m_compositePresenter->IsA("LegoAnimMMPresenter")) { + m_compositePresenter->VTable0x60(this); + } + } + } + else { + if (m_action->GetDuration() != -1) { + if (m_action->GetElapsedTime() > m_action->GetDuration() + m_action->GetStartTime()) { + m_unk0x95 = TRUE; + } + } + } } -// STUB: LEGO1 0x1006cb40 +// FUNCTION: LEGO1 0x1006cb40 +// FUNCTION: BETA10 0x1005239a void LegoLoopingAnimPresenter::PutFrame() { - // TODO + MxLong time; + + if (m_action->GetStartTime() <= m_action->GetElapsedTime()) { + time = (m_action->GetElapsedTime() - m_action->GetStartTime()) % m_anim->GetDuration(); + } + else { + time = 0; + } + + FUN_1006b9a0(m_anim, time, m_unk0x78); + + if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) { + for (MxS32 i = 0; i < m_unk0x94; i++) { + if (m_unk0x8c[i] != NULL) { + MxMatrix mat(m_unk0x8c[i]->GetLocal2World()); + + Vector3 pos(mat[0]); + Vector3 dir(mat[1]); + Vector3 up(mat[2]); + Vector3 und(mat[3]); + + float possqr = sqrt(pos.LenSquared()); + float dirsqr = sqrt(dir.LenSquared()); + float upsqr = sqrt(up.LenSquared()); + + up = und; + +#ifdef COMPAT_MODE + Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation(); + ((Vector3&) up).Sub(&location); +#else + ((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation()); +#endif + ((Vector3&) dir).Div(dirsqr); + pos.EqualsCross(&dir, &up); + pos.Unitize(); + up.EqualsCross(&pos, &dir); + ((Vector3&) pos).Mul(possqr); + ((Vector3&) dir).Mul(dirsqr); + ((Vector3&) up).Mul(upsqr); + + m_unk0x8c[i]->FUN_100a58f0(mat); + m_unk0x8c[i]->VTable0x14(); + } + } + } } diff --git a/LEGO1/omni/include/mxdschunk.h b/LEGO1/omni/include/mxdschunk.h index c21816e6..10ed9b8b 100644 --- a/LEGO1/omni/include/mxdschunk.h +++ b/LEGO1/omni/include/mxdschunk.h @@ -5,18 +5,16 @@ #include "mxcore.h" #include "mxtypes.h" +#define DS_CHUNK_BIT1 0x01 +#define DS_CHUNK_END_OF_STREAM 0x02 +#define DS_CHUNK_BIT3 0x04 +#define DS_CHUNK_SPLIT 0x10 +#define DS_CHUNK_BIT16 0x8000 + // VTABLE: LEGO1 0x100dc7f8 // SIZE 0x1c class MxDSChunk : public MxCore { public: - enum { - c_bit1 = 0x01, - c_end = 0x02, - c_bit3 = 0x04, - c_split = 0x10, - c_bit16 = 0x8000 - }; - MxDSChunk(); ~MxDSChunk() override; @@ -39,13 +37,13 @@ class MxDSChunk : public MxCore { inline static MxU32 Size(MxU32 p_dataSize) { return (p_dataSize & 1) + p_dataSize + 8; } inline static MxU8* End(MxU8* p_buffer) { return p_buffer + Size(*IntoLength(p_buffer)); } - inline void SetFlags(MxU16 p_flags) { m_flags = p_flags; } + inline void SetChunkFlags(MxU16 p_flags) { m_flags = p_flags; } inline void SetObjectId(undefined4 p_objectid) { m_objectId = p_objectid; } inline void SetTime(MxLong p_time) { m_time = p_time; } inline void SetLength(MxU32 p_length) { m_length = p_length; } inline void SetData(MxU8* p_data) { m_data = p_data; } - inline MxU16 GetFlags() { return m_flags; } + inline MxU16 GetChunkFlags() { return m_flags; } inline undefined4 GetObjectId() { return m_objectId; } inline MxLong GetTime() { return m_time; } inline MxU32 GetLength() { return m_length; } diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index de113a7a..bc6f0683 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -192,8 +192,9 @@ void MxWavePresenter::StreamingTickle() if (!(m_action->GetFlags() & MxDSAction::c_looping)) { MxStreamChunk* chunk = CurrentChunk(); - if (chunk && chunk->GetFlags() & MxDSChunk::c_end && !(chunk->GetFlags() & MxDSChunk::c_bit16)) { - chunk->SetFlags(chunk->GetFlags() | MxDSChunk::c_bit16); + if (chunk && chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM && + !(chunk->GetChunkFlags() & DS_CHUNK_BIT16)) { + chunk->SetChunkFlags(chunk->GetChunkFlags() | DS_CHUNK_BIT16); m_currentChunk = new MxStreamChunk; MxU8* data = new MxU8[m_chunkLength]; @@ -203,7 +204,7 @@ void MxWavePresenter::StreamingTickle() m_currentChunk->SetLength(m_chunkLength); m_currentChunk->SetData(data); m_currentChunk->SetTime(chunk->GetTime() + 1000); - m_currentChunk->SetFlags(MxDSChunk::c_bit1); + m_currentChunk->SetChunkFlags(DS_CHUNK_BIT1); } } diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index 4a322b33..462b8987 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -67,7 +67,7 @@ MxStreamChunk* MxMediaPresenter::CurrentChunk() if (m_subscriber) { chunk = m_subscriber->PeekData(); - if (chunk && chunk->GetFlags() & MxDSChunk::c_bit3) { + if (chunk && chunk->GetChunkFlags() & DS_CHUNK_BIT3) { m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_bit7); m_subscriber->PopData(); m_subscriber->FreeDataChunk(chunk); @@ -87,7 +87,7 @@ MxStreamChunk* MxMediaPresenter::NextChunk() if (m_subscriber) { chunk = m_subscriber->PopData(); - if (chunk && chunk->GetFlags() & MxDSChunk::c_bit3) { + if (chunk && chunk->GetChunkFlags() & DS_CHUNK_BIT3) { m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_bit7); m_subscriber->FreeDataChunk(chunk); chunk = NULL; @@ -180,7 +180,7 @@ void MxMediaPresenter::StreamingTickle() m_currentChunk = NextChunk(); if (m_currentChunk) { - if (m_currentChunk->GetFlags() & MxDSChunk::c_end) { + if (m_currentChunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { m_subscriber->FreeDataChunk(m_currentChunk); m_currentChunk = NULL; ProgressTickleState(e_repeating); diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 450673f7..e5e69c55 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -242,7 +242,7 @@ MxResult MxDSBuffer::ParseChunk( p_header->SetTime(p_header->GetTime() + m_unk0x30->GetUnknowna8()); - if (p_header->GetFlags() & MxDSChunk::c_split) { + if (p_header->GetChunkFlags() & DS_CHUNK_SPLIT) { MxU32 length = p_header->GetLength() + MxDSChunk::GetHeaderSize() + 8; MxDSBuffer* buffer = new MxDSBuffer(); @@ -252,7 +252,7 @@ MxResult MxDSBuffer::ParseChunk( if (*p_streamingAction) { MxU16* flags = MxStreamChunk::IntoFlags(buffer->GetBuffer()); - *flags = p_header->GetFlags() & ~MxDSChunk::c_split; + *flags = p_header->GetChunkFlags() & ~DS_CHUNK_SPLIT; delete p_header; (*p_streamingAction)->SetUnknowna0(buffer); @@ -268,7 +268,7 @@ MxResult MxDSBuffer::ParseChunk( return FAILURE; } else { - if (p_header->GetFlags() & MxDSChunk::c_end) { + if (p_header->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { if (m_unk0x30->HasId(p_header->GetObjectId())) { if (m_unk0x30->GetFlags() & MxDSAction::c_bit3 && (m_unk0x30->GetLoopCount() > 1 || m_unk0x30->GetDuration() == -1)) { diff --git a/LEGO1/omni/src/stream/mxdschunk.cpp b/LEGO1/omni/src/stream/mxdschunk.cpp index a964d0fa..60dfb10e 100644 --- a/LEGO1/omni/src/stream/mxdschunk.cpp +++ b/LEGO1/omni/src/stream/mxdschunk.cpp @@ -15,7 +15,7 @@ MxDSChunk::MxDSChunk() // FUNCTION: LEGO1 0x100be170 MxDSChunk::~MxDSChunk() { - if (m_flags & c_bit1) { + if (m_flags & DS_CHUNK_BIT1) { delete[] m_data; } } diff --git a/LEGO1/omni/src/stream/mxdssubscriber.cpp b/LEGO1/omni/src/stream/mxdssubscriber.cpp index 18832493..8900ff69 100644 --- a/LEGO1/omni/src/stream/mxdssubscriber.cpp +++ b/LEGO1/omni/src/stream/mxdssubscriber.cpp @@ -130,7 +130,7 @@ void MxDSSubscriber::FreeDataChunk(MxStreamChunk* p_chunk) delete p_chunk; } } - else if (p_chunk->GetFlags() & MxDSChunk::c_bit1 && p_chunk) { + else if (p_chunk->GetChunkFlags() & DS_CHUNK_BIT1 && p_chunk) { delete p_chunk; } } diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index ec06f90b..55d282b3 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -126,15 +126,15 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size) data += MxDSChunk::Size(*psize); if ((*MxDSChunk::IntoType(data2) == FOURCC('M', 'x', 'C', 'h')) && - (*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_split)) { + (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_SPLIT)) { if (*MxStreamChunk::IntoObjectId(data2) == *MxStreamChunk::IntoObjectId(data3) && - (*MxStreamChunk::IntoFlags(data3) & MxDSChunk::c_split) && + (*MxStreamChunk::IntoFlags(data3) & DS_CHUNK_SPLIT) && *MxStreamChunk::IntoTime(data2) == *MxStreamChunk::IntoTime(data3)) { MxDSBuffer::Append(data2, data3); continue; } else { - *MxStreamChunk::IntoFlags(data2) &= ~MxDSChunk::c_split; + *MxStreamChunk::IntoFlags(data2) &= ~DS_CHUNK_SPLIT; } } @@ -142,7 +142,7 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size) memcpy(data2, data3, MxDSChunk::Size(*psize)); if (*MxStreamChunk::IntoObjectId(data2) == id && - (*MxStreamChunk::IntoFlags(data2) & MxDSChunk::c_end)) { + (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_END_OF_STREAM)) { break; } } @@ -157,6 +157,6 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size) } while (data < end); } - *MxStreamChunk::IntoFlags(data2) &= ~MxDSChunk::c_split; + *MxStreamChunk::IntoFlags(data2) &= ~DS_CHUNK_SPLIT; return MxDSChunk::End(data2) - p_buffer; } diff --git a/LEGO1/omni/src/stream/mxstreamchunk.cpp b/LEGO1/omni/src/stream/mxstreamchunk.cpp index 7289b3e2..98503096 100644 --- a/LEGO1/omni/src/stream/mxstreamchunk.cpp +++ b/LEGO1/omni/src/stream/mxstreamchunk.cpp @@ -61,7 +61,7 @@ MxResult MxStreamChunk::SendChunk(MxStreamListMxDSSubscriber& p_subscriberList, { for (MxStreamListMxDSSubscriber::iterator it = p_subscriberList.begin(); it != p_subscriberList.end(); it++) { if ((*it)->GetObjectId() == m_objectId && (*it)->GetUnknown48() == p_obj24val) { - if (m_flags & MxDSChunk::c_end && m_buffer) { + if (m_flags & DS_CHUNK_END_OF_STREAM && m_buffer) { m_buffer->ReleaseRef(this); m_buffer = NULL; } diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index 4b76abf2..88db08d6 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -284,7 +284,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) return FAILURE; } - chunk->SetFlags(MxDSChunk::c_bit3); + chunk->SetChunkFlags(DS_CHUNK_BIT3); chunk->SetObjectId(objectId); if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) { diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index b8d98dfb..a828296c 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -43,7 +43,7 @@ void MxLoopingFlcPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::c_end) { + if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { ProgressTickleState(e_repeating); } else { diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index 499fb075..ca043243 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -53,7 +53,7 @@ void MxLoopingSmkPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::c_end) { + if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { ProgressTickleState(e_repeating); } else { diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 02adeb01..c94e656c 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -180,7 +180,7 @@ void MxVideoPresenter::NextFrame() { MxStreamChunk* chunk = NextChunk(); - if (chunk->GetFlags() & MxDSChunk::c_end) { + if (chunk->GetChunkFlags() & DS_CHUNK_END_OF_STREAM) { m_subscriber->FreeDataChunk(chunk); ProgressTickleState(e_repeating); } From 3c89cbe4e1ef2240436ae7c4a852a84a4a95a25e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 15 May 2024 15:29:00 -0400 Subject: [PATCH 40/89] Implement/match LegoLocomotionAnimPresenter (#925) --- .../include/legolocomotionanimpresenter.h | 13 ++-- LEGO1/lego/legoomni/include/legoroimaplist.h | 55 ++++++++++++++++ .../src/video/legolocomotionanimpresenter.cpp | 65 +++++++++++++++---- 3 files changed, 116 insertions(+), 17 deletions(-) create mode 100644 LEGO1/lego/legoomni/include/legoroimaplist.h diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index b70841ea..1a06ab35 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -2,6 +2,7 @@ #define LEGOLOCOMOTIONANIMPRESENTER_H #include "legoloopinganimpresenter.h" +#include "legoroimaplist.h" // VTABLE: LEGO1 0x100d9170 // SIZE 0xd8 @@ -50,12 +51,12 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { void Init(); void Destroy(MxBool p_fromDestructor); - undefined4 m_unk0xc0; // 0xc0 - undefined4* m_unk0xc4; // 0xc4 - MxCore* m_unk0xc8; // 0xc8 - MxS32 m_unk0xcc; // 0xcc - MxS32 m_unk0xd0; // 0xd0 - undefined2 m_unk0xd4; // 0xd4 + undefined4 m_unk0xc0; // 0xc0 + undefined4* m_unk0xc4; // 0xc4 + LegoROIMapList* m_roiMapList; // 0xc8 + MxS32 m_unk0xcc; // 0xcc + MxS32 m_unk0xd0; // 0xd0 + undefined2 m_unk0xd4; // 0xd4 }; #endif // LEGOLOCOMOTIONANIMPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legoroimaplist.h b/LEGO1/lego/legoomni/include/legoroimaplist.h new file mode 100644 index 00000000..697c2dd8 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legoroimaplist.h @@ -0,0 +1,55 @@ +#ifndef LEGOROIMAPLIST_H +#define LEGOROIMAPLIST_H + +#include "mxlist.h" +#include "mxtypes.h" + +class LegoROI; + +// VTABLE: LEGO1 0x100d9218 +// class MxCollection + +// VTABLE: LEGO1 0x100d9230 +// class MxList + +// VTABLE: LEGO1 0x100d9248 +// class MxPtrList + +// VTABLE: LEGO1 0x100d9260 +// SIZE 0x18 +class LegoROIMapList : public MxPtrList { +public: + LegoROIMapList() : MxPtrList(TRUE) {} + + // SYNTHETIC: LEGO1 0x1006d360 + // LegoROIMapList::`scalar deleting destructor' +}; + +// TEMPLATE: LEGO1 0x1006d250 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x1006d260 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x1006d2b0 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x1006d2c0 +// MxList::~MxList + +// TEMPLATE: LEGO1 0x1006d3d0 +// MxPtrList::~MxPtrList + +// TEMPLATE: LEGO1 0x1006d350 +// MxPtrList::Destroy + +// SYNTHETIC: LEGO1 0x1006d420 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1006d490 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1006d540 +// MxPtrList::`scalar deleting destructor' + +#endif // LEGOROIMAPLIST_H diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index a5302e47..90b6533e 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -1,8 +1,14 @@ #include "legolocomotionanimpresenter.h" +#include "anim/legoanim.h" +#include "legoanimactor.h" #include "legomain.h" #include "legoworld.h" #include "misc.h" +#include "mxautolock.h" +#include "mxdssubscriber.h" +#include "mxmisc.h" +#include "mxvariabletable.h" DECOMP_SIZE_ASSERT(LegoLocomotionAnimPresenter, 0xd8) @@ -22,10 +28,10 @@ LegoLocomotionAnimPresenter::~LegoLocomotionAnimPresenter() void LegoLocomotionAnimPresenter::Init() { m_unk0xc0 = 0; - m_unk0xc4 = 0; + m_unk0xc4 = NULL; m_unk0xcc = -1; m_unk0xd0 = -1; - m_unk0xc8 = 0; + m_roiMapList = NULL; m_unk0xd4 = 0; } @@ -38,8 +44,8 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor) delete[] m_unk0xc4; } - if (m_unk0xc8) { - delete m_unk0xc8; + if (m_roiMapList) { + delete m_roiMapList; } m_roiMap = NULL; @@ -48,7 +54,7 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor) m_criticalSection.Leave(); if (!p_fromDestructor) { - LegoAnimPresenter::Destroy(); + LegoLoopingAnimPresenter::Destroy(); } } @@ -59,10 +65,17 @@ MxResult LegoLocomotionAnimPresenter::CreateAnim(MxStreamChunk* p_chunk) return result == SUCCESS ? SUCCESS : result; } -// STUB: LEGO1 0x1006d160 +// FUNCTION: LEGO1 0x1006d160 +// FUNCTION: BETA10 0x100528c7 MxResult LegoLocomotionAnimPresenter::AddToManager() { - return MxVideoPresenter::AddToManager(); + m_roiMapList = new LegoROIMapList(); + + if (m_roiMapList == NULL) { + return FAILURE; + } + + return LegoAnimPresenter::AddToManager(); } // FUNCTION: LEGO1 0x1006d5b0 @@ -92,10 +105,18 @@ void LegoLocomotionAnimPresenter::ReadyTickle() } } -// STUB: LEGO1 0x1006d610 +// FUNCTION: LEGO1 0x1006d610 +// FUNCTION: BETA10 0x10052a34 void LegoLocomotionAnimPresenter::StartingTickle() { - // TODO + if (m_subscriber->PeekData()) { + MxStreamChunk* chunk = m_subscriber->PopData(); + m_subscriber->FreeDataChunk(chunk); + } + + if (m_roiMapList->GetCount() != 0) { + ProgressTickleState(e_streaming); + } } // FUNCTION: LEGO1 0x1006d660 @@ -114,8 +135,30 @@ void LegoLocomotionAnimPresenter::EndAction() } } -// STUB: LEGO1 0x1006d680 +// FUNCTION: LEGO1 0x1006d680 +// FUNCTION: BETA10 0x10052b3d void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value) { - // TODO + AUTOLOCK(m_criticalSection); + + MxVariableTable* variableTable = VariableTable(); + + const char* key = ((LegoAnimNodeData*) m_anim->GetRoot()->GetData())->GetName(); + variableTable->SetVariable(key, p_actor->GetROI()->GetName()); + + FUN_100695c0(); + FUN_10069b10(); + + if (m_roiMap != NULL) { + m_roiMapList->Append(m_roiMap); + p_actor->FUN_1001c450(m_anim, p_value, m_roiMap, m_roiMapSize); + m_roiMap = NULL; + } + + variableTable->SetVariable(key, ""); + + if (m_unk0x70 != NULL) { + delete m_unk0x70; + m_unk0x70 = NULL; + } } From 4419007355945bc1700155ec3e5cdc46c6a40194 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 16 May 2024 15:36:52 -0400 Subject: [PATCH 41/89] Replace magic values with script actions --- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index ee3b6177..0bc064b5 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -144,7 +144,7 @@ MxU32 Helicopter::VTable0xcc() } VTable0xe0(); - InvokeAction(Extra::ActionType::e_start, m_script, 0x15, NULL); + InvokeAction(Extra::ActionType::e_start, m_script, IsleScript::c_HelicopterDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); return 1; @@ -191,7 +191,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) state->SetUnknown18(4); m_state->SetUnknown8(1); m_world->RemovePathActor(this); - InvokeAction(Extra::ActionType::e_start, script, 0x20, NULL); + InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL); SetState(0); } ret = 1; @@ -204,7 +204,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) if (m_state->GetUnkown8() == 2) { m_state->SetUnknown8(3); m_world->RemovePathActor(this); - InvokeAction(Extra::ActionType::e_start, script, 0x21, NULL); + InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterLand_Anim, NULL); SetState(4); } ret = 1; From 02c4aad33e967a7ec0c647f00b5c55e5a5448f24 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 10:05:06 -0400 Subject: [PATCH 42/89] Implement/match LegoAnimationManager::FUN_10064b50 (#926) --- .../legoomni/include/legoanimationmanager.h | 3 +- LEGO1/lego/legoomni/include/legotraninfo.h | 1 + .../src/common/legoanimationmanager.cpp | 40 ++++++++++++++++++- LEGO1/mxgeometry/mxgeometry3d.h | 6 ++- LEGO1/mxgeometry/mxmatrix.h | 2 - 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 30d72d41..ac85dd89 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -188,7 +188,8 @@ class LegoAnimationManager : public MxCore { MxBool m_suspended; // 0x42b LegoTranInfo* m_unk0x42c; // 0x42c MxBool m_unk0x430; // 0x430 - undefined4 m_unk0x434[2]; // 0x434 + MxLong m_unk0x434; // 0x434 + MxLong m_unk0x438; // 0x438 MxMatrix m_unk0x43c; // 0x43c MxMatrix m_unk0x484; // 0x484 UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc diff --git a/LEGO1/lego/legoomni/include/legotraninfo.h b/LEGO1/lego/legoomni/include/legotraninfo.h index 3ded0903..aa35f31c 100644 --- a/LEGO1/lego/legoomni/include/legotraninfo.h +++ b/LEGO1/lego/legoomni/include/legotraninfo.h @@ -13,6 +13,7 @@ class MxPresenter; // SIZE 0x78 struct LegoTranInfo { enum { + c_bit1 = 0x01, c_bit2 = 0x02 }; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 812d9d93..c82a12e5 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1,5 +1,6 @@ #include "legoanimationmanager.h" +#include "3dmanager/lego3dmanager.h" #include "anim/legoanim.h" #include "animstate.h" #include "define.h" @@ -13,6 +14,7 @@ #include "legomain.h" #include "legonavcontroller.h" #include "legoroilist.h" +#include "legosoundmanager.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" @@ -25,6 +27,7 @@ #include "viewmanager/viewmanager.h" #include +#include DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500) DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) @@ -1863,9 +1866,42 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) // TODO } -// STUB: LEGO1 0x10064b50 +// FUNCTION: LEGO1 0x10064b50 // FUNCTION: BETA10 0x10045f14 void LegoAnimationManager::FUN_10064b50(MxLong p_time) { - // TODO + if (m_unk0x430 && m_unk0x42c != NULL) { + MxMatrix mat; + + if (p_time < 0 || p_time <= m_unk0x438) { + m_unk0x430 = FALSE; + m_unk0x42c->m_flags &= ~LegoTranInfo::c_bit1; + m_unk0x42c = NULL; + mat = m_unk0x484; + } + else { + float und = (float) (p_time - m_unk0x434) / (float) (m_unk0x438 - m_unk0x434); + + float sub[3]; + sub[0] = (m_unk0x484[3][0] - m_unk0x43c[3][0]) * und; + sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und; + sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und; + + m_unk0x4cc.Unknown_100040a0(mat, (float) (p_time - m_unk0x434) / 1000.0f); + + VPV3(mat[3], m_unk0x43c[3], sub); + mat[3][4] = 1.0f; + } + + LegoROI* viewROI = VideoManager()->GetViewROI(); + + viewROI->WrappedSetLocalTransform(mat); + VideoManager()->Get3DManager()->Moved(*viewROI); + SoundManager()->FUN_1002a410( + viewROI->GetWorldPosition(), + viewROI->GetWorldDirection(), + viewROI->GetWorldUp(), + viewROI->GetWorldVelocity() + ); + } } diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index a214e25a..bd4cc24a 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -100,6 +100,7 @@ class UnknownMx4DPointFloat { undefined4 m_unk0x30; // 0x30 }; +// FUNCTION: BETA10 0x1004aaa0 int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) { float data[4]; @@ -114,6 +115,7 @@ int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) } // FUNCTION: LEGO1 0x100040a0 +// FUNCTION: BETA10 0x1004ab10 inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) { undefined4 state = m_unk0x30; @@ -136,7 +138,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) if (1.0 - d1 > 0.00001) { double d = acos(d1); sin(d); - d1 = sin((1 - p_f) * d) / sin(d); + d1 = sin((1.0 - p_f) * d) / sin(d); d2 = sin(p_f * d) / sin(d); } else { @@ -150,7 +152,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) } else { p_v[0] = -m_unk0x00[1]; - p_v[1] = m_unk0x00[1]; + p_v[1] = m_unk0x00[0]; p_v[2] = -m_unk0x00[3]; p_v[3] = m_unk0x00[2]; d1 = sin((1.0 - p_f) * 1.570796326794895); diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index f6d0cece..916abda7 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -21,8 +21,6 @@ class MxMatrix : public Matrix4 { // FUNCTION: LEGO1 0x10002850 void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 - // No idea why there's another equals. Maybe to some other type like the - // DirectX Retained Mode Matrix type which is also a float* alias? // FUNCTION: LEGO1 0x10002860 virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48 From ed782980ec1b06f65d735b5e3cce112f30348566 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 10:20:04 -0400 Subject: [PATCH 43/89] Implement/match LegoAnimationManager::FUN_10063d10 (#927) --- .../legoomni/include/legoanimationmanager.h | 4 +- .../src/common/legoanimationmanager.cpp | 40 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index ac85dd89..78dfa737 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -32,7 +32,7 @@ class LegoAnimationManager : public MxCore { MxBool m_unk0x07; // 0x07 MxBool m_unk0x08; // 0x08 MxBool m_unk0x09; // 0x09 - MxU32 m_unk0x0c; // 0x0c + MxS32 m_unk0x0c; // 0x0c MxS32 m_unk0x10; // 0x10 MxBool m_active; // 0x14 MxU8 m_unk0x15; // 0x15 @@ -51,7 +51,7 @@ class LegoAnimationManager : public MxCore { LegoROI* m_roi; // 0x00 MxS32 m_characterId; // 0x04 MxLong m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0c; // 0x0c MxBool m_unk0x0d; // 0x0d float m_unk0x10; // 0x10 MxBool m_unk0x14; // 0x14 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index c82a12e5..95b8963c 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1824,11 +1824,47 @@ MxBool LegoAnimationManager::FUN_10063b90( return TRUE; } -// STUB: LEGO1 0x10063d10 +// FUNCTION: LEGO1 0x10063d10 // FUNCTION: BETA10 0x10045034 void LegoAnimationManager::FUN_10063d10() { - // TODO + if (CurrentWorld() != NULL) { + MxLong time = Timer()->GetTime(); + + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; + + if (roi != NULL) { + if (m_extras[i].m_unk0x0c && g_characters[m_extras[i].m_characterId].m_unk0x0c >= 0 && + g_characters[m_extras[i].m_characterId].m_unk0x0c < time - m_extras[i].m_unk0x08) { + + m_extras[i].m_unk0x0c = FALSE; + + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL) { + float speed = m_extras[i].m_unk0x10; + + if (speed < 0.0f) { + if (m_extras[i].m_unk0x14) { + speed = ((float) (rand() * 1.5) / 32767.0f) + 0.9; + } + else { + speed = ((float) (rand() * 1.4) / 32767.0f) + 0.6; + } + } + + actor->SetWorldSpeed(speed); + } + } + else { + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL) { + actor->Restart(); + } + } + } + } + } } // STUB: LEGO1 0x10063fb0 From 710f07e632f2e65918ecccc87f8d2e78e2060842 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 14:21:48 -0400 Subject: [PATCH 44/89] Implement/match LegoAnimationManager::FUN_10064380 (#928) * Implement/match LegoAnimationManager::FUN_10064380 * Fix naming * Revert --- .../legoomni/include/legoanimationmanager.h | 17 +- LEGO1/lego/legoomni/include/legoextraactor.h | 3 +- .../src/common/legoanimationmanager.cpp | 303 +++++++++++++++++- .../legoomni/src/paths/legoextraactor.cpp | 4 +- 4 files changed, 317 insertions(+), 10 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 78dfa737..3e362e5a 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -36,7 +36,7 @@ class LegoAnimationManager : public MxCore { MxS32 m_unk0x10; // 0x10 MxBool m_active; // 0x14 MxU8 m_unk0x15; // 0x15 - MxU8 m_unk0x16; // 0x16 + MxS8 m_unk0x16; // 0x16 }; // SIZE 0x08 @@ -53,7 +53,7 @@ class LegoAnimationManager : public MxCore { MxLong m_unk0x08; // 0x08 MxBool m_unk0x0c; // 0x0c MxBool m_unk0x0d; // 0x0d - float m_unk0x10; // 0x10 + float m_speed; // 0x10 MxBool m_unk0x14; // 0x14 }; @@ -150,6 +150,19 @@ class LegoAnimationManager : public MxCore { void FUN_10063d10(); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool, MxBool); + MxResult FUN_10064380( + const char* p_name, + const char* p_boundaryName, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale, + MxU32 p_undIdx1, + MxS32 p_unk0x0c, + MxU32 p_undIdx2, + MxS32 p_unk0x10, + float p_speed + ); void FUN_100648f0(LegoTranInfo*, MxLong); void FUN_10064b50(MxLong p_time); diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index d2c846f3..ea3fdeb1 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -49,7 +49,8 @@ class LegoExtraActor : public virtual LegoAnimActor { MxResult WaitForAnimation() override; // vtable+0x9c void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4 void VTable0xc4() override; // vtable+0xc4 - virtual MxResult VTable0xc8(); // vtable+0xc8 + + virtual MxResult FUN_1002aae0(); void Restart(); inline void FUN_1002ad8a(); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 95b8963c..a8bcc375 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -11,6 +11,7 @@ #include "legoendanimnotificationparam.h" #include "legoextraactor.h" #include "legogamestate.h" +#include "legolocomotionanimpresenter.h" #include "legomain.h" #include "legonavcontroller.h" #include "legoroilist.h" @@ -49,6 +50,197 @@ LegoAnimationManager::Vehicle g_vehicles[] = { {"board", 0, FALSE} }; +// GLOBAL: LEGO1 0x100f6d58 +const char* g_unk0x100f6d58[11][17] = { + {"CNs001xx", + "CNs002xx", + "CNs003xx", + "CNs004xx", + "CNs005xx", + "CNs007xx", + "CNs006xx", + "CNs008xx", + "CNs009xx", + "CNs010xx", + "CNs011xx", + "CNs012xx", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001Pe", + "CNs002Pe", + "CNs003Pe", + "CNs004Pe", + "CNs005Pe", + "CNs007Pe", + "CNs006Pe", + "CNs008Pe", + "CNs009Pe", + "CNs010Pe", + "CNs001sk", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001Ma", + "CNs002Ma", + "CNs003Ma", + "CNs004Ma", + "CNs005Ma", + "CNs007Ma", + "CNs006Ma", + "CNs008Ma", + "CNs009Ma", + "CNs010Ma", + "CNs0x4Ma", + NULL, + NULL, + "CNs011Ma", + "CNs012Ma", + "CNs013Ma", + NULL}, + {"CNs001Pa", + "CNs002Pa", + "CNs003Pa", + "CNs004Pa", + "CNs005Pa", + "CNs007Pa", + "CNs006Pa", + "CNs008Pa", + "CNs009Pa", + "CNs010Pa", + "CNs0x4Pa", + NULL, + NULL, + "CNs011Pa", + "CNs012Pa", + "CNs013Pa", + NULL}, + {"CNs001Ni", + "CNs002Ni", + "CNs003Ni", + "CNs004Ni", + "CNs005Ni", + "CNs007Ni", + "CNs006Ni", + "CNs008Ni", + "CNs009Ni", + "CNs010Ni", + "CNs011Ni", + "CNsx11Ni", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001La", + "CNs002La", + "CNs003La", + "CNs004La", + "CNs005La", + "CNs007La", + "CNs006La", + "CNs008La", + "CNs009La", + "CNs010La", + "CNs011La", + "CNsx11La", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001Br", + "CNs002Br", + "CNs003Br", + "CNs004Br", + "CNs005Br", + "CNs007Br", + "CNs006Br", + "CNs008Br", + "CNs009Br", + "CNs010Br", + "CNs011Br", + "CNs900Br", + "CNs901Br", + "CNs011Br", + "CNs012Br", + "CNs013Br", + "CNs014Br"}, + {"CNs001xx", + "CNs002xx", + "CNs003xx", + "CNs004xx", + "CNs005xx", + "CNs007xx", + "CNs006xx", + "CNs008xx", + "CNs009xx", + "CNs010xx", + "CNs001Bd", + "CNs012xx", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001xx", + "CNs002xx", + "CNs003xx", + "CNs004xx", + "CNs005xx", + "CNs007xx", + "CNs006xx", + "CNs008xx", + "CNs009xx", + "CNs010xx", + "CNs001Pg", + "CNs012xx", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001xx", + "CNs002xx", + "CNs003xx", + "CNs004xx", + "CNs005xx", + "CNs007xx", + "CNs006xx", + "CNs008xx", + "CNs009xx", + "CNs010xx", + "CNs001Rd", + "CNs012xx", + NULL, + NULL, + NULL, + NULL, + NULL}, + {"CNs001xx", + "CNs002xx", + "CNs003xx", + "CNs004xx", + "CNs005xx", + "CNs007xx", + "CNs006xx", + "CNs008xx", + "CNs009xx", + "CNs010xx", + "CNs001Sy", + "CNs012xx", + NULL, + NULL, + NULL, + NULL, + NULL} +}; + // GLOBAL: LEGO1 0x100f7048 LegoAnimationManager::Character g_characters[47] = { {"pepper", FALSE, 6, 0, FALSE, FALSE, TRUE, 1500, 20000, FALSE, 50, 1}, @@ -263,7 +455,7 @@ void LegoAnimationManager::Suspend() m_extras[i].m_roi = NULL; m_extras[i].m_characterId = -1; - m_extras[i].m_unk0x10 = -1.0f; + m_extras[i].m_speed = -1.0f; } m_unk0x18 = 0; @@ -316,7 +508,7 @@ void LegoAnimationManager::Init() for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { m_extras[i].m_roi = NULL; m_extras[i].m_characterId = -1; - m_extras[i].m_unk0x10 = -1.0f; + m_extras[i].m_speed = -1.0f; m_extras[i].m_unk0x14 = FALSE; } @@ -1743,7 +1935,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) m_extras[i].m_characterId = m_lastExtraCharacterId; g_characters[m_lastExtraCharacterId].m_unk0x04 = TRUE; m_extras[i].m_unk0x08 = Timer()->GetTime(); - m_extras[i].m_unk0x10 = -1; + m_extras[i].m_speed = -1; m_extras[i].m_unk0x0d = FALSE; m_unk0x414++; return; @@ -1842,7 +2034,7 @@ void LegoAnimationManager::FUN_10063d10() LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL) { - float speed = m_extras[i].m_unk0x10; + float speed = m_extras[i].m_speed; if (speed < 0.0f) { if (m_extras[i].m_unk0x14) { @@ -1883,6 +2075,108 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx return TRUE; } +// FUNCTION: LEGO1 0x10064380 +// FUNCTION: BETA10 0x1004583a +MxResult LegoAnimationManager::FUN_10064380( + const char* p_name, + const char* p_boundaryName, + MxS32 p_src, + float p_srcScale, + MxS32 p_dest, + float p_destScale, + MxU32 p_undIdx1, + MxS32 p_unk0x0c, + MxU32 p_undIdx2, + MxS32 p_unk0x10, + float p_speed +) +{ + LegoWorld* world = CurrentWorld(); + MxS32 extraIndex = -1; + LegoExtraActor* actor = NULL; + MxS32 i; + + for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; + + if (roi == NULL && extraIndex == -1) { + extraIndex = i; + } + + if (roi != NULL && !strcmpi(roi->GetName(), p_name)) { + actor = CharacterManager()->GetActor(p_name); + + if (actor != NULL && actor->GetController() != NULL) { + actor->GetController()->RemoveActor(actor); + actor->SetController(NULL); + actor->ClearMaps(); + } + + break; + } + } + + if (actor == NULL && extraIndex != -1) { + i = extraIndex; + + MxS32 characterId; + for (characterId = 0; characterId < (MxS32) sizeOfArray(g_characters); characterId++) { + if (!strcmpi(g_characters[characterId].m_name, p_name)) { + break; + } + } + + if (characterId > sizeOfArray(g_characters)) { + return FAILURE; + } + + m_extras[extraIndex].m_roi = CharacterManager()->GetROI(p_name, TRUE); + m_extras[extraIndex].m_characterId = characterId; + m_extras[extraIndex].m_speed = p_speed; + + actor = CharacterManager()->GetActor(p_name); + m_unk0x414++; + } + + if (actor != NULL) { + MxU8 unk0x0c = rand() % 2 != 0 ? 1 : 2; + actor->SetUnknown0x0c(unk0x0c); + actor->SetWorldSpeed(0.0f); + + if (world->PlaceActor(actor, p_boundaryName, p_src, p_srcScale, p_dest, p_destScale) != SUCCESS) { + CharacterManager()->FUN_10083db0(m_extras[i].m_roi); + m_extras[i].m_roi = NULL; + m_unk0x414--; + return FAILURE; + } + + MxS32 characterId = m_extras[i].m_characterId; + const char** unk0x100f6d58 = g_unk0x100f6d58[g_characters[characterId].m_unk0x16]; + + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx1]); + if (presenter != NULL) { + presenter->FUN_1006d680(actor, 0.0f); + } + + presenter = (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx2]); + if (presenter != NULL) { + presenter->FUN_1006d680(actor, 4.0f); + } + + m_extras[i].m_unk0x08 = Timer()->GetTime(); + m_extras[i].m_unk0x0c = TRUE; + m_extras[i].m_speed = p_speed; + + g_characters[characterId].m_unk0x0c = p_unk0x0c; + g_characters[characterId].m_unk0x10 = p_unk0x10; + g_characters[characterId].m_unk0x04 = TRUE; + return SUCCESS; + } + + return FAILURE; +} + // STUB: LEGO1 0x10064670 void LegoAnimationManager::FUN_10064670(Vector3*) { @@ -1892,7 +2186,6 @@ void LegoAnimationManager::FUN_10064670(Vector3*) // STUB: LEGO1 0x10064740 void LegoAnimationManager::FUN_10064740(Vector3*) { - // TODO } // STUB: LEGO1 0x100648f0 diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index a88ca7b3..d1600d13 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -128,7 +128,7 @@ void LegoExtraActor::VTable0xa4(MxU8& p_und1, MxS32& p_und2) } // FUNCTION: LEGO1 0x1002aae0 -MxResult LegoExtraActor::VTable0xc8() +MxResult LegoExtraActor::FUN_1002aae0() { LegoPathBoundary* oldEdge = m_boundary; Vector3 rightRef(m_unk0xec[0]); @@ -203,7 +203,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) } m_unk0x15 = 100; - VTable0xc8(); + FUN_1002aae0(); } else { MxU32 b = FALSE; From 5fe0b7e0bb74514e67fc469f450039fd4eabd88f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 15:58:35 -0400 Subject: [PATCH 45/89] Implement/matche LegoAnimationManager::FUN_10064740 and FUN_10064670 (#929) --- .../legoomni/include/legoanimationmanager.h | 4 +- .../src/common/legoanimationmanager.cpp | 55 +++++++++++++++++-- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 3e362e5a..49ee513e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -105,8 +105,8 @@ class LegoAnimationManager : public MxCore { void AddExtra(MxS32 p_location, MxBool p_und); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); - void FUN_10064670(Vector3*); - void FUN_10064740(Vector3*); + MxResult FUN_10064670(Vector3* p_position); + MxResult FUN_10064740(Vector3* p_position); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index a8bcc375..67f2e7bd 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2177,15 +2177,60 @@ MxResult LegoAnimationManager::FUN_10064380( return FAILURE; } -// STUB: LEGO1 0x10064670 -void LegoAnimationManager::FUN_10064670(Vector3*) +// FUNCTION: LEGO1 0x10064670 +MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position) { - // TODO + MxBool success = FALSE; + + if (p_position != NULL) { + Mx3DPointFloat vec(98.875f, 0.0f, -46.1564f); + ((Vector3&) vec).Sub(p_position); + + if (vec.LenSquared() < 800.0f) { + success = TRUE; + } + } + else { + success = TRUE; + } + + if (success) { + return FUN_10064380("brickstr", "EDG02_95", 1, 0.5f, 3, 0.5f, rand() % 3 + 14, -1, rand() % 3, -1, 0.5f); + } + + return FAILURE; } -// STUB: LEGO1 0x10064740 -void LegoAnimationManager::FUN_10064740(Vector3*) +// FUNCTION: LEGO1 0x10064740 +MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) { + MxBool success = FALSE; + + if (p_position != NULL) { + Mx3DPointFloat vec(-21.375f, 0.0f, -41.75f); + ((Vector3&) vec).Sub(p_position); + + if (vec.LenSquared() < 1000.0f) { + success = TRUE; + } + } + else { + success = TRUE; + } + + if (success) { + if (GameState()->GetActorId() != 2) { + FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f); + } + + if (GameState()->GetActorId() != 3) { + FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f); + } + + return SUCCESS; + } + + return FAILURE; } // STUB: LEGO1 0x100648f0 From c92341527ef4a3acee1c649c149dd02fc6a809a2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 21:42:21 -0400 Subject: [PATCH 46/89] 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 47/89] 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 48/89] 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 49/89] 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 50/89] 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 51/89] 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 52/89] 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 53/89] 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 54/89] 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 55/89] 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 56/89] 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 57/89] 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 58/89] 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 59/89] 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 60/89] 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 61/89] 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 From db90807d536f4be299071171ae5e6d3d6e46f0c4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 13:07:45 -0400 Subject: [PATCH 62/89] Implement/match LegoPathActor::ParseAction (#946) * Implement/match LegoPathActor::ParseAction * Fix naming * Space --- LEGO1/define.cpp | 12 +++++ LEGO1/define.h | 3 ++ LEGO1/lego/legoomni/include/isle.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 2 +- LEGO1/lego/legoomni/include/legomain.h | 8 +-- LEGO1/lego/legoomni/include/legopathactor.h | 2 +- LEGO1/lego/legoomni/include/legoworld.h | 1 - LEGO1/lego/legoomni/include/misc.h | 6 +-- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 13 ++--- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 10 ++-- .../src/common/legoanimmmpresenter.cpp | 2 +- .../legoomni/src/common/legogamestate.cpp | 28 ++++++----- LEGO1/lego/legoomni/src/common/misc.cpp | 4 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 3 +- .../src/gasstation/gasstationentity.cpp | 2 +- .../legoomni/src/hospital/hospitalentity.cpp | 2 +- .../src/infocenter/infocenterentity.cpp | 2 +- .../legoomni/src/isle/beachhouseentity.cpp | 2 +- .../lego/legoomni/src/paths/legopathactor.cpp | 48 ++++++++++++++++-- .../lego/legoomni/src/police/policeentity.cpp | 2 +- .../legoomni/src/race/racestandsentity.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 50 ++++++++++--------- 25 files changed, 137 insertions(+), 75 deletions(-) diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index 89d70dd0..0c04bb50 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -20,6 +20,10 @@ const char* g_strAUTO_CREATE = "AUTO_CREATE"; // STRING: LEGO1 0x10102000 const char* g_strBOTTOM_TO_TOP = "BOTTOM_TO_TOP"; +// GLOBAL: LEGO1 0x10102060 +// STRING: LEGO1 0x10101ff4 +const char* g_strCOLLIDEBOX = "COLLIDEBOX"; + // GLOBAL: LEGO1 0x10102064 // STRING: LEGO1 0x10101fec const char* g_strSTYLE = "STYLE"; @@ -68,6 +72,14 @@ const char* g_strMUST_SUCCEED = "MUST_SUCCEED"; // STRING: LEGO1 0x10101f58 const char* g_strOBJECT = "OBJECT"; +// GLOBAL: LEGO1 0x101020a0 +// STRING: LEGO1 0x10101f50 +const char* g_strPATH = "PATH"; + +// GLOBAL: LEGO1 0x101020a4 +// STRING: LEGO1 0x10101f40 +const char* g_strPERMIT_NAVIGATE = "PERMIT_NAVIGATE"; + // GLOBAL: LEGO1 0x101020a8 // STRING: LEGO1 0x10101f38 const char* g_strPTATCAM = "PTATCAM"; diff --git a/LEGO1/define.h b/LEGO1/define.h index 9bb1962a..a73a80f8 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -34,5 +34,8 @@ extern const char* g_strVARIABLE; extern const char* g_strBMP_ISMAP; extern const char* g_strAUTO_CREATE; extern const char* g_strDB_CREATE; +extern const char* g_strPERMIT_NAVIGATE; +extern const char* g_strPATH; +extern const char* g_strCOLLIDEBOX; #endif // DEFINE_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 76971271..ae7e1af7 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -59,7 +59,7 @@ class Isle : public LegoWorld { MxBool VTable0x64() override; // vtable+64 void Enable(MxBool p_enable) override; // vtable+68 - virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c + virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+6c MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleClick(LegoControlManagerEvent& p_param); diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 6a2c1e78..1b795be0 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -137,7 +137,7 @@ class IslePathActor : public LegoPathActor { protected: LegoWorld* m_world; // 0x154 - IslePathActor* m_unk0x158; // 0x158 + LegoPathActor* m_unk0x158; // 0x158 MxFloat m_unk0x15c; // 0x15c }; diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 1d2191d5..4a2fad65 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -6,7 +6,6 @@ #include "mxomni.h" class Isle; -class IslePathActor; class LegoAnimationManager; class LegoBuildingManager; class LegoCharacterManager; @@ -14,6 +13,7 @@ class LegoEntity; class LegoGameState; class LegoInputManager; class LegoNavController; +class LegoPathActor; class LegoPathBoundary; class LegoPlantManager; class LegoROI; @@ -127,7 +127,7 @@ class LegoOmni : public MxOmni { ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; } LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } - IslePathActor* GetCurrentActor() { return m_currentActor; } + LegoPathActor* GetCurrentActor() { return m_currentActor; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } @@ -139,7 +139,7 @@ class LegoOmni : public MxOmni { LegoWorldList* GetWorldList() { return m_worldList; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } - inline void SetCurrentActor(IslePathActor* p_currentActor) { m_currentActor = p_currentActor; } + inline void SetCurrentActor(LegoPathActor* p_currentActor) { m_currentActor = p_currentActor; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; } inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) @@ -162,7 +162,7 @@ class LegoOmni : public MxOmni { LegoWorld* m_currentWorld; // 0x7c MxBool m_exit; // 0x80 LegoNavController* m_navController; // 0x84 - IslePathActor* m_currentActor; // 0x88 + LegoPathActor* m_currentActor; // 0x88 LegoCharacterManager* m_characterManager; // 0x8c LegoPlantManager* m_plantManager; // 0x90 LegoAnimationManager* m_animationManager; // 0x94 diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 4acc28e7..10f79b50 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -155,7 +155,7 @@ class LegoPathActor : public LegoActor { MxU32 m_state; // 0xdc LegoUnknown100db7f4* m_destEdge; // 0xe0 MxFloat m_unk0xe4; // 0xe4 - undefined m_unk0xe8; // 0xe8 + MxBool m_collideBox; // 0xe8 undefined m_unk0xe9; // 0xe9 MxBool m_userNavFlag; // 0xea MxMatrix m_unk0xec; // 0xec diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 5e54c748..15f103a8 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -8,7 +8,6 @@ #include "mxpresenterlist.h" #include "roi/legoroi.h" -class IslePathActor; class LegoCameraController; class LegoPathBoundary; class LegoHideAnimPresenter; diff --git a/LEGO1/lego/legoomni/include/misc.h b/LEGO1/lego/legoomni/include/misc.h index 65606dfb..34824772 100644 --- a/LEGO1/lego/legoomni/include/misc.h +++ b/LEGO1/lego/legoomni/include/misc.h @@ -7,7 +7,6 @@ #include "lego/legoomni/include/actions/actionsfwd.h" #include "mxtypes.h" -class IslePathActor; class LegoAnimationManager; class LegoBuildingManager; class LegoCharacterManager; @@ -16,6 +15,7 @@ class LegoGameState; class LegoInputManager; class LegoNavController; class LegoOmni; +class LegoPathActor; class LegoPlantManager; class LegoROI; class LegoSoundManager; @@ -40,7 +40,7 @@ LegoControlManager* ControlManager(); LegoGameState* GameState(); LegoAnimationManager* AnimationManager(); LegoNavController* NavController(); -IslePathActor* CurrentActor(); +LegoPathActor* CurrentActor(); LegoWorld* CurrentWorld(); LegoCharacterManager* CharacterManager(); ViewManager* GetViewManager(); @@ -51,7 +51,7 @@ ViewLODListManager* GetViewLODListManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); LegoROI* FindROI(const char* p_name); void SetROIVisible(const char* p_name, MxBool p_visible); -void SetCurrentActor(IslePathActor* p_currentActor); +void SetCurrentActor(LegoPathActor* p_currentActor); MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction); void DeleteAction(); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index f4a92d51..078cb6c1 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -78,11 +78,12 @@ void Helicopter::VTable0xe4() if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_copter); if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) { - CurrentActor()->SpawnPlayer( - LegoGameState::e_unk55, - TRUE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + LegoGameState::e_unk55, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); } } @@ -116,7 +117,7 @@ MxU32 Helicopter::VTable0xcc() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 72f558aa..be2bbc4b 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -27,7 +27,7 @@ IslePathActor::IslePathActor() m_world = NULL; m_unk0x13c = 6.0; m_unk0x15c = 1.0; - m_unk0x158 = 0; + m_unk0x158 = NULL; } // FUNCTION: LEGO1 0x1001a280 diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index ade45933..72905a76 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -38,7 +38,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param) } if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } ((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 8b010eb3..2e742d97 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -87,7 +87,7 @@ MxU32 SkateBoard::VTable0xcc() if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 2bd84167..95df6202 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -994,7 +994,7 @@ MxResult LegoAnimationManager::FUN_100605e0( FUN_100648f0(tranInfo, m_unk0x404); } else if (p_unk0x0a) { - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (actor != NULL) { actor->SetState(4); @@ -1432,7 +1432,7 @@ MxResult LegoAnimationManager::Tickle() return SUCCESS; } - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); LegoROI* roi; if (actor == NULL || (roi = actor->GetROI()) == NULL) { @@ -1655,7 +1655,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) LegoEntityListCursor cursor(entityList); LegoEntity* entity; - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); while (cursor.Next(entity)) { if (entity != actor && entity->IsA("LegoPathActor")) { @@ -1858,7 +1858,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) if (world != NULL) { PurgeExtra(FALSE); - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) { MxU32 i; for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) { @@ -2163,7 +2163,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx { MxU32 local2c = 12; float destScale = ((rand() * 0.5) / 32767.0) + 0.25; - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (actor == NULL) { return FALSE; diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index d1c73605..d2e37eba 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -425,7 +425,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time) MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) { LegoROI* viewROI = VideoManager()->GetViewROI(); - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) { if (m_unk0x64 != NULL) { diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 101a3e6a..79d6b1d4 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -172,7 +172,7 @@ void LegoGameState::SetActor(MxU8 p_actorId) m_actorId = p_actorId; } - IslePathActor* oldActor = CurrentActor(); + LegoPathActor* oldActor = CurrentActor(); SetCurrentActor(NULL); IslePathActor* newActor = new IslePathActor(); @@ -199,7 +199,7 @@ void LegoGameState::SetActor(MxU8 p_actorId) // FUNCTION: LEGO1 0x10039910 void LegoGameState::RemoveActor() { - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); SetCurrentActor(NULL); delete actor; m_actorId = 0; @@ -209,7 +209,7 @@ void LegoGameState::RemoveActor() void LegoGameState::ResetROI() { if (m_actorId) { - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (actor) { LegoROI* roi = actor->GetROI(); @@ -906,11 +906,12 @@ void LegoGameState::SwitchArea(Area p_area) AnimationManager()->Resume(); } - CurrentActor()->SpawnPlayer( - p_area, - TRUE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + p_area, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); break; } case e_hospital: @@ -922,11 +923,12 @@ void LegoGameState::SwitchArea(Area p_area) SetCameraControllerFromIsle(); CurrentActor()->ResetWorldTransform(TRUE); AnimationManager()->Resume(); - CurrentActor()->SpawnPlayer( - p_area, - TRUE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + p_area, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); break; case e_police: VideoManager()->SetUnk0x554(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index bf77f5e8..34060c5f 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -67,7 +67,7 @@ LegoNavController* NavController() } // FUNCTION: LEGO1 0x10015790 -IslePathActor* CurrentActor() +LegoPathActor* CurrentActor() { return LegoOmni::GetInstance()->GetCurrentActor(); } @@ -137,7 +137,7 @@ void SetROIVisible(const char* p_name, MxBool p_visible) } // FUNCTION: LEGO1 0x10015880 -void SetCurrentActor(IslePathActor* p_currentActor) +void SetCurrentActor(LegoPathActor* p_currentActor) { LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 0455f1a7..2eb76ed2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -1,7 +1,6 @@ #include "legoworld.h" #include "anim/legoanim.h" -#include "islepathactor.h" #include "legoanimationmanager.h" #include "legoanimpresenter.h" #include "legobuildingmanager.h" @@ -701,7 +700,7 @@ void LegoWorld::Enable(MxBool p_enable) else if (!p_enable && m_set0xd0.empty()) { MxPresenter* presenter; LegoPathController* controller; - IslePathActor* actor = CurrentActor(); + LegoPathActor* actor = CurrentActor(); if (actor) { RemovePathActor(actor); diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp index cb15b026..aa14a197 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp @@ -24,7 +24,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp index 9b2f4eb0..b6c995d9 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp @@ -24,7 +24,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) act1State->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp index 4c89044e..1928f1c7 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp @@ -26,7 +26,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) switch (GameState()->GetCurrentAct()) { case LegoGameState::Act::e_act1: { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp index 5e11a4bd..1e7167dd 100644 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp @@ -22,7 +22,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index c26aec13..661c3e95 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -1,5 +1,6 @@ #include "legopathactor.h" +#include "define.h" #include "geom/legounkown100db7f4.h" #include "legocachesoundmanager.h" #include "legocameracontroller.h" @@ -11,6 +12,7 @@ #include "misc.h" #include "mxmisc.h" #include "mxtimer.h" +#include "mxutilities.h" #include "mxvariabletable.h" #include @@ -44,7 +46,7 @@ LegoPathActor::LegoPathActor() m_state = 0; m_grec = NULL; m_controller = NULL; - m_unk0xe8 = 0; + m_collideBox = FALSE; m_unk0x148 = 0; m_unk0x14c = 0; m_unk0x140 = 0.0099999999f; @@ -454,7 +456,7 @@ MxU32 LegoPathActor::VTable0x6c( LegoROI* roi = actor->GetROI(); if (roi != NULL && (roi->GetVisibility() || actor->GetCameraFlag())) { - if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_unk0xe8 != 0 && actor->m_unk0xe8 != 0)) { + if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->m_collideBox)) { VTable0x94(actor, TRUE); actor->VTable0x94(this, FALSE); return 2; @@ -540,10 +542,50 @@ inline MxU32 LegoPathActor::FUN_1002edd0( return result; } -// STUB: LEGO1 0x1002f020 +// FUNCTION: LEGO1 0x1002f020 +// FUNCTION: BETA10 0x100af54a void LegoPathActor::ParseAction(char* p_extra) { LegoActor::ParseAction(p_extra); + + char value[256]; + value[0] = '\0'; + + if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) { + SetUserNavFlag(TRUE); + NavController()->ResetLinearVel(m_worldSpeed); + SetCurrentActor(this); + } + + char* token; + if (KeyValueStringParse(value, g_strPATH, p_extra)) { + char name[12]; + + token = strtok(value, g_parseExtraTokens); + strcpy(name, token); + + token = strtok(NULL, g_parseExtraTokens); + MxS32 src = atoi(token); + + token = strtok(NULL, g_parseExtraTokens); + float srcScale = atof(token); + + token = strtok(NULL, g_parseExtraTokens); + MxS32 dest = atoi(token); + + token = strtok(NULL, g_parseExtraTokens); + float destScale = atof(token); + + LegoWorld* world = CurrentWorld(); + if (world != NULL) { + world->PlaceActor(this, name, src, srcScale, dest, destScale); + } + } + + if (KeyValueStringParse(value, g_strCOLLIDEBOX, p_extra)) { + token = strtok(value, g_parseExtraTokens); + m_collideBox = atoi(token); + } } // FUNCTION: LEGO1 0x1002f1b0 diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp index 936d3859..a9090b61 100644 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ b/LEGO1/lego/legoomni/src/police/policeentity.cpp @@ -24,7 +24,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp index 91d9a07f..8cceb324 100644 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp @@ -22,7 +22,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - CurrentActor()->VTable0xe4(); + ((IslePathActor*) CurrentActor())->VTable0xe4(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 9d787a8d..a1bbe9aa 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -503,7 +503,7 @@ void Isle::Enable(MxBool p_enable) } if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) { - IslePathActor* actor = CurrentActor(); + IslePathActor* actor = (IslePathActor*) CurrentActor(); actor->SpawnPlayer( LegoGameState::e_unk45, FALSE, @@ -657,11 +657,12 @@ void Isle::Enable(MxBool p_enable) } break; case 5: { - CurrentActor()->SpawnPlayer( - LegoGameState::e_jetrace2, - FALSE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + LegoGameState::e_jetrace2, + FALSE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -689,11 +690,12 @@ void Isle::Enable(MxBool p_enable) } case 6: { GameState()->m_currentArea = LegoGameState::e_carraceExterior; - CurrentActor()->SpawnPlayer( - LegoGameState::e_unk21, - FALSE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + LegoGameState::e_unk21, + FALSE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -738,11 +740,12 @@ void Isle::Enable(MxBool p_enable) break; case 11: m_act1state->m_unk0x018 = 0; - CurrentActor()->SpawnPlayer( - LegoGameState::e_unk54, - TRUE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + LegoGameState::e_unk54, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); GameState()->m_currentArea = LegoGameState::e_unk66; FUN_1003ef00(TRUE); m_jukebox->StartAction(); @@ -789,7 +792,7 @@ void Isle::FUN_10032620() case LegoGameState::e_unk66: { MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); LegoPathBoundary* boundary = CurrentActor()->GetBoundary(); - CurrentActor()->VTable0xec(mat, boundary, TRUE); + ((IslePathActor*) CurrentActor())->VTable0xec(mat, boundary, TRUE); break; } case LegoGameState::e_unk4: @@ -802,11 +805,12 @@ void Isle::FUN_10032620() case LegoGameState::e_hospitalExterior: case LegoGameState::e_unk31: case LegoGameState::e_policeExterior: - CurrentActor()->SpawnPlayer( - GameState()->m_currentArea, - TRUE, - IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 - ); + ((IslePathActor*) CurrentActor()) + ->SpawnPlayer( + GameState()->m_currentArea, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); GameState()->m_currentArea = LegoGameState::e_unk66; break; } @@ -1065,7 +1069,7 @@ void Isle::Add(MxCore* p_object) } // FUNCTION: LEGO1 0x10033050 -void Isle::VTable0x6c(IslePathActor* p_actor) +void Isle::VTable0x6c(LegoPathActor* p_actor) { LegoWorld::Remove(p_actor); From 1633118f68f6bd321d10acbe9d267007a95dde69 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 13:16:04 -0400 Subject: [PATCH 63/89] Implement/match Isle::UpdateGlobe (#947) * Implement/match Isle::UpdateGlobe * Change function access --- LEGO1/lego/legoomni/include/isle.h | 17 +++++++++-------- LEGO1/lego/legoomni/src/worlds/isle.cpp | 20 ++++++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index ae7e1af7..8d98d423 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -61,15 +61,22 @@ class Isle : public LegoWorld { void Enable(MxBool p_enable) override; // vtable+68 virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+6c + inline void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } + + void FUN_10033350(); + + // SYNTHETIC: LEGO1 0x10030a30 + // Isle::`scalar deleting destructor' + +protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleClick(LegoControlManagerEvent& p_param); MxLong HandleType19Notification(MxParam& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); - void FUN_10031590(); + void UpdateGlobe(); void FUN_10032620(); void FUN_100330e0(); - void FUN_10033350(); void FUN_10032d30( IsleScript::Script p_script, JukeboxScript::Script p_music, @@ -77,12 +84,6 @@ class Isle : public LegoWorld { MxBool p_und ); - inline void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } - - // SYNTHETIC: LEGO1 0x10030a30 - // Isle::`scalar deleting destructor' - -protected: Act1State* m_act1state; // 0xf8 Pizza* m_pizza; // 0xfc Pizzeria* m_pizzeria; // 0x100 diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index a1bbe9aa..21aeb3dd 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -399,15 +399,15 @@ MxLong Isle::HandleClick(LegoControlManagerEvent& p_param) Start(&action); break; case IsleScript::c_Observe_RCab_Ctl: - FUN_10031590(); + UpdateGlobe(); break; case IsleScript::c_Observe_GlobeLArrow_Ctl: UpdateLightPosition(-1); - FUN_10031590(); + UpdateGlobe(); break; case IsleScript::c_Observe_GlobeRArrow_Ctl: UpdateLightPosition(1); - FUN_10031590(); + UpdateGlobe(); break; case IsleScript::c_Observe_Draw1_Ctl: case IsleScript::c_Observe_Draw2_Ctl: @@ -443,10 +443,18 @@ MxLong Isle::HandleClick(LegoControlManagerEvent& p_param) return 0; } -// STUB: LEGO1 0x10031590 -void Isle::FUN_10031590() +// FUNCTION: LEGO1 0x10031590 +void Isle::UpdateGlobe() { - // TODO + MxS32 lightPosition = atoi(VariableTable()->GetVariable("lightposition")); + + for (MxS32 i = 0; i < 6; i++) { + MxStillPresenter* presenter = (MxStillPresenter*) Find(*g_isleScript, IsleScript::c_Observe_Globe1_Bitmap + i); + + if (presenter != NULL) { + presenter->Enable(i == lightPosition); + } + } } // STUB: LEGO1 0x100315f0 From 63719ef68981edbb37ee71e20e382a735f7e01ce Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 14:07:36 -0400 Subject: [PATCH 64/89] Implement/match Isle::CreateState and related (#948) --- LEGO1/lego/legoomni/include/ambulance.h | 1 + LEGO1/lego/legoomni/include/helicopter.h | 5 ++- LEGO1/lego/legoomni/include/isle.h | 2 +- LEGO1/lego/legoomni/include/pizza.h | 19 +++++----- LEGO1/lego/legoomni/include/pizzeria.h | 4 +-- LEGO1/lego/legoomni/include/radio.h | 3 +- LEGO1/lego/legoomni/include/towtrack.h | 24 +++++++------ LEGO1/lego/legoomni/src/actors/ambulance.cpp | 36 ++++++++++++------- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/pizza.cpp | 22 ++++++++++-- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/radio.cpp | 6 ++-- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 31 +++++++++++----- LEGO1/lego/legoomni/src/worlds/isle.cpp | 23 +++++++++--- 14 files changed, 123 insertions(+), 61 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 1aff83a0..f5d8d04c 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -36,6 +36,7 @@ class Ambulance : public IslePathActor { MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc void VTable0xe4() override; // vtable+0xe4 + void CreateState(); void FUN_10036e60(); void FUN_10037060(); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index b568390a..867763be 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -37,6 +37,8 @@ class Helicopter : public IslePathActor { // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' + void CreateState(); + protected: MxMatrix m_unk0x160; // 0x160 MxMatrix m_unk0x1a8; // 0x1a8 @@ -44,9 +46,6 @@ class Helicopter : public IslePathActor { UnknownMx4DPointFloat m_unk0x1f4; // 0x1f4 HelicopterState* m_state; // 0x228 MxAtomId m_script; // 0x22c - -private: - void GetState(); }; #endif // HELICOPTER_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 8d98d423..6242a828 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -76,7 +76,7 @@ class Isle : public LegoWorld { void HandleElevatorEndAction(); void UpdateGlobe(); void FUN_10032620(); - void FUN_100330e0(); + void CreateState(); void FUN_10032d30( IsleScript::Script p_script, JukeboxScript::Script p_music, diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index bb8c18f7..f845868f 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "isleactor.h" +class Act1State; +class PizzaMissionState; class SkateBoard; // VTABLE: LEGO1 0x100d7380 @@ -33,6 +35,7 @@ class Pizza : public IsleActor { undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 undefined4 VTable0x80(MxParam&) override; // vtable+0x80 + void CreateState(); void FUN_100382b0(); void FUN_10038380(); @@ -42,14 +45,14 @@ class Pizza : public IsleActor { // Pizza::`scalar deleting destructor' private: - undefined4 m_unk0x7c; // 0x7c - undefined4 m_unk0x80; // 0x80 - SkateBoard* m_skateboard; // 0x84 - undefined4 m_unk0x88; // 0x88 - undefined4 m_unk0x8c; // 0x8c - undefined4 m_unk0x90; // 0x90 - undefined4 m_unk0x94; // 0x94 - undefined m_unk0x98; // 0x98 + PizzaMissionState* m_state; // 0x7c + undefined4 m_unk0x80; // 0x80 + SkateBoard* m_skateboard; // 0x84 + Act1State* m_act1state; // 0x88 + undefined4 m_unk0x8c; // 0x8c + undefined4 m_unk0x90; // 0x90 + undefined4 m_unk0x94; // 0x94 + undefined m_unk0x98; // 0x98 }; #endif // PIZZA_H diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 0f36dbdf..0991d00a 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -29,12 +29,12 @@ class Pizzeria : public IsleActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 undefined4 VTable0x68() override; // vtable+0x68 + void CreateState(); + // SYNTHETIC: LEGO1 0x1000e8d0 // Pizzeria::`scalar deleting destructor' private: - void Init(); - PizzeriaState* m_pizzeriaState; // 0x7c PizzaMissionState* m_pizzaMissionState; // 0x80 }; diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 3c35a300..50b4de6f 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -30,6 +30,7 @@ class Radio : public MxCore { } void Initialize(MxBool p_und); + void CreateState(); void Play(); void Stop(); @@ -39,8 +40,6 @@ class Radio : public MxCore { // Radio::`scalar deleting destructor' private: - void CreateRadioState(); - RadioState* m_state; // 0x08 MxBool m_unk0x0c; // 0x0c MxBool m_audioEnabled; // 0x0d diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 056f0793..0c91e8a7 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "islepathactor.h" +class TowTrackMissionState; + // VTABLE: LEGO1 0x100d7ee0 // SIZE 0x180 class TowTrack : public IslePathActor { @@ -32,6 +34,7 @@ class TowTrack : public IslePathActor { MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc void VTable0xe4() override; // vtable+0xe4 + void CreateState(); void FUN_1004dab0(); void FUN_1004dad0(); @@ -39,17 +42,16 @@ class TowTrack : public IslePathActor { // TowTrack::`scalar deleting destructor' private: - // TODO: TowTrack field types - undefined m_unk0x154[4]; - MxS32 m_unk0x164; - MxS16 m_unk0x168; - MxS16 m_unk0x16a; - MxS16 m_unk0x16c; - MxS16 m_unk0x16e; - MxS32 m_unk0x170; - MxS32 m_unk0x174; - MxFloat m_unk0x178; - undefined4 m_unk0x17c; + undefined4 m_unk0x160; // 0x160 + TowTrackMissionState* m_state; // 0x164 + MxS16 m_unk0x168; // 0x168 + MxS16 m_unk0x16a; // 0x16a + MxS16 m_unk0x16c; // 0x16c + MxS16 m_unk0x16e; // 0x16e + MxS32 m_unk0x170; // 0x170 + MxS32 m_unk0x174; // 0x174 + MxFloat m_unk0x178; // 0x178 + undefined4 m_unk0x17c; // 0x17c }; #endif // TOWTRACK_H diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index d793503b..d7f7ebb4 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -18,17 +18,17 @@ DECOMP_SIZE_ASSERT(Ambulance, 0x184) // FUNCTION: LEGO1 0x10035ee0 Ambulance::Ambulance() { - this->m_unk0x168 = 0; - this->m_unk0x16a = -1; - this->m_state = NULL; - this->m_unk0x16c = 0; - this->m_unk0x174 = -1; - this->m_unk0x16e = 0; - this->m_unk0x178 = -1; - this->m_unk0x170 = 0; - this->m_unk0x172 = 0; - this->m_unk0x13c = 40.0; - this->m_unk0x17c = 1.0; + m_unk0x168 = 0; + m_unk0x16a = -1; + m_state = NULL; + m_unk0x16c = 0; + m_unk0x174 = -1; + m_unk0x16e = 0; + m_unk0x178 = -1; + m_unk0x170 = 0; + m_unk0x172 = 0; + m_unk0x13c = 40.0; + m_unk0x17c = 1.0; } // FUNCTION: LEGO1 0x10035f90 @@ -66,7 +66,6 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction) VariableTable()->SetVariable(g_varAMBULFUEL, "1.0"); m_unk0x17c = 1.0; m_time = Timer()->GetTime(); - return result; } @@ -76,6 +75,19 @@ void Ambulance::VTable0x70(float p_float) // TODO } +// FUNCTION: LEGO1 0x100363f0 +void Ambulance::CreateState() +{ + LegoGameState* gameState = GameState(); + AmbulanceMissionState* state = (AmbulanceMissionState*) gameState->GetState("AmbulanceMissionState"); + + if (state == NULL) { + state = (AmbulanceMissionState*) gameState->CreateState("AmbulanceMissionState"); + } + + m_state = state; +} + // STUB: LEGO1 0x10036420 MxLong Ambulance::Notify(MxParam& p_param) { diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 078cb6c1..8307e07a 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -49,12 +49,12 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) if (world) { world->Add(this); } - GetState(); + CreateState(); return result; } // FUNCTION: LEGO1 0x10003320 -void Helicopter::GetState() +void Helicopter::CreateState() { m_state = (HelicopterState*) GameState()->GetState("HelicopterState"); if (!m_state) { diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 57ab17df..236536b0 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -1,17 +1,21 @@ #include "pizza.h" +#include "act1state.h" +#include "legogamestate.h" +#include "misc.h" #include "mxmisc.h" #include "mxticklemanager.h" +#include "pizzamissionstate.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() { - m_unk0x7c = 0; + m_state = NULL; m_unk0x80 = 0; m_skateboard = NULL; - m_unk0x88 = 0; + m_act1state = NULL; m_unk0x8c = -1; m_unk0x98 = 0; m_unk0x90 = 0x80000000; @@ -30,6 +34,20 @@ MxResult Pizza::Create(MxDSAction& p_dsAction) return SUCCESS; } +// FUNCTION: LEGO1 0x100381b0 +void Pizza::CreateState() +{ + m_state = (PizzaMissionState*) GameState()->GetState("PizzaMissionState"); + if (m_state == NULL) { + m_state = (PizzaMissionState*) GameState()->CreateState("PizzaMissionState"); + } + + m_act1state = (Act1State*) GameState()->GetState("Act1State"); + if (m_act1state == NULL) { + m_act1state = (Act1State*) GameState()->CreateState("Act1State"); + } +} + // STUB: LEGO1 0x100382b0 void Pizza::FUN_100382b0() { diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 2346914b..2d72fd56 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -11,14 +11,14 @@ MxResult Pizzeria::Create(MxDSAction& p_dsAction) MxResult result = IsleActor::Create(p_dsAction); if (result == SUCCESS) { - Init(); + CreateState(); } return result; } // FUNCTION: LEGO1 0x100179f0 -void Pizzeria::Init() +void Pizzeria::CreateState() { LegoGameState* gameState = GameState(); PizzeriaState* pizzeriaState = (PizzeriaState*) gameState->GetState("PizzeriaState"); diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index a04523b1..537bf080 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -22,7 +22,7 @@ Radio::Radio() ControlManager()->Register(this); m_unk0x0c = TRUE; - CreateRadioState(); + CreateState(); } // FUNCTION: LEGO1 0x1002c990 @@ -147,12 +147,12 @@ void Radio::Initialize(MxBool p_und) { if (m_unk0x0c != p_und) { m_unk0x0c = p_und; - CreateRadioState(); + CreateState(); } } // FUNCTION: LEGO1 0x1002cde0 -void Radio::CreateRadioState() +void Radio::CreateState() { LegoGameState* gameState = GameState(); RadioState* state = (RadioState*) gameState->GetState("RadioState"); diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 2b087966..25b939e0 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -1,19 +1,23 @@ #include "towtrack.h" +#include "legogamestate.h" +#include "misc.h" +#include "towtrackmissionstate.h" + DECOMP_SIZE_ASSERT(TowTrack, 0x180) // FUNCTION: LEGO1 0x1004c720 TowTrack::TowTrack() { - this->m_unk0x168 = 0; - this->m_unk0x16a = -1; - this->m_unk0x164 = 0; - this->m_unk0x16c = 0; - this->m_unk0x170 = -1; - this->m_unk0x16e = 0; - this->m_unk0x174 = -1; - this->m_unk0x13c = 40.0; - this->m_unk0x178 = 1.0; + m_unk0x168 = 0; + m_unk0x16a = -1; + m_state = NULL; + m_unk0x16c = 0; + m_unk0x170 = -1; + m_unk0x16e = 0; + m_unk0x174 = -1; + m_unk0x13c = 40.0; + m_unk0x178 = 1.0; } // STUB: LEGO1 0x1004c9e0 @@ -29,6 +33,15 @@ void TowTrack::VTable0x70(float p_float) // TODO } +// FUNCTION: LEGO1 0x1004cc40 +void TowTrack::CreateState() +{ + m_state = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState"); + if (m_state == NULL) { + m_state = (TowTrackMissionState*) GameState()->CreateState("TowTrackMissionState"); + } +} + // STUB: LEGO1 0x1004cc80 MxLong TowTrack::Notify(MxParam& p_param) { diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 21aeb3dd..38e0fa5a 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -31,6 +31,7 @@ #include "mxtransitionmanager.h" #include "mxvariabletable.h" #include "pizza.h" +#include "pizzeria.h" #include "scripts.h" #include "skateboard.h" #include "towtrack.h" @@ -474,7 +475,7 @@ void Isle::Enable(MxBool p_enable) m_radio.Initialize(p_enable); if (p_enable) { - FUN_100330e0(); + CreateState(); VideoManager()->ResetPalette(FALSE); m_act1state->FUN_10034d00(); @@ -1095,10 +1096,24 @@ void Isle::VTable0x6c(LegoPathActor* p_actor) } } -// STUB: LEGO1 0x100330e0 -void Isle::FUN_100330e0() +// FUNCTION: LEGO1 0x100330e0 +void Isle::CreateState() { - // TODO + m_act1state = (Act1State*) GameState()->GetState("Act1State"); + if (!m_act1state) { + m_act1state = (Act1State*) GameState()->CreateState("Act1State"); + m_act1state->m_unk0x018 = 0; + } + + m_radio.CreateState(); + m_pizzeria->CreateState(); + m_pizza->CreateState(); + m_towtrack->CreateState(); + m_ambulance->CreateState(); + + if (m_helicopter != NULL) { + m_helicopter->CreateState(); + } } // STUB: LEGO1 0x10033180 From e59d684f37078d508e56462e0b976705ca008bcb Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 14:44:09 -0400 Subject: [PATCH 65/89] Implement/match actor Create functions (#949) --- .../legoomni/include/ambulancemissionstate.h | 3 -- LEGO1/lego/legoomni/include/isleactor.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 3 -- LEGO1/lego/legoomni/include/legovariables.h | 1 + LEGO1/lego/legoomni/include/towtrack.h | 2 +- .../legoomni/include/towtrackmissionstate.h | 1 - LEGO1/lego/legoomni/src/actors/ambulance.cpp | 2 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 15 ++++----- LEGO1/lego/legoomni/src/actors/pizza.cpp | 14 +++++++-- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 31 +++++++++++++++++-- .../legoomni/src/common/legovariables.cpp | 4 +++ 11 files changed, 55 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulancemissionstate.h b/LEGO1/lego/legoomni/include/ambulancemissionstate.h index 88bcf4b8..002d2803 100644 --- a/LEGO1/lego/legoomni/include/ambulancemissionstate.h +++ b/LEGO1/lego/legoomni/include/ambulancemissionstate.h @@ -24,8 +24,6 @@ class AmbulanceMissionState : public LegoState { MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - inline void SetUnknown0x08(undefined4 p_unk0x08) { m_unk0x08 = p_unk0x08; } - inline MxU16 GetScore(MxU8 p_id) { switch (p_id) { @@ -47,7 +45,6 @@ class AmbulanceMissionState : public LegoState { // SYNTHETIC: LEGO1 0x100376c0 // AmbulanceMissionState::`scalar deleting destructor' -protected: undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c MxU16 m_unk0x10; // 0x10 diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 1affab4a..ad2e985d 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -49,7 +49,7 @@ class IsleActor : public LegoActor { // FUNCTION: LEGO1 0x1000e650 virtual undefined4 VTable0x80(MxParam&) { return 0; } // vtable+0x80 -private: +protected: LegoWorld* m_world; // 0x78 }; diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 1b795be0..43d301cf 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -128,9 +128,6 @@ class IslePathActor : public LegoPathActor { // SYNTHETIC: LEGO1 0x10002ff0 // IslePathActor::`scalar deleting destructor' - inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } - inline LegoWorld* GetWorld() { return m_world; } - void FUN_1001b660(); static void RegisterSpawnLocations(); diff --git a/LEGO1/lego/legoomni/include/legovariables.h b/LEGO1/lego/legoomni/include/legovariables.h index ec02c530..9ef1a197 100644 --- a/LEGO1/lego/legoomni/include/legovariables.h +++ b/LEGO1/lego/legoomni/include/legovariables.h @@ -4,6 +4,7 @@ #include "mxvariable.h" extern const char* g_varAMBULFUEL; +extern const char* g_varTOWFUEL; extern const char* g_varVISIBILITY; extern const char* g_varCAMERALOCATION; extern const char* g_varCURSOR; diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 0c91e8a7..8e5ecfc0 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -51,7 +51,7 @@ class TowTrack : public IslePathActor { MxS32 m_unk0x170; // 0x170 MxS32 m_unk0x174; // 0x174 MxFloat m_unk0x178; // 0x178 - undefined4 m_unk0x17c; // 0x17c + MxFloat m_time; // 0x17c }; #endif // TOWTRACK_H diff --git a/LEGO1/lego/legoomni/include/towtrackmissionstate.h b/LEGO1/lego/legoomni/include/towtrackmissionstate.h index da9361f2..5a684011 100644 --- a/LEGO1/lego/legoomni/include/towtrackmissionstate.h +++ b/LEGO1/lego/legoomni/include/towtrackmissionstate.h @@ -45,7 +45,6 @@ class TowTrackMissionState : public LegoState { // SYNTHETIC: LEGO1 0x1004e060 // TowTrackMissionState::`scalar deleting destructor' -protected: undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c MxU8 m_unk0x10; // 0x10 diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index d7f7ebb4..8f7f05d1 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -58,7 +58,7 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction) m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState"); if (!m_state) { m_state = new AmbulanceMissionState(); - m_state->SetUnknown0x08(0); + m_state->m_unk0x08 = 0; GameState()->RegisterState(m_state); } } diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 8307e07a..06eba4e0 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -40,15 +40,16 @@ Helicopter::~Helicopter() MxResult Helicopter::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); - LegoWorld* world = CurrentWorld(); - SetWorld(world); - if (world->IsA("Act3")) { - ((Act3*) GetWorld())->SetUnknown420c(this); + + m_world = CurrentWorld(); + if (m_world->IsA("Act3")) { + ((Act3*) m_world)->SetUnknown420c(this); } - world = GetWorld(); - if (world) { - world->Add(this); + + if (m_world != NULL) { + m_world->Add(this); } + CreateState(); return result; } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 236536b0..d3779d40 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -1,7 +1,9 @@ #include "pizza.h" #include "act1state.h" +#include "isle_actions.h" #include "legogamestate.h" +#include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxticklemanager.h" @@ -27,11 +29,17 @@ Pizza::~Pizza() TickleManager()->UnregisterClient(this); } -// STUB: LEGO1 0x10038170 +// FUNCTION: LEGO1 0x10038170 MxResult Pizza::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult result = IsleActor::Create(p_dsAction); + + if (result == SUCCESS) { + CreateState(); + m_skateboard = (SkateBoard*) m_world->Find(m_atom, IsleScript::c_SkateBoard_Actor); + } + + return result; } // FUNCTION: LEGO1 0x100381b0 diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 25b939e0..2337fa4b 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -1,7 +1,12 @@ #include "towtrack.h" #include "legogamestate.h" +#include "legovariables.h" +#include "legoworld.h" #include "misc.h" +#include "mxmisc.h" +#include "mxtimer.h" +#include "mxvariabletable.h" #include "towtrackmissionstate.h" DECOMP_SIZE_ASSERT(TowTrack, 0x180) @@ -20,11 +25,31 @@ TowTrack::TowTrack() m_unk0x178 = 1.0; } -// STUB: LEGO1 0x1004c9e0 +// FUNCTION: LEGO1 0x1004c9e0 +// FUNCTION: BETA10 0x100f6bf1 MxResult TowTrack::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult result = IslePathActor::Create(p_dsAction); + + if (result == SUCCESS) { + m_world = CurrentWorld(); + + if (m_world) { + m_world->Add(this); + } + + m_state = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState"); + if (!m_state) { + m_state = new TowTrackMissionState(); + m_state->m_unk0x08 = 0; + GameState()->RegisterState(m_state); + } + } + + VariableTable()->SetVariable(g_varTOWFUEL, "1.0"); + m_unk0x178 = 1.0; + m_time = Timer()->GetTime(); + return result; } // STUB: LEGO1 0x1004cb10 diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 7dc427b8..38b5b5e8 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -20,6 +20,10 @@ DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24) // STRING: LEGO1 0x100f39a0 const char* g_varAMBULFUEL = "ambulFUEL"; +// GLOBAL: LEGO1 0x100f43b4 +// STRING: LEGO1 0x100f439c +const char* g_varTOWFUEL = "towFUEL"; + // GLOBAL: LEGO1 0x100f3a40 // STRING: LEGO1 0x100f3808 const char* g_varVISIBILITY = "VISIBILITY"; From b759390060f6a31e7333ffc664729b0d19c757c4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 20:41:57 -0400 Subject: [PATCH 66/89] Implement/match Isle::Escape (#950) --- LEGO1/lego/legoomni/include/act3.h | 2 +- LEGO1/lego/legoomni/include/ambulance.h | 2 + LEGO1/lego/legoomni/include/carrace.h | 2 +- LEGO1/lego/legoomni/include/elevatorbottom.h | 2 +- LEGO1/lego/legoomni/include/gasstation.h | 2 +- LEGO1/lego/legoomni/include/historybook.h | 2 +- LEGO1/lego/legoomni/include/hospital.h | 2 +- LEGO1/lego/legoomni/include/infocenter.h | 2 +- LEGO1/lego/legoomni/include/infocenterdoor.h | 2 +- LEGO1/lego/legoomni/include/isle.h | 2 +- LEGO1/lego/legoomni/include/jetskirace.h | 2 +- LEGO1/lego/legoomni/include/jukebox.h | 2 +- LEGO1/lego/legoomni/include/legoact2.h | 2 +- LEGO1/lego/legoomni/include/legocarbuild.h | 2 +- LEGO1/lego/legoomni/include/legorace.h | 2 +- LEGO1/lego/legoomni/include/legoworld.h | 2 +- LEGO1/lego/legoomni/include/police.h | 2 +- .../lego/legoomni/include/registrationbook.h | 2 +- LEGO1/lego/legoomni/include/score.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 2 + LEGO1/lego/legoomni/include/towtrack.h | 2 + LEGO1/lego/legoomni/src/actors/ambulance.cpp | 12 ++++ LEGO1/lego/legoomni/src/actors/towtrack.cpp | 12 ++++ .../lego/legoomni/src/build/legocarbuild.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- LEGO1/lego/legoomni/src/race/carrace.cpp | 2 +- LEGO1/lego/legoomni/src/race/jetskirace.cpp | 2 +- LEGO1/lego/legoomni/src/race/legorace.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/act3.cpp | 2 +- .../legoomni/src/worlds/elevatorbottom.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 2 +- .../lego/legoomni/src/worlds/historybook.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 2 +- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 58 +++++++++++++++++-- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/police.cpp | 2 +- .../legoomni/src/worlds/registrationbook.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/score.cpp | 2 +- 42 files changed, 120 insertions(+), 40 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 2883ff9d..b476dcc0 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -32,7 +32,7 @@ class Act3 : public LegoWorld { void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c void VTable0x60() override; // vtable+0x60 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 inline void SetUnknown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index f5d8d04c..9e4b95b7 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -39,6 +39,8 @@ class Ambulance : public IslePathActor { void CreateState(); void FUN_10036e60(); void FUN_10037060(); + void FUN_10037240(); + void FUN_10037250(); // SYNTHETIC: LEGO1 0x10036130 // Ambulance::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index c5af66e8..bb9d6324 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -25,7 +25,7 @@ class CarRace : public LegoRace { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 undefined4 VTable0x6c(undefined4) override; // vtable+0x6c undefined4 VTable0x70(undefined4) override; // vtable+0x70 undefined4 VTable0x74(undefined4) override; // vtable+0x74 diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index e2886f5c..81db82d6 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -35,7 +35,7 @@ class ElevatorBottom : public LegoWorld { // FUNCTION: LEGO1 0x10017f10 MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10018040 diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index c6dd28d5..51e7a3da 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -35,7 +35,7 @@ class GasStation : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 virtual MxLong HandleClick(LegoControlManagerEvent& p_param); // vtable+0x6c diff --git a/LEGO1/lego/legoomni/include/historybook.h b/LEGO1/lego/legoomni/include/historybook.h index af3b9be2..28870fc9 100644 --- a/LEGO1/lego/legoomni/include/historybook.h +++ b/LEGO1/lego/legoomni/include/historybook.h @@ -31,7 +31,7 @@ class HistoryBook : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 // SYNTHETIC: LEGO1 0x100824b0 // HistoryBook::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 40f4f947..9f9c8e4c 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -37,7 +37,7 @@ class Hospital : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 inline void PlayAction(MxU32 p_objectId); diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 04b56757..f0ed8697 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -67,7 +67,7 @@ class Infocenter : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1006ec60 diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index 84854072..9cb0c49d 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -34,7 +34,7 @@ class InfocenterDoor : public LegoWorld { // FUNCTION: LEGO1 0x100377a0 MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x100378d0 diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 6242a828..372c20ab 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -57,7 +57,7 @@ class Isle : public LegoWorld { // FUNCTION: LEGO1 0x10033170 void VTable0x60() override {} // vtable+60 - MxBool VTable0x64() override; // vtable+64 + MxBool Escape() override; // vtable+64 void Enable(MxBool p_enable) override; // vtable+68 virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+6c diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 4d039f70..bb612ec7 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -22,7 +22,7 @@ class JetskiRace : public LegoRace { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 undefined4 VTable0x6c(undefined4) override; // vtable+0x6c undefined4 VTable0x70(undefined4) override; // vtable+0x70 undefined4 VTable0x74(undefined4) override; // vtable+0x74 diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 260fb9a5..05618523 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -34,7 +34,7 @@ class JukeBox : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1005d810 diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index c7dd6a35..b84fada3 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -14,7 +14,7 @@ class LegoAct2 : public LegoWorld { void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c void VTable0x60() override; // vtable+0x60 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 inline void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; } diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 0d2eccc1..bd86964e 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -29,7 +29,7 @@ class LegoCarBuild : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10022a60 diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index c8b02f2e..29e46cab 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -30,7 +30,7 @@ class LegoRace : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 virtual undefined4 VTable0x6c(undefined4) = 0; // vtable+0x6c virtual undefined4 VTable0x70(undefined4); // vtable+0x70 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 15f103a8..2dd7321a 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -59,7 +59,7 @@ class LegoWorld : public LegoEntity { // FUNCTION: LEGO1 0x100010a0 virtual void VTable0x60() {} // vtable+0x60 - virtual MxBool VTable0x64(); // vtable+0x64 + virtual MxBool Escape(); // vtable+0x64 virtual void Enable(MxBool p_enable); // vtable+0x68 MxBool PresentersPending(); diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 4ba7ac20..3760f22a 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -36,7 +36,7 @@ class Police : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1005e300 diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index 1266d29b..ee4e55f8 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -34,7 +34,7 @@ class RegistrationBook : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 inline void PlayAction(MxU32 p_objectId); diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 71efd0f4..979fa33d 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -35,7 +35,7 @@ class Score : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 MxBool VTable0x5c() override; // vtable+0x5c - MxBool VTable0x64() override; // vtable+0x64 + MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 void Paint(); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index c42d3fe0..60cadaa2 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -32,6 +32,8 @@ class SkateBoard : public IslePathActor { MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 void VTable0xe4() override; // vtable+0xe4 + inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } + void ActivateSceneActions(); // SYNTHETIC: LEGO1 0x1000ff60 diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 8e5ecfc0..add3a9f6 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -37,6 +37,8 @@ class TowTrack : public IslePathActor { void CreateState(); void FUN_1004dab0(); void FUN_1004dad0(); + void FUN_1004db10(); + void FUN_1004dbe0(); // SYNTHETIC: LEGO1 0x1004c950 // TowTrack::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 8f7f05d1..b6bc7584 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -140,3 +140,15 @@ MxResult Ambulance::Tickle() // TODO return SUCCESS; } + +// STUB: LEGO1 0x10037240 +void Ambulance::FUN_10037240() +{ + // TODO +} + +// STUB: LEGO1 0x10037250 +void Ambulance::FUN_10037250() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 2337fa4b..7cd6ee1b 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -119,3 +119,15 @@ void TowTrack::FUN_1004dad0() { // TODO } + +// STUB: LEGO1 0x1004db10 +void TowTrack::FUN_1004db10() +{ + // TODO +} + +// STUB: LEGO1 0x1004dbe0 +void TowTrack::FUN_1004dbe0() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 90d06155..f844aa08 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -56,7 +56,7 @@ void LegoCarBuild::Enable(MxBool p_enable) } // STUB: LEGO1 0x10025e70 -MxBool LegoCarBuild::VTable0x64() +MxBool LegoCarBuild::Escape() { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index d3d940d3..63377d72 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -619,7 +619,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) if (currentWorld) { InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); - if (infocenterState && infocenterState->GetUnknown0x74() != 8 && currentWorld->VTable0x64()) { + if (infocenterState && infocenterState->GetUnknown0x74() != 8 && currentWorld->Escape()) { BackgroundAudioManager()->Stop(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); infocenterState->SetUnknown0x74(8); diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 2eb76ed2..b0cb72dd 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -53,7 +53,7 @@ MxBool LegoWorld::VTable0x5c() } // FUNCTION: LEGO1 0x1001d680 -MxBool LegoWorld::VTable0x64() +MxBool LegoWorld::Escape() { return FALSE; } diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index b45ff7ea..418a74c5 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -51,7 +51,7 @@ undefined4 CarRace::VTable0x78(undefined4) } // STUB: LEGO1 0x10017900 -MxBool CarRace::VTable0x64() +MxBool CarRace::Escape() { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index a976724d..37fc198d 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -32,7 +32,7 @@ undefined4 JetskiRace::VTable0x70(undefined4) } // STUB: LEGO1 0x10016a10 -MxBool JetskiRace::VTable0x64() +MxBool JetskiRace::Escape() { return TRUE; } diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index 034d3af8..c7959fc7 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -57,7 +57,7 @@ undefined4 LegoRace::VTable0x74(undefined4) } // FUNCTION: LEGO1 0x10015b90 -MxBool LegoRace::VTable0x64() +MxBool LegoRace::Escape() { return FALSE; } diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 8195e6c7..98f789da 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -88,7 +88,7 @@ void Act3::VTable0x60() } // STUB: LEGO1 0x10073e50 -MxBool Act3::VTable0x64() +MxBool Act3::Escape() { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index b3184aff..32c9265a 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -133,7 +133,7 @@ void ElevatorBottom::Enable(MxBool p_enable) } // FUNCTION: LEGO1 0x10018310 -MxBool ElevatorBottom::VTable0x64() +MxBool ElevatorBottom::Escape() { DeleteObjects(&m_atom, 500, 999); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index d32b32ab..e8a4d813 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -411,7 +411,7 @@ MxResult GasStation::Tickle() } // FUNCTION: LEGO1 0x10005e70 -MxBool GasStation::VTable0x64() +MxBool GasStation::Escape() { m_radio.Stop(); m_state->FUN_10006490(); diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index 56e09bed..bf01d00a 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -149,7 +149,7 @@ void HistoryBook::ReadyWorld() } // FUNCTION: LEGO1 0x10082a10 -MxBool HistoryBook::VTable0x64() +MxBool HistoryBook::Escape() { m_destLocation = LegoGameState::Area::e_infomain; return TRUE; diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index cbc86643..bc6b0386 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -662,7 +662,7 @@ MxResult Hospital::Tickle() } // FUNCTION: LEGO1 0x10076330 -MxBool Hospital::VTable0x64() +MxBool Hospital::Escape() { DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, 999); m_hospitalState->m_unk0x08.m_unk0x00 = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index d5d68518..b88db8b5 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1327,7 +1327,7 @@ void Infocenter::Reset() } // FUNCTION: LEGO1 0x10070f60 -MxBool Infocenter::VTable0x64() +MxBool Infocenter::Escape() { if (m_infocenterState != NULL) { MxU32 val = m_infocenterState->GetUnknown0x74(); diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index bc961368..7d205ce1 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -165,7 +165,7 @@ void InfocenterDoor::Enable(MxBool p_enable) } // FUNCTION: LEGO1 0x10037cd0 -MxBool InfocenterDoor::VTable0x64() +MxBool InfocenterDoor::Escape() { DeleteObjects(&m_atom, 500, 510); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 38e0fa5a..37a00ede 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1116,11 +1116,61 @@ void Isle::CreateState() } } -// STUB: LEGO1 0x10033180 -MxBool Isle::VTable0x64() +// FUNCTION: LEGO1 0x10033180 +MxBool Isle::Escape() { - // TODO - return FALSE; + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + + switch (m_act1state->m_unk0x018) { + case 3: + if (CurrentActor() != NULL) { + m_pizza->FUN_10038380(); + m_pizza->FUN_100382b0(); + } + break; + case 8: + if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { + m_towtrack->FUN_1004db10(); + m_towtrack->FUN_1004dbe0(); + } + break; + case 10: + if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { + m_ambulance->FUN_10037240(); + m_ambulance->FUN_10037250(); + } + break; + } + + if (m_act1state->m_unk0x01e == TRUE) { + InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_Floor2, NULL); + m_act1state->m_unk0x01e = FALSE; + } + + m_act1state->m_elevFloor = Act1State::c_floor1; + + AnimationManager()->FUN_10061010(FALSE); + DeleteObjects(&m_atom, IsleScript::c_sba001bu_RunAnim, IsleScript::c_FNS018EN_Wav_518); + + if (CurrentActor()) { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + m_skateboard->SetUnknown0x160(FALSE); + } + } + + if (GameState()->m_currentArea == LegoGameState::e_polidoor) { + VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); + } + + if (GameState()->m_currentArea == LegoGameState::e_garadoor) { + VariableTable()->SetVariable("VISIBILITY", "Show Gas"); + } + + m_act1state->m_unk0x018 = 0; + m_destLocation = LegoGameState::e_infomain; + return TRUE; } // STUB: LEGO1 0x10033350 diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 257db67b..ac284815 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -255,7 +255,7 @@ MxResult JukeBox::Tickle() } // FUNCTION: LEGO1 0x1005de70 -MxBool JukeBox::VTable0x64() +MxBool JukeBox::Escape() { m_destLocation = LegoGameState::e_infomain; return TRUE; diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 43c05750..cc108d10 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -48,7 +48,7 @@ void LegoAct2::VTable0x60() } // STUB: LEGO1 0x100519d0 -MxBool LegoAct2::VTable0x64() +MxBool LegoAct2::Escape() { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index 1cf8f879..cf1396b8 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -190,7 +190,7 @@ void Police::Enable(MxBool p_enable) } // FUNCTION: LEGO1 0x1005e790 -MxBool Police::VTable0x64() +MxBool Police::Escape() { DeleteObjects(&m_atom, PoliceScript::c_nps001ni_RunAnim, 510); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 29802f23..bb325a8f 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -493,7 +493,7 @@ MxBool RegistrationBook::CreateSurface() } // FUNCTION: LEGO1 0x100783e0 -MxBool RegistrationBook::VTable0x64() +MxBool RegistrationBook::Escape() { DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); return TRUE; diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index 0bb40ea7..f8bea176 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -312,7 +312,7 @@ void Score::FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score) } // FUNCTION: LEGO1 0x10001e40 -MxBool Score::VTable0x64() +MxBool Score::Escape() { DeleteScript(); m_destLocation = LegoGameState::e_infomain; From 715acd657d30d120182ca65fd9670b7ebfb0e3d7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 21:14:45 -0400 Subject: [PATCH 67/89] Implement/match Isle::FUN_10033350 (#951) --- LEGO1/lego/legoomni/src/worlds/isle.cpp | 42 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 37a00ede..8c2bc113 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1173,8 +1173,46 @@ MxBool Isle::Escape() return TRUE; } -// STUB: LEGO1 0x10033350 +// FUNCTION: LEGO1 0x10033350 void Isle::FUN_10033350() { - // TODO + if (m_act1state->m_unk0x018 == 10) { + if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { + m_ambulance->FUN_10037240(); + m_ambulance->FUN_10037250(); + } + } + + if (m_act1state->m_unk0x018 == 8) { + if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { + m_towtrack->FUN_1004db10(); + m_towtrack->FUN_1004dbe0(); + } + } + + if (m_act1state->m_unk0x018 == 3) { + if (CurrentActor() != NULL) { + m_pizza->FUN_10038380(); + m_pizza->FUN_100382b0(); + } + } + + AnimationManager()->FUN_10061010(FALSE); + + if (CurrentActor()) { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + m_skateboard->SetUnknown0x160(FALSE); + } + } + + if (GameState()->m_currentArea == LegoGameState::e_polidoor) { + VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); + } + + if (GameState()->m_currentArea == LegoGameState::e_garadoor) { + VariableTable()->SetVariable("VISIBILITY", "Show Gas"); + } + + m_destLocation = LegoGameState::e_infomain; } From 7c9fdd255effb8f8de6c1ff79cf9eb8409594da1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 21:23:41 -0400 Subject: [PATCH 68/89] Implement/match Isle::HandleType19Notification (#952) * Implement/match Isle::HandleType19Notification * Fix --- LEGO1/lego/legoomni/include/isle.h | 21 ++++--- .../legoomni/include/legoanimationmanager.h | 1 + .../src/common/legoanimationmanager.cpp | 19 ++++++ LEGO1/lego/legoomni/src/worlds/isle.cpp | 63 +++++++++++++++++-- .../omni/include/mxtype19notificationparam.h | 6 +- 5 files changed, 94 insertions(+), 16 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 372c20ab..878cef90 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -6,19 +6,20 @@ #include "legoworld.h" #include "radio.h" -class Pizza; -class Pizzeria; -class TowTrack; +class Act1State; class Ambulance; -class JukeBoxEntity; -class Helicopter; class Bike; class DuneBuggy; -class Motocycle; -class SkateBoard; -class RaceCar; +class Helicopter; class Jetski; -class Act1State; +class JukeBoxEntity; +class Motocycle; +class MxType19NotificationParam; +class Pizza; +class Pizzeria; +class RaceCar; +class SkateBoard; +class TowTrack; // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 @@ -71,7 +72,7 @@ class Isle : public LegoWorld { protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleClick(LegoControlManagerEvent& p_param); - MxLong HandleType19Notification(MxParam& p_param); + MxLong HandleType19Notification(MxType19NotificationParam& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); void UpdateGlobe(); diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 52aeb7c6..88f304e8 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -112,6 +112,7 @@ class LegoAnimationManager : public MxCore { void FUN_10063780(LegoROIList* p_list); MxResult FUN_10064670(Vector3* p_position); MxResult FUN_10064740(Vector3* p_position); + MxResult FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 95df6202..04c86576 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2411,6 +2411,25 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) return FAILURE; } +// FUNCTION: LEGO1 0x10064880 +// FUNCTION: BETA10 0x10045d02 +MxResult LegoAnimationManager::FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10) +{ + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; + + if (roi != NULL) { + if (!strcmpi(roi->GetName(), p_name)) { + g_characters[m_extras[i].m_characterId].m_unk0x0c = p_unk0x0c; + g_characters[m_extras[i].m_characterId].m_unk0x10 = p_unk0x10; + return SUCCESS; + } + } + } + + return FAILURE; +} + // STUB: LEGO1 0x100648f0 // FUNCTION: BETA10 0x10045daf void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 8c2bc113..9e692616 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -29,6 +29,7 @@ #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxtransitionmanager.h" +#include "mxtype19notificationparam.h" #include "mxvariabletable.h" #include "pizza.h" #include "pizzeria.h" @@ -158,7 +159,7 @@ MxLong Isle::Notify(MxParam& p_param) } break; case c_notificationType19: - result = HandleType19Notification(p_param); + result = HandleType19Notification((MxType19NotificationParam&) p_param); break; case c_notificationType20: Enable(TRUE); @@ -458,10 +459,64 @@ void Isle::UpdateGlobe() } } -// STUB: LEGO1 0x100315f0 -MxLong Isle::HandleType19Notification(MxParam& p_param) +// FUNCTION: LEGO1 0x100315f0 +MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) { - return 0; + MxLong result = 0; + + if (CurrentActor() != NULL) { + if (CurrentActor() == m_dunebuggy) { + result = m_dunebuggy->Notify(p_param); + } + else if (CurrentActor() == m_motocycle) { + result = m_motocycle->Notify(p_param); + } + } + + switch (m_act1state->m_unk0x018) { + case 3: + result = m_pizza->Notify(p_param); + break; + case 8: + result = m_towtrack->Notify(p_param); + break; + case 10: + result = m_ambulance->Notify(p_param); + break; + } + + if (result == 0) { + switch (p_param.GetUnknown0x0c()) { + case 0x12c: + AnimationManager()->FUN_10064670(NULL); + result = 1; + break; + case 0x12d: + AnimationManager()->FUN_10064880("brickstr", 0, 20000); + result = 1; + break; + case 0x131: + if (m_act1state->m_unk0x018 != 10) { + AnimationManager()->FUN_10064740(FALSE); + } + result = 1; + break; + case 0x132: + AnimationManager()->FUN_10064880("mama", 0, 20000); + AnimationManager()->FUN_10064880("papa", 0, 20000); + result = 1; + break; + case 0x136: + LegoEntity* bouy = (LegoEntity*) Find("MxEntity", "bouybump"); + if (bouy != NULL) { + NotificationManager()->Send(bouy, LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + } + result = 1; + break; + } + } + + return result; } // FUNCTION: LEGO1 0x10031820 diff --git a/LEGO1/omni/include/mxtype19notificationparam.h b/LEGO1/omni/include/mxtype19notificationparam.h index 0833f299..2a44e2ac 100644 --- a/LEGO1/omni/include/mxtype19notificationparam.h +++ b/LEGO1/omni/include/mxtype19notificationparam.h @@ -8,7 +8,7 @@ // SIZE 0x10 class MxType19NotificationParam : public MxNotificationParam { public: - MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxU16 p_unk0x0c) + MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxS16 p_unk0x0c) : MxNotificationParam() { m_type = p_type; @@ -23,8 +23,10 @@ class MxType19NotificationParam : public MxNotificationParam { return new MxType19NotificationParam(m_type, m_sender, m_unk0x0e, m_unk0x0c); } // vtable+0x04 + inline MxS16 GetUnknown0x0c() { return m_unk0x0c; } + protected: - MxU16 m_unk0x0c; // 0x0c + MxS16 m_unk0x0c; // 0x0c MxU8 m_unk0x0e; // 0x0e }; From 857c15ca119b97f973d4f8838d57b0d92868f721 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 25 May 2024 10:40:10 -0400 Subject: [PATCH 69/89] Implement/match LegoAnimationManager::FUN_10063b90 (#953) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../legoomni/include/legocharactermanager.h | 2 +- LEGO1/lego/legoomni/include/legocharacters.h | 2 +- .../src/common/legoanimationmanager.cpp | 78 +++++++++++++++---- .../src/common/legocharactermanager.cpp | 12 +-- 5 files changed, 73 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 88f304e8..087e3f86 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_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); - MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_unk0x14, MxU32 p_characterId); + MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId); void FUN_10063d10(); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale); diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index aaeb584d..f92bdd76 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -71,7 +71,7 @@ class LegoCharacterManager { LegoCharacterInfo* GetInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); - MxU8 FUN_10085180(LegoROI* p_roi); + MxU8 GetMood(LegoROI* p_roi); LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legocharacters.h b/LEGO1/lego/legoomni/include/legocharacters.h index 313a49e4..c21d81c7 100644 --- a/LEGO1/lego/legoomni/include/legocharacters.h +++ b/LEGO1/lego/legoomni/include/legocharacters.h @@ -24,7 +24,7 @@ struct LegoCharacterInfo { LegoExtraActor* m_actor; // 0x08 MxS32 m_unk0x0c; // 0x0c MxS32 m_unk0x10; // 0x10 - MxU8 m_unk0x14; // 0x14 + MxU8 m_mood; // 0x14 Part m_parts[10]; // 0x18 }; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 04c86576..c3a939fe 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -51,7 +51,7 @@ LegoAnimationManager::Vehicle g_vehicles[] = { }; // GLOBAL: LEGO1 0x100f6d58 -const char* g_unk0x100f6d58[11][17] = { +const char* g_cycles[11][17] = { {"CNs001xx", "CNs002xx", "CNs003xx", @@ -1973,7 +1973,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) if (FUN_10063b90( world, actor, - CharacterManager()->FUN_10085180(m_extras[i].m_roi), + CharacterManager()->GetMood(m_extras[i].m_roi), m_lastExtraCharacterId )) { m_extras[i].m_unk0x14 = TRUE; @@ -2064,17 +2064,67 @@ void LegoAnimationManager::FUN_10063aa0() } } -// STUB: LEGO1 0x10063b90 +// FUNCTION: LEGO1 0x10063b90 // FUNCTION: BETA10 0x10044d46 -MxBool LegoAnimationManager::FUN_10063b90( - LegoWorld* p_world, - LegoExtraActor* p_actor, - MxU8 p_unk0x14, - MxU32 p_characterId -) +MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId) { - // TODO - return TRUE; + const char** cycles = g_cycles[g_characters[p_characterId].m_unk0x16]; + const char* vehicleWC; + + if (g_characters[p_characterId].m_vehicleId >= 0 && g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 && + (vehicleWC = cycles[10]) != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 1.7f); + } + + g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 = FALSE; + g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x05 = TRUE; + return TRUE; + } + else { + vehicleWC = cycles[p_mood]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 0.7f); + } + } + + if (p_mood >= 2) { + p_mood--; + } + + vehicleWC = cycles[p_mood + 4]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 4.0f); + } + } + + if (p_mood >= 1) { + p_mood--; + } + + vehicleWC = cycles[p_mood + 7]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 0.0f); + } + } + + return FALSE; + } } // FUNCTION: LEGO1 0x10063d10 @@ -2329,15 +2379,15 @@ MxResult LegoAnimationManager::FUN_10064380( } MxS32 characterId = m_extras[i].m_characterId; - const char** unk0x100f6d58 = g_unk0x100f6d58[g_characters[characterId].m_unk0x16]; + const char** cycles = g_cycles[g_characters[characterId].m_unk0x16]; LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx1]); + (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", cycles[p_undIdx1]); if (presenter != NULL) { presenter->FUN_1006d680(actor, 0.0f); } - presenter = (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx2]); + presenter = (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", cycles[p_undIdx2]); if (presenter != NULL) { presenter->FUN_1006d680(actor, 4.0f); } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 856ff777..9f409bfb 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -116,7 +116,7 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != @@ -171,7 +171,7 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != @@ -449,7 +449,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) info->m_unk0x0c = pepper->m_unk0x0c; info->m_unk0x10 = pepper->m_unk0x10; - info->m_unk0x14 = pepper->m_unk0x14; + info->m_mood = pepper->m_mood; for (i = 0; i < sizeOfArray(info->m_parts); i++) { info->m_parts[i] = pepper->m_parts[i]; @@ -760,7 +760,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) LegoCharacterInfo* info = GetInfo(p_roi); if (p_und) { - return info->m_unk0x14 + g_unk0x100fc4dc; + return info->m_mood + g_unk0x100fc4dc; } if (info != NULL) { @@ -772,12 +772,12 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) // FUNCTION: LEGO1 0x10085180 // FUNCTION: BETA10 0x100768c5 -MxU8 LegoCharacterManager::FUN_10085180(LegoROI* p_roi) +MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi) { LegoCharacterInfo* info = GetInfo(p_roi); if (info != NULL) { - return info->m_unk0x14; + return info->m_mood; } return 0; From f380fa3b84287bd030a039d9bc83cd6e5604080e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 25 May 2024 11:18:24 -0400 Subject: [PATCH 70/89] Implement/match LegoAnimationManager::FUN_100648f0 (#954) --- .../legoomni/include/legoanimationmanager.h | 2 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 6 +- .../src/common/legoanimationmanager.cpp | 40 +++++++++++-- LEGO1/lego/sources/anim/legoanim.cpp | 6 +- LEGO1/mxgeometry/mxgeometry3d.h | 56 +++++++++++++++++-- 5 files changed, 92 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 087e3f86..b25b2510 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -170,7 +170,7 @@ class LegoAnimationManager : public MxCore { MxS32 p_unk0x10, float p_speed ); - void FUN_100648f0(LegoTranInfo*, MxLong); + void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404); void FUN_10064b50(MxLong p_time); MxS32 m_scriptIndex; // 0x08 diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 06eba4e0..d3b3ef51 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -378,11 +378,7 @@ void Helicopter::VTable0x70(float p_float) Vector3 v2(m_unk0x1a8[3]); float* loc = m_unk0x1a8[3]; mat.SetIdentity(); - float fa[4]; - Vector4 v3(fa); - if (m_unk0x1f4.FUN_100040a0(v3, f2) == SUCCESS) { - mat.FromQuaternion(v3); - } + m_unk0x1f4.Unknown6(mat, f2); v2.SetVector(loc); v2.Sub(&v); v2.Mul(f2); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index c3a939fe..2d780d0a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -25,6 +25,7 @@ #include "mxticklemanager.h" #include "mxtimer.h" #include "mxutilities.h" +#include "realtime/realtime.h" #include "viewmanager/viewmanager.h" #include @@ -2480,11 +2481,42 @@ MxResult LegoAnimationManager::FUN_10064880(const char* p_name, MxS32 p_unk0x0c, return FAILURE; } -// STUB: LEGO1 0x100648f0 +// FUNCTION: LEGO1 0x100648f0 // FUNCTION: BETA10 0x10045daf -void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) +void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404) { - // TODO + if (m_unk0x402 && p_tranInfo->m_unk0x14) { + p_tranInfo->m_flags |= LegoTranInfo::c_bit1; + m_unk0x430 = TRUE; + m_unk0x42c = p_tranInfo; + m_unk0x434 = p_unk0x404; + m_unk0x438 = p_unk0x404 + 1000; + + ViewROI* viewROI = VideoManager()->GetViewROI(); + m_unk0x43c = viewROI->GetLocal2World(); + p_tranInfo->m_unk0x2c = m_unk0x43c; + + LegoPathActor* actor = CurrentActor(); + if (actor != NULL) { + actor->SetState(4); + actor->SetWorldSpeed(0.0f); + } + + LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); + if (location != NULL) { + CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484); + m_unk0x4cc.Unknown1(m_unk0x43c, m_unk0x484); + m_unk0x4cc.Unknown7(); + } + else { + p_tranInfo->m_flags &= ~LegoTranInfo::c_bit1; + m_unk0x430 = FALSE; + } + + Mx3DPointFloat vec; + vec.Clear(); + viewROI->FUN_100a5a30(vec); + } } // FUNCTION: LEGO1 0x10064b50 @@ -2508,7 +2540,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und; sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und; - m_unk0x4cc.Unknown_100040a0(mat, (float) (p_time - m_unk0x434) / 1000.0f); + m_unk0x4cc.Unknown6(mat, (float) (p_time - m_unk0x434) / 1000.0f); VPV3(mat[3], m_unk0x43c[3], sub); mat[3][4] = 1.0f; diff --git a/LEGO1/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 92de53ae..4be46ae4 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -572,9 +572,9 @@ inline void LegoAnimNodeData::GetTranslation( c[3] = p_rotationKeys[i + 1].GetAngle(); } - b.Unknown1(a); - b.Unknown2(c); - b.Unknown_100040a0( + b.Unknown4(a); + b.Unknown5(c); + b.Unknown6( p_matrix, (p_time - p_rotationKeys[i].GetTime()) / (p_rotationKeys[i + 1].GetTime() - p_rotationKeys[i].GetTime()) ); diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index bd4cc24a..970695bb 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -65,6 +65,9 @@ class Mx4DPointFloat : public Vector4 { inline float& operator[](int idx) { return m_data[idx]; } inline const float& operator[](int idx) const { return m_data[idx]; } + // SYNTHETIC: LEGO1 0x10064b20 + // Mx4DPointFloat::operator= + private: float m_elements[4]; // 0x08 }; @@ -79,29 +82,54 @@ class UnknownMx4DPointFloat { UnknownMx4DPointFloat() : m_unk0x30(0) {} - inline void Unknown1(Vector4& p_v) + // FUNCTION: BETA10 0x1004a9b0 + inline void Unknown1(Matrix4& p_m1, Matrix4& p_m2) + { + Unknown2(p_m1); + Unknown3(p_m2); + } + + // FUNCTION: BETA10 0x1004a9f0 + inline void Unknown2(Matrix4& p_m) + { + p_m.ToQuaternion(m_unk0x00); + m_unk0x30 |= c_bit1; + } + + // FUNCTION: BETA10 0x1004aa30 + inline void Unknown3(Matrix4& p_m) + { + p_m.ToQuaternion(m_unk0x18); + m_unk0x30 |= c_bit2; + } + + // FUNCTION: BETA10 0x10180b80 + inline void Unknown4(Vector4& p_v) { m_unk0x00 = p_v; m_unk0x30 |= c_bit1; } - inline void Unknown2(Vector4& p_v) + // FUNCTION: BETA10 0x10180bc0 + inline void Unknown5(Vector4& p_v) { m_unk0x18 = p_v; m_unk0x30 |= c_bit2; } - inline int Unknown_100040a0(Matrix4& p_matrix, float p_f); - inline int FUN_100040a0(Vector4& p_v, float p_f); + inline int Unknown6(Matrix4& p_matrix, float p_f); + inline void Unknown7(); private: + inline int FUN_100040a0(Vector4& p_v, float p_f); + Mx4DPointFloat m_unk0x00; // 0x00 Mx4DPointFloat m_unk0x18; // 0x18 undefined4 m_unk0x30; // 0x30 }; // FUNCTION: BETA10 0x1004aaa0 -int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) +int UnknownMx4DPointFloat::Unknown6(Matrix4& p_matrix, float p_f) { float data[4]; Vector4 v(data); @@ -114,6 +142,24 @@ int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) } } +inline void UnknownMx4DPointFloat::Unknown7() +{ + if (m_unk0x30) { + Mx4DPointFloat v1; + Mx4DPointFloat v2; + + v1 = m_unk0x00; + ((Vector4&) v1).Add(&m_unk0x18); + + v2 = m_unk0x00; + ((Vector4&) v2).Sub(&m_unk0x18); + + if (v1.Dot(&v1, &v1) < v2.Dot(&v2, &v2)) { + ((Vector4&) m_unk0x18).Mul(-1.0f); + } + } +} + // FUNCTION: LEGO1 0x100040a0 // FUNCTION: BETA10 0x1004ab10 inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) From 535f1b973a56fbe88ef10c958c420b512765db3e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 25 May 2024 16:21:05 -0400 Subject: [PATCH 71/89] Implement LegoROI::FUN_100a9410 (#955) * WIP * WIP * Remove space * Fix --- .../legoomni/src/video/legoanimpresenter.cpp | 3 +- LEGO1/lego/sources/roi/legoroi.cpp | 140 +++++++++++++++++- LEGO1/lego/sources/roi/legoroi.h | 2 +- 3 files changed, 140 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 747cbf4e..b463240c 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1129,7 +1129,8 @@ MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1 return TRUE; } - if (m_unk0xa4 + p_f2 >= sqrt(len) && m_roiMapSize != 0 && m_roiMap != NULL) { + len = sqrt(len); + if (len <= m_unk0xa4 + p_f2 && m_roiMapSize != 0 && m_roiMap != NULL) { for (MxU32 i = 1; i <= m_roiMapSize; i++) { if (m_roiMap[i]->GetLODCount() != 0 && m_roiMap[i]->FUN_100a9410(p_vec1, p_vec2, p_f1, p_f2, p_vec3, FALSE)) { diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 33fbbb8e..35e0231a 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -551,9 +551,143 @@ LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo) return FAILURE; } -// STUB: LEGO1 0x100a9410 -LegoU32 LegoROI::FUN_100a9410(Vector3&, Vector3&, float, float, Vector3&, LegoBool) +// FUNCTION: LEGO1 0x100a9410 +// FUNCTION: BETA10 0x1018b324 +LegoU32 LegoROI::FUN_100a9410( + Vector3& p_v1, + Vector3& p_v2, + float p_f1, + float p_f2, + Vector3& p_v3, + LegoBool p_collideBox +) { + if (p_collideBox) { + Mx3DPointFloat v2(p_v1); + ((Vector3&) v2).Mul(p_f1); + ((Vector3&) v2).Add(&p_v1); + + Mx4DPointFloat localc0; + Mx4DPointFloat local9c; + Mx4DPointFloat local168; + Mx4DPointFloat local70; + Mx4DPointFloat local150[6]; + + Vector3 local58(&localc0[0]); + Vector3 locala8(&local9c[0]); + Vector3 local38(&local168[0]); + + Mx3DPointFloat local4c(p_v1); + + local58 = m_unk0x80.Min(); + locala8 = m_unk0x80.Max(); + + localc0[3] = local9c[3] = local168[3] = 1.0f; + + local38 = local58; + ((Vector3&) local38).Add(&locala8); + ((Vector3&) local38).Mul(0.5f); + + local70 = localc0; + localc0.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + + local70 = local9c; + local9c.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + + local70 = local168; + local168.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + + p_v3 = m_local2world[3]; + + LegoS32 i; + for (i = 0; i < 6; i++) { + local150[i] = m_local2world[i % 3]; + + if (i > 2) { + local150[i][3] = -local58.Dot(&local58, &local150[i]); + } + else { + local150[i][3] = -locala8.Dot(&locala8, &local150[i]); + } + + if (local150[i][3] + local38.Dot(&local38, &local150[i]) < 0.0f) { + ((Vector4&) local150[i]).Mul(-1.0f); + } + } + + for (i = 0; i < 6; i++) { + float local50 = p_v2.Dot(&p_v2, &local150[i]); + + if (local50 >= 0.01 || local50 < -0.01) { + local50 = -((local150[i][3] + local4c.Dot(&local4c, &local150[i])) / local50); + + if (local50 >= 0.0f && local50 <= p_f1) { + Mx3DPointFloat local17c(p_v2); + ((Vector3&) local17c).Mul(local50); + ((Vector3&) local17c).Add(&local4c); + + LegoS32 j; + for (j = 0; j < 6; j++) { + if (i != j && i - j != 3 && j - i != 3) { + if (local150[j][3] + local17c.Dot(&local17c, &local150[j]) < 0.0f) { + break; + } + } + } + + if (j == 6) { + return 1; + } + } + } + } + } + else { + Mx3DPointFloat v1(p_v1); + ((Vector3&) v1).Sub(&GetWorldBoundingSphere().Center()); + + float local10 = GetWorldBoundingSphere().Radius(); + float local8 = p_v2.Dot(&p_v2, &p_v2); + float localc = p_v2.Dot(&p_v2, &v1) * 2.0f; + float local14 = v1.Dot(&v1, &v1) - (local10 * local10); + + if (local8 >= 0.001 || local8 <= -0.001) { + float local1c = -1.0f; + float local18 = (localc * localc) - (local14 * local8 * 4.0f); + + if (local18 >= -0.001) { + local8 *= 2.0f; + localc = -localc; + + if (local18 > 0.0f) { + local18 = sqrt(local18); + float local184 = (localc + local18) / local8; + float local188 = (localc - local18) / local8; + + if (local184 > 0.0f && local188 > local184) { + local1c = local184; + } + else if (local188 > 0.0f) { + local1c = local188; + } + else { + return 0; + } + } + else { + local1c = localc / local8; + } + + if (local1c >= 0.0f && p_f1 <= local1c) { + p_v3 = p_v2; + p_v3.Mul(local1c); + p_v3.Add(&p_v1); + return 1; + } + } + } + } + return 0; } @@ -609,7 +743,7 @@ LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_g // FUNCTION: LEGO1 0x100a9c50 LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha) { - for (MxU32 i = 0; i < sizeOfArray(g_roiColorAliases); i++) { + for (LegoU32 i = 0; i < sizeOfArray(g_roiColorAliases); i++) { if (strcmpi(g_roiColorAliases[i].m_name, p_param) == 0) { p_red = g_roiColorAliases[i].m_red / 255.0; p_green = g_roiColorAliases[i].m_green / 255.0; diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 64002d30..f00bcf36 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -38,7 +38,7 @@ class LegoROI : public ViewROI { LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo); LegoResult GetTexture(LegoTextureInfo*& p_textureInfo); - LegoU32 FUN_100a9410(Vector3&, Vector3&, float, float, Vector3&, LegoBool); + LegoU32 FUN_100a9410(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3, LegoBool p_collideBox); void SetName(const LegoChar* p_name); float IntrinsicImportance() const override; // vtable+0x04 From 3cfb91855969f40c19bb996e3eb3eb4fc8eae9b3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 25 May 2024 19:16:20 -0400 Subject: [PATCH 72/89] Implement/match LegoExtraActor::VTable0x6c (#956) --- .../lego/legoomni/include/legoanimpresenter.h | 30 +++--- LEGO1/lego/legoomni/include/legopathactor.h | 1 + .../legoomni/src/paths/legoextraactor.cpp | 99 ++++++++++++++++++- .../lego/legoomni/src/paths/legopathactor.cpp | 4 +- .../legoomni/src/video/legoanimpresenter.cpp | 9 +- 5 files changed, 116 insertions(+), 27 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 09fd00a8..f4745c18 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -54,21 +54,21 @@ class LegoAnimPresenter : public MxVideoPresenter { return !strcmp(p_name, LegoAnimPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - void ReadyTickle() override; // vtable+0x18 - void StartingTickle() override; // vtable+0x1c - void StreamingTickle() override; // vtable+0x20 - void DoneTickle() override; // vtable+0x2c - void ParseExtra() override; // vtable+0x30 - MxResult AddToManager() override; // vtable+0x34 - void Destroy() override; // vtable+0x38 - MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - void EndAction() override; // vtable+0x40 - void PutFrame() override; // vtable+0x6c - virtual MxResult CreateAnim(MxStreamChunk* p_chunk); // vtable+0x88 - virtual void VTable0x8c(); // vtable+0x8c - virtual void VTable0x90(); // vtable+0x90 - virtual MxU32 VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1, float p_f2, Vector3& p_vec3); // vtable+0x94 - virtual MxResult VTable0x98(LegoPathBoundary* p_boundary); // vtable+0x98 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c + virtual MxResult CreateAnim(MxStreamChunk* p_chunk); // vtable+0x88 + virtual void VTable0x8c(); // vtable+0x8c + virtual void VTable0x90(); // vtable+0x90 + virtual MxU32 VTable0x94(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3); // vtable+0x94 + virtual MxResult VTable0x98(LegoPathBoundary* p_boundary); // vtable+0x98 // FUNCTION: LEGO1 0x1000c990 virtual LegoROI** GetROIMap(MxU32& p_roiMapSize) diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 10f79b50..71e9f68e 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -126,6 +126,7 @@ class LegoPathActor : public LegoActor { inline LegoPathBoundary* GetBoundary() { return m_boundary; } inline MxU32 GetState() { return m_state; } inline LegoPathController* GetController() { return m_controller; } + inline MxBool GetCollideBox() { return m_collideBox; } inline void SetBoundary(LegoPathBoundary* p_boundary) { m_boundary = p_boundary; } inline void SetState(MxU32 p_state) { m_state = p_state; } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 9b3a6304..e1eeedbe 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -287,9 +287,9 @@ MxResult LegoExtraActor::VTable0x9c() if (m_boundary != oldBoundary) { MxU32 b = FALSE; - LegoAnimPresenterSet& set = m_boundary->GetPresenters(); + LegoAnimPresenterSet& presenters = m_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) { + for (LegoAnimPresenterSet::iterator it = presenters.begin(); it != presenters.end(); it++) { MxU32 roiMapSize; if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; @@ -312,9 +312,9 @@ void LegoExtraActor::Restart() { if (m_unk0x0e != 0) { MxU32 b = FALSE; - LegoAnimPresenterSet& set = m_boundary->GetPresenters(); + LegoAnimPresenterSet& presenters = m_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator it = set.begin(); it != set.end(); it++) { + for (LegoAnimPresenterSet::iterator it = presenters.begin(); it != presenters.end(); it++) { MxU32 roiMapSize; if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; @@ -429,7 +429,7 @@ MxS32 LegoExtraActor::VTable0x68(Vector3& p_point1, Vector3& p_point2, Vector3& return LegoPathActor::VTable0x68(p_point1, p_point2, p_point3); } -// STUB: LEGO1 0x1002b980 +// FUNCTION: LEGO1 0x1002b980 MxU32 LegoExtraActor::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -439,5 +439,94 @@ MxU32 LegoExtraActor::VTable0x6c( Vector3& p_v3 ) { + LegoAnimPresenterSet& presenters = p_boundary->GetPresenters(); + + for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) { + if ((*itap)->VTable0x94(p_v1, p_v2, p_f1, p_f2, p_v3)) { + return 1; + } + } + + LegoPathActorSet& plpas = p_boundary->GetActors(); + LegoPathActorSet lpas(plpas); + + for (LegoPathActorSet::iterator itpa = lpas.begin(); itpa != lpas.end(); itpa++) { + if (plpas.find(*itpa) != plpas.end()) { + LegoPathActor* actor = *itpa; + + if (this != actor && !(actor->GetState() & 0x100)) { + LegoROI* roi = actor->GetROI(); + + if ((roi != NULL && roi->GetVisibility()) || actor->GetCameraFlag()) { + if (actor->GetUserNavFlag()) { + MxMatrix local2world = roi->GetLocal2World(); + Vector3 local60(local2world[3]); + Mx3DPointFloat local54(p_v1); + + ((Vector3&) local54).Sub(&local60); + float local1c = p_v2.Dot(&p_v2, &p_v2); + float local24 = p_v2.Dot(&p_v2, &local54) * 2.0f; + float local20 = local54.Dot(&local54, &local54); + + if (m_unk0x15 != 0 && local20 < 10.0f) { + return 0; + } + + local20 -= 1.0f; + + if (local1c >= 0.001 || local1c <= -0.001) { + float local40 = (local24 * local24) + (local20 * local1c * -4.0f); + + if (local40 >= -0.001) { + local1c *= 2.0f; + local24 = -local24; + + if (local40 < 0.0f) { + local40 = 0.0f; + } + + local40 = sqrt(local40); + float local20X = (local24 + local40) / local1c; + float local1cX = (local24 - local40) / local1c; + + if (local1cX < local20X) { + local40 = local20X; + local20X = local1cX; + local1cX = local40; + } + + if ((local20X >= 0.0f && local20X <= p_f1) || (local1cX >= 0.0f && local1cX <= p_f1) || + (local20X <= -0.01 && p_f1 + 0.01 <= local1cX)) { + p_v3 = p_v1; + + if (VTable0x94(actor, TRUE) < 0) { + return 0; + } + + actor->VTable0x94(this, FALSE); + return 2; + } + } + } + } + else { + if (roi->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, m_collideBox && actor->GetCollideBox())) { + if (VTable0x94(actor, TRUE) < 0) { + return 0; + } + + actor->VTable0x94(this, FALSE); + return 2; + } + } + } + } + } + } + + if (m_unk0x15 != 0) { + m_unk0x15--; + } + return 0; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 661c3e95..17d89e68 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -437,9 +437,9 @@ MxU32 LegoPathActor::VTable0x6c( Vector3& p_v3 ) { - LegoAnimPresenterSet& laps = p_boundary->GetPresenters(); + LegoAnimPresenterSet& presenters = p_boundary->GetPresenters(); - for (LegoAnimPresenterSet::iterator itap = laps.begin(); itap != laps.end(); itap++) { + for (LegoAnimPresenterSet::iterator itap = presenters.begin(); itap != presenters.end(); itap++) { if ((*itap)->VTable0x94(p_v1, p_v2, p_f1, p_f2, p_v3)) { return 1; } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index b463240c..503c6282 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1113,13 +1113,13 @@ void LegoAnimPresenter::FUN_1006c8a0(MxBool p_bool) // FUNCTION: LEGO1 0x1006c8f0 // FUNCTION: BETA10 0x1005206c -MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1, float p_f2, Vector3& p_vec3) +MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3) { Mx3DPointFloat a, b; - b = p_vec2; + b = p_v2; ((Vector3&) b).Mul(p_f1); - ((Vector3&) b).Add(&p_vec1); + ((Vector3&) b).Add(&p_v1); a = b; ((Vector3&) a).Sub(&m_unk0xa8); @@ -1132,8 +1132,7 @@ MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1 len = sqrt(len); if (len <= m_unk0xa4 + p_f2 && m_roiMapSize != 0 && m_roiMap != NULL) { for (MxU32 i = 1; i <= m_roiMapSize; i++) { - if (m_roiMap[i]->GetLODCount() != 0 && - m_roiMap[i]->FUN_100a9410(p_vec1, p_vec2, p_f1, p_f2, p_vec3, FALSE)) { + if (m_roiMap[i]->GetLODCount() != 0 && m_roiMap[i]->FUN_100a9410(p_v1, p_v2, p_f1, p_f2, p_v3, FALSE)) { return TRUE; } } From 765c49fd4ee5f2e4939ce71f5f4c5d6ff021a0fe Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 26 May 2024 11:12:37 -0400 Subject: [PATCH 73/89] Match LegoUnknown::FUN_1009a1e0 (#957) --- LEGO1/lego/sources/misc/legounknown.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index 6b4a710e..117a50af 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -42,9 +42,9 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L } 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]); + ((Vector3&) v1).Add(&m_unk0x00[1]); + ((Vector3&) v1).Add(&m_unk0x00[2]); + ((Vector3&) v1).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; From 3c45022864c96271dc54c0fbba9f79fc3c98322b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 26 May 2024 13:13:56 -0400 Subject: [PATCH 74/89] Fix extra actor collisions (#958) --- LEGO1/lego/sources/roi/legoroi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 35e0231a..c978b6ce 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -563,7 +563,7 @@ LegoU32 LegoROI::FUN_100a9410( ) { if (p_collideBox) { - Mx3DPointFloat v2(p_v1); + Mx3DPointFloat v2(p_v2); ((Vector3&) v2).Mul(p_f1); ((Vector3&) v2).Add(&p_v1); @@ -678,7 +678,7 @@ LegoU32 LegoROI::FUN_100a9410( local1c = localc / local8; } - if (local1c >= 0.0f && p_f1 <= local1c) { + if (local1c >= 0.0f && p_f1 >= local1c) { p_v3 = p_v2; p_v3.Mul(local1c); p_v3.Add(&p_v1); From b8ea5bf9babe6f55fa92537f2f583b44cfa503f2 Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 27 May 2024 03:22:10 -0400 Subject: [PATCH 75/89] Fix missing float constants (#959) --- tools/isledecomp/isledecomp/compare/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/isledecomp/isledecomp/compare/core.py b/tools/isledecomp/isledecomp/compare/core.py index b49600d0..8e93a828 100644 --- a/tools/isledecomp/isledecomp/compare/core.py +++ b/tools/isledecomp/isledecomp/compare/core.py @@ -103,6 +103,11 @@ def _load_cvdump(self): res = CvdumpAnalysis(cv) for sym in res.nodes: + # Skip nodes where we have almost no information. + # These probably came from SECTION CONTRIBUTIONS. + if sym.name() is None and sym.node_type is None: + continue + # The PDB might contain sections that do not line up with the # actual binary. The symbol "__except_list" is one example. # In these cases, just skip this symbol and move on because From 219b65f5adba6289ca34670f8f089b6354816fd5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 27 May 2024 15:49:41 -0400 Subject: [PATCH 76/89] Implement/match IslePathActor::FUN_1001b660 (#960) --- LEGO1/lego/legoomni/src/actors/islepathactor.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index be2bbc4b..edaaa314 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -579,8 +579,17 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar } } -// STUB: LEGO1 0x1001b660 +// FUNCTION: LEGO1 0x1001b660 +// FUNCTION: BETA10 0x10036ea2 void IslePathActor::FUN_1001b660() { - // TODO + MxMatrix transform(m_roi->GetLocal2World()); + Vector3 position(transform[0]); + Vector3 direction(transform[1]); + Vector3 up(transform[2]); + + ((Vector3&) up).Mul(-1.0f); + position.EqualsCross(&direction, &up); + m_roi->FUN_100a58f0(transform); + m_roi->VTable0x14(); } From a88546baad9eabb7fc34d361e7abd416362fa465 Mon Sep 17 00:00:00 2001 From: MS Date: Tue, 28 May 2024 03:32:51 -0400 Subject: [PATCH 77/89] Refactor MxBitmap (again) (#961) * Remove this * Starting list of beta addrs * Static for height-specific abs, fix StrechBits * MxBitmap refactor --- LEGO1/omni/include/mxbitmap.h | 48 +++-- LEGO1/omni/src/video/mxbitmap.cpp | 299 +++++++++++++++++------------- 2 files changed, 209 insertions(+), 138 deletions(-) diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index a11853e4..c9c949be 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -34,6 +34,7 @@ struct MxBITMAPINFO { // SIZE 0x20 // VTABLE: LEGO1 0x100dc7b0 +// VTABLE: BETA10 0x101c21f8 class MxBitmap : public MxCore { public: MxBitmap(); @@ -46,6 +47,7 @@ class MxBitmap : public MxCore { virtual MxLong Read(const char* p_filename); // vtable+24 // FUNCTION: LEGO1 0x1004e0d0 + // FUNCTION: BETA10 0x10060fc0 virtual int VTable0x28(int) { return -1; } // vtable+28 virtual void BitBlt( @@ -82,26 +84,35 @@ class MxBitmap : public MxCore { // Bit mask trick to round up to the nearest multiple of four. // Pixel data may be stored with padding. // https://learn.microsoft.com/en-us/windows/win32/medfound/image-stride + // FUNCTION: BETA10 0x1002c510 inline MxLong AlignToFourByte(MxLong p_value) const { return (p_value + 3) & -4; } - // Same as the one from legoutils.h, but flipped the other way - // TODO: While it's not outside the realm of possibility that they - // reimplemented Abs for only this file, that seems odd, right? - inline MxLong AbsFlipped(MxLong p_value) const { return p_value > 0 ? p_value : -p_value; } + // DECOMP: This could be a free function. It is static here because it has no + // reference to "this". In the beta it is called in two places: + // 1. GetBmiHeightAbs + // 2. at 0x101523b9, in reference to BITMAPINFOHEADER.biHeight + // FUNCTION: BETA10 0x1002c690 + static MxLong HeightAbs(MxLong p_value) { return p_value > 0 ? p_value : -p_value; } inline BITMAPINFOHEADER* GetBmiHeader() const { return m_bmiHeader; } + + // FUNCTION: BETA10 0x1002c440 inline MxLong GetBmiWidth() const { return m_bmiHeader->biWidth; } inline MxLong GetBmiStride() const { return ((m_bmiHeader->biWidth + 3) & -4); } inline MxLong GetBmiHeight() const { return m_bmiHeader->biHeight; } - inline MxLong GetBmiHeightAbs() const { return AbsFlipped(m_bmiHeader->biHeight); } + + // FUNCTION: BETA10 0x1002c470 + inline MxLong GetBmiHeightAbs() const { return HeightAbs(m_bmiHeader->biHeight); } + + // FUNCTION: BETA10 0x10083900 inline MxU8* GetImage() const { return m_data; } + + // FUNCTION: BETA10 0x100838d0 inline MxBITMAPINFO* GetBitmapInfo() const { return m_info; } - inline MxLong GetDataSize() const - { - MxLong absHeight = GetBmiHeightAbs(); - MxLong alignedWidth = AlignToFourByte(m_bmiHeader->biWidth); - return alignedWidth * absHeight; - } + + // FUNCTION: BETA10 0x100982b0 + inline MxLong GetDataSize() const { return AlignToFourByte(m_bmiHeader->biWidth) * GetBmiHeightAbs(); } + inline MxLong GetAdjustedStride() { if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) { @@ -138,9 +149,24 @@ class MxBitmap : public MxCore { } // SYNTHETIC: LEGO1 0x100bc9f0 + // SYNTHETIC: BETA10 0x1013dcd0 // MxBitmap::`scalar deleting destructor' private: + // FUNCTION: BETA10 0x1013dd10 + inline MxLong MxBitmapInfoSize() const { return sizeof(MxBITMAPINFO); } + + // FUNCTION: BETA10 0x1013dd30 + inline MxBool IsBottomUp() + { + if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) { + return FALSE; + } + else { + return m_bmiHeader->biHeight > 0; + } + } + MxResult ImportColorsToPalette(RGBQUAD*, MxPalette*); MxBITMAPINFO* m_info; // 0x08 diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index 29733d5f..88295b21 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -8,66 +8,79 @@ DECOMP_SIZE_ASSERT(MxBitmap, 0x20); DECOMP_SIZE_ASSERT(MxBITMAPINFO, 0x428); // GLOBAL: LEGO1 0x10102184 +// GLOBAL: BETA10 0x10203030 MxU16 g_bitmapSignature = TWOCC('B', 'M'); // FUNCTION: LEGO1 0x100bc980 +// FUNCTION: BETA10 0x1013cab0 MxBitmap::MxBitmap() { - this->m_info = NULL; - this->m_bmiHeader = NULL; - this->m_paletteData = NULL; - this->m_data = NULL; - this->m_isHighColor = FALSE; - this->m_palette = NULL; + m_info = NULL; + m_bmiHeader = NULL; + m_paletteData = NULL; + m_data = NULL; + m_isHighColor = FALSE; + m_palette = NULL; } // FUNCTION: LEGO1 0x100bca10 +// FUNCTION: BETA10 0x1013cb58 MxBitmap::~MxBitmap() { - if (this->m_info) { + if (m_info) { delete m_info; } - if (this->m_data) { + if (m_data) { delete m_data; } - if (this->m_palette) { + if (m_palette) { delete m_palette; } } // FUNCTION: LEGO1 0x100bcaa0 +// FUNCTION: BETA10 0x1013cc47 MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette, MxBool p_isHighColor) { MxResult ret = FAILURE; MxLong size = AlignToFourByte(p_width) * p_height; - m_info = new MxBITMAPINFO; - if (m_info) { - m_data = new MxU8[size]; - if (m_data) { - m_bmiHeader = &m_info->m_bmiHeader; - m_paletteData = m_info->m_bmiColors; - memset(&m_info->m_bmiHeader, 0, sizeof(m_info->m_bmiHeader)); - - m_bmiHeader->biSize = sizeof(*m_bmiHeader); // should be 40 bytes - m_bmiHeader->biWidth = p_width; - m_bmiHeader->biHeight = p_height; - m_bmiHeader->biPlanes = 1; - m_bmiHeader->biBitCount = 8; - m_bmiHeader->biCompression = 0; - m_bmiHeader->biSizeImage = size; - - if (!ImportColorsToPalette(m_paletteData, p_palette)) { - if (!SetBitDepth(p_isHighColor)) { - ret = SUCCESS; - } - } - } + m_info = (MxBITMAPINFO*) new MxU8[MxBitmapInfoSize()]; + if (!m_info) { + goto done; } + m_data = new MxU8[size]; + if (!m_data) { + goto done; + } + + m_bmiHeader = &m_info->m_bmiHeader; + m_paletteData = m_info->m_bmiColors; + memset(m_bmiHeader, 0, sizeof(m_info->m_bmiHeader)); + + m_bmiHeader->biSize = sizeof(*m_bmiHeader); // should be 40 bytes + m_bmiHeader->biWidth = p_width; + m_bmiHeader->biHeight = p_height; + m_bmiHeader->biPlanes = 1; + m_bmiHeader->biBitCount = 8; + m_bmiHeader->biCompression = 0; + m_bmiHeader->biSizeImage = size; + + if (ImportColorsToPalette(m_paletteData, p_palette)) { + goto done; + } + + if (SetBitDepth(p_isHighColor)) { + goto done; + } + + ret = SUCCESS; + +done: if (ret) { if (m_info) { - delete m_info; + delete[] m_info; m_info = NULL; } @@ -81,33 +94,37 @@ MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette, } // FUNCTION: LEGO1 0x100bcba0 +// FUNCTION: BETA10 0x1013ce25 MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info) { MxResult result = FAILURE; - MxLong width = p_info->m_bmiHeader.biWidth; - MxLong height = p_info->m_bmiHeader.biHeight; - MxLong size = AlignToFourByte(width) * height; + MxLong size = AlignToFourByte(p_info->m_bmiHeader.biWidth) * p_info->m_bmiHeader.biHeight; - this->m_info = new MxBITMAPINFO; - if (this->m_info) { - this->m_data = new MxU8[size]; - if (this->m_data) { - memcpy(this->m_info, p_info, sizeof(*this->m_info)); - this->m_bmiHeader = &this->m_info->m_bmiHeader; - this->m_paletteData = this->m_info->m_bmiColors; - result = SUCCESS; - } + m_info = (MxBITMAPINFO*) new MxU8[MxBitmapInfoSize()]; + if (!m_info) { + goto done; } + m_data = new MxU8[size]; + if (!m_data) { + goto done; + } + + memcpy(m_info, p_info, MxBitmapInfoSize()); + m_bmiHeader = &m_info->m_bmiHeader; + m_paletteData = m_info->m_bmiColors; + result = SUCCESS; + +done: if (result != SUCCESS) { - if (this->m_info) { - delete this->m_info; - this->m_info = NULL; + if (m_info) { + delete[] m_info; + m_info = NULL; } - if (this->m_data) { - delete[] this->m_data; - this->m_data = NULL; + if (m_data) { + delete[] m_data; + m_data = NULL; } } @@ -115,32 +132,38 @@ MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info) } // FUNCTION: LEGO1 0x100bcc40 +// FUNCTION: BETA10 0x1013cf6d MxResult MxBitmap::ImportBitmap(MxBitmap* p_bitmap) { MxResult result = FAILURE; - this->m_info = new MxBITMAPINFO; - if (this->m_info) { - this->m_data = new MxU8[p_bitmap->GetDataSize()]; - if (this->m_data) { - memcpy(this->m_info, p_bitmap->GetBitmapInfo(), MxBITMAPINFO::Size()); - memcpy(this->m_data, p_bitmap->GetImage(), p_bitmap->GetDataSize()); - - this->m_bmiHeader = &this->m_info->m_bmiHeader; - this->m_paletteData = this->m_info->m_bmiColors; - result = SUCCESS; - } + m_info = (MxBITMAPINFO*) new MxU8[p_bitmap->MxBitmapInfoSize()]; + if (!m_info) { + goto done; } + m_data = new MxU8[p_bitmap->GetDataSize()]; + if (!m_data) { + goto done; + } + + memcpy(m_info, p_bitmap->GetBitmapInfo(), p_bitmap->MxBitmapInfoSize()); + memcpy(m_data, p_bitmap->GetImage(), p_bitmap->GetDataSize()); + + m_bmiHeader = &m_info->m_bmiHeader; + m_paletteData = m_info->m_bmiColors; + result = SUCCESS; + +done: if (result != SUCCESS) { - if (this->m_info) { - delete this->m_info; - this->m_info = NULL; + if (m_info) { + delete[] m_info; + m_info = NULL; } - if (this->m_data) { - delete this->m_data; - this->m_data = NULL; + if (m_data) { + delete[] m_data; + m_data = NULL; } } @@ -148,16 +171,25 @@ MxResult MxBitmap::ImportBitmap(MxBitmap* p_bitmap) } // FUNCTION: LEGO1 0x100bcd10 +// FUNCTION: BETA10 0x1013d0c7 MxLong MxBitmap::Read(const char* p_filename) { MxResult result = FAILURE; - HANDLE handle = - CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE handle = 0; - if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle)) { - result = SUCCESS; + handle = CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (handle == INVALID_HANDLE_VALUE) { + goto done; } + if (LoadFile(handle)) { + goto done; + } + + result = SUCCESS; + +done: if (handle) { CloseHandle(handle); } @@ -166,46 +198,64 @@ MxLong MxBitmap::Read(const char* p_filename) } // FUNCTION: LEGO1 0x100bcd60 +// FUNCTION: BETA10 0x1013d169 MxResult MxBitmap::LoadFile(HANDLE p_handle) { MxResult result = FAILURE; + MxLong unused = 0; + + MxLong size; DWORD bytesRead; BITMAPFILEHEADER hdr; - - BOOL ret = ReadFile(p_handle, &hdr, sizeof(hdr), &bytesRead, NULL); - if (ret && (hdr.bfType == g_bitmapSignature)) { - this->m_info = new MxBITMAPINFO; - if (this->m_info) { - ret = ReadFile(p_handle, this->m_info, sizeof(*this->m_info), &bytesRead, NULL); - if (ret && (this->m_info->m_bmiHeader.biBitCount == 8)) { - MxLong size = hdr.bfSize - (sizeof(MxBITMAPINFO) + sizeof(BITMAPFILEHEADER)); - this->m_data = new MxU8[size]; - if (this->m_data) { - ret = ReadFile(p_handle, this->m_data, size, &bytesRead, NULL); - if (ret) { - this->m_bmiHeader = &this->m_info->m_bmiHeader; - this->m_paletteData = this->m_info->m_bmiColors; - if (this->m_info->m_bmiHeader.biSizeImage == 0) { - MxLong height = AbsFlipped(this->m_info->m_bmiHeader.biHeight); - this->m_info->m_bmiHeader.biSizeImage = - AlignToFourByte(this->m_info->m_bmiHeader.biWidth) * height; - } - result = SUCCESS; - } - } - } - } + if (!ReadFile(p_handle, &hdr, sizeof(hdr), &bytesRead, NULL)) { + goto done; } + if (hdr.bfType != g_bitmapSignature) { + goto done; + } + + m_info = (MxBITMAPINFO*) new MxU8[MxBitmapInfoSize()]; + if (!m_info) { + goto done; + } + + if (!ReadFile(p_handle, m_info, MxBitmapInfoSize(), &bytesRead, NULL)) { + goto done; + } + + if (m_info->m_bmiHeader.biBitCount != 8) { + goto done; + } + + size = hdr.bfSize - sizeof(BITMAPFILEHEADER) - MxBitmapInfoSize(); + m_data = new MxU8[size]; + if (!m_data) { + goto done; + } + + if (!ReadFile(p_handle, m_data, size, &bytesRead, NULL)) { + goto done; + } + + m_bmiHeader = &m_info->m_bmiHeader; + m_paletteData = m_info->m_bmiColors; + if (m_info->m_bmiHeader.biSizeImage == 0) { + m_info->m_bmiHeader.biSizeImage = GetDataSize(); + } + + result = SUCCESS; + +done: if (result != SUCCESS) { - if (this->m_info) { - delete this->m_info; - this->m_info = NULL; + if (m_info) { + delete[] m_info; + m_info = NULL; } - if (this->m_data) { - delete this->m_data; - this->m_data = NULL; + if (m_data) { + delete[] m_data; + m_data = NULL; } } @@ -213,6 +263,7 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle) } // FUNCTION: LEGO1 0x100bce70 +// FUNCTION: BETA10 0x1013d399 void MxBitmap::BitBlt( MxBitmap* p_src, MxS32 p_srcLeft, @@ -252,6 +303,7 @@ void MxBitmap::BitBlt( } // FUNCTION: LEGO1 0x100bd020 +// FUNCTION: BETA10 0x1013d4ea void MxBitmap::BitBltTransparent( MxBitmap* p_src, MxS32 p_srcLeft, @@ -298,24 +350,21 @@ void MxBitmap::BitBltTransparent( } // FUNCTION: LEGO1 0x100bd1c0 +// FUNCTION: BETA10 0x1013d684 MxPalette* MxBitmap::CreatePalette() { MxBool success = FALSE; MxPalette* palette = NULL; - switch (this->m_isHighColor) { + switch (m_isHighColor) { case FALSE: - palette = new MxPalette(this->m_paletteData); - - if (!palette) { + if (!(palette = new MxPalette(m_paletteData))) { goto done; } break; case TRUE: - palette = this->m_palette->Clone(); - - if (!palette) { + if (!(palette = m_palette->Clone())) { goto done; } @@ -336,24 +385,24 @@ MxPalette* MxBitmap::CreatePalette() } // FUNCTION: LEGO1 0x100bd280 +// FUNCTION: BETA10 0x1013d80e void MxBitmap::ImportPalette(MxPalette* p_palette) { // Odd to use a switch on a boolean, but it matches. - switch (this->m_isHighColor) { + switch (m_isHighColor) { case FALSE: - ImportColorsToPalette(this->m_paletteData, p_palette); + ImportColorsToPalette(m_paletteData, p_palette); break; case TRUE: - if (this->m_palette) { - delete this->m_palette; - } - this->m_palette = p_palette->Clone(); + delete m_palette; + m_palette = p_palette->Clone(); break; } } // FUNCTION: LEGO1 0x100bd2d0 +// FUNCTION: BETA10 0x1013d8a9 MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) { MxResult ret = FAILURE; @@ -368,17 +417,11 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) switch (p_isHighColor) { case FALSE: ImportColorsToPalette(m_paletteData, m_palette); - if (m_palette) { - delete m_palette; - } - + delete m_palette; m_palette = NULL; break; case TRUE: { - pal = NULL; - pal = new MxPalette(m_paletteData); - - if (!pal) { + if (!(pal = new MxPalette(m_paletteData))) { goto done; } @@ -409,6 +452,7 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor) } // FUNCTION: LEGO1 0x100bd3e0 +// FUNCTION: BETA10 0x1013dad2 MxResult MxBitmap::StretchBits( HDC p_hdc, MxS32 p_xSrc, @@ -420,8 +464,8 @@ MxResult MxBitmap::StretchBits( ) { // Compression fix? - if ((this->m_bmiHeader->biCompression != BI_RGB_TOPDOWN) && (0 < this->m_bmiHeader->biHeight)) { - p_ySrc = (this->m_bmiHeader->biHeight - p_destHeight) - p_ySrc; + if (IsBottomUp()) { + p_ySrc = GetBmiHeightAbs() - p_ySrc - p_destHeight; } return StretchDIBits( @@ -434,14 +478,15 @@ MxResult MxBitmap::StretchBits( p_ySrc, p_destWidth, p_destHeight, - this->m_data, - (BITMAPINFO*) this->m_info, - this->m_isHighColor, + m_data, + (BITMAPINFO*) m_info, + m_isHighColor, SRCCOPY ); } // FUNCTION: LEGO1 0x100bd450 +// FUNCTION: BETA10 0x1013db55 MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palette) { MxResult ret = FAILURE; From 60b747d7b2687b6df498634c6bc05b5d218c4e26 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 28 May 2024 11:20:23 -0400 Subject: [PATCH 78/89] Implement/match LegoPathBoundary::FUN_100586e0 and FUN_10057fe0 (#962) --- .../lego/legoomni/include/legoanimpresenter.h | 4 ++ .../lego/legoomni/include/legopathboundary.h | 33 +++++++++++++++ .../legoomni/src/paths/legopathboundary.cpp | 40 ++++++++++++++++--- LEGO1/lego/sources/geom/legowegedge.h | 2 +- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index f4745c18..d9d97bb5 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -83,8 +83,12 @@ class LegoAnimPresenter : public MxVideoPresenter { MxResult FUN_1006b140(LegoROI* p_roi); const char* GetActionObjectName(); + inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } + inline LegoAnim* GetAnimation() { return m_anim; } + friend class LegoPathBoundary; + protected: void Init(); void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index f46633d7..570b2ea2 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -131,6 +131,39 @@ class LegoPathBoundary : public LegoWEGEdge { // TEMPLATE: LEGO1 0x100573e0 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::begin +// TEMPLATE: LEGO1 0x100580c0 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::insert + +// TEMPLATE: LEGO1 0x10058330 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::iterator::_Dec + +// TEMPLATE: LEGO1 0x10058380 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Buynode + +// TEMPLATE: LEGO1 0x100583a0 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Insert + +// TEMPLATE: LEGO1 0x10058620 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Lrotate + +// TEMPLATE: LEGO1 0x10058680 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Rrotate + +// TEMPLATE: LEGO1 0x10058820 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::erase + +// TEMPLATE: LEGO1 0x100588e0 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::equal_range + +// TEMPLATE: LEGO1 0x10058950 +// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::_Lbound + +// TEMPLATE: LEGO1 0x10058980 +// _Construct + +// TEMPLATE: LEGO1 0x100589a0 +// _Distance + // GLOBAL: LEGO1 0x100f11a4 // _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::_Nil diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 057143ec..81108d61 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -2,6 +2,7 @@ #include "decomp.h" #include "geom/legounkown100db7f4.h" +#include "legolocomotionanimpresenter.h" #include "legopathactor.h" #include "legopathstruct.h" @@ -337,18 +338,47 @@ MxU32 LegoPathBoundary::Intersect( return 0; } -// STUB: LEGO1 0x10057fe0 +// FUNCTION: LEGO1 0x10057fe0 // FUNCTION: BETA10 0x100b2220 MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) { - // TODO - return 0; + Mx3DPointFloat unk0x30; + + unk0x30 = m_unk0x30; + ((Vector3&) unk0x30).Sub(&p_presenter->m_unk0xa8); + + float len = unk0x30.LenSquared(); + float local20 = p_presenter->m_unk0xa4 + m_unk0x44; + + if (len > 0.001 && len > local20 * local20) { + return 0; + } + + // TODO: This only seems to match if the type is not the same as the type of the + // key value of the set. Figure out which type the set (or parameter) actually uses. + // Also see call to .find in LegoPathController::FUN_10046050 + m_presenters.insert(static_cast(p_presenter)); + return 1; } -// STUB: LEGO1 0x100586e0 +// FUNCTION: LEGO1 0x100586e0 // FUNCTION: BETA10 0x100b22d1 MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter) { - // TODO + if (p_presenter != NULL) { + // TODO: This only seems to match if the type is not the same as the type of the + // key value of the set. Figure out which type the set (or parameter) actually uses. + // Also see call to .find in LegoPathController::FUN_10046050 + if (m_presenters.find(static_cast(p_presenter)) != m_presenters.end()) { + m_presenters.erase(static_cast(p_presenter)); + return 1; + } + } + else { + for (LegoAnimPresenterSet::iterator it = m_presenters.begin(); it != m_presenters.end(); it++) { + (*it)->SetCurrentWorld(NULL); + } + } + return 0; } diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index aff336e6..efce4662 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -69,7 +69,7 @@ class LegoWEGEdge : public LegoWEEdge { Mx4DPointFloat m_unk0x14; // 0x14 Mx4DPointFloat* m_edgeNormals; // 0x2c Mx3DPointFloat m_unk0x30; // 0x30 - LegoU32 m_unk0x44; // 0x44 + float m_unk0x44; // 0x44 LegoU8 m_unk0x48; // 0x48 PathWithTrigger* m_pathTrigger; // 0x4c Mx3DPointFloat* m_unk0x50; // 0x50 From da48dfb40dfc553eaca5bed9436d1a8846a3a519 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 28 May 2024 15:23:23 -0400 Subject: [PATCH 79/89] Implement/match LegoAnimPresenter::FUN_1006b140 (#963) --- .../lego/legoomni/include/legoanimpresenter.h | 12 +-- .../legoomni/src/video/legoanimpresenter.cpp | 52 +++++++++++- LEGO1/realtime/matrix.h | 82 ++++++++++++++++++- 3 files changed, 136 insertions(+), 10 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index d9d97bb5..d7cc4cb2 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -84,11 +84,11 @@ class LegoAnimPresenter : public MxVideoPresenter { const char* GetActionObjectName(); inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } + inline void SetUnknown0x0cTo1() { m_unk0x9c = 1; } + inline void SetUnknown0xa0(MxMatrix* p_unk0xa0) { m_unk0xa0 = p_unk0xa0; } inline LegoAnim* GetAnimation() { return m_anim; } - friend class LegoPathBoundary; - protected: void Init(); void Destroy(MxBool p_fromDestructor); @@ -128,9 +128,11 @@ class LegoAnimPresenter : public MxVideoPresenter { undefined m_unk0x97; // 0x97 LegoAnimSubstMap* m_substMap; // 0x98 MxS16 m_unk0x9c; // 0x9c - undefined4* m_unk0xa0; // 0xa0 - float m_unk0xa4; // 0xa4 - Mx3DPointFloat m_unk0xa8; // 0xa8 + MxMatrix* m_unk0xa0; // 0xa0 + +public: + float m_unk0xa4; // 0xa4 + Mx3DPointFloat m_unk0xa8; // 0xa8 }; // clang-format off diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 503c6282..11aa7f40 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -121,7 +121,7 @@ void LegoAnimPresenter::Destroy(MxBool p_fromDestructor) } if (m_unk0xa0 != NULL) { - delete m_unk0xa0; // TODO + delete m_unk0xa0; } Init(); @@ -699,11 +699,57 @@ MxResult LegoAnimPresenter::FUN_1006afc0(MxMatrix*& p_matrix, float p_und) return SUCCESS; } -// STUB: LEGO1 0x1006b140 +// FUNCTION: LEGO1 0x1006b140 // FUNCTION: BETA10 0x100507e0 MxResult LegoAnimPresenter::FUN_1006b140(LegoROI* p_roi) { - // TODO + if (p_roi == NULL) { + return FAILURE; + } + + MxMatrix* mn = new MxMatrix(); + MxMatrix local58; + const Matrix4& local2world = p_roi->GetLocal2World(); + MxMatrix* local5c; + MxU32 i; + + if (FUN_1006afc0(local5c, 0.0f) != SUCCESS) { + goto done; + } + + for (i = 1; i <= m_roiMapSize; i++) { + if (m_roiMap[i] == p_roi) { + if (local5c[i].Unknown(local58) != SUCCESS) { + goto done; + } + + break; + } + } + + { + ((Matrix4*) mn)->Product(local58, local2world); + SetUnknown0xa0(mn); + delete[] local5c; + SetUnknown0x0cTo1(); + + MxMatrix local140(*m_unk0x78); + MxMatrix localf8; + + localf8.Product(local140, *m_unk0xa0); + ((Matrix4&) *m_unk0x78) = localf8; + return SUCCESS; + } + +done: + if (mn != NULL) { + delete mn; + } + + if (local5c != NULL) { + delete[] local5c; + } + return FAILURE; } diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index 82c3166a..df2260ea 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -16,6 +16,7 @@ struct UnknownMatrixType { // SIZE 0x08 class Matrix4 { public: + // FUNCTION: LEGO1 0x10004500 inline Matrix4(float (*p_data)[4]) { SetData(p_data); } // Note: virtual function overloads appear in the virtual table @@ -107,6 +108,9 @@ class Matrix4 { // FUNCTION: LEGO1 0x10002530 virtual void Product(const Matrix4& p_a, const Matrix4& p_b) { Product(p_a.m_data, p_b.m_data); } // vtable+0x38 + inline virtual void ToQuaternion(Vector4& p_resultQuat); // vtable+0x40 + inline virtual int FromQuaternion(const Vector4& p_vec); // vtable+0x44 + // FUNCTION: LEGO1 0x100a0ff0 inline void Scale(const float& p_x, const float& p_y, const float& p_z) { @@ -141,8 +145,17 @@ class Matrix4 { } } - inline virtual void ToQuaternion(Vector4& p_resultQuat); // vtable+0x40 - inline virtual int FromQuaternion(const Vector4& p_vec); // vtable+0x44 + inline int Unknown(Matrix4& p_mat); + + // FUNCTION: LEGO1 0x1006b500 + inline void Swap(int p_d1, int p_d2) + { + for (int i = 0; i < 4; i++) { + float e = m_data[p_d1][i]; + m_data[p_d1][i] = m_data[p_d2][i]; + m_data[p_d2][i] = e; + } + } float* operator[](int idx) { return m_data[idx]; } const float* operator[](int idx) const { return m_data[idx]; } @@ -241,4 +254,69 @@ inline int Matrix4::FromQuaternion(const Vector4& p_vec) return -1; } +// FUNCTION: BETA10 0x1005a590 +inline int Matrix4::Unknown(Matrix4& p_mat) +{ + float local5c[4][4]; + Matrix4 localc(local5c); + + ((Matrix4&) localc) = *this; + p_mat.SetIdentity(); + + for (int i = 0; i < 4; i++) { + int local1c = i; + int local10; + + for (local10 = i + 1; local10 < 4; local10++) { + if (fabs(localc[local1c][i]) < fabs(localc[local10][i])) { + local1c = local10; + } + } + + if (local1c != i) { + localc.Swap(local1c, i); + p_mat.Swap(local1c, i); + } + + if (localc[i][i] < 0.001f && localc[i][i] > -0.001f) { + return -1; + } + + float local60 = localc[i][i]; + int local18; + + for (local18 = 0; local18 < 4; local18++) { + p_mat[i][local18] /= local60; + } + + for (local18 = 0; local18 < 4; local18++) { + localc[i][local18] /= local60; + } + + for (local10 = 0; local10 < 4; local10++) { + if (i != local10) { + float afStack70[4]; + + for (local18 = 0; local18 < 4; local18++) { + afStack70[local18] = p_mat[i][local18] * localc[local10][i]; + } + + for (local18 = 0; local18 < 4; local18++) { + p_mat[local10][local18] -= afStack70[local18]; + } + + for (local18 = 0; local18 < 4; local18++) { + afStack70[local18] = localc[i][local18] * localc[local10][i]; + } + + for (local18 = 0; local18 < 4; local18++) { + localc[local10][local18] -= afStack70[local18]; + } + } + } + } + + return 0; +} + #endif // MATRIX_H From 5f00634b9c617fb4fff414759c82cd6fc264fdc2 Mon Sep 17 00:00:00 2001 From: MS Date: Wed, 29 May 2024 10:47:25 -0400 Subject: [PATCH 80/89] Implement LegoMeterPresenter::DrawMeter (#964) * Implement LegoMeterPresenter::DrawMeter * New MxRect16 header, offsets and size annotations * Missing mxtypes include --- .../legoomni/include/legometerpresenter.h | 32 ++++-- .../src/control/legometerpresenter.cpp | 104 ++++++++++++++---- LEGO1/omni/include/mxbitmap.h | 29 ++--- LEGO1/omni/include/mxrect16.h | 47 ++++++++ 4 files changed, 167 insertions(+), 45 deletions(-) create mode 100644 LEGO1/omni/include/mxrect16.h diff --git a/LEGO1/lego/legoomni/include/legometerpresenter.h b/LEGO1/lego/legoomni/include/legometerpresenter.h index ad43944d..9a8b7acd 100644 --- a/LEGO1/lego/legoomni/include/legometerpresenter.h +++ b/LEGO1/lego/legoomni/include/legometerpresenter.h @@ -1,10 +1,18 @@ #ifndef LEGOMETERPRESENTER_H #define LEGOMETERPRESENTER_H +#include "mxrect16.h" #include "mxstillpresenter.h" #include "mxstring.h" +// SIZE 0x08 +struct MeterRect : public MxRect16 { + // FUNCTION: BETA10 0x10097eb0 + MeterRect() {} +}; + // VTABLE: LEGO1 0x100d7ac8 +// VTABLE: BETA10 0x101bca68 // SIZE 0x94 class LegoMeterPresenter : public MxStillPresenter { public: @@ -18,17 +26,21 @@ class LegoMeterPresenter : public MxStillPresenter { void ParseExtra() override; // vtable+0x30 private: - void FUN_10043a50(); + enum MeterLayout { + e_leftToRight = 0, + e_rightToLeft, + e_bottomToTop, + e_topToBottom + }; - MxU8* m_unk0x6c; // 0x6c - MxU16 m_type; // 0x70 - MxString m_variable; // 0x74 - MxFloat m_unk0x84; // 0x84 - MxU16 m_unk0x88; // 0x88 - MxU16 m_unk0x8a; // 0x8a - MxU16 m_unk0x8c; // 0x8c - MxU16 m_unk0x8e; // 0x8e - MxU16 m_layout; // 0x90 + void DrawMeter(); + + MxU8* m_meterPixels; // 0x6c + MxU16 m_fillColor; // 0x70 + MxString m_variable; // 0x74 + MxFloat m_curPercent; // 0x84 + MeterRect m_meterRect; // 0x88 + MxS16 m_layout; // 0x90 }; // SYNTHETIC: LEGO1 0x10043760 diff --git a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index d6dd5dd8..c6c8352a 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -4,27 +4,34 @@ #include "define.h" #include "mxbitmap.h" #include "mxdsaction.h" +#include "mxmisc.h" #include "mxutilities.h" +#include "mxvariabletable.h" + +#include DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94) // FUNCTION: LEGO1 0x10043430 +// FUNCTION: BETA10 0x10097570 LegoMeterPresenter::LegoMeterPresenter() { - m_layout = 0; - m_unk0x6c = 0; - m_unk0x84 = 0; - m_type = 1; - SetBit1(FALSE); + m_meterPixels = NULL; + m_fillColor = 1; + m_curPercent = 0; + m_layout = e_leftToRight; + m_flags.m_bit1 = FALSE; } // FUNCTION: LEGO1 0x10043780 +// FUNCTION: BETA10 0x1009764a LegoMeterPresenter::~LegoMeterPresenter() { - delete m_unk0x6c; + delete m_meterPixels; } // FUNCTION: LEGO1 0x10043800 +// FUNCTION: BETA10 0x100976ec void LegoMeterPresenter::ParseExtra() { MxStillPresenter::ParseExtra(); @@ -41,27 +48,28 @@ void LegoMeterPresenter::ParseExtra() char output[256]; if (KeyValueStringParse(extraCopy, g_strTYPE, output)) { if (!strcmpi(output, g_strLEFT_TO_RIGHT)) { - m_layout = 0; + m_layout = e_leftToRight; } else if (!strcmpi(output, g_strRIGHT_TO_LEFT)) { - m_layout = 1; + m_layout = e_rightToLeft; } else if (!strcmpi(output, g_strBOTTOM_TO_TOP)) { - m_layout = 2; + m_layout = e_bottomToTop; } else if (!strcmpi(output, g_strTOP_TO_BOTTOM)) { - m_layout = 3; + m_layout = e_topToBottom; } } if (KeyValueStringParse(extraCopy, g_strFILLER_INDEX, output)) { - m_type = atoi(output); + m_fillColor = atoi(output); } if (KeyValueStringParse(extraCopy, g_strVARIABLE, output)) { m_variable = output; } else { + assert(0); EndAction(); } } @@ -71,30 +79,84 @@ void LegoMeterPresenter::ParseExtra() } // FUNCTION: LEGO1 0x10043990 +// FUNCTION: BETA10 0x10097917 void LegoMeterPresenter::StreamingTickle() { MxStillPresenter::StreamingTickle(); - m_unk0x6c = new MxU8[m_frameBitmap->GetBmiStride() * m_frameBitmap->GetBmiHeightAbs()]; - if (m_unk0x6c == NULL) { + m_meterPixels = new MxU8[m_frameBitmap->GetDataSize()]; + if (m_meterPixels == NULL) { + assert(0); EndAction(); } - memcpy(m_unk0x6c, m_frameBitmap->GetImage(), m_frameBitmap->GetBmiStride() * m_frameBitmap->GetBmiHeightAbs()); + memcpy(m_meterPixels, m_frameBitmap->GetImage(), m_frameBitmap->GetDataSize()); - m_unk0x88 = 0; - m_unk0x8a = 0; - m_unk0x8c = m_frameBitmap->GetBmiWidth() - 1; - m_unk0x8e = m_frameBitmap->GetBmiHeightAbs() - 1; + m_meterRect.SetLeft(0); + m_meterRect.SetTop(0); + m_meterRect.SetRight(m_frameBitmap->GetBmiWidth() - 1); + m_meterRect.SetBottom(m_frameBitmap->GetBmiHeightAbs() - 1); } // FUNCTION: LEGO1 0x10043a30 +// FUNCTION: BETA10 0x10097a1a void LegoMeterPresenter::RepeatingTickle() { - FUN_10043a50(); + DrawMeter(); MxStillPresenter::RepeatingTickle(); } -// STUB: LEGO1 0x10043a50 -void LegoMeterPresenter::FUN_10043a50() +// FUNCTION: LEGO1 0x10043a50 +// FUNCTION: BETA10 0x10097a40 +void LegoMeterPresenter::DrawMeter() { + const char* strval = VariableTable()->GetVariable(m_variable.GetData()); + MxFloat percent = atof(strval); + MxS16 row, leftRightCol, bottomTopCol, leftRightEnd, bottomTopEnd; + + if (strval != NULL && m_curPercent != percent) { + m_curPercent = percent; + + // DECOMP: This clamp is retail only + if (percent > 0.99) { + m_curPercent = 0.99f; + } + else if (percent < 0.0) { + m_curPercent = 0.0f; + } + + // Copy the previously drawn meter back into the bitmap + memcpy(m_frameBitmap->GetImage(), m_meterPixels, m_frameBitmap->GetDataSize()); + + switch (m_layout) { + case e_leftToRight: + leftRightEnd = m_meterRect.GetWidth() * m_curPercent; + + for (row = m_meterRect.GetTop(); row < m_meterRect.GetBottom(); row++) { + MxU8* line = m_frameBitmap->GetStart(m_meterRect.GetLeft(), row); + + for (leftRightCol = 0; leftRightCol < leftRightEnd; leftRightCol++, line++) { + if (*line) { + *line = m_fillColor; + } + } + } + break; + case e_bottomToTop: + bottomTopEnd = m_meterRect.GetBottom() - (MxS16) (m_meterRect.GetHeight() * m_curPercent); + + for (row = m_meterRect.GetBottom(); row < bottomTopEnd; row--) { + MxU8* line = m_frameBitmap->GetStart(m_meterRect.GetLeft(), row); + + for (bottomTopCol = 0; bottomTopCol < m_meterRect.GetWidth(); bottomTopCol++, line++) { + if (*line) { + *line = m_fillColor; + } + } + } + // break; + default: + // The other two fill options are not implemented. + break; + } + } } diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index c9c949be..e0056957 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -113,6 +113,17 @@ class MxBitmap : public MxCore { // FUNCTION: BETA10 0x100982b0 inline MxLong GetDataSize() const { return AlignToFourByte(m_bmiHeader->biWidth) * GetBmiHeightAbs(); } + // FUNCTION: BETA10 0x1002c4b0 + inline MxBool IsTopDown() + { + if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) { + return TRUE; + } + else { + return m_bmiHeader->biHeight < 0; + } + } + inline MxLong GetAdjustedStride() { if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) { @@ -123,28 +134,18 @@ class MxBitmap : public MxCore { } } - inline MxLong GetLine(MxS32 p_top) - { - MxS32 height; - if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN || m_bmiHeader->biHeight < 0) { - height = p_top; - } - else { - height = GetBmiHeightAbs() - p_top - 1; - } - return GetBmiStride() * height; - } - + // FUNCTION: BETA10 0x1002c320 inline MxU8* GetStart(MxS32 p_left, MxS32 p_top) { if (m_bmiHeader->biCompression == BI_RGB) { - return GetLine(p_top) + m_data + p_left; + return m_data + p_left + + AlignToFourByte(GetBmiWidth()) * (IsTopDown() ? p_top : (GetBmiHeightAbs() - 1) - p_top); } else if (m_bmiHeader->biCompression == BI_RGB_TOPDOWN) { return m_data; } else { - return GetLine(0) + m_data; + return m_data + AlignToFourByte(GetBmiWidth()) * (IsTopDown() ? 0 : (GetBmiHeightAbs() - 1)); } } diff --git a/LEGO1/omni/include/mxrect16.h b/LEGO1/omni/include/mxrect16.h new file mode 100644 index 00000000..1dd82dc5 --- /dev/null +++ b/LEGO1/omni/include/mxrect16.h @@ -0,0 +1,47 @@ +#ifndef MXRECT16_H +#define MXRECT16_H + +#include "mxtypes.h" + +// SIZE 0x08 +struct MxRect16 { + // FUNCTION: BETA10 0x10097ee0 + MxRect16() {} + + // FUNCTION: BETA10 0x100981f0 + inline void SetLeft(MxS16 p_left) { m_left = p_left; } + + // FUNCTION: BETA10 0x10098220 + inline void SetTop(MxS16 p_top) { m_top = p_top; } + + // FUNCTION: BETA10 0x10098250 + inline void SetRight(MxS16 p_right) { m_right = p_right; } + + // FUNCTION: BETA10 0x10098280 + inline void SetBottom(MxS16 p_bottom) { m_bottom = p_bottom; } + + // FUNCTION: BETA10 0x10098300 + inline MxS16 GetLeft() const { return m_left; } + + // FUNCTION: BETA10 0x10098330 + inline MxS16 GetTop() const { return m_top; } + + // There is no GetRight() + + // FUNCTION: BETA10 0x10098360 + inline MxS16 GetBottom() const { return m_bottom; } + + // FUNCTION: BETA10 0x10098390 + inline MxS16 GetWidth() const { return m_right - m_left + 1; } + + // FUNCTION: BETA10 0x100983c0 + inline MxS16 GetHeight() const { return m_bottom - m_top + 1; } + +private: + MxS16 m_left; // 0x00 + MxS16 m_top; // 0x02 + MxS16 m_right; // 0x04 + MxS16 m_bottom; // 0x06 +}; + +#endif // MXRECT16_H From 36ec252f7e6e0badb7093a7c5e55b5f92de1e407 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 29 May 2024 11:05:50 -0400 Subject: [PATCH 81/89] Implement/match LegoAnimationManager::FUN_10063270 (#965) --- .../legoomni/include/legoanimationmanager.h | 5 +- .../src/common/legoanimationmanager.cpp | 119 +++++++++++++++++- 2 files changed, 119 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index b25b2510..1ad249ea 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -108,7 +108,7 @@ class LegoAnimationManager : public MxCore { void FUN_10062770(); void PurgeExtra(MxBool p_und); void AddExtra(MxS32 p_location, MxBool p_und); - void FUN_10063270(LegoROIList*, LegoAnimPresenter*); + void FUN_10063270(LegoROIList* p_list, LegoAnimPresenter* p_presenter); void FUN_10063780(LegoROIList* p_list); MxResult FUN_10064670(Vector3* p_position); MxResult FUN_10064740(Vector3* p_position); @@ -151,9 +151,12 @@ class LegoAnimationManager : public MxCore { void FUN_10062580(AnimInfo& p_info); MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); + MxBool FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter); + void FUN_10063950(LegoROI* p_roi); void FUN_10063aa0(); MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId); void FUN_10063d10(); + void FUN_10063e40(LegoAnimPresenter* p_presenter); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); 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); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 2d780d0a..60545c39 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1396,7 +1396,6 @@ MxLong LegoAnimationManager::Notify(MxParam& p_param) if (roi != NULL) { LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); - if (actor != NULL) { actor->Restart(); } @@ -2030,10 +2029,92 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) } } -// STUB: LEGO1 0x10063270 -void LegoAnimationManager::FUN_10063270(LegoROIList*, LegoAnimPresenter*) +// STUB: LEGO1 0x10062e20 +// FUNCTION: BETA10 0x100444cb +MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter) { - // TODO + return FALSE; +} + +// FUNCTION: LEGO1 0x10063270 +// FUNCTION: BETA10 0x10044b9a +void LegoAnimationManager::FUN_10063270(LegoROIList* p_list, LegoAnimPresenter* p_presenter) +{ + if (p_list != NULL) { + LegoWorld* world = CurrentWorld(); + LegoROI* roi; + MxU32 i; + + for (i = 0; i < sizeOfArray(g_vehicles); i++) { + roi = Lego()->FindROI(g_vehicles[i].m_name); + + if (roi != NULL) { + if (!g_vehicles[i].m_unk0x05 && roi->GetVisibility()) { + g_vehicles[i].m_unk0x04 = TRUE; + } + else { + g_vehicles[i].m_unk0x04 = FALSE; + } + } + } + + LegoROIListCursor cursor(p_list); + + while (cursor.Next(roi)) { + if (roi->GetVisibility() && FUN_10062e20(roi, p_presenter)) { + cursor.Detach(); + FUN_10063950(roi); + } + else { + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + + if (actor != NULL) { + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + if (m_extras[i].m_roi == roi) { + if (actor->GetController() != NULL) { + actor->GetController()->RemoveActor(actor); + actor->SetController(NULL); + } + + if (m_extras[i].m_unk0x14) { + m_extras[i].m_unk0x14 = FALSE; + + MxS32 vehicleId = g_characters[m_extras[i].m_characterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + + LegoROI* roi = Lego()->FindROI(g_vehicles[vehicleId].m_name); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + + m_extras[i].m_roi = NULL; + g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; + m_extras[i].m_characterId = -1; + m_extras[i].m_unk0x0d = FALSE; + m_unk0x414--; + break; + } + } + } + } + } + + FUN_10063e40(p_presenter); + + for (i = 0; i < sizeOfArray(g_vehicles); i++) { + if (!g_vehicles[i].m_unk0x05) { + roi = Lego()->FindROI(g_vehicles[i].m_name); + + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + } } // FUNCTION: LEGO1 0x10063780 @@ -2054,6 +2135,19 @@ void LegoAnimationManager::FUN_10063780(LegoROIList* p_list) } } +// FUNCTION: LEGO1 0x10063950 +void LegoAnimationManager::FUN_10063950(LegoROI* p_roi) +{ + if (m_unk0x424 != NULL) { + LegoROIListCursor cursor(m_unk0x424); + + if (cursor.Find(p_roi)) { + CharacterManager()->FUN_10083db0(p_roi); + cursor.Detach(); + } + } +} + // FUNCTION: LEGO1 0x10063aa0 void LegoAnimationManager::FUN_10063aa0() { @@ -2171,6 +2265,23 @@ void LegoAnimationManager::FUN_10063d10() } } +// FUNCTION: LEGO1 0x10063e40 +void LegoAnimationManager::FUN_10063e40(LegoAnimPresenter* p_presenter) +{ + if (m_unk0x424 != NULL) { + LegoROIListCursor cursor(m_unk0x424); + LegoROI* roi; + + while (cursor.Next(roi)) { + if (!FUN_10062e20(roi, p_presenter)) { + CharacterManager()->FUN_10083db0(roi); + } + + cursor.Detach(); + } + } +} + // FUNCTION: LEGO1 0x10063fb0 // FUNCTION: BETA10 0x100452a7 MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world) From 2f1aa58153b6ef15eb4c360345b26c6fe012e217 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 29 May 2024 11:35:36 -0400 Subject: [PATCH 82/89] Implement/match LegoAnimMMPresenter::FUN_1004b840 (#966) --- .../lego/legoomni/include/legoanimpresenter.h | 1 + .../src/common/legoanimmmpresenter.cpp | 28 ++++++++++++++++--- .../legoomni/src/video/legoanimpresenter.cpp | 11 ++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index d7cc4cb2..44ed14aa 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -81,6 +81,7 @@ class LegoAnimPresenter : public MxVideoPresenter { MxResult FUN_1006afc0(MxMatrix*& p_matrix, float p_und); MxResult FUN_1006b140(LegoROI* p_roi); + void FUN_1006c7a0(); const char* GetActionObjectName(); inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index d2e37eba..6b778ad7 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -16,6 +16,7 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxobjectfactory.h" +#include "mxstreamer.h" #include "mxtimer.h" #include "mxutilities.h" @@ -465,10 +466,28 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) return TRUE; } -// STUB: LEGO1 0x1004b840 +// FUNCTION: LEGO1 0x1004b840 +// FUNCTION: BETA10 0x1004d033 void LegoAnimMMPresenter::FUN_1004b840() { - // TODO + MxDSAction* action = m_action; + + if (m_presenter != NULL) { + m_presenter->FUN_1006c7a0(); + } + + for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { + if (*it != m_presenter) { + (*it)->EndAction(); + } + } + + FUN_1004b6d0(0); + EndAction(); + + if (action != NULL) { + Streamer()->FUN_100b98f0(action); + } } // FUNCTION: LEGO1 0x1004b8b0 @@ -478,8 +497,9 @@ MxBool LegoAnimMMPresenter::FUN_1004b8b0() return m_tranInfo != NULL ? m_tranInfo->m_unk0x28 : TRUE; } -// STUB: LEGO1 0x1004b8c0 +// FUNCTION: LEGO1 0x1004b8c0 +// FUNCTION: BETA10 0x1004d13d void LegoAnimMMPresenter::FUN_1004b8c0() { - // TODO + FUN_1004b6d0(0); } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 11aa7f40..9d126327 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1100,6 +1100,17 @@ void LegoAnimPresenter::EndAction() MxVideoPresenter::EndAction(); } +// FUNCTION: LEGO1 0x1006c7a0 +// FUNCTION: BETA10 0x10051da6 +void LegoAnimPresenter::FUN_1006c7a0() +{ + if (m_anim != NULL) { + FUN_1006b9a0(m_anim, m_anim->GetDuration(), m_unk0x78); + } + + m_unk0x95 = TRUE; +} + // FUNCTION: LEGO1 0x1006c7d0 // FUNCTION: BETA10 0x10051e07 void LegoAnimPresenter::VTable0x8c() From b978787f8f0333dd69a60ddd004d23b4d4fd7dc0 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 29 May 2024 13:24:08 -0400 Subject: [PATCH 83/89] Implement/match LegoAnimationManager::FUN_10062e20 (#967) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../legoomni/include/legopathcontroller.h | 6 +- LEGO1/lego/legoomni/include/legoworld.h | 6 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 4 +- .../legoomni/src/actors/islepathactor.cpp | 6 +- .../src/common/legoanimationmanager.cpp | 170 ++++++++++++++++-- .../src/common/legoanimmmpresenter.cpp | 6 +- .../legoomni/src/common/legogamestate.cpp | 8 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 16 +- .../legoomni/src/paths/legopathcontroller.cpp | 6 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 14 +- 11 files changed, 197 insertions(+), 47 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 1ad249ea..e118cbf5 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -28,7 +28,7 @@ class LegoAnimationManager : public MxCore { // SIZE 0x18 struct Character { char* m_name; // 0x00 - MxBool m_unk0x04; // 0x04 + MxBool m_inExtras; // 0x04 MxS8 m_vehicleId; // 0x05 undefined m_unk0x06; // 0x06 (unused?) MxBool m_unk0x07; // 0x07 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index a65a1f34..7bb38b61 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -81,7 +81,7 @@ class LegoPathController : public MxCore { virtual MxResult Create(MxU8* p_data, const Vector3& p_location, const MxAtomId& p_trigger); // vtable+0x14 virtual void Destroy(); // vtable+0x18 - MxResult FUN_10045c20( + MxResult PlaceActor( LegoPathActor* p_actor, const char* p_name, MxS32 p_src, @@ -89,13 +89,13 @@ class LegoPathController : public MxCore { MxS32 p_dest, float p_destScale ); - MxResult FUN_10046050( + MxResult PlaceActor( LegoPathActor* p_actor, LegoAnimPresenter* p_presenter, Vector3& p_position, Vector3& p_direction ); - MxResult AddActor(LegoPathActor* p_actor); + MxResult PlaceActor(LegoPathActor* p_actor); MxResult RemoveActor(LegoPathActor* p_actor); void FUN_100468f0(LegoAnimPresenter* p_presenter); void FUN_10046930(LegoAnimPresenter* p_presenter); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 2dd7321a..79088500 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -72,14 +72,14 @@ class LegoWorld : public LegoEntity { MxS32 p_dest, float p_destScale ); - MxResult AddPathActor(LegoPathActor* p_actor); - MxResult FUN_1001fb70( + MxResult PlaceActor(LegoPathActor* p_actor); + MxResult PlaceActor( LegoPathActor* p_actor, LegoAnimPresenter* p_presenter, Vector3& p_position, Vector3& p_direction ); - void RemovePathActor(LegoPathActor* p_actor); + void RemoveActor(LegoPathActor* p_actor); void FUN_1001fda0(LegoAnimPresenter* p_presenter); void FUN_1001fe90(LegoAnimPresenter* p_presenter); LegoPathBoundary* FindPathBoundary(const char* p_name); diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index d3b3ef51..5c0a26b3 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -192,7 +192,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) if (m_state->GetUnkown8() == 0) { state->SetUnknown18(4); m_state->SetUnknown8(1); - m_world->RemovePathActor(this); + m_world->RemoveActor(this); InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL); SetState(0); } @@ -205,7 +205,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) } if (m_state->GetUnkown8() == 2) { m_state->SetUnknown8(3); - m_world->RemovePathActor(this); + m_world->RemoveActor(this); InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterLand_Anim, NULL); SetState(4); } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index edaaa314..c3913942 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -471,7 +471,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p assert(world); if (m_world != NULL) { - m_world->RemovePathActor(this); + m_world->RemoveActor(this); m_world->Remove(this); VideoManager()->Get3DManager()->Remove(*m_roi); } @@ -556,7 +556,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset) { if (m_world) { - m_world->RemovePathActor(this); + m_world->RemoveActor(this); m_world->Remove(this); VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); } @@ -566,7 +566,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar VTable0xe0(); } - m_world->AddPathActor(this); + m_world->PlaceActor(this); p_boundary->AddActor(this); if (m_actorId != GameState()->GetActorId()) { m_world->Add(this); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 60545c39..39de0c7a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -347,7 +347,7 @@ LegoAnimationManager::~LegoAnimationManager() LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); if (actor != NULL && actor->GetController() != NULL && CurrentWorld() != NULL) { - CurrentWorld()->RemovePathActor(actor); + CurrentWorld()->RemoveActor(actor); actor->SetController(NULL); } @@ -467,7 +467,7 @@ void LegoAnimationManager::Suspend() m_unk0x401 = FALSE; for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { - g_characters[i].m_unk0x04 = FALSE; + g_characters[i].m_inExtras = FALSE; } } } @@ -531,7 +531,7 @@ void LegoAnimationManager::Init() for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { g_characters[i].m_active = FALSE; - g_characters[i].m_unk0x04 = FALSE; + g_characters[i].m_inExtras = FALSE; } for (i = 0; i < (MxS32) sizeOfArray(g_vehicles); i++) { @@ -1468,7 +1468,7 @@ MxResult LegoAnimationManager::Tickle() } m_extras[i].m_roi = NULL; - g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_inExtras = FALSE; g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; m_extras[i].m_characterId = -1; m_extras[i].m_unk0x0d = FALSE; @@ -1837,7 +1837,7 @@ void LegoAnimationManager::PurgeExtra(MxBool p_und) } m_extras[i].m_roi = NULL; - g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_inExtras = FALSE; g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; m_extras[i].m_characterId = -1; } @@ -1928,7 +1928,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) tryNextCharacter: if (g_characters[m_lastExtraCharacterId].m_unk0x09 && g_characters[m_lastExtraCharacterId].m_unk0x08 && - !g_characters[m_lastExtraCharacterId].m_unk0x04 && + !g_characters[m_lastExtraCharacterId].m_inExtras && g_characters[m_lastExtraCharacterId].m_active == active) { if (!CharacterManager()->FUN_10083b20(g_characters[m_lastExtraCharacterId].m_name )) { @@ -1994,7 +1994,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) actor->SetWorldSpeed(speed); m_extras[i].m_characterId = m_lastExtraCharacterId; - g_characters[m_lastExtraCharacterId].m_unk0x04 = TRUE; + g_characters[m_lastExtraCharacterId].m_inExtras = TRUE; m_extras[i].m_unk0x08 = Timer()->GetTime(); m_extras[i].m_speed = -1; m_extras[i].m_unk0x0d = FALSE; @@ -2029,10 +2029,160 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) } } -// STUB: LEGO1 0x10062e20 +// FUNCTION: LEGO1 0x10062e20 // FUNCTION: BETA10 0x100444cb MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter) { + LegoWorld* world = CurrentWorld(); + + if (world == NULL || m_suspended || !m_unk0x400) { + return FALSE; + } + + MxBool inExtras = FALSE; + const char* name = p_roi->GetName(); + + LegoExtraActor* actor = CharacterManager()->GetActor(name); + if (actor != NULL) { + MxS32 characterId = -1; + MxS32 i; + + for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) { + if (!strcmpi(name, g_characters[i].m_name)) { + characterId = i; + break; + } + } + + if (characterId == -1) { + return FALSE; + } + + if (!g_characters[characterId].m_inExtras) { + for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + if (m_extras[i].m_roi == NULL) { + m_extras[i].m_roi = p_roi; + break; + } + } + + if (i == (MxS32) sizeOfArray(m_extras)) { + return FALSE; + } + } + else { + inExtras = TRUE; + + for (i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + if (m_extras[i].m_roi == p_roi) { + break; + } + } + + if (i == (MxS32) sizeOfArray(m_extras)) { + return FALSE; + } + } + + if (g_characters[characterId].m_unk0x07) { + m_unk0x414--; + + if (actor->GetBoundary() == NULL) { + g_characters[characterId].m_unk0x07 = FALSE; + + if (g_characters[characterId].m_unk0x0c < 0) { + g_characters[characterId].m_unk0x0c = 0; + } + + if (g_characters[characterId].m_unk0x10 < 0) { + g_characters[characterId].m_unk0x10 = 0; + } + + m_extras[i].m_roi = NULL; + g_characters[characterId].m_unk0x07 = FALSE; + g_characters[characterId].m_inExtras = FALSE; + return FALSE; + } + + CharacterManager()->FUN_10083db0(p_roi); + } + else { + if (inExtras) { + return FALSE; + } + } + + if (GameState()->GetCurrentAct() != LegoGameState::e_act1 && !strcmp(name, "brickstr")) { + return FALSE; + } + + MxBool local24 = inExtras && g_characters[characterId].m_unk0x07 && + (g_characters[characterId].m_unk0x0c < 0 || g_characters[characterId].m_unk0x10 < 0); + + MxResult result = 1; // Not a valid MxResult value + + if (!local24) { + MxU8 unk0x0c; + + switch (rand() % 3) { + case 0: + unk0x0c = 1; + break; + case 1: + unk0x0c = 2; + break; + case 2: + unk0x0c = 0; + break; + } + + actor->SetUnknown0x0c(unk0x0c); + + Mx3DPointFloat position; + Mx3DPointFloat direction; + + position = p_roi->GetWorldPosition(); + direction = p_roi->GetWorldDirection(); + + ((Vector3&) direction).Mul(-1.0f); + m_extras[i].m_speed = -1.0f; + + if (inExtras) { + actor->ClearMaps(); + } + + if (FUN_10063b90(world, actor, CharacterManager()->GetMood(p_roi), characterId)) { + m_extras[i].m_unk0x14 = TRUE; + } + else { + m_extras[i].m_unk0x14 = FALSE; + } + + result = world->PlaceActor(actor, p_presenter, position, direction); + } + + if (result != SUCCESS && g_characters[characterId].m_unk0x07) { + result = world->PlaceActor(actor); + } + + g_characters[characterId].m_unk0x07 = FALSE; + + if (result != SUCCESS) { + m_extras[i].m_roi = NULL; + g_characters[characterId].m_inExtras = FALSE; + } + else { + m_extras[i].m_characterId = characterId; + m_extras[i].m_unk0x08 = Timer()->GetTime(); + m_extras[i].m_unk0x0c = TRUE; + m_extras[i].m_unk0x0d = FALSE; + g_characters[characterId].m_inExtras = TRUE; + actor->SetWorldSpeed(0.0f); + m_unk0x414++; + return TRUE; + } + } + return FALSE; } @@ -2091,7 +2241,7 @@ void LegoAnimationManager::FUN_10063270(LegoROIList* p_list, LegoAnimPresenter* } m_extras[i].m_roi = NULL; - g_characters[m_extras[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_extras[i].m_characterId].m_inExtras = FALSE; g_characters[m_extras[i].m_characterId].m_unk0x07 = FALSE; m_extras[i].m_characterId = -1; m_extras[i].m_unk0x0d = FALSE; @@ -2510,7 +2660,7 @@ MxResult LegoAnimationManager::FUN_10064380( g_characters[characterId].m_unk0x0c = p_unk0x0c; g_characters[characterId].m_unk0x10 = p_unk0x10; - g_characters[characterId].m_unk0x04 = TRUE; + g_characters[characterId].m_inExtras = TRUE; return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 6b778ad7..b88392e5 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -433,7 +433,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) undefined4 und = 1; if (m_presenter != NULL) { - m_unk0x64->RemovePathActor(actor); + m_unk0x64->RemoveActor(actor); if (m_tranInfo->m_unk0x29) { Mx3DPointFloat position, direction; @@ -442,7 +442,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) direction = viewROI->GetWorldDirection(); position[1] -= 1.25; - und = m_unk0x64->FUN_1001fb70(actor, m_presenter, position, direction); + und = m_unk0x64->PlaceActor(actor, m_presenter, position, direction); } else { und = 0; @@ -452,7 +452,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) if (und != 0) { viewROI->WrappedSetLocalTransform(m_tranInfo->m_unk0x2c); VideoManager()->Get3DManager()->Moved(*viewROI); - m_unk0x64->AddPathActor(actor); + m_unk0x64->PlaceActor(actor); } if (m_tranInfo->m_unk0x29) { diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 79d6b1d4..64f4c494 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1102,28 +1102,28 @@ void LegoGameState::Init() Helicopter* copter = (Helicopter*) isle->Find(*g_copterScript, CopterScript::c_Helicopter_Actor); if (copter) { - isle->RemovePathActor(copter); + isle->RemoveActor(copter); isle->VTable0x6c(copter); delete copter; } DuneBuggy* dunebuggy = (DuneBuggy*) isle->Find(*g_dunecarScript, DunecarScript::c_DuneBugy_Actor); if (dunebuggy) { - isle->RemovePathActor(dunebuggy); + isle->RemoveActor(dunebuggy); isle->VTable0x6c(dunebuggy); delete dunebuggy; } Jetski* jetski = (Jetski*) isle->Find(*g_jetskiScript, JetskiScript::c_Jetski_Actor); if (jetski) { - isle->RemovePathActor(jetski); + isle->RemoveActor(jetski); isle->VTable0x6c(jetski); delete jetski; } RaceCar* racecar = (RaceCar*) isle->Find(*g_racecarScript, RacecarScript::c_RaceCar_Actor); if (racecar) { - isle->RemovePathActor(racecar); + isle->RemoveActor(racecar); isle->VTable0x6c(racecar); delete racecar; } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index b0cb72dd..5d4dcd00 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -286,7 +286,7 @@ MxResult LegoWorld::PlaceActor( LegoPathController* controller; while (cursor.Next(controller)) { - if (controller->FUN_10045c20(p_actor, p_name, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) { + if (controller->PlaceActor(p_actor, p_name, p_src, p_srcScale, p_dest, p_destScale) == SUCCESS) { return SUCCESS; } } @@ -295,13 +295,13 @@ MxResult LegoWorld::PlaceActor( } // FUNCTION: LEGO1 0x1001fa70 -MxResult LegoWorld::AddPathActor(LegoPathActor* p_actor) +MxResult LegoWorld::PlaceActor(LegoPathActor* p_actor) { LegoPathControllerListCursor cursor(&m_list0x68); LegoPathController* controller; while (cursor.Next(controller)) { - if (controller->AddActor(p_actor) == SUCCESS) { + if (controller->PlaceActor(p_actor) == SUCCESS) { return SUCCESS; } } @@ -310,7 +310,7 @@ MxResult LegoWorld::AddPathActor(LegoPathActor* p_actor) } // FUNCTION: LEGO1 0x1001fb70 -MxResult LegoWorld::FUN_1001fb70( +MxResult LegoWorld::PlaceActor( LegoPathActor* p_actor, LegoAnimPresenter* p_presenter, Vector3& p_position, @@ -321,7 +321,7 @@ MxResult LegoWorld::FUN_1001fb70( LegoPathController* controller; while (cursor.Next(controller)) { - if (controller->FUN_10046050(p_actor, p_presenter, p_position, p_direction) == SUCCESS) { + if (controller->PlaceActor(p_actor, p_presenter, p_position, p_direction) == SUCCESS) { return SUCCESS; } } @@ -330,7 +330,7 @@ MxResult LegoWorld::FUN_1001fb70( } // FUNCTION: LEGO1 0x1001fc80 -void LegoWorld::RemovePathActor(LegoPathActor* p_actor) +void LegoWorld::RemoveActor(LegoPathActor* p_actor) { LegoPathControllerListCursor cursor(&m_list0x68); LegoPathController* controller; @@ -502,7 +502,7 @@ void LegoWorld::Remove(MxCore* p_object) } else if (p_object->IsA("MxEntity")) { if (p_object->IsA("LegoPathActor")) { - RemovePathActor((LegoPathActor*) p_object); + RemoveActor((LegoPathActor*) p_object); } if (m_entityList) { @@ -703,7 +703,7 @@ void LegoWorld::Enable(MxBool p_enable) LegoPathActor* actor = CurrentActor(); if (actor) { - RemovePathActor(actor); + RemoveActor(actor); } AnimationManager()->Reset(FALSE); diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index eeed3661..3a5a763b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -198,7 +198,7 @@ MxResult LegoPathController::Tickle() // FUNCTION: LEGO1 0x10045c20 // FUNCTION: BETA10 0x100b6d80 -MxResult LegoPathController::FUN_10045c20( +MxResult LegoPathController::PlaceActor( LegoPathActor* p_actor, const char* p_name, MxS32 p_src, @@ -229,7 +229,7 @@ MxResult LegoPathController::FUN_10045c20( // FUNCTION: LEGO1 0x10046050 // FUNCTION: BETA10 0x100b6f35 -MxResult LegoPathController::FUN_10046050( +MxResult LegoPathController::PlaceActor( LegoPathActor* p_actor, LegoAnimPresenter* p_presenter, Vector3& p_position, @@ -303,7 +303,7 @@ MxResult LegoPathController::FUN_10046050( // FUNCTION: LEGO1 0x100466a0 // FUNCTION: BETA10 0x100b71fe -MxResult LegoPathController::AddActor(LegoPathActor* p_actor) +MxResult LegoPathController::PlaceActor(LegoPathActor* p_actor) { if (p_actor->GetController() != NULL) { p_actor->GetController()->RemoveActor(p_actor); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 9e692616..8c061f99 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -590,7 +590,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 5; } - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -613,7 +613,7 @@ void Isle::Enable(MxBool p_enable) SetIsWorldActive(FALSE); break; case LegoGameState::e_bike: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -626,7 +626,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_dunecar: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -639,7 +639,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_motocycle: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -652,7 +652,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_copter: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -665,7 +665,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_skateboard: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -678,7 +678,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_jetski: - AddPathActor(CurrentActor()); + PlaceActor(CurrentActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE From 085bdbe74bb08575f3a9d53cd9547aecd9ce33bf Mon Sep 17 00:00:00 2001 From: MS Date: Wed, 29 May 2024 16:52:45 -0400 Subject: [PATCH 84/89] Beta match MxPalette (#968) * Beta match MxPalette * Modern compiler fix --- LEGO1/omni/include/mxpalette.h | 7 +- LEGO1/omni/src/video/mxpalette.cpp | 215 ++++++++++++++++++----------- 2 files changed, 138 insertions(+), 84 deletions(-) diff --git a/LEGO1/omni/include/mxpalette.h b/LEGO1/omni/include/mxpalette.h index 4f38c91b..6d1c61e7 100644 --- a/LEGO1/omni/include/mxpalette.h +++ b/LEGO1/omni/include/mxpalette.h @@ -7,6 +7,7 @@ #include // VTABLE: LEGO1 0x100dc848 +// VTABLE: BETA10 0x101c2300 // SIZE 0x414 class MxPalette : public MxCore { public: @@ -26,9 +27,13 @@ class MxPalette : public MxCore { void Reset(MxBool p_ignoreSkyColor); LPDIRECTDRAWPALETTE CreateNativePalette(); - inline void SetOverrideSkyColor(MxBool p_value) { this->m_overrideSkyColor = p_value; } + void SetPalette(LPDIRECTDRAWPALETTE p_palette); + + // FUNCTION: BETA10 0x100d92c0 + inline void SetOverrideSkyColor(MxBool p_value) { m_overrideSkyColor = p_value; } // SYNTHETIC: LEGO1 0x100beeb0 + // SYNTHETIC: BETA10 0x10144640 // MxPalette::`scalar deleting destructor' private: diff --git a/LEGO1/omni/src/video/mxpalette.cpp b/LEGO1/omni/src/video/mxpalette.cpp index f3a3e599..7738a198 100644 --- a/LEGO1/omni/src/video/mxpalette.cpp +++ b/LEGO1/omni/src/video/mxpalette.cpp @@ -4,6 +4,7 @@ #include "mxvideomanager.h" // GLOBAL: LEGO1 0x10102188 +// GLOBAL: BETA10 0x10203558 PALETTEENTRY g_defaultPaletteEntries[256] = { {0u, 0u, 0u, 0u}, {128u, 0u, 0u, 0u}, {0u, 128u, 0u, 0u}, {128u, 128u, 0u, 0u}, {0u, 0u, 128u, 0u}, {128u, 0u, 128u, 0u}, {0u, 128u, 128u, 0u}, {128u, 128u, 128u, 0u}, @@ -72,32 +73,35 @@ PALETTEENTRY g_defaultPaletteEntries[256] = { }; // FUNCTION: LEGO1 0x100bee30 +// FUNCTION: BETA10 0x10143b50 MxPalette::MxPalette() { - this->m_overrideSkyColor = FALSE; - this->m_palette = NULL; - GetDefaultPalette(this->m_entries); - this->m_skyColor = this->m_entries[141]; + m_overrideSkyColor = FALSE; + m_palette = NULL; + GetDefaultPalette(m_entries); + m_skyColor = m_entries[141]; } // FUNCTION: LEGO1 0x100beed0 +// FUNCTION: BETA10 0x10143bf4 MxPalette::MxPalette(const RGBQUAD* p_colors) { - this->m_overrideSkyColor = FALSE; - this->m_palette = NULL; - ApplySystemEntriesToPalette(this->m_entries); + m_overrideSkyColor = FALSE; + m_palette = NULL; + ApplySystemEntriesToPalette(m_entries); for (MxS32 i = 10; i < 246; i++) { - this->m_entries[i].peRed = p_colors[i].rgbRed; - this->m_entries[i].peGreen = p_colors[i].rgbGreen; - this->m_entries[i].peBlue = p_colors[i].rgbBlue; - this->m_entries[i].peFlags = 0; + m_entries[i].peRed = p_colors[i].rgbRed; + m_entries[i].peGreen = p_colors[i].rgbGreen; + m_entries[i].peBlue = p_colors[i].rgbBlue; + m_entries[i].peFlags = 0; } - this->m_skyColor = this->m_entries[141]; + m_skyColor = m_entries[141]; } // FUNCTION: LEGO1 0x100bef90 +// FUNCTION: BETA10 0x10143d01 MxPalette::~MxPalette() { if (m_palette) { @@ -106,97 +110,123 @@ MxPalette::~MxPalette() } // FUNCTION: LEGO1 0x100bf000 +// FUNCTION: BETA10 0x10143d88 LPDIRECTDRAWPALETTE MxPalette::CreateNativePalette() { - MxS32 i; - if (this->m_palette == NULL) { + if (m_palette == NULL) { + MxS32 i; for (i = 0; i < 10; i++) { - this->m_entries[i].peFlags = 0x80; - } - for (i = 10; i < 136; i++) { - this->m_entries[i].peFlags = 0x44; - } - for (i = 136; i < 140; i++) { - this->m_entries[i].peFlags = 0x84; - } - this->m_entries[140].peFlags = 0x84; - this->m_entries[141].peFlags = 0x44; - for (i = 142; i < 246; i++) { - this->m_entries[i].peFlags = 0x84; - } - for (i = 246; i < 256; i++) { - this->m_entries[i].peFlags = 0x80; + m_entries[i].peFlags = D3DPAL_RESERVED; } - if (MVideoManager() && MVideoManager()->GetDirectDraw()) { - MVideoManager()->GetDirectDraw()->CreatePalette(DDPCAPS_8BIT, this->m_entries, &this->m_palette, NULL); + for (; i < 136; i++) { + m_entries[i].peFlags = D3DPAL_READONLY | PC_NOCOLLAPSE; + } + + for (; i < 140; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + } + + m_entries[i++].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + m_entries[i++].peFlags = D3DPAL_READONLY | PC_NOCOLLAPSE; + + for (; i < 246; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + } + + for (; i < 256; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED; + } + + if (!MVideoManager()) { + goto done; + } + + if (!MVideoManager()->GetDirectDraw()) { + goto done; + } + + if (MVideoManager()->GetDirectDraw()->CreatePalette(DDPCAPS_8BIT, m_entries, &m_palette, NULL)) { + goto done; } } - return this->m_palette; +done: + return m_palette; } // FUNCTION: LEGO1 0x100bf0b0 +// FUNCTION: BETA10 0x10143f13 MxPalette* MxPalette::Clone() { MxPalette* result = new MxPalette; - this->GetEntries(result->m_entries); - result->m_overrideSkyColor = this->m_overrideSkyColor; + GetEntries(result->m_entries); + result->SetOverrideSkyColor(m_overrideSkyColor); return result; } // FUNCTION: LEGO1 0x100bf150 +// FUNCTION: BETA10 0x10143fc8 MxResult MxPalette::GetEntries(LPPALETTEENTRY p_entries) { - memcpy(p_entries, this->m_entries, sizeof(this->m_entries)); + memcpy(p_entries, m_entries, sizeof(m_entries)); return SUCCESS; } // FUNCTION: LEGO1 0x100bf170 +// FUNCTION: BETA10 0x10143ffa MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries) { - MxS32 i; MxResult status = SUCCESS; - if (this->m_palette) { + if (m_palette) { + MxS32 i; for (i = 0; i < 10; i++) { - this->m_entries[i].peFlags = 0x80; - } - for (i = 10; i < 136; i++) { - this->m_entries[i].peFlags = 68; - this->m_entries[i].peRed = p_entries[i].peRed; - this->m_entries[i].peGreen = p_entries[i].peGreen; - this->m_entries[i].peBlue = p_entries[i].peBlue; - } - for (i = 136; i < 140; i++) { - this->m_entries[i].peFlags = 132; - this->m_entries[i].peRed = p_entries[i].peRed; - this->m_entries[i].peGreen = p_entries[i].peGreen; - this->m_entries[i].peBlue = p_entries[i].peBlue; - } - if (!this->m_overrideSkyColor) { - this->m_entries[140].peFlags = 0x44; - this->m_entries[140].peRed = p_entries[140].peRed; - this->m_entries[140].peGreen = p_entries[140].peGreen; - this->m_entries[140].peBlue = p_entries[140].peBlue; - this->m_entries[141].peFlags = 0x84; - this->m_entries[141].peRed = p_entries[141].peRed; - this->m_entries[141].peGreen = p_entries[141].peGreen; - this->m_entries[141].peBlue = p_entries[141].peBlue; + m_entries[i].peFlags = D3DPAL_RESERVED; } - for (i = 142; i < 246; i++) { - this->m_entries[i].peFlags = 132; - this->m_entries[i].peRed = p_entries[i].peRed; - this->m_entries[i].peGreen = p_entries[i].peGreen; - this->m_entries[i].peBlue = p_entries[i].peBlue; + for (; i < 136; i++) { + m_entries[i].peFlags = D3DPAL_READONLY | PC_NOCOLLAPSE; + m_entries[i].peRed = p_entries[i].peRed; + m_entries[i].peGreen = p_entries[i].peGreen; + m_entries[i].peBlue = p_entries[i].peBlue; } - for (i = 246; i < 256; i++) { - this->m_entries[i].peFlags = 0x80; + for (; i < 140; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + m_entries[i].peRed = p_entries[i].peRed; + m_entries[i].peGreen = p_entries[i].peGreen; + m_entries[i].peBlue = p_entries[i].peBlue; } - if (this->m_palette->SetEntries(0, 0, 256, this->m_entries)) { + if (!m_overrideSkyColor) { + m_entries[i].peFlags = D3DPAL_READONLY | PC_NOCOLLAPSE; + m_entries[i].peRed = p_entries[i].peRed; + m_entries[i].peGreen = p_entries[i].peGreen; + m_entries[i].peBlue = p_entries[i].peBlue; + i++; + m_entries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + m_entries[i].peRed = p_entries[i].peRed; + m_entries[i].peGreen = p_entries[i].peGreen; + m_entries[i].peBlue = p_entries[i].peBlue; + i++; + } + else { + i = 142; + } + + for (; i < 246; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; + m_entries[i].peRed = p_entries[i].peRed; + m_entries[i].peGreen = p_entries[i].peGreen; + m_entries[i].peBlue = p_entries[i].peBlue; + } + + for (; i < 256; i++) { + m_entries[i].peFlags = D3DPAL_RESERVED; + } + + if (m_palette->SetEntries(0, 0, 256, m_entries)) { status = FAILURE; } } @@ -205,38 +235,53 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries) } // FUNCTION: LEGO1 0x100bf2d0 +// FUNCTION: BETA10 0x101442aa MxResult MxPalette::SetSkyColor(LPPALETTEENTRY p_skyColor) { MxResult status = 0; - if (this->m_palette != NULL) { - this->m_entries[141].peRed = p_skyColor->peRed; - this->m_entries[141].peGreen = p_skyColor->peGreen; - this->m_entries[141].peBlue = p_skyColor->peBlue; - this->m_skyColor = this->m_entries[141]; - if (this->m_palette->SetEntries(0, 141, 1, &this->m_skyColor)) { + if (m_palette != NULL) { + m_entries[141].peRed = p_skyColor->peRed; + m_entries[141].peGreen = p_skyColor->peGreen; + m_entries[141].peBlue = p_skyColor->peBlue; + m_skyColor = m_entries[141]; + if (m_palette->SetEntries(0, 141, 1, &m_skyColor)) { status = -1; } } return status; } +// FUNCTION: BETA10 0x1014434a +void MxPalette::SetPalette(LPDIRECTDRAWPALETTE p_palette) +{ + if (m_palette) { + m_palette->Release(); + } + + m_palette = p_palette; +} + // FUNCTION: LEGO1 0x100bf330 +// FUNCTION: BETA10 0x1014438a void MxPalette::Detach() { - this->m_palette = NULL; + m_palette = NULL; } // FUNCTION: LEGO1 0x100bf340 +// FUNCTION: BETA10 0x101443aa MxBool MxPalette::operator==(MxPalette& p_other) { for (MxS32 i = 0; i < 256; i++) { - if (this->m_entries[i].peRed != p_other.m_entries[i].peRed) { + if (m_entries[i].peRed != p_other.m_entries[i].peRed) { return FALSE; } - if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen) { + + if (m_entries[i].peGreen != p_other.m_entries[i].peGreen) { return FALSE; } - if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue) { + + if (m_entries[i].peBlue != p_other.m_entries[i].peBlue) { return FALSE; } } @@ -244,6 +289,7 @@ MxBool MxPalette::operator==(MxPalette& p_other) } // FUNCTION: LEGO1 0x100bf390 +// FUNCTION: BETA10 0x1014445a void MxPalette::ApplySystemEntriesToPalette(LPPALETTEENTRY p_entries) { HDC hdc; @@ -261,6 +307,7 @@ void MxPalette::ApplySystemEntriesToPalette(LPPALETTEENTRY p_entries) } // FUNCTION: LEGO1 0x100bf420 +// FUNCTION: BETA10 0x10144517 void MxPalette::GetDefaultPalette(LPPALETTEENTRY p_entries) { HDC hdc; @@ -278,14 +325,16 @@ void MxPalette::GetDefaultPalette(LPPALETTEENTRY p_entries) } // FUNCTION: LEGO1 0x100bf490 +// FUNCTION: BETA10 0x101445bf void MxPalette::Reset(MxBool p_ignoreSkyColor) { - if (this->m_palette != NULL) { - GetDefaultPalette(this->m_entries); + if (m_palette != NULL) { + GetDefaultPalette(m_entries); if (!p_ignoreSkyColor) { - this->m_entries[140] = this->m_entries[141] = this->m_skyColor; + m_entries[140] = m_entries[141] = m_skyColor; } - SetEntries(this->m_entries); - this->m_palette->SetEntries(0, 0, 256, this->m_entries); + + SetEntries(m_entries); + m_palette->SetEntries(0, 0, 256, m_entries); } } From 689178f68906785692da1ea577f07118c82c078d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 08:48:14 -0400 Subject: [PATCH 85/89] Implement/match LegoCameraController::FUN_10012290 and FUN_10012320 (#969) --- .../lego/legoomni/include/legocameracontroller.h | 4 ++-- .../legoomni/src/entity/legocameracontroller.cpp | 15 ++++++++++----- LEGO1/realtime/matrix.h | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocameracontroller.h b/LEGO1/lego/legoomni/include/legocameracontroller.h index f7325286..8e6e4989 100644 --- a/LEGO1/lego/legoomni/include/legocameracontroller.h +++ b/LEGO1/lego/legoomni/include/legocameracontroller.h @@ -36,8 +36,8 @@ class LegoCameraController : public LegoPointOfViewController { virtual MxResult Create(); // vtable+0x44 void SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up); - void FUN_10012290(float); - void FUN_10012320(MxFloat); + void FUN_10012290(float p_angle); + void FUN_10012320(float p_angle); void FUN_100123e0(const Matrix4& p_transform, MxU32 p_und); Mx3DPointFloat GetWorldUp(); Mx3DPointFloat GetWorldLocation(); diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index 6025f614..da455eab 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -124,15 +124,20 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3& m_matrix2 = m_matrix1; } -// STUB: LEGO1 0x10012290 -void LegoCameraController::FUN_10012290(float) +// FUNCTION: LEGO1 0x10012290 +// FUNCTION: BETA10 0x10068c34 +void LegoCameraController::FUN_10012290(float p_angle) { + m_matrix1 = m_matrix2; + m_matrix1.RotateZ(p_angle); } -// STUB: LEGO1 0x10012320 -void LegoCameraController::FUN_10012320(MxFloat) +// FUNCTION: LEGO1 0x10012320 +// FUNCTION: BETA10 0x10068c73 +void LegoCameraController::FUN_10012320(float p_angle) { - // TODO + m_matrix1 = m_matrix2; + m_matrix1.RotateY(p_angle); } // FUNCTION: LEGO1 0x100123e0 diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index df2260ea..f90cc3e8 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -133,6 +133,20 @@ class Matrix4 { } } + // FUNCTION: BETA10 0x1001fd60 + inline void RotateY(const float& p_angle) + { + float s = sin(p_angle); + float c = cos(p_angle); + float matrix[4][4]; + memcpy(matrix, m_data, sizeof(float) * 16); + for (int i = 0; i < 4; i++) { + m_data[i][0] = matrix[i][0] * c + matrix[i][2] * s; + m_data[i][2] = matrix[i][2] * c - matrix[i][0] * s; + } + } + + // FUNCTION: BETA10 0x1006ab10 inline void RotateZ(const float& p_angle) { float s = sin(p_angle); From ae859fbc19308e8d8d8176bdae28fee50572b9a4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 09:15:16 -0400 Subject: [PATCH 86/89] Implement/match LegoControlManager::FUN_100293c0 (#970) --- .../legoomni/include/legocontrolmanager.h | 2 +- .../legoomni/include/mxcontrolpresenter.h | 4 +++- .../src/common/mxcontrolpresenter.cpp | 6 ++--- .../src/control/legocontrolmanager.cpp | 22 +++++++++++++++++-- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 10 ++++----- LEGO1/omni/include/mxdsobject.h | 1 + 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 46719167..f5274a31 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -63,7 +63,7 @@ class LegoControlManager : public MxCore { void Register(MxCore* p_listener); void Unregister(MxCore* p_listener); MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter); - void FUN_100293c0(undefined4, const char*, undefined2); + void FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS16 p_unk0x4e); MxControlPresenter* FUN_100294e0(MxS32 p_x, MxS32 p_y); MxBool FUN_10029630(); MxBool FUN_10029750(); diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index e12c1a25..49f9e975 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -37,11 +37,13 @@ class MxControlPresenter : public MxCompositePresenter { void Enable(MxBool p_enable) override; // vtable+0x54 MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 - virtual void VTable0x6c(MxS16); // vtable+0x6c + virtual void VTable0x6c(MxS16 p_unk0x4e); // vtable+0x6c MxBool FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter); MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter); + inline MxS16 GetUnknown0x4e() { return m_unk0x4e; } + private: undefined2 m_unk0x4c; // 0x4c MxS16 m_unk0x4e; // 0x4e diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 5c2eec3d..c0cbed68 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -206,9 +206,9 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres } // FUNCTION: LEGO1 0x10044540 -void MxControlPresenter::VTable0x6c(MxS16 p_val) +void MxControlPresenter::VTable0x6c(MxS16 p_unk0x4e) { - if (p_val == -1) { + if (p_unk0x4e == -1) { if ((MxS16) ((MxDSMultiAction*) m_action)->GetActionList()->GetCount() - m_unk0x4e == 1) { m_unk0x4e = 0; } @@ -217,7 +217,7 @@ void MxControlPresenter::VTable0x6c(MxS16 p_val) } } else { - m_unk0x4e = p_val; + m_unk0x4e = p_unk0x4e; } m_action->SetUnknown90(Timer()->GetTime()); diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index a7ca2c20..b0864024 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -116,9 +116,27 @@ void LegoControlManager::FUN_100292e0() } } -// STUB: LEGO1 0x100293c0 -void LegoControlManager::FUN_100293c0(undefined4, const char*, undefined2) +// FUNCTION: LEGO1 0x100293c0 +void LegoControlManager::FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS16 p_unk0x4e) { + if (m_presenterList) { + MxPresenterListCursor cursor(m_presenterList); + MxPresenter* control; + + while (cursor.Next(control)) { + MxDSAction* action = control->GetAction(); + + if (action->GetObjectId() == p_objectId && action->GetAtomId().GetInternal() == p_atom) { + ((MxControlPresenter*) control)->VTable0x6c(p_unk0x4e); + + if (((MxControlPresenter*) control)->GetUnknown0x4e() == 0) { + g_unk0x100f31b0 = -1; + g_unk0x100f31b4 = NULL; + break; + } + } + } + } } // FUNCTION: LEGO1 0x100294e0 diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index b88db8b5..55de745e 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -246,7 +246,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) } if (action->GetObjectId() == InfomainScript::c_iicx26in_RunAnim) { - ControlManager()->FUN_100293c0(0x10, action->GetAtomId().GetInternal(), 0); + ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, action->GetAtomId().GetInternal(), 0); m_unk0x1d6 = 0; } @@ -1159,16 +1159,16 @@ MxResult Infocenter::Tickle() m_unk0x1d6 += 100; if (m_unk0x1d6 > 3400 && m_unk0x1d6 < 3650) { - ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 1); + ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 1); } else if (m_unk0x1d6 > 3650 && m_unk0x1d6 < 3900) { - ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 0); + ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 0); } else if (m_unk0x1d6 > 3900 && m_unk0x1d6 < 4150) { - ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 1); + ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 1); } else if (m_unk0x1d6 > 4400) { - ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 0); + ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atom.GetInternal(), 0); m_unk0x1d6 = 0; } } diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index 8fe2426c..396b67ba 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -62,6 +62,7 @@ class MxDSObject : public MxCore { // FUNCTION: BETA10 0x1012efb0 inline const char* GetSourceName() const { return m_sourceName; } + inline const char* GetObjectName() const { return m_objectName; } inline MxU32 GetObjectId() { return m_objectId; } inline const MxAtomId& GetAtomId() { return m_atomId; } From 650903d043b7638d1a164d6cec60725aff83c25c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 09:54:24 -0400 Subject: [PATCH 87/89] Implement/match Pizzeria::HandleClick (#971) --- LEGO1/lego/legoomni/include/ambulance.h | 14 ++++---- LEGO1/lego/legoomni/include/bike.h | 8 ++--- LEGO1/lego/legoomni/include/dunebuggy.h | 12 +++---- LEGO1/lego/legoomni/include/elevatorbottom.h | 2 +- LEGO1/lego/legoomni/include/gasstation.h | 12 +++---- LEGO1/lego/legoomni/include/helicopter.h | 4 +-- LEGO1/lego/legoomni/include/hospital.h | 2 +- LEGO1/lego/legoomni/include/infocenter.h | 2 +- LEGO1/lego/legoomni/include/infocenterdoor.h | 2 +- LEGO1/lego/legoomni/include/isle.h | 2 +- LEGO1/lego/legoomni/include/isleactor.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 4 +-- LEGO1/lego/legoomni/include/jetski.h | 10 +++--- LEGO1/lego/legoomni/include/jukebox.h | 2 +- LEGO1/lego/legoomni/include/motocycle.h | 12 +++---- LEGO1/lego/legoomni/include/pizza.h | 3 +- .../lego/legoomni/include/pizzamissionstate.h | 2 -- LEGO1/lego/legoomni/include/pizzeria.h | 2 +- LEGO1/lego/legoomni/include/pizzeriastate.h | 2 ++ LEGO1/lego/legoomni/include/police.h | 2 +- LEGO1/lego/legoomni/include/racecar.h | 2 +- LEGO1/lego/legoomni/include/radio.h | 2 +- .../lego/legoomni/include/registrationbook.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 10 +++--- LEGO1/lego/legoomni/include/towtrack.h | 4 +-- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/bike.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/isleactor.cpp | 4 +-- .../legoomni/src/actors/islepathactor.cpp | 8 ++--- LEGO1/lego/legoomni/src/actors/jetski.cpp | 4 +-- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/pizza.cpp | 7 +++- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 30 +++++++++++++--- LEGO1/lego/legoomni/src/actors/racecar.cpp | 2 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 6 ++-- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 4 +-- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 4 +-- .../legoomni/src/build/buildingentity.cpp | 2 +- .../src/common/mxcontrolpresenter.cpp | 4 +-- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 2 +- .../legoomni/src/input/legoinputmanager.cpp | 4 +-- .../src/pizzeria/pizzamissionstate.cpp | 1 + .../legoomni/src/pizzeria/pizzeriastate.cpp | 6 ++++ .../legoomni/src/worlds/elevatorbottom.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 6 ++-- .../legoomni/src/worlds/infocenterdoor.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/isle.cpp | 36 +++++++++---------- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/police.cpp | 6 ++-- .../legoomni/src/worlds/registrationbook.cpp | 6 ++-- LEGO1/lego/legoomni/src/worlds/score.cpp | 2 +- LEGO1/omni/include/mxnotificationparam.h | 4 +-- 57 files changed, 178 insertions(+), 143 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 9e4b95b7..0edd9cae 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -28,13 +28,13 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index 7355d1a7..a71747ad 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -23,10 +23,10 @@ class Bike : public IslePathActor { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 void FUN_10076b60(); diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index c10ea949..6abe2881 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -23,12 +23,12 @@ class DuneBuggy : public IslePathActor { return !strcmp(p_name, DuneBuggy::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index 81db82d6..7c94aff2 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -44,7 +44,7 @@ class ElevatorBottom : public LegoWorld { private: LegoGameState::Area m_destLocation; // 0xf8 - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); }; #endif // ELEVATORBOTTOM_H diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 51e7a3da..0709f0ad 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -32,12 +32,12 @@ class GasStation : public LegoWorld { return !strcmp(p_name, GasStation::ClassName()) || LegoWorld::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 - virtual MxLong HandleClick(LegoControlManagerEvent& p_param); // vtable+0x6c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool Escape() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 + virtual MxLong HandleControl(LegoControlManagerEvent& p_param); // vtable+0x6c inline void PlayAction(MxU32 p_objectId); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 867763be..638f9287 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -29,8 +29,8 @@ class Helicopter : public IslePathActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 void VTable0xe4() override; // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 9f9c8e4c..014e872d 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -49,7 +49,7 @@ class Hospital : public LegoWorld { MxLong HandleKeyPress(MxS8 p_key); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleButtonDown(LegoControlManagerEvent& p_param); - MxBool HandleClick(LegoControlManagerEvent& p_param); + MxBool HandleControl(LegoControlManagerEvent& p_param); MxS16 m_currentActorId; // 0xf8 LegoGameState::Area m_destLocation; // 0xfc diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index f0ed8697..08bb9a2c 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -79,7 +79,7 @@ class Infocenter : public LegoWorld { MxLong HandleKeyPress(MxS8 p_key); MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y); MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y); - MxU8 HandleClick(LegoControlManagerEvent& p_param); + MxU8 HandleControl(LegoControlManagerEvent& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleNotification0(MxNotificationParam& p_param); diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index 9cb0c49d..6d012b4c 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -43,7 +43,7 @@ class InfocenterDoor : public LegoWorld { private: LegoGameState::Area m_destLocation; // 0xf8 - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); }; #endif // INFOCENTERDOOR_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 878cef90..e9d4da42 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -71,7 +71,7 @@ class Isle : public LegoWorld { protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); MxLong HandleType19Notification(MxType19NotificationParam& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index ad2e985d..388db2c2 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -29,7 +29,7 @@ class IsleActor : public LegoActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 // FUNCTION: LEGO1 0x1000e5f0 - virtual undefined4 VTable0x68() { return 0; } // vtable+0x68 + virtual undefined4 HandleClick() { return 0; } // vtable+0x68 // FUNCTION: LEGO1 0x1000e600 virtual undefined4 VTable0x6c() { return 0; } // vtable+0x6c diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 43d301cf..758039ff 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -106,13 +106,13 @@ class IslePathActor : public LegoPathActor { void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c // FUNCTION: LEGO1 0x10002e70 - virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc + virtual MxU32 HandleClick() { return 0; } // vtable+0xcc // FUNCTION: LEGO1 0x10002df0 virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 // FUNCTION: LEGO1 0x10002e80 - virtual MxU32 VTable0xd4(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 + virtual MxU32 HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 virtual MxU32 VTable0xd8(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 263b2a4f..773513f9 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -25,11 +25,11 @@ class Jetski : public IslePathActor { return !strcmp(p_name, Jetski::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent&) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 05618523..2ee17f37 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -41,7 +41,7 @@ class JukeBox : public LegoWorld { // JukeBox::`scalar deleting destructor' private: - MxBool HandleClick(LegoControlManagerEvent& p_param); + MxBool HandleControl(LegoControlManagerEvent& p_param); LegoGameState::Area m_destLocation; // 0xf8 JukeBoxState* m_state; // 0xfc diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index 638018f0..e23e87ad 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -23,12 +23,12 @@ class Motocycle : public IslePathActor { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + void VTable0xe4() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index f845868f..01e99d7f 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -31,11 +31,12 @@ class Pizza : public IsleActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - undefined4 VTable0x68() override; // vtable+0x68 + undefined4 HandleClick() override; // vtable+0x68 undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 undefined4 VTable0x80(MxParam&) override; // vtable+0x80 void CreateState(); + void FUN_10038220(MxU32 p_objectId); void FUN_100382b0(); void FUN_10038380(); diff --git a/LEGO1/lego/legoomni/include/pizzamissionstate.h b/LEGO1/lego/legoomni/include/pizzamissionstate.h index 1796dde4..c74ea4b1 100644 --- a/LEGO1/lego/legoomni/include/pizzamissionstate.h +++ b/LEGO1/lego/legoomni/include/pizzamissionstate.h @@ -37,10 +37,8 @@ class PizzaMissionState : public LegoState { // SYNTHETIC: LEGO1 0x10039350 // PizzaMissionState::`scalar deleting destructor' -private: PizzaMissionStateEntry* GetState(MxU8 p_id); -protected: undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c PizzaMissionStateEntry m_state[5]; // 0x10 diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 0991d00a..91f76f46 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -27,7 +27,7 @@ class Pizzeria : public IsleActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - undefined4 VTable0x68() override; // vtable+0x68 + undefined4 HandleClick() override; // vtable+0x68 void CreateState(); diff --git a/LEGO1/lego/legoomni/include/pizzeriastate.h b/LEGO1/lego/legoomni/include/pizzeriastate.h index 6ddd23cd..6bed2aad 100644 --- a/LEGO1/lego/legoomni/include/pizzeriastate.h +++ b/LEGO1/lego/legoomni/include/pizzeriastate.h @@ -36,6 +36,8 @@ class PizzeriaState : public LegoState { // SYNTHETIC: LEGO1 0x10017ce0 // PizzeriaState::`scalar deleting destructor' + MxU32 FUN_10017d70(); + private: Playlist m_unk0x08[5]; // 0x08 PizzeriaStateStruct m_unk0x44; // 0x44 diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 3760f22a..67c3586a 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -43,7 +43,7 @@ class Police : public LegoWorld { // Police::`scalar deleting destructor' private: - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(LegoEventNotificationParam& p_param); diff --git a/LEGO1/lego/legoomni/include/racecar.h b/LEGO1/lego/legoomni/include/racecar.h index 462c2dbe..72174c8f 100644 --- a/LEGO1/lego/legoomni/include/racecar.h +++ b/LEGO1/lego/legoomni/include/racecar.h @@ -25,7 +25,7 @@ class RaceCar : public IslePathActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 VTable0xcc() override; // vtable+0xcc + MxU32 HandleClick() override; // vtable+0xcc // SYNTHETIC: LEGO1 0x10028400 // RaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 50b4de6f..997c6579 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -45,7 +45,7 @@ class Radio : public MxCore { MxBool m_audioEnabled; // 0x0d MxLong HandleEndAction(MxEndActionNotificationParam& p_param); - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); }; #endif // RADIO_H diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index ee4e55f8..fb561453 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -64,7 +64,7 @@ class RegistrationBook : public LegoWorld { MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(MxU8 p_key); - MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerEvent& p_param); MxLong HandleNotification19(MxParam& p_param); void FUN_100775c0(MxS16 p_playerIndex); void WriteInfocenterLetters(MxS16); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 60cadaa2..26007aed 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -26,11 +26,11 @@ class SkateBoard : public IslePathActor { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd0() override; // vtable+0xd0 - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 VTable0xd0() override; // vtable+0xd0 + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void VTable0xe4() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index add3a9f6..4f4f1bb5 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -28,8 +28,8 @@ class TowTrack : public IslePathActor { MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0xcc() override; // vtable+0xcc - MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxU32 HandleClick() override; // vtable+0xcc + MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc void VTable0xe4() override; // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index b6bc7584..2d293972 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -103,7 +103,7 @@ MxU32 Ambulance::VTable0xdc(MxType19NotificationParam& p_param) } // STUB: LEGO1 0x10036ce0 -MxU32 Ambulance::VTable0xcc() +MxU32 Ambulance::HandleClick() { // TODO return 0; @@ -122,7 +122,7 @@ void Ambulance::VTable0xe4() } // STUB: LEGO1 0x10036f90 -MxU32 Ambulance::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 Ambulance::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index e6be2228..20b6e904 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -45,14 +45,14 @@ void Bike::VTable0xe4() } // STUB: LEGO1 0x100769a0 -MxU32 Bike::VTable0xcc() +MxU32 Bike::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10076aa0 -MxU32 Bike::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 Bike::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 3331d82f..30923948 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -31,14 +31,14 @@ void DuneBuggy::VTable0xe4() } // STUB: LEGO1 0x10068060 -MxU32 DuneBuggy::VTable0xcc() +MxU32 DuneBuggy::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x100681b0 -MxU32 DuneBuggy::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 5c0a26b3..dee0a47b 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -104,7 +104,7 @@ void Helicopter::VTable0xe4() } // FUNCTION: LEGO1 0x10003480 -MxU32 Helicopter::VTable0xcc() +MxU32 Helicopter::HandleClick() { if (!FUN_1003ef60()) { return 1; @@ -153,7 +153,7 @@ MxU32 Helicopter::VTable0xcc() } // FUNCTION: LEGO1 0x100035e0 -MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) { MxU32 ret = 0; MxAtomId script; diff --git a/LEGO1/lego/legoomni/src/actors/isleactor.cpp b/LEGO1/lego/legoomni/src/actors/isleactor.cpp index a09c62d7..66d8bf02 100644 --- a/LEGO1/lego/legoomni/src/actors/isleactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/isleactor.cpp @@ -42,8 +42,8 @@ MxLong IsleActor::Notify(MxParam& p_param) case c_notificationButtonDown: result = HandleButtonDown((MxNotificationParam&) p_param); break; - case c_notificationType11: - result = VTable0x68(); + case c_notificationClick: + result = HandleClick(); break; case c_notificationEndAnim: result = VTable0x70(); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index c3913942..b4f1266a 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -53,11 +53,11 @@ MxLong IslePathActor::Notify(MxParam& p_param) case c_notificationType0: ret = VTable0xd0(); break; - case c_notificationType11: - ret = VTable0xcc(); - break; case c_notificationClick: - ret = VTable0xd4((LegoControlManagerEvent&) p_param); + ret = HandleClick(); + break; + case c_notificationControl: + ret = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationEndAnim: ret = VTable0xd8((LegoEndAnimNotificationParam&) p_param); diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 8ac6924b..2b26d842 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -30,14 +30,14 @@ void Jetski::VTable0xe4() } // STUB: LEGO1 0x1007e750 -MxU32 Jetski::VTable0xcc() +MxU32 Jetski::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x1007e8e0 -MxU32 Jetski::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 Jetski::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 72905a76..a4c505a2 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -32,7 +32,7 @@ JukeBoxEntity::~JukeBoxEntity() // FUNCTION: LEGO1 0x10085e40 MxLong JukeBoxEntity::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationType11) { + if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { if (!FUN_1003ef60()) { return 1; } diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 68ce7950..a716d266 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -31,14 +31,14 @@ void Motocycle::VTable0xe4() } // STUB: LEGO1 0x10035c50 -MxU32 Motocycle::VTable0xcc() +MxU32 Motocycle::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10035d70 -MxU32 Motocycle::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 Motocycle::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index d3779d40..9185de23 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -56,6 +56,11 @@ void Pizza::CreateState() } } +// STUB: LEGO1 0x10038220 +void Pizza::FUN_10038220(MxU32 p_objectId) +{ +} + // STUB: LEGO1 0x100382b0 void Pizza::FUN_100382b0() { @@ -67,7 +72,7 @@ void Pizza::FUN_10038380() } // STUB: LEGO1 0x100383f0 -undefined4 Pizza::VTable0x68() +undefined4 Pizza::HandleClick() { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 2d72fd56..46139dd7 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -1,7 +1,17 @@ #include "pizzeria.h" +#include "isle_actions.h" +#include "islepathactor.h" +#include "legoanimationmanager.h" #include "legogamestate.h" +#include "legopathactor.h" +#include "legoutils.h" +#include "legoworld.h" #include "misc.h" +#include "pizza.h" +#include "pizzamissionstate.h" +#include "pizzeriastate.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Pizzeria, 0x84) @@ -35,9 +45,21 @@ void Pizzeria::CreateState() m_pizzaMissionState = pizzaMissionState; } -// STUB: LEGO1 0x10017a50 -undefined4 Pizzeria::VTable0x68() +// FUNCTION: LEGO1 0x10017a50 +undefined4 Pizzeria::HandleClick() { - // TODO - return 0; + if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + if (!CurrentActor()->IsA("SkateBoard")) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + } + + AnimationManager()->FUN_10061010(FALSE); + + Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); + pizza->FUN_10038220(m_pizzeriaState->FUN_10017d70()); + } + + return 1; } diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index 3907a7d0..e32fab62 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -26,7 +26,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction) } // STUB: LEGO1 0x100284d0 -MxU32 RaceCar::VTable0xcc() +MxU32 RaceCar::HandleClick() { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index 537bf080..f625e787 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -47,8 +47,8 @@ MxLong Radio::Notify(MxParam& p_param) case c_notificationEndAction: result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; } } @@ -96,7 +96,7 @@ void Radio::Stop() } // FUNCTION: LEGO1 0x1002cbc0 -MxLong Radio::HandleClick(LegoControlManagerEvent& p_param) +MxLong Radio::HandleControl(LegoControlManagerEvent& p_param) { MxDSAction action; // Unused MxS32 objectId = p_param.GetClickedObjectId(); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 2e742d97..ab37d3f1 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -72,7 +72,7 @@ void SkateBoard::VTable0xe4() } // FUNCTION: LEGO1 0x100100e0 -MxU32 SkateBoard::VTable0xcc() +MxU32 SkateBoard::HandleClick() { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -107,7 +107,7 @@ MxU32 SkateBoard::VTable0xcc() } // FUNCTION: LEGO1 0x10010230 -MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param) { MxU32 result = 0; diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 7cd6ee1b..cf155775 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -89,7 +89,7 @@ MxU32 TowTrack::VTable0xdc(MxType19NotificationParam& p_param) } // STUB: LEGO1 0x1004d690 -MxU32 TowTrack::VTable0xcc() +MxU32 TowTrack::HandleClick() { // TODO return 0; @@ -102,7 +102,7 @@ void TowTrack::VTable0xe4() } // STUB: LEGO1 0x1004d9e0 -MxU32 TowTrack::VTable0xd4(LegoControlManagerEvent& p_param) +MxU32 TowTrack::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/build/buildingentity.cpp b/LEGO1/lego/legoomni/src/build/buildingentity.cpp index 7986a589..9491c229 100644 --- a/LEGO1/lego/legoomni/src/build/buildingentity.cpp +++ b/LEGO1/lego/legoomni/src/build/buildingentity.cpp @@ -21,7 +21,7 @@ BuildingEntity::~BuildingEntity() // FUNCTION: LEGO1 0x100150a0 MxLong BuildingEntity::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationType11) { + if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { return VTable0x50(p_param); } diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index c0cbed68..96e6d598 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -184,7 +184,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(0); - p_event->SetType(c_notificationClick); + p_event->SetType(c_notificationControl); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } @@ -194,7 +194,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(m_unk0x56); - p_event->SetType(c_notificationClick); + p_event->SetType(c_notificationControl); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index c4a09084..4d9324ad 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -337,7 +337,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) { LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param; - if (param.GetNotification() != c_notificationType11) { + if (param.GetNotification() != c_notificationClick) { return 0; } diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 9149835d..200652b1 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -456,7 +456,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) } if (FUN_1005cdf0(p_param)) { - if (processRoi && p_param.GetType() == c_notificationType11) { + if (processRoi && p_param.GetType() == c_notificationClick) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); p_param.SetROI(roi); @@ -498,7 +498,7 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) else if (m_unk0x81) { p_param.SetX(m_x); p_param.SetY(m_y); - p_param.SetType(c_notificationType11); + p_param.SetType(c_notificationClick); result = TRUE; } diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp index dac374c5..543a5152 100644 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp +++ b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp @@ -18,5 +18,6 @@ PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id) return m_state + i; } } + return NULL; } diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp index 41f9d029..3271c3d6 100644 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp +++ b/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp @@ -8,6 +8,12 @@ PizzeriaState::PizzeriaState() // TODO } +// STUB: LEGO1 0x10017d70 +MxU32 PizzeriaState::FUN_10017d70() +{ + return 0; +} + // STUB: LEGO1 0x10017da0 MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) { diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 32c9265a..219fcf79 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -59,8 +59,8 @@ MxLong ElevatorBottom::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetType()) { - case c_notificationClick: - ret = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + ret = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -80,7 +80,7 @@ void ElevatorBottom::ReadyWorld() } // FUNCTION: LEGO1 0x100181d0 -MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param) +MxLong ElevatorBottom::HandleControl(LegoControlManagerEvent& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index e8a4d813..4042eb8d 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -113,8 +113,8 @@ MxLong GasStation::Notify(MxParam& p_param) case c_notificationButtonDown: result = HandleButtonDown(((LegoControlManagerEvent&) p_param)); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -313,7 +313,7 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10005b20 -MxLong GasStation::HandleClick(LegoControlManagerEvent& p_param) +MxLong GasStation::HandleControl(LegoControlManagerEvent& p_param) { if (p_param.GetUnknown0x28() == 1) { MxDSAction action; diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index bc6b0386..59d265f7 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -122,8 +122,8 @@ MxLong Hospital::Notify(MxParam& p_param) case c_notificationButtonDown: result = HandleButtonDown(((LegoControlManagerEvent&) p_param)); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: if (m_destLocation != LegoGameState::e_undefined) { @@ -552,7 +552,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10075f90 -MxBool Hospital::HandleClick(LegoControlManagerEvent& p_param) +MxBool Hospital::HandleControl(LegoControlManagerEvent& p_param) { if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 55de745e..2277300a 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -170,8 +170,8 @@ MxLong Infocenter::Notify(MxParam& p_param) ((LegoEventNotificationParam&) p_param).GetY() ); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: StopBookAnimation(); @@ -870,7 +870,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) } // FUNCTION: LEGO1 0x10070370 -MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param) +MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param) { if (p_param.GetUnknown0x28() == 1) { m_infoManDialogueTimer = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 7d205ce1..d433c337 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -68,8 +68,8 @@ MxLong InfocenterDoor::Notify(MxParam& p_param) result = 1; } break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -90,7 +90,7 @@ void InfocenterDoor::ReadyWorld() } // FUNCTION: LEGO1 0x10037a90 -MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param) +MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 8c061f99..f99cf6fc 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -142,8 +142,8 @@ MxLong Isle::Notify(MxParam& p_param) break; } break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationEndAnim: switch (m_act1state->m_unk0x018) { @@ -278,7 +278,7 @@ void Isle::ReadyWorld() } // FUNCTION: LEGO1 0x10031030 -MxLong Isle::HandleClick(LegoControlManagerEvent& p_param) +MxLong Isle::HandleControl(LegoControlManagerEvent& p_param) { if (p_param.GetUnknown0x28() == 1) { MxDSAction action; @@ -509,7 +509,7 @@ MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) case 0x136: LegoEntity* bouy = (LegoEntity*) Find("MxEntity", "bouybump"); if (bouy != NULL) { - NotificationManager()->Send(bouy, LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + NotificationManager()->Send(bouy, LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); } result = 1; break; @@ -595,11 +595,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_jetski->Notify(param); } #else - m_jetski->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_jetski->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_garadoor: @@ -618,11 +618,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_bike->Notify(param); } #else - m_bike->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_bike->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_dunecar: @@ -631,11 +631,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_dunebuggy->Notify(param); } #else - m_dunebuggy->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_dunebuggy->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_motocycle: @@ -644,11 +644,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_motocycle->Notify(param); } #else - m_motocycle->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_motocycle->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_copter: @@ -657,11 +657,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_helicopter->Notify(param); } #else - m_helicopter->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_helicopter->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_skateboard: @@ -670,11 +670,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_skateboard->Notify(param); } #else - m_skateboard->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_skateboard->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; case LegoGameState::e_jetski: @@ -683,11 +683,11 @@ void Isle::Enable(MxBool p_enable) #ifdef COMPAT_MODE { - LegoEventNotificationParam param(c_notificationType11, NULL, 0, 0, 0, 0); + LegoEventNotificationParam param(c_notificationClick, NULL, 0, 0, 0, 0); m_jetski->Notify(param); } #else - m_jetski->Notify(LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + m_jetski->Notify(LegoEventNotificationParam(c_notificationClick, NULL, 0, 0, 0, 0)); #endif break; default: diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index ac284815..421760ab 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -75,8 +75,8 @@ MxLong JukeBox::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetNotification()) { - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -119,7 +119,7 @@ void JukeBox::ReadyWorld() } // FUNCTION: LEGO1 0x1005da70 -MxBool JukeBox::HandleClick(LegoControlManagerEvent& p_param) +MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) { MxStillPresenter* presenter; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index cf1396b8..b80e1a33 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -81,8 +81,8 @@ MxLong Police::Notify(MxParam& p_param) case c_notificationKeyPress: result = HandleKeyPress(((LegoEventNotificationParam&) p_param)); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -102,7 +102,7 @@ void Police::ReadyWorld() } // FUNCTION: LEGO1 0x1005e550 -MxLong Police::HandleClick(LegoControlManagerEvent& p_param) +MxLong Police::HandleControl(LegoControlManagerEvent& p_param) { if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index bb325a8f..28cd8c27 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -114,8 +114,8 @@ MxLong RegistrationBook::Notify(MxParam& p_param) case c_notificationButtonDown: m_registerDialogueTimer = Timer()->GetTime(); break; - case c_notificationClick: - result = HandleClick((LegoControlManagerEvent&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationType19: result = HandleNotification19(p_param); @@ -210,7 +210,7 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) } // FUNCTION: LEGO1 0x100774a0 -MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param) +MxLong RegistrationBook::HandleControl(LegoControlManagerEvent& p_param) { MxS16 unk0x28 = p_param.GetUnknown0x28(); diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index f8bea176..a4ff3621 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -104,7 +104,7 @@ MxLong Score::Notify(MxParam& p_param) } ret = 1; break; - case c_notificationClick: + case c_notificationControl: ret = FUN_100016d0((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index fd0990f9..1c1e691d 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -19,12 +19,12 @@ enum NotificationId { c_notificationButtonUp = 8, // 100d6aa0 c_notificationButtonDown = 9, // 100d6aa0 c_notificationMouseMove = 10, // 100d6aa0 - c_notificationType11 = 11, // 100d6aa0 + c_notificationClick = 11, // 100d6aa0 c_notificationDragEnd = 12, c_notificationDragStart = 13, c_notificationDrag = 14, c_notificationTimer = 15, // 100d6aa0 - c_notificationClick = 17, + c_notificationControl = 17, c_notificationEndAnim = 18, // 100d7e80 c_notificationType19 = 19, // 100d6230 c_notificationType20 = 20, From ab4ba9fc4f73fca3ff865bab9e5b5020bbebbe7f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 30 May 2024 10:27:18 -0400 Subject: [PATCH 88/89] Implement/match Lego3DWavePresenter::StartingTickle (#972) * Implement/match Lego3DWavePresenter::StartingTickle * Fix annotation * Add StreamingTickle * Rename --- CMakeLists.txt | 2 +- .../{legounknown100d5778.h => lego3dsound.h} | 20 ++++++------- .../legoomni/include/lego3dwavepresenter.h | 6 ++-- LEGO1/lego/legoomni/include/legocachsound.h | 4 +-- ...egounknown100d5778.cpp => lego3dsound.cpp} | 28 ++++++++++--------- .../src/audio/lego3dwavepresenter.cpp | 26 ++++++++++++++--- LEGO1/omni/include/mxaudiopresenter.h | 2 +- 7 files changed, 54 insertions(+), 34 deletions(-) rename LEGO1/lego/legoomni/include/{legounknown100d5778.h => lego3dsound.h} (59%) rename LEGO1/lego/legoomni/src/audio/{legounknown100d5778.cpp => lego3dsound.cpp} (58%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 259ec560..58d2b662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,12 +306,12 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/actors/radio.cpp LEGO1/lego/legoomni/src/actors/skateboard.cpp LEGO1/lego/legoomni/src/actors/towtrack.cpp + LEGO1/lego/legoomni/src/audio/lego3dsound.cpp LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp LEGO1/lego/legoomni/src/audio/legocachsound.cpp LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp - LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp LEGO1/lego/legoomni/src/build/buildingentity.cpp LEGO1/lego/legoomni/src/build/helicopterstate.cpp diff --git a/LEGO1/lego/legoomni/include/legounknown100d5778.h b/LEGO1/lego/legoomni/include/lego3dsound.h similarity index 59% rename from LEGO1/lego/legoomni/include/legounknown100d5778.h rename to LEGO1/lego/legoomni/include/lego3dsound.h index 5ae43070..a6f4bb02 100644 --- a/LEGO1/lego/legoomni/include/legounknown100d5778.h +++ b/LEGO1/lego/legoomni/include/lego3dsound.h @@ -1,5 +1,5 @@ -#ifndef LEGOUNKNOWN100D5778_H -#define LEGOUNKNOWN100D5778_H +#ifndef LEGO3DSOUND_H +#define LEGO3DSOUND_H #include "decomp.h" #include "mxtypes.h" @@ -10,20 +10,20 @@ class LegoROI; // VTABLE: LEGO1 0x100d5778 // SIZE 0x30 -class LegoUnknown100d5778 { +class Lego3DSound { public: - LegoUnknown100d5778(); - virtual ~LegoUnknown100d5778(); + Lego3DSound(); + virtual ~Lego3DSound(); void Init(); - MxResult FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c); + MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume); void Destroy(); - undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer); + undefined4 FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer); void FUN_10011ca0(); MxS32 FUN_10011cf0(undefined4, undefined4); // SYNTHETIC: LEGO1 0x10011650 - // LegoUnknown100d5778::`scalar deleting destructor' + // Lego3DSound::`scalar deleting destructor' private: undefined m_unk0x04[4]; // 0x04 @@ -34,7 +34,7 @@ class LegoUnknown100d5778 { MxBool m_unk0x15; // 0x15 undefined4 m_unk0x18; // 0x18 undefined m_unk0x1c[0x10]; // 0x1c - undefined4 m_unk0x2c; // 0x2c + MxS32 m_volume; // 0x2c }; -#endif // LEGOUNKNOWN100D5778_H +#endif // LEGO3DSOUND_H diff --git a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h index 79be1834..775f6a09 100644 --- a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h +++ b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h @@ -2,7 +2,7 @@ #define LEGO3DWAVEPRESENTER_H #include "decomp.h" -#include "legounknown100d5778.h" +#include "lego3dsound.h" #include "mxwavepresenter.h" // VTABLE: LEGO1 0x100d52b0 @@ -31,8 +31,8 @@ class Lego3DWavePresenter : public MxWavePresenter { // Lego3DWavePresenter::`scalar deleting destructor' private: - undefined m_unk0x6c[4]; // 0x6c - LegoUnknown100d5778 m_unk0x70; // 0x70 + undefined m_unk0x6c[4]; // 0x6c + Lego3DSound m_sound; // 0x70 }; #endif // LEGO3DWAVEPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 178430ff..f424a465 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -2,7 +2,7 @@ #define LEGOCACHSOUND_H #include "decomp.h" -#include "legounknown100d5778.h" +#include "lego3dsound.h" #include "mxcore.h" #include "mxstring.h" @@ -47,7 +47,7 @@ class LegoCacheSound : public MxCore { LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08 undefined m_unk0xc[4]; // 0x0c - LegoUnknown100d5778 m_unk0x10; // 0x10 + Lego3DSound m_unk0x10; // 0x10 undefined* m_unk0x40; // 0x40 undefined4 m_unk0x44; // 0x44 MxString m_string0x48; // 0x48 diff --git a/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp similarity index 58% rename from LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp rename to LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 3ff57585..23b7a8c5 100644 --- a/LEGO1/lego/legoomni/src/audio/legounknown100d5778.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -1,25 +1,25 @@ -#include "legounknown100d5778.h" +#include "lego3dsound.h" #include "legocharactermanager.h" #include "misc.h" #include "mxomni.h" -DECOMP_SIZE_ASSERT(LegoUnknown100d5778, 0x30) +DECOMP_SIZE_ASSERT(Lego3DSound, 0x30) // FUNCTION: LEGO1 0x10011630 -LegoUnknown100d5778::LegoUnknown100d5778() +Lego3DSound::Lego3DSound() { Init(); } // FUNCTION: LEGO1 0x10011670 -LegoUnknown100d5778::~LegoUnknown100d5778() +Lego3DSound::~Lego3DSound() { Destroy(); } // FUNCTION: LEGO1 0x10011680 -void LegoUnknown100d5778::Init() +void Lego3DSound::Init() { m_dsBuffer = NULL; m_unk0x0c = NULL; @@ -27,16 +27,17 @@ void LegoUnknown100d5778::Init() m_unk0x18 = 0; m_unk0x14 = FALSE; m_unk0x15 = FALSE; - m_unk0x2c = 79; + m_volume = 79; } // STUB: LEGO1 0x100116a0 -MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, undefined4 p_unk0x2c) +// FUNCTION: BETA10 0x10039647 +MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char*, MxS32 p_volume) { - m_unk0x2c = p_unk0x2c; + m_volume = p_volume; if (MxOmni::IsSound3D()) { - p_dsound->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); + p_directSoundBuffer->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &m_dsBuffer); if (m_dsBuffer == NULL) { return FAILURE; } @@ -50,7 +51,7 @@ MxResult LegoUnknown100d5778::FUN_100116a0(LPDIRECTSOUND p_dsound, undefined4, u } // FUNCTION: LEGO1 0x10011880 -void LegoUnknown100d5778::Destroy() +void Lego3DSound::Destroy() { if (m_dsBuffer) { m_dsBuffer->Release(); @@ -70,20 +71,21 @@ void LegoUnknown100d5778::Destroy() } // STUB: LEGO1 0x100118e0 -undefined4 LegoUnknown100d5778::FUN_100118e0(LPDIRECTSOUNDBUFFER p_dsBuffer) +// FUNCTION: BETA10 0x10039a2a +undefined4 Lego3DSound::FUN_100118e0(LPDIRECTSOUNDBUFFER p_directSoundBuffer) { // TODO return 0; } // STUB: LEGO1 0x10011ca0 -void LegoUnknown100d5778::FUN_10011ca0() +void Lego3DSound::FUN_10011ca0() { // TODO } // STUB: LEGO1 0x10011cf0 -MxS32 LegoUnknown100d5778::FUN_10011cf0(undefined4, undefined4) +MxS32 Lego3DSound::FUN_10011cf0(undefined4, undefined4) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp index b60f3ded..10b79146 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp @@ -1,5 +1,7 @@ #include "lego3dwavepresenter.h" +#include "mxcompositepresenter.h" +#include "mxdsaction.h" #include "mxomni.h" DECOMP_SIZE_ASSERT(Lego3DWavePresenter, 0xa0) @@ -28,7 +30,8 @@ void Lego3DWavePresenter::Destroy() } } -// STUB: LEGO1 0x1004a810 +// FUNCTION: LEGO1 0x1004a810 +// FUNCTION: BETA10 0x1003a3b0 void Lego3DWavePresenter::StartingTickle() { if (MxOmni::IsSound3D()) { @@ -37,12 +40,27 @@ void Lego3DWavePresenter::StartingTickle() MxWavePresenter::StartingTickle(); - // TODO + if (m_dsBuffer != NULL) { + MxU16 extraLength; + char* buff; + m_action->GetExtra(extraLength, buff); + + if (!strcmp(buff, "FROM_PARENT") && m_compositePresenter != NULL) { + m_compositePresenter->GetAction()->GetExtra(extraLength, buff); + } + + if (m_sound.Create(m_dsBuffer, buff, m_volume) != SUCCESS) { + m_dsBuffer->Release(); + m_dsBuffer = NULL; + EndAction(); + } + } } -// STUB: LEGO1 0x1004a8b0 +// FUNCTION: LEGO1 0x1004a8b0 +// FUNCTION: BETA10 0x1003a4cc void Lego3DWavePresenter::StreamingTickle() { MxWavePresenter::StreamingTickle(); - // TODO + m_sound.FUN_100118e0(m_dsBuffer); } diff --git a/LEGO1/omni/include/mxaudiopresenter.h b/LEGO1/omni/include/mxaudiopresenter.h index 873871ec..dd4369ea 100644 --- a/LEGO1/omni/include/mxaudiopresenter.h +++ b/LEGO1/omni/include/mxaudiopresenter.h @@ -30,7 +30,7 @@ class MxAudioPresenter : public MxMediaPresenter { virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; } // vtable+0x60 protected: - MxS32 m_volume; + MxS32 m_volume; // 0x50 }; // SYNTHETIC: LEGO1 0x1000d370 From ac41854149776a30b7acaa89808cee0a7cad7380 Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 30 May 2024 13:10:41 -0400 Subject: [PATCH 89/89] Add static HandlerClassName function (#973) * Add static HandlerClassName function * Use method in PresenterNameDispatch --- LEGO1/lego/legoomni/include/jetskirace.h | 11 ++++++-- .../legoomni/include/lego3dwavepresenter.h | 11 ++++++-- .../include/legoactioncontrolpresenter.h | 11 ++++++-- .../legoomni/include/legoactorpresenter.h | 11 ++++++-- .../legoomni/include/legoanimmmpresenter.h | 11 ++++++-- .../lego/legoomni/include/legoanimpresenter.h | 11 ++++++-- .../include/legocarbuildanimpresenter.h | 11 ++++++-- .../legoomni/include/legocontrolmanager.h | 11 ++++++-- .../legoomni/include/legoentitypresenter.h | 11 ++++++-- .../include/legoflctexturepresenter.h | 11 ++++++-- .../legoomni/include/legohideanimpresenter.h | 11 ++++++-- .../include/legoloadcachesoundpresenter.h | 11 ++++++-- .../include/legolocomotionanimpresenter.h | 11 ++++++-- .../include/legoloopinganimpresenter.h | 11 ++++++-- .../legoomni/include/legomodelpresenter.h | 11 ++++++-- .../legoomni/include/legopalettepresenter.h | 11 ++++++-- .../lego/legoomni/include/legopartpresenter.h | 11 ++++++-- .../lego/legoomni/include/legopathpresenter.h | 11 ++++++-- .../legoomni/include/legophonemepresenter.h | 11 ++++++-- LEGO1/lego/legoomni/include/legorace.h | 11 ++++++-- .../legoomni/include/legotexturepresenter.h | 11 ++++++-- .../legoomni/include/legoworldpresenter.h | 11 ++++++-- LEGO1/omni/include/mxaudiopresenter.h | 11 ++++++-- LEGO1/omni/include/mxcompositepresenter.h | 11 ++++++-- LEGO1/omni/include/mxeventpresenter.h | 11 ++++++-- LEGO1/omni/include/mxflcpresenter.h | 11 ++++++-- LEGO1/omni/include/mxloopingflcpresenter.h | 11 ++++++-- LEGO1/omni/include/mxloopingmidipresenter.h | 11 ++++++-- LEGO1/omni/include/mxloopingsmkpresenter.h | 11 ++++++-- LEGO1/omni/include/mxmediapresenter.h | 11 ++++++-- LEGO1/omni/include/mxmidipresenter.h | 11 ++++++-- LEGO1/omni/include/mxmusicpresenter.h | 11 ++++++-- LEGO1/omni/include/mxpresenter.h | 11 ++++++-- LEGO1/omni/include/mxsmkpresenter.h | 11 ++++++-- LEGO1/omni/include/mxsoundpresenter.h | 11 ++++++-- LEGO1/omni/include/mxstillpresenter.h | 11 ++++++-- LEGO1/omni/include/mxvideopresenter.h | 11 ++++++-- LEGO1/omni/include/mxwavepresenter.h | 11 ++++++-- LEGO1/omni/src/common/mxpresenter.cpp | 27 ++++++++++++++----- 39 files changed, 362 insertions(+), 83 deletions(-) diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index bb612ec7..7f17a1fc 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -7,13 +7,20 @@ // SIZE 0x144 class JetskiRace : public LegoRace { public: - // FUNCTION: LEGO1 0x1000daf0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a8840 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0530 return "JetskiRace"; } + // FUNCTION: LEGO1 0x1000daf0 + // FUNCTION: BETA10 0x100a8810 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000db00 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h index 775f6a09..2ebd9426 100644 --- a/LEGO1/lego/legoomni/include/lego3dwavepresenter.h +++ b/LEGO1/lego/legoomni/include/lego3dwavepresenter.h @@ -9,13 +9,20 @@ // SIZE 0xa0 class Lego3DWavePresenter : public MxWavePresenter { public: - // FUNCTION: LEGO1 0x1000d890 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a8670 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f058c return "Lego3DWavePresenter"; } + // FUNCTION: LEGO1 0x1000d890 + // FUNCTION: BETA10 0x100a8640 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000d8a0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h index 98ee03f2..c46aec5b 100644 --- a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h @@ -13,13 +13,20 @@ class LegoActionControlPresenter : public MxMediaPresenter { LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; } ~LegoActionControlPresenter() override { Destroy(TRUE); } // vtable+0x00 - // FUNCTION: LEGO1 0x1000d0e0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a7840 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f05bc return "LegoActionControlPresenter"; } + // FUNCTION: LEGO1 0x1000d0e0 + // FUNCTION: BETA10 0x100a7810 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000d0f0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoactorpresenter.h b/LEGO1/lego/legoomni/include/legoactorpresenter.h index aea15b64..99f6cd04 100644 --- a/LEGO1/lego/legoomni/include/legoactorpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactorpresenter.h @@ -12,13 +12,20 @@ class LegoActorPresenter : public LegoEntityPresenter { // FUNCTION: LEGO1 0x100679c0 ~LegoActorPresenter() override {} - // FUNCTION: LEGO1 0x1000cb10 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a6f10 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f06a4 return "LegoActorPresenter"; } + // FUNCTION: LEGO1 0x1000cb10 + // FUNCTION: BETA10 0x100a6ee0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000cb20 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 4ca63a7b..946fcdd0 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -29,13 +29,20 @@ class LegoAnimMMPresenter : public MxCompositePresenter { MxLong Notify(MxParam& p_param) override; // vtable+0x04 - // FUNCTION: LEGO1 0x1004a950 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1004d840 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f046c return "LegoAnimMMPresenter"; } + // FUNCTION: LEGO1 0x1004a950 + // FUNCTION: BETA10 0x1004d810 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1004a960 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 44ed14aa..6dc2c7ce 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -41,13 +41,20 @@ class LegoAnimPresenter : public MxVideoPresenter { LegoAnimPresenter(); ~LegoAnimPresenter() override; - // FUNCTION: LEGO1 0x10068530 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10055300 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f071c return "LegoAnimPresenter"; } + // FUNCTION: LEGO1 0x10068530 + // FUNCTION: BETA10 0x100552d0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10068540 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h index 5b72d2be..d4c12d76 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h @@ -11,13 +11,20 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { LegoCarBuildAnimPresenter(); ~LegoCarBuildAnimPresenter() override; // vtable+0x00 - // FUNCTION: LEGO1 0x10078510 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10073290 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f05ec return "LegoCarBuildAnimPresenter"; } + // FUNCTION: LEGO1 0x10078510 + // FUNCTION: BETA10 0x10073260 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10078520 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index f5274a31..09e5a6d5 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -46,13 +46,20 @@ class LegoControlManager : public MxCore { MxResult Tickle() override; // vtable+0x08 - // FUNCTION: LEGO1 0x10028cb0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1008af70 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f31b8 return "LegoControlManager"; } + // FUNCTION: LEGO1 0x10028cb0 + // FUNCTION: BETA10 0x1008af40 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10028cc0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoentitypresenter.h b/LEGO1/lego/legoomni/include/legoentitypresenter.h index e8bf6ff1..e4da7af7 100644 --- a/LEGO1/lego/legoomni/include/legoentitypresenter.h +++ b/LEGO1/lego/legoomni/include/legoentitypresenter.h @@ -13,13 +13,20 @@ class LegoEntityPresenter : public MxCompositePresenter { LegoEntityPresenter(); ~LegoEntityPresenter() override; // vtable+0x00 - // FUNCTION: LEGO1 0x100534b0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10080780 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f06b8 return "LegoEntityPresenter"; } + // FUNCTION: LEGO1 0x100534b0 + // FUNCTION: BETA10 0x10080750 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100534c0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h index 70f8a309..706b953d 100644 --- a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h +++ b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h @@ -10,13 +10,20 @@ class LegoFlcTexturePresenter : public MxFlcPresenter { public: LegoFlcTexturePresenter(); - // FUNCTION: LEGO1 0x1005def0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100837e0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0634 return "LegoFlcTexturePresenter"; } + // FUNCTION: LEGO1 0x1005def0 + // FUNCTION: BETA10 0x100837b0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void StartingTickle() override; // vtable+0x1c void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 void PutFrame() override; // vtable+0x6c diff --git a/LEGO1/lego/legoomni/include/legohideanimpresenter.h b/LEGO1/lego/legoomni/include/legohideanimpresenter.h index d560f224..4006a91c 100644 --- a/LEGO1/lego/legoomni/include/legohideanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legohideanimpresenter.h @@ -25,13 +25,20 @@ class LegoHideAnimPresenter : public LegoLoopingAnimPresenter { LegoHideAnimPresenter(); ~LegoHideAnimPresenter() override; - // FUNCTION: LEGO1 0x1006d880 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1005d4a0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f06cc return "LegoHideAnimPresenter"; } + // FUNCTION: LEGO1 0x1006d880 + // FUNCTION: BETA10 0x1005d470 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1006d890 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h index cb6ad80a..883f4b01 100644 --- a/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloadcachesoundpresenter.h @@ -13,13 +13,20 @@ class LegoLoadCacheSoundPresenter : public MxWavePresenter { LegoLoadCacheSoundPresenter(); ~LegoLoadCacheSoundPresenter() override; - // FUNCTION: LEGO1 0x10018450 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1008cf90 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f05a0 return "LegoLoadCacheSoundPresenter"; } + // FUNCTION: LEGO1 0x10018450 + // FUNCTION: BETA10 0x1008cf60 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void ReadyTickle() override; // vtable+0x18 void StreamingTickle() override; // vtable+0x20 void DoneTickle() override; // vtable+0x2c diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index 1a06ab35..f3eb4ccf 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -11,13 +11,20 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { LegoLocomotionAnimPresenter(); ~LegoLocomotionAnimPresenter() override; - // FUNCTION: LEGO1 0x1006ce50 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1005c4e0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f06e4 return "LegoLocomotionAnimPresenter"; } + // FUNCTION: LEGO1 0x1006ce50 + // FUNCTION: BETA10 0x1005c4b0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1006ce60 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h b/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h index c7095dac..355d6dc8 100644 --- a/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoloopinganimpresenter.h @@ -7,13 +7,20 @@ // SIZE 0xc0 class LegoLoopingAnimPresenter : public LegoAnimPresenter { public: - // FUNCTION: LEGO1 0x1000c9a0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1005c6f0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0700 return "LegoLoopingAnimPresenter"; } + // FUNCTION: LEGO1 0x1000c9a0 + // FUNCTION: BETA10 0x1005c6c0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000c9b0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legomodelpresenter.h b/LEGO1/lego/legoomni/include/legomodelpresenter.h index f8b4cea1..679aec0b 100644 --- a/LEGO1/lego/legoomni/include/legomodelpresenter.h +++ b/LEGO1/lego/legoomni/include/legomodelpresenter.h @@ -19,13 +19,20 @@ class LegoModelPresenter : public MxVideoPresenter { static void configureLegoModelPresenter(MxS32 p_modelPresenterConfig); - // FUNCTION: LEGO1 0x1000ccb0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a7180 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f067c return "LegoModelPresenter"; } + // FUNCTION: LEGO1 0x1000ccb0 + // FUNCTION: BETA10 0x100a7150 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000ccc0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legopalettepresenter.h b/LEGO1/lego/legoomni/include/legopalettepresenter.h index d6906540..2cd72973 100644 --- a/LEGO1/lego/legoomni/include/legopalettepresenter.h +++ b/LEGO1/lego/legoomni/include/legopalettepresenter.h @@ -13,13 +13,20 @@ class LegoPalettePresenter : public MxVideoPresenter { LegoPalettePresenter(); ~LegoPalettePresenter() override; // vtable+0x00 - // FUNCTION: LEGO1 0x10079f30 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100ab250 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f061c return "LegoPalettePresenter"; } + // FUNCTION: LEGO1 0x10079f30 + // FUNCTION: BETA10 0x100ab220 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10079f40 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legopartpresenter.h b/LEGO1/lego/legoomni/include/legopartpresenter.h index 5de1402d..514ab603 100644 --- a/LEGO1/lego/legoomni/include/legopartpresenter.h +++ b/LEGO1/lego/legoomni/include/legopartpresenter.h @@ -13,13 +13,20 @@ class LegoPartPresenter : public MxMediaPresenter { // FUNCTION: LEGO1 0x10067300 ~LegoPartPresenter() override { Destroy(TRUE); } - // FUNCTION: LEGO1 0x1000cf70 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a75d0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f05d8 return "LegoPartPresenter"; } + // FUNCTION: LEGO1 0x1000cf70 + // FUNCTION: BETA10 0x100a75a0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000cf80 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legopathpresenter.h b/LEGO1/lego/legoomni/include/legopathpresenter.h index 9e3f0f0f..bfae8a74 100644 --- a/LEGO1/lego/legoomni/include/legopathpresenter.h +++ b/LEGO1/lego/legoomni/include/legopathpresenter.h @@ -11,13 +11,20 @@ class LegoPathPresenter : public MxMediaPresenter { LegoPathPresenter(); ~LegoPathPresenter() override; - // FUNCTION: LEGO1 0x100449a0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100c24d0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0690 return "LegoPathPresenter"; } + // FUNCTION: LEGO1 0x100449a0 + // FUNCTION: BETA10 0x100c24a0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100449b0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legophonemepresenter.h b/LEGO1/lego/legoomni/include/legophonemepresenter.h index 0f4a6a5d..3786a6f1 100644 --- a/LEGO1/lego/legoomni/include/legophonemepresenter.h +++ b/LEGO1/lego/legoomni/include/legophonemepresenter.h @@ -15,13 +15,20 @@ class LegoPhonemePresenter : public MxFlcPresenter { LegoPhonemePresenter(); ~LegoPhonemePresenter() override; // vtable+0x00 - // FUNCTION: LEGO1 0x1004e310 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100c4220 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f064c return "LegoPhonemePresenter"; } + // FUNCTION: LEGO1 0x1004e310 + // FUNCTION: BETA10 0x100c41f0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void StartingTickle() override; // vtable+0x1c void EndAction() override; // vtable+0x40 void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 29e46cab..f99f7e28 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -15,13 +15,20 @@ class LegoRace : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 - // FUNCTION: LEGO1 0x10015ba0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a8970 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f07c4 return "LegoRace"; } + // FUNCTION: LEGO1 0x10015ba0 + // FUNCTION: BETA10 0x100a8940 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10015bb0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legotexturepresenter.h b/LEGO1/lego/legoomni/include/legotexturepresenter.h index 49947295..3e8cf5d1 100644 --- a/LEGO1/lego/legoomni/include/legotexturepresenter.h +++ b/LEGO1/lego/legoomni/include/legotexturepresenter.h @@ -11,13 +11,20 @@ class LegoTexturePresenter : public MxMediaPresenter { LegoTexturePresenter() : m_textures(NULL) {} ~LegoTexturePresenter() override; - // FUNCTION: LEGO1 0x1000ce50 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100a73c0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0664 return "LegoTexturePresenter"; } + // FUNCTION: LEGO1 0x1000ce50 + // FUNCTION: BETA10 0x100a7390 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000ce60 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/lego/legoomni/include/legoworldpresenter.h b/LEGO1/lego/legoomni/include/legoworldpresenter.h index 831b64f5..a7e09c4e 100644 --- a/LEGO1/lego/legoomni/include/legoworldpresenter.h +++ b/LEGO1/lego/legoomni/include/legoworldpresenter.h @@ -18,13 +18,20 @@ class LegoWorldPresenter : public LegoEntityPresenter { static void configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality); - // FUNCTION: LEGO1 0x10066630 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100e41c0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0608 return "LegoWorldPresenter"; } + // FUNCTION: LEGO1 0x10066630 + // FUNCTION: BETA10 0x100e4190 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x10066640 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxaudiopresenter.h b/LEGO1/omni/include/mxaudiopresenter.h index dd4369ea..448f957f 100644 --- a/LEGO1/omni/include/mxaudiopresenter.h +++ b/LEGO1/omni/include/mxaudiopresenter.h @@ -10,13 +10,20 @@ class MxAudioPresenter : public MxMediaPresenter { public: MxAudioPresenter() { m_volume = 100; } - // FUNCTION: LEGO1 0x1000d280 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1008cba0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f078c return "MxAudioPresenter"; } + // FUNCTION: LEGO1 0x1000d280 + // FUNCTION: BETA10 0x1008cb70 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000d290 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxcompositepresenter.h b/LEGO1/omni/include/mxcompositepresenter.h index 977c1325..fb88cf86 100644 --- a/LEGO1/omni/include/mxcompositepresenter.h +++ b/LEGO1/omni/include/mxcompositepresenter.h @@ -18,13 +18,20 @@ class MxCompositePresenter : public MxPresenter { MxLong Notify(MxParam& p_param) override; // vtable+0x04 - // FUNCTION: LEGO1 0x100b6210 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1004da30 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0774 return "MxCompositePresenter"; } + // FUNCTION: LEGO1 0x100b6210 + // FUNCTION: BETA10 0x1004da00 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100b6220 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxeventpresenter.h b/LEGO1/omni/include/mxeventpresenter.h index 1812280f..71c5aed3 100644 --- a/LEGO1/omni/include/mxeventpresenter.h +++ b/LEGO1/omni/include/mxeventpresenter.h @@ -11,13 +11,20 @@ class MxEventPresenter : public MxMediaPresenter { MxEventPresenter(); ~MxEventPresenter() override; - // FUNCTION: LEGO1 0x100c2c30 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f0d0 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101dcc return "MxEventPresenter"; } + // FUNCTION: LEGO1 0x100c2c30 + // FUNCTION: BETA10 0x10152f10 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100c2c40 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxflcpresenter.h b/LEGO1/omni/include/mxflcpresenter.h index 569fa06c..deffbac0 100644 --- a/LEGO1/omni/include/mxflcpresenter.h +++ b/LEGO1/omni/include/mxflcpresenter.h @@ -19,13 +19,20 @@ class MxFlcPresenter : public MxVideoPresenter { return !strcmp(p_name, MxFlcPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - // FUNCTION: LEGO1 0x100b33f0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10083790 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f43c8 return "MxFlcPresenter"; } + // FUNCTION: LEGO1 0x100b33f0 + // FUNCTION: BETA10 0x10083760 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void LoadHeader(MxStreamChunk* p_chunk) override; // vtable+0x5c void CreateBitmap() override; // vtable+0x60 void LoadFrame(MxStreamChunk* p_chunk) override; // vtable+0x68 diff --git a/LEGO1/omni/include/mxloopingflcpresenter.h b/LEGO1/omni/include/mxloopingflcpresenter.h index 1bc76e18..8a1f7d8d 100644 --- a/LEGO1/omni/include/mxloopingflcpresenter.h +++ b/LEGO1/omni/include/mxloopingflcpresenter.h @@ -11,13 +11,20 @@ class MxLoopingFlcPresenter : public MxFlcPresenter { MxLoopingFlcPresenter(); ~MxLoopingFlcPresenter() override; - // FUNCTION: LEGO1 0x100b4380 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f050 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101e20 return "MxLoopingFlcPresenter"; } + // FUNCTION: LEGO1 0x100b4380 + // FUNCTION: BETA10 0x1013c300 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void RepeatingTickle() override; // vtable+0x24 MxResult AddToManager() override; // vtable+0x34 void Destroy() override; // vtable+0x38 diff --git a/LEGO1/omni/include/mxloopingmidipresenter.h b/LEGO1/omni/include/mxloopingmidipresenter.h index 1a9eff73..0bdd191e 100644 --- a/LEGO1/omni/include/mxloopingmidipresenter.h +++ b/LEGO1/omni/include/mxloopingmidipresenter.h @@ -7,13 +7,20 @@ // SIZE 0x58 class MxLoopingMIDIPresenter : public MxMIDIPresenter { public: - // FUNCTION: LEGO1 0x100b1830 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f0b0 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101de0 return "MxLoopingMIDIPresenter"; } + // FUNCTION: LEGO1 0x100b1830 + // FUNCTION: BETA10 0x10143910 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100b1840 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxloopingsmkpresenter.h b/LEGO1/omni/include/mxloopingsmkpresenter.h index de0f506f..a71b00e1 100644 --- a/LEGO1/omni/include/mxloopingsmkpresenter.h +++ b/LEGO1/omni/include/mxloopingsmkpresenter.h @@ -11,13 +11,20 @@ class MxLoopingSmkPresenter : public MxSmkPresenter { MxLoopingSmkPresenter(); ~MxLoopingSmkPresenter() override; // vtable+0x00 - // FUNCTION: LEGO1 0x100b4920 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f070 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101e08 return "MxLoopingSmkPresenter"; } + // FUNCTION: LEGO1 0x100b4920 + // FUNCTION: BETA10 0x1013c360 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + void RepeatingTickle() override; // vtable+0x24 MxResult AddToManager() override; // vtable+0x34 void Destroy() override; // vtable+0x38 diff --git a/LEGO1/omni/include/mxmediapresenter.h b/LEGO1/omni/include/mxmediapresenter.h index e78ac194..83dc2c28 100644 --- a/LEGO1/omni/include/mxmediapresenter.h +++ b/LEGO1/omni/include/mxmediapresenter.h @@ -18,13 +18,20 @@ class MxMediaPresenter : public MxPresenter { MxResult Tickle() override; // vtable+0x08 - // FUNCTION: LEGO1 0x1000c5c0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10054f50 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f074c return "MxMediaPresenter"; } + // FUNCTION: LEGO1 0x1000c5c0 + // FUNCTION: BETA10 0x10054f20 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000c5d0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxmidipresenter.h b/LEGO1/omni/include/mxmidipresenter.h index adab6fe2..35eefd4d 100644 --- a/LEGO1/omni/include/mxmidipresenter.h +++ b/LEGO1/omni/include/mxmidipresenter.h @@ -12,13 +12,20 @@ class MxMIDIPresenter : public MxMusicPresenter { MxMIDIPresenter(); ~MxMIDIPresenter() override; - // FUNCTION: LEGO1 0x100c2650 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f090 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101df8 return "MxMIDIPresenter"; } + // FUNCTION: LEGO1 0x100c2650 + // FUNCTION: BETA10 0x10143a90 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100c2660 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxmusicpresenter.h b/LEGO1/omni/include/mxmusicpresenter.h index a66afa78..ec9a37ce 100644 --- a/LEGO1/omni/include/mxmusicpresenter.h +++ b/LEGO1/omni/include/mxmusicpresenter.h @@ -10,13 +10,20 @@ class MxMusicPresenter : public MxAudioPresenter { MxMusicPresenter(); ~MxMusicPresenter() override; - // FUNCTION: LEGO1 0x100c23a0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x10143a70 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101e48 return "MxMusicPresenter"; } + // FUNCTION: LEGO1 0x100c23a0 + // FUNCTION: BETA10 0x10143a50 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100c23b0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index a652f40d..b865a52f 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -33,13 +33,20 @@ class MxPresenter : public MxCore { MxResult Tickle() override; // vtable+0x08 - // FUNCTION: LEGO1 0x1000bfe0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1004d9e0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0740 return "MxPresenter"; } + // FUNCTION: LEGO1 0x1000bfe0 + // FUNCTION: BETA10 0x1004d9b0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000bff0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxsmkpresenter.h b/LEGO1/omni/include/mxsmkpresenter.h index d17ce59d..eccd6737 100644 --- a/LEGO1/omni/include/mxsmkpresenter.h +++ b/LEGO1/omni/include/mxsmkpresenter.h @@ -12,13 +12,20 @@ class MxSmkPresenter : public MxVideoPresenter { MxSmkPresenter(); ~MxSmkPresenter() override; - // FUNCTION: LEGO1 0x100b3730 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1012f010 + static const char* HandlerClassName() { // STRING: LEGO1 0x10101e38 return "MxSmkPresenter"; } + // FUNCTION: LEGO1 0x100b3730 + // FUNCTION: BETA10 0x1013b8c0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100b3740 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxsoundpresenter.h b/LEGO1/omni/include/mxsoundpresenter.h index 3f578109..e56aa1fd 100644 --- a/LEGO1/omni/include/mxsoundpresenter.h +++ b/LEGO1/omni/include/mxsoundpresenter.h @@ -10,13 +10,20 @@ class MxSoundPresenter : public MxAudioPresenter { // FUNCTION: LEGO1 0x1000d430 ~MxSoundPresenter() override { Destroy(TRUE); } - // FUNCTION: LEGO1 0x1000d4a0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1008ca70 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f07a0 return "MxSoundPresenter"; } + // FUNCTION: LEGO1 0x1000d4a0 + // FUNCTION: BETA10 0x1008ca40 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000d4b0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxstillpresenter.h b/LEGO1/omni/include/mxstillpresenter.h index 0fb92862..3364085f 100644 --- a/LEGO1/omni/include/mxstillpresenter.h +++ b/LEGO1/omni/include/mxstillpresenter.h @@ -13,13 +13,20 @@ class MxStillPresenter : public MxVideoPresenter { // FUNCTION: LEGO1 0x10043550 ~MxStillPresenter() override { Destroy(TRUE); } // vtable+0x00 - // FUNCTION: LEGO1 0x100435c0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100980c0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0184 return "MxStillPresenter"; } + // FUNCTION: LEGO1 0x100435c0 + // FUNCTION: BETA10 0x10098090 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x100435d0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 19a40e39..55770f60 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -17,13 +17,20 @@ class MxVideoPresenter : public MxMediaPresenter { // FUNCTION: LEGO1 0x1000c740 ~MxVideoPresenter() override { Destroy(TRUE); } // vtable+0x00 - // FUNCTION: LEGO1 0x1000c820 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x100551b0 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f0760 return "MxVideoPresenter"; } + // FUNCTION: LEGO1 0x1000c820 + // FUNCTION: BETA10 0x10055180 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000c830 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/include/mxwavepresenter.h b/LEGO1/omni/include/mxwavepresenter.h index 27bd1824..12ed817e 100644 --- a/LEGO1/omni/include/mxwavepresenter.h +++ b/LEGO1/omni/include/mxwavepresenter.h @@ -15,13 +15,20 @@ class MxWavePresenter : public MxSoundPresenter { // FUNCTION: LEGO1 0x1000d640 ~MxWavePresenter() override { Destroy(TRUE); } // vtable+0x00 - // FUNCTION: LEGO1 0x1000d6c0 - inline const char* ClassName() const override // vtable+0x0c + // FUNCTION: BETA10 0x1008cd00 + static const char* HandlerClassName() { // STRING: LEGO1 0x100f07b4 return "MxWavePresenter"; } + // FUNCTION: LEGO1 0x1000d6c0 + // FUNCTION: BETA10 0x1008ccd0 + inline const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + // FUNCTION: LEGO1 0x1000d6d0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index be530f58..5d19f091 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -8,13 +8,22 @@ #include "mxdsanim.h" #include "mxdssound.h" #include "mxentity.h" +#include "mxeventpresenter.h" +#include "mxflcpresenter.h" +#include "mxloopingflcpresenter.h" +#include "mxloopingmidipresenter.h" +#include "mxloopingsmkpresenter.h" +#include "mxmidipresenter.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxobjectfactory.h" #include "mxomni.h" #include "mxparam.h" +#include "mxsmkpresenter.h" +#include "mxstillpresenter.h" #include "mxstreamer.h" #include "mxutilities.h" +#include "mxwavepresenter.h" #include @@ -175,6 +184,7 @@ void MxPresenter::Enable(MxBool p_enable) } // FUNCTION: LEGO1 0x100b5310 +// FUNCTION: BETA10 0x1012e8bd const char* PresenterNameDispatch(const MxDSAction& p_action) { const char* name = p_action.GetSourceName(); @@ -186,10 +196,12 @@ const char* PresenterNameDispatch(const MxDSAction& p_action) format = ((MxDSAnim&) p_action).GetMediaFormat(); switch (format) { case FOURCC(' ', 'F', 'L', 'C'): - name = !p_action.IsLooping() ? "MxFlcPresenter" : "MxLoopingFlcPresenter"; + name = !p_action.IsLooping() ? MxFlcPresenter::HandlerClassName() + : MxLoopingFlcPresenter::HandlerClassName(); break; case FOURCC(' ', 'S', 'M', 'K'): - name = !p_action.IsLooping() ? "MxSmkPresenter" : "MxLoopingSmkPresenter"; + name = !p_action.IsLooping() ? MxSmkPresenter::HandlerClassName() + : MxLoopingSmkPresenter::HandlerClassName(); break; } break; @@ -198,10 +210,11 @@ const char* PresenterNameDispatch(const MxDSAction& p_action) format = ((MxDSSound&) p_action).GetMediaFormat(); switch (format) { case FOURCC(' ', 'M', 'I', 'D'): - name = !p_action.IsLooping() ? "MxMIDIPresenter" : "MxLoopingMIDIPresenter"; + name = !p_action.IsLooping() ? MxMIDIPresenter::HandlerClassName() + : MxLoopingMIDIPresenter::HandlerClassName(); break; case FOURCC(' ', 'W', 'A', 'V'): - name = "MxWavePresenter"; + name = MxWavePresenter::HandlerClassName(); break; } break; @@ -209,15 +222,15 @@ const char* PresenterNameDispatch(const MxDSAction& p_action) case MxDSObject::e_serialAction: case MxDSObject::e_parallelAction: case MxDSObject::e_selectAction: - name = "MxCompositePresenter"; + name = MxCompositePresenter::HandlerClassName(); break; case MxDSObject::e_event: - name = "MxEventPresenter"; + name = MxEventPresenter::HandlerClassName(); break; case MxDSObject::e_still: - name = "MxStillPresenter"; + name = MxStillPresenter::HandlerClassName(); break; } }