本文整理汇总了C++中Steps::GetTimingData方法的典型用法代码示例。如果您正苦于以下问题:C++ Steps::GetTimingData方法的具体用法?C++ Steps::GetTimingData怎么用?C++ Steps::GetTimingData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Steps
的用法示例。
在下文中一共展示了Steps::GetTimingData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const TimingData &PlayerState::GetDisplayedTiming() const
{
Steps *steps = GAMESTATE->m_pCurSteps[m_PlayerNumber];
if( steps == NULL )
return GAMESTATE->m_pCurSong->m_SongTiming;
return *steps->GetTimingData();
}
示例2: GetYOffset
/* For visibility testing: if bAbsolute is false, random modifiers must return
* the minimum possible scroll speed. */
float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, float &fPeakYOffsetOut, bool &bIsPastPeakOut, bool bAbsolute )
{
// Default values that are returned if boomerang is off.
fPeakYOffsetOut = FLT_MAX;
bIsPastPeakOut = true;
float fYOffset = 0;
const SongPosition &position = pPlayerState->GetDisplayedPosition();
float fSongBeat = position.m_fSongBeatVisible;
Steps *pCurSteps = GAMESTATE->m_pCurSteps[pPlayerState->m_PlayerNumber];
/* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat spacing or
* entirely time spacing (respectively). Occasionally, we tween between them. */
if( curr_options->m_fTimeSpacing != 1.0f )
{
if( GAMESTATE->m_bInStepEditor ) {
// Use constant spacing in step editor
fYOffset = fNoteBeat - fSongBeat;
} else {
fYOffset = GetDisplayedBeat(pPlayerState, fNoteBeat) - GetDisplayedBeat(pPlayerState, fSongBeat);
fYOffset *= pCurSteps->GetTimingData()->GetDisplayedSpeedPercent(
position.m_fSongBeatVisible,
position.m_fMusicSecondsVisible );
}
fYOffset *= 1 - curr_options->m_fTimeSpacing;
}
if( curr_options->m_fTimeSpacing != 0.0f )
{
float fSongSeconds = GAMESTATE->m_Position.m_fMusicSecondsVisible;
float fNoteSeconds = pCurSteps->GetTimingData()->GetElapsedTimeFromBeat(fNoteBeat);
float fSecondsUntilStep = fNoteSeconds - fSongSeconds;
float fBPM = curr_options->m_fScrollBPM;
float fBPS = fBPM/60.f / GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
float fYOffsetTimeSpacing = fSecondsUntilStep * fBPS;
fYOffset += fYOffsetTimeSpacing * curr_options->m_fTimeSpacing;
}
// TODO: If we allow noteskins to have metricable row spacing
// (per issue 24), edit this to reflect that. -aj
fYOffset *= ARROW_SPACING;
// Factor in scroll speed
float fScrollSpeed = curr_options->m_fScrollSpeed;
if(curr_options->m_fMaxScrollBPM != 0)
{
fScrollSpeed= curr_options->m_fMaxScrollBPM /
(pPlayerState->m_fReadBPM * GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate);
}
// don't mess with the arrows after they've crossed 0
if( fYOffset < 0 )
{
return fYOffset * fScrollSpeed;
}
const float* fAccels = curr_options->m_fAccels;
//const float* fEffects = curr_options->m_fEffects;
float fYAdjust = 0; // fill this in depending on PlayerOptions
if( fAccels[PlayerOptions::ACCEL_BOOST] != 0 )
{
float fEffectHeight = GetNoteFieldHeight();
float fNewYOffset = fYOffset * 1.5f / ((fYOffset+fEffectHeight/1.2f)/fEffectHeight);
float fAccelYAdjust = fAccels[PlayerOptions::ACCEL_BOOST] * (fNewYOffset - fYOffset);
// TRICKY: Clamp this value, or else BOOST+BOOMERANG will draw a ton of arrows on the screen.
CLAMP( fAccelYAdjust, BOOST_MOD_MIN_CLAMP, BOOST_MOD_MAX_CLAMP );
fYAdjust += fAccelYAdjust;
}
if( fAccels[PlayerOptions::ACCEL_BRAKE] != 0 )
{
float fEffectHeight = GetNoteFieldHeight();
float fScale = SCALE( fYOffset, 0.f, fEffectHeight, 0, 1.f );
float fNewYOffset = fYOffset * fScale;
float fBrakeYAdjust = fAccels[PlayerOptions::ACCEL_BRAKE] * (fNewYOffset - fYOffset);
// TRICKY: Clamp this value the same way as BOOST so that in BOOST+BRAKE, BRAKE doesn't overpower BOOST
CLAMP( fBrakeYAdjust, BRAKE_MOD_MIN_CLAMP, BRAKE_MOD_MAX_CLAMP );
fYAdjust += fBrakeYAdjust;
}
if( fAccels[PlayerOptions::ACCEL_WAVE] != 0 )
fYAdjust += fAccels[PlayerOptions::ACCEL_WAVE] * WAVE_MOD_MAGNITUDE *RageFastSin( fYOffset/WAVE_MOD_HEIGHT );
fYOffset += fYAdjust;
// Factor in boomerang
if( fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0 )
{
float fPeakAtYOffset = SCREEN_HEIGHT * BOOMERANG_PEAK_PERCENTAGE; // zero point of boomerang function
fPeakYOffsetOut = (-1*fPeakAtYOffset*fPeakAtYOffset/SCREEN_HEIGHT) + 1.5f*fPeakAtYOffset;
bIsPastPeakOut = fYOffset < fPeakAtYOffset;
fYOffset = (-1*fYOffset*fYOffset/SCREEN_HEIGHT) + 1.5f*fYOffset;
}
if( curr_options->m_fRandomSpeed > 0 && !bAbsolute )
//.........这里部分代码省略.........
示例3: Load
void ScoreKeeperNormal::Load(
const vector<Song*>& apSongs,
const vector<Steps*>& apSteps,
const vector<AttackArray> &asModifiers )
{
m_apSteps = apSteps;
ASSERT( apSongs.size() == apSteps.size() );
ASSERT( apSongs.size() == asModifiers.size() );
// True if a jump is one to combo, false if combo is purely based on tap count.
m_ComboIsPerRow.Load( "Gameplay", "ComboIsPerRow" );
m_MissComboIsPerRow.Load( "Gameplay", "MissComboIsPerRow" );
m_MinScoreToContinueCombo.Load( "Gameplay", "MinScoreToContinueCombo" );
m_MinScoreToMaintainCombo.Load( "Gameplay", "MinScoreToMaintainCombo" );
m_MaxScoreToIncrementMissCombo.Load( "Gameplay", "MaxScoreToIncrementMissCombo" );
m_MineHitIncrementsMissCombo.Load( "Gameplay", "MineHitIncrementsMissCombo" );
m_AvoidMineIncrementsCombo.Load( "Gameplay", "AvoidMineIncrementsCombo" );
m_UseInternalScoring.Load( "Gameplay", "UseInternalScoring" );
// This can be a function or a number, the type is checked when needed.
// -Kyz
m_toasty_trigger.Load("Gameplay", "ToastyTriggersAt");
m_toasty_min_tns.Load("Gameplay", "ToastyMinTNS");
// Fill in STATSMAN->m_CurStageStats, calculate multiplier
int iTotalPossibleDancePoints = 0;
int iTotalPossibleGradePoints = 0;
for( unsigned i=0; i<apSteps.size(); i++ )
{
Song* pSong = apSongs[i];
ASSERT( pSong != NULL );
Steps* pSteps = apSteps[i];
ASSERT( pSteps != NULL );
const AttackArray &aa = asModifiers[i];
NoteData ndTemp;
pSteps->GetNoteData( ndTemp );
// We might have been given lots of songs; don't keep them in memory uncompressed.
pSteps->Compress();
const Style* pStyle = GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber);
NoteData ndPre;
pStyle->GetTransformedNoteDataForStyle( m_pPlayerState->m_PlayerNumber, ndTemp, ndPre );
/* Compute RadarValues before applying any user-selected mods. Apply
* Course mods and count them in the "pre" RadarValues because they're
* forced and not chosen by the user. */
NoteDataUtil::TransformNoteData(ndPre, *(pSteps->GetTimingData()), aa, pSteps->m_StepsType, pSong );
/* Apply user transforms to find out how the notes will really look.
*
* XXX: This is brittle: if we end up combining mods for a song differently
* than ScreenGameplay, we'll end up with the wrong data. We should probably
* have eg. GAMESTATE->GetOptionsForCourse(po,so,pn) to get options based on
* the last call to StoreSelectedOptions and the modifiers list, but that'd
* mean moving the queues in ScreenGameplay to GameState ... */
NoteData ndPost = ndPre;
NoteDataUtil::TransformNoteData(ndPost, *(pSteps->GetTimingData()), m_pPlayerState->m_PlayerOptions.GetStage(), pSteps->m_StepsType);
GAMESTATE->SetProcessedTimingData(pSteps->GetTimingData()); // XXX: Not sure why but NoteDataUtil::CalculateRadarValues segfaults without this
iTotalPossibleDancePoints += this->GetPossibleDancePoints( &ndPre, &ndPost, pSteps->GetTimingData(), pSong->m_fMusicLengthSeconds );
iTotalPossibleGradePoints += this->GetPossibleGradePoints( &ndPre, &ndPost, pSteps->GetTimingData(), pSong->m_fMusicLengthSeconds );
GAMESTATE->SetProcessedTimingData(NULL);
}
m_pPlayerStageStats->m_iPossibleDancePoints = iTotalPossibleDancePoints;
m_pPlayerStageStats->m_iPossibleGradePoints = iTotalPossibleGradePoints;
m_iScoreRemainder = 0;
m_cur_toasty_combo = 0;
m_cur_toasty_level= 0;
// Initialize m_next_toasty_at to 0 so that CalcNextToastyAt just needs to
// add the value. -Kyz
m_next_toasty_at= 0;
m_next_toasty_at= CalcNextToastyAt(m_cur_toasty_level);
m_iMaxScoreSoFar = 0;
m_iPointBonus = 0;
m_iNumTapsAndHolds = 0;
m_iNumNotesHitThisRow = 0;
m_bIsLastSongInCourse = false;
Message msg( "ScoreChanged" );
msg.SetParam( "PlayerNumber", m_pPlayerState->m_PlayerNumber );
msg.SetParam( "MultiPlayer", m_pPlayerState->m_mp );
MESSAGEMAN->Broadcast( msg );
memset( m_ComboBonusFactor, 0, sizeof(m_ComboBonusFactor) );
m_iRoundTo = 1;
}