Improve FUN_10061010, other fixes (#1634)

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2025-07-19 16:28:35 +02:00
committed by GitHub
parent 29d7a5df89
commit 73d9ef1d80
7 changed files with 90 additions and 20 deletions

View File

@@ -303,4 +303,7 @@ private:
// TEMPLATE: LEGO1 0x10061750
// MxListCursor<LegoTranInfo *>::MxListCursor<LegoTranInfo *>
// TEMPLATE: BETA10 0x1004b5d0
// MxListCursor<LegoTranInfo *>::Next
#endif // LEGOANIMATIONMANAGER_H

View File

@@ -28,9 +28,11 @@ public:
// class MxPtrListCursor<LegoTranInfo>
// VTABLE: LEGO1 0x100d8d20
// VTABLE: BETA10 0x101bad70
// SIZE 0x10
class LegoTranInfoListCursor : public MxPtrListCursor<LegoTranInfo> {
public:
// FUNCTION: BETA10 0x100496d0
LegoTranInfoListCursor(LegoTranInfoList* p_list) : MxPtrListCursor<LegoTranInfo>(p_list) {}
};
@@ -62,9 +64,14 @@ public:
// MxPtrList<LegoTranInfo>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x100612f0
// SYNTHETIC: BETA10 0x100498c0
// LegoTranInfoListCursor::`scalar deleting destructor'
// SYNTHETIC: BETA10 0x10049770
// MxPtrListCursor<LegoTranInfo>::MxPtrListCursor<LegoTranInfo>
// FUNCTION: LEGO1 0x10061360
// FUNCTION: BETA10 0x10049910
// MxPtrListCursor<LegoTranInfo>::~MxPtrListCursor<LegoTranInfo>
// SYNTHETIC: LEGO1 0x100613b0
@@ -77,6 +84,7 @@ public:
// MxListCursor<LegoTranInfo *>::~MxListCursor<LegoTranInfo *>
// FUNCTION: LEGO1 0x100614e0
// FUNCTION: BETA10 0x10049ab0
// LegoTranInfoListCursor::~LegoTranInfoListCursor
#endif // LEGOTRANINFOLIST_H

View File

@@ -20,6 +20,7 @@
#include "legoworld.h"
#include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdebug.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxticklemanager.h"
@@ -1225,12 +1226,10 @@ void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU
}
}
// FUNCTION: LEGO1 0x10061010
#ifdef BETA10
// FUNCTION: BETA10 0x100422cc
void LegoAnimationManager::FUN_10061010(MxBool p_und)
{
MxBool unk0x39 = FALSE;
FUN_10064b50(-1);
if (m_tranInfoList != NULL) {
@@ -1238,17 +1237,47 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und)
LegoTranInfo* tranInfo;
while (cursor.Next(tranInfo)) {
if (tranInfo->m_presenter != NULL) {
// TODO: Match
MxU32 flags = tranInfo->m_flags;
if (tranInfo->m_unk0x14 && tranInfo->m_location != -1) {
MxTrace("Releasing user from %d\n", tranInfo->m_objectId);
if (tranInfo->m_presenter != NULL) {
tranInfo->m_presenter->FUN_1004b8c0();
}
tranInfo->m_unk0x14 = FALSE;
}
else {
MxTrace("Stopping %d\n", tranInfo->m_objectId);
if (tranInfo->m_presenter != NULL) {
tranInfo->m_presenter->FUN_1004b840();
}
}
}
}
m_animRunning = FALSE;
m_unk0x404 = Timer()->GetTime();
}
#else
// FUNCTION: LEGO1 0x10061010
void LegoAnimationManager::FUN_10061010(MxBool p_und)
{
MxBool animRunning = FALSE;
FUN_10064b50(-1);
if (m_tranInfoList != NULL) {
LegoTranInfoListCursor cursor(m_tranInfoList);
LegoTranInfo* tranInfo;
while (cursor.Next(tranInfo)) {
if (tranInfo->m_presenter) {
// LINE: LEGO1 0x100610e6
if (tranInfo->m_unk0x14 && tranInfo->m_location != -1 && p_und) {
LegoAnim* anim;
if (tranInfo->m_presenter->GetPresenter() != NULL &&
(anim = tranInfo->m_presenter->GetPresenter()->GetAnimation()) != NULL &&
anim->GetCamAnim() != NULL) {
if (flags & LegoTranInfo::c_bit2) {
if (tranInfo->m_presenter->GetPresenter() &&
tranInfo->m_presenter->GetPresenter()->GetAnimation() &&
tranInfo->m_presenter->GetPresenter()->GetAnimation()->GetCamAnim()) {
if (tranInfo->m_flags & LegoTranInfo::c_bit2) {
BackgroundAudioManager()->RaiseVolume();
tranInfo->m_flags &= ~LegoTranInfo::c_bit2;
}
@@ -1257,37 +1286,43 @@ void LegoAnimationManager::FUN_10061010(MxBool p_und)
tranInfo->m_unk0x14 = FALSE;
}
else {
MxTrace("Releasing user from %d\n", tranInfo->m_objectId);
// LINE: LEGO1 0x10061137
tranInfo->m_presenter->FUN_1004b8c0();
animRunning = TRUE;
tranInfo->m_unk0x14 = FALSE;
unk0x39 = TRUE;
}
}
else {
if (flags & LegoTranInfo::c_bit2) {
if (tranInfo->m_flags & LegoTranInfo::c_bit2) {
// LINE: LEGO1 0x10061150
BackgroundAudioManager()->RaiseVolume();
tranInfo->m_flags &= ~LegoTranInfo::c_bit2;
}
MxTrace("Stopping %d\n", tranInfo->m_objectId);
tranInfo->m_presenter->FUN_1004b840();
}
}
else {
if (m_tranInfoList2 != NULL) {
LegoTranInfoListCursor cursor(m_tranInfoList2);
if (!cursor.Find(tranInfo)) {
// TODO: For some reason, the embedded `MxListEntry` constructor is not inlined.
// This may be the key for getting this function to match correctly.
m_tranInfoList2->Append(tranInfo);
}
}
unk0x39 = TRUE;
animRunning = TRUE;
}
}
}
m_animRunning = unk0x39;
m_animRunning = animRunning;
m_unk0x404 = Timer()->GetTime();
}
#endif
// FUNCTION: LEGO1 0x10061530
void LegoAnimationManager::FUN_10061530()

View File

@@ -425,6 +425,21 @@ MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time)
// FUNCTION: BETA10 0x1004ce18
MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
{
#ifdef BETA10
switch (m_unk0x58) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
#endif
LegoROI* viewROI = VideoManager()->GetViewROI();
LegoPathActor* actor = UserActor();
@@ -455,9 +470,13 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
m_world->PlaceActor(actor);
}
#ifdef BETA10
actor->VTable0xa8();
#else
if (m_tranInfo->m_unk0x29) {
actor->VTable0xa8();
}
#endif
}
actor->SetActorState(LegoPathActor::c_initial);
@@ -491,9 +510,11 @@ void LegoAnimMMPresenter::FUN_1004b840()
FUN_1004b6d0(0);
EndAction();
#ifndef BETA10
if (action != NULL) {
Streamer()->FUN_100b98f0(action);
}
#endif
}
// FUNCTION: LEGO1 0x1004b8b0

