begin implementation of InfoCenter class (#444)

* Push changes

* fixes

* Implement Infocenter::HandleEndAction

* match Infocenter::StopCutScene

* implement Infocenter::HandleKeyPress

* fixes

* Update infocenter.cpp

* Update legoworld.cpp

* use enums

* WIP Fixes

* Fix

* Fix

* Fix

* Rename function

* Change enum

* Update enums

* Refactor another enum

* Refactor MxDSType

* Refactor HashTableOpt

* Fixes

* Refactor tickle enum

* Update other enums

* Add EnumConstantName to ncc

* Move enum to global namespace

* Rename enum

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-01-17 11:53:53 -05:00
committed by GitHub
parent aaa18bc9e2
commit f50b771fff
100 changed files with 1160 additions and 555 deletions

View File

@@ -55,7 +55,7 @@ MxAtomId& MxAtomId::operator=(const MxAtomId& p_atomId)
Destroy();
if (p_atomId.m_internal && MxOmni::GetInstance() && AtomIdCounterSet()) {
MxAtomIdCounter* counter = GetCounter(p_atomId.m_internal, LookupMode_Exact);
MxAtomIdCounter* counter = GetCounter(p_atomId.m_internal, e_exact);
counter->Inc();
}
@@ -71,11 +71,11 @@ MxAtomIdCounter* MxAtomId::GetCounter(const char* p_str, LookupMode p_mode)
MxAtomIdCounter* counter = new MxAtomIdCounter(p_str);
switch (p_mode) {
case LookupMode_LowerCase:
case LookupMode_LowerCase2:
case e_lowerCase:
case e_lowerCase2:
counter->GetKey()->ToLowerCase();
break;
case LookupMode_UpperCase:
case e_upperCase:
counter->GetKey()->ToUpperCase();
break;
}

View File

@@ -112,7 +112,7 @@ MxLong MxCompositePresenter::Notify(MxParam& p_param)
case c_notificationEndAction:
VTable0x58((MxEndActionNotificationParam&) p_param);
break;
case MXPRESENTER_NOTIFICATION:
case c_notificationPresenter:
VTable0x5c((MxNotificationParam&) p_param);
}
@@ -155,8 +155,8 @@ void MxCompositePresenter::VTable0x58(MxEndActionNotificationParam& p_param)
else {
if (m_action->IsA("MxDSSerialAction") && it != m_list.end()) {
MxPresenter* presenter = *it;
if (presenter->GetCurrentTickleState() == TickleState_Idle)
presenter->SetTickleState(TickleState_Ready);
if (presenter->GetCurrentTickleState() == e_idle)
presenter->SetTickleState(e_ready);
}
}
}
@@ -171,8 +171,8 @@ void MxCompositePresenter::VTable0x5c(MxNotificationParam& p_param)
if (*it == presenter) {
m_list.erase(it++);
if (presenter->GetCurrentTickleState() == TickleState_Idle)
presenter->SetTickleState(TickleState_Ready);
if (presenter->GetCurrentTickleState() == e_idle)
presenter->SetTickleState(e_ready);
MxDSActionList* actions = ((MxDSMultiAction*) m_action)->GetActionList();
MxDSActionListCursor cursor(actions);
@@ -186,8 +186,8 @@ void MxCompositePresenter::VTable0x5c(MxNotificationParam& p_param)
else {
if (m_action->IsA("MxDSSerialAction")) {
MxPresenter* presenter = *it;
if (presenter->GetCurrentTickleState() == TickleState_Idle)
presenter->SetTickleState(TickleState_Ready);
if (presenter->GetCurrentTickleState() == e_idle)
presenter->SetTickleState(e_ready);
}
}
@@ -210,8 +210,8 @@ void MxCompositePresenter::VTable0x60(MxPresenter* p_presenter)
}
else if (m_action->IsA("MxDSSerialAction")) {
MxPresenter* presenter = *it;
if (presenter->GetCurrentTickleState() == TickleState_Idle)
presenter->SetTickleState(TickleState_Ready);
if (presenter->GetCurrentTickleState() == e_idle)
presenter->SetTickleState(e_ready);
}
return;
}
@@ -227,7 +227,7 @@ void MxCompositePresenter::SetTickleState(TickleState p_tickleState)
MxPresenter* presenter = *it;
presenter->SetTickleState(p_tickleState);
if (m_action->IsA("MxDSSerialAction") && p_tickleState == TickleState_Ready)
if (m_action->IsA("MxDSSerialAction") && p_tickleState == e_ready)
return;
}
}

View File

