Skip to content

Commit

Permalink
Set SelectMusic DifferentialReload to not reset current wheel position
Browse files Browse the repository at this point in the history
side effect: if hovering a non-song (group, sort) it will open it but not do anything else
  • Loading branch information
poco0317 committed Jun 20, 2020
1 parent d947841 commit 2a7c41a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Etterna/Actor/Menus/MusicWheel.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* MusicWheel - A wheel with song names used in the Select Music screen. */
/* MusicWheel - A wheel with song names used in the Select Music screen. */

#ifndef MUSIC_WHEEL_H
#define MUSIC_WHEEL_H
Expand Down Expand Up @@ -65,6 +65,8 @@ class MusicWheel : public WheelBase

vector<Song*> allSongsFiltered;
map<RString, vector<Song*>> allSongsByGroupFiltered;
bool SelectSongOrCourse();
void SelectSongAfterSearch();

// Lua
void PushSelf(lua_State* L) override;
Expand All @@ -74,7 +76,6 @@ class MusicWheel : public WheelBase

vector<string> hashList;
void GetSongList(vector<Song*>& arraySongs, SortOrder so);
bool SelectSongOrCourse();
bool SelectModeMenuItem();

void FilterByStepKeys(vector<Song*>& inv);
Expand Down Expand Up @@ -139,7 +140,6 @@ class MusicWheel : public WheelBase
void FilterWheelItemDatas(vector<MusicWheelItemData*>& aUnFilteredDatas,
vector<MusicWheelItemData*>& aFilteredData,
SortOrder so);
void SelectSongAfterSearch();
RString prevSongTitle;
};

Expand Down
11 changes: 11 additions & 0 deletions src/Etterna/Actor/Menus/WheelBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ WheelBase::Select() // return true if this selection can end the screen
}
}

RString
WheelBase::GetCurrentGroup()
{
// current hovering a group
if (m_CurWheelItemData[m_iSelection]->m_Type == WheelItemDataType_Section)
return m_CurWheelItemData[m_iSelection]->m_sText;
else
// currently within a group
return m_sExpandedSectionName;
}

WheelItemBaseData*
WheelBase::GetItem(unsigned int iIndex)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Etterna/Actor/Menus/WheelBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class WheelBase : public ActorFrame

virtual bool Select(); // return true if this selection can end the screen

RString GetCurrentGroup();

WheelState GetWheelState() { return m_WheelState; }
void Lock() { m_WheelState = STATE_LOCKED; }
bool WheelIsLocked()
Expand Down
23 changes: 20 additions & 3 deletions src/Etterna/Screen/Others/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,26 @@ ScreenSelectMusic::OpenOptions()
}
void
ScreenSelectMusic::DifferentialReload()
{
SONGMAN->DifferentialReload();
m_MusicWheel.ReloadSongList(false, "");
{
// reload songs
SONGMAN->DifferentialReload();

auto selSong = GAMESTATE->m_pCurSong;
auto currentHoveredGroup = m_MusicWheel.GetCurrentGroup();

// reset wheel
m_MusicWheel.ReloadSongList(false, "");

// place selection on the last song we were on
// or fall back to section in case no song selected
// (forces the section to open if so)
if (selSong != nullptr)
m_MusicWheel.SelectSongOrCourse();
else {
m_MusicWheel.SelectSection(currentHoveredGroup);
m_MusicWheel.SetOpenSection(currentHoveredGroup);
}

}

bool
Expand Down

0 comments on commit 2a7c41a

Please sign in to comment.