Replace tickle code

This commit is contained in:
Christian Semmler 2024-01-11 09:51:39 -05:00
parent af071b5e40
commit 2fa32c0382
17 changed files with 47 additions and 93 deletions

View File

@ -19,8 +19,7 @@ void LegoActionControlPresenter::ReadyTickle()
if (chunk) {
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
m_subscriber->DestroyChunk(chunk);
if (m_compositePresenter) {
@ -47,8 +46,7 @@ void LegoActionControlPresenter::RepeatingTickle()
#else
InvokeAction(m_unk0x50, MxAtomId(m_unk0x54.GetData(), LookupMode_LowerCase2), m_unk0x64, NULL);
#endif
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
ProgressTickleState(TickleState_Done);
}
}

View File

@ -123,8 +123,7 @@ void MxCompositeMediaPresenter::StartingTickle()
}
if (!m_unk0x4c) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
ProgressTickleState(TickleState_Streaming);
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
}
@ -138,8 +137,7 @@ MxResult MxCompositeMediaPresenter::Tickle()
switch (m_currentTickleState) {
case TickleState_Ready:
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
case TickleState_Starting:
StartingTickle();
break;

View File

@ -88,9 +88,7 @@ void MxControlPresenter::ReadyTickle()
{
MxPresenter::ParseExtra();
TickleManager()->UnregisterClient(this);
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
ProgressTickleState(TickleState_Repeating);
}
// STUB: LEGO1 0x10044640

View File

@ -69,8 +69,7 @@ void LegoEntityPresenter::ReadyTickle()
m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
ParseExtra();
}
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
}

View File

@ -95,8 +95,7 @@ void LegoWorldPresenter::ReadyTickle()
}
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
// FUNCTION: LEGO1 0x10066ac0
@ -116,8 +115,7 @@ void LegoWorldPresenter::StartingTickle()
}
}
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
ProgressTickleState(TickleState_Streaming);
}
// STUB: LEGO1 0x10067a70

View File

@ -76,8 +76,8 @@ void LegoPalettePresenter::ReadyTickle()
if (chunk) {
if (chunk->GetTime() <= m_action->GetElapsedTime()) {
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
chunk = m_subscriber->NextChunk();
MxResult result = ParsePalette(chunk);
m_subscriber->DestroyChunk(chunk);

View File

@ -20,10 +20,8 @@ void MxLoopingMIDIPresenter::StreamingTickle()
return;
}
if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
}
if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime())
ProgressTickleState(TickleState_Done);
}
// FUNCTION: LEGO1 0x100c2ae0

View File

@ -52,8 +52,7 @@ void MxMIDIPresenter::ReadyTickle()
if (chunk) {
m_subscriber->DestroyChunk(chunk);
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
}
@ -62,19 +61,15 @@ void MxMIDIPresenter::StartingTickle()
{
MxStreamChunk* chunk = CurrentChunk();
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
}
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime())
ProgressTickleState(TickleState_Streaming);
}
// FUNCTION: LEGO1 0x100c2910
void MxMIDIPresenter::StreamingTickle()
{
if (m_chunk) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
}
if (m_chunk)
ProgressTickleState(TickleState_Done);
else
m_chunk = NextChunk();
}

View File

@ -118,8 +118,7 @@ void MxWavePresenter::ReadyTickle()
memcpy(m_waveFormat, chunk->GetData(), chunk->GetLength());
m_subscriber->DestroyChunk(chunk);
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
}
@ -170,8 +169,7 @@ void MxWavePresenter::StartingTickle()
}
else {
SetVolume(((MxDSSound*) m_action)->GetVolume());
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
ProgressTickleState(TickleState_Streaming);
}
}
}

View File

@ -221,8 +221,7 @@ void MxCompositePresenter::VTable0x60(MxPresenter* p_presenter)
// FUNCTION: LEGO1 0x100b6bc0
void MxCompositePresenter::SetTickleState(TickleState p_tickleState)
{
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = p_tickleState;
ProgressTickleState(p_tickleState);
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
MxPresenter* presenter = *it;

View File

@ -65,8 +65,7 @@ MxStreamChunk* MxMediaPresenter::CurrentChunk()
m_subscriber->NextChunk();
m_subscriber->DestroyChunk(chunk);
chunk = NULL;
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
ProgressTickleState(TickleState_Done);
}
}
@ -85,8 +84,7 @@ MxStreamChunk* MxMediaPresenter::NextChunk()
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Bit7);
m_subscriber->DestroyChunk(chunk);
chunk = NULL;
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
ProgressTickleState(TickleState_Done);
}
}
@ -183,8 +181,7 @@ void MxMediaPresenter::StreamingTickle()
if (m_currentChunk->GetFlags() & MxDSChunk::Flag_End) {
m_subscriber->DestroyChunk(m_currentChunk);
m_currentChunk = NULL;
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
ProgressTickleState(TickleState_Repeating);
}
else if (m_action->GetFlags() & MxDSAction::Flag_Looping) {
LoopChunk(m_currentChunk);
@ -208,16 +205,12 @@ void MxMediaPresenter::RepeatingTickle()
if (m_currentChunk) {
MxLong time = m_currentChunk->GetTime();
if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_unk5;
}
if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount())
ProgressTickleState(TickleState_unk5);
}
else {
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_unk5;
}
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration())
ProgressTickleState(TickleState_unk5);
}
}
}

