Skip to content

Commit

Permalink
Chart Preview Revamp: Remove some left over chart preview logic
Browse files Browse the repository at this point in the history
theres like 2 things ive still left behind at this point and it is on purpose
they allow C++ side SSM to control the music as it normally would alongside Lua if it chooses to override the behavior
things should still work out as they normally would
  • Loading branch information
poco0317 committed Jan 26, 2021
1 parent b5ce723 commit 77abb15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
34 changes: 11 additions & 23 deletions src/Etterna/Screen/Others/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ ScreenSelectMusic::Init()
m_soundOptionsChange.Load(THEME->GetPathS(m_sName, "options"));
m_soundLocked.Load(THEME->GetPathS(m_sName, "locked"));

// Chart Preview.
m_pPreviewNoteField = nullptr;
// Replay Data Manager Reset.
PlayerAI::ResetScoreData();

Expand Down Expand Up @@ -288,14 +286,10 @@ ScreenSelectMusic::CheckBackgroundRequests(bool bForce)
// we need something similar to the previewmusic delay except for charts, so
// 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
if (delayedchartupdatewaiting) {
if (g_ScreenStartedLoadingAt
.Ago() > // not sure if i need the "moving fast" check -mina
SAMPLE_MUSIC_DELAY_INIT) // todo: decoupled this mina
SAMPLE_MUSIC_DELAY_INIT)
{
MESSAGEMAN->Broadcast("DelayedChartUpdate");
delayedchartupdatewaiting = false;
Expand Down Expand Up @@ -354,8 +348,8 @@ ScreenSelectMusic::PlayCurrentSongSampleMusic(bool bForcePlay, bool bForceAccura
// The way music playing works does not cause stutter, but
// will cause inconsistent music playing experience and an overall
// negative feel.
// But if chart preview is active, force it to be synced
PlayParams.bAccurateSync = GAMESTATE->m_bIsChartPreviewActive || bForceAccurate;
// But if chart preview is active, it should probably be synced
PlayParams.bAccurateSync = bForceAccurate;

GameSoundManager::PlayMusicParams FallbackMusic;
FallbackMusic.sFile = m_sLoopMusicPath;
Expand Down Expand Up @@ -1325,12 +1319,8 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector<PlayerNumber>& vpns)
GAMESTATE->SetCompatibleStyle(pSteps->m_StepsType, pn);

if (pSteps) {
if (m_pPreviewNoteField != nullptr) {
GAMESTATE->UpdateSongPosition(pSong->m_fMusicSampleStartSeconds,
*(pSteps->GetTimingData()));
pSteps->GetNoteData(m_PreviewNoteData);
m_pPreviewNoteField->Load(&m_PreviewNoteData, 0, 800);
}
GAMESTATE->UpdateSongPosition(pSong->m_fMusicSampleStartSeconds,
*pSteps->GetTimingData());
delayedchartupdatewaiting = true;
}
}
Expand Down Expand Up @@ -1381,15 +1371,13 @@ ScreenSelectMusic::AfterMusicChange()
GAMESTATE->m_pCurSong.Set(pSong);
if (pSong == nullptr) {
GAMESTATE->m_pCurSteps.Set(nullptr);
if (m_pPreviewNoteField) {
m_pPreviewNoteField->SetVisible(false);
// if previewnotefield is active and we are moving out of a pack
// into the pack list (that's what this block of code is for
// handling) manually call songmans cleanup function (compresses all
// steps); we could optimize by only compressing the pack but this
// is pretty fast anyway -mina
if (b_PreviewNoteFieldIsActive)
// if previewnotefield we are moving out of a pack
// into the pack list (that's what this block of code is for
// handling) manually call songmans cleanup function (compresses all
// steps); we could optimize by only compressing the pack but this
// is pretty fast anyway -mina
SONGMAN->Cleanup();
}
} else {
GAMESTATE->m_pPreferredSong = pSong;
}
Expand Down
3 changes: 0 additions & 3 deletions src/Etterna/Screen/Others/ScreenSelectMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class ScreenSelectMusic : public ScreenWithMenuElements
void PlayCurrentSongSampleMusic(bool bForcePlay,
bool bForceAccurate = false);

NoteData m_PreviewNoteData;
NoteField* m_pPreviewNoteField;

void ChangeSteps(PlayerNumber pn, int dir);
// Lua
void PushSelf(lua_State* L) override;
Expand Down

0 comments on commit 77abb15

Please sign in to comment.