[default -> loading window] Trying to keep up the best I can.
This commit is contained in:
+23
-2
@@ -163,18 +163,39 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
||||
// infer entry::Type from the first param
|
||||
// todo: make sure these aren't generating bogus entries due
|
||||
// to a lack of songs. -aj
|
||||
int iNumSongs = SONGMAN->GetNumSongs();
|
||||
LOG->Trace("[CourseLoaderCRS] sParams[1] = %s",sParams[1].c_str());
|
||||
// most played
|
||||
if( sParams[1].Left(strlen("BEST")) == "BEST" )
|
||||
{
|
||||
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||
int iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||
if( iChooseIndex > iNumSongs )
|
||||
{
|
||||
// looking up a song that doesn't exist.
|
||||
LOG->UserLog( "Course file", sPath, "is trying to load BEST%i with only %i songs installed. "
|
||||
"This entry will be ignored.", iChooseIndex, iNumSongs);
|
||||
out.m_bIncomplete = true;
|
||||
continue; // skip this #SONG
|
||||
}
|
||||
|
||||
new_entry.iChooseIndex = iChooseIndex;
|
||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||
new_entry.songSort = SongSort_MostPlays;
|
||||
}
|
||||
// least played
|
||||
else if( sParams[1].Left(strlen("WORST")) == "WORST" )
|
||||
{
|
||||
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1;
|
||||
int iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||
if( iChooseIndex > iNumSongs )
|
||||
{
|
||||
// looking up a song that doesn't exist.
|
||||
LOG->UserLog( "Course file", sPath, "is trying to load WORST%i with only %i songs installed. "
|
||||
"This entry will be ignored.", iChooseIndex, iNumSongs);
|
||||
out.m_bIncomplete = true;
|
||||
continue; // skip this #SONG
|
||||
}
|
||||
|
||||
new_entry.iChooseIndex = iChooseIndex;
|
||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||
new_entry.songSort = SongSort_FewestPlays;
|
||||
}
|
||||
|
||||
+2
-10
@@ -1405,12 +1405,8 @@ RString MusicWheel::JumpToNextGroup()
|
||||
|
||||
for(unsigned i = 0 ; i < iNumGroups ; i++)
|
||||
{
|
||||
RString sCurSongGroup = SONGMAN->GetSongGroupByIndex(i);
|
||||
|
||||
if( m_sExpandedSectionName == sCurSongGroup )
|
||||
if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(i) )
|
||||
{
|
||||
if( SONGMAN->GetSongsOfCurrentGame(sCurSongGroup).size() == 0 ) continue;
|
||||
|
||||
if ( i < iNumGroups - 1 )
|
||||
return SONGMAN->GetSongGroupByIndex(i+1);
|
||||
else
|
||||
@@ -1455,12 +1451,8 @@ RString MusicWheel::JumpToPrevGroup()
|
||||
|
||||
for(unsigned i = 0 ; i < iNumGroups ; i++)
|
||||
{
|
||||
RString sCurSongGroup = SONGMAN->GetSongGroupByIndex(i);
|
||||
|
||||
if( m_sExpandedSectionName == sCurSongGroup )
|
||||
if( m_sExpandedSectionName == SONGMAN->GetSongGroupByIndex(i) )
|
||||
{
|
||||
if( SONGMAN->GetSongsOfCurrentGame(sCurSongGroup).size() == 0 ) continue;
|
||||
|
||||
if ( i > 0 )
|
||||
return SONGMAN->GetSongGroupByIndex(i-1);
|
||||
else
|
||||
|
||||
@@ -78,6 +78,7 @@ void SMLoader::LoadFromTokens(
|
||||
out.m_StepsType = GAMEMAN->StringToStepsType( sStepsType );
|
||||
out.SetDescription( sDescription );
|
||||
out.SetCredit( sDescription ); // this is often used for both.
|
||||
out.SetChartName(sDescription); // yeah, one more for good measure.
|
||||
out.SetDifficulty( StringToDifficulty(sDifficulty) );
|
||||
|
||||
// Handle hacks that originated back when StepMania didn't have
|
||||
|
||||
@@ -145,7 +145,6 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache )
|
||||
{
|
||||
LOG->Trace( "Song::LoadFromSSCFile(%s)", sPath.c_str() );
|
||||
@@ -446,6 +445,10 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
}
|
||||
case GETTING_STEP_INFO:
|
||||
{
|
||||
if (sValueName == "CHARTNAME")
|
||||
{
|
||||
pNewNotes->SetChartName(sParams[1]);
|
||||
}
|
||||
if( sValueName=="STEPSTYPE" )
|
||||
{
|
||||
pNewNotes->m_StepsType = GAMEMAN->StringToStepsType( sParams[1] );
|
||||
@@ -458,6 +461,11 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
|
||||
else if( sValueName=="DESCRIPTION" )
|
||||
{
|
||||
if (out.m_fVersion < VERSION_CHART_NAME_TAG)
|
||||
{
|
||||
pNewNotes->SetChartName(sParams[1]);
|
||||
}
|
||||
// TODO: Make this the else clause?
|
||||
pNewNotes->SetDescription( sParams[1] );
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ const float VERSION_WARP_SEGMENT = 0.56f;
|
||||
const float VERSION_SPLIT_TIMING = 0.7f;
|
||||
/** @brief The version that moved the step's Offset higher up. */
|
||||
const float VERSION_OFFSET_BEFORE_ATTACK = 0.72f;
|
||||
/** @brief The version that introduced the Chart Name tag. */
|
||||
const float VERSION_CHART_NAME_TAG = 0.74f;
|
||||
|
||||
/**
|
||||
* @brief The SSCLoader handles all of the parsing needed for .ssc files.
|
||||
|
||||
@@ -226,7 +226,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in )
|
||||
GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName, SmEscape(in.GetDescription()).c_str()) );
|
||||
lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" );
|
||||
lines.push_back( ssprintf( " %s:", GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName ) );
|
||||
RString desc = (USE_CREDIT ? in.GetCredit() : in.GetDescription());
|
||||
RString desc = (USE_CREDIT ? in.GetCredit() : in.GetChartName());
|
||||
lines.push_back( ssprintf( " %s:", SmEscape(desc).c_str() ) );
|
||||
lines.push_back( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) );
|
||||
lines.push_back( ssprintf( " %d:", in.GetMeter() ) );
|
||||
|
||||
@@ -302,6 +302,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
|
||||
lines.push_back( ssprintf("//---------------%s - %s----------------",
|
||||
GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName, SmEscape(in.GetDescription()).c_str()) );
|
||||
lines.push_back( "#NOTEDATA:;" ); // our new separator.
|
||||
lines.push_back( ssprintf( "#CHARTNAME:%s:", SmEscape(in.GetChartName()).c_str()));
|
||||
lines.push_back( ssprintf( "#STEPSTYPE:%s;", GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName ) );
|
||||
lines.push_back( ssprintf( "#DESCRIPTION:%s;", SmEscape(in.GetDescription()).c_str() ) );
|
||||
lines.push_back( ssprintf( "#CHARTSTYLE:%s;", SmEscape(in.GetChartStyle()).c_str() ) );
|
||||
|
||||
+35
-12
@@ -600,6 +600,7 @@ static MenuDef g_StepsInformation(
|
||||
"ScreenMiniMenuStepsInformation",
|
||||
MenuRowDef( ScreenEdit::difficulty, "Difficulty", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::meter, "Meter", true, EditMode_Practice, true, false, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::chartname, "Chart Name", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::description, "Description", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::chartstyle, "Chart Style", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
MenuRowDef( ScreenEdit::step_credit, "Step Author", true, EditMode_Practice, true, true, 0, NULL ),
|
||||
@@ -1121,6 +1122,7 @@ static LocalizedString NOTES("ScreenEdit", "%s notes");
|
||||
static LocalizedString SELECTION_BEAT("ScreenEdit", "Selection beat");
|
||||
static LocalizedString DIFFICULTY("ScreenEdit", "Difficulty");
|
||||
static LocalizedString ROUTINE_PLAYER("ScreenEdit", "Routine Player");
|
||||
static LocalizedString CHART_NAME("ScreenEdit", "Chart Name");
|
||||
static LocalizedString DESCRIPTION("ScreenEdit", "Description");
|
||||
static LocalizedString CHART_STYLE("ScreenEdit", "Chart Style");
|
||||
static LocalizedString STEP_AUTHOR("ScreenEdit", "Step Author");
|
||||
@@ -1151,6 +1153,7 @@ static ThemeMetric<RString> SELECTION_BEAT_UNFINISHED_FORMAT("ScreenEdit", "Sele
|
||||
static ThemeMetric<RString> SELECTION_BEAT_END_FORMAT("ScreenEdit", "SelectionBeatEndFormat");
|
||||
static ThemeMetric<RString> DIFFICULTY_FORMAT("ScreenEdit", "DifficultyFormat");
|
||||
static ThemeMetric<RString> ROUTINE_PLAYER_FORMAT("ScreenEdit", "RoutinePlayerFormat");
|
||||
static ThemeMetric<RString> CHART_NAME_FORMAT("ScreenEdit", "ChartNameFormat");
|
||||
static ThemeMetric<RString> DESCRIPTION_FORMAT("ScreenEdit", "DescriptionFormat");
|
||||
static ThemeMetric<RString> CHART_STYLE_FORMAT("ScreenEdit", "ChartStyleFormat");
|
||||
static ThemeMetric<RString> STEP_AUTHOR_FORMAT("ScreenEdit", "StepAuthorFormat");
|
||||
@@ -1222,7 +1225,8 @@ void ScreenEdit::UpdateTextInfo()
|
||||
sText += ssprintf( DIFFICULTY_FORMAT.GetValue(), DIFFICULTY.GetValue().c_str(), DifficultyToString( m_pSteps->GetDifficulty() ).c_str() );
|
||||
if ( m_InputPlayerNumber != PLAYER_INVALID )
|
||||
sText += ssprintf( ROUTINE_PLAYER_FORMAT.GetValue(), ROUTINE_PLAYER.GetValue().c_str(), m_InputPlayerNumber + 1 );
|
||||
sText += ssprintf( DESCRIPTION_FORMAT.GetValue(), DESCRIPTION.GetValue().c_str(), m_pSteps->GetDescription().c_str() );
|
||||
//sText += ssprintf( DESCRIPTION_FORMAT.GetValue(), DESCRIPTION.GetValue().c_str(), m_pSteps->GetDescription().c_str() );
|
||||
sText += ssprintf( CHART_NAME_FORMAT.GetValue(), CHART_NAME.GetValue().c_str(), m_pSteps->GetChartName().c_str() );
|
||||
sText += ssprintf( STEP_AUTHOR_FORMAT.GetValue(), STEP_AUTHOR.GetValue().c_str(), m_pSteps->GetCredit().c_str() );
|
||||
//sText += ssprintf( CHART_STYLE_FORMAT.GetValue(), CHART_STYLE.GetValue().c_str(), m_pSteps->GetChartStyle().c_str() );
|
||||
sText += ssprintf( MAIN_TITLE_FORMAT.GetValue(), MAIN_TITLE.GetValue().c_str(), m_pSong->m_sMainTitle.c_str() );
|
||||
@@ -3385,6 +3389,12 @@ static void ChangeDescription( const RString &sNew )
|
||||
pSteps->SetDescription(sNew);
|
||||
}
|
||||
|
||||
static void ChangeChartName( const RString &sNew )
|
||||
{
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
pSteps->SetChartName(sNew);
|
||||
}
|
||||
|
||||
static void ChangeChartStyle( const RString &sNew )
|
||||
{
|
||||
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
@@ -3657,6 +3667,8 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
g_StepsInformation.rows[meter].SetOneUnthemedChoice( ssprintf("%d", pSteps->GetMeter()) );
|
||||
g_StepsInformation.rows[meter].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Home);
|
||||
g_StepsInformation.rows[predict_meter].SetOneUnthemedChoice( ssprintf("%.2f",pSteps->PredictMeter()) );
|
||||
g_StepsInformation.rows[chartname].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
g_StepsInformation.rows[chartname].SetOneUnthemedChoice(pSteps->GetChartName());
|
||||
g_StepsInformation.rows[description].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
g_StepsInformation.rows[description].SetOneUnthemedChoice( pSteps->GetDescription() );
|
||||
g_StepsInformation.rows[chartstyle].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
@@ -4253,6 +4265,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
|
||||
}
|
||||
|
||||
static LocalizedString ENTER_NEW_DESCRIPTION( "ScreenEdit", "Enter a new description." );
|
||||
static LocalizedString ENTER_NEW_CHART_NAME("ScreenEdit", "Enter a new chart name.");
|
||||
static LocalizedString ENTER_NEW_CHART_STYLE( "ScreenEdit", "Enter a new chart style." );
|
||||
static LocalizedString ENTER_NEW_STEP_AUTHOR( "ScreenEdit", "Enter the author who made this step pattern." );
|
||||
static LocalizedString ENTER_NEW_METER( "ScreenEdit", "Enter a new meter." );
|
||||
@@ -4264,17 +4277,27 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
|
||||
|
||||
switch( c )
|
||||
{
|
||||
case description:
|
||||
ScreenTextEntry::TextEntry(
|
||||
SM_None,
|
||||
ENTER_NEW_DESCRIPTION,
|
||||
m_pSteps->GetDescription(),
|
||||
MAX_STEPS_DESCRIPTION_LENGTH,
|
||||
SongUtil::ValidateCurrentStepsDescription,
|
||||
ChangeDescription,
|
||||
NULL
|
||||
);
|
||||
break;
|
||||
case chartname:
|
||||
{
|
||||
ScreenTextEntry::TextEntry(SM_None,
|
||||
ENTER_NEW_CHART_NAME,
|
||||
m_pSteps->GetChartName(),
|
||||
MAX_STEPS_DESCRIPTION_LENGTH,
|
||||
SongUtil::ValidateCurrentStepsChartName,
|
||||
ChangeChartName,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
case description:
|
||||
{
|
||||
ScreenTextEntry::TextEntry(SM_None,
|
||||
ENTER_NEW_DESCRIPTION,
|
||||
m_pSteps->GetDescription(),
|
||||
MAX_STEPS_DESCRIPTION_LENGTH,
|
||||
SongUtil::ValidateCurrentStepsDescription,
|
||||
ChangeDescription,NULL);
|
||||
break;
|
||||
}
|
||||
case chartstyle:
|
||||
ScreenTextEntry::TextEntry(
|
||||
SM_None,
|
||||
|
||||
+3
-2
@@ -503,8 +503,9 @@ public:
|
||||
|
||||
enum StepsInformationChoice
|
||||
{
|
||||
difficulty,
|
||||
meter,
|
||||
difficulty, /**< What is the difficulty of this chart? */
|
||||
meter, /**< What is the numerical rating of this chart? */
|
||||
chartname, /**< What is the name of this chart? */
|
||||
description, /**< What is the description of this chart? */
|
||||
chartstyle, /**< How is this chart meant to be played? */
|
||||
step_credit, /**< Who wrote this individual chart? */
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
* @brief The internal version of the cache for StepMania.
|
||||
*
|
||||
* Increment this value to invalidate the current cache. */
|
||||
const int FILE_CACHE_VERSION = 187;
|
||||
const int FILE_CACHE_VERSION = 188;
|
||||
|
||||
/** @brief How long does a song sample last by default? */
|
||||
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
||||
|
||||
+1
-9
@@ -20,7 +20,7 @@ void FixupPath( RString &path, const RString &sSongPath );
|
||||
RString GetSongAssetPath( RString sPath, const RString &sSongPath );
|
||||
|
||||
/** @brief The version of the .ssc file format. */
|
||||
const static float STEPFILE_VERSION_NUMBER = 0.73f;
|
||||
const static float STEPFILE_VERSION_NUMBER = 0.74f;
|
||||
|
||||
/** @brief How many edits for this song can each profile have? */
|
||||
const int MAX_EDITS_PER_SONG_PER_PROFILE = 15;
|
||||
@@ -39,14 +39,6 @@ enum BackgroundLayer
|
||||
BACKGROUND_LAYER_Invalid
|
||||
};
|
||||
|
||||
/** @brief The different ways of displaying the BPM. */
|
||||
enum DisplayBPM
|
||||
{
|
||||
DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */
|
||||
DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */
|
||||
DISPLAY_BPM_RANDOM /**< Display a random selection of BPMs. */
|
||||
};
|
||||
|
||||
/** @brief A custom foreach loop for the different background layers. */
|
||||
#define FOREACH_BackgroundLayer( bl ) FOREACH_ENUM( BackgroundLayer, bl )
|
||||
|
||||
|
||||
@@ -749,6 +749,22 @@ bool SongUtil::IsEditDescriptionUnique( const Song* pSong, StepsType st, const R
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SongUtil::IsChartNameUnique( const Song* pSong, StepsType st, const RString &name, const Steps *pExclude )
|
||||
{
|
||||
FOREACH_CONST( Steps*, pSong->GetAllSteps(), s )
|
||||
{
|
||||
Steps *pSteps = *s;
|
||||
|
||||
if( pSteps->m_StepsType != st )
|
||||
continue;
|
||||
if( pSteps == pExclude )
|
||||
continue;
|
||||
if( pSteps->GetChartName() == name )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, const RString &sPreferredDescription )
|
||||
{
|
||||
if( IsEditDescriptionUnique( pSong, st, sPreferredDescription, NULL ) )
|
||||
@@ -772,8 +788,11 @@ RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, co
|
||||
}
|
||||
|
||||
static LocalizedString YOU_MUST_SUPPLY_NAME ( "SongUtil", "You must supply a name for your new edit." );
|
||||
static LocalizedString CHART_NAME_CONFLICTS ("SongUtil", "The name you chose conflicts with another chart. Please use a different name.");
|
||||
static LocalizedString EDIT_NAME_CONFLICTS ( "SongUtil", "The name you chose conflicts with another edit. Please use a different name." );
|
||||
static LocalizedString CHART_NAME_CANNOT_CONTAIN ("SongUtil", "The chart name cannot contain any of the following characters: %s" );
|
||||
static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "SongUtil", "The edit name cannot contain any of the following characters: %s" );
|
||||
|
||||
bool SongUtil::ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut )
|
||||
{
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
@@ -833,6 +852,31 @@ bool SongUtil::ValidateCurrentStepsDescription( const RString &sAnswer, RString
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SongUtil::ValidateCurrentStepsChartName(const RString &answer, RString &error)
|
||||
{
|
||||
if (answer.empty()) return true;
|
||||
|
||||
static const RString sInvalidChars = "\\/:*?\"<>|";
|
||||
if( strpbrk(answer, sInvalidChars) != NULL )
|
||||
{
|
||||
error = ssprintf( CHART_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't allow duplicate title names within the same StepsType.
|
||||
* We need some way of identifying the unique charts. */
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
|
||||
if (pSteps->GetChartName() == answer) return true;
|
||||
|
||||
// TODO next commit: borrow code from EditStepsDescription.
|
||||
bool result = SongUtil::IsChartNameUnique(GAMESTATE->m_pCurSong, pSteps->m_StepsType,
|
||||
answer, pSteps);
|
||||
if (!result)
|
||||
error = CHART_NAME_CONFLICTS;
|
||||
return result;
|
||||
}
|
||||
|
||||
static LocalizedString AUTHOR_NAME_CANNOT_CONTAIN( "SongUtil", "The step author's name cannot contain any of the following characters: %s" );
|
||||
|
||||
bool SongUtil::ValidateCurrentStepsCredit( const RString &sAnswer, RString &sErrorOut )
|
||||
|
||||
@@ -159,10 +159,12 @@ namespace SongUtil
|
||||
* @return true if it is unique, false otherwise.
|
||||
*/
|
||||
bool IsEditDescriptionUnique( const Song* pSong, StepsType st, const RString &sPreferredDescription, const Steps *pExclude );
|
||||
bool IsChartNameUnique( const Song* pSong, StepsType st, const RString &name, const Steps *pExclude );
|
||||
RString MakeUniqueEditDescription( const Song* pSong, StepsType st, const RString &sPreferredDescription );
|
||||
bool ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
||||
bool ValidateCurrentStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
||||
bool ValidateCurrentStepsCredit( const RString &sAnswer, RString &sErrorOut );
|
||||
bool ValidateCurrentStepsChartName(const RString &answer, RString &error);
|
||||
|
||||
void GetAllSongGenres( vector<RString> &vsOut );
|
||||
/**
|
||||
|
||||
+61
-1
@@ -34,12 +34,29 @@ Steps::Steps(): m_StepsType(StepsType_Invalid),
|
||||
m_sDescription(""), m_sChartStyle(""),
|
||||
m_Difficulty(Difficulty_Invalid), m_iMeter(0),
|
||||
m_bAreCachedRadarValuesJustLoaded(false),
|
||||
m_sCredit("") {}
|
||||
m_sCredit(""), displayBPMType(DISPLAY_BPM_ACTUAL),
|
||||
specifiedBPMMin(0), specifiedBPMMax(0) {}
|
||||
|
||||
Steps::~Steps()
|
||||
{
|
||||
}
|
||||
|
||||
void Steps::GetDisplayBpms( DisplayBpms &AddTo ) const
|
||||
{
|
||||
if( this->GetDisplayBPM() == DISPLAY_BPM_SPECIFIED )
|
||||
{
|
||||
AddTo.Add( this->GetMinBPM() );
|
||||
AddTo.Add( this->GetMaxBPM() );
|
||||
}
|
||||
else
|
||||
{
|
||||
float fMinBPM, fMaxBPM;
|
||||
this->m_Timing.GetActualBPM( fMinBPM, fMaxBPM );
|
||||
AddTo.Add( fMinBPM );
|
||||
AddTo.Add( fMaxBPM );
|
||||
}
|
||||
}
|
||||
|
||||
bool Steps::HasAttacks() const
|
||||
{
|
||||
return !this->m_Attacks.empty();
|
||||
@@ -507,6 +524,44 @@ public:
|
||||
lua_pushstring( L, out );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetChartName(T *p, lua_State *L)
|
||||
{
|
||||
lua_pushstring(L, p->GetChartName());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetDisplayBpms( T* p, lua_State *L )
|
||||
{
|
||||
DisplayBpms temp;
|
||||
p->GetDisplayBpms(temp);
|
||||
float fMin = temp.GetMin();
|
||||
float fMax = temp.GetMax();
|
||||
vector<float> fBPMs;
|
||||
fBPMs.push_back( fMin );
|
||||
fBPMs.push_back( fMax );
|
||||
LuaHelpers::CreateTableFromArray(fBPMs, L);
|
||||
return 1;
|
||||
}
|
||||
static int IsDisplayBpmSecret( T* p, lua_State *L )
|
||||
{
|
||||
DisplayBpms temp;
|
||||
p->GetDisplayBpms(temp);
|
||||
lua_pushboolean( L, temp.IsSecret() );
|
||||
return 1;
|
||||
}
|
||||
static int IsDisplayBpmConstant( T* p, lua_State *L )
|
||||
{
|
||||
DisplayBpms temp;
|
||||
p->GetDisplayBpms(temp);
|
||||
lua_pushboolean( L, temp.BpmIsConstant() );
|
||||
return 1;
|
||||
}
|
||||
static int IsDisplayBpmRandom( T* p, lua_State *L )
|
||||
{
|
||||
lua_pushboolean( L, p->GetDisplayBPM() == DISPLAY_BPM_RANDOM );
|
||||
return 1;
|
||||
}
|
||||
|
||||
LunaSteps()
|
||||
{
|
||||
@@ -521,12 +576,17 @@ public:
|
||||
ADD_METHOD( HasAttacks );
|
||||
ADD_METHOD( GetRadarValues );
|
||||
ADD_METHOD( GetTimingData );
|
||||
ADD_METHOD( GetChartName );
|
||||
//ADD_METHOD( GetSMNoteData );
|
||||
ADD_METHOD( GetStepsType );
|
||||
ADD_METHOD( IsAnEdit );
|
||||
ADD_METHOD( IsAutogen );
|
||||
ADD_METHOD( IsAPlayerEdit );
|
||||
ADD_METHOD( UsesSplitTiming );
|
||||
ADD_METHOD( GetDisplayBpms );
|
||||
ADD_METHOD( IsDisplayBpmSecret );
|
||||
ADD_METHOD( IsDisplayBpmConstant );
|
||||
ADD_METHOD( IsDisplayBpmRandom );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+61
@@ -22,6 +22,14 @@ struct lua_State;
|
||||
*/
|
||||
const int MAX_STEPS_DESCRIPTION_LENGTH = 255;
|
||||
|
||||
/** @brief The different ways of displaying the BPM. */
|
||||
enum DisplayBPM
|
||||
{
|
||||
DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */
|
||||
DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */
|
||||
DISPLAY_BPM_RANDOM /**< Display a random selection of BPMs. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Holds note information for a Song.
|
||||
*
|
||||
@@ -98,6 +106,16 @@ public:
|
||||
/** @brief The stringified list of attacks. */
|
||||
vector<RString> m_sAttackString;
|
||||
|
||||
RString GetChartName() const
|
||||
{
|
||||
return parent ? Real()->GetChartName() : this->chartName;
|
||||
}
|
||||
|
||||
void SetChartName(const RString name)
|
||||
{
|
||||
this->chartName = name;
|
||||
}
|
||||
|
||||
void SetFilename( RString fn ) { m_sFilename = fn; }
|
||||
RString GetFilename() const { return m_sFilename; }
|
||||
void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; }
|
||||
@@ -151,6 +169,36 @@ public:
|
||||
* @brief Determine if the Steps use Split Timing by comparing the Song it's in.
|
||||
* @return true if the Step and Song use different timings, false otherwise. */
|
||||
bool UsesSplitTiming() const;
|
||||
|
||||
void SetDisplayBPM(const DisplayBPM type)
|
||||
{
|
||||
this->displayBPMType = type;
|
||||
}
|
||||
|
||||
DisplayBPM GetDisplayBPM() const
|
||||
{
|
||||
return this->displayBPMType;
|
||||
}
|
||||
|
||||
void SetMinBPM(const float f)
|
||||
{
|
||||
this->specifiedBPMMin = f;
|
||||
}
|
||||
float GetMinBPM() const
|
||||
{
|
||||
return this->specifiedBPMMin;
|
||||
}
|
||||
|
||||
void SetMaxBPM(const float f)
|
||||
{
|
||||
this->specifiedBPMMax = f;
|
||||
}
|
||||
float GetMaxBPM() const
|
||||
{
|
||||
return this->specifiedBPMMax;
|
||||
}
|
||||
|
||||
void GetDisplayBpms( DisplayBpms &addTo) const;
|
||||
|
||||
private:
|
||||
inline const Steps *Real() const { return parent ? parent : this; }
|
||||
@@ -194,6 +242,19 @@ private:
|
||||
bool m_bAreCachedRadarValuesJustLoaded;
|
||||
/** @brief The name of the person who created the Steps. */
|
||||
RString m_sCredit;
|
||||
|
||||
/** @brief The name of the chart. */
|
||||
RString chartName;
|
||||
|
||||
/** @brief How is the BPM displayed for this chart? */
|
||||
DisplayBPM displayBPMType;
|
||||
/** @brief What is the minimum specified BPM? */
|
||||
float specifiedBPMMin;
|
||||
/**
|
||||
* @brief What is the maximum specified BPM?
|
||||
*
|
||||
* If this is a range, then min should not be equal to max. */
|
||||
float specifiedBPMMax;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user