From 7884f8391ad675133be1c06cdf58e9ed14ff6364 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 20 Dec 2001 12:37:38 +0000 Subject: [PATCH] no message --- stepmania/src/Actor.h | 2 +- stepmania/src/Player.cpp | 380 ++++++++++++++++++++++++++++++------ stepmania/src/Player.h | 8 +- stepmania/src/RageUtil.cpp | 16 ++ stepmania/src/RageUtil.h | 1 + stepmania/src/Song.cpp | 34 ++-- stepmania/src/StepMania.cpp | 25 ++- stepmania/src/StepMania.dsp | 16 ++ 8 files changed, 389 insertions(+), 93 deletions(-) diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 261185f545..37a68fee3e 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -87,7 +87,7 @@ public: TweenType tt = tween_linear ); virtual void BeginTweening( float time, TweenType tt = tween_linear ); - virtual void StopTweening( float time, TweenType tt = tween_linear ) { m_TweenType = no_tween; }; + virtual void StopTweening() { m_TweenType = no_tween; }; virtual void SetTweenX( float x ); virtual void SetTweenY( float y ); virtual void SetTweenXY( float x, float y ); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 1bf6c4640d..10e3b38be7 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -40,17 +40,18 @@ const int NUM_FRAMES_IN_COLOR_ARROW_SPRITE = 12; const float JUDGEMENT_DISPLAY_TIME = 0.6f; -const CString JUDGEMENT_TEXTURE = "Textures\\judgement 1x6.png"; -const float JUDGEMENT_Y = CENTER_Y; +const CString JUDGEMENT_TEXTURE = "Textures\\judgement 1x9.png"; +const float JUDGEMENT_Y_OFFSET = 20; -const CString HOLD_JUDGEMENT_TEXTURE = "Textures\\Hold Arrow Judgement 1x3.png"; -const float HOLD_JUDGEMENT_Y = GRAY_ARROW_Y + 50; +const CString HOLD_JUDGEMENT_TEXTURE = "Textures\\judgement 1x9.png"; +const float HOLD_JUDGEMENT_Y = GRAY_ARROW_Y + 80; -const CString SEQUENCE_NUMBERS = "SpriteSequences\\Bold Numbers.seq"; +const CString SEQUENCE_COMBO_NUMBERS = "SpriteSequences\\MAX Numbers.seq"; +const CString SEQUENCE_SCORE_NUMBERS = "SpriteSequences\\Bold Numbers.seq"; const float COMBO_TWEEN_TIME = 0.5f; -const CString COMBO_TEXTURE = "Textures\\Combo.png"; +const CString COMBO_TEXTURE = "Textures\\judgement 1x9.png"; const float COMBO_Y = (CENTER_Y+60); @@ -68,9 +69,10 @@ const CString SCORE_FRAME_TEXTURE = "Textures\\Score Frame.png"; const float SCORE_Y = SCREEN_HEIGHT - 40; -Player::Player( PlayerOptions po ) +Player::Player( PlayerOptions po, PlayerNumber pn ) { m_PlayerOptions = po; + m_PlayerNumber = pn; m_iCurCombo = 0; m_iMaxCombo = 0; @@ -180,11 +182,34 @@ Player::Player( PlayerOptions po ) m_ColorArrow[c].SetRotation( m_ColumnToRotation[c] ); } + + // holder for judgement and combo displays + m_frameJudgementAndCombo.AddActor( &m_sprJudgement ); + m_frameJudgementAndCombo.AddActor( &m_sprCombo ); + m_frameJudgementAndCombo.AddActor( &m_ComboNumber ); + m_frameJudgementAndCombo.SetXY( CENTER_X, CENTER_Y ); + // judgement m_fJudgementDisplayCountdown = 0; m_sprJudgement.LoadFromTexture( JUDGEMENT_TEXTURE ); m_sprJudgement.StopAnimating(); + m_sprJudgement.SetXY( 0, m_PlayerOptions.m_bReverseScroll ? JUDGEMENT_Y_OFFSET : -JUDGEMENT_Y_OFFSET ); + // combo + m_sprCombo.LoadFromTexture( COMBO_TEXTURE ); + m_sprCombo.StopAnimating(); + m_sprCombo.SetState( 6 ); + m_sprCombo.SetXY( 40, m_PlayerOptions.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET+2 ); + m_sprCombo.SetZoom( 1.0f ); + + m_ComboNumber.LoadFromSequenceFile( SEQUENCE_COMBO_NUMBERS ); + m_ComboNumber.SetXY( -40, m_PlayerOptions.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET ); + + m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible + m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible + + + // hold judgement for( c=0; c tempHoldSteps; + + // copy the steps into our tempSteps where we will transform them for( int i=0; iIsButtonDown( PlayerI ) ) // they're holding the button down { int iCol = m_StepToColumnNumber[ hs.m_Step ]; @@ -333,6 +498,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference UpdateCombo( fDeltaTime ); UpdateScore( fDeltaTime ); UpdateLifeMeter( fDeltaTime ); + + m_frameJudgementAndCombo.Update( fDeltaTime ); } void Player::Draw() @@ -343,7 +510,9 @@ void Player::Draw() DrawJudgement(); DrawCombo(); DrawScore(); - DrawLifeMeter(); + DrawLifeMeter(); + + m_frameJudgementAndCombo.Draw(); } @@ -633,9 +802,11 @@ void Player::DrawColorArrows() { if( m_LeftToStepOn[i] != 0 ) // this step is not yet complete { + float fYOffset = GetColorArrowYOffset( i, m_fSongBeat ); float fYPos = GetColorArrowYPos( i, m_fSongBeat ); if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; + float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); // beats until the note is stepped on. float fBeatsTilStep = StepIndexToBeat( i ) - m_fSongBeat; @@ -646,6 +817,7 @@ void Player::DrawColorArrows() if( m_OriginalStep[i] & m_ColumnNumberToStep[c] ) { // this column is still unstepped on? m_ColorArrow[c].SetY( fYPos ); m_ColorArrow[c].SetIndexAndBeat( i, m_fSongBeat ); + m_ColorArrow[c].SetAlpha( fAlpha ); m_ColorArrow[c].Draw(); } } @@ -686,17 +858,24 @@ void Player::DrawColorArrows() // draw the gray parts for( int j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze { + float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); + float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); + float fYPos = GetColorArrowYPos( j, m_fSongBeat ); if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK ) fYPos = max( fYPos, GetGrayArrowYPos() ); if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; m_ColorArrow[iColNum].SetY( fYPos ); + m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].DrawGrayPart(); } // draw the color parts for( j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze { + float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); + float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); + float fYPos = GetColorArrowYPos( j, m_fSongBeat ); m_ColorArrow[iColNum].SetY( fYPos ); if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK ) @@ -704,12 +883,16 @@ void Player::DrawColorArrows() if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; m_ColorArrow[iColNum].SetY( fYPos ); D3DXCOLOR color( (float)(j-hs.m_iStartIndex)/(float)(hs.m_iEndIndex-hs.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow - m_ColorArrow[iColNum].SetDiffuseColor( color ); + m_ColorArrow[iColNum].SetDiffuseColor( color ); + m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].DrawColorPart(); } // draw the first arrow on top of the others j = hs.m_iStartIndex; + + float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); + float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); float fYPos = GetColorArrowYPos( j, m_fSongBeat ); if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK ) fYPos = max( fYPos, GetGrayArrowYPos() ); @@ -718,6 +901,7 @@ void Player::DrawColorArrows() m_ColorArrow[iColNum].SetIndexAndBeat( i, m_fSongBeat ); D3DXCOLOR color( 0, 1, 0, 1 ); // color shifts from green to yellow m_ColorArrow[iColNum].SetDiffuseColor( color ); + m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].Draw(); } @@ -745,6 +929,48 @@ float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat ) } +float Player::GetColorArrowYOffset( int iStepIndex, float fSongBeat ) +{ + float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat; + float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed; + switch( m_PlayerOptions.m_EffectType ) + { + case PlayerOptions::EFFECT_BOOST: + fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT); + break; + case PlayerOptions::EFFECT_WAVE: + fYOffset += 15*sin( fYOffset/38 ); + break; + } + return fYOffset; +} + +float Player::GetColorArrowAlphaFromYOffset( float fYOffset ) +{ + float fAlpha; + switch( m_PlayerOptions.m_AppearanceType ) + { + case PlayerOptions::APPEARANCE_VISIBLE: + fAlpha = 1; + break; + case PlayerOptions::APPEARANCE_HIDDEN: +// fAlpha = m_PlayerOptions.m_bReverseScroll ? ((SCREEN_HEIGHT-(fYPos-200))/200) : ((fYPos-200)/200); + fAlpha = (fYOffset-100)/200; + break; + case PlayerOptions::APPEARANCE_SUDDEN: +// fAlpha = m_PlayerOptions.m_bReverseScroll ? ((SCREEN_HEIGHT-(fYPos+200))/200) : ((fYPos+200)/200); + fAlpha = ((SCREEN_HEIGHT-fYOffset)-280)/200; + break; + case PlayerOptions::APPEARANCE_STEALTH: + fAlpha = 0; + break; + }; + if( fYOffset < 0 ) + fAlpha = 1; + + return fAlpha; +}; + float Player::GetGrayArrowYPos() { return GRAY_ARROW_Y; @@ -757,11 +983,12 @@ float Player::GetGrayArrowYPos() void Player::SetJudgementX( int iNewX ) { - float fY = JUDGEMENT_Y; - if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY; - m_sprJudgement.SetXY( iNewX, fY ); + // the frame will do this for us + //float fY = JUDGEMENT_Y; + //if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY; + //m_sprJudgement.SetXY( iNewX, fY ); - fY = HOLD_JUDGEMENT_Y; + float fY = HOLD_JUDGEMENT_Y; if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY; for( int c=0; c 0 ) - m_fJudgementDisplayCountdown -= fDeltaTime; - m_sprJudgement.Update( fDeltaTime ); + m_fJudgementDisplayCountdown -= fDeltaTime; + if( m_fJudgementDisplayCountdown < 0 ) + { + m_sprJudgement.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible + m_fJudgementDisplayCountdown = 0; + } + + // m_sprJudgement.Update( fDeltaTime ); // the frame will take care of this for us. for( int c=0; c 0.0 ) - m_sprJudgement.Draw(); + //if( m_fJudgementDisplayCountdown > 0.0 ) + // m_sprJudgement.Draw(); // the frame will take care of this for us for( int c=0; c dwLargestFileSoFar ) // we have a new leader! { - int iNumPixels = d3dii.Width * d3dii.Height; - if( iNumPixels > iBiggestNumPixelsSoFar ) // we have a new leader! - { - iBiggestNumPixelsSoFar = iNumPixels; - sBiggestFileNameSoFar = arrayPossibleBackgrounds[i]; - } + dwLargestFileSoFar = this_size; + sLargestFileNameSoFar = arrayPossibleBackgrounds[i]; } } - if( sBiggestFileNameSoFar != "" ) // we found a match - m_sBackground = sBiggestFileNameSoFar; + if( sLargestFileNameSoFar != "" ) // we found a match + m_sBackground = sLargestFileNameSoFar; else RageError( ssprintf("Background could not be found. Please check the Song file '%s' and verify the specified #BANNER exists.", GetSongFilePath()) ); } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 7dd48bd4dc..81556c6efb 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -23,9 +23,9 @@ #include "GameInfo.h" #include "WindowManager.h" -#include "WindowTitleMenu.h" #include "WindowSandbox.h" #include "WindowLoading.h" +#include "WindowTitleMenu.h" #include @@ -315,18 +315,27 @@ HRESULT CreateObjects( HWND hWnd ) Render(); ShowFrame(); - + + // this stuff takes a long time... SOUND = new RageSound( hWnd ); MUSIC = new RageMusic; INPUT = new RageInput( hWnd ); - - GAMEINFO = new GameInfo; + GAMEINFO= new GameInfo; + GAMEINFO->InitSongArrayFromDisk(); + + BringWindowToTop( hWnd ); + SetForegroundWindow( hWnd ); + + bool bGoFullScreen = GAMEINFO->m_GameOptions.m_bIsFullscreen; + SetFullscreen( GAMEINFO->m_GameOptions.m_bIsFullscreen ); //WM->SetNewWindow( new WindowSandbox ); + //WM->SetNewWindow( new WindowResults ); WM->SetNewWindow( new WindowTitleMenu ); - Sleep(1000); // let the disk operations catch up + Sleep(2000); // let the disk operations catch up + DXUtil_Timer( TIMER_START ); // Start the accurate timer @@ -528,6 +537,12 @@ void SetFullscreen( BOOL bFullscreen ) SCREEN_WIDTH, SCREEN_HEIGHT ); RestoreObjects(); + + if( GAMEINFO ) + { + GAMEINFO->m_GameOptions.m_bIsFullscreen = bFullscreen; + GAMEINFO->SaveConfigToDisk(); + } } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 4390c3a4d2..7daf72a24e 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -224,6 +224,14 @@ SOURCE=.\WindowManager.h # End Source File # Begin Source File +SOURCE=.\WindowOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowOptions.h +# End Source File +# Begin Source File + SOURCE=.\WindowPlayerOptions.cpp # End Source File # Begin Source File @@ -280,6 +288,14 @@ SOURCE=.\WindowSelectSteps.h # End Source File # Begin Source File +SOURCE=.\WindowSongOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowSongOptions.h +# End Source File +# Begin Source File + SOURCE=.\WindowTitleMenu.cpp # End Source File # Begin Source File