View File

@ -47,8 +47,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];
this->m_previousTickleStates |= 1 << (unsigned char) previousTickleState;
this->m_currentTickleState = TickleState_Ready;
ProgressTickleState(TickleState_Ready);
return SUCCESS;
}

View File

@ -71,8 +71,7 @@ void MxEventPresenter::ReadyTickle()
CopyData(chunk);
m_subscriber->DestroyChunk(chunk);
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
}
@ -81,10 +80,8 @@ void MxEventPresenter::StartingTickle()
{
MxStreamChunk* chunk = NextChunk();
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
}
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime())
ProgressTickleState(TickleState_Streaming);
}
// FUNCTION: LEGO1 0x100c2ef0

View File

@ -40,10 +40,8 @@ void MxLoopingFlcPresenter::NextFrame()
{
MxStreamChunk* chunk = NextChunk();
if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
}
if (chunk->GetFlags() & MxDSChunk::Flag_End)
ProgressTickleState(TickleState_Repeating);
else {
LoadFrame(chunk);
LoopChunk(chunk);

View File

@ -51,10 +51,8 @@ void MxLoopingSmkPresenter::NextFrame()
{
MxStreamChunk* chunk = NextChunk();
if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
}
if (chunk->GetFlags() & MxDSChunk::Flag_End)
ProgressTickleState(TickleState_Repeating);
else {
LoadFrame(chunk);
LoopChunk(chunk);
@ -67,10 +65,8 @@ void MxLoopingSmkPresenter::NextFrame()
// FUNCTION: LEGO1 0x100b4a90
void MxLoopingSmkPresenter::VTable0x8c()
{
if (m_action->GetDuration() < m_elapsedDuration) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_unk5;
}
if (m_action->GetDuration() < m_elapsedDuration)
ProgressTickleState(TickleState_unk5);
else {
MxStreamChunk* chunk;
m_loopingChunkCursor->Current(chunk);

View File

@ -121,8 +121,7 @@ void MxStillPresenter::StreamingTickle()
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) {
m_chunkTime = chunk->GetTime();
NextFrame();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
ProgressTickleState(TickleState_Repeating);
if (m_action->GetDuration() == -1 && m_compositePresenter)
m_compositePresenter->VTable0x60(this);
@ -133,10 +132,8 @@ void MxStillPresenter::StreamingTickle()
void MxStillPresenter::RepeatingTickle()
{
if (m_action->GetDuration() != -1) {
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_unk5;
}
if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration())
ProgressTickleState(TickleState_unk5);
}
}

View File

@ -182,8 +182,7 @@ void MxVideoPresenter::NextFrame()
if (chunk->GetFlags() & MxDSChunk::Flag_End) {
m_subscriber->DestroyChunk(chunk);
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
ProgressTickleState(TickleState_Repeating);
}
else {
LoadFrame(chunk);
@ -400,8 +399,7 @@ void MxVideoPresenter::ReadyTickle()
LoadHeader(chunk);
m_subscriber->DestroyChunk(chunk);
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
ProgressTickleState(TickleState_Starting);
}
}
@ -412,8 +410,7 @@ void MxVideoPresenter::StartingTickle()
if (chunk && m_action->GetElapsedTime() >= chunk->GetTime()) {
CreateBitmap();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
ProgressTickleState(TickleState_Streaming);
}
}
@ -504,15 +501,11 @@ void MxVideoPresenter::Unk5Tickle()
if (m_unk0x60 == -1)
m_unk0x60 = m_action->GetElapsedTime();
if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime()) {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
}
}
else {
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
if (m_action->GetElapsedTime() >= m_unk0x60 + ((MxDSMediaAction*) m_action)->GetSustainTime())
ProgressTickleState(TickleState_Done);
}
else
ProgressTickleState(TickleState_Done);
}
}