本文整理汇总了C++中Steps::SetDifficulty方法的典型用法代码示例。如果您正苦于以下问题:C++ Steps::SetDifficulty方法的具体用法?C++ Steps::SetDifficulty怎么用?C++ Steps::SetDifficulty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Steps
的用法示例。
在下文中一共展示了Steps::SetDifficulty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFromTokens
void SMLoader::LoadFromTokens(
RString sStepsType,
RString sDescription,
RString sDifficulty,
RString sMeter,
RString sRadarValues,
RString sNoteData,
Steps &out
)
{
// we're loading from disk, so this is by definition already saved:
out.SetSavedToDisk( true );
Trim( sStepsType );
Trim( sDescription );
Trim( sDifficulty );
Trim( sNoteData );
// LOG->Trace( "Steps::LoadFromTokens()" );
// backwards compatibility hacks:
// HACK: We eliminated "ez2-single-hard", but we should still handle it.
if( sStepsType == "ez2-single-hard" )
sStepsType = "ez2-single";
// HACK: "para-single" used to be called just "para"
if( sStepsType == "para" )
sStepsType = "para-single";
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( OldStyleStringToDifficulty(sDifficulty) );
// Handle hacks that originated back when StepMania didn't have
// Difficulty_Challenge. (At least v1.64, possibly v3.0 final...)
if( out.GetDifficulty() == Difficulty_Hard )
{
// HACK: SMANIAC used to be Difficulty_Hard with a special description.
if( sDescription.CompareNoCase("smaniac") == 0 )
out.SetDifficulty( Difficulty_Challenge );
// HACK: CHALLENGE used to be Difficulty_Hard with a special description.
if( sDescription.CompareNoCase("challenge") == 0 )
out.SetDifficulty( Difficulty_Challenge );
}
if( sMeter.empty() )
{
// some simfiles (e.g. X-SPECIALs from Zenius-I-Vanisher) don't
// have a meter on certain steps. Make the meter 1 in these instances.
sMeter = "1";
}
out.SetMeter( StringToInt(sMeter) );
out.SetSMNoteData( sNoteData );
out.TidyUpData();
}
示例2: LoadFromSMTokens
void SMLoader::LoadFromSMTokens(
CString sStepsType,
CString sDescription,
CString sDifficulty,
CString sMeter,
CString sRadarValues,
CString sNoteData,
CString sAttackData,
Steps &out
)
{
TrimLeft(sStepsType);
TrimRight(sStepsType);
TrimLeft(sDescription);
TrimRight(sDescription);
TrimLeft(sDifficulty);
TrimRight(sDifficulty);
// LOG->Trace( "Steps::LoadFromSMTokens()" );
out.m_StepsType = GameManager::StringToStepsType(sStepsType);
out.SetDescription(sDescription);
out.SetDifficulty(StringToDifficulty( sDifficulty ));
// HACK: We used to store SMANIAC as DIFFICULTY_HARD with special description.
// Now, it has its own DIFFICULTY_CHALLENGE
if( sDescription.CompareNoCase("smaniac") == 0 )
out.SetDifficulty( DIFFICULTY_CHALLENGE );
// HACK: We used to store CHALLENGE as DIFFICULTY_HARD with special description.
// Now, it has its own DIFFICULTY_CHALLENGE
if( sDescription.CompareNoCase("challenge") == 0 )
out.SetDifficulty( DIFFICULTY_CHALLENGE );
out.SetMeter(atoi(sMeter));
CStringArray saValues;
split( sRadarValues, ",", saValues, true );
if( saValues.size() == NUM_RADAR_CATEGORIES )
{
RadarValues v;
FOREACH_RadarCategory(rc)
v[rc] = strtof( saValues[rc], NULL );
out.SetRadarValues( v );
}
out.SetSMNoteData(sNoteData, sAttackData);
out.TidyUpData();
}
示例3: min
FOREACH_ENUM( Difficulty, dc )
{
if( dc == Difficulty_Edit )
continue;
vector<Steps*> vSteps;
SongUtil::GetSteps( &p, vSteps, st, dc );
StepsUtil::SortNotesArrayByDifficulty( vSteps );
for( unsigned k=1; k<vSteps.size(); k++ )
{
Steps* pSteps = vSteps[k];
Difficulty dc2 = min( (Difficulty)(dc+1), Difficulty_Challenge );
pSteps->SetDifficulty( dc2 );
}
}
示例4: LoadFromKSFFile
//.........这里部分代码省略.........
}
if( iTickCount == -1 )
{
iTickCount = 4;
LOG->UserLog( "Song file", sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", iTickCount );
}
// Prepare BPM stuff already if the file uses KSF syntax.
if( bKIUCompliant )
{
if( BPM2 > 0 && BPMPos2 > 0 )
{
HandleBunki( stepsTiming, BPM1, BPM2, SMGap1, BPMPos2 );
}
if( BPM3 > 0 && BPMPos3 > 0 )
{
HandleBunki( stepsTiming, BPM2, BPM3, SMGap2, BPMPos3 );
}
}
NoteData notedata; // read it into here
{
std::string sDir, sFName, sExt;
splitpath( sPath, sDir, sFName, sExt );
sFName = Rage::make_lower(sFName);
out.SetDescription(sFName);
// Check another before anything else... is this okay? -DaisuMaster
if( sFName.find("another") != string::npos )
{
out.SetDifficulty( Difficulty_Edit );
if( !out.GetMeter() ) out.SetMeter( 25 );
}
else if(sFName.find("wild") != string::npos ||
sFName.find("wd") != string::npos ||
sFName.find("crazy+") != string::npos ||
sFName.find("cz+") != string::npos ||
sFName.find("hardcore") != string::npos )
{
out.SetDifficulty( Difficulty_Challenge );
if( !out.GetMeter() ) out.SetMeter( 20 );
}
else if(sFName.find("crazy") != string::npos ||
sFName.find("cz") != string::npos ||
sFName.find("nightmare") != string::npos ||
sFName.find("nm") != string::npos ||
sFName.find("crazydouble") != string::npos )
{
out.SetDifficulty( Difficulty_Hard );
if( !out.GetMeter() ) out.SetMeter( 14 ); // Set the meters to the Pump scale, not DDR.
}
else if(sFName.find("hard") != string::npos ||
sFName.find("hd") != string::npos ||
sFName.find("freestyle") != string::npos ||
sFName.find("fs") != string::npos ||
sFName.find("double") != string::npos )
{
out.SetDifficulty( Difficulty_Medium );
if( !out.GetMeter() ) out.SetMeter( 8 );
}
else if(sFName.find("easy") != string::npos ||
sFName.find("ez") != string::npos ||
sFName.find("normal") != string::npos )
示例5: LoadFromKSFFile
bool KSFLoader::LoadFromKSFFile( const CString &sPath, Steps &out, const Song &song )
{
LOG->Trace( "Steps::LoadFromKSFFile( '%s' )", sPath.c_str() );
MsdFile msd;
if( !msd.ReadFile( sPath ) )
RageException::Throw( "Error opening file '%s'.", sPath.c_str() );
int iTickCount = -1; // this is the value we read for TICKCOUNT
CStringArray asRows;
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
const MsdFile::value_t &sParams = msd.GetValue(i);
CString sValueName = sParams[0];
// handle the data
if( 0==stricmp(sValueName,"TICKCOUNT") )
iTickCount = atoi(sParams[1]);
else if( 0==stricmp(sValueName,"STEP") )
{
CString step = sParams[1];
TrimLeft(step);
split( step, "\n", asRows, true );
}
else if( 0==stricmp(sValueName,"DIFFICULTY") )
out.SetMeter(atoi(sParams[1]));
}
if( iTickCount == -1 )
{
iTickCount = 2;
LOG->Warn( "\"%s\": TICKCOUNT not found; defaulting to %i", sPath.c_str(), iTickCount );
}
NoteData notedata; // read it into here
{
CString sDir, sFName, sExt;
splitpath( sPath, sDir, sFName, sExt );
sFName.MakeLower();
out.SetDescription(sFName);
if( sFName.Find("crazy")!=-1 )
{
out.SetDifficulty(DIFFICULTY_HARD);
if(!out.GetMeter()) out.SetMeter(8);
}
else if( sFName.Find("hard")!=-1 )
{
out.SetDifficulty(DIFFICULTY_MEDIUM);
if(!out.GetMeter()) out.SetMeter(5);
}
else if( sFName.Find("easy")!=-1 )
{
out.SetDifficulty(DIFFICULTY_EASY);
if(!out.GetMeter()) out.SetMeter(2);
}
else
{
out.SetDifficulty(DIFFICULTY_MEDIUM);
if(!out.GetMeter()) out.SetMeter(5);
}
notedata.SetNumTracks( 5 );
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
/* Check for "halfdouble" before "double". */
if( sFName.Find("halfdouble") != -1 || sFName.Find("h_double") != -1 )
{
notedata.SetNumTracks( 6 );
out.m_StepsType = STEPS_TYPE_PUMP_HALFDOUBLE;
}
else if( sFName.Find("double") != -1 )
{
notedata.SetNumTracks( 10 );
out.m_StepsType = STEPS_TYPE_PUMP_DOUBLE;
}
else if( sFName.Find("_2") != -1 )
{
notedata.SetNumTracks( 10 );
out.m_StepsType = STEPS_TYPE_PUMP_COUPLE;
}
}
int iHoldStartRow[13];
int t;
for( t=0; t<13; t++ )
iHoldStartRow[t] = -1;
for( unsigned r=0; r<asRows.size(); r++ )
{
CString& sRowString = asRows[r];
StripCrnl( sRowString );
if( sRowString == "" )
continue; // skip
/* All 2s indicates the end of the song. */
//.........这里部分代码省略.........
示例6: LoadEdit
bool SMLoader::LoadEdit( CString sEditFilePath, ProfileSlot slot )
{
LOG->Trace( "Song::LoadEdit(%s)", sEditFilePath.c_str() );
int iBytes = FILEMAN->GetFileSizeInBytes( sEditFilePath );
if( iBytes > MAX_EDIT_SIZE_BYTES )
{
LOG->Warn( "The edit '%s' is unreasonably large. It won't be loaded.", sEditFilePath.c_str() );
return false;
}
MsdFile msd;
if( !msd.ReadFile( sEditFilePath ) )
RageException::Throw( "Error opening file \"%s\": %s", sEditFilePath.c_str(), msd.GetError().c_str() );
Song* pSong = NULL;
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
int iNumParams = msd.GetNumParams(i);
const MsdFile::value_t &sParams = msd.GetValue(i);
const CString sValueName = sParams[0];
// handle the data
if( 0==stricmp(sValueName,"SONG") )
{
if( pSong )
{
LOG->Warn( "The edit file '%s' has more than one #SONG tag.", sEditFilePath.c_str() );
return false;
}
CString sSongFullTitle = sParams[1];
sSongFullTitle.Replace( '\\', '/' );
pSong = SONGMAN->FindSong( sSongFullTitle );
if( pSong == NULL )
{
LOG->Warn( "The edit file '%s' required a song '%s' that isn't present.", sEditFilePath.c_str(), sSongFullTitle.c_str() );
return false;
}
if( pSong->GetNumStepsLoadedFromProfile(slot) >= MAX_EDITS_PER_SONG_PER_PROFILE )
{
LOG->Warn( "The song '%s' already has the maximum number of edits allowed for ProfileSlotP%d.", sSongFullTitle.c_str(), slot+1 );
return false;
}
}
else if( 0==stricmp(sValueName,"NOTES") )
{
if( pSong == NULL )
{
LOG->Warn( "The edit file '%s' has doesn't have a #SONG tag preceeding the first #NOTES tag.", sEditFilePath.c_str() );
return false;
}
if( iNumParams < 7 )
{
LOG->Trace( "The song file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sEditFilePath.c_str(), iNumParams, 7 );
continue;
}
Steps* pNewNotes = new Steps;
ASSERT( pNewNotes );
LoadFromSMTokens(
sParams[1], sParams[2], sParams[3], sParams[4], sParams[5], sParams[6], (iNumParams>=8)?sParams[7]:CString(""),
*pNewNotes);
pNewNotes->SetLoadedFromProfile( slot );
pNewNotes->SetDifficulty( DIFFICULTY_EDIT );
if( pSong->IsEditAlreadyLoaded(pNewNotes) )
{
LOG->Warn( "The edit file '%s' is a duplicate of another edit that was already loaded.", sEditFilePath.c_str() );
SAFE_DELETE( pNewNotes );
return false;
}
pSong->AddSteps( pNewNotes );
return true; // Only allow one Steps per edit file!
}
else
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
}
return true;
}