Implement/match LegoOmni::FindROI and related (#570)

* Implement/match LegoOmni::FindROI and related

* Add missing file
This commit is contained in:
Christian Semmler 2024-02-16 19:34:30 -05:00 committed by GitHub
parent 5b06054375
commit c67f613b8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 61 additions and 23 deletions

View file

@ -24,7 +24,7 @@ class AnimState : public LegoState {
}
MxBool SetFlag() override; // vtable+0x18
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c
// SYNTHETIC: LEGO1 0x10065130
// AnimState::`scalar deleting destructor'

View file

@ -193,6 +193,7 @@ class LegoOmni : public MxOmni {
void StopTimer() override; // vtable+3c
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);
LegoROI* FindROI(const char* p_name);
void AddWorld(LegoWorld* p_world);
void DeleteWorld(LegoWorld* p_world);
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
@ -273,8 +274,9 @@ LegoWorld* CurrentWorld();
LegoUnkSaveDataWriter* UnkSaveDataWriter();
GifManager* GetGifManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags);
void FUN_10015860(const char*, MxU8);
void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c);
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);
LegoROI* FindROI(const char* p_name);
MxDSAction& GetCurrentAction();
void PlayMusic(MxU32 p_index);

View file

@ -22,7 +22,7 @@ class TowTrackMissionState : public LegoState {
return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name);
}
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C
MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c
inline MxU16 GetColor(MxU8 p_id)
{

View file

@ -448,7 +448,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
}
LegoROI* roi = entity->GetROI();
if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) {
if (roi && !strcmpi(roi->GetName(), p_name)) {
return entity;
}
}

View file

