示例#1
0
void Attack::GetRealtimeAttackBeats(const Song* pSong, const PlayerState** pPlayerState, float& fStartBeat, float& fEndBeat) const
{
	if (fStartSecond >= 0)
	{
		GetAttackBeats(pSong, fStartBeat, fEndBeat);
		return;
	}

	ASSERT(pPlayerState);
	ASSERT(pSong);

	fStartBeat = min( GAMESTATE->m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat );
	fStartBeat = truncf(fStartBeat) + 1;

	const float fStartSecond = pSong->GetElapsedTimeFromBeat(fStartBeat);
	const float fEndSecond = fStartSecond + fSecsRemaining;
	fEndBeat = pSong->GetBeatFromElapsedTime(fEndSecond);
	fEndBeat = truncf(fEndBeat) + 1;

	ASSERT_M(fEndBeat >= fStartBeat, ssprintf("%f >= %f", fEndBeat, fStartBeat));
}
示例#2
0
/* Get the range for an attack that's being applied in realtime, eg. during battle
 * mode.  We need a PlayerState for this, so we can push the region off-screen to
 * prevent popping when the attack has note modifers. */
void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const
{
	if( fStartSecond >= 0 )
	{
		GetAttackBeats( pSong, fStartBeat, fEndBeat );
		return;
	}

	ASSERT( pPlayerState != NULL );
	ASSERT( pSong != NULL );

	/* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */
	fStartBeat = min( GAMESTATE->m_Position.m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat );
	fStartBeat = truncf(fStartBeat)+1;

	const TimingData &timing = pSong->m_SongTiming;
	const float lStartSecond = timing.GetElapsedTimeFromBeat( fStartBeat );
	const float fEndSecond = lStartSecond + fSecsRemaining;
	fEndBeat = timing.GetBeatFromElapsedTime( fEndSecond );
	fEndBeat = truncf(fEndBeat)+1;

	// loading the course should have caught this.
	ASSERT_M( fEndBeat >= fStartBeat, ssprintf("EndBeat %f >= StartBeat %f", fEndBeat, fStartBeat) );
}