Implement/match Act2Brick

This commit is contained in:
Christian Semmler 2024-11-25 13:55:36 -07:00
parent 816bfe842d
commit 461b623df1
4 changed files with 120 additions and 18 deletions

View File

@ -26,18 +26,22 @@ class Act2Brick : public LegoPathActor {
return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name); return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name);
} }
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor* p_actor, MxBool) override; // vtable+0x94
// SYNTHETIC: LEGO1 0x1007a450 // SYNTHETIC: LEGO1 0x1007a450
// Act2Brick::`scalar deleting destructor' // Act2Brick::`scalar deleting destructor'
void FUN_1007a9d0();
private: private:
undefined4 m_unk0x154; // 0x154 static MxLong g_lastHitActorTime;
LegoCacheSound* m_unk0x154; // 0x154
undefined m_unk0x158[0x0c]; // 0x158 undefined m_unk0x158[0x0c]; // 0x158
undefined4 m_unk0x164; // 0x164 undefined4 m_unk0x164; // 0x164
Mx3DPointFloat m_unk0x168; // 0x168 Mx3DPointFloat m_unk0x168; // 0x168
Mx3DPointFloat m_unk0x17c; // 0x17c Mx3DPointFloat m_unk0x17c; // 0x17c
undefined4 m_unk0x190; // 0x190 MxS32 m_unk0x190; // 0x190
}; };
#endif // ACT2BRICK_H #endif // ACT2BRICK_H

View File

@ -58,6 +58,7 @@ class LegoCacheSoundManager {
LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound);
LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping); LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping);
LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping); LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping);
void FUN_1003db80(LegoCacheSound*& p_sound);
void Destroy(LegoCacheSound*& p_sound); void Destroy(LegoCacheSound*& p_sound);
private: private:

View File

@ -132,6 +132,40 @@ LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char*
return NULL; return NULL;
} }
// FUNCTION: LEGO1 0x1003db80
// FUNCTION: BETA10 0x100656a7
void LegoCacheSoundManager::FUN_1003db80(LegoCacheSound*& p_sound)
{
#ifdef COMPAT_MODE
Set100d6b4c::iterator setIter;
for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#else
for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#endif
if ((*setIter).GetSound() == p_sound) {
p_sound->FUN_10006b80();
return;
}
}
#ifdef COMPAT_MODE
List100d6b4c::iterator listIter;
for (listIter = m_list.begin();; listIter++) {
#else
for (List100d6b4c::iterator listIter = m_list.begin();; listIter++) {
#endif
if (listIter == m_list.end()) {
return;
}
LegoCacheSound* sound = (*listIter).GetSound();
if (sound == p_sound) {
p_sound->FUN_10006b80();
return;
}
}
}
// FUNCTION: LEGO1 0x1003dc40 // FUNCTION: LEGO1 0x1003dc40
void LegoCacheSoundManager::Destroy(LegoCacheSound*& p_sound) void LegoCacheSoundManager::Destroy(LegoCacheSound*& p_sound)
{ {

View File

@ -1,38 +1,101 @@
#include "act2brick.h" #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) DECOMP_SIZE_ASSERT(Act2Brick, 0x194)
// STUB: LEGO1 0x1007a2b0 // GLOBAL: LEGO1 0x100f7a60
MxLong Act2Brick::g_lastHitActorTime = 0;
// FUNCTION: LEGO1 0x1007a2b0
// FUNCTION: BETA10 0x10012a30
Act2Brick::Act2Brick() Act2Brick::Act2Brick()
{ {
// TODO m_unk0x154 = NULL;
m_unk0x164 = 0;
} }
// STUB: LEGO1 0x1007a470 // FUNCTION: LEGO1 0x1007a470
Act2Brick::~Act2Brick() Act2Brick::~Act2Brick()
{ {
// TODO TickleManager()->UnregisterClient(this);
} }
// STUB: LEGO1 0x1007a750 // FUNCTION: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool)
{ {
// TODO MxLong time = Timer()->GetTime();
return 0; MxLong diff = time - g_lastHitActorTime;
}
// STUB: LEGO1 0x1007a7f0 if (strcmp(p_actor->GetROI()->GetName(), "pepper")) {
MxResult Act2Brick::Tickle() return SUCCESS;
{ }
// TODO
g_lastHitActorTime = time;
if (diff > 1000) {
SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE);
}
return SUCCESS; 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) MxLong Act2Brick::Notify(MxParam& p_param)
{ {
// TODO if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick && m_roi->GetVisibility()) {
m_roi->SetVisibility(FALSE);
if (m_unk0x154 != NULL) {
FUN_1007a9d0();
}
MxNotificationParam param(c_notificationType22, this);
NotificationManager()->Send(CurrentWorld(), param);
return 1;
}
return 0; return 0;
} }
// FUNCTION: LEGO1 0x1007a9d0
// FUNCTION: BETA10 0x1001300f
void Act2Brick::FUN_1007a9d0()
{
if (m_unk0x154 != NULL) {
SoundManager()->GetCacheSoundManager()->FUN_1003db80(m_unk0x154);
m_unk0x154 = NULL;
}
}