Implement/match LegoAnimationManager::FUN_100605e0 (#872)

* Implement/match LegoAnimationManager::FUN_100605e0

* Remove padding

* Fix annotation
This commit is contained in:
Christian Semmler 2024-04-30 10:02:58 -04:00 committed by GitHub
parent b902790c54
commit 20dee07b9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 160 additions and 45 deletions

View file

@ -18,15 +18,16 @@ struct AnimInfo {
char* m_animName; // 0x00 char* m_animName; // 0x00
MxU32 m_objectId; // 0x04 MxU32 m_objectId; // 0x04
MxS16 m_unk0x08; // 0x08 MxS16 m_unk0x08; // 0x08
MxU8 m_unk0x0a; // 0x0a MxBool m_unk0x0a; // 0x0a
MxU8 m_unk0x0b; // 0x0b MxU8 m_unk0x0b; // 0x0b
MxU8 m_unk0x0c; // 0x0c MxU8 m_unk0x0c; // 0x0c
MxU8 m_unk0x0d; // 0x0d MxU8 m_unk0x0d; // 0x0d
MxU32 m_unk0x10[4]; // 0x10 MxU32 m_unk0x10[4]; // 0x10
MxU8 m_modelCount; // 0x20 MxU8 m_modelCount; // 0x20
MxS16 m_unk0x22; // 0x22
ModelInfo* m_models; // 0x24 ModelInfo* m_models; // 0x24
MxU8 m_unk0x28; // 0x28 MxU8 m_unk0x28; // 0x28
MxU8 m_unk0x29; // 0x29 MxBool m_unk0x29; // 0x29
MxS8 m_unk0x2a[3]; // 0x2a MxS8 m_unk0x2a[3]; // 0x2a
}; };

View file

@ -80,13 +80,13 @@ class LegoAnimationManager : public MxCore {
MxResult FUN_10060dc0( MxResult FUN_10060dc0(
IsleScript::Script p_objectId, IsleScript::Script p_objectId,
MxMatrix* p_matrix, MxMatrix* p_matrix,
undefined p_param3, MxBool p_param3,
undefined p_param4, undefined p_param4,
undefined4 p_param5, LegoROI* p_roi,
undefined p_param6, MxBool p_param6,
MxBool p_param7, MxBool p_param7,
MxBool p_param8, MxBool p_param8,
undefined p_param9 MxBool p_param9
); );
void FUN_10061010(undefined4); void FUN_10061010(undefined4);
void FUN_100617c0(MxS32, MxU16&, MxU16&); void FUN_100617c0(MxS32, MxU16&, MxU16&);
@ -108,21 +108,25 @@ class LegoAnimationManager : public MxCore {
void Init(); void Init();
MxResult FUN_100605e0( MxResult FUN_100605e0(
MxU32 p_index, MxU32 p_index,
MxU8 p_unk0x0a, MxBool p_unk0x0a,
MxMatrix* p_matrix, MxMatrix* p_matrix,
undefined, MxBool p_bool1,
undefined4, LegoROI* p_roi,
undefined, MxBool p_bool2,
MxBool, MxBool p_bool3,
MxBool, MxBool p_bool4,
undefined MxBool p_bool5
); );
MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2); MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2);
void DeleteAnimations(); void DeleteAnimations();
MxS8 GetCharacterIndex(const char* p_name); MxS8 GetCharacterIndex(const char* p_name);
MxBool FUN_100623a0(AnimInfo& p_info);
void FUN_10062580(AnimInfo& p_info);
MxBool FUN_10062710(AnimInfo& p_info);
void FUN_10063aa0(); void FUN_10063aa0();
void FUN_100648f0(LegoTranInfo*, MxLong);
MxU32 m_scriptIndex; // 0x08 MxS32 m_scriptIndex; // 0x08
MxU16 m_animCount; // 0x0c MxU16 m_animCount; // 0x0c
MxU16 m_unk0x0e; // 0x0e MxU16 m_unk0x0e; // 0x0e
MxU16 m_unk0x10; // 0x10 MxU16 m_unk0x10; // 0x10

View file

@ -4,6 +4,7 @@
#include "decomp.h" #include "decomp.h"
#include "mxgeometry/mxmatrix.h" #include "mxgeometry/mxmatrix.h"
struct AnimInfo;
class LegoAnimMMPresenter; class LegoAnimMMPresenter;
// SIZE 0x78 // SIZE 0x78
@ -30,7 +31,7 @@ struct LegoTranInfo {
m_unk0x2c.SetIdentity(); m_unk0x2c.SetIdentity();
} }
undefined4 m_unk0x00; // 0x00 AnimInfo* m_animInfo; // 0x00
MxU32 m_index; // 0x04 MxU32 m_index; // 0x04
LegoROI* m_unk0x08; // 0x08 LegoROI* m_unk0x08; // 0x08
MxMatrix* m_unk0x0c; // 0x0c MxMatrix* m_unk0x0c; // 0x0c

