Implement/match Act2Brick (#1169)

* Implement/match Act2Brick

* Rename functions

* Naming
This commit is contained in:
Christian Semmler
2024-11-25 14:08:57 -07:00
committed by GitHub
parent 816bfe842d
commit b9a1da6a7a
7 changed files with 132 additions and 30 deletions

View File

@@ -1,38 +1,101 @@
#include "act2brick.h"
#include "legocachesoundmanager.h"
#include "legosoundmanager.h"
#include "legoworld.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxnotificationparam.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "roi/legoroi.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(Act2Brick, 0x194)
// STUB: LEGO1 0x1007a2b0
// GLOBAL: LEGO1 0x100f7a60
MxLong Act2Brick::g_lastHitActorTime = 0;
// FUNCTION: LEGO1 0x1007a2b0
// FUNCTION: BETA10 0x10012a30
Act2Brick::Act2Brick()
{
// TODO
m_whistleSound = NULL;
m_unk0x164 = 0;
}
// STUB: LEGO1 0x1007a470
// FUNCTION: LEGO1 0x1007a470
Act2Brick::~Act2Brick()
{
// TODO
TickleManager()->UnregisterClient(this);
}
// STUB: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
// FUNCTION: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool)
{
// TODO
return 0;
}
MxLong time = Timer()->GetTime();
MxLong diff = time - g_lastHitActorTime;
// STUB: LEGO1 0x1007a7f0
MxResult Act2Brick::Tickle()
{
// TODO
if (strcmp(p_actor->GetROI()->GetName(), "pepper")) {
return SUCCESS;
}
g_lastHitActorTime = time;
if (diff > 1000) {
SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE);
}
return SUCCESS;
}
// STUB: LEGO1 0x1007a8c0
// FUNCTION: LEGO1 0x1007a7f0
// FUNCTION: BETA10 0x10012d46
MxResult Act2Brick::Tickle()
{
MxMatrix local2world(m_roi->GetLocal2World());
m_unk0x190++;
if (m_unk0x190 >= 8) {
local2world.SetTranslation(m_unk0x17c[0], m_unk0x17c[1], m_unk0x17c[2]);
m_unk0x164 = 3;
TickleManager()->UnregisterClient(this);
}
else {
VPV3(local2world[3], local2world[3], m_unk0x168);
}
m_roi->FUN_100a58f0(local2world);
m_roi->VTable0x14();
return SUCCESS;
}
// FUNCTION: LEGO1 0x1007a8c0
// FUNCTION: BETA10 0x10012ec4
MxLong Act2Brick::Notify(MxParam& p_param)
{
// TODO
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick && m_roi->GetVisibility()) {
m_roi->SetVisibility(FALSE);
if (m_whistleSound != NULL) {
StopSound();
}
MxNotificationParam param(c_notificationType22, this);
NotificationManager()->Send(CurrentWorld(), param);
return 1;
}
return 0;
}
// FUNCTION: LEGO1 0x1007a9d0
// FUNCTION: BETA10 0x1001300f
void Act2Brick::StopSound()
{
if (m_whistleSound != NULL) {
SoundManager()->GetCacheSoundManager()->Stop(m_whistleSound);
m_whistleSound = NULL;
}
}

View File

@@ -26,7 +26,7 @@ LegoActor::LegoActor()
LegoActor::~LegoActor()
{
if (m_sound) {
m_sound->FUN_10006b80();
m_sound->Stop();
}
}