本文整理汇总了C++中Steps::GetMeter方法的典型用法代码示例。如果您正苦于以下问题:C++ Steps::GetMeter方法的具体用法?C++ Steps::GetMeter怎么用?C++ Steps::GetMeter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Steps
的用法示例。
在下文中一共展示了Steps::GetMeter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: GetSteps
void SongUtil::GetSteps(
const Song *pSong,
vector<Steps*>& arrayAddTo,
StepsType st,
Difficulty dc,
int iMeterLow,
int iMeterHigh,
const RString &sDescription,
bool bIncludeAutoGen,
unsigned uHash,
int iMaxToGet
)
{
if( !iMaxToGet )
return;
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( iMeterLow != -1 && iMeterLow > pSteps->GetMeter() )
continue;
if( iMeterHigh != -1 && iMeterHigh < pSteps->GetMeter() )
continue;
if( sDescription.size() && sDescription != pSteps->GetDescription() )
continue;
if( uHash != 0 && uHash != pSteps->GetHash() )
continue;
if( !bIncludeAutoGen && pSteps->IsAutogen() )
continue;
arrayAddTo.push_back( pSteps );
if( iMaxToGet != -1 )
{
--iMaxToGet;
if( !iMaxToGet )
break;
}
}
}
示例4: SortSongPointerArrayByMeter
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 );
}
示例5: SetStep
/* Add a list of difficulties/edits to the given row/handler. */
void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand )
{
hand.type = ROW_STEP;
row.bOneChoiceForAllPlayers = false;
// fill in difficulty names
if( GAMESTATE->m_bEditing )
{
row.choices.push_back( "" );
hand.ListEntries.push_back( ModeChoice() );
}
else if( GAMESTATE->IsCourseMode() ) // playing a course
{
row.bOneChoiceForAllPlayers = PREFSMAN->m_bLockCourseDifficulties;
vector<Trail*> vTrails;
GAMESTATE->m_pCurCourse->GetTrails( vTrails, GAMESTATE->GetCurrentStyle()->m_StepsType );
ModeChoice mc;
for( unsigned i=0; i<vTrails.size(); i++ )
{
row.choices.push_back( CourseDifficultyToThemedString(vTrails[i]->m_CourseDifficulty) );
mc.m_pTrail = vTrails[i];
hand.ListEntries.push_back( mc );
}
}
else // !GAMESTATE->IsCourseMode(), playing a song
{
vector<Steps*> vSteps;
GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->GetCurrentStyle()->m_StepsType );
StepsUtil::SortNotesArrayByDifficulty( vSteps );
ModeChoice mc;
for( unsigned i=0; i<vSteps.size(); i++ )
{
Steps* pSteps = vSteps[i];
CString s;
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
s = pSteps->GetDescription();
else
s = DifficultyToThemedString( pSteps->GetDifficulty() );
s += ssprintf( " (%d)", pSteps->GetMeter() );
row.choices.push_back( s );
mc.m_pSteps = pSteps;
mc.m_dc = pSteps->GetDifficulty();
hand.ListEntries.push_back( mc );
}
}
}
示例6: WriteSMNotesTag
void NotesWriterSM::WriteSMNotesTag( const Steps &in, RageFile &f, bool bSavingCache )
{
f.PutLine( "" );
f.PutLine( ssprintf( "//---------------%s - %s----------------",
GameManager::StepsTypeToString(in.m_StepsType).c_str(), in.GetDescription().c_str() ) );
f.PutLine( "#NOTES:" );
f.PutLine( ssprintf( " %s:", GameManager::StepsTypeToString(in.m_StepsType).c_str() ) );
f.PutLine( ssprintf( " %s:", in.GetDescription().c_str() ) );
f.PutLine( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) );
f.PutLine( ssprintf( " %d:", in.GetMeter() ) );
int MaxRadar = bSavingCache? NUM_RADAR_CATEGORIES:5;
CStringArray asRadarValues;
for( int r=0; r < MaxRadar; r++ )
asRadarValues.push_back( ssprintf("%.3f", in.GetRadarValues()[r]) );
/* Don't append a newline here; it's added in NoteDataUtil::GetSMNoteDataString.
* If we add it here, then every time we write unmodified data we'll add an extra
* newline and they'll accumulate. */
f.Write( ssprintf( " %s:", join(",",asRadarValues).c_str() ) );
CString sNoteData;
CString sAttackData;
in.GetSMNoteData( sNoteData, sAttackData );
vector<CString> lines;
split( sNoteData, "\n", lines, false );
WriteLineList( f, lines, true, true );
if( sAttackData.empty() )
f.PutLine( ";" );
else
{
f.PutLine( ":" );
lines.clear();
split( sAttackData, "\n", lines, false );
WriteLineList( f, lines, true, true );
f.PutLine( ";" );
}
}
示例7: AddPlayerStatsToProfile
/* This data is added to each player profile, and to the machine profile per-player. */
void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNumber pn )
{
ss.AssertValid( pn );
CHECKPOINT;
StyleID sID;
sID.FromStyle( ss.m_pStyle );
ASSERT( (int) ss.m_vpPlayedSongs.size() == ss.m_player[pn].m_iStepsPlayed );
for( int i=0; i<ss.m_player[pn].m_iStepsPlayed; i++ )
{
Steps *pSteps = ss.m_player[pn].m_vpPossibleSteps[i];
pProfile->m_iNumSongsPlayedByPlayMode[ss.m_playMode]++;
pProfile->m_iNumSongsPlayedByStyle[sID] ++;
pProfile->m_iNumSongsPlayedByDifficulty[pSteps->GetDifficulty()] ++;
int iMeter = clamp( pSteps->GetMeter(), 0, MAX_METER );
pProfile->m_iNumSongsPlayedByMeter[iMeter] ++;
}
pProfile->m_iTotalDancePoints += ss.m_player[pn].m_iActualDancePoints;
if( ss.m_Stage == Stage_Extra1 || ss.m_Stage == Stage_Extra2 )
{
if( ss.m_player[pn].m_bFailed )
++pProfile->m_iNumExtraStagesFailed;
else
++pProfile->m_iNumExtraStagesPassed;
}
// If you fail in a course, you passed all but the final song.
// FIXME: Not true. If playing with 2 players, one player could have failed earlier.
if( !ss.m_player[pn].m_bFailed )
{
pProfile->m_iNumStagesPassedByPlayMode[ss.m_playMode] ++;
pProfile->m_iNumStagesPassedByGrade[ss.m_player[pn].GetGrade()] ++;
}
}
示例8: 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 )
{
示例9: GetSectionNameFromSongAndSort
CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so )
{
if( pSong == NULL )
return "";
switch( so )
{
case SORT_PREFERRED:
return "";
case SORT_GROUP:
return pSong->m_sGroupName;
case SORT_TITLE:
case SORT_ARTIST:
{
CString s;
switch( so )
{
case SORT_TITLE: s = pSong->GetTranslitMainTitle(); break;
case SORT_ARTIST: s = pSong->GetTranslitArtist(); break;
default: ASSERT(0);
}
s = MakeSortString(s); // resulting string will be uppercase
if( s.empty() )
return "";
else if( s[0] >= '0' && s[0] <= '9' )
return "NUM";
else if( s[0] < 'A' || s[0] > 'Z')
return "OTHER";
else
return s.Left(1);
}
case SORT_BPM:
{
const int iBPMGroupSize = 20;
DisplayBpms bpms;
pSong->GetDisplayBpms( bpms );
int iMaxBPM = (int)bpms.GetMax();
iMaxBPM += iBPMGroupSize - (iMaxBPM%iBPMGroupSize) - 1;
return ssprintf("%03d-%03d",iMaxBPM-(iBPMGroupSize-1), iMaxBPM);
}
case SORT_MOST_PLAYED:
return "";
case SORT_GRADE:
{
int iCounts[NUM_GRADES];
PROFILEMAN->GetMachineProfile()->GetGrades( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, iCounts );
for( int i=GRADE_TIER_1; i<NUM_GRADES; ++i )
{
Grade g = (Grade)i;
if( iCounts[i] > 0 )
return ssprintf( "%4s x %d", GradeToThemedString(g).c_str(), iCounts[i] );
}
return GradeToThemedString( GRADE_NO_DATA );
}
case SORT_EASY_METER:
{
Steps* pSteps = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyle()->m_StepsType,DIFFICULTY_EASY);
if( pSteps )
return ssprintf("%02d", pSteps->GetMeter() );
return "N/A";
}
case SORT_MEDIUM_METER:
{
Steps* pSteps = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyle()->m_StepsType,DIFFICULTY_MEDIUM);
if( pSteps )
return ssprintf("%02d", pSteps->GetMeter() );
return "N/A";
}
case SORT_HARD_METER:
{
Steps* pSteps = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyle()->m_StepsType,DIFFICULTY_HARD);
if( pSteps )
return ssprintf("%02d", pSteps->GetMeter() );
return "N/A";
}
case SORT_CHALLENGE_METER:
{
Steps* pSteps = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyle()->m_StepsType,DIFFICULTY_CHALLENGE);
if( pSteps )
return ssprintf("%02d", pSteps->GetMeter() );
return "N/A";
}
case SORT_SORT_MENU:
case SORT_MODE_MENU:
return "";
case SORT_ALL_COURSES:
case SORT_NONSTOP_COURSES:
case SORT_ONI_COURSES:
case SORT_ENDLESS_COURSES:
default:
ASSERT(0);
return "";
}
}
示例10: 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. */
//.........这里部分代码省略.........
示例11: StartRequest
void NetworkSyncManager::StartRequest(short position)
{
if( !useSMserver )
return;
if( GAMESTATE->m_bDemonstrationOrJukebox )
return;
LOG->Trace("Requesting Start from Server.");
m_packet.ClearPacket();
m_packet.Write1( NSCGSR );
unsigned char ctr=0;
Steps * tSteps;
tSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
if ((tSteps!=NULL) && (GAMESTATE->IsPlayerEnabled(PLAYER_1)))
ctr = uint8_t(ctr+tSteps->GetMeter()*16);
tSteps = GAMESTATE->m_pCurSteps[PLAYER_2];
if ((tSteps!=NULL) && (GAMESTATE->IsPlayerEnabled(PLAYER_2)))
ctr = uint8_t(ctr+tSteps->GetMeter());
m_packet.Write1(ctr);
ctr=0;
tSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
if ((tSteps!=NULL) && (GAMESTATE->IsPlayerEnabled(PLAYER_1)))
ctr = uint8_t(ctr + (int) tSteps->GetDifficulty()*16);
tSteps = GAMESTATE->m_pCurSteps[PLAYER_2];
if ((tSteps!=NULL) && (GAMESTATE->IsPlayerEnabled(PLAYER_2)))
ctr = uint8_t(ctr + (int) tSteps->GetDifficulty());
m_packet.Write1(ctr);
//Notify server if this is for sync or not.
ctr = char(position*16);
m_packet.Write1(ctr);
if (GAMESTATE->m_pCurSong != NULL)
{
m_packet.WriteNT(GAMESTATE->m_pCurSong->m_sMainTitle);
m_packet.WriteNT(GAMESTATE->m_pCurSong->m_sSubTitle);
m_packet.WriteNT(GAMESTATE->m_pCurSong->m_sArtist);
}
else
{
m_packet.WriteNT("");
m_packet.WriteNT("");
m_packet.WriteNT("");
}
if (GAMESTATE->m_pCurCourse != NULL)
m_packet.WriteNT(GAMESTATE->m_pCurCourse->GetFullDisplayTitle());
else
m_packet.WriteNT(CString(""));
//Send Player (and song) Options
m_packet.WriteNT(GAMESTATE->m_SongOptions.GetString());
int players=0;
FOREACH_PlayerNumber (p)
{
++players;
m_packet.WriteNT(GAMESTATE->m_PlayerOptions[p].GetString());
}
for (int i=0; i<2-players; ++i)
m_packet.WriteNT(""); //Write a NULL if no player
//This needs to be reset before ScreenEvaluation could possibly be called
for (int i=0; i<NETMAXPLAYERS; ++i)
{
m_EvalPlayerData[i].name=0;
m_EvalPlayerData[i].grade=0;
m_EvalPlayerData[i].score=0;
m_EvalPlayerData[i].difficulty=(Difficulty)0;
for (int j=0; j<NETNUMTAPSCORES; ++j)
m_EvalPlayerData[i].tapScores[j] = 0;
}
//Block until go is recieved.
//Switch to blocking mode (this is the only
//way I know how to get precievably instantanious results
bool dontExit=true;
//Don't block if we are server.
if (isLanServer)
NetPlayerClient->blocking=false;
else
NetPlayerClient->blocking=true;
//The following packet HAS to get through, so we turn blocking on for it as well
//Don't block if we are serving
NetPlayerClient->SendPack((char*)&m_packet.Data, m_packet.Position);
//.........这里部分代码省略.........