View file

@ -64,10 +64,4 @@ void PlayMusic(JukeboxScript::Script p_script);
void SetIsWorldActive(MxBool p_isWorldActive); void SetIsWorldActive(MxBool p_isWorldActive);
void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last);
// FUNCTION: LEGO1 0x10015890
inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction)
{
return LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction);
}
#endif // MISC_H #endif // MISC_H

View file

@ -451,7 +451,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex)
} }
m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2); m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2);
m_anims[j].m_unk0x29 = 0; m_anims[j].m_unk0x29 = FALSE;
for (k = 0; k < 3; k++) { for (k = 0; k < 3; k++) {
m_anims[j].m_unk0x2a[k] = -1; m_anims[j].m_unk0x2a[k] = -1;
@ -656,22 +656,100 @@ void LegoAnimationManager::FUN_10060570(MxBool)
// TODO // TODO
} }
// STUB: LEGO1 0x100605e0 // FUNCTION: LEGO1 0x100605e0
// FUNCTION: BETA10 0x1004152b // FUNCTION: BETA10 0x1004152b
MxResult LegoAnimationManager::FUN_100605e0( MxResult LegoAnimationManager::FUN_100605e0(
MxU32 p_index, MxU32 p_index,
MxU8 p_unk0x0a, MxBool p_unk0x0a,
MxMatrix* p_matrix, MxMatrix* p_matrix,
undefined, MxBool p_bool1,
undefined4, LegoROI* p_roi,
undefined, MxBool p_bool2,
MxBool, MxBool p_bool3,
MxBool, MxBool p_bool4,
undefined MxBool p_bool5
) )
{ {
// TODO MxResult result = FAILURE;
if (m_scriptIndex != -1 && p_index < m_animCount && m_tranInfoList != NULL) {
FUN_100627d0(FALSE);
FUN_10062770();
MxDSAction action;
AnimInfo& animInfo = m_anims[p_index];
if (!p_bool1) {
if (m_unk0x39 || !animInfo.m_unk0x29) {
return FAILURE; return FAILURE;
}
if (FUN_100623a0(animInfo)) {
return FAILURE;
}
if (FUN_10062710(animInfo)) {
return FAILURE;
}
}
FUN_10062580(animInfo);
LegoTranInfo* tranInfo = new LegoTranInfo();
tranInfo->m_animInfo = &animInfo;
tranInfo->m_index = ++m_unk0x1c;
tranInfo->m_unk0x10 = 0;
tranInfo->m_unk0x08 = p_roi;
tranInfo->m_unk0x12 = m_anims[p_index].m_unk0x08;
tranInfo->m_unk0x14 = p_unk0x0a;
tranInfo->m_objectId = animInfo.m_objectId;
tranInfo->m_unk0x15 = p_bool2;
if (p_matrix != NULL) {
tranInfo->m_unk0x0c = new MxMatrix(*p_matrix);
}
tranInfo->m_unk0x1c = m_unk0x28;
tranInfo->m_unk0x20 = m_unk0x30;
tranInfo->m_unk0x28 = p_bool3;
tranInfo->m_unk0x29 = p_bool4;
if (m_tranInfoList != NULL) {
m_tranInfoList->Append(tranInfo);
}
char buf[256];
sprintf(buf, "%s:%d", g_strANIMMAN_ID, tranInfo->m_index);
action.SetAtomId(*Lego()->GetScriptAtom(m_scriptIndex));
action.SetObjectId(animInfo.m_objectId);
action.SetUnknown24(-1);
action.AppendExtra(strlen(buf) + 1, buf);
if (StartActionIfUnknown0x13c(action) == SUCCESS) {
BackgroundAudioManager()->LowerVolume();
tranInfo->m_flags |= LegoTranInfo::c_bit2;
animInfo.m_unk0x22++;
m_unk0x404 = Timer()->GetTime();
if (p_bool5) {
FUN_100648f0(tranInfo, m_unk0x404);
}
else if (p_unk0x0a) {
IslePathActor* actor = CurrentActor();
if (actor != NULL) {
actor->SetState(4);
actor->SetWorldSpeed(0.0f);
}
}
m_unk0x39 = TRUE;
result = SUCCESS;
}
}
return result;
} }
// FUNCTION: LEGO1 0x100609f0 // FUNCTION: LEGO1 0x100609f0
@ -684,12 +762,12 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix
FUN_100627d0(FALSE); FUN_100627d0(FALSE);
LegoTranInfo* info = new LegoTranInfo(); LegoTranInfo* info = new LegoTranInfo();
info->m_unk0x00 = 0; info->m_animInfo = NULL;
info->m_index = ++m_unk0x1c; info->m_index = ++m_unk0x1c;
info->m_unk0x10 = 0; info->m_unk0x10 = 0;
info->m_unk0x08 = NULL; info->m_unk0x08 = NULL;
info->m_unk0x12 = -1; info->m_unk0x12 = -1;
info->m_unk0x14 = 0; info->m_unk0x14 = FALSE;
info->m_objectId = p_objectId; info->m_objectId = p_objectId;
if (p_matrix != NULL) { if (p_matrix != NULL) {
@ -758,7 +836,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt
} }
} }
if (StartActionIfUnknown0x13c(p_dsAction) == SUCCESS) { if (LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction) == SUCCESS) {
result = SUCCESS; result = SUCCESS;
} }
@ -770,13 +848,13 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt
MxResult LegoAnimationManager::FUN_10060dc0( MxResult LegoAnimationManager::FUN_10060dc0(
IsleScript::Script p_objectId, IsleScript::Script p_objectId,
MxMatrix* p_matrix, MxMatrix* p_matrix,
undefined p_param3, MxBool p_param3,
undefined p_param4, undefined p_param4,
undefined4 p_param5, LegoROI* p_roi,
undefined p_param6, MxBool p_param6,
MxBool p_param7, MxBool p_param7,
MxBool p_param8, MxBool p_param8,
undefined p_param9 MxBool p_param9
) )
{ {
MxResult result = FAILURE; MxResult result = FAILURE;
@ -789,21 +867,21 @@ MxResult LegoAnimationManager::FUN_10060dc0(
for (MxS32 i = 0; i < m_animCount; i++) { for (MxS32 i = 0; i < m_animCount; i++) {
if (m_anims[i].m_objectId == p_objectId) { if (m_anims[i].m_objectId == p_objectId) {
found = TRUE; found = TRUE;
undefined unk0x0a; MxBool unk0x0a;
switch (p_param4) { switch (p_param4) {
case 0: case 0:
unk0x0a = m_anims[i].m_unk0x0a; unk0x0a = m_anims[i].m_unk0x0a;
break; break;
case 1: case 1:
unk0x0a = 1; unk0x0a = TRUE;
break; break;
default: default:
unk0x0a = 0; unk0x0a = FALSE;
break; break;
} }
result = FUN_100605e0(i, unk0x0a, p_matrix, p_param3, p_param5, p_param6, p_param7, p_param8, p_param9); result = FUN_100605e0(i, unk0x0a, p_matrix, p_param3, p_roi, p_param6, p_param7, p_param8, p_param9);
break; break;
} }
} }
@ -874,6 +952,29 @@ MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name)
return -1; return -1;
} }
// STUB: LEGO1 0x100623a0
// FUNCTION: BETA10 0x10043342
MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info)
{
// TODO
return FALSE;
}
// STUB: LEGO1 0x10062580
// FUNCTION: BETA10 0x10043552
void LegoAnimationManager::FUN_10062580(AnimInfo& p_info)
{
// TODO
}
// STUB: LEGO1 0x10062710
// FUNCTION: BETA10 0x10043787
MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info)
{
// TODO
return FALSE;
}
// FUNCTION: LEGO1 0x10062770 // FUNCTION: LEGO1 0x10062770
// FUNCTION: BETA10 0x1004381a // FUNCTION: BETA10 0x1004381a
void LegoAnimationManager::FUN_10062770() void LegoAnimationManager::FUN_10062770()
@ -949,3 +1050,10 @@ void LegoAnimationManager::FUN_10064740(MxBool)
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x100648f0
// FUNCTION: BETA10 0x10045daf
void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong)
{
// TODO
}