@@ -60,12 +60,12 @@ MxStreamChunk* MxMediaPresenter::CurrentChunk()
if (m_subscriber) {
chunk = m_subscriber->CurrentChunk();
if (chunk && chunk->GetFlags() & MxDSChunk::Flag_Bit3) {
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Bit7);
if (chunk && chunk->GetFlags() & MxDSChunk::c_bit3) {
m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_bit7);
m_subscriber->NextChunk();
m_subscriber->DestroyChunk(chunk);
chunk = NULL;
ProgressTickleState(TickleState_Done);
ProgressTickleState(e_done);
}
}
@@ -80,11 +80,11 @@ MxStreamChunk* MxMediaPresenter::NextChunk()
if (m_subscriber) {
chunk = m_subscriber->NextChunk();
if (chunk && chunk->GetFlags() & MxDSChunk::Flag_Bit3) {
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Bit7);
if (chunk && chunk->GetFlags() & MxDSChunk::c_bit3) {
m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_bit7);
m_subscriber->DestroyChunk(chunk);
chunk = NULL;
ProgressTickleState(TickleState_Done);
ProgressTickleState(e_done);
}
}
@@ -98,7 +98,7 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct
MxAutoLocker lock(&m_criticalSection);
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
if (m_action->GetFlags() & MxDSAction::Flag_Looping) {
if (m_action->GetFlags() & MxDSAction::c_looping) {
m_loopingChunks = new MxStreamChunkList;
m_loopingChunkCursor = new MxStreamChunkListCursor(m_loopingChunks);
@@ -131,10 +131,9 @@ void MxMediaPresenter::EndAction()
m_currentChunk = NULL;
if (m_action->GetFlags() & MxDSAction::Flag_World &&
(!m_compositePresenter || !m_compositePresenter->VTable0x64(2))) {
if (m_action->GetFlags() & MxDSAction::c_world && (!m_compositePresenter || !m_compositePresenter->VTable0x64(2))) {
MxPresenter::Enable(FALSE);
SetTickleState(TickleState_Idle);
SetTickleState(e_idle);
}
else {
MxDSAction* action = m_action;
@@ -178,12 +177,12 @@ void MxMediaPresenter::StreamingTickle()
m_currentChunk = NextChunk();
if (m_currentChunk) {
if (m_currentChunk->GetFlags() & MxDSChunk::Flag_End) {
if (m_currentChunk->GetFlags() & MxDSChunk::c_end) {
m_subscriber->DestroyChunk(m_currentChunk);
m_currentChunk = NULL;
ProgressTickleState(TickleState_Repeating);
ProgressTickleState(e_repeating);
}
else if (m_action->GetFlags() & MxDSAction::Flag_Looping) {
else if (m_action->GetFlags() & MxDSAction::c_looping) {
LoopChunk(m_currentChunk);
if (!IsEnabled()) {
@@ -206,11 +205,11 @@ void MxMediaPresenter::RepeatingTickle()
if (m_currentChunk) {
MxLong time = m_currentChunk->GetTime();
if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount())
ProgressTickleState(TickleState_unk5);
ProgressTickleState(e_unk5);
}
else {
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration())
ProgressTickleState(TickleState_unk5);
ProgressTickleState(e_unk5);
}
}
}
@@ -219,7 +218,7 @@ void MxMediaPresenter::RepeatingTickle()
void MxMediaPresenter::DoneTickle()
{
m_previousTickleStates |= 1 << m_currentTickleState;
m_currentTickleState = TickleState_Idle;
m_currentTickleState = e_idle;
EndAction();
}
@@ -246,13 +245,13 @@ void MxMediaPresenter::Enable(MxBool p_enable)
if (p_enable) {
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
SetTickleState(TickleState_Repeating);
SetTickleState(e_repeating);
}
else {
if (m_loopingChunkCursor)
m_loopingChunkCursor->Reset();
m_currentChunk = NULL;
SetTickleState(TickleState_Done);
SetTickleState(e_done);
}
}
}

View File

@@ -19,7 +19,7 @@ DECOMP_SIZE_ASSERT(MxObjectFactory, 0x38); // 100af1db
// FUNCTION: LEGO1 0x100b0d80
MxObjectFactory::MxObjectFactory()
{
#define X(V) this->m_id##V = MxAtomId(#V, LookupMode_Exact);
#define X(V) this->m_id##V = MxAtomId(#V, e_exact);
FOR_MXOBJECTFACTORY_OBJECTS(X)
#undef X
}
@@ -28,7 +28,7 @@ MxObjectFactory::MxObjectFactory()
MxCore* MxObjectFactory::Create(const char* p_name)
{
MxCore* object = NULL;
MxAtomId atom(p_name, LookupMode_Exact);
MxAtomId atom(p_name, e_exact);
if (0) {
}

View File

@@ -21,7 +21,7 @@ DECOMP_SIZE_ASSERT(MxPresenter, 0x40);
// FUNCTION: LEGO1 0x100b4d50
void MxPresenter::Init()
{
m_currentTickleState = TickleState_Idle;
m_currentTickleState = e_idle;
m_action = NULL;
m_location = MxPoint32(0, 0);
m_displayZ = 0;
@@ -41,7 +41,7 @@ MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action)
this->m_location = MxPoint32(this->m_action->GetLocation()[0], this->m_action->GetLocation()[1]);
this->m_displayZ = this->m_action->GetLocation()[2];
ProgressTickleState(TickleState_Ready);
ProgressTickleState(e_ready);
return SUCCESS;
}
@@ -70,7 +70,7 @@ void MxPresenter::EndAction()
this->m_action = NULL;
MxS32 previousTickleState = 1 << m_currentTickleState;
this->m_previousTickleStates |= previousTickleState;
this->m_currentTickleState = TickleState_Idle;
this->m_currentTickleState = e_idle;
}
// FUNCTION: LEGO1 0x100b4fc0
@@ -96,7 +96,7 @@ void MxPresenter::ParseExtra()
MxS32 val = token ? atoi(token) : 0;
MxEntity* result = MxOmni::GetInstance()->FindWorld(buf, val, this);
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_World);
m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_world);
if (result)
SendToCompositePresenter(MxOmni::GetInstance());
@@ -112,11 +112,11 @@ void MxPresenter::SendToCompositePresenter(MxOmni* p_omni)
#ifdef COMPAT_MODE
{
MxNotificationParam param(MXPRESENTER_NOTIFICATION, this);
MxNotificationParam param(c_notificationPresenter, this);
NotificationManager()->Send(m_compositePresenter, &param);
}
#else
NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this));
NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(c_notificationPresenter, this));
#endif
m_action->SetOrigin(p_omni ? p_omni : MxOmni::GetInstance());
@@ -130,32 +130,32 @@ MxResult MxPresenter::Tickle()
MxAutoLocker lock(&this->m_criticalSection);
switch (this->m_currentTickleState) {
case TickleState_Ready:
case e_ready:
this->ReadyTickle();
if (m_currentTickleState != TickleState_Starting)
if (m_currentTickleState != e_starting)
break;
case TickleState_Starting:
case e_starting:
this->StartingTickle();
if (m_currentTickleState != TickleState_Streaming)
if (m_currentTickleState != e_streaming)
break;
case TickleState_Streaming:
case e_streaming:
this->StreamingTickle();
if (m_currentTickleState != TickleState_Repeating)
if (m_currentTickleState != e_repeating)
break;
case TickleState_Repeating:
case e_repeating:
this->RepeatingTickle();
if (m_currentTickleState != TickleState_unk5)
if (m_currentTickleState != e_unk5)
break;
case TickleState_unk5:
case e_unk5:
this->Unk5Tickle();
if (m_currentTickleState != TickleState_Done)
if (m_currentTickleState != e_done)
break;
case TickleState_Done:
case e_done:
this->DoneTickle();
default:
break;
@@ -171,9 +171,9 @@ void MxPresenter::Enable(MxBool p_enable)
MxU32 flags = this->m_action->GetFlags();
if (p_enable)
this->m_action->SetFlags(flags | MxDSAction::Flag_Enabled);
this->m_action->SetFlags(flags | MxDSAction::c_enabled);
else
this->m_action->SetFlags(flags & ~MxDSAction::Flag_Enabled);
this->m_action->SetFlags(flags & ~MxDSAction::c_enabled);
}
}
@@ -185,7 +185,7 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
if (!name || strlen(name) == 0) {
switch (p_action.GetType()) {
case MxDSType_Anim:
case MxDSObject::e_anim:
format = ((MxDSAnim&) p_action).GetMediaFormat();
switch (format) {
case FOURCC(' ', 'F', 'L', 'C'):
@@ -197,7 +197,7 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
}
break;
case MxDSType_Sound:
case MxDSObject::e_sound:
format = ((MxDSSound&) p_action).GetMediaFormat();
switch (format) {
case FOURCC(' ', 'M', 'I', 'D'):
@@ -209,17 +209,17 @@ const char* PresenterNameDispatch(const MxDSAction& p_action)
}
break;
case MxDSType_SerialAction:
case MxDSType_ParallelAction:
case MxDSType_SelectAction:
case MxDSObject::e_serialAction:
case MxDSObject::e_parallelAction:
case MxDSObject::e_selectAction:
name = "MxCompositePresenter";
break;
case MxDSType_Event:
case MxDSObject::e_event:
name = "MxEventPresenter";
break;
case MxDSType_Still:
case MxDSObject::e_still:
name = "MxStillPresenter";
break;
}
@@ -252,5 +252,5 @@ MxEntity* MxPresenter::CreateEntity(const char* p_name)
// FUNCTION: LEGO1 0x100b54c0
MxBool MxPresenter::IsEnabled()
{
return this->m_action && this->m_action->GetFlags() & MxDSAction::Flag_Enabled;
return this->m_action && this->m_action->GetFlags() & MxDSAction::c_enabled;
}