From 661c76c6e0deb80adc00f7eaf0ccfc4e367d80c9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 15 Dec 2024 09:18:25 -0700 Subject: [PATCH] Implement/match `Act3Shark::Animate` (#1231) * Implement/match `Act3Shark::Animate` * Add BETA annotation * Raise max functions * Mark as FUNCTION --- .github/workflows/build.yml | 2 +- LEGO1/lego/legoomni/include/act3actors.h | 5 +- LEGO1/lego/legoomni/src/actors/act3actors.cpp | 56 +++++++++++++++++-- .../legoomni/src/common/legotextureinfo.cpp | 2 +- 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d53dac46..217ad762 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -139,7 +139,7 @@ jobs: run: | reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT - reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4340 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT + reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4345 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT - name: Compare Accuracy With Current Master shell: bash diff --git a/LEGO1/lego/legoomni/include/act3actors.h b/LEGO1/lego/legoomni/include/act3actors.h index 660ebba6..6381b76f 100644 --- a/LEGO1/lego/legoomni/include/act3actors.h +++ b/LEGO1/lego/legoomni/include/act3actors.h @@ -156,7 +156,7 @@ class Act3Shark : public LegoAnimActor { private: list m_unk0x1c; // 0x1c - undefined4 m_unk0x28; // 0x28 + Act3Ammo* m_unk0x28; // 0x28 MxFloat m_unk0x2c; // 0x2c LegoWorld* m_world; // 0x30 LegoAnimActorStruct* m_unk0x34; // 0x34 @@ -173,6 +173,9 @@ class Act3Shark : public LegoAnimActor { // TEMPLATE: LEGO1 0x10042c90 // List::~List +// TEMPLATE: LEGO1 0x10042ee0 +// list >::erase + // GLOBAL: LEGO1 0x100d7660 // Act3Actor::`vbtable' diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index 7526846d..382ef941 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -2,6 +2,7 @@ #include "act3.h" #include "act3ammo.h" +#include "anim/legoanim.h" #include "define.h" #include "legocachesoundmanager.h" #include "legolocomotionanimpresenter.h" @@ -299,6 +300,7 @@ void Act3Brickster::ParseAction(char* p_extra) } // STUB: LEGO1 0x10041050 +// STUB: BETA10 0x100197d7 void Act3Brickster::Animate(float p_time) { // TODO @@ -386,7 +388,7 @@ MxResult Act3Brickster::VTable0x9c() Act3Shark::Act3Shark() { m_unk0x2c = 0.0f; - m_unk0x28 = 0; + m_unk0x28 = NULL; } // FUNCTION: LEGO1 0x10042ce0 @@ -397,10 +399,56 @@ MxResult Act3Shark::FUN_10042ce0(Act3Ammo* p_ammo) return SUCCESS; } -// STUB: LEGO1 0x10042d40 +// FUNCTION: LEGO1 0x10042d40 void Act3Shark::Animate(float p_time) { - // TODO + LegoROI** roiMap = m_unk0x34->GetROIMap(); + + if (m_unk0x28 == NULL) { + if (m_unk0x1c.size() > 0) { + m_unk0x28 = m_unk0x1c.front(); + m_unk0x1c.pop_front(); + m_unk0x2c = p_time; + roiMap[1] = m_unk0x28->GetROI(); + m_unk0x3c = roiMap[1]->GetLocal2World()[3]; + roiMap[1]->SetVisibility(TRUE); + roiMap[2]->SetVisibility(TRUE); + } + + if (m_unk0x28 == NULL) { + return; + } + } + + float time = m_unk0x2c + m_unk0x34->GetDuration(); + + if (time > p_time) { + float duration = p_time - m_unk0x2c; + + if (duration < 0) { + duration = 0; + } + + if (m_unk0x34->GetDuration() < duration) { + duration = m_unk0x34->GetDuration(); + } + + MxMatrix mat; + mat.SetIdentity(); + + Vector3 vec(mat[3]); + vec = m_unk0x3c; + + LegoTreeNode* node = m_unk0x34->GetAnimTreePtr()->GetRoot(); + LegoROI::FUN_100a8e80(node, mat, duration, m_unk0x34->GetROIMap()); + } + else { + roiMap[1] = m_unk0x38; + ((Act3*) m_world)->RemovePizza(*m_unk0x28); + m_unk0x28 = NULL; + roiMap[1]->SetVisibility(FALSE); + roiMap[2]->SetVisibility(FALSE); + } } // FUNCTION: LEGO1 0x10042f30 @@ -408,7 +456,7 @@ void Act3Shark::ParseAction(char* p_extra) { LegoPathActor::ParseAction(p_extra); - m_world = (LegoWorld*) CurrentWorld(); + m_world = CurrentWorld(); char value[256]; if (KeyValueStringParse(value, g_strANIMATION, p_extra)) { diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index 51775a03..ea00ad5f 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -153,7 +153,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text return NULL; } -// STUB: LEGO1 0x10065f60 +// FUNCTION: LEGO1 0x10065f60 BOOL LegoTextureInfo::SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo) { TglImpl::MeshImpl::MeshData* data = ((TglImpl::MeshImpl*) pMesh)->ImplementationData();