Implement/match Act2GenActor::VTable0x94 (#1138)

This commit is contained in:
Christian Semmler 2024-11-10 08:43:07 -07:00 committed by GitHub
parent 2c10c8e344
commit 0b94b4803b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 4 deletions

View file

@ -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

View file

@ -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;
}