Two of the CodeDetector codes referenced Frieza's old MusicBannerWheel, which is not in use anymore. I have repurposed these to be Next/Previous group, a la Pump it Up. The metrics have been changed to reflect this. Also changed an assert message to be more useful in NoteField.cpp

This commit is contained in:
AJ Kelly
2010-02-22 00:47:31 -06:00
parent 9045d04356
commit 01137a22f5
8 changed files with 118 additions and 39 deletions
+2 -2
View File
@@ -209,8 +209,8 @@ NextTheme2="MenuLeft,MenuLeft,MenuLeft,MenuRight,MenuRight,MenuRight,MenuLeft,Me
NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right" NextAnnouncer="Left,Left,Right,Right,Left,Left,Right,Right"
NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight" NextAnnouncer2="MenuLeft,MenuLeft,MenuRight,MenuRight,MenuLeft,MenuLeft,MenuRight,MenuRight"
# Various. # Various.
NextBannerGroup="MenuUp,MenuRight,MenuRight" NextGroup="MenuUp,MenuRight,MenuRight"
NextBannerGroup2="MenuUp,MenuDown,MenuUp,MenuDown" PrevGroup="MenuUp,MenuDown,MenuUp,MenuDown"
Hidden="" Hidden=""
RandomVanish="" RandomVanish=""
SaveScreenshot1="MenuLeft-MenuRight" SaveScreenshot1="MenuLeft-MenuRight"
+9 -4
View File
@@ -45,8 +45,8 @@ const char *CodeNames[] = {
"NextTheme2", "NextTheme2",
"NextAnnouncer", "NextAnnouncer",
"NextAnnouncer2", "NextAnnouncer2",
"NextBannerGroup", "NextGroup",
"NextBannerGroup2", "PrevGroup",
"SaveScreenshot1", "SaveScreenshot1",
"SaveScreenshot2", "SaveScreenshot2",
"CancelAllPlayerOptions", "CancelAllPlayerOptions",
@@ -76,9 +76,14 @@ void CodeDetector::RefreshCacheItems( RString sClass )
} }
} }
bool CodeDetector::EnteredNextBannerGroup( GameController controller ) bool CodeDetector::EnteredNextGroup( GameController controller )
{ {
return EnteredCode(controller,CODE_BW_NEXT_GROUP) || EnteredCode(controller,CODE_BW_NEXT_GROUP2); return EnteredCode(controller,CODE_NEXT_GROUP);
}
bool CodeDetector::EnteredPrevGroup( GameController controller )
{
return EnteredCode(controller,CODE_PREV_GROUP);
} }
bool CodeDetector::EnteredPrevSteps( GameController controller ) bool CodeDetector::EnteredPrevSteps( GameController controller )
+5 -4
View File
@@ -39,8 +39,8 @@ enum Code {
CODE_NEXT_THEME2, CODE_NEXT_THEME2,
CODE_NEXT_ANNOUNCER, CODE_NEXT_ANNOUNCER,
CODE_NEXT_ANNOUNCER2, CODE_NEXT_ANNOUNCER2,
CODE_BW_NEXT_GROUP, CODE_NEXT_GROUP,
CODE_BW_NEXT_GROUP2, CODE_PREV_GROUP,
CODE_SAVE_SCREENSHOT1, CODE_SAVE_SCREENSHOT1,
CODE_SAVE_SCREENSHOT2, CODE_SAVE_SCREENSHOT2,
CODE_CANCEL_ALL_PLAYER_OPTIONS, CODE_CANCEL_ALL_PLAYER_OPTIONS,
@@ -58,9 +58,10 @@ public:
static bool EnteredModeMenu( GameController controller ); static bool EnteredModeMenu( GameController controller );
static bool DetectAndAdjustMusicOptions( GameController controller ); static bool DetectAndAdjustMusicOptions( GameController controller );
static bool EnteredCode( GameController controller, Code code ); static bool EnteredCode( GameController controller, Code code );
static bool EnteredNextBannerGroup( GameController controller ); static bool EnteredPrevGroup( GameController controller );
static bool EnteredNextGroup( GameController controller );
// move to PlayerOptions.h -aj // todo: move to PlayerOptions.h -aj
void ChangeScrollSpeed( GameController controller, bool bIncrement ); void ChangeScrollSpeed( GameController controller, bool bIncrement );
}; };
+71 -26
View File
@@ -127,7 +127,6 @@ void MusicWheel::BeginScreen()
} }
} }
WheelBase::BeginScreen(); WheelBase::BeginScreen();
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() ) if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
@@ -139,14 +138,14 @@ void MusicWheel::BeginScreen()
GAMESTATE->m_SortOrder.Set( GAMESTATE->m_PreferredSortOrder ); GAMESTATE->m_SortOrder.Set( GAMESTATE->m_PreferredSortOrder );
/* Never start in the mode menu; some elements may not initialize correctly. */ // Never start in the mode menu; some elements may not initialize correctly.
if( GAMESTATE->m_SortOrder == SORT_MODE_MENU ) if( GAMESTATE->m_SortOrder == SORT_MODE_MENU )
GAMESTATE->m_SortOrder.Set( SortOrder_Invalid ); GAMESTATE->m_SortOrder.Set( SortOrder_Invalid );
GAMESTATE->m_SortOrder.Set( ForceAppropriateSort(GAMESTATE->m_PlayMode, GAMESTATE->m_SortOrder) ); GAMESTATE->m_SortOrder.Set( ForceAppropriateSort(GAMESTATE->m_PlayMode, GAMESTATE->m_SortOrder) );
/* Only save the sort order if the player didn't already have one. If he did, don't /* Only save the sort order if the player didn't already have one.
* overwrite it. */ * If he did, don't overwrite it. */
if( GAMESTATE->m_PreferredSortOrder == SortOrder_Invalid ) if( GAMESTATE->m_PreferredSortOrder == SortOrder_Invalid )
GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder; GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder;
@@ -350,22 +349,21 @@ void MusicWheel::GetSongList( vector<Song*> &arraySongs, SortOrder so )
if( iLocked & LOCKED_DISABLED ) if( iLocked & LOCKED_DISABLED )
continue; continue;
/* If we're on an extra stage, and this song is selected, ignore #SELECTABLE. */ // If we're on an extra stage, and this song is selected, ignore #SELECTABLE.
if( pSong != GAMESTATE->m_pCurSong || !GAMESTATE->IsAnExtraStage() ) if( pSong != GAMESTATE->m_pCurSong || !GAMESTATE->IsAnExtraStage() )
{ {
/* Hide songs that asked to be hidden via #SELECTABLE. */ // Hide songs that asked to be hidden via #SELECTABLE.
if( iLocked & LOCKED_SELECTABLE ) if( iLocked & LOCKED_SELECTABLE )
continue; continue;
if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE ) if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE )
continue; continue;
} }
/* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette and Random, /* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette
* too. */ * and Random, too. */
if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && iLocked ) if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && iLocked )
continue; continue;
if( PREFSMAN->m_bOnlyPreferredDifficulties ) if( PREFSMAN->m_bOnlyPreferredDifficulties )
{ {
// if the song has steps that fit the preferred difficulty of the default player // if the song has steps that fit the preferred difficulty of the default player
@@ -382,8 +380,8 @@ void MusicWheel::GetSongList( vector<Song*> &arraySongs, SortOrder so )
} }
/* Hack: Add extra stage item if it was eliminated for any reason (eg. it's a long /* Hack: Add extra stage item if it was eliminated for any reason
* song). */ * (eg. it's a long song). */
if( GAMESTATE->IsAnExtraStage() ) if( GAMESTATE->IsAnExtraStage() )
{ {
Song* pSong; Song* pSong;
@@ -766,9 +764,7 @@ void MusicWheel::UpdateSwitch()
m_iSelection = 0; m_iSelection = 0;
//
// Select the previously selected item // Select the previously selected item
//
switch( GAMESTATE->m_SortOrder ) switch( GAMESTATE->m_SortOrder )
{ {
default: default:
@@ -780,9 +776,8 @@ void MusicWheel::UpdateSwitch()
break; break;
} }
// // Change difficulty for sorts by meter
// Change difficulty for sorts by meter - XXX: do this with GameCommand? // XXX: do this with GameCommand?
//
StepsType st; StepsType st;
Difficulty dc; Difficulty dc;
if( SongUtil::GetStepsTypeAndDifficultyFromSortOrder( GAMESTATE->m_SortOrder, st, dc ) ) if( SongUtil::GetStepsTypeAndDifficultyFromSortOrder( GAMESTATE->m_SortOrder, st, dc ) )
@@ -819,7 +814,7 @@ void MusicWheel::UpdateSwitch()
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
m_fLockedWheelVelocity = 0; m_fLockedWheelVelocity = 0;
/* Send this again so the screen starts sample music. */ // Send this again so the screen starts sample music.
SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 ); SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
} }
else else
@@ -855,7 +850,7 @@ void MusicWheel::ChangeMusic( int iDist )
SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 ); SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
/* If we're moving automatically, don't play this; it'll be called in Update. */ // If we're moving automatically, don't play this; it'll be called in Update.
if(!IsMoving()) if(!IsMoving())
m_soundChangeMusic.Play(); m_soundChangeMusic.Play();
} }
@@ -867,7 +862,7 @@ bool MusicWheel::ChangeSort( SortOrder new_so ) // return true if change success
if( GAMESTATE->m_SortOrder == new_so ) if( GAMESTATE->m_SortOrder == new_so )
return false; return false;
/* Don't change to SORT_MODE_MENU if it doesn't have at least two choices. */ // Don't change to SORT_MODE_MENU if it doesn't have at least two choices.
if( new_so == SORT_MODE_MENU && m_WheelItemDatas[new_so].size() < 2 ) if( new_so == SORT_MODE_MENU && m_WheelItemDatas[new_so].size() < 2 )
return false; return false;
@@ -886,7 +881,7 @@ bool MusicWheel::ChangeSort( SortOrder new_so ) // return true if change success
TweenOffScreenForSort(); TweenOffScreenForSort();
/* Save the new preference. */ // Save the new preference.
if( IsSongSort(new_so) ) if( IsSongSort(new_so) )
GAMESTATE->m_PreferredSortOrder = new_so; GAMESTATE->m_PreferredSortOrder = new_so;
GAMESTATE->m_SortOrder.Set( new_so ); GAMESTATE->m_SortOrder.Set( new_so );
@@ -1001,7 +996,7 @@ void MusicWheel::StartRandom()
* game into picking a locked song, so pick from SORT_ROULETTE. */ * game into picking a locked song, so pick from SORT_ROULETTE. */
if( RANDOM_PICKS_LOCKED_SONGS ) if( RANDOM_PICKS_LOCKED_SONGS )
{ {
/* Shuffle and use the roulette wheel. */ // Shuffle and use the roulette wheel.
RandomGen rnd; RandomGen rnd;
random_shuffle( m_WheelItemDatas[SORT_ROULETTE].begin(), m_WheelItemDatas[SORT_ROULETTE].end(), rnd ); random_shuffle( m_WheelItemDatas[SORT_ROULETTE].begin(), m_WheelItemDatas[SORT_ROULETTE].end(), rnd );
GAMESTATE->m_SortOrder.Set( SORT_ROULETTE ); GAMESTATE->m_SortOrder.Set( SORT_ROULETTE );
@@ -1067,9 +1062,7 @@ void MusicWheel::SetOpenSection( RString group )
} }
//
// Try to select the item that was selected before changing groups // Try to select the item that was selected before changing groups
//
m_iSelection = 0; m_iSelection = 0;
for( unsigned i=0; i<m_CurWheelItemData.size(); i++ ) for( unsigned i=0; i<m_CurWheelItemData.size(); i++ )
@@ -1084,7 +1077,59 @@ void MusicWheel::SetOpenSection( RString group )
RebuildWheelItems(); RebuildWheelItems();
} }
/* Called on late join. Selectable courses may have changed; reopen the section. */ // sm-ssc additions: jump to group
RString MusicWheel::JumpToNextGroup()
{
unsigned int iLastSelection = m_iSelection;
for( unsigned int i = m_iSelection; i < m_CurWheelItemData.size(); ++i )
{
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection )
{
m_iSelection = i;
return m_CurWheelItemData[i]->m_sText;
}
}
// it should not get down here, but it might happen... only search up to
// the previous selection.
for( unsigned int i = 0; i < iLastSelection; ++i )
{
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection )
{
m_iSelection = i;
return m_CurWheelItemData[i]->m_sText;
}
}
// and this would be el bad:
return "";
}
RString MusicWheel::JumpToPrevGroup()
{
for( unsigned int i = m_iSelection; i > 0; --i )
{
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection )
{
m_iSelection = i;
return m_CurWheelItemData[i]->m_sText;
}
}
// in case it wasn't found above:
for( unsigned int i = m_CurWheelItemData.size()-1; i > 0; --i )
{
LOG->Trace( ssprintf("JumpToPrevGroup iteration 2 | i = %u",i) );
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION )
{
m_iSelection = i;
LOG->Trace( ssprintf("finding it in #2 | i = %u | text = %s",i, m_CurWheelItemData[i]->m_sText.c_str()) );
return m_CurWheelItemData[i]->m_sText;
}
}
LOG->Trace("NO I'M NOT OK!!!");
// and this would be el bad:
return "";
}
// Called on late join. Selectable courses may have changed; reopen the section.
void MusicWheel::PlayerJoined() void MusicWheel::PlayerJoined()
{ {
SetOpenSection( m_sExpandedSectionName ); SetOpenSection( m_sExpandedSectionName );
@@ -1141,8 +1186,8 @@ Song *MusicWheel::GetPreferredSelectionForRandomOrPortal()
#define NUM_PROBES 1000 #define NUM_PROBES 1000
for( int i=0; i<NUM_PROBES; i++ ) for( int i=0; i<NUM_PROBES; i++ )
{ {
/* Maintaining difficulties is higher priority than maintaining the current /* Maintaining difficulties is higher priority than maintaining
* group. */ * the current group. */
if( i == NUM_PROBES/4 ) if( i == NUM_PROBES/4 )
sPreferredGroup = ""; sPreferredGroup = "";
if( i == NUM_PROBES/2 ) if( i == NUM_PROBES/2 )
+3
View File
@@ -44,6 +44,9 @@ public:
virtual void ChangeMusic( int dist ); /* +1 or -1 */ //CHECK THIS virtual void ChangeMusic( int dist ); /* +1 or -1 */ //CHECK THIS
void FinishChangingSorts(); void FinishChangingSorts();
void PlayerJoined(); void PlayerJoined();
// sm-ssc additions
RString JumpToNextGroup();
RString JumpToPrevGroup();
protected: protected:
MusicWheelItem *MakeItem(); MusicWheelItem *MakeItem();
+2 -1
View File
@@ -178,7 +178,8 @@ void NoteField::Load(
// The note skin may have changed at the beginning of a new course song. // The note skin may have changed at the beginning of a new course song.
map<RString, NoteDisplayCols *>::iterator it = m_NoteDisplays.find( m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin ); map<RString, NoteDisplayCols *>::iterator it = m_NoteDisplays.find( m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin );
ASSERT_M( it != m_NoteDisplays.end(), m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin ); ASSERT_M( it != m_NoteDisplays.end(),
ssprintf("Player noteskin: %s", m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin.c_str()) );
m_pCurDisplay = it->second; m_pCurDisplay = it->second;
memset( m_pDisplays, 0, sizeof(m_pDisplays) ); memset( m_pDisplays, 0, sizeof(m_pDisplays) );
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
+24
View File
@@ -664,6 +664,30 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
MESSAGEMAN->Broadcast( "SongOptionsChanged" ); MESSAGEMAN->Broadcast( "SongOptionsChanged" );
} }
else if( CodeDetector::EnteredNextGroup(input.GameI.controller) )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
{
RString sNewGroup = m_MusicWheel.JumpToNextGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
AfterMusicChange();
}
}
else if( CodeDetector::EnteredPrevGroup(input.GameI.controller) )
{
if( GAMESTATE->IsAnExtraStageAndSelectionLocked() )
m_soundLocked.Play();
else
{
RString sNewGroup = m_MusicWheel.JumpToPrevGroup();
m_MusicWheel.SelectSection(sNewGroup);
m_MusicWheel.SetOpenSection(sNewGroup);
AfterMusicChange();
}
}
else else
{ {
return false; return false;
+1 -1
View File
@@ -77,7 +77,7 @@ protected:
int m_iSwitchesLeftInSpinDown; int m_iSwitchesLeftInSpinDown;
float m_fLockedWheelVelocity; float m_fLockedWheelVelocity;
/* 0 = none; -1 or 1 = up/down */ // 0 = none; -1 or 1 = up/down
int m_Moving; int m_Moving;
RageTimer m_MovingSoundTimer; RageTimer m_MovingSoundTimer;
float m_TimeBeforeMovingBegins; float m_TimeBeforeMovingBegins;