Implement/match LegoAnimationManager::Notify (#875)

* Implement/match LegoAnimationManager::Notify

* Rename notification type
This commit is contained in:
Christian Semmler
2024-05-01 09:00:42 -04:00
committed by GitHub
parent 6c89cd3315
commit cd39e71597
16 changed files with 143 additions and 72 deletions

View File

@@ -248,7 +248,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
}
// FUNCTION: LEGO1 0x10003c20
MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param)
{
MxU32 ret = 0;

View File

@@ -45,7 +45,7 @@ MxLong IsleActor::Notify(MxParam& p_param)
case c_notificationType11:
result = VTable0x68();
break;
case c_notificationType18:
case c_notificationEndAnim:
result = VTable0x70();
break;
case c_notificationType19:

View File

@@ -47,8 +47,8 @@ MxLong IslePathActor::Notify(MxParam& p_param)
case c_notificationClick:
ret = VTable0xd4((LegoControlManagerEvent&) p_param);
break;
case c_notificationType18:
ret = VTable0xd8((MxType18NotificationParam&) p_param);
case c_notificationEndAnim:
ret = VTable0xd8((LegoEndAnimNotificationParam&) p_param);
break;
case c_notificationType19:
ret = VTable0xdc((MxType19NotificationParam&) p_param);

View File

@@ -37,7 +37,7 @@ MxLong TowTrack::Notify(MxParam& p_param)
}
// STUB: LEGO1 0x1004cd30
MxU32 TowTrack::VTable0xd8(MxType18NotificationParam& p_param)
MxU32 TowTrack::VTable0xd8(LegoEndAnimNotificationParam& p_param)
{
// TODO
return 0;

View File

@@ -235,7 +235,7 @@ void LegoAnimationManager::Suspend()
}
m_unk0x18 = 0;
m_unk0x1a = 0;
m_unk0x1a = FALSE;
m_unk0x3a = FALSE;
m_unk0x400 = FALSE;
m_unk0x414 = 0;
@@ -270,7 +270,7 @@ void LegoAnimationManager::Init()
m_animCount = 0;
m_anims = NULL;
m_unk0x18 = 0;
m_unk0x1a = 0;
m_unk0x1a = FALSE;
m_tranInfoList = NULL;
m_tranInfoList2 = NULL;
m_unk0x41c = g_legoAnimationManagerConfig <= 1 ? 10 : 20;
@@ -299,8 +299,8 @@ void LegoAnimationManager::Init()
m_unk0x10 = 0;
m_unk0x401 = 0;
m_suspended = FALSE;
m_unk0x430 = 0;
m_unk0x42c = 0;
m_unk0x430 = FALSE;
m_unk0x42c = NULL;
m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime();
m_unk0x410 = 5000;
@@ -374,8 +374,8 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex)
m_unk0x38 = FALSE;
m_unk0x39 = FALSE;
m_unk0x430 = 0;
m_unk0x42c = 0;
m_unk0x430 = FALSE;
m_unk0x42c = NULL;
for (j = 0; j < (MxS32) _countof(g_characters); j++) {
g_characters[j].m_active = FALSE;
@@ -923,10 +923,68 @@ LegoTranInfo* LegoAnimationManager::GetTranInfo(MxU32 p_index)
return NULL;
}
// STUB: LEGO1 0x100619f0
// FUNCTION: LEGO1 0x100619f0
// FUNCTION: BETA10 0x100426b1
MxLong LegoAnimationManager::Notify(MxParam& p_param)
{
// TODO
if (((MxNotificationParam&) p_param).GetSender() == this) {
if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim) {
FUN_100605e0(m_unk0x18, TRUE, NULL, TRUE, NULL, FALSE, TRUE, TRUE, TRUE);
}
}
else if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim && m_tranInfoList != NULL) {
LegoTranInfoListCursor cursor(m_tranInfoList);
LegoTranInfo* tranInfo;
MxU32 index = ((LegoEndAnimNotificationParam&) p_param).GetIndex();
MxBool found = FALSE;
while (cursor.Next(tranInfo)) {
if (tranInfo->m_index == index) {
if (m_unk0x430 && m_unk0x42c == tranInfo) {
FUN_10064b50(-1);
}
if (tranInfo->m_flags & LegoTranInfo::c_bit2) {
BackgroundAudioManager()->RaiseVolume();
}
m_unk0x39 = FALSE;
m_unk0x404 = Timer()->GetTime();
found = TRUE;
cursor.Detach();
delete tranInfo;
for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) {
LegoROI* roi = m_unk0x3c[i].m_roi;
if (roi != NULL) {
LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName());
if (actor != NULL) {
actor->Restart();
}
}
}
break;
}
}
if (m_unk0x1a && found) {
m_unk0x18++;
if (m_animCount <= m_unk0x18) {
m_unk0x1a = FALSE;
}
else {
LegoEndAnimNotificationParam param(c_notificationEndAnim, this, 0);
NotificationManager()->Send(this, param);
}
}
}
return 0;
}
@@ -1057,3 +1115,10 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong)
{
// TODO
}
// STUB: LEGO1 0x10064b50
// FUNCTION: BETA10 0x10045f14
void LegoAnimationManager::FUN_10064b50(undefined4)
{
// TODO
}

View File

@@ -5,6 +5,7 @@
#include "islepathactor.h"
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
#include "legoendanimnotificationparam.h"
#include "legotraninfo.h"
#include "legovideomanager.h"
#include "legoworld.h"
@@ -15,7 +16,6 @@
#include "mxnotificationmanager.h"
#include "mxobjectfactory.h"
#include "mxtimer.h"
#include "mxtype18notificationparam.h"
#include "mxutilities.h"
DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74)
@@ -123,7 +123,7 @@ void LegoAnimMMPresenter::EndAction()
m_tranInfo = NULL;
MxType18NotificationParam param(c_notificationType18, NULL, m_animmanId);
LegoEndAnimNotificationParam param(c_notificationEndAnim, NULL, m_animmanId);
if (m_animmanId != 0) {
NotificationManager()->Send(AnimationManager(), param);
}

View File

@@ -4,6 +4,7 @@
#include "legoanimationmanager.h"
#include "legoanimmmpresenter.h"
#include "legocharactermanager.h"
#include "legoendanimnotificationparam.h"
#include "legopathboundary.h"
#include "legovideomanager.h"
#include "legoworld.h"
@@ -15,7 +16,6 @@
#include "mxnotificationmanager.h"
#include "mxstreamchunk.h"
#include "mxtimer.h"
#include "mxtype18notificationparam.h"
#include "mxutilities.h"
#include "mxvideomanager.h"
#include "realtime/realtime.h"
@@ -1021,7 +1021,7 @@ void LegoAnimPresenter::EndAction()
LegoWorld* world = CurrentWorld();
if (world != NULL) {
MxType18NotificationParam param(c_notificationType18, NULL, 0);
LegoEndAnimNotificationParam param(c_notificationEndAnim, NULL, 0);
NotificationManager()->Send(world, param);
}

View File

@@ -138,7 +138,7 @@ MxLong Isle::Notify(MxParam& p_param)
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationType18:
case c_notificationEndAnim:
switch (m_act1state->m_unk0x018) {
case 4:
result = CurrentActor()->Notify(p_param);