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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 143 additions and 72 deletions

View file

@ -25,13 +25,13 @@ class Helicopter : public IslePathActor {
return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
MxU32 VTable0xcc() override; // vtable+0xcc
MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4
MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8
void VTable0xe4() override; // vtable+0xe4
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
MxU32 VTable0xcc() override; // vtable+0xcc
MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4
MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8
void VTable0xe4() override; // vtable+0xe4
// SYNTHETIC: LEGO1 0x10003210
// Helicopter::`scalar deleting destructor'

View file

@ -2,10 +2,10 @@
#define ISLEPATHACTOR_H
#include "legocontrolmanager.h"
#include "legoendanimnotificationparam.h"
#include "legogamestate.h"
#include "legopathactor.h"
#include "legoworld.h"
#include "mxtype18notificationparam.h"
#include "mxtype19notificationparam.h"
#include "mxtypes.h"
@ -46,7 +46,7 @@ class IslePathActor : public LegoPathActor {
virtual MxU32 VTable0xd4(LegoControlManagerEvent&) { return 0; } // vtable+0xd4
// FUNCTION: LEGO1 0x10002e90
virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8
virtual MxU32 VTable0xd8(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8
// FUNCTION: LEGO1 0x10002e00
virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc

View file

@ -125,6 +125,7 @@ class LegoAnimationManager : public MxCore {
MxBool FUN_10062710(AnimInfo& p_info);
void FUN_10063aa0();
void FUN_100648f0(LegoTranInfo*, MxLong);
void FUN_10064b50(undefined4);
MxS32 m_scriptIndex; // 0x08
MxU16 m_animCount; // 0x0c
@ -132,7 +133,7 @@ class LegoAnimationManager : public MxCore {
MxU16 m_unk0x10; // 0x10
AnimInfo* m_anims; // 0x14
undefined2 m_unk0x18; // 0x18
undefined m_unk0x1a; // 0x1a
MxBool m_unk0x1a; // 0x1a
MxU32 m_unk0x1c; // 0x1c
LegoTranInfoList* m_tranInfoList; // 0x20
LegoTranInfoList* m_tranInfoList2; // 0x24
@ -159,8 +160,8 @@ class LegoAnimationManager : public MxCore {
MxBool m_unk0x429; // 0x429
undefined m_unk0x42a; // 0x42a
MxBool m_suspended; // 0x42b
undefined4 m_unk0x42c; // 0x42c
undefined m_unk0x430; // 0x430
LegoTranInfo* m_unk0x42c; // 0x42c
MxBool m_unk0x430; // 0x430
undefined4 m_unk0x434[2]; // 0x434
MxMatrix m_unk0x43c; // 0x43c
MxMatrix m_unk0x484; // 0x484

View file

@ -0,0 +1,34 @@
#ifndef LEGOENDANIMNOTIFICATIONPARAM_H
#define LEGOENDANIMNOTIFICATIONPARAM_H
#include "decomp.h"
#include "mxnotificationparam.h"
// VTABLE: LEGO1 0x100d7e80
// SIZE 0x10
class LegoEndAnimNotificationParam : public MxNotificationParam {
public:
LegoEndAnimNotificationParam(NotificationId p_type, MxCore* p_sender, MxU32 p_index)
: MxNotificationParam(p_type, p_sender), m_index(p_index)
{
}
// FUNCTION: LEGO1 0x1004afd0
MxNotificationParam* Clone() const override
{
return new LegoEndAnimNotificationParam(m_type, m_sender, m_index);
} // vtable+0x04
inline MxU32 GetIndex() { return m_index; }
protected:
MxU32 m_index; // 0x0c
};
// SYNTHETIC: LEGO1 0x1004b080
// LegoEndAnimNotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1004b0f0
// LegoEndAnimNotificationParam::~LegoEndAnimNotificationParam
#endif // LEGOENDANIMNOTIFICATIONPARAM_H

View file

@ -31,6 +31,8 @@ struct LegoTranInfo {
m_unk0x2c.SetIdentity();
}
~LegoTranInfo() { delete m_unk0x0c; }
AnimInfo* m_animInfo; // 0x00
MxU32 m_index; // 0x04
LegoROI* m_unk0x08; // 0x08

View file

@ -23,14 +23,14 @@ class TowTrack : public IslePathActor {
return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name);
}
MxLong Notify(MxParam& p_param) override; // vtable+0x04
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void VTable0x70(float p_float) override; // vtable+0x70
MxU32 VTable0xcc() override; // vtable+0xcc
MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4
MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8
MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc
void VTable0xe4() override; // vtable+0xe4
MxLong Notify(MxParam& p_param) override; // vtable+0x04
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void VTable0x70(float p_float) override; // vtable+0x70
MxU32 VTable0xcc() override; // vtable+0xcc
MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4
MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8
MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc
void VTable0xe4() override; // vtable+0xe4
void FUN_1004dab0();
void FUN_1004dad0();

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);

View file

@ -7,6 +7,7 @@
class MxCore;
// Several of those should be defined in LegoOmni
enum NotificationId {
c_notificationType0 = 0,
c_notificationStartAction = 1, // 100dc210:100d8350
@ -24,8 +25,8 @@ enum NotificationId {
c_notificationDrag = 14,
c_notificationTimer = 15, // 100d6aa0
c_notificationClick = 17,
c_notificationType18 = 18, // 100d7e80
c_notificationType19 = 19, // 100d6230
c_notificationEndAnim = 18, // 100d7e80
c_notificationType19 = 19, // 100d6230
c_notificationType20 = 20,
c_notificationNewPresenter = 21,
c_notificationType22 = 22,

View file

@ -1,32 +0,0 @@
#ifndef MXTYPE18NOTIFICATIONPARAM_H
#define MXTYPE18NOTIFICATIONPARAM_H
#include "decomp.h"
#include "mxnotificationparam.h"
// VTABLE: LEGO1 0x100d7e80
// SIZE 0x10
class MxType18NotificationParam : public MxNotificationParam {
public:
MxType18NotificationParam(NotificationId p_type, MxCore* p_sender, undefined4 p_unk0x0c)
: MxNotificationParam(p_type, p_sender), m_unk0x0c(p_unk0x0c)
{
}
// FUNCTION: LEGO1 0x1004afd0
MxNotificationParam* Clone() const override
{
return new MxType18NotificationParam(m_type, m_sender, m_unk0x0c);
} // vtable+0x04
protected:
undefined4 m_unk0x0c; // 0x0c
};
// SYNTHETIC: LEGO1 0x1004b080
// MxType18NotificationParam::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1004b0f0
// MxType18NotificationParam::~MxType18NotificationParam
#endif // MXTYPE18NOTIFICATIONPARAM_H