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

View file

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

View file

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

View file

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

View file

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

View file

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