implement a few MxControlPresenter functions (#440)

* MxControlPresenter

* Fixes

* Minor change

* Match MxControlPresenter::StartAction

* Use flags instead

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-15 14:08:28 -05:00 committed by GitHub
parent 7f72a36462
commit f116389373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 13 deletions

View file

@ -33,7 +33,8 @@ class MxControlPresenter : public MxCompositePresenter {
virtual MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48 virtual MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48
virtual void Enable(MxBool p_enable) override; // vtable+0x54 virtual void Enable(MxBool p_enable) override; // vtable+0x54
virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64
virtual void VTable0x68(MxBool p_undefined); // vtable+0x68 virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68
virtual void VTable0x6c(undefined4); // vtable+0x6c
private: private:
MxBool FUN_10044270(undefined4, undefined4, undefined4*); MxBool FUN_10044270(undefined4, undefined4, undefined4*);

View file

@ -1,6 +1,7 @@
#include "mxcontrolpresenter.h" #include "mxcontrolpresenter.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
#include "mxutil.h"
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c) DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
@ -28,9 +29,9 @@ MxBool MxControlPresenter::VTable0x64(undefined4 p_undefined)
} }
// FUNCTION: LEGO1 0x10043ff0 // FUNCTION: LEGO1 0x10043ff0
void MxControlPresenter::VTable0x68(MxBool p_undefined) void MxControlPresenter::VTable0x68(MxBool p_unk0x50)
{ {
m_unk0x50 = p_undefined; m_unk0x50 = p_unk0x50;
} }
// FUNCTION: LEGO1 0x10044110 // FUNCTION: LEGO1 0x10044110
@ -47,11 +48,28 @@ MxResult MxControlPresenter::AddToManager()
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x10044190 // FUNCTION: LEGO1 0x10044190
MxResult MxControlPresenter::StartAction(MxStreamController*, MxDSAction*) MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{ {
// TODO MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
return SUCCESS;
FUN_100b7220(m_action, MxDSAction::Flag_World | MxDSAction::Flag_Looping, TRUE);
ParseExtra();
MxS16 i = 0;
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
(*it)->Enable((m_unk0x4c != 3 || m_unk0x4e) && IsEnabled() ? m_unk0x4e == i : FALSE);
i++;
}
if (m_unk0x4c == 3) {
MxDSAction* action = (*m_list.begin())->GetAction();
action->SetFlags(action->GetFlags() | MxDSAction::Flag_Bit11);
}
TickleManager()->RegisterClient(this, 200);
return result;
} }
// FUNCTION: LEGO1 0x10044260 // FUNCTION: LEGO1 0x10044260
@ -78,7 +96,7 @@ MxBool MxControlPresenter::FUN_10044480(undefined4, undefined4*)
} }
// STUB: LEGO1 0x10044540 // STUB: LEGO1 0x10044540
void MxControlPresenter::FUN_10044540(undefined2) void MxControlPresenter::VTable0x6c(undefined4)
{ {
// TODO // TODO
} }
@ -97,15 +115,34 @@ void MxControlPresenter::ParseExtra()
// TODO // TODO
} }
// STUB: LEGO1 0x10044820 // FUNCTION: LEGO1 0x10044820
void MxControlPresenter::Enable(MxBool p_enable) void MxControlPresenter::Enable(MxBool p_enable)
{ {
// TODO if (MxPresenter::IsEnabled() != p_enable) {
MxPresenter::Enable(p_enable);
MxS16 i = 0;
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if (i == m_unk0x4e) {
(*it)->Enable((m_unk0x4c != 3 || i != 0) ? p_enable : 0);
break;
}
i++;
}
if (!p_enable) {
m_unk0x4e = 0;
}
}
} }
// STUB: LEGO1 0x100448a0 // FUNCTION: LEGO1 0x100448a0
MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState) MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState)
{ {
// TODO MxCompositePresenterList::iterator it = m_list.begin();
return TRUE; for (MxS16 i = m_unk0x4e; i > 0; i--, it++)
;
return (*it)->HasTickleStatePassed(p_tickleState);
} }

View file

@ -7,6 +7,7 @@
class MxDSFile; class MxDSFile;
class MxDSObject; class MxDSObject;
class MxDSAction;
template <class T> template <class T>
inline T Abs(T p_t) inline T Abs(T p_t)
@ -70,6 +71,7 @@ MxBool FUN_100b6e10(
__declspec(dllexport) void MakeSourceName(char*, const char*); __declspec(dllexport) void MakeSourceName(char*, const char*);
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char*, int)); __declspec(dllexport) void SetOmniUserMessage(void (*)(const char*, int));
void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags);
__declspec(dllexport) MxDSObject* CreateStreamObject(MxDSFile*, MxS16); __declspec(dllexport) MxDSObject* CreateStreamObject(MxDSFile*, MxS16);
MxBool KeyValueStringParse(char*, const char*, const char*); MxBool KeyValueStringParse(char*, const char*, const char*);

View file

@ -1,6 +1,9 @@
#include "mxutil.h" #include "mxutil.h"
#include "mxdsaction.h"
#include "mxdsactionlist.h"
#include "mxdsfile.h" #include "mxdsfile.h"
#include "mxdsmultiaction.h"
#include "mxdsobject.h" #include "mxdsobject.h"
#include "mxrect32.h" #include "mxrect32.h"
@ -112,6 +115,21 @@ void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
g_omniUserMessage = p_userMsg; g_omniUserMessage = p_userMsg;
} }
// FUNCTION: LEGO1 0x100b7220
void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags)
{
p_action->SetFlags(!p_setFlags ? p_action->GetFlags() & ~p_newFlags : p_action->GetFlags() | p_newFlags);
if (p_action->IsA("MxDSMultiAction")) {
MxDSActionListCursor cursor(((MxDSMultiAction*) p_action)->GetActionList());
MxDSAction* action;
while (cursor.Next(action)) {
FUN_100b7220(action, p_newFlags, p_setFlags);
}
}
}
// Should probably be somewhere else // Should probably be somewhere else
// FUNCTION: LEGO1 0x100c0280 // FUNCTION: LEGO1 0x100c0280
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs) MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)