View file

@ -136,6 +136,13 @@ void SetCurrentActor(IslePathActor* p_currentActor)
LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); LegoOmni::GetInstance()->SetCurrentActor(p_currentActor);
} }
// FUNCTION: LEGO1 0x10015890
// FUNCTION: BETA10 0x100e4d80
MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction)
{
return LegoOmni::GetInstance()->StartActionIfUnknown0x13c(p_dsAction);
}
// FUNCTION: LEGO1 0x100158b0 // FUNCTION: LEGO1 0x100158b0
void DeleteAction() void DeleteAction()
{ {

View file

@ -666,7 +666,7 @@ void Isle::Enable(MxBool p_enable)
break; break;
} }
AnimationManager()->FUN_10060dc0(script, NULL, 1, 1, 0, 0, FALSE, TRUE, 0); AnimationManager()->FUN_10060dc0(script, NULL, TRUE, 1, NULL, FALSE, FALSE, TRUE, 0);
} }
m_act1state->m_unk0x018 = 0; m_act1state->m_unk0x018 = 0;
@ -694,7 +694,7 @@ void Isle::Enable(MxBool p_enable)
break; break;
} }
AnimationManager()->FUN_10060dc0(script, NULL, 1, 1, 0, 0, FALSE, TRUE, 0); AnimationManager()->FUN_10060dc0(script, NULL, TRUE, 1, NULL, FALSE, FALSE, TRUE, 0);
} }
m_act1state->m_unk0x018 = 0; m_act1state->m_unk0x018 = 0;