From 248a61513a2b785ccbbed5e98c2defaeeb5c4321 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 17 Aug 2003 00:15:54 +0000 Subject: [PATCH] Add scrolls: split and alternate --- stepmania/src/ArrowEffects.cpp | 16 ++++----- stepmania/src/ArrowEffects.h | 4 +-- stepmania/src/CodeDetector.cpp | 2 +- stepmania/src/MusicBannerWheel.cpp | 13 +++---- stepmania/src/NoteDisplay.cpp | 39 +++++++++++---------- stepmania/src/Player.cpp | 6 ++-- stepmania/src/PlayerOptions.cpp | 49 ++++++++++++++++++++++++--- stepmania/src/PlayerOptions.h | 13 ++++++- stepmania/src/ScreenGameplay.cpp | 4 +-- stepmania/src/ScreenPlayerOptions.cpp | 9 +++-- stepmania/src/SongManager.cpp | 2 +- 11 files changed, 105 insertions(+), 52 deletions(-) diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 24ca2b13b1..e6ae47b75f 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -182,8 +182,8 @@ float ArrowGetYPosWithoutReverse( PlayerNumber pn, int iCol, float fYOffset ) float ArrowGetYPos( PlayerNumber pn, int iCol, float fYOffset, float fYReverseOffsetPixels ) { float f = ArrowGetYPosWithoutReverse(pn,iCol,fYOffset); - f *= SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].m_fReverseScroll, 0.f, 1.f, 1.f, -1.f ); - f += SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].m_fReverseScroll, 0.f, 1.f, 0.f, fYReverseOffsetPixels ); + f *= SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol), 0.f, 1.f, 1.f, -1.f ); + f += SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol), 0.f, 1.f, 0.f, fYReverseOffsetPixels ); const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects; @@ -197,9 +197,9 @@ const float fCenterLine = 160; // from fYPos == 0 const float fFadeDist = 100; // used by ArrowGetAlpha and ArrowGetGlow below -float ArrowGetPercentVisible( PlayerNumber pn, float fYPos ) +float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYPos ) { - if( GAMESTATE->m_CurrentPlayerOptions[pn].m_fReverseScroll > 0.5f ) + if( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol) > 0.5f ) fYPos *= -1; const float fDistFromCenterLine = fYPos - fCenterLine; @@ -252,10 +252,10 @@ float ArrowGetPercentVisible( PlayerNumber pn, float fYPos ) return clamp( 1+fVisibleAdjust, 0, 1 ); } -float ArrowGetAlpha( PlayerNumber pn, float fYPos, float fPercentFadeToFail ) +float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ) { // fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed; - float fPercentVisible = ArrowGetPercentVisible(pn,fYPos); + float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos); if( fPercentFadeToFail != -1 ) fPercentVisible = 1 - fPercentFadeToFail; @@ -263,10 +263,10 @@ float ArrowGetAlpha( PlayerNumber pn, float fYPos, float fPercentFadeToFail ) return (fPercentVisible>0.5f) ? 1.0f : 0.0f; } -float ArrowGetGlow( PlayerNumber pn, float fYPos, float fPercentFadeToFail ) +float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ) { // fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed; - float fPercentVisible = ArrowGetPercentVisible(pn,fYPos); + float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos); if( fPercentFadeToFail != -1 ) fPercentVisible = 1 - fPercentFadeToFail; diff --git a/stepmania/src/ArrowEffects.h b/stepmania/src/ArrowEffects.h index db84ecb616..a8e426f595 100644 --- a/stepmania/src/ArrowEffects.h +++ b/stepmania/src/ArrowEffects.h @@ -52,12 +52,12 @@ bool ArrowsNeedZBuffer( PlayerNumber pn ); // fAlpha is the transparency of the arrow. It depends on fYPos and the // AppearanceType. -float ArrowGetAlpha( PlayerNumber pn, float fYPos, float fPercentFadeToFail ); +float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ); // fAlpha is the transparency of the arrow. It depends on fYPos and the // AppearanceType. -float ArrowGetGlow( PlayerNumber pn, float fYPos, float fPercentFadeToFail ); +float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ); // Depends on fYOffset. diff --git a/stepmania/src/CodeDetector.cpp b/stepmania/src/CodeDetector.cpp index 3d1a2554f9..4e43c74651 100644 --- a/stepmania/src/CodeDetector.cpp +++ b/stepmania/src/CodeDetector.cpp @@ -168,7 +168,7 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) case CODE_NEXT_EFFECT: GAMESTATE->m_PlayerOptions[pn].NextEffect(); break; case CODE_NEXT_APPEARANCE: GAMESTATE->m_PlayerOptions[pn].NextAppearance(); break; case CODE_NEXT_TURN: GAMESTATE->m_PlayerOptions[pn].NextTurn(); break; - case CODE_REVERSE: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fReverseScroll ); break; + case CODE_REVERSE: GAMESTATE->m_PlayerOptions[pn].NextScroll(); break; case CODE_HOLDS: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bHoldNotes, true, false ); break; case CODE_DARK: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fDark ); break; case CODE_CANCEL_ALL: GAMESTATE->m_PlayerOptions[pn].Init(); diff --git a/stepmania/src/MusicBannerWheel.cpp b/stepmania/src/MusicBannerWheel.cpp index 7fb9b24032..709ea247a7 100644 --- a/stepmania/src/MusicBannerWheel.cpp +++ b/stepmania/src/MusicBannerWheel.cpp @@ -40,7 +40,7 @@ enum GOINGRIGHT }; -#define DEFAULT_SCROLL_DIRECTION THEME->GetMetricI("Steps","DefaultScrollDirection") + #define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") MusicBannerWheel::MusicBannerWheel() @@ -51,11 +51,12 @@ MusicBannerWheel::MusicBannerWheel() SingleLoad=0; bScanning = false; - if(DEFAULT_SCROLL_DIRECTION && GAMESTATE->m_pCurSong == NULL) /* check the song is null... incase they have just come back from a song and changed their PlayerOptions */ - { - for(int i=0; im_PlayerOptions[i].m_fReverseScroll = 1; - } + // Use pref DefaultModifiers to acomplish this +// if(DEFAULT_SCROLL_DIRECTION && GAMESTATE->m_pCurSong == NULL) /* check the song is null... incase they have just come back from a song and changed their PlayerOptions */ +// { +// for(int i=0; im_PlayerOptions[i].m_fReverseScroll = 1; +// } m_ScrollingList.UseSpriteType(BANNERTYPE); m_ScrollingList.SetXY( 0, 0 ); diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index c9cdbf3b8d..d7531125cb 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -479,10 +479,10 @@ void NoteDisplay::DrawHoldTopCap( const HoldNote& hn, const bool bActive, float ASSERT( fTexCoordTop>=-0.0001 && fTexCoordBottom<=1.0001 ); /* allow for rounding error */ const float fTexCoordLeft = pRect->left; const float fTexCoordRight = pRect->right; - const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, fYBottom, fPercentFadeToFail ); - const float fGlowTop = ArrowGetGlow( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, fYBottom, fPercentFadeToFail ); + const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); + const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); @@ -562,10 +562,10 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bActive, float fY ASSERT( fTexCoordTop<=2 && fTexCoordBottom<=2 ); const float fTexCoordLeft = pRect->left; const float fTexCoordRight = pRect->right; - const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, fYBottom, fPercentFadeToFail ); - const float fGlowTop = ArrowGetGlow( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, fYBottom, fPercentFadeToFail ); + const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); + const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); @@ -632,10 +632,10 @@ void NoteDisplay::DrawHoldBottomCap( const HoldNote& hn, const bool bActive, flo const float fTexCoordBottom = SCALE( fBottomDistFromTailTop, 0, fFrameHeight, pRect->top, pRect->bottom ); const float fTexCoordLeft = pRect->left; const float fTexCoordRight = pRect->right; - const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, fYBottom, fPercentFadeToFail ); - const float fGlowTop = ArrowGetGlow( m_PlayerNumber, fYTop, fPercentFadeToFail ); - const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, fYBottom, fPercentFadeToFail ); + const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); + const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); + const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); @@ -667,8 +667,8 @@ void NoteDisplay::DrawHoldTail( const HoldNote& hn, bool bActive, float fYTail, const float fY = fYTail; const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY ); const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY ); - const float fAlpha = ArrowGetAlpha( m_PlayerNumber, fY, fPercentFadeToFail ); - const float fGlow = ArrowGetGlow( m_PlayerNumber, fY, fPercentFadeToFail ); + const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); + const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor colorGlow = RageColor(1,1,1,fGlow); @@ -717,8 +717,8 @@ void NoteDisplay::DrawHoldHead( const HoldNote& hn, bool bActive, float fYHead, const float fY = fYHead; const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY ); const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY ); - const float fAlpha = ArrowGetAlpha( m_PlayerNumber, fY, fPercentFadeToFail ); - const float fGlow = ArrowGetGlow( m_PlayerNumber, fY, fPercentFadeToFail ); + const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); + const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor colorGlow = RageColor(1,1,1,fGlow); @@ -760,9 +760,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float { // bDrawGlowOnly is a little hacky. We need to draw the diffuse part and the glow part one pass at a time to minimize state changes - const bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fReverseScroll > 0.5; - const int iCol = hn.iTrack; + const bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(iCol) > 0.5; const float fStartYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, hn.fStartBeat ); const float fStartYPos = ArrowGetYPos( m_PlayerNumber, iCol, fStartYOffset, fReverseOffsetPixels ); const float fEndYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, hn.fEndBeat ); @@ -812,8 +811,8 @@ void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bo const float fRotation = ArrowGetRotation( m_PlayerNumber, fBeat ); const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYPos ); const float fZPos = ArrowGetZPos( m_PlayerNumber, iCol, fYPos ); - const float fAlpha = ArrowGetAlpha( m_PlayerNumber, fYPos, fPercentFadeToFail ); - const float fGlow = ArrowGetGlow( m_PlayerNumber, fYPos, fPercentFadeToFail ); + const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail ); + const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail ); const float fColorScale = ArrowGetBrightness( m_PlayerNumber, fBeat ) * SCALE(fLife,0,1,0.2f,1); RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha); RageColor glow = RageColor(1,1,1,fGlow); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index dce85fe1d0..31172cd270 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -141,7 +141,7 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, Combine m_NoteField.Load( (NoteData*)this, pn, iStartDrawingAtPixels, iStopDrawingAtPixels, GRAY_ARROWS_Y_REVERSE-GRAY_ARROWS_Y_STANDARD ); m_ArrowBackdrop.SetPlayer( pn ); - const bool bReverse = GAMESTATE->m_PlayerOptions[pn].m_fReverseScroll == 1; + const bool bReverse = GAMESTATE->m_PlayerOptions[pn].GetReversePercentForColumn(0) == 1; bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyleDef()->m_StyleType==StyleDef::ONE_PLAYER_TWO_CREDITS; m_Combo.SetX( COMBO_X(m_PlayerNumber,bPlayerUsingBothSides) ); m_Combo.SetY( bReverse ? SCREEN_BOTTOM-COMBO_Y : SCREEN_TOP+COMBO_Y ); @@ -183,7 +183,7 @@ void Player::Update( float fDeltaTime ) // // Update Y positions // - float fPercentReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fReverseScroll; + float fPercentReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(0); float fHoldJudgeYPos = SCALE( fPercentReverse, 0.f, 1.f, HOLD_JUDGMENT_Y_STANDARD, HOLD_JUDGMENT_Y_REVERSE ); float fGrayYPos = SCALE( fPercentReverse, 0.f, 1.f, GRAY_ARROWS_Y_STANDARD, GRAY_ARROWS_Y_REVERSE ); int c; @@ -332,7 +332,7 @@ void Player::DrawPrimitives() m_Combo.Draw(); float fTilt = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fPerspectiveTilt; - bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fReverseScroll==1; + bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(0)>0.5; float fReverseScale = bReverse ? -1.0f : 1.0f; if( fTilt != 0 ) diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index a1b9654e26..1350dd5c6a 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -27,7 +27,7 @@ void PlayerOptions::Init() ZERO( m_fAccels ); ZERO( m_fEffects ); ZERO( m_fAppearances ); - m_fReverseScroll = 0; + ZERO( m_fScrolls ); m_fDark = 0; m_Turn = TURN_NONE; m_Transform = TRANSFORM_NONE; @@ -50,7 +50,8 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds ) fapproach( m_fEffects[i], other.m_fEffects[i], fDeltaSeconds ); for( i=0; i0.8f ) m_fScrollSpeed = 1.5f; if( RandomFloat(0,1)>0.8f ) - m_fReverseScroll = 1; + m_fScrolls[SCROLL_REVERSE] = 1; if( RandomFloat(0,1)>0.9f ) m_fDark = 1; float f; @@ -333,6 +343,14 @@ PlayerOptions::Appearance PlayerOptions::GetFirstAppearance() return (Appearance)-1; } +PlayerOptions::Scroll PlayerOptions::GetFirstScroll() +{ + for( int i=0; i= GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer/2 ) + f += m_fScrolls[SCROLL_SPLIT]; + if( (iCol%2)==1 ) + f += m_fScrolls[SCROLL_ALTERNATE]; + if( f > 2 ) + f = fmodf( f, 2 ); + if( f > 1 ) + f -= 1; + return f; +} diff --git a/stepmania/src/PlayerOptions.h b/stepmania/src/PlayerOptions.h index ae3381d479..140f08060e 100644 --- a/stepmania/src/PlayerOptions.h +++ b/stepmania/src/PlayerOptions.h @@ -67,6 +67,14 @@ struct PlayerOptions TRANSFORM_MINES, NUM_TRANSFORMS }; + enum Scroll { + SCROLL_REVERSE=0, + SCROLL_SPLIT, + SCROLL_ALTERNATE, + NUM_SCROLLS + }; + float GetReversePercentForColumn( int iCol ); // accounts for all Directions + bool m_bTimeSpacing; // instead of Beat spacing float m_fScrollSpeed; // used if !m_bTimeSpacing @@ -74,7 +82,7 @@ struct PlayerOptions float m_fAccels[NUM_ACCELS]; float m_fEffects[NUM_EFFECTS]; float m_fAppearances[NUM_APPEARANCES]; - float m_fReverseScroll; + float m_fScrolls[NUM_SCROLLS]; float m_fDark; Turn m_Turn; Transform m_Transform; @@ -91,14 +99,17 @@ struct PlayerOptions void NextTurn(); void NextTransform(); void NextPerspective(); + void NextScroll(); Accel GetFirstAccel(); Effect GetFirstEffect(); Appearance GetFirstAppearance(); + Scroll GetFirstScroll(); void SetOneAccel( Accel a ); void SetOneEffect( Effect e ); void SetOneAppearance( Appearance a ); + void SetOneScroll( Scroll s ); }; #endif diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 494a14e0cc..303dabdf7f 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -790,8 +790,8 @@ void ScreenGameplay::LoadNextSong() const bool bExtra = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2(); const bool bReverse[NUM_PLAYERS] = { - GAMESTATE->m_PlayerOptions[0].m_fReverseScroll == 1, - GAMESTATE->m_PlayerOptions[1].m_fReverseScroll == 1 + GAMESTATE->m_PlayerOptions[0].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1, + GAMESTATE->m_PlayerOptions[1].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1 }; for( p=0; p