isle-portable/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp

149 lines
3 KiB
C++
Raw Normal View History

#include "mxcontrolpresenter.h"
#include "mxticklemanager.h"
#include "mxutil.h"
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x10043f50
MxControlPresenter::MxControlPresenter()
{
this->m_unk0x4c = 0;
this->m_unk0x4e = -1;
this->m_unk0x50 = FALSE;
this->m_unk0x52 = 0;
this->m_unk0x58 = 0;
this->m_unk0x54 = 0;
}
// FUNCTION: LEGO1 0x10043fd0
void MxControlPresenter::RepeatingTickle()
{
// empty
}
// FUNCTION: LEGO1 0x10043fe0
MxBool MxControlPresenter::VTable0x64(undefined4 p_undefined)
{
return m_unk0x50;
}
// FUNCTION: LEGO1 0x10043ff0
void MxControlPresenter::VTable0x68(MxBool p_unk0x50)
{
m_unk0x50 = p_unk0x50;
}
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x10044110
MxControlPresenter::~MxControlPresenter()
{
if (m_unk0x58)
delete m_unk0x58;
}
// FUNCTION: LEGO1 0x10044180
MxResult MxControlPresenter::AddToManager()
{
m_unk0x4e = 0;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10044190
MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
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
void MxControlPresenter::EndAction()
{
if (m_action) {
m_unk0x50 = TRUE;
MxCompositePresenter::EndAction();
}
}
// STUB: LEGO1 0x10044270
MxBool MxControlPresenter::FUN_10044270(undefined4, undefined4, undefined4*)
{
// TODO
return TRUE;
}
// STUB: LEGO1 0x10044480
MxBool MxControlPresenter::FUN_10044480(undefined4, undefined4*)
{
// TODO
return TRUE;
}
// STUB: LEGO1 0x10044540
void MxControlPresenter::VTable0x6c(undefined4)
{
// TODO
}
(Proposal) Adjustments to "decomp" language (#308) * Adjustments to "decomp" language * Fix a comment * Fix accidental clang-formatting * Fix order * Fix order * Remove junk * Fix OFFSET * Adjustments based on new suggestions * Annotate globals * Globals in ISLE * More globals * Merge from parser2 branch * Allow prepending space for exact marker match * To eliminate noise, require the 0x prefix on offset for marker match * fix test from previous * Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise * FUNCTION to SYNTHETIC where needed * Missed marker conversion on SetAtomId * pylint cleanup, remove unused code * Fix unexpected function end, add more unit tests * Be more strict about synthetic name syntax * Revert "Missed marker conversion on SetAtomId" This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2. * Revert "FUNCTION to SYNTHETIC where needed" This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8. * Implicit lookup by name for functions * Fix VTABLE SYNTHETIC and other decomp markers * Get vtable class name * Vtable marker should identify struct * No colon for SIZE comment * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update README.md * Update CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix destructor/annotation * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
2023-12-06 07:10:45 -05:00
// FUNCTION: LEGO1 0x10044610
void MxControlPresenter::ReadyTickle()
{
MxPresenter::ParseExtra();
TickleManager()->UnregisterClient(this);
ProgressTickleState(TickleState_Repeating);
}
// STUB: LEGO1 0x10044640
void MxControlPresenter::ParseExtra()
{
// TODO
}
// FUNCTION: LEGO1 0x10044820
void MxControlPresenter::Enable(MxBool p_enable)
{
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;
}
}
}
// FUNCTION: LEGO1 0x100448a0
MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState)
{
MxCompositePresenterList::iterator it = m_list.begin();
for (MxS16 i = m_unk0x4e; i > 0; i--, it++)
;
return (*it)->HasTickleStatePassed(p_tickleState);
}