From c22c6f337960f0c4c2f1170e857417926cbeeb0f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 10 Jun 2024 11:44:55 -0400 Subject: [PATCH] Implement/match LegoFlcTexturePresenter (#1015) * Implement/match LegoFlcTexturePresenter * Move files --- CMakeLists.txt | 4 +- .../include/legoflctexturepresenter.h | 6 ++- .../src/{build => actors}/buildingentity.cpp | 0 .../{build => common}/legobuildingmanager.cpp | 0 .../src/video/legoflctexturepresenter.cpp | 52 ++++++++++++++++--- 5 files changed, 50 insertions(+), 12 deletions(-) rename LEGO1/lego/legoomni/src/{build => actors}/buildingentity.cpp (100%) rename LEGO1/lego/legoomni/src/{build => common}/legobuildingmanager.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06c10670..1bcb3535 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,6 +289,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/actors/act3shark.cpp LEGO1/lego/legoomni/src/actors/ambulance.cpp LEGO1/lego/legoomni/src/actors/bike.cpp + LEGO1/lego/legoomni/src/actors/buildingentity.cpp LEGO1/lego/legoomni/src/actors/buildings.cpp LEGO1/lego/legoomni/src/actors/bumpbouy.cpp LEGO1/lego/legoomni/src/actors/doors.cpp @@ -312,8 +313,6 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp - LEGO1/lego/legoomni/src/build/buildingentity.cpp - LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp LEGO1/lego/legoomni/src/build/legocarbuild.cpp LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp @@ -321,6 +320,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp + LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp LEGO1/lego/legoomni/src/common/legocharactermanager.cpp LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp LEGO1/lego/legoomni/src/common/legogamestate.cpp diff --git a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h index 706b953d..bb90a14b 100644 --- a/LEGO1/lego/legoomni/include/legoflctexturepresenter.h +++ b/LEGO1/lego/legoomni/include/legoflctexturepresenter.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "mxflcpresenter.h" +class LegoTextureInfo; + // VTABLE: LEGO1 0x100d89e0 // SIZE 0x70 class LegoFlcTexturePresenter : public MxFlcPresenter { @@ -34,8 +36,8 @@ class LegoFlcTexturePresenter : public MxFlcPresenter { private: void Init(); - undefined4 m_unk0x68; // 0x68 - undefined4 m_unk0x6c; // 0x6c + MxS32 m_rectCount; // 0x68 + LegoTextureInfo* m_texture; // 0x6c }; #endif // LEGOFLCTEXTUREPRESENTER_H diff --git a/LEGO1/lego/legoomni/src/build/buildingentity.cpp b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp similarity index 100% rename from LEGO1/lego/legoomni/src/build/buildingentity.cpp rename to LEGO1/lego/legoomni/src/actors/buildingentity.cpp diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp similarity index 100% rename from LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp rename to LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp diff --git a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp index 8d77a1eb..5d37e829 100644 --- a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp @@ -1,5 +1,9 @@ #include "legoflctexturepresenter.h" +#include "misc.h" +#include "misc/legocontainer.h" +#include "mxdsaction.h" + DECOMP_SIZE_ASSERT(LegoFlcTexturePresenter, 0x70) // FUNCTION: LEGO1 0x1005de80 @@ -11,24 +15,56 @@ LegoFlcTexturePresenter::LegoFlcTexturePresenter() // FUNCTION: LEGO1 0x1005df70 void LegoFlcTexturePresenter::Init() { - this->m_unk0x68 = 0; - this->m_unk0x6c = 0; + m_rectCount = 0; + m_texture = NULL; } -// STUB: LEGO1 0x1005df80 +// FUNCTION: LEGO1 0x1005df80 +// FUNCTION: BETA10 0x100833a7 void LegoFlcTexturePresenter::StartingTickle() { - // TODO + MxU16 extraLength; + char* pp; + char extraCopy[128]; + m_action->GetExtra(extraLength, pp); + + if (pp != NULL) { + strcpy(extraCopy, pp); + strcat(extraCopy, ".gif"); + m_texture = TextureContainer()->Get(extraCopy); + } + + MxFlcPresenter::StartingTickle(); } -// STUB: LEGO1 0x1005e0c0 +// FUNCTION: LEGO1 0x1005e0c0 +// FUNCTION: BETA10 0x100834ce void LegoFlcTexturePresenter::LoadFrame(MxStreamChunk* p_chunk) { - // TODO + MxU8* data = p_chunk->GetData(); + + m_rectCount = *(MxS32*) data; + data += sizeof(MxS32); + + MxRect32* rects = (MxRect32*) data; + data += m_rectCount * sizeof(MxRect32); + + MxBool decodedColorMap; + DecodeFLCFrame( + &m_frameBitmap->GetBitmapInfo()->m_bmiHeader, + m_frameBitmap->GetImage(), + m_flcHeader, + (FLIC_FRAME*) data, + &decodedColorMap + ); } -// STUB: LEGO1 0x1005e100 +// FUNCTION: LEGO1 0x1005e100 +// FUNCTION: BETA10 0x10083562 void LegoFlcTexturePresenter::PutFrame() { - // TODO + if (m_texture != NULL && m_rectCount != 0) { + m_texture->FUN_10066010(m_frameBitmap->GetImage()); + m_rectCount = 0; + } }