View File

@@ -286,6 +286,7 @@ MxResult LegoWorld::PlaceActor(
}
// FUNCTION: LEGO1 0x1001fa70
// FUNCTION: BETA10 0x100da328
MxResult LegoWorld::PlaceActor(LegoPathActor* p_actor)
{
LegoPathControllerListCursor cursor(&m_pathControllerList);
@@ -301,6 +302,7 @@ MxResult LegoWorld::PlaceActor(LegoPathActor* p_actor)
}
// FUNCTION: LEGO1 0x1001fb70
// FUNCTION: BETA10 0x100da3f1
MxResult LegoWorld::PlaceActor(
LegoPathActor* p_actor,
LegoAnimPresenter* p_presenter,

View File

@@ -244,11 +244,11 @@ inline MxBool MxListCursor<T>::Next()
template <class T>
inline MxBool MxListCursor<T>::Next(T& p_obj)
{
if (!m_match) {
m_match = m_list->m_first;
if (m_match) {
m_match = m_match->GetNext();
}
else {
m_match = m_match->GetNext();
m_match = m_list->m_first;
}
if (m_match) {

View File

@@ -153,6 +153,7 @@ void OrientableROI::UpdateWorldDataWithTransformAndChildren(const Matrix4& p_tra
}
// FUNCTION: LEGO1 0x100a5a30
// FUNCTION: BETA10 0x10167d31
void OrientableROI::SetWorldVelocity(const Vector3& p_world_velocity)
{
m_world_velocity = p_world_velocity;