本文整理汇总了C++中Steps类的典型用法代码示例。如果您正苦于以下问题:C++ Steps类的具体用法?C++ Steps怎么用?C++ Steps使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Steps类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
float Profile::GetSongsPossible( StepsType st, Difficulty dc ) const
{
int iTotalSteps = 0;
// add steps high scores
const vector<Song*> vSongs = SONGMAN->GetAllSongs();
for( unsigned i=0; i<vSongs.size(); i++ )
{
Song* pSong = vSongs[i];
if( pSong->m_SelectionDisplay == Song::SHOW_NEVER )
continue; // skip
vector<Steps*> vSteps = pSong->GetAllSteps();
for( unsigned j=0; j<vSteps.size(); j++ )
{
Steps* pSteps = vSteps[j];
if( pSteps->m_StepsType != st )
continue; // skip
if( pSteps->GetDifficulty() != dc )
continue; // skip
iTotalSteps++;
}
}
return (float) iTotalSteps;
}
示例2: ASSERT
Steps* SongUtil::GetClosestNotes( const Song *pSong, StepsType st, Difficulty dc, bool bIgnoreLocked )
{
ASSERT( dc != Difficulty_Invalid );
const vector<Steps*>& vpSteps = (st == StepsType_Invalid)? pSong->GetAllSteps() : pSong->GetStepsByStepsType(st);
Steps *pClosest = NULL;
int iClosestDistance = 999;
for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps
{
Steps* pSteps = vpSteps[i];
if( pSteps->GetDifficulty() == Difficulty_Edit && dc != Difficulty_Edit )
continue;
if( bIgnoreLocked && UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
continue;
int iDistance = abs(dc - pSteps->GetDifficulty());
if( iDistance < iClosestDistance )
{
pClosest = pSteps;
iClosestDistance = iDistance;
}
}
return pClosest;
}
示例3: WriteDWINotesTag
static bool WriteDWINotesTag( RageFile &f, const Steps &out )
{
if( out.GetDifficulty() == Difficulty_Edit )
return false; // not supported by DWI
LOG->Trace( "Steps::WriteDWINotesTag" );
switch( out.m_StepsType )
{
case StepsType_dance_single: f.Write( "#SINGLE:" ); break;
case StepsType_dance_couple: f.Write( "#COUPLE:" ); break;
case StepsType_dance_double: f.Write( "#DOUBLE:" ); break;
case StepsType_dance_solo: f.Write( "#SOLO:" ); break;
default: return false; // not a type supported by DWI
}
switch( out.GetDifficulty() )
{
case Difficulty_Beginner: f.Write( "BEGINNER:" ); break;
case Difficulty_Easy: f.Write( "BASIC:" ); break;
case Difficulty_Medium: f.Write( "ANOTHER:" ); break;
case Difficulty_Hard: f.Write( "MANIAC:" ); break;
case Difficulty_Challenge: f.Write( "SMANIAC:" ); break;
default: ASSERT(0); return false;
}
f.PutLine( ssprintf("%d:", out.GetMeter()) );
return true;
}
示例4:
const TimingData &PlayerState::GetDisplayedTiming() const
{
Steps *steps = GAMESTATE->m_pCurSteps[m_PlayerNumber];
if( steps == NULL )
return GAMESTATE->m_pCurSong->m_SongTiming;
return *steps->GetTimingData();
}
示例5: RefreshNumStepsLoadedFromProfile
void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_RefreshSelector )
{
m_Selector.RefreshAll();
RefreshNumStepsLoadedFromProfile();
}
else if( SM == SM_Success && m_Selector.GetSelectedAction() == EditMenuAction_Delete )
{
LOG->Trace( "Delete successful; deleting steps from memory" );
Song* pSong = GAMESTATE->m_pCurSong;
Steps* pStepsToDelete = GAMESTATE->m_pCurSteps[PLAYER_1];
FOREACH_PlayerNumber(pn)
{
GAMESTATE->m_pCurSteps[pn].Set(NULL);
}
bool bSaveSong = !pStepsToDelete->WasLoadedFromProfile();
pSong->DeleteSteps( pStepsToDelete );
SONGMAN->Invalidate( pSong );
/* Only save to the main .SM file if the steps we're deleting
* were loaded from it. */
if( bSaveSong )
{
pSong->Save();
SCREENMAN->ZeroNextUpdate();
}
SCREENMAN->SendMessageToTopScreen( SM_RefreshSelector );
}
示例6: ASSERT
void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
{
// ugly...
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
vector<Steps*> vpAllSteps;
map<Steps*,Song*> mapStepsToSong;
{
for( unsigned i=0; i<vpSongs.size(); i++ )
{
Song* pSong = vpSongs[i];
vector<Steps*> vpSteps = pSong->GetAllSteps();
for( unsigned j=0; j<vpSteps.size(); j++ )
{
Steps* pSteps = vpSteps[j];
if( pSteps->IsAutogen() )
continue; // skip
vpAllSteps.push_back( pSteps );
mapStepsToSong[pSteps] = pSong;
}
}
}
ASSERT( pProfile != NULL );
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
{
Steps* pSteps = vStepsPointers[i];
Song* pSong = mapStepsToSong[pSteps];
steps_sort_val[vStepsPointers[i]] = ssprintf("%9i", pProfile->GetStepsNumTimesPlayed(pSong,pSteps));
}
stable_sort( vStepsPointers.begin(), vStepsPointers.end(), bDecending ? CompareStepsPointersBySortValueDescending : CompareStepsPointersBySortValueAscending );
steps_sort_val.clear();
}
示例7: main
int main( int argc, char** argv ) {
Steps* s;
s = new Steps( argv[1], argv[2], argv[3], 1000 );
WorkUnit* wu;
while ( (wu = s->newWorkUnit()) != NULL ) {
wu->print( stdout );
delete wu;
}
}
示例8:
void Calibration::SignalPath::add_step (Scalar* function, double step)
{
Steps* steps = dynamic_cast<Steps*> (function);
if (steps)
{
#ifdef _DEBUG
cerr << "Calibration::SignalPath::add_step step=" << step << endl;
#endif
steps->add_step (step);
}
}
示例9: ssprintf
void SongUtil::SortSongPointerArrayByMeter( vector<Song*> &arraySongPointers, Difficulty dc )
{
song_sort_val.clear();
for(unsigned i = 0; i < arraySongPointers.size(); ++i)
{
Steps* pSteps = arraySongPointers[i]->GetStepsByDifficulty( GAMESTATE->GetCurrentStyle()->m_StepsType, dc );
CString &s = song_sort_val[arraySongPointers[i]];
s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0);
if( PREFSMAN->m_bSubSortByNumSteps )
s += ssprintf("%06.0f",pSteps ? pSteps->GetRadarValues()[RADAR_NUM_TAPS_AND_HOLDS] : 0);
}
stable_sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersBySortValueAscending );
}
示例10: GetSongsActual
float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
{
float fTotalPercents = 0;
// add steps high scores
for( std::map<SongID,HighScoresForASong>::const_iterator i = m_SongHighScores.begin();
i != m_SongHighScores.end();
++i )
{
const SongID &id = i->first;
Song* pSong = id.ToSong();
// If the Song isn't loaded on the current machine, then we can't
// get radar values to compute dance points.
if( pSong == NULL )
continue;
if( pSong->m_SelectionDisplay == Song::SHOW_NEVER )
continue; // skip
const HighScoresForASong &hsfas = i->second;
for( std::map<StepsID,HighScoresForASteps>::const_iterator j = hsfas.m_StepsHighScores.begin();
j != hsfas.m_StepsHighScores.end();
++j )
{
const StepsID &id = j->first;
Steps* pSteps = id.ToSteps( pSong, true );
// If the Steps isn't loaded on the current machine, then we can't
// get radar values to compute dance points.
if( pSteps == NULL )
continue;
if( pSteps->m_StepsType != st )
continue;
if( pSteps->GetDifficulty() != dc )
continue; // skip
const HighScoresForASteps& h = j->second;
const HighScoreList& hs = h.hs;
fTotalPercents += hs.GetTopScore().fPercentDP;
}
}
return fTotalPercents;
}
示例11: LoadNoteDataFromSimfile
bool KSFLoader::LoadNoteDataFromSimfile( const std::string & cachePath, Steps &out )
{
bool KIUCompliant = false;
Song dummy;
if (!LoadGlobalData(cachePath, dummy, KIUCompliant))
return false;
Steps *notes = dummy.CreateSteps();
if (LoadFromKSFFile(cachePath, *notes, dummy, KIUCompliant))
{
KIUCompliant = true; // yeah, reusing a variable.
out.SetNoteData(notes->GetNoteData());
}
delete notes;
return KIUCompliant;
}
示例12: Error
void Calibration::SignalPath::add_step (Scalar* function, const MJD& mjd)
{
Steps* steps = dynamic_cast<Steps*> (function);
if (!steps)
throw Error (InvalidState, "Calibration::SignalPath::add_step",
"function is not a Steps");
MJD zero;
if (convert.get_reference_epoch() == zero)
convert.set_reference_epoch ( mjd );
time.set_value (mjd);
double step = convert.get_value();
steps->add_step (step);
}
示例13: GetDirListing
bool KSFLoader::LoadFromDir( const std::string &sDir, Song &out )
{
LOG->Trace( "KSFLoader::LoadFromDir(%s)", sDir.c_str() );
vector<std::string> arrayKSFFileNames;
GetDirListing( sDir + "*.ksf", arrayKSFFileNames );
// We shouldn't have been called to begin with if there were no KSFs.
ASSERT( arrayKSFFileNames.size() != 0 );
bool bKIUCompliant = false;
/* With Split Timing, there has to be a backup Song Timing in case
* anything goes wrong. As these files are kept in alphabetical
* order (hopefully), it is best to use the LAST file for timing
* purposes, for that is the "normal", or easiest difficulty.
* Usually. */
// Nevermind, kiu compilancy is screwing things up:
// IE, I have two simfiles, oh wich each have four ksf files, the first one has
// the first ksf with directmove timing changes, and the rest are not, everything
// goes fine. In the other hand I have my second simfile with the first ksf file
// without directmove timing changes and the rest have changes, changes are not
// loaded due to kiucompilancy in the first ksf file.
// About the "normal" thing, my simfiles' ksfs uses non-standard naming so
// the last chart is usually nightmare or normal, I use easy and normal
// indistinctly for SM so it shouldn't matter, I use piu fiesta/ex naming
// for directmove though, and we're just gathering basic info anyway, and
// most of the time all the KSF files have the same info in the #TITLE:; section
unsigned files = arrayKSFFileNames.size();
std::string dir = out.GetSongDir();
if( !LoadGlobalData(dir + arrayKSFFileNames[files - 1], out, bKIUCompliant) )
return false;
out.m_sSongFileName = dir + arrayKSFFileNames[files - 1];
// load the Steps from the rest of the KSF files
for( unsigned i=0; i<files; i++ )
{
Steps* pNewNotes = out.CreateSteps();
if( !LoadFromKSFFile(dir + arrayKSFFileNames[i], *pNewNotes, out, bKIUCompliant) )
{
delete pNewNotes;
continue;
}
pNewNotes->SetFilename(dir + arrayKSFFileNames[i]);
out.AddSteps( pNewNotes );
}
return true;
}
示例14: GetStepsByDifficulty
Steps* SongUtil::GetStepsByDifficulty( const Song *pSong, StepsType st, Difficulty dc, bool bIncludeAutoGen )
{
const vector<Steps*>& vpSteps = (st == StepsType_Invalid)? pSong->GetAllSteps() : pSong->GetStepsByStepsType(st);
for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps
{
Steps* pSteps = vpSteps[i];
if( dc != Difficulty_Invalid && dc != pSteps->GetDifficulty() )
continue;
if( !bIncludeAutoGen && pSteps->IsAutogen() )
continue;
return pSteps;
}
return NULL;
}
示例15: GetStepsByMeter
Steps* SongUtil::GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow, int iMeterHigh )
{
const vector<Steps*>& vpSteps = (st == StepsType_Invalid)? pSong->GetAllSteps() : pSong->GetStepsByStepsType(st);
for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps
{
Steps* pSteps = vpSteps[i];
if( iMeterLow > pSteps->GetMeter() )
continue;
if( iMeterHigh < pSteps->GetMeter() )
continue;
return pSteps;
}
return NULL;
}