search songs by a genre list
move MenuDir to SSMaster header GoalType name cleanup
This commit is contained in:
@@ -71,8 +71,8 @@ RString CourseEntry::GetTextDescription() const
|
||||
vsEntryDescription.push_back( "Random" );
|
||||
if( !songCriteria.m_sGroupName.empty() )
|
||||
vsEntryDescription.push_back( songCriteria.m_sGroupName );
|
||||
if( !songCriteria.m_sGenre.empty() )
|
||||
vsEntryDescription.push_back( songCriteria.m_sGenre );
|
||||
if( songCriteria.m_bUseSongGenreAllowedList )
|
||||
vsEntryDescription.push_back( join(",",songCriteria.m_vsSongGenreAllowedList) );
|
||||
if( stepsCriteria.m_difficulty != DIFFICULTY_INVALID && stepsCriteria.m_difficulty != DIFFICULTY_MEDIUM )
|
||||
vsEntryDescription.push_back( DifficultyToLocalizedString(stepsCriteria.m_difficulty) );
|
||||
if( stepsCriteria.m_iLowMeter != -1 )
|
||||
|
||||
@@ -54,7 +54,7 @@ void GameCommand::Init()
|
||||
m_vsScreensToPrepare.clear();
|
||||
m_iWeightPounds = -1;
|
||||
m_iGoalCalories = -1;
|
||||
m_GoalType = GOAL_INVALID;
|
||||
m_GoalType = GoalType_INVALID;
|
||||
m_sProfileID = "";
|
||||
m_sUrl = "";
|
||||
|
||||
@@ -129,7 +129,7 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
||||
return false;
|
||||
if( m_iGoalCalories != -1 && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories )
|
||||
return false;
|
||||
if( m_GoalType != GOAL_INVALID && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType )
|
||||
if( m_GoalType != GoalType_INVALID && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType )
|
||||
return false;
|
||||
if( !m_sProfileID.empty() && ProfileManager::m_sDefaultLocalProfileID[pn].Get() != m_sProfileID )
|
||||
return false;
|
||||
@@ -707,7 +707,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
|
||||
if( m_iGoalCalories != -1 )
|
||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||
PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories;
|
||||
if( m_GoalType != GOAL_INVALID )
|
||||
if( m_GoalType != GoalType_INVALID )
|
||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||
PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType;
|
||||
if( !m_sProfileID.empty() )
|
||||
@@ -767,7 +767,7 @@ bool GameCommand::IsZero() const
|
||||
m_SortOrder != SORT_INVALID ||
|
||||
m_iWeightPounds != -1 ||
|
||||
m_iGoalCalories != -1 ||
|
||||
m_GoalType != GOAL_INVALID ||
|
||||
m_GoalType != GoalType_INVALID ||
|
||||
!m_sProfileID.empty() ||
|
||||
!m_sUrl.empty() )
|
||||
return false;
|
||||
|
||||
@@ -197,7 +197,7 @@ XToString( TapNoteScore, NUM_TapNoteScore );
|
||||
TapNoteScore StringToTapNoteScore( const RString &s )
|
||||
{
|
||||
// new style
|
||||
if ( s == "None" ) return TNS_None;
|
||||
if ( s == "None" ) return TNS_None;
|
||||
else if( s == "HitMine" ) return TNS_HitMine;
|
||||
else if( s == "AvoidMine" ) return TNS_AvoidMine;
|
||||
else if( s == "Miss" ) return TNS_Miss;
|
||||
@@ -384,22 +384,12 @@ XToString( StyleType, NUM_STYLE_TYPES );
|
||||
StringToX( StyleType );
|
||||
|
||||
|
||||
static const char *MenuDirNames[] = {
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Auto",
|
||||
};
|
||||
XToString( MenuDir, NUM_MENU_DIRS );
|
||||
|
||||
|
||||
static const char *GoalTypeNames[] = {
|
||||
"Calories",
|
||||
"Time",
|
||||
"None",
|
||||
};
|
||||
XToString( GoalType, NUM_GOAL_TYPES );
|
||||
XToString( GoalType, NUM_GoalType );
|
||||
StringToX( GoalType );
|
||||
static void LuaGoalType(lua_State* L)
|
||||
{
|
||||
|
||||
@@ -387,28 +387,15 @@ const RString& StyleTypeToString( StyleType s );
|
||||
StyleType StringToStyleType( const RString& s );
|
||||
|
||||
|
||||
enum MenuDir
|
||||
{
|
||||
MENU_DIR_UP,
|
||||
MENU_DIR_DOWN,
|
||||
MENU_DIR_LEFT,
|
||||
MENU_DIR_RIGHT,
|
||||
MENU_DIR_AUTO, // when players join and the selection becomes invalid
|
||||
NUM_MENU_DIRS
|
||||
};
|
||||
#define FOREACH_MenuDir( md ) FOREACH_ENUM( MenuDir, NUM_MENU_DIRS, md )
|
||||
const RString& MenuDirToString( MenuDir md );
|
||||
|
||||
|
||||
enum GoalType
|
||||
{
|
||||
GOAL_CALORIES,
|
||||
GOAL_TIME,
|
||||
GOAL_NONE,
|
||||
NUM_GOAL_TYPES,
|
||||
GOAL_INVALID,
|
||||
GoalType_Calories,
|
||||
GoalType_Time,
|
||||
GoalType_None,
|
||||
NUM_GoalType,
|
||||
GoalType_INVALID,
|
||||
};
|
||||
#define FOREACH_GoalType( gt ) FOREACH_ENUM( GoalType, NUM_GOAL_TYPES, gt )
|
||||
#define FOREACH_GoalType( gt ) FOREACH_ENUM( GoalType, NUM_GoalType, gt )
|
||||
const RString& GoalTypeToString( GoalType gt );
|
||||
GoalType StringToGoalType( const RString& s );
|
||||
|
||||
|
||||
@@ -1774,15 +1774,15 @@ float GameState::GetGoalPercentComplete( PlayerNumber pn )
|
||||
float fGoal = 0;
|
||||
switch( pProfile->m_GoalType )
|
||||
{
|
||||
case GOAL_CALORIES:
|
||||
case GoalType_Calories:
|
||||
fActual = pssAccum.fCaloriesBurned + pssCurrent.fCaloriesBurned;
|
||||
fGoal = (float)pProfile->m_iGoalCalories;
|
||||
break;
|
||||
case GOAL_TIME:
|
||||
case GoalType_Time:
|
||||
fActual = ssAccum.fGameplaySeconds + ssCurrent.fGameplaySeconds;
|
||||
fGoal = (float)pProfile->m_iGoalSeconds;
|
||||
break;
|
||||
case GOAL_NONE:
|
||||
case GoalType_None:
|
||||
return 0; // never complete
|
||||
default:
|
||||
ASSERT(0);
|
||||
|
||||
@@ -14,6 +14,15 @@
|
||||
#include "RageSoundManager.h"
|
||||
#include "InputEventPlus.h"
|
||||
|
||||
static const char *MenuDirNames[] = {
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Auto",
|
||||
};
|
||||
XToString( MenuDir, NUM_MenuDir );
|
||||
|
||||
AutoScreenMessage( SM_PlayPostSwitchPage )
|
||||
|
||||
RString CURSOR_OFFSET_X_FROM_ICON_NAME( size_t p ) { return ssprintf("CursorP%dOffsetXFromIcon",int(p+1)); }
|
||||
@@ -42,7 +51,7 @@ void ScreenSelectMaster::Init()
|
||||
PER_CHOICE_ICON_ELEMENT.Load( m_sName, "PerChoiceIconElement" );
|
||||
PRE_SWITCH_PAGE_SECONDS.Load( m_sName, "PreSwitchPageSeconds" );
|
||||
POST_SWITCH_PAGE_SECONDS.Load( m_sName, "PostSwitchPageSeconds" );
|
||||
OPTION_ORDER.Load( m_sName, OPTION_ORDER_NAME, NUM_MENU_DIRS );
|
||||
OPTION_ORDER.Load( m_sName, OPTION_ORDER_NAME, NUM_MenuDir );
|
||||
WRAP_CURSOR.Load( m_sName, "WrapCursor" );
|
||||
WRAP_SCROLLER.Load( m_sName, "WrapScroller" );
|
||||
LOOP_SCROLLER.Load( m_sName, "LoopScroller" );
|
||||
@@ -202,8 +211,8 @@ void ScreenSelectMaster::Init()
|
||||
int add;
|
||||
switch( dir )
|
||||
{
|
||||
case MENU_DIR_UP:
|
||||
case MENU_DIR_LEFT:
|
||||
case MenuDir_Up:
|
||||
case MenuDir_Left:
|
||||
add = -1;
|
||||
break;
|
||||
default:
|
||||
@@ -212,8 +221,8 @@ void ScreenSelectMaster::Init()
|
||||
}
|
||||
|
||||
m_mapCurrentChoiceToNextChoice[dir][c] = c + add;
|
||||
/* Always wrap around MENU_DIR_AUTO. */
|
||||
if( dir == MENU_DIR_AUTO || (bool)WRAP_CURSOR )
|
||||
/* Always wrap around MenuDir_Auto. */
|
||||
if( dir == MenuDir_Auto || (bool)WRAP_CURSOR )
|
||||
wrap( m_mapCurrentChoiceToNextChoice[dir][c], m_aGameCommands.size() );
|
||||
else
|
||||
m_mapCurrentChoiceToNextChoice[dir][c] = clamp( m_mapCurrentChoiceToNextChoice[dir][c], 0, (int)m_aGameCommands.size()-1 );
|
||||
@@ -349,7 +358,7 @@ void ScreenSelectMaster::UpdateSelectableChoices()
|
||||
*/
|
||||
FOREACH_HumanPlayer( p )
|
||||
if( !m_aGameCommands[m_iChoice[p]].IsPlayable() )
|
||||
Move( p, MENU_DIR_AUTO );
|
||||
Move( p, MenuDir_Auto );
|
||||
}
|
||||
|
||||
bool ScreenSelectMaster::AnyOptionsArePlayable() const
|
||||
@@ -399,7 +408,7 @@ void ScreenSelectMaster::MenuLeft( const InputEventPlus &input )
|
||||
if( m_TrackingRepeatingInput != input.MenuI )
|
||||
return;
|
||||
}
|
||||
if( Move(pn, MENU_DIR_LEFT) )
|
||||
if( Move(pn, MenuDir_Left) )
|
||||
{
|
||||
m_TrackingRepeatingInput = input.MenuI;
|
||||
m_soundChange.Play();
|
||||
@@ -422,7 +431,7 @@ void ScreenSelectMaster::MenuRight( const InputEventPlus &input )
|
||||
if( m_TrackingRepeatingInput != input.MenuI )
|
||||
return;
|
||||
}
|
||||
if( Move(pn, MENU_DIR_RIGHT) )
|
||||
if( Move(pn, MenuDir_Right) )
|
||||
{
|
||||
m_TrackingRepeatingInput = input.MenuI;
|
||||
m_soundChange.Play();
|
||||
@@ -445,7 +454,7 @@ void ScreenSelectMaster::MenuUp( const InputEventPlus &input )
|
||||
if( m_TrackingRepeatingInput != input.MenuI )
|
||||
return;
|
||||
}
|
||||
if( Move(pn, MENU_DIR_UP) )
|
||||
if( Move(pn, MenuDir_Up) )
|
||||
{
|
||||
m_TrackingRepeatingInput = input.MenuI;
|
||||
m_soundChange.Play();
|
||||
@@ -468,7 +477,7 @@ void ScreenSelectMaster::MenuDown( const InputEventPlus &input )
|
||||
if( m_TrackingRepeatingInput != input.MenuI )
|
||||
return;
|
||||
}
|
||||
if( Move(pn, MENU_DIR_DOWN) )
|
||||
if( Move(pn, MenuDir_Down) )
|
||||
{
|
||||
m_TrackingRepeatingInput = input.MenuI;
|
||||
m_soundChange.Play();
|
||||
@@ -607,7 +616,7 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
|
||||
{
|
||||
// HACK: We can't tell from the option orders whether or not we wrapped.
|
||||
// For now, assume that the order is increasing left to right.
|
||||
int iPressedDir = (dir == MENU_DIR_LEFT) ? -1 : +1;
|
||||
int iPressedDir = (dir == MenuDir_Left) ? -1 : +1;
|
||||
int iActualDir = (iOldChoice < iNewChoice) ? +1 : -1;
|
||||
|
||||
if( iPressedDir != iActualDir ) // wrapped
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
#include "ActorScroller.h"
|
||||
#include "MenuInput.h"
|
||||
|
||||
enum MenuDir
|
||||
{
|
||||
MenuDir_Up,
|
||||
MenuDir_Down,
|
||||
MenuDir_Left,
|
||||
MenuDir_Right,
|
||||
MenuDir_Auto, // when players join and the selection becomes invalid
|
||||
NUM_MenuDir,
|
||||
};
|
||||
#define FOREACH_MenuDir( md ) FOREACH_ENUM( MenuDir, NUM_MenuDir, md )
|
||||
const RString& MenuDirToString( MenuDir md );
|
||||
|
||||
class ScreenSelectMaster : public ScreenSelect
|
||||
{
|
||||
public:
|
||||
@@ -57,7 +69,7 @@ protected:
|
||||
ThemeMetric<int> SCROLLER_SUBDIVISIONS;
|
||||
ThemeMetric<RString> DEFAULT_CHOICE;
|
||||
|
||||
map<int,int> m_mapCurrentChoiceToNextChoice[NUM_MENU_DIRS];
|
||||
map<int,int> m_mapCurrentChoiceToNextChoice[NUM_MenuDir];
|
||||
|
||||
virtual int GetSelectionIndex( PlayerNumber pn );
|
||||
virtual void UpdateSelectableChoices();
|
||||
|
||||
@@ -19,8 +19,13 @@ bool SongCriteria::Matches( const Song *pSong ) const
|
||||
{
|
||||
if( !m_sGroupName.empty() && m_sGroupName != pSong->m_sGroupName )
|
||||
return false;
|
||||
if( !m_sGenre.empty() && m_sGenre != pSong->m_sGenre )
|
||||
return false;
|
||||
|
||||
if( m_bUseSongGenreAllowedList )
|
||||
{
|
||||
if( find(m_vsSongGenreAllowedList.begin(),m_vsSongGenreAllowedList.end(),pSong->m_sGenre) == m_vsSongGenreAllowedList.end() )
|
||||
return false;
|
||||
}
|
||||
|
||||
switch( m_Selectable )
|
||||
{
|
||||
DEFAULT_FAIL(m_Selectable);
|
||||
@@ -35,13 +40,16 @@ bool SongCriteria::Matches( const Song *pSong ) const
|
||||
case Selectable_DontCare:
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_bUseSongAllowedList )
|
||||
{
|
||||
if( find(m_vpSongAllowedList.begin(),m_vpSongAllowedList.end(),pSong) == m_vpSongAllowedList.end() )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_iStagesForSong != -1 && SONGMAN->GetNumStagesForSong(pSong) != m_iStagesForSong )
|
||||
return false;
|
||||
|
||||
switch( m_Tutorial )
|
||||
{
|
||||
DEFAULT_FAIL(m_Tutorial);
|
||||
@@ -56,6 +64,7 @@ bool SongCriteria::Matches( const Song *pSong ) const
|
||||
case Tutorial_DontCare:
|
||||
break;
|
||||
}
|
||||
|
||||
switch( m_Locked )
|
||||
{
|
||||
DEFAULT_FAIL(m_Locked);
|
||||
|
||||
@@ -15,7 +15,8 @@ class SongCriteria
|
||||
{
|
||||
public:
|
||||
RString m_sGroupName; // "" means don't match
|
||||
RString m_sGenre; // "" means don't match
|
||||
bool m_bUseSongGenreAllowedList;
|
||||
vector<RString> m_vsSongGenreAllowedList;
|
||||
enum Selectable { Selectable_Yes, Selectable_No, Selectable_DontCare } m_Selectable;
|
||||
bool m_bUseSongAllowedList;
|
||||
vector<Song*> m_vpSongAllowedList;
|
||||
@@ -25,6 +26,7 @@ public:
|
||||
|
||||
SongCriteria()
|
||||
{
|
||||
m_bUseSongGenreAllowedList = false;
|
||||
m_Selectable = Selectable_DontCare;
|
||||
m_bUseSongAllowedList = false;
|
||||
m_iStagesForSong = -1;
|
||||
|
||||
Reference in New Issue
Block a user