Fixed popping notes problem with V, Colors and more. Fixed background movie synch.

This commit is contained in:
Chris Danford
2002-09-10 08:21:55 +00:00
parent 0e4f2d8a54
commit 44a27f646f
6 changed files with 88 additions and 68 deletions
+4 -1
View File
@@ -305,7 +305,10 @@ void Background::LoadFromSong( Song* pSong )
/* If we have only 2, only generate a single animation segment for for the
* whole song. Otherwise, if it's a movie., it'll loop every four bars; we
* want it to play continuously. */
const float fFirstBeat = (m_BackgroundMode==MODE_MOVIE_BG) ? 0 : pSong->m_fFirstBeat;
float fMusicStartBeat, fBPS;
bool bFreeze;
pSong->GetBeatAndBPSFromElapsedTime( -pSong->m_fBeat0OffsetInSeconds, fMusicStartBeat, fBPS, bFreeze );
const float fFirstBeat = (m_BackgroundMode==MODE_MOVIE_BG) ? fMusicStartBeat : pSong->m_fFirstBeat;
const float fLastBeat = pSong->m_fLastBeat;
if( m_BackgroundAnimations.GetSize() == 2) {
+4 -3
View File
@@ -20,6 +20,7 @@
#include "GameState.h"
#include "RageException.h"
#include "RageTimer.h"
#include "RageLog.h"
const float HOLD_NOTE_BITS_PER_BEAT = 6;
@@ -150,16 +151,16 @@ void NoteField::DrawPrimitives()
{
//LOG->Trace( "NoteField::DrawPrimitives()" );
float fSongBeat = max( 0, GAMESTATE->m_fSongBeat );
const float fSongBeat = GAMESTATE->m_fSongBeat;
const float fBeatsToDrawBehind = m_iPixelsToDrawBehind * (1/(float)ARROW_SIZE) * (1/GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fArrowScrollSpeed);
const float fBeatsToDrawAhead = m_iPixelsToDrawAhead * (1/(float)ARROW_SIZE) * (1/GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fArrowScrollSpeed);
const float fFirstBeatToDraw = max( 0, fSongBeat - fBeatsToDrawBehind );
const float fLastBeatToDraw = fSongBeat + fBeatsToDrawAhead;
const float fLastBeatToDraw = max( 0, fSongBeat + fBeatsToDrawAhead );
const int iFirstIndexToDraw = BeatToNoteRow(fFirstBeatToDraw);
const int iLastIndexToDraw = BeatToNoteRow(fLastBeatToDraw);
//LOG->Trace( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw );
LOG->Trace( "Drawing elements %d through %d", iFirstIndexToDraw, iLastIndexToDraw );
if( GAMESTATE->m_bEditing )
{
+4 -2
View File
@@ -293,6 +293,8 @@ ScreenEdit::~ScreenEdit()
void ScreenEdit::Update( float fDeltaTime )
{
m_soundMusic.Update( fDeltaTime );
float fPositionSeconds = m_soundMusic.GetPositionSeconds();
float fSongBeat, fBPS;
bool bFreeze;
@@ -848,8 +850,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
m_rectRecordBack.SetTweenDiffuse( D3DXCOLOR(0,0,0,0.8f) );
GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker - 4; // give a 1 measure lead-in
float fElapsedSeconds = max( 0, m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
m_soundMusic.SetPositionSeconds( fElapsedSeconds );
const float fStartSeconds = m_pSong->GetElapsedTimeFromBeat( GAMESTATE->m_fSongBeat );
m_soundMusic.SetPositionSeconds( fStartSeconds );
m_soundMusic.Play();
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
}
+55 -53
View File
@@ -349,59 +349,6 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
m_bTryExtraStage = false;
//////////////////////////
// Init non-ResultMode specific displays
//////////////////////////
for( l=0; l<NUM_JUDGE_LINES; l++ )
{
// EZ2 should hide these things by placing them off screen with theme metrics
m_sprJudgeLabels[l].Load( THEME->GetPathTo("Graphics","evaluation judge labels") );
m_sprJudgeLabels[l].StopAnimating();
m_sprJudgeLabels[l].SetState( l );
m_sprJudgeLabels[l].SetXY( JUDGE_LABELS_X, JUDGE_Y(l) );
m_sprJudgeLabels[l].SetZoom( 1.0f );
this->AddChild( &m_sprJudgeLabels[l] );
}
m_sprScoreLabel.Load( THEME->GetPathTo("Graphics","evaluation score labels") );
m_sprScoreLabel.SetState( m_ResultMode==RM_ONI ? 1 : 0 );
m_sprScoreLabel.StopAnimating();
m_sprScoreLabel.SetXY( SCORE_LABELS_X, SCORE_Y );
m_sprScoreLabel.SetZoom( 1.0f );
this->AddChild( &m_sprScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
for( l=0; l<NUM_JUDGE_LINES; l++ )
{
m_textJudgeNumbers[l][p].LoadFromTextureAndChars( THEME->GetPathTo("Graphics","evaluation score numbers 7x2"), "01234 :56789%." );
m_textJudgeNumbers[l][p].TurnShadowOff();
m_textJudgeNumbers[l][p].SetXY( JUDGE_X(p,l), JUDGE_Y(l) );
m_textJudgeNumbers[l][p].SetZoom( 0.7f );
m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) );
this->AddChild( &m_textJudgeNumbers[l][p] );
}
m_textJudgeNumbers[0][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_PERFECT]) );
m_textJudgeNumbers[1][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_GREAT]) );
m_textJudgeNumbers[2][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_GOOD]) );
m_textJudgeNumbers[3][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_BOO]) );
m_textJudgeNumbers[4][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_MISS]) );
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", iHoldNoteScores[p][HNS_OK]) );
m_textJudgeNumbers[6][p].SetText( ssprintf("%4d", iMaxCombo[p]) );
if( m_ResultMode==RM_ONI )
m_ScoreDisplay[p].SetText( SecondsToTime(GAMESTATE->GetPlayerSurviveTime( (PlayerNumber)p )) );
else
m_ScoreDisplay[p].SetScore( fScore[p] );
}
/////////////////////////////////
// Init ResultMode-specific displays
/////////////////////////////////
@@ -531,6 +478,61 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
}
}
//////////////////////////
// Init non-ResultMode specific displays.
// Do this after Result-specific displays so that the text will draw on top of
// the bonus frame.
//////////////////////////
for( l=0; l<NUM_JUDGE_LINES; l++ )
{
// EZ2 should hide these things by placing them off screen with theme metrics
m_sprJudgeLabels[l].Load( THEME->GetPathTo("Graphics","evaluation judge labels") );
m_sprJudgeLabels[l].StopAnimating();
m_sprJudgeLabels[l].SetState( l );
m_sprJudgeLabels[l].SetXY( JUDGE_LABELS_X, JUDGE_Y(l) );
m_sprJudgeLabels[l].SetZoom( 1.0f );
this->AddChild( &m_sprJudgeLabels[l] );
}
m_sprScoreLabel.Load( THEME->GetPathTo("Graphics","evaluation score labels") );
m_sprScoreLabel.SetState( m_ResultMode==RM_ONI ? 1 : 0 );
m_sprScoreLabel.StopAnimating();
m_sprScoreLabel.SetXY( SCORE_LABELS_X, SCORE_Y );
m_sprScoreLabel.SetZoom( 1.0f );
this->AddChild( &m_sprScoreLabel );
for( p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
for( l=0; l<NUM_JUDGE_LINES; l++ )
{
m_textJudgeNumbers[l][p].LoadFromTextureAndChars( THEME->GetPathTo("Graphics","evaluation score numbers 7x2"), "01234 :56789%." );
m_textJudgeNumbers[l][p].TurnShadowOff();
m_textJudgeNumbers[l][p].SetXY( JUDGE_X(p,l), JUDGE_Y(l) );
m_textJudgeNumbers[l][p].SetZoom( 0.7f );
m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) );
this->AddChild( &m_textJudgeNumbers[l][p] );
}
m_textJudgeNumbers[0][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_PERFECT]) );
m_textJudgeNumbers[1][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_GREAT]) );
m_textJudgeNumbers[2][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_GOOD]) );
m_textJudgeNumbers[3][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_BOO]) );
m_textJudgeNumbers[4][p].SetText( ssprintf("%4d", iTapNoteScores[p][TNS_MISS]) );
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", iHoldNoteScores[p][HNS_OK]) );
m_textJudgeNumbers[6][p].SetText( ssprintf("%4d", iMaxCombo[p]) );
if( m_ResultMode==RM_ONI )
m_ScoreDisplay[p].SetText( SecondsToTime(GAMESTATE->GetPlayerSurviveTime( (PlayerNumber)p )) );
else
m_ScoreDisplay[p].SetScore( fScore[p] );
}
bool bOneHasNewRecord = false;
for( p=0; p<NUM_PLAYERS; p++ )
+16 -4
View File
@@ -543,8 +543,10 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
m_Background.SetTweenDiffuse( D3DXCOLOR(1,1,1,1) );
m_soundMusic.Load( GAMESTATE->m_pCurSong->GetMusicPath(), true ); // enable accurate sync
float fStartSeconds = min( 0, -4+GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(GAMESTATE->m_pCurSong->m_fFirstBeat) );
m_soundMusic.SetPositionSeconds( fStartSeconds );
const float fFirstBeat = GAMESTATE->m_pCurSong->m_fFirstBeat;
const float fFirstSecond = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat( fFirstBeat );
const float fStartSecond = min( 0, fFirstSecond-4 );
m_soundMusic.SetPositionSeconds( fStartSecond );
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
if( !bFirstLoad )
m_soundMusic.Play();
@@ -608,17 +610,27 @@ void ScreenGameplay::Update( float fDeltaTime )
GAMESTATE->m_fSongBeat = fSongBeat;
GAMESTATE->m_fCurBPS = fBPS;
GAMESTATE->m_bFreeze = bFreeze;
// printf( "m_fSongBeat = %f\n", GAMESTATE->m_fSongBeat );
/* Before the music starts, we have no song position, so set it toto
/*
* Before the music starts, we have no song position, so set it toto
* -1; if we leave it alone we'll get 0, which will cause movies to start
* playing before the music starts.
*
* We really should be setting the beat to negative numbers before the song
* starts, leading up to 0, but we need a separate time source to do that.
* XXX: do this once we have a new sound infrastructure. */
* XXX: do this once we have a new sound infrastructure.
if(!m_soundMusic.IsPlaying())
GAMESTATE->m_fSongBeat = -1;
Chris: Actually, RageSoundStream has a "fake" second counter built into
it. If you set its position to a negative second and call Update() on it,
it will count up as if was playing music.
*/
// LOG->Trace( "GAMESTATE->m_fMusicSeconds = %f", GAMESTATE->m_fMusicSeconds );
+5 -5
View File
@@ -303,11 +303,11 @@ void ScreenSelectMusic::TweenOffScreen()
{
int i;
m_sprBannerFrame.FadeOff( 0, "bounce left", TWEEN_TIME );
m_Banner.FadeOff( 0, "bounce left", TWEEN_TIME );
m_BPMDisplay.FadeOff( 0, "bounce left", TWEEN_TIME );
m_textStage.FadeOff( 0, "bounce left", TWEEN_TIME );
m_sprCDTitle.FadeOff( 0, "bounce left", TWEEN_TIME );
m_sprBannerFrame.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_Banner.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_BPMDisplay.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_textStage.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_sprCDTitle.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
for( int p=0; p<NUM_PLAYERS; p++ )
{