Beispiel #1
0
void LifeMeterTime::ChangeLife( TapNoteScore tns )
{
	if( GetLifeSeconds() <= 0 )
		return;

	float fMeterChange = 0;
	switch( tns )
	{
	default:
		FAIL_M(ssprintf("Invalid TapNoteScore: %i", tns));
	case TNS_W1:		fMeterChange = g_fTimeMeterSecondsChange[SE_W1];		break;
	case TNS_W2:		fMeterChange = g_fTimeMeterSecondsChange[SE_W2];		break;
	case TNS_W3:		fMeterChange = g_fTimeMeterSecondsChange[SE_W3];		break;
	case TNS_W4:		fMeterChange = g_fTimeMeterSecondsChange[SE_W4];		break;
	case TNS_W5:		fMeterChange = g_fTimeMeterSecondsChange[SE_W5];		break;
	case TNS_Miss:		fMeterChange = g_fTimeMeterSecondsChange[SE_Miss];		break;
	case TNS_HitMine:	fMeterChange = g_fTimeMeterSecondsChange[SE_HitMine];		break;
	case TNS_CheckpointHit:	fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointHit];	break;
	case TNS_CheckpointMiss:fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointMiss];	break;
	}

	float fOldLife = m_fLifeTotalLostSeconds;
	m_fLifeTotalLostSeconds -= fMeterChange;
	SendLifeChangedMessage( fOldLife, tns, HoldNoteScore_Invalid );
}
Beispiel #2
0
void LifeMeterTime::OnLoadSong()
{
	if( GetLifeSeconds() <= 0 && GAMESTATE->GetCourseSongIndex() > 0 )
		return;

	Course* pCourse = GAMESTATE->m_pCurCourse;
	ASSERT( pCourse != NULL );

	float fOldLife = m_fLifeTotalLostSeconds;
	float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
	if( MIN_LIFE_TIME > fGainSeconds )
		fGainSeconds = MIN_LIFE_TIME;
	m_fLifeTotalGainedSeconds += fGainSeconds;
	m_soundGainLife.Play();
	SendLifeChangedMessage( fOldLife, TapNoteScore_Invalid, HoldNoteScore_Invalid );
}
void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns )
{
	if( GetLifeSeconds() <= 0 )
		return;

	float fMeterChange = 0;
	switch( hns )
	{
	default:	ASSERT(0);
	case HNS_Held:	fMeterChange = g_fTimeMeterSecondsChange[SE_Held];	break;
	case HNS_LetGo:	fMeterChange = g_fTimeMeterSecondsChange[SE_LetGo];	break;
	}

	float fOldLife = m_fLifeTotalLostSeconds;
	m_fLifeTotalLostSeconds -= fMeterChange;
	SendLifeChangedMessage( fOldLife, tns, hns );
}
Beispiel #4
0
void LifeMeterTime::Update( float fDeltaTime )
{
	// update current stage stats so ScoreDisplayLifeTime can show the right thing
	float fSecs = GetLifeSeconds();
	fSecs = max( 0, fSecs );
	m_pPlayerStageStats->m_fLifeRemainingSeconds = fSecs;
	
	LifeMeter::Update( fDeltaTime );

	m_pStream->SetPercent( GetLife() );
	m_pStream->SetPassingAlpha( 0 );
	m_pStream->SetHotAlpha( 0 );

	if( m_pPlayerState->m_HealthState == HealthState_Danger )
		m_quadDangerGlow.SetDiffuseAlpha( 1 );
	else
		m_quadDangerGlow.SetDiffuseAlpha( 0 );
}
Beispiel #5
0
void LifeMeterTime::OnLoadSong()
{
	if( GetLifeSeconds() <= 0 && GAMESTATE->GetCourseSongIndex() > 0 )
		return;

	float fOldLife = m_fLifeTotalLostSeconds;
	float fGainSeconds = 0;
	if(GAMESTATE->IsCourseMode())
	{
		Course* pCourse = GAMESTATE->m_pCurCourse;
		ASSERT( pCourse != NULL );
		fGainSeconds= pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
	}
	else
	{
		// Placeholderish, at least this way it won't crash when someone tries it
		// out in non-course mode. -Kyz
		Song* song= GAMESTATE->m_pCurSong;
		ASSERT(song != NULL);
		float song_len= song->m_fMusicLengthSeconds;
		Steps* steps= GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber];
		ASSERT(steps != NULL);
		RadarValues radars= steps->GetRadarValues(m_pPlayerState->m_PlayerNumber);
		float scorable_things= radars[RadarCategory_TapsAndHolds] +
			radars[RadarCategory_Lifts];
		if(g_fTimeMeterSecondsChange[SE_Held] > 0.0f)
		{
			scorable_things+= radars[RadarCategory_Holds] +
				radars[RadarCategory_Rolls];
		}
		// Calculate the amount of time to give for the player to need 80% W1.
		float gainable_score_time= scorable_things * g_fTimeMeterSecondsChange[SE_W1];
		fGainSeconds= song_len - (gainable_score_time * INITIAL_VALUE);
	}

	if( MIN_LIFE_TIME > fGainSeconds )
		fGainSeconds = MIN_LIFE_TIME;
	m_fLifeTotalGainedSeconds += fGainSeconds;
	m_soundGainLife.Play();
	SendLifeChangedMessage( fOldLife, TapNoteScore_Invalid, HoldNoteScore_Invalid );
}
Beispiel #6
0
float LifeMeterTime::GetLife() const
{
	float fPercent = GetLifeSeconds() / FULL_LIFE_SECONDS;
	CLAMP( fPercent, 0, 1 );
	return fPercent;
}
Beispiel #7
0
bool LifeMeterTime::IsFailing() const
{
	return GetLifeSeconds() <= 0;
}