From bfc327df13fa43f3e008c85bf528801ea6dd781b Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 29 May 2002 09:47:24 +0000 Subject: [PATCH] no message --- stepmania/src/Actor.cpp | 6 +- stepmania/src/BitmapText.cpp | 126 +++++++++++++++++--------- stepmania/src/GradeDisplay.cpp | 2 - stepmania/src/GrooveRadar.cpp | 4 +- stepmania/src/HoldJudgement.cpp | 1 + stepmania/src/LifeMeterBar.cpp | 46 +++++----- stepmania/src/LifeMeterBar.h | 2 +- stepmania/src/MenuElements.cpp | 8 +- stepmania/src/MusicWheel.cpp | 87 ++++++++++++------ stepmania/src/MusicWheel.h | 7 +- stepmania/src/Player.cpp | 58 ++++++------ stepmania/src/PrefsManager.cpp | 21 +++-- stepmania/src/PrefsManager.h | 5 +- stepmania/src/RageLog.cpp | 20 +++- stepmania/src/RageLog.h | 3 + stepmania/src/ScoreDisplayRolling.cpp | 58 +++++------- stepmania/src/ScoreDisplayRolling.h | 4 +- stepmania/src/ScreenEdit.cpp | 12 +-- stepmania/src/ScreenEditMenu.cpp | 4 +- stepmania/src/ScreenGameplay.cpp | 8 +- stepmania/src/ScreenSelectGroup.cpp | 2 +- stepmania/src/ScreenSelectMusic.cpp | 19 ++-- stepmania/src/SongManager.cpp | 31 ++++++- stepmania/src/SongManager.h | 12 ++- stepmania/src/StepMania.cpp | 4 +- stepmania/src/StepMania.dsp | 4 +- stepmania/src/StepMania.vcproj | 6 -- 27 files changed, 332 insertions(+), 228 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 376eb38a01..8296ad7c21 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -215,14 +215,16 @@ void Actor::Update( float fDeltaTime ) if( TS.m_fTimeLeftInTween <= 0 ) // The tweening is over. Stop the tweening { + int i; + m_pos = TS.m_end_pos; m_scale = TS.m_end_scale; m_rotation = TS.m_end_rotation; - for(int i=0; i<4; i++) m_colorDiffuse[i] = TS.m_end_colorDiffuse[i]; + for(i=0; i<4; i++) m_colorDiffuse[i] = TS.m_end_colorDiffuse[i]; m_colorAdd = TS.m_end_colorAdd; // delete the head tween - for( int i=0; iUnlock(); + + + + // Set the stage... + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); + pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); + + pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); + pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); + + pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); + pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); + + + + ////////////////////// + // render the shadow + ////////////////////// + if( m_bShadow && m_temp_colorDiffuse[0].a != 0 ) + { + DISPLAY->PushMatrix(); + DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units + + DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black + + /* + // YUCK. It is very common in crapier drivers that the texture factor doesn't work. + // Too bad because using the texture factor instead of recoloring the verticies is very fast. + pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); + + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + */ + + // recolor the verticies for a shadow + pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + for( int i=0; iUnlock(); + + + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + + + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); + + DISPLAY->PopMatrix(); + } + + + ////////////////////// + // render the diffuse pass + ////////////////////// + + // // set vertex colors for the diffuse pass // + pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + if( m_bRainbow ) { int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS; @@ -259,46 +323,6 @@ void BitmapText::DrawPrimitives() pVB->Unlock(); - - - // Set the stage... - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); - - pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); - pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); - - pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); - - - - ////////////////////// - // render the shadow - ////////////////////// - if( m_bShadow && m_temp_colorDiffuse[0].a != 0 ) - { - DISPLAY->PushMatrix(); - DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - - DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black - pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); - - DISPLAY->PopMatrix(); - } - - - ////////////////////// - // render the diffuse pass - ////////////////////// pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); @@ -315,6 +339,11 @@ void BitmapText::DrawPrimitives() if( m_temp_colorAdd.a != 0 ) { DWORD dwColor = m_temp_colorAdd; + + /* + // See above comment about some cards not correctly handling the + // texture factor render state. + pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); @@ -322,7 +351,20 @@ void BitmapText::DrawPrimitives() pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - + */ + + // recolor the verticies for + pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + for( int i=0; iUnlock(); + + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); } diff --git a/stepmania/src/GradeDisplay.cpp b/stepmania/src/GradeDisplay.cpp index c87e8a745d..d55a88b396 100644 --- a/stepmania/src/GradeDisplay.cpp +++ b/stepmania/src/GradeDisplay.cpp @@ -71,8 +71,6 @@ void GradeDisplay::SetGrade( Grade g ) StopUsingCustomCoords(); - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - switch( g ) { case GRADE_AAA: SetState(0); break; diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index 025652d594..51dec764f0 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -146,12 +146,10 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); pd3dDevice->SetTexture( 0, NULL ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 ); RAGEVERTEX* v; for( int p=0; pGetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) ); m_sprJudgement.StopAnimating(); + m_sprJudgement.TurnShadowOn(); this->AddActor( &m_sprJudgement ); } diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index f77b1d72b0..a611615648 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -31,20 +31,24 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) { bool bWasDoingGreat = IsDoingGreat(); + float fDeltaLife; switch( score ) { - case TNS_PERFECT: m_fLifePercentage += 0.02f; break; - case TNS_GREAT: m_fLifePercentage += 0.01f; break; - case TNS_GOOD: m_fLifePercentage += 0.00f; break; - case TNS_BOO: m_fLifePercentage -= 0.05f; break; - case TNS_MISS: m_fLifePercentage -= 0.10f; break; + case TNS_PERFECT: fDeltaLife = +0.02f; break; + case TNS_GREAT: fDeltaLife = +0.01f; break; + case TNS_GOOD: fDeltaLife = +0.00f; break; + case TNS_BOO: fDeltaLife = -0.06f; break; + case TNS_MISS: fDeltaLife = -0.12f; break; } + + if( bWasDoingGreat && !IsDoingGreat() ) + fDeltaLife = -0.12f; // make it take a while to get back to "doing great" + + m_fLifePercentage += fDeltaLife; m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 ); - bool bIsDoingGreat = IsDoingGreat(); - - if( bWasDoingGreat && !bIsDoingGreat ) - m_fLifePercentage -= 0.10f; // make it take a while to get back to "doing great" + if( m_fLifePercentage == 0 ) + m_bHasFailed = true; ResetBarVelocity(); } @@ -74,24 +78,16 @@ bool LifeMeterBar::HasFailed() void LifeMeterBar::Update( float fDeltaTime ) { - m_fLifeVelocity *= 1-fDeltaTime*2; // dampen + float fDelta = m_fLifePercentage - m_fTrailingLifePercentage; + m_fLifeVelocity += fDelta * fDeltaTime; // accelerate + m_fLifeVelocity *= 1-fDeltaTime; // dampen + m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime; - // there are some cases where we want to snap the meter - bool bSnap = m_fTrailingLifePercentage >= 1; + float fNewDelta = m_fLifePercentage - m_fTrailingLifePercentage; - if( bSnap ) - { - m_fTrailingLifePercentage = m_fLifePercentage; - m_fLifeVelocity = 0; - } - else - { - m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime; - m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 ); - } - - if( m_fLifePercentage == 0 ) - m_bHasFailed = true; + if( fDelta * fNewDelta < 0 ) // the deltas have different signs + m_fLifeVelocity /= 4; + m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 ); } diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index 96d71611fb..ebabd82dda 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -35,5 +35,5 @@ private: float m_fLifePercentage; float m_fTrailingLifePercentage; // this approaches m_fLifePercentage float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage - bool m_bHasFailed; + bool m_bHasFailed; // set this to true when life dips below 0 }; diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 63ccd0d4cc..d2d6d8e640 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -190,7 +190,7 @@ void MenuElements::TweenOnScreenFromBlack( ScreenMessage smSendWhenDone ) { TweenTopLayerOnScreen(); TweenBottomLayerOnScreen(); - m_Wipe.OpenWipingRight( smSendWhenDone ); + //m_Wipe.OpenWipingRight( smSendWhenDone ); m_soundSwoosh.Play(); } @@ -201,9 +201,11 @@ void MenuElements::TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPl TweenTopLayerOffScreen(); TweenBottomLayerOffScreen(); } - m_Wipe.CloseWipingRight( smSendWhenDone ); - if( bPlayBackSound ) + else + { m_soundBack.Play(); + m_Wipe.CloseWipingLeft( smSendWhenDone ); + } } void MenuElements::DrawPrimitives() diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 3c3f693f79..a724a684d6 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -146,14 +146,14 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) break; case TYPE_SONG: { - m_TextBanner.LoadFromSong( m_pSong ); - D3DXCOLOR color = m_color; - color.r += 0.15f; - color.g += 0.15f; - color.b += 0.15f; - m_TextBanner.SetDiffuseColor( color ); - m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); - RefreshGrades(); + m_TextBanner.LoadFromSong( m_pSong ); + D3DXCOLOR color = m_color; + color.r += 0.15f; + color.g += 0.15f; + color.b += 0.15f; + m_TextBanner.SetDiffuseColor( color ); + m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); + RefreshGrades(); } break; case TYPE_ROULETTE: @@ -167,6 +167,7 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) void WheelItemDisplay::RefreshGrades() { + // Refresh Grades for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) @@ -175,20 +176,22 @@ void WheelItemDisplay::RefreshGrades() continue; } - const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p]; if( m_pSong ) // this is a song display { + const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p]; const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMEMAN->GetCurrentStyleDef()->m_NotesType, dc ); m_GradeDisplay[p].SetGrade( grade ); - m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); + //m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); } else // this is a section display { m_GradeDisplay[p].SetGrade( GRADE_NO_DATA ); } } + } + void WheelItemDisplay::Update( float fDeltaTime ) { Actor::Update( fDeltaTime ); @@ -247,15 +250,20 @@ MusicWheel::MusicWheel() GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; + m_frameOverlay.SetXY( 0, 0 ); + for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + continue; // skip + m_sprHighScoreFrame[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SCORE_FRAME) ); m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] ); - this->AddActor( &m_sprHighScoreFrame[p] ); + m_frameOverlay.AddActor( &m_sprHighScoreFrame[p] ); m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f ); m_HighScore[p].SetZoom( 0.6f ); - this->AddActor( &m_HighScore[p] ); + m_frameOverlay.AddActor( &m_HighScore[p] ); } m_sprHighScoreFrame[1].SetZoomY( -1 ); // flip vertically @@ -265,11 +273,14 @@ MusicWheel::MusicWheel() m_sprSelectionOverlay.SetXY( 0, 0 ); m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) ); - this->AddActor( &m_sprSelectionOverlay ); + m_frameOverlay.AddActor( &m_sprSelectionOverlay ); m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y ); m_MusicSortDisplay.SetEffectGlowing( 1.0f ); - this->AddActor( &m_MusicSortDisplay ); + m_frameOverlay.AddActor( &m_MusicSortDisplay ); + + this->AddActor( &m_frameOverlay ); + m_ScrollBar.SetX( SCROLLBAR_X ); this->AddActor( &m_ScrollBar ); @@ -315,7 +326,7 @@ MusicWheel::MusicWheel() SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs ); if( arraySongs.GetSize() > 0 ) - SONGMAN->m_pCurSong = arraySongs[0]; // select the first song + SONGMAN->SetCurrentSong( arraySongs[0] ); // select the first song } @@ -324,7 +335,7 @@ MusicWheel::MusicWheel() // find the previously selected song (if any) for( int i=0; im_pCurSong ) + if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->GetCurrentSong() ) { m_iSelection = i; // select it m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group @@ -572,8 +583,8 @@ void MusicWheel::RebuildWheelItemDisplays() void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score { DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[pn]; - Song* pSong = SONGMAN->m_pCurSong; - Notes* m_pNotes = SONGMAN->m_pCurNotes[pn]; + Song* pSong = SONGMAN->GetCurrentSong(); + Notes* m_pNotes = SONGMAN->GetCurrentNotes( pn ); if( m_pNotes ) m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore ); @@ -886,12 +897,22 @@ void MusicWheel::TweenOnScreen() } - float fX = GetBannerX(0); - float fY = GetBannerY(0); - m_sprSelectionOverlay.SetXY( fX+320, fY ); - m_sprSelectionOverlay.BeginTweeningQueued( 0.5f ); // sleep - m_sprSelectionOverlay.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN ); - m_sprSelectionOverlay.SetTweenX( fX ); + float fX, fY; + + fX = GetBannerX(0); + fY = GetBannerY(0); + m_frameOverlay.SetXY( fX+320, fY ); + m_frameOverlay.BeginTweeningQueued( 0.5f ); // sleep + m_frameOverlay.BeginTweeningQueued( 0.4f, Actor::TWEEN_BIAS_BEGIN ); + m_frameOverlay.SetTweenX( fX ); + + + fX = m_ScrollBar.GetX(); + fY = m_ScrollBar.GetY(); + m_ScrollBar.SetXY( fX+30, fY ); + m_ScrollBar.BeginTweeningQueued( 0.7f ); // sleep + m_ScrollBar.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN ); + m_ScrollBar.SetTweenX( fX ); for( int i=0; i m_WheelItemDatas[NUM_SORT_ORDERS]; CArray &GetCurWheelItemDatas() { return m_WheelItemDatas[m_SortOrder]; }; diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index ff55d9a056..dfa216877a 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -115,14 +115,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference // // Check for TapNote misses // - int iNumMisses = UpdateTapNotesMissedOlderThan( m_fSongBeat-fMaxBeatDifference ); - if( iNumMisses > 0 ) - { - m_Judgement.SetJudgement( TNS_MISS ); - m_Combo.EndCombo(); - for( int i=0; iChangeLife( TNS_MISS ); - } + UpdateTapNotesMissedOlderThan( m_fSongBeat-fMaxBeatDifference ); // @@ -358,6 +351,8 @@ void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ) //LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); + int iIndexOverlappingNote = -1; // leave as -1 if we don't find any + // Start at iIndexStartLookingAt and search outward. The first one that overlaps the player's step is the closest match. for( int delta=0; delta <= iNumElementsToExamine; delta++ ) { @@ -374,38 +369,35 @@ void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ) //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier ); if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap { - m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit - - bool bRowDestroyed = true; - for( int t=0; tWriteLine( "Checking Notes[%d]", iCurrentIndexLater ); if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap { - m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit - - bool bRowDestroyed = true; - for( int t=0; t 0 ) + { + m_Judgement.SetJudgement( TNS_MISS ); + m_Combo.EndCombo(); + } + return iNumMissesFound; } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 2f3dd31d8e..3c43162a6c 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -35,7 +35,7 @@ PrefsManager::PrefsManager() m_PreferredDifficultyClass[p] = CLASS_EASY; m_SongSortOrder = SORT_GROUP; m_PlayMode = PLAY_MODE_ARCADE; - m_iCurrentStage = 1; + m_iCurrentStageIndex = 0; ReadPrefsFromDisk(); } @@ -84,29 +84,36 @@ void PrefsManager::SavePrefsToDisk() ini.WriteFile(); } +int PrefsManager::GetStageIndex() +{ + return m_iCurrentStageIndex; +} + int PrefsManager::GetStageNumber() { - return m_iCurrentStage; + return m_iCurrentStageIndex+1; } bool PrefsManager::IsFinalStage() { - return m_iNumArcadeStages == m_iCurrentStage; + return m_iCurrentStageIndex == m_iNumArcadeStages-1; } CString PrefsManager::GetStageText() { - if( m_iCurrentStage == 3 ) + if( m_iCurrentStageIndex == m_iNumArcadeStages-1 ) return "Final"; + int iStageNo = m_iCurrentStageIndex+1; + CString sNumberSuffix; - if( ( (m_iCurrentStage/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213) + if( ( (iStageNo/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213) { sNumberSuffix = "th"; } else // not in the teens { - const int iLastDigit = m_iCurrentStage%10; + const int iLastDigit = iStageNo%10; switch( iLastDigit ) { case 1: sNumberSuffix = "st"; break; @@ -115,6 +122,6 @@ CString PrefsManager::GetStageText() default:sNumberSuffix = "th"; break; } } - return ssprintf( "%d%s", PREFSMAN->m_iCurrentStage, sNumberSuffix ); + return ssprintf( "%d%s", this->GetStageNumber(), sNumberSuffix ); } diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 4291cc8c26..4067bb3907 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -42,10 +42,11 @@ public: // Options that are NOT saved between sessions DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; - SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits + SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits PlayMode m_PlayMode; - int m_iCurrentStage; // starts at 1, and is incremented with each Stage Clear + int m_iCurrentStageIndex; // starts at 0, and is incremented with each Stage Clear + int GetStageIndex(); int GetStageNumber(); bool IsFinalStage(); CString GetStageText(); diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index 17dff0b98d..cdb031ef81 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -31,10 +31,7 @@ RageLog::RageLog() // delete old log files DeleteFile( LOG_FILE_NAME ); - // create a new console window and attach standard handles - AllocConsole(); - freopen("CONOUT$","wb",stdout); - freopen("CONOUT$","wb",stderr); + ShowConsole(); // Open log file and leave it open. Let the OS close it when the app exits m_fileLog = fopen( LOG_FILE_NAME, "w" ); @@ -51,11 +48,24 @@ RageLog::RageLog() RageLog::~RageLog() { - FreeConsole(); Flush(); + FreeConsole(); fclose( m_fileLog ); } +void RageLog::ShowConsole() +{ + // create a new console window and attach standard handles + AllocConsole(); + freopen("CONOUT$","wb",stdout); + freopen("CONOUT$","wb",stderr); +} + +void RageLog::HideConsole() +{ + FreeConsole(); +} + void RageLog::WriteLine( LPCTSTR fmt, ...) { va_list va; diff --git a/stepmania/src/RageLog.h b/stepmania/src/RageLog.h index 95c2859333..ef483396ac 100644 --- a/stepmania/src/RageLog.h +++ b/stepmania/src/RageLog.h @@ -21,6 +21,9 @@ public: void WriteLineHr( HRESULT hr, LPCTSTR fmt, ...); void Flush(); + void ShowConsole(); + void HideConsole(); + protected: FILE* m_fileLog; }; diff --git a/stepmania/src/ScoreDisplayRolling.cpp b/stepmania/src/ScoreDisplayRolling.cpp index 74d7fc4053..3655b63dc1 100644 --- a/stepmania/src/ScoreDisplayRolling.cpp +++ b/stepmania/src/ScoreDisplayRolling.cpp @@ -15,6 +15,9 @@ #include "ThemeManager.h" +const float SCORE_TWEEN_TIME = 0.5f; + + ScoreDisplayRolling::ScoreDisplayRolling() { LOG->WriteLine( "ScoreDisplayRolling::ScoreDisplayRolling()" ); @@ -23,12 +26,7 @@ ScoreDisplayRolling::ScoreDisplayRolling() Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) ); TurnShadowOff(); - // init the digits - for( int i=0; i 9 ) - m_iCurrentScoreDigits[i] = 0; + CString sFormat = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS ); + SetText( ssprintf(sFormat, m_fTrailingScore) ); } - int iCurScore = 0; - int iMultiplier = 1; - for( int d=NUM_SCORE_DIGITS-1; d>=0; d-- ) // foreach digit - { - iCurScore += m_iCurrentScoreDigits[d] * iMultiplier; - iMultiplier *= 10; - } - - CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS ); - SetText( ssprintf(sFormat, iCurScore) ); - BitmapText::Draw(); } diff --git a/stepmania/src/ScoreDisplayRolling.h b/stepmania/src/ScoreDisplayRolling.h index d1f5015b1c..8048963b43 100644 --- a/stepmania/src/ScoreDisplayRolling.h +++ b/stepmania/src/ScoreDisplayRolling.h @@ -35,6 +35,6 @@ public: protected: float m_fScore; - int m_iCurrentScoreDigits[NUM_SCORE_DIGITS]; - int m_iDestinationScoreDigits[NUM_SCORE_DIGITS]; + float m_fTrailingScore; + float m_fScoreVelocity; }; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 38a64e8e57..6ad22a2a0d 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -53,7 +53,7 @@ ScreenEdit::ScreenEdit() { LOG->WriteLine( "ScreenEdit::ScreenEdit()" ); - m_pSong = SONGMAN->m_pCurSong; + m_pSong = SONGMAN->GetCurrentSong(); m_Mode = MODE_EDIT; @@ -80,7 +80,7 @@ ScreenEdit::ScreenEdit() NoteData noteData; noteData.m_iNumTracks = GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer; if( SONGMAN->m_pCurNotes[PLAYER_1] != NULL ) - noteData = *SONGMAN->m_pCurNotes[PLAYER_1]->GetNoteData(); + noteData = *SONGMAN->GetCurrentNotes(PLAYER_1)->GetNoteData(); m_NoteFieldEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_NoteFieldEdit.SetZoom( 0.5f ); @@ -364,20 +364,20 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ case DIK_S: // copy edit into current Notes Notes* pNotes; - pNotes = SONGMAN->m_pCurNotes[PLAYER_1]; + pNotes = SONGMAN->GetCurrentNotes(PLAYER_1); if( pNotes == NULL ) { // allocate a new Notes - SONGMAN->m_pCurSong->m_arrayNotes.SetSize( SONGMAN->m_pCurSong->m_arrayNotes.GetSize() + 1 ); - pNotes = &SONGMAN->m_pCurSong->m_arrayNotes[ SONGMAN->m_pCurSong->m_arrayNotes.GetSize()-1 ]; + SONGMAN->GetCurrentSong()->m_arrayNotes.SetSize( SONGMAN->GetCurrentSong()->m_arrayNotes.GetSize() + 1 ); + pNotes = &SONGMAN->GetCurrentSong()->m_arrayNotes[ SONGMAN->GetCurrentSong()->m_arrayNotes.GetSize()-1 ]; pNotes->m_NotesType = GAMEMAN->m_CurNotesType; pNotes->m_sDescription = "Untitled"; pNotes->m_iMeter = 1; } pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit ); - SONGMAN->m_pCurSong->Save(); + SONGMAN->GetCurrentSong()->Save(); break; case DIK_UP: case DIK_DOWN: diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index e7e2a714f6..0b5bf11895 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -310,9 +310,9 @@ void ScreenEditMenu::MenuStart( const PlayerNumber p ) MUSIC->Stop(); - SONGMAN->m_pCurSong = GetSelectedSong(); + SONGMAN->SetCurrentSong( GetSelectedSong() ); GAMEMAN->m_CurNotesType = GetSelectedNotesType(); - SONGMAN->m_pCurNotes[PLAYER_1] = GetSelectedNotes(); + SONGMAN->SetCurrentNotes( PLAYER_1, GetSelectedNotes() ); m_soundSelect.PlayRandom(); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index def86bcf30..73c8912168 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -71,10 +71,10 @@ ScreenGameplay::ScreenGameplay() m_fTimeLeftBeforeDancingComment = TIME_BETWEEN_DANCING_COMMENTS; m_bHasFailed = false; - m_pSong = SONGMAN->m_pCurSong; + m_pSong = SONGMAN->GetCurrentSong(); - m_Background.LoadFromSong( SONGMAN->m_pCurSong ); + m_Background.LoadFromSong( m_pSong ); m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) ); this->AddActor( &m_Background ); @@ -91,11 +91,11 @@ ScreenGameplay::ScreenGameplay() if( PREFSMAN->m_PlayerOptions[p].m_bReverseScroll ) fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y; m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY ); - m_DifficultyBanner[p].SetFromNotes( SONGMAN->m_pCurNotes[p] ); + m_DifficultyBanner[p].SetFromNotes( SONGMAN->GetCurrentNotes((PlayerNumber)p) ); this->AddActor( &m_DifficultyBanner[p] ); - NoteData* pOriginalNoteData = SONGMAN->m_pCurNotes[p]->GetNoteData(); + NoteData* pOriginalNoteData = SONGMAN->GetCurrentNotes((PlayerNumber)p)->GetNoteData(); NoteData newNoteData; GAMEMAN->GetCurrentStyleDef()->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData ); diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 06ff011abe..35492abc42 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -280,7 +280,7 @@ void ScreenSelectGroup::MenuStart( const PlayerNumber p ) m_soundSelect.PlayRandom(); m_bChosen = true; - SONGMAN->m_pCurSong = NULL; + SONGMAN->SetCurrentSong( NULL ); SONGMAN->m_sPreferredGroup = m_arrayGroupNames[m_iSelection]; if( 0 == stricmp(SONGMAN->m_sPreferredGroup, "All Music") ) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 02bab8d5bb..b53031a5f8 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -114,7 +114,7 @@ ScreenSelectMusic::ScreenSelectMusic() m_textHoldForOptions.SetZoom( 1 ); m_textHoldForOptions.SetZoomY( 0 ); m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.SetZ( -4 ); + m_textHoldForOptions.SetZ( -2 ); this->AddActor( &m_textHoldForOptions ); @@ -348,18 +348,13 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p ) return; } - TweenOffScreen(); - m_Menu.TweenOffScreenToBlack( SM_None, false ); - - m_soundSelect.PlayRandom(); - bool bIsNew = m_MusicWheel.GetSelectedSong()->IsNew(); bool bIsHard = false; for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip - if( SONGMAN->m_pCurNotes[p] && SONGMAN->m_pCurNotes[p]->m_iMeter >= 9 ) + if( SONGMAN->GetCurrentNotes((PlayerNumber)p) && SONGMAN->GetCurrentNotes((PlayerNumber)p)->m_iMeter >= 9 ) bIsHard = true; } @@ -370,12 +365,16 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p ) else SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); - ; + + TweenOffScreen(); + + m_soundSelect.PlayRandom(); // show "hold NEXT for options" m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in m_textHoldForOptions.SetTweenZoomY( 1 ); + m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); @@ -412,7 +411,7 @@ void ScreenSelectMusic::AfterNotesChange( const PlayerNumber p ) Notes* pNotes = m_arrayNotes.GetSize()>0 ? m_arrayNotes[m_iSelection[p]] : NULL; - SONGMAN->m_pCurNotes[p] = pNotes; + SONGMAN->SetCurrentNotes( p, pNotes ); m_DifficultyIcon[p].SetFromNotes( pNotes ); m_FootMeter[p].SetFromNotes( pNotes ); @@ -423,7 +422,7 @@ void ScreenSelectMusic::AfterNotesChange( const PlayerNumber p ) void ScreenSelectMusic::AfterMusicChange() { Song* pSong = m_MusicWheel.GetSelectedSong(); - SONGMAN->m_pCurSong = pSong; + SONGMAN->SetCurrentSong( pSong ); m_arrayNotes.RemoveAll(); diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index e5e479781e..2edf88db9a 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -15,6 +15,7 @@ #include "IniFile.h" #include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" +#include "PrefsManager.h" SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program @@ -35,9 +36,12 @@ const int NUM_GROUP_COLORS = sizeof(GROUP_COLORS) / sizeof(D3DXCOLOR); SongManager::SongManager() { - m_pCurSong = NULL; - for( int p=0; pGetStageIndex() ]; +} + +Notes* SongManager::GetCurrentNotes( PlayerNumber p ) +{ + return m_pCurNotes[ PREFSMAN->GetStageIndex() ][p]; +} + +void SongManager::SetCurrentSong( Song* pSong ) +{ + m_pCurSong[ PREFSMAN->GetStageIndex() ] = pSong; +} + +void SongManager::SetCurrentNotes( PlayerNumber p, Notes* pNotes ) +{ + m_pCurNotes[ PREFSMAN->GetStageIndex() ][p] = pNotes; +} + + void SongManager::InitSongArrayFromDisk() { LoadStepManiaSongDir( "Songs" ); diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 0a04d1cb87..3e2885bc7d 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -15,6 +15,7 @@ #include "Song.h" //#include // for D3DXCOLOR +const int MAX_SONG_QUEUE_SIZE = 30; class SongManager { @@ -22,14 +23,21 @@ public: SongManager(); ~SongManager(); - Song* m_pCurSong; - Notes* m_pCurNotes[NUM_PLAYERS]; + Song* m_pCurSong[MAX_SONG_QUEUE_SIZE]; + Notes* m_pCurNotes[MAX_SONG_QUEUE_SIZE][NUM_PLAYERS]; CString m_sPreferredGroup; CArray m_pSongs; // all songs that can be played void InitSongArrayFromDisk(); + + Song* GetCurrentSong(); + Notes* GetCurrentNotes( PlayerNumber p ); + void SetCurrentSong( Song* pSong ); + void SetCurrentNotes( PlayerNumber p, Notes* pNotes ); + + void CleanUpSongArray(); void ReloadSongArray(); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 505a20f6c0..cbc52a6635 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -233,7 +233,9 @@ void MainLoop() CreateObjects( g_hWndMain ); // Create the game objects ShowWindow( g_hWndMain, SW_SHOW ); - +#ifdef RELEASE + LOG->HideConsole(); +#endif // Now we're ready to recieve and process Windows messages. MSG msg; diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 5a071457eb..8ddbad5456 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -65,7 +65,7 @@ LINK32=link.exe # PROP Use_MFC 1 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "../" -# PROP Intermediate_Dir "../Debug" +# PROP Intermediate_Dir "../Debug-VC6" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-debug.exe" /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-debug-VC6.exe" /pdbtype:sept !ENDIF diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 072499cdfe..1d13d780f2 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -719,12 +719,6 @@ - - - -