From d978cbe7f9e65276b9cf042f202bd1b2f7e0d67b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 8 Mar 2024 15:01:18 -0500 Subject: [PATCH] Implement/match LegoROI::FUN_100a9210 (#638) * Implement/match LegoROI::FUN_100a9210 * Fix order --- LEGO1/lego/sources/roi/legolod.cpp | 7 +++++++ LEGO1/lego/sources/roi/legolod.h | 1 + LEGO1/lego/sources/roi/legoroi.cpp | 25 ++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 4e7cc1ef..bf81b29a 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -311,6 +311,13 @@ done: return FAILURE; } +// STUB: LEGO1 0x100aad00 +LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo) +{ + // TODO + return SUCCESS; +} + // FUNCTION: LEGO1 0x100aae20 LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name) { diff --git a/LEGO1/lego/sources/roi/legolod.h b/LEGO1/lego/sources/roi/legolod.h index 92ad3515..00993cb3 100644 --- a/LEGO1/lego/sources/roi/legolod.h +++ b/LEGO1/lego/sources/roi/legolod.h @@ -28,6 +28,7 @@ public: float VTable0x10() override { return 0.0; } // vtable+0x10 LegoResult Read(Tgl::Renderer*, LegoTextureContainer* p_textureContainer, LegoStorage* p_storage); + LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo); static LegoBool FUN_100aae20(const LegoChar* p_name); diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 7cfc13aa..8b701fca 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -425,11 +425,30 @@ LegoResult LegoROI::FUN_100a9170(LegoFloat, LegoFloat, LegoFloat, LegoFloat) return SUCCESS; } -// STUB: LEGO1 0x100a9210 +// FUNCTION: LEGO1 0x100a9210 LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo) { - // TODO - return SUCCESS; + LegoResult result = SUCCESS; + CompoundObject::iterator it; + + int lodCount = GetLODCount(); + for (LegoU32 i = 0; i < lodCount; i++) { + LegoLOD* lod = (LegoLOD*) GetLOD(i); + + if (lod->FUN_100aad00(p_textureInfo) != SUCCESS) { + result = FAILURE; + } + } + + if (comp != NULL) { + for (it = comp->begin(); it != comp->end(); it++) { + if (((LegoROI*) *it)->FUN_100a9210(p_textureInfo) != SUCCESS) { + result = FAILURE; + } + } + } + + return result; } // FUNCTION: LEGO1 0x100a9a50