From 23022b8613791885beac56eba46ba4ed03feca4b Mon Sep 17 00:00:00 2001 From: "born a rick, raised a morty, died a jerry" Date: Sun, 25 Nov 2018 03:01:30 -0500 Subject: [PATCH] hand over more chartpreview music control to lua --- .../wifeTwirl.lua | 3 ++ src/ScreenSelectMusic.cpp | 28 +++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua index 6c284fa9c6..b86b0c429d 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua @@ -31,6 +31,9 @@ local t = if song ~= bong then song = bong self:queuecommand("MortyFarts") + if noteField and mcbootlarder:GetChild("NoteField"):GetVisible() and song then + song:Borp() + end end if getTabIndex() == 0 then if heyiwasusingthat and GAMESTATE:GetCurrentSong() and noteField then -- these can prolly be wrapped better too -mina diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index a1902da0d6..81de78fb75 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -316,9 +316,9 @@ ScreenSelectMusic::CheckBackgroundRequests(bool bForce) // heavy duty chart specific operations can be delayed when scrolling (chord // density graph, possibly chart leaderboards, etc) -mina - // in theory the notedata load for chartpreviews could go here however a delay - // might make it weird when swapping between difficulties to compare sections - // for which you would want instantaneous action -mina + // in theory the notedata load for chartpreviews could go here however a + // delay might make it weird when swapping between difficulties to compare + // sections for which you would want instantaneous action -mina if (delayedchartupdatewaiting) { if (g_ScreenStartedLoadingAt .Ago() > // not sure if i need the "moving fast" check -mina @@ -365,18 +365,8 @@ ScreenSelectMusic::CheckBackgroundRequests(bool bForce) // the notefield is not visible when the // previewmusic starts i.e. when the general tab // is not active when a song is switched -mina - auto song = GAMESTATE->m_pCurSong; - if (song == nullptr) - return; - - PlayParams.sFile = song->GetMusicPath(); - PlayParams.fLengthSeconds = - song->GetLastSecond() - m_fSampleStartSeconds + 2.f; - if (PlayParams.fLengthSeconds < 3.f) { // if the songpreview is after the last note - PlayParams.fStartSecond = 5.f; // chartpreview wont play, just set it near the start -mina - PlayParams.fLengthSeconds = song->GetLastSecond() + 2.f; - } - + return; + MESSAGEMAN->Broadcast("PlayingSampleMusic"); } SOUND->PlayMusic(PlayParams, FallbackMusic); @@ -1003,7 +993,8 @@ ScreenSelectMusic::HandleMessage(const Message& msg) } m_iSelection[pn] = iSel; - Steps* pSteps = m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; + Steps* pSteps = + m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; GAMESTATE->m_pCurSteps[pn].Set(pSteps); } @@ -1287,10 +1278,11 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector& vpns) CLAMP(m_iSelection[pn], 0, m_vpSteps.size() - 1); Song* pSong = GAMESTATE->m_pCurSong; - Steps* pSteps = m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; + Steps* pSteps = + m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; GAMESTATE->m_pCurSteps[pn].Set(pSteps); - if (pSteps != nullptr) + if (pSteps != nullptr) GAMESTATE->SetCompatibleStyle(pSteps->m_StepsType, pn); int iScore = 0;