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

View File

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

View File

@ -88,9 +88,7 @@ void MxControlPresenter::ReadyTickle()
{ {
MxPresenter::ParseExtra(); MxPresenter::ParseExtra();
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
ProgressTickleState(TickleState_Repeating);
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Repeating;
} }
// STUB: LEGO1 0x10044640 // 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); m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
ParseExtra(); ParseExtra();
} }
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; ProgressTickleState(TickleState_Starting);
m_currentTickleState = TickleState_Starting;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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