Implement/match LegoAnimMMPresenter::FUN_1004b530 (#828)

This commit is contained in:
Christian Semmler 2024-04-20 11:40:23 -04:00 committed by GitHub
parent 91d043a9ae
commit f637dcaa29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 75 additions and 60 deletions

View file

@ -5,6 +5,7 @@
class LegoAnimPresenter;
class LegoWorld;
class LegoROI;
struct LegoTranInfo;
// VTABLE: LEGO1 0x100d7de8
@ -65,7 +66,7 @@ class LegoAnimMMPresenter : public MxCompositePresenter {
MxBool FUN_1004b6b0(MxLong p_time);
MxBool FUN_1004b6d0(MxLong p_time);
LegoAnimPresenter* m_unk0x4c; // 0x4c
LegoAnimPresenter* m_presenter; // 0x4c
MxLong m_unk0x50; // 0x50
undefined4 m_unk0x54; // 0x54
MxU8 m_unk0x58; // 0x58
@ -73,9 +74,9 @@ class LegoAnimMMPresenter : public MxCompositePresenter {
MxU32 m_animmanId; // 0x5c
LegoTranInfo* m_tranInfo; // 0x60
LegoWorld* m_unk0x64; // 0x64
undefined4 m_unk0x68; // 0x68
undefined4 m_unk0x6c; // 0x6c
undefined4 m_unk0x70; // 0x70
Matrix4* m_unk0x68; // 0x68
LegoROI** m_roiMap; // 0x6c
MxU32 m_roiMapSize; // 0x70
};
#endif // LEGOANIMMMPRESENTER_H

View file

@ -63,14 +63,15 @@ class LegoAnimPresenter : public MxVideoPresenter {
virtual void VTable0x98(); // vtable+0x98
// FUNCTION: LEGO1 0x1000c990
virtual LegoROI** VTable0x9c(MxU32& p_unk0x6c)
virtual LegoROI** GetROIMap(MxU32& p_roiMapSize)
{
p_unk0x6c = m_unk0x6c;
return m_unk0x68;
p_roiMapSize = m_roiMapSize;
return m_roiMap;
} // vtable+0x9c
virtual void VTable0xa0(Matrix4*); // vtable+0xa0
MxResult FUN_1006afc0(Matrix4*&, undefined4);
MxResult FUN_1006b140(LegoROI* p_roi);
void FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value);
@ -97,8 +98,8 @@ class LegoAnimPresenter : public MxVideoPresenter {
void FUN_1006c8a0(MxBool p_bool);
LegoAnim* m_anim; // 0x64
LegoROI** m_unk0x68; // 0x68
MxU32 m_unk0x6c; // 0x6c
LegoROI** m_roiMap; // 0x68
MxU32 m_roiMapSize; // 0x6c
LegoROIList* m_unk0x70; // 0x70
LegoROIList* m_unk0x74; // 0x74
MxMatrix* m_unk0x78; // 0x78

View file

@ -21,15 +21,15 @@ DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74)
// FUNCTION: LEGO1 0x1004a8d0
LegoAnimMMPresenter::LegoAnimMMPresenter()
{
m_unk0x4c = NULL;
m_presenter = NULL;
m_animmanId = 0;
m_unk0x59 = FALSE;
m_tranInfo = NULL;
m_unk0x54 = 0;
m_unk0x64 = NULL;
m_unk0x68 = 0;
m_unk0x6c = 0;
m_unk0x70 = 0;
m_roiMap = NULL;
m_roiMapSize = 0;
m_unk0x58 = e_unk0;
}
@ -70,7 +70,7 @@ MxResult LegoAnimMMPresenter::StartAction(MxStreamController* p_controller, MxDS
presenter->SetTickleState(MxPresenter::e_idle);
if (presenter->IsA("LegoAnimPresenter") || presenter->IsA("LegoLoopingAnimPresenter")) {
m_unk0x4c = (LegoAnimPresenter*) presenter;
m_presenter = (LegoAnimPresenter*) presenter;
}
success = TRUE;
}
@ -136,11 +136,11 @@ void LegoAnimMMPresenter::ReadyTickle()
}
if (m_tranInfo != NULL && m_tranInfo->m_unk0x0c != NULL) {
m_unk0x4c->VTable0xa0(m_tranInfo->m_unk0x0c);
m_presenter->VTable0xa0(m_tranInfo->m_unk0x0c);
}
if (m_unk0x4c != NULL) {
m_unk0x4c->SetTickleState(e_ready);
if (m_presenter != NULL) {
m_presenter->SetTickleState(e_ready);
}
ProgressTickleState(e_starting);
@ -150,9 +150,9 @@ void LegoAnimMMPresenter::ReadyTickle()
// FUNCTION: BETA10 0x1004c2cc
void LegoAnimMMPresenter::StartingTickle()
{
if (m_unk0x4c == NULL || m_unk0x4c->GetCurrentTickleState() == e_idle) {
if (m_presenter == NULL || m_presenter->GetCurrentTickleState() == e_idle) {
if (m_tranInfo != NULL && m_tranInfo->m_unk0x08 != NULL) {
m_unk0x4c->FUN_1006b140(m_tranInfo->m_unk0x08);
m_presenter->FUN_1006b140(m_tranInfo->m_unk0x08);
}
m_unk0x50 = Timer()->GetTime();
@ -173,12 +173,12 @@ void LegoAnimMMPresenter::StreamingTickle()
// FUNCTION: BETA10 0x1004c3a4
void LegoAnimMMPresenter::RepeatingTickle()
{
if (m_unk0x4c == NULL) {
if (m_presenter == NULL) {
ProgressTickleState(e_freezing);
}
else if (m_list.size() <= 1) {
if (m_list.front() == m_unk0x4c) {
m_unk0x4c->SetTickleState(e_done);
if (m_list.front() == m_presenter) {
m_presenter->SetTickleState(e_done);
ProgressTickleState(e_freezing);
}
else {
@ -201,8 +201,8 @@ MxLong LegoAnimMMPresenter::Notify(MxParam& p_param)
AUTOLOCK(m_criticalSection);
if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction &&
((MxNotificationParam&) p_param).GetSender() == m_unk0x4c) {
m_unk0x4c = NULL;
((MxNotificationParam&) p_param).GetSender() == m_presenter) {
m_presenter = NULL;
}
return MxCompositePresenter::Notify(p_param);
@ -211,7 +211,7 @@ MxLong LegoAnimMMPresenter::Notify(MxParam& p_param)
// FUNCTION: LEGO1 0x1004b360
void LegoAnimMMPresenter::VTable0x60(MxPresenter* p_presenter)
{
if (m_unk0x4c == p_presenter && ((MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_streaming ||
if (m_presenter == p_presenter && ((MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_streaming ||
(MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_done)) {
p_presenter->SetTickleState(MxPresenter::e_idle);
}
@ -295,12 +295,17 @@ MxBool LegoAnimMMPresenter::FUN_1004b450()
return result;
}
// STUB: LEGO1 0x1004b530
// FUNCTION: LEGO1 0x1004b530
// FUNCTION: BETA10 0x1004c8c4
MxBool LegoAnimMMPresenter::FUN_1004b530(MxLong p_time)
{
// TODO
return FALSE;
if (m_presenter != NULL) {
m_presenter->FUN_1006afc0(m_unk0x68, 0);
m_roiMap = m_presenter->GetROIMap(m_roiMapSize);
m_roiMapSize++;
}
return TRUE;
}
// STUB: LEGO1 0x1004b570

View file

@ -285,8 +285,8 @@ MxResult LegoExtraActor::WaitForAnimation()
LegoAnimPresenterSet* set = m_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
undefined4 tmp;
if ((*it)->VTable0x9c(tmp)) {
MxU32 roiMapSize;
if ((*it)->GetROIMap(roiMapSize)) {
b = TRUE;
break;
}
@ -310,8 +310,8 @@ void LegoExtraActor::Restart()
LegoAnimPresenterSet* set = m_boundary->GetPresenters();
for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) {
undefined4 tmp;
if ((*it)->VTable0x9c(tmp)) {
MxU32 roiMapSize;
if ((*it)->GetROIMap(roiMapSize)) {
b = TRUE;
break;
}

View file

@ -31,8 +31,8 @@ LegoAnimPresenter::~LegoAnimPresenter()
void LegoAnimPresenter::Init()
{
m_anim = NULL;
m_unk0x68 = NULL;
m_unk0x6c = 0;
m_roiMap = NULL;
m_roiMapSize = 0;
m_unk0x74 = NULL;
m_unk0x70 = NULL;
m_unk0x78 = NULL;
@ -337,24 +337,24 @@ void LegoAnimPresenter::FUN_10069b10()
FUN_1006a3c0(map, m_anim->GetRoot(), NULL);
if (m_unk0x68 != NULL) {
delete[] m_unk0x68;
m_unk0x6c = 0;
if (m_roiMap != NULL) {
delete[] m_roiMap;
m_roiMapSize = 0;
}
m_unk0x6c = 0;
m_unk0x68 = new LegoROI*[map.size() + 1];
memset(m_unk0x68, 0, (map.size() + 1) * sizeof(*m_unk0x68));
m_roiMapSize = 0;
m_roiMap = new LegoROI*[map.size() + 1];
memset(m_roiMap, 0, (map.size() + 1) * sizeof(*m_roiMap));
for (LegoAnimPresenterMap::iterator it = map.begin(); it != map.end();) {
MxU32 index = (*it).second.m_index;
m_unk0x68[index] = (*it).second.m_roi;
m_roiMap[index] = (*it).second.m_roi;
if (m_unk0x68[index]->GetName() != NULL) {
if (m_roiMap[index]->GetName() != NULL) {
for (MxS32 i = 0; i < m_unk0x94; i++) {
if (m_unk0x8c[i] == NULL && m_unk0x90[i] != NULL) {
if (!strcmpi(m_unk0x90[i], m_unk0x68[index]->GetName())) {
m_unk0x8c[i] = m_unk0x68[index];
if (!strcmpi(m_unk0x90[i], m_roiMap[index]->GetName())) {
m_unk0x8c[i] = m_roiMap[index];
break;
}
}
@ -363,7 +363,7 @@ void LegoAnimPresenter::FUN_10069b10()
delete[] const_cast<char*>((*it).first);
it++;
m_unk0x6c++;
m_roiMapSize++;
}
}
@ -563,6 +563,14 @@ void LegoAnimPresenter::PutFrame()
}
}
// STUB: LEGO1 0x1006afc0
// FUNCTION: BETA10 0x1005059a
MxResult LegoAnimPresenter::FUN_1006afc0(Matrix4*&, undefined4)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x1006b140
// FUNCTION: BETA10 0x100507e0
MxResult LegoAnimPresenter::FUN_1006b140(LegoROI* p_roi)
@ -616,8 +624,8 @@ void LegoAnimPresenter::StartingTickle()
m_unk0x78 = new MxMatrix();
CalcLocalTransform(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), *m_unk0x78);
}
else if (m_unk0x68 != NULL) {
LegoROI* roi = m_unk0x68[1];
else if (m_roiMap != NULL) {
LegoROI* roi = m_roiMap[1];
if (roi != NULL) {
MxMatrix mat;
@ -709,7 +717,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
mat = *p_matrix;
}
else {
LegoROI* roi = m_unk0x68[data->GetUnknown0x20()];
LegoROI* roi = m_roiMap[data->GetUnknown0x20()];
if (roi != NULL) {
mat = roi->GetLocal2World();
@ -728,7 +736,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
}
}
LegoROI::FUN_100a8e80(root, mat, p_time, m_unk0x68);
LegoROI::FUN_100a8e80(root, mat, p_time, m_roiMap);
}
// STUB: LEGO1 0x1006bac0
@ -796,9 +804,9 @@ void LegoAnimPresenter::VTable0x90()
// FUNCTION: LEGO1 0x1006c8a0
void LegoAnimPresenter::FUN_1006c8a0(MxBool p_bool)
{
if (m_unk0x6c != 0 && m_unk0x68 != NULL) {
for (MxU32 i = 1; i <= m_unk0x6c; i++) {
LegoEntity* entity = m_unk0x68[i]->GetEntity();
if (m_roiMapSize != 0 && m_roiMap != NULL) {
for (MxU32 i = 1; i <= m_roiMapSize; i++) {
LegoEntity* entity = m_roiMap[i]->GetEntity();
if (entity != NULL) {
if (p_bool) {

View file

@ -42,7 +42,7 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor)
delete m_unk0xc8;
}
m_unk0x68 = NULL;
m_roiMap = NULL;
Init();
m_criticalSection.Leave();