From 0b94b4803b96a9542bd4ffb706e609344dbc9726 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 10 Nov 2024 08:43:07 -0700 Subject: [PATCH] Implement/match Act2GenActor::VTable0x94 (#1138) --- LEGO1/lego/legoomni/include/act2genactor.h | 5 +++- .../lego/legoomni/src/actors/act2genactor.cpp | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act2genactor.h b/LEGO1/lego/legoomni/include/act2genactor.h index 93cc05da..1831870e 100644 --- a/LEGO1/lego/legoomni/include/act2genactor.h +++ b/LEGO1/lego/legoomni/include/act2genactor.h @@ -6,10 +6,13 @@ // VTABLE: LEGO1 0x100d4ed8 // SIZE 0x154 class Act2GenActor : public LegoPathActor { - MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 + MxResult VTable0x94(LegoPathActor* p_actor, MxBool) override; // vtable+0x94 // SYNTHETIC: LEGO1 0x1000f5a0 // Act2GenActor::`scalar deleting destructor' + +private: + static MxLong g_lastHitActorTime; }; #endif // ACT2GENACTOR_H diff --git a/LEGO1/lego/legoomni/src/actors/act2genactor.cpp b/LEGO1/lego/legoomni/src/actors/act2genactor.cpp index d7ade7b1..fa66335e 100644 --- a/LEGO1/lego/legoomni/src/actors/act2genactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2genactor.cpp @@ -1,10 +1,32 @@ #include "act2genactor.h" +#include "legocachesoundmanager.h" +#include "legosoundmanager.h" +#include "misc.h" +#include "mxmisc.h" +#include "mxtimer.h" +#include "roi/legoroi.h" + DECOMP_SIZE_ASSERT(Act2GenActor, 0x154) -// STUB: LEGO1 0x10018740 -MxResult Act2GenActor::VTable0x94(LegoPathActor*, MxBool) +// GLOBAL: LEGO1 0x100f0f18 +MxLong Act2GenActor::g_lastHitActorTime = 0; + +// FUNCTION: LEGO1 0x10018740 +// FUNCTION: BETA10 0x1000c7a0 +MxResult Act2GenActor::VTable0x94(LegoPathActor* p_actor, MxBool) { - // TODO + MxLong time = Timer()->GetTime(); + MxLong diff = time - g_lastHitActorTime; + + if (strcmp(p_actor->GetROI()->GetName(), "pepper")) { + return SUCCESS; + } + + g_lastHitActorTime = time; + if (diff > 1000) { + SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE); + } + return SUCCESS; }