Two part can be cancelled with menuup/down, todo: make it a metric

This commit is contained in:
Alberto Ramos
2010-07-26 13:09:56 -06:00
parent b55a57f2a9
commit 3653da83c6
4 changed files with 129 additions and 30 deletions
+8 -1
View File
@@ -724,7 +724,10 @@ UseSectionsWithPreferredGroup=false
RouletteSwitchSeconds=0.05
RouletteSlowDownSwitches=5
LockedInitialVelocity=15
#
OnlyShowActiveSection=true
RemindWheelPositions=true
#
ScrollBarHeight=300
ScrollBarOnCommand=visible,false
#
@@ -1767,6 +1770,10 @@ ChangeStepsWithGameButtons=false
PreviousDifficultyButton="MenuUp"
NextDifficultyButton="MenuDown"
#
ChangeGroupsWithGameButtoms=false
PreviousDifficultyButton="MenuUp"
NextDifficultyButton="MenuDown"
#
TwoPartSelection=false
TwoPartConfirmsOnly=false
TwoPartTimerSeconds=15
+54 -9
View File
@@ -80,11 +80,12 @@ void MusicWheel::Load( RString sType )
SHOW_EASY_FLAG .Load(sType,"UseEasyMarkerFlag");
USE_SECTIONS_WITH_PREFERRED_GROUP .Load(sType,"UseSectionsWithPreferredGroup");
HIDE_INACTIVE_SECTIONS .Load(sType,"OnlyShowActiveSection");
REMIND_WHEEL_POSITIONS .Load(sType,"RemindWheelPositions");
vector<RString> vsModeChoiceNames;
split( MODE_MENU_CHOICE_NAMES, ",", vsModeChoiceNames );
CHOICE .Load(sType,CHOICE_NAME,vsModeChoiceNames);
SECTION_COLORS .Load(sType,SECTION_COLORS_NAME,NUM_SECTION_COLORS);
WheelBase::Load( sType );
SONGMAN->UpdateRankingCourses();
@@ -193,6 +194,20 @@ void MusicWheel::BeginScreen()
SetOpenSection("");
}
if( REMIND_WHEEL_POSITIONS && HIDE_INACTIVE_SECTIONS )
{
// store the group song index, run this also here because it forgets the current position when
// not changing the song if you came back from gameplay or your last round song (profiles)
// is not the first one in the group.
for( unsigned idx = 0 ; idx < m_viWheelPositions.size() ; idx++ )
{
if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(idx) )
{
m_viWheelPositions[idx] = m_iSelection;
}
}
}
// rebuild the WheelItems that appear on screen
RebuildWheelItems();
}
@@ -897,6 +912,18 @@ void MusicWheel::ChangeMusic( int iDist )
m_iSelection += iDist;
wrap( m_iSelection, m_CurWheelItemData.size() );
if( REMIND_WHEEL_POSITIONS && HIDE_INACTIVE_SECTIONS )
{
// store the group song index
for( unsigned idx = 0 ; idx < m_viWheelPositions.size() ; idx++ )
{
if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(idx) )
{
m_viWheelPositions[idx] = m_iSelection;
}
}
}
RebuildWheelItems( iDist );
m_fPositionOffsetFromSelection += iDist;
@@ -1076,6 +1103,10 @@ void MusicWheel::SetOpenSection( RString group )
//LOG->Trace( "SetOpenSection %s", group.c_str() );
m_sExpandedSectionName = group;
// wheel positions = num song groups
if ( REMIND_WHEEL_POSITIONS && HIDE_INACTIVE_SECTIONS )
m_viWheelPositions.resize( SONGMAN->GetNumSongGroups() );
const WheelItemBaseData *old = NULL;
if( !m_CurWheelItemData.empty() )
old = GetCurWheelItemData(m_iSelection);
@@ -1114,16 +1145,29 @@ void MusicWheel::SetOpenSection( RString group )
m_CurWheelItemData.push_back(&d);
}
// Try to select the item that was selected before changing groups
m_iSelection = 0;
for( unsigned i=0; i<m_CurWheelItemData.size(); i++ )
//restore the past group song index
if( REMIND_WHEEL_POSITIONS && HIDE_INACTIVE_SECTIONS )
{
if( m_CurWheelItemData[i] == old )
for( unsigned idx = 0 ; idx < m_viWheelPositions.size() ; idx++ )
{
m_iSelection=i;
break;
if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(idx) )
{
m_iSelection = m_viWheelPositions[idx];
}
}
}
else
{
// Try to select the item that was selected before changing groups
m_iSelection = 0;
for( unsigned i=0; i<m_CurWheelItemData.size(); i++ )
{
if( m_CurWheelItemData[i] == old )
{
m_iSelection=i;
break;
}
}
}
@@ -1136,6 +1180,7 @@ RString MusicWheel::JumpToNextGroup()
// Thanks to Juanelote for this logic:
if( HIDE_INACTIVE_SECTIONS )
{
//todo: make it work with other sort types
unsigned iNumGroups = SONGMAN->GetNumSongGroups();
for(unsigned i = 0 ; i < iNumGroups ; i++)
+2
View File
@@ -87,6 +87,8 @@ protected:
// sm-ssc additions:
ThemeMetric<bool> USE_SECTIONS_WITH_PREFERRED_GROUP;
ThemeMetric<bool> HIDE_INACTIVE_SECTIONS;
ThemeMetric<bool> REMIND_WHEEL_POSITIONS;
vector <int> m_viWheelPositions;
};
#endif
+65 -20
View File
@@ -635,7 +635,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
// yeah, wanted this since a while ago... -DaisuMaster
if( CHANGE_STEPS_WITH_GAME_BUTTONS )
{
// avoid anything not being just press (read: release or repeat/hold)
// Avoid any event not being first press
if( input.type != IET_FIRST_PRESS )
return;
@@ -657,8 +657,8 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
}
}
}
// Most likely a copypasta of the previous addition -DaisuMaster
// Actually I don't like to just copy and paste code because it may go wrong
// if something goes overlooked -DaisuMaster
if( CHANGE_GROUPS_WITH_GAME_BUTTONS )
{
if( input.type != IET_FIRST_PRESS)
@@ -672,14 +672,14 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
m_soundLocked.Play();
else
{
// for real: copypasta
RString sNewGroup = m_MusicWheel.JumpToPrevGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("PreviousGroup");
AfterMusicChange();
}
}
if(input.MenuI == m_GameButtonNextGroup )
else if(input.MenuI == m_GameButtonNextGroup )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
@@ -688,6 +688,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
RString sNewGroup = m_MusicWheel.JumpToNextGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("NextGroup");
AfterMusicChange();
}
}
@@ -723,8 +724,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
m_MusicWheel.ChangeMusicUnlessLocked( +1 );
}
}
// added an entry for difficulty change with
// gamebuttons -DaisuMaster
// added an entry for difficulty change with gamebuttons -DaisuMaster
else if( input.MenuI == m_GameButtonPreviousDifficulty )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
@@ -747,28 +747,70 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
ChangeSteps( input.pn, +1);
}
}
// added also for groupchanges
else if(input.MenuI == m_GameButtonPreviousGroup )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
{
RString sNewGroup = m_MusicWheel.JumpToPrevGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("PreviousGroup");
AfterMusicChange();
}
}
else if(input.MenuI == m_GameButtonNextGroup )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
{
RString sNewGroup = m_MusicWheel.JumpToNextGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("NextGroup");
AfterMusicChange();
}
}
}
}
else
{
if( m_SelectionState == SelectionState_SelectingSteps &&
input.type == IET_FIRST_PRESS &&
(input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong) &&
!m_bStepsChosen[input.pn] )
if( m_SelectionState == SelectionState_SelectingSteps && input.type == IET_FIRST_PRESS && !m_bStepsChosen[input.pn] )
{
if( input.MenuI == m_GameButtonPreviousSong )
if( input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
ChangeSteps( input.pn, -1 );
if( input.MenuI == m_GameButtonPreviousSong )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
ChangeSteps( input.pn, -1 );
}
else if( input.MenuI == m_GameButtonNextSong )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
ChangeSteps( input.pn, +1 );
}
}
else if( input.MenuI == m_GameButtonNextSong )
else if( input.MenuI == GAME_BUTTON_MENUUP || input.MenuI == GAME_BUTTON_MENUDOWN ) // && TWO_PART_DESELECTS_WITH_MENUUPDOWN
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
ChangeSteps( input.pn, +1 );
{
Message msg("SongUnchosen");
msg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( msg );
//unset all steps
FOREACH_ENUM( PlayerNumber , p )
m_bStepsChosen[p] = false;
m_SelectionState = SelectionState_SelectingSong;
}
}
}
}
@@ -828,6 +870,7 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
RString sNewGroup = m_MusicWheel.JumpToNextGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("PreviousGroup");
AfterMusicChange();
}
}
@@ -840,6 +883,7 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
RString sNewGroup = m_MusicWheel.JumpToPrevGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
MESSAGEMAN->Broadcast("NextGroup");
AfterMusicChange();
}
}
@@ -1407,7 +1451,8 @@ void ScreenSelectMusic::MenuBack( const InputEventPlus &input )
{
// Handle unselect song (ffff)
// todo: this isn't right at all. -aj
if( m_SelectionState == SelectionState_SelectingSteps && !m_bStepsChosen[input.pn] && input.MenuI == GAME_BUTTON_BACK && input.type == IET_FIRST_PRESS )
// temporal: deactivating this for the time being -DaisuMaster
/*if( m_SelectionState == SelectionState_SelectingSteps && !m_bStepsChosen[input.pn] && input.MenuI == GAME_BUTTON_BACK && input.type == IET_FIRST_PRESS )
{
// if a player has chosen their steps already, don't unchoose song.
FOREACH_HumanPlayer( p )
@@ -1419,7 +1464,7 @@ void ScreenSelectMusic::MenuBack( const InputEventPlus &input )
MESSAGEMAN->Broadcast( msg );
m_SelectionState = SelectionState_SelectingSong;
return;
}
}*/
m_BackgroundLoader.Abort();