From 2a11fc815b7ae23dfbbb257e145a92ae6a1ce9f0 Mon Sep 17 00:00:00 2001 From: PS Date: Thu, 8 Apr 2021 16:54:50 -1000 Subject: [PATCH] Phrase reception timeout --- src/app/ss_blumen_lumen/blumen_lumen.cpp | 27 ++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index d46c1ec..ede2fb1 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -445,20 +445,25 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) u32 NameLen = CStringLength(Mic.AnimationFileName); phrase_hue NewHue = PhraseHueMap_Get(BLState->PhraseHueMap, NameHash); - if (NewHue.Phrase.Length > 0 && BLState->NextHotHue.Phrase.Length < NewHue.Phrase.Length) + if (NewHue.Phrase.Length > 0) { - PrintF(&DebugStr, "Queuing: %S\n", NewHue.Phrase); - NullTerminate(&DebugStr); - OutputDebugString(DebugStr.Str); - - BLState->NextHotHue = NewHue; - if (SecondsElapsed(BLState->TimePhraseReceptionBegan, - Context->SystemTime_Current) > PhrasePriorityMessageGroupingTime) + bool IsLonger = (BLState->NextHotHue.Phrase.Length < NewHue.Phrase.Length); + bool IsntInPhraseReceptionMode = !BLState->InPhraseReceptionMode; + if (IsLonger || IsntInPhraseReceptionMode) { - BLState->TimePhraseReceptionBegan = Context->SystemTime_Current; - BLState->InPhraseReceptionMode = true; + PrintF(&DebugStr, "Queuing: %S\n", NewHue.Phrase); + NullTerminate(&DebugStr); + OutputDebugString(DebugStr.Str); + + BLState->NextHotHue = NewHue; + if (SecondsElapsed(BLState->TimePhraseReceptionBegan, + Context->SystemTime_Current) > PhrasePriorityMessageGroupingTime) + { + BLState->TimePhraseReceptionBegan = Context->SystemTime_Current; + BLState->InPhraseReceptionMode = true; + } + BLState->TimeLastPhraseReceived = Context->SystemTime_Current; } - BLState->TimeLastPhraseReceived = Context->SystemTime_Current; } }break;