@ -289,8 +289,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
m_currentCutscene = e_noIntro;
return 1;
case 2:
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
SetROIUnknown0x0c(g_object2x4red, 0);
SetROIUnknown0x0c(g_object2x4grn, 0);
BackgroundAudioManager()->RaiseVolume();
return 1;
case 4:
@ -319,7 +319,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param)
}
m_infocenterState->SetUnknown0x74(2);
FUN_10015860("infoman", 1);
SetROIUnknown0x0c("infoman", 1);
return 1;
case 12:
if (action->GetObjectId() == m_currentInfomainScript) {
@ -1054,15 +1054,15 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param)
}
PlayAction(objectId);
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
SetROIUnknown0x0c(g_object2x4red, 0);
SetROIUnknown0x0c(g_object2x4grn, 0);
return 1;
}
case 6:
if (m_infocenterState->GetUnknown0x74() == 8) {
StopCurrentAction();
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
SetROIUnknown0x0c(g_object2x4red, 0);
SetROIUnknown0x0c(g_object2x4grn, 0);
m_infocenterState->SetUnknown0x74(2);
PlayAction(c_infomanSneeze);
return 1;

View file

@ -1,6 +1,6 @@
#include "scorestate.h"
DECOMP_SIZE_ASSERT(ScoreState, 0x0C);
DECOMP_SIZE_ASSERT(ScoreState, 0x0c);
// FUNCTION: LEGO1 0x1000de20
MxBool ScoreState::VTable0x14()

View file

@ -387,7 +387,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
p_param.SetROI(roi);
if (roi && roi->GetUnk0x0c() == 1) {
if (roi && roi->GetUnknown0x0c() == 1) {
for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) {
roi = (LegoROI*) oroi;
}

View file

@ -226,10 +226,20 @@ void FUN_10015820(MxBool p_disable, MxU16 p_flags)
LegoOmni::GetInstance()->FUN_1005b4f0(p_disable, p_flags);
}
// STUB: LEGO1 0x10015860
void FUN_10015860(const char*, MxU8)
// FUNCTION: LEGO1 0x10015840
LegoROI* FindROI(const char* p_name)
{
// TODO
return LegoOmni::GetInstance()->FindROI(p_name);
}
// FUNCTION: LEGO1 0x10015860
void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c)
{
LegoROI* roi = FindROI(p_name);
if (roi) {
roi->SetUnknown0x0c(p_unk0x0c);
}
}
// FUNCTION: LEGO1 0x100158c0
@ -803,6 +813,28 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
MxOmni::DeleteObject(p_dsAction);
}
// FUNCTION: LEGO1 0x1005b270
LegoROI* LegoOmni::FindROI(const char* p_name)
{
ViewManager* viewManager = GetVideoManager()->Get3DManager()->GetLego3DView()->GetViewManager();
CompoundObject& unk0x08 = viewManager->GetUnknown0x08();
if (p_name != NULL && *p_name != '\0' && unk0x08.size() > 0) {
for (CompoundObject::iterator it = unk0x08.begin(); it != unk0x08.end(); it++) {
LegoROI* roi = (LegoROI*) *it;
const char* name = roi->GetName();
if (name != NULL) {
if (!strcmpi(name, p_name)) {
return roi;
}
}
}
}
return NULL;
}
// FUNCTION: LEGO1 0x1005b2f0
MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter)
{

View file

@ -135,7 +135,7 @@ void LegoModelPresenter::ParseExtra()
list<AutoROI*>& roiList = currentWorld->GetUnknownList0xe0();
for (list<AutoROI*>::iterator it = roiList.begin(); it != roiList.end(); it++) {
if (!strcmpi(((LegoROI*) (*it))->GetUnknown0xe4(), output)) {
if (!strcmpi(((LegoROI*) (*it))->GetName(), output)) {
m_roi = *it;
roiList.erase(it);

View file

@ -40,7 +40,7 @@ class LegoROI : public ViewROI {
void FUN_100a46b0(Matrix4& p_transform);
void FUN_100a58f0(Matrix4& p_transform);
inline const char* GetUnknown0xe4() { return m_unk0xe4; }
inline const char* GetName() { return m_name; }
inline LegoEntity* GetUnknown0x104() { return m_unk0x104; }
inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; }
@ -50,7 +50,7 @@ class LegoROI : public ViewROI {
private:
undefined4 m_unk0xe0; // 0xe0
const char* m_unk0xe4; // 0xe4
const char* m_name; // 0xe4
undefined m_unk0xe8[0x1c]; // 0xe8
LegoEntity* m_unk0x104; // 0x104
int m_time; // 0x108

View file

@ -81,15 +81,15 @@ class MxOmni : public MxCore {
MxString m_mediaPath; // 0x08
HWND m_windowHandle; // 0x18
MxObjectFactory* m_objectFactory; // 0x1C
MxObjectFactory* m_objectFactory; // 0x1c
MxVariableTable* m_variableTable; // 0x20
MxTickleManager* m_tickleManager; // 0x24
MxNotificationManager* m_notificationManager; // 0x28
MxVideoManager* m_videoManager; // 0x2C
MxVideoManager* m_videoManager; // 0x2c
MxSoundManager* m_soundManager; // 0x30
MxMusicManager* m_musicManager; // 0x34
MxEventManager* m_eventManager; // 0x38
MxTimer* m_timer; // 0x3C
MxTimer* m_timer; // 0x3c
MxStreamer* m_streamer; // 0x40
MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44
MxCriticalSection m_criticalsection; // 0x48

View file

@ -103,7 +103,9 @@ class ROI {
int GetLODCount() const { return m_lods ? m_lods->Size() : 0; }
const CompoundObject* GetComp() const { return m_comp; }
inline undefined GetUnk0x0c() { return m_unk0x0c; }
inline undefined GetUnknown0x0c() { return m_unk0x0c; }
inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
// SYNTHETIC: LEGO1 0x100a5d60
// ROI::`scalar deleting destructor'

View file

@ -20,6 +20,8 @@ class ViewManager {
// SYNTHETIC: LEGO1 0x100a6000
// ViewManager::`scalar deleting destructor'
inline CompoundObject& GetUnknown0x08() { return m_unk0x08; }
inline void AddToUnknown0x08(ViewROI* p_roi) { m_unk0x08.push_back(p_roi); }
private: