Skip to content

Commit

Permalink
hand over more chartpreview music control to lua
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Nov 25, 2018
1 parent decdc66 commit 23022b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 10 additions & 18 deletions src/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1287,10 +1278,11 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector<PlayerNumber>& 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;
Expand Down

0 comments on commit 23022b8

Please sign in to comment.