From a696414cac28c2514d0dd8184fcd53e53c068fed Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 2 Mar 2003 01:43:33 +0000 Subject: [PATCH] Actor tween cleanup Actor scipting with Command() modularizing menu widgets into "ModeSelector"s move animations into metrics --- stepmania/Themes/default/metrics.ini | 127 +++--- stepmania/src/Actor.cpp | 349 ++++++++-------- stepmania/src/Actor.h | 409 ++++++++++--------- stepmania/src/ActorFrame.cpp | 6 +- stepmania/src/ActorFrame.h | 2 +- stepmania/src/BGAnimationLayer.cpp | 22 +- stepmania/src/BPMDisplay.cpp | 4 +- stepmania/src/Banner.cpp | 4 +- stepmania/src/Combo.cpp | 4 +- stepmania/src/CourseEntryDisplay.cpp | 8 +- stepmania/src/FadingBanner.cpp | 18 +- stepmania/src/FadingBanner.h | 2 +- stepmania/src/GameState.cpp | 13 + stepmania/src/GameState.h | 7 +- stepmania/src/GrooveRadar.cpp | 4 +- stepmania/src/HoldJudgment.cpp | 2 +- stepmania/src/Judgment.cpp | 6 +- stepmania/src/LifeMeterBattery.cpp | 6 +- stepmania/src/MenuTimer.cpp | 4 +- stepmania/src/ModeChoice.h | 1 + stepmania/src/ModeSelector.cpp | 35 ++ stepmania/src/ModeSelector.h | 46 +++ stepmania/src/ModeSelectorMaxType1.cpp | 276 +++++++++++++ stepmania/src/ModeSelectorMaxType1.h | 64 +++ stepmania/src/ModeSelectorMaxType2.cpp | 407 +++++++++++++++++++ stepmania/src/ModeSelectorMaxType2.h | 81 ++++ stepmania/src/MotionBlurSprite.h | 4 +- stepmania/src/MusicWheel.cpp | 20 +- stepmania/src/MusicWheelItem.cpp | 6 +- stepmania/src/NoteDisplay.cpp | 2 +- stepmania/src/NoteField.cpp | 2 +- stepmania/src/OptionIcon.cpp | 2 +- stepmania/src/ScoreDisplayNormal.cpp | 2 +- stepmania/src/ScoreDisplayOni.cpp | 2 +- stepmania/src/ScreenDemonstration.cpp | 2 +- stepmania/src/ScreenEvaluation.cpp | 28 +- stepmania/src/ScreenEz2SelectPlayer.cpp | 6 +- stepmania/src/ScreenGameplay.cpp | 22 +- stepmania/src/ScreenInstructions.cpp | 4 +- stepmania/src/ScreenOptions.cpp | 6 +- stepmania/src/ScreenRanking.cpp | 20 +- stepmania/src/ScreenSelectCourse.cpp | 4 +- stepmania/src/ScreenSelectDifficulty.cpp | 442 ++++----------------- stepmania/src/ScreenSelectDifficulty.h | 41 +- stepmania/src/ScreenSelectDifficultyEX.cpp | 2 +- stepmania/src/ScreenSelectGroup.cpp | 8 +- stepmania/src/ScreenSelectMode.cpp | 6 +- stepmania/src/ScreenSelectMusic.cpp | 16 +- stepmania/src/ScreenSelectStyle.cpp | 342 ++++------------ stepmania/src/ScreenSelectStyle.h | 49 +-- stepmania/src/ScreenSelectStyle5th.cpp | 2 +- stepmania/src/ScreenStage.cpp | 20 +- stepmania/src/ScreenTestFonts.cpp | 2 +- stepmania/src/ScreenTitleMenu.cpp | 8 +- stepmania/src/ScrollingList.cpp | 4 +- stepmania/src/StageDisplay.cpp | 2 +- stepmania/src/StepMania.dsp | 32 +- stepmania/src/TextBanner.cpp | 6 +- stepmania/src/ThemeManager.cpp | 11 +- stepmania/src/TipDisplay.cpp | 4 +- stepmania/src/TransitionOniFade.cpp | 2 +- stepmania/src/TransitionStarWipe.cpp | 2 +- 62 files changed, 1768 insertions(+), 1272 deletions(-) create mode 100644 stepmania/src/ModeSelector.cpp create mode 100644 stepmania/src/ModeSelector.h create mode 100644 stepmania/src/ModeSelectorMaxType1.cpp create mode 100644 stepmania/src/ModeSelectorMaxType1.h create mode 100644 stepmania/src/ModeSelectorMaxType2.cpp create mode 100644 stepmania/src/ModeSelectorMaxType2.h diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index d89b4894f0..bd4a4d8688 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1,4 +1,4 @@ -// Possible NextScreen Codes: +// Possible NextScreen names: // - ScreenCaution // - ScreenEz2SelectPlayer // - ScreenSelectMode @@ -10,6 +10,9 @@ // - ScreenSelectMusic // - ScreenSelectStyle5th // - ScreenSelectStyle +// Possible Selector names: +// - ModeSelectorMaxType1 (Max's Select Style) +// - ModeSelectorMaxType2 (Max's Select Difficulty) [Common] ColorP1=0.4,1.0,0.8,1 // sea green @@ -58,18 +61,7 @@ BounceJoinMessage=1 FoldOnJoin=1 [ScreenSelectStyle] -JointPremiumBannerX=550 -JointPremiumBannerY=400 -IconsStartX=60 -IconsSpacingX=76 -IconsStartY=100 -IconsSpacingY=0 -ExplanationX=480 -ExplanationY=170 -InfoX=480 -InfoY=280 -PreviewX=160 -PreviewY=240 +Selector=ModeSelectorMaxType1 HelpText=Use &LEFT; &RIGHT; to select, then press START TimerSeconds=40 NextScreen=ScreenSelectDifficulty @@ -104,39 +96,8 @@ FoldOnJoin=1 NextScreen=ScreenSelectGroup [ScreenSelectDifficulty] -MorePage1X=580 -MorePage1Y=90 -MorePage2X=700 -MorePage2Y=90 -ExplanationPage1X=170 -ExplanationPage1Y=70 -ExplanationPage2X=1100 -ExplanationPage2Y=70 -ChoicesOnPage1=Beginner,Easy,Medium,Hard -ChoicesOnPage2=Nonstop,Oni,Endless -Page1Choice1X=98 -Page1Choice1Y=180 -Page1Choice2X=246 -Page1Choice2Y=220 -Page1Choice3X=394 -Page1Choice3Y=180 -Page1Choice4X=542 -Page1Choice4Y=220 -Page1Choice5X=542 -Page1Choice5Y=220 -Page2Choice1X=760 -Page2Choice1Y=200 -Page2Choice2X=960 -Page2Choice2Y=200 -Page2Choice3X=1160 -Page2Choice3Y=200 -CursorOffsetP1X=-40 -CursorOffsetP1Y=200 -CursorOffsetP2X=+40 -CursorOffsetP2Y=200 -CursorShadowLengthX=10 -CursorShadowLengthY=10 -InitialChoice=0 +Choices=Beginner,Easy,Medium,Hard,Nonstop,Oni,Endless +Selector=ModeSelectorMaxType2 HelpText=Use &LEFT; &RIGHT; to select, then press START TimerSeconds=40 NextScreenArcade=ScreenSelectGroup @@ -1022,3 +983,77 @@ TextHorizAlignP1=0 TextHorizAlignP2=0 TextZoom=0 SpacingY=0 + +[ModeSelectorMaxType1] +JointPremiumBannerX=550 +JointPremiumBannerY=400 +IconsStartX=60 +IconsSpacingX=76 +IconsStartY=100 +IconsSpacingY=0 +IconsDisabledColor=0.2,0.2,0.2,1 +ExplanationX=480 +ExplanationY=170 +InfoX=480 +InfoY=280 +PreviewX=160 +PreviewY=240 +FadeSeconds=0.5 + +[ModeSelectorMaxType2] +NumChoicesOnPage1=4 +LockInputSeconds=0.5 +SleepAfterChoiceSeconds=0.5 +SleepAfterTweenOffSeconds=1.3 +MorePage1OnCommand=diffuse,1,1,1,0;x,580;y,90;linear,0.5;diffuse,1,1,1,1 +MorePage1OffCommand=linear,0.5;diffuse,1,1,1,0 +MorePage2OnCommand=x,700;y,90 +MorePage2OffCommand=linear,0.5;diffuse,1,1,1,0 +ExplanationPage1OnCommand=x,170;y,70;xoffset,-400;bounceend,0.5;xoffset,400; +ExplanationPage1OffCommand=bouncebegin,0.5;xoffset,-400 +ExplanationPage2OnCommand=x,1100;y,70 +ExplanationPage2OffCommand=bouncebegin,0.5;xoffset,400 +HeaderPage1Choice1OnCommand=vertalign,bottom;x,90;y,180;xoffset,-800;sleep,0.0;decelerate,0.4;xoffset,800 +HeaderPage1Choice1OffCommand=sleep,0.3;accelerate,0.4;xoffset,-800 +HeaderPage1Choice2OnCommand=vertalign,bottom;x,246;y,220;xoffset,-800;sleep,0.2;decelerate,0.4;xoffset,800 +HeaderPage1Choice2OffCommand=sleep,0.5;accelerate,0.4;xoffset,-800 +HeaderPage1Choice3OnCommand=vertalign,bottom;x,394;y,180;xoffset,-800;sleep,0.4;decelerate,0.4;xoffset,800 +HeaderPage1Choice3OffCommand=sleep,0.7;accelerate,0.4;xoffset,-800 +HeaderPage1Choice4OnCommand=vertalign,bottom;x,542;y,220;xoffset,-800;sleep,0.6;decelerate,0.4;xoffset,800 +HeaderPage1Choice4OffCommand=sleep,0.9;accelerate,0.4;xoffset,-800 +HeaderPage2Choice1OnCommand=vertalign,bottom;x,760;y,200 +HeaderPage2Choice1OffCommand=sleep,0.3;accelerate,0.4;xoffset,-800 +HeaderPage2Choice2OnCommand=vertalign,bottom;x,960;y,200 +HeaderPage2Choice2OffCommand=sleep,0.5;accelerate,0.4;xoffset,-800 +HeaderPage2Choice3OnCommand=vertalign,bottom;x,1160;y,200 +HeaderPage2Choice3OffCommand=sleep,0.7;accelerate,0.4;xoffset,-800 +PicturePage1Choice1OnCommand=vertalign,top;x,90;y,180;zoomy,0.0;sleep,0.4;bounceend,0.3;zoomy,1 +PicturePage1Choice1OffCommand=sleep,0.0;bouncebegin,0.3;zoomy,0 +PicturePage1Choice2OnCommand=vertalign,top;x,246;y,220;zoomy,0.0;sleep,0.6;bounceend,0.3;zoomy,1 +PicturePage1Choice2OffCommand=sleep,0.2;bouncebegin,0.3;zoomy,0 +PicturePage1Choice3OnCommand=vertalign,top;x,394;y,180;zoomy,0.0;sleep,0.8;bounceend,0.3;zoomy,1 +PicturePage1Choice3OffCommand=sleep,0.4;bouncebegin,0.3;zoomy,0 +PicturePage1Choice4OnCommand=vertalign,top;x,542;y,220;zoomy,0.0;sleep,1.0;bounceend,0.3;zoomy,1 +PicturePage1Choice4OffCommand=sleep,0.6;bouncebegin,0.3;zoomy,0 +PicturePage2Choice1OnCommand=vertalign,top;x,760;y,200; +PicturePage2Choice1OffCommand=sleep,0.0;bouncebegin,0.3;zoomy,0 +PicturePage2Choice2OnCommand=vertalign,top;x,960;y,200 +PicturePage2Choice2OffCommand=sleep,0.2;bouncebegin,0.3;zoomy,0 +PicturePage2Choice3OnCommand=vertalign,top;x,1160;y,200 +PicturePage2Choice3OffCommand=sleep,0.4;bouncebegin,0.3;zoomy,0 +CursorOnCommand=diffuse,1,1,1,0;rotationz,6;zoom,4;linear,0.3;diffuse,1,1,1,1;rotationz,0;zoom,1;glowshift +CursorChooseCommand=sleep,0.2;linear,0.2;xoffset,10;yoffset,10 +CursorOffCommand=sleep,0.2;linear,0.3;zoom,0 +CursorP1OffsetXFromPicture=-40 +CursorP1OffsetYFromPicture=188 +CursorP2OffsetXFromPicture=+40 +CursorP2OffsetYFromPicture=188 +ShadowOnCommand=diffuse,1,1,1,0;rotationz,6;zoom,4;linear,0.3;diffuse,1,1,1,1;rotationz,0;zoom,1 +ShadowChooseCommand=sleep,0.2;linear,0.2;diffuse,1,1,1,0 +ShadowOffCommand=sleep,0.2;linear,0.3;diffuse,1,1,1,0 +ShadowLengthX=10 +ShadowLengthY=10 +OKOnCommand=diffuse,1,1,1,1 +OKChooseCommand=diffuse,1,1,1,1;zoom,2;linear,0.2;diffuse,1,1,1,1;zoom,1 +OKOffCommand=sleep,0.2;linear,0.3;zoom,0 +DisabledColor=0.2,0.2,0.2,1 diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 07109af92b..b3088e92c8 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -16,6 +16,7 @@ #include "PrefsManager.h" #include "RageUtil.h" #include "GameConstantsAndTypes.h" +#include "RageLog.h" Actor::Actor() @@ -35,16 +36,14 @@ Actor::Actor() m_Effect = no_effect; m_fSecsIntoEffect = 0; m_fEffectPeriodSeconds = 1; - m_fWagRadians = 0.2f; - m_vSpinVelocity = RageVector3(0,0,0); - m_fVibrationDistance = 5.0f; - m_bVisibleThisFrame = false; + m_vEffectMagnitude = RageVector3(0,0,10); + m_effectColor1 = RageColor(1,1,1,1); + m_effectColor2 = RageColor(1,1,1,1); m_bShadow = false; m_fShadowLength = 4; m_bBlendAdd = false; - } void Actor::Draw() @@ -67,9 +66,9 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties // // set temporary drawing properties based on Effects // - - bool bBlinkOn = m_fSecsIntoEffect/m_fEffectPeriodSeconds > 0.5f; - float fPercentBetweenColors = sinf( m_fSecsIntoEffect/m_fEffectPeriodSeconds * 2 * PI ) / 2 + 0.5f; + float fPercentThroughEffect = m_fSecsIntoEffect / m_fEffectPeriodSeconds; + bool bBlinkOn = fPercentThroughEffect > 0.5f; + float fPercentBetweenColors = sinf( fPercentThroughEffect * 2 * PI ) / 2 + 0.5f; ASSERT( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1 ); float fOriginalAlpha = m_temp.diffuse[0].a; @@ -77,7 +76,7 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties { case no_effect: break; - case diffuse_blinking: + case diffuse_blink: for(i=0; i<4; i++) m_temp.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2; break; @@ -85,7 +84,7 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties for(i=0; i<4; i++) m_temp.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); break; - case glow_blinking: + case glow_blink: m_temp.glow = bBlinkOn ? m_effectColor1 : m_effectColor2; m_temp.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! break; @@ -93,39 +92,30 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties m_temp.glow = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); m_temp.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! break; - case wagging: - m_temp.rotation.z = m_fWagRadians * sinf( - (m_fSecsIntoEffect / m_fEffectPeriodSeconds) // percent through wag - * 2.0f * PI ); + case wag: + m_temp.rotation = m_vEffectMagnitude * sinf( fPercentThroughEffect * 2.0f * PI ); break; - case spinning: + case spin: // nothing needs to be here break; - case vibrating: - m_temp.pos.x += m_fVibrationDistance * randomf(-1.0f, 1.0f) * GetZoom(); - m_temp.pos.y += m_fVibrationDistance * randomf(-1.0f, 1.0f) * GetZoom(); + case vibrate: + m_temp.pos.x += m_vEffectMagnitude.x * randomf(-1.0f, 1.0f) * GetZoom(); + m_temp.pos.y += m_vEffectMagnitude.y * randomf(-1.0f, 1.0f) * GetZoom(); + m_temp.pos.z += m_vEffectMagnitude.z * randomf(-1.0f, 1.0f) * GetZoom(); break; - case flickering: - m_bVisibleThisFrame = !m_bVisibleThisFrame; - if( !m_bVisibleThisFrame ) - for(int i=0; i<4; i++) - m_temp.diffuse[i] = RageColor(0,0,0,0); // don't draw the frame - break; - case bouncing: + case bounce: { - float fPercentThroughBounce = m_fSecsIntoEffect / m_fEffectPeriodSeconds; - float fPercentOffset = sinf( fPercentThroughBounce*PI ); - m_temp.pos += m_vectBounce * fPercentOffset; + float fPercentOffset = sinf( fPercentThroughEffect*PI ); + m_temp.pos += m_vEffectMagnitude * fPercentOffset; m_temp.pos.x = roundf( m_temp.pos.x ); m_temp.pos.y = roundf( m_temp.pos.y ); m_temp.pos.z = roundf( m_temp.pos.z ); } break; - case bobbing: + case bob: { - float fPercentThroughBounce = m_fSecsIntoEffect / m_fEffectPeriodSeconds; - float fPercentOffset = sinf( fPercentThroughBounce*PI*2 ); - m_temp.pos += m_vectBounce * fPercentOffset; + float fPercentOffset = sinf( fPercentThroughEffect*PI*2 ); + m_temp.pos += m_vEffectMagnitude * fPercentOffset; m_temp.pos.x = roundf( m_temp.pos.x ); m_temp.pos.y = roundf( m_temp.pos.y ); m_temp.pos.z = roundf( m_temp.pos.z ); @@ -196,20 +186,15 @@ void Actor::UpdateTweening( float fDeltaTime ) switch( TI.m_TweenType ) { case TWEEN_LINEAR: fPercentAlongPath = fPercentThroughTween; break; - case TWEEN_BIAS_BEGIN: fPercentAlongPath = 1 - (1-fPercentThroughTween) * (1-fPercentThroughTween); break; - case TWEEN_BIAS_END: fPercentAlongPath = fPercentThroughTween * fPercentThroughTween; break; + case TWEEN_ACCELERATE: fPercentAlongPath = fPercentThroughTween * fPercentThroughTween; break; + case TWEEN_DECELERATE: fPercentAlongPath = 1 - (1-fPercentThroughTween) * (1-fPercentThroughTween); break; case TWEEN_BOUNCE_BEGIN:fPercentAlongPath = 1 - sinf( 1.1f + fPercentThroughTween*(PI-1.1f) ) / 0.89f; break; case TWEEN_BOUNCE_END: fPercentAlongPath = sinf( 1.1f + (1-fPercentThroughTween)*(PI-1.1f) ) / 0.89f; break; case TWEEN_SPRING: fPercentAlongPath = 1 - cosf( fPercentThroughTween*PI*2.5f )/(1+fPercentThroughTween*3); break; default: ASSERT(0); } - m_current.pos = m_start.pos + (TS.pos - m_start.pos )*fPercentAlongPath; - m_current.scale = m_start.scale + (TS.scale - m_start.scale )*fPercentAlongPath; - m_current.rotation = m_start.rotation+ (TS.rotation - m_start.rotation)*fPercentAlongPath; - for(int i=0; i<4; i++) - m_current.diffuse[i]= m_start.diffuse[i]*(1.0f-fPercentAlongPath) + TS.diffuse[i]*(fPercentAlongPath); - m_current.glow = m_start.glow *(1.0f-fPercentAlongPath) + TS.glow *(fPercentAlongPath); + TweenState::MakeWeightedAverage( m_current, m_start, TS, fPercentAlongPath ); } } @@ -227,26 +212,27 @@ void Actor::Update( float fDeltaTime ) { case no_effect: break; - case diffuse_blinking: + case diffuse_blink: case diffuse_shift: - case glow_blinking: + case glow_blink: case glow_shift: - case wagging: - case bouncing: - case bobbing: + case wag: + case bounce: + case bob: m_fSecsIntoEffect += fDeltaTime; while( m_fSecsIntoEffect >= m_fEffectPeriodSeconds ) m_fSecsIntoEffect -= m_fEffectPeriodSeconds; break; - case spinning: - m_current.rotation += m_vSpinVelocity; - if( m_current.rotation.x > 1000*PI*2 ) m_current.rotation.x -= 1000*PI*2; - if( m_current.rotation.y > 1000*PI*2 ) m_current.rotation.y -= 1000*PI*2; - if( m_current.rotation.z > 1000*PI*2 ) m_current.rotation.z -= 1000*PI*2; + case spin: + m_current.rotation += m_vEffectMagnitude; + if( m_current.rotation.x > PI*2 ) m_current.rotation.x -= PI*2; + if( m_current.rotation.y > PI*2 ) m_current.rotation.y -= PI*2; + if( m_current.rotation.z > PI*2 ) m_current.rotation.z -= PI*2; + if( m_current.rotation.x < -PI*2 ) m_current.rotation.x += PI*2; + if( m_current.rotation.y < -PI*2 ) m_current.rotation.y += PI*2; + if( m_current.rotation.z < -PI*2 ) m_current.rotation.z += PI*2; break; - case vibrating: - break; - case flickering: + case vibrate: break; } @@ -292,44 +278,11 @@ void Actor::StopTweening() { m_TweenStates.clear(); m_TweenInfo.clear(); + ASSERT( m_TweenStates.empty() ); + ASSERT( m_TweenInfo.empty() ); } -void Actor::SetTweenX( float x ) { LatestTween().pos.x = x; } -void Actor::SetTweenY( float y ) { LatestTween().pos.y = y; } -void Actor::SetTweenZ( float z ) { LatestTween().pos.z = z; } -void Actor::SetTweenXY( float x, float y ) { LatestTween().pos.x = x; LatestTween().pos.y = y; } -void Actor::SetTweenZoom( float zoom ) { LatestTween().scale.x = zoom; LatestTween().scale.y = zoom; } -void Actor::SetTweenZoomX( float zoom ) { LatestTween().scale.x = zoom; } -void Actor::SetTweenZoomY( float zoom ) { LatestTween().scale.y = zoom; } -void Actor::SetTweenZoomToWidth( float zoom ) { SetTweenZoomX( zoom/GetUnzoomedWidth() ); } -void Actor::SetTweenZoomToHeight( float zoom ) { SetTweenZoomX( zoom/GetUnzoomedHeight() ); } -void Actor::SetTweenRotationX( float r ) { LatestTween().rotation.x = r; } -void Actor::SetTweenRotationY( float r ) { LatestTween().rotation.y = r; } -void Actor::SetTweenRotationZ( float r ) { LatestTween().rotation.z = r; } -void Actor::SetTweenDiffuse( RageColor c ) { for(int i=0; i<4; i++) LatestTween().diffuse[i] = c; }; -void Actor::SetTweenDiffuseUpperLeft( RageColor c ) { LatestTween().diffuse[0] = c; }; -void Actor::SetTweenDiffuseUpperRight( RageColor c ) { LatestTween().diffuse[1] = c; }; -void Actor::SetTweenDiffuseLowerLeft( RageColor c ) { LatestTween().diffuse[2] = c; }; -void Actor::SetTweenDiffuseLowerRight( RageColor c ) { LatestTween().diffuse[3] = c; }; -void Actor::SetTweenDiffuseTopEdge( RageColor c ) { LatestTween().diffuse[0] = LatestTween().diffuse[1] = c; }; -void Actor::SetTweenDiffuseRightEdge( RageColor c ) { LatestTween().diffuse[1] = LatestTween().diffuse[3] = c; }; -void Actor::SetTweenDiffuseBottomEdge( RageColor c ) { LatestTween().diffuse[2] = LatestTween().diffuse[3] = c; }; -void Actor::SetTweenDiffuseLeftEdge( RageColor c ) { LatestTween().diffuse[0] = LatestTween().diffuse[2] = c; }; -void Actor::SetTweenGlow( RageColor c ) { LatestTween().glow = c; }; - -Actor::TweenState Actor::GetDestTweenState() -{ - if( m_TweenStates.empty() ) // not tweening - return m_current; - else - return LatestTween(); -} - -void Actor::SetTweenState( const Actor::TweenState &ts ) -{ - LatestTween() = ts; -} void Actor::ScaleTo( const RectI &rect, StretchType st ) { @@ -391,17 +344,11 @@ void Actor::StretchTo( const RectF &r ) -// effects +// effect "macros" -void Actor::SetEffectNone() +void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) { - m_Effect = no_effect; - //m_color = RageColor( 1.0,1.0,1.0,1.0 ); -} - -void Actor::SetEffectDiffuseBlinking( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) -{ - m_Effect = diffuse_blinking; + m_Effect = diffuse_blink; m_effectColor1 = c1; m_effectColor2 = c2; m_fEffectPeriodSeconds = fEffectPeriodSeconds; @@ -417,9 +364,9 @@ void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, Rag m_fSecsIntoEffect = 0; } -void Actor::SetEffectGlowBlinking( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) { - m_Effect = glow_blinking; + m_Effect = glow_blink; m_effectColor1 = c1; m_effectColor2 = c2; m_fEffectPeriodSeconds = fEffectPeriodSeconds; @@ -435,93 +382,59 @@ void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageCo m_fSecsIntoEffect = 0; } -void Actor::SetEffectWagging( float fWagRadians, float fWagPeriod ) +void Actor::SetEffectWag( float fPeriod, RageVector3 vect ) { - m_Effect = wagging; - m_fWagRadians = fWagRadians; - m_fEffectPeriodSeconds = fWagPeriod; -} - -void Actor::SetEffectSpinning( RageVector3 vectRotationVelocity ) -{ - m_Effect = spinning; - m_vSpinVelocity = vectRotationVelocity; -} - -void Actor::SetEffectVibrating( float fVibrationDistance ) -{ - m_Effect = vibrating; - m_fVibrationDistance = fVibrationDistance; -} - -void Actor::SetEffectFlickering() -{ - m_Effect = flickering; -} - -void Actor::SetEffectBouncing( RageVector3 vectBounce, float fPeriod ) -{ - m_Effect = bouncing; - - m_vectBounce = vectBounce; + m_Effect = wag; m_fEffectPeriodSeconds = fPeriod; + m_vEffectMagnitude = vect; m_fSecsIntoEffect = 0; - } -void Actor::SetEffectBobbing( RageVector3 vectBob, float fPeriod ) +void Actor::SetEffectBounce( float fPeriod, RageVector3 vect ) { - m_Effect = bobbing; - - m_vectBounce = vectBob; + m_Effect = bounce; m_fEffectPeriodSeconds = fPeriod; + m_vEffectMagnitude = vect; m_fSecsIntoEffect = 0; - } - -void GetFadeFlagsFromString( CString sFadeString, - bool& linear, bool& accelerate, bool& bounce, bool& spring, - bool& foldx, bool& foldy, bool& fade, bool& zoombig, bool& zoomsmall, bool& spinx, bool& spiny, bool& spinz, bool& ghost, - bool& left, bool& right, bool& top, bool& bottom ) +void Actor::SetEffectBob( float fPeriod, RageVector3 vect ) { - sFadeString.MakeLower(); - foldx = -1!=sFadeString.Find("foldx"); - foldy = -1!=sFadeString.Find("foldy"); - fade = -1!=sFadeString.Find("fade"); - zoombig = -1!=sFadeString.Find("zoombig"); - zoomsmall = -1!=sFadeString.Find("zoomsmall"); - spinx = -1!=sFadeString.Find("spinx"); - spiny = -1!=sFadeString.Find("spiny"); - spinz = -1!=sFadeString.Find("spinz"); - ghost = -1!=sFadeString.Find("ghost"); - linear = -1!=sFadeString.Find("linear"); - accelerate = -1!=sFadeString.Find("accelerate"); - bounce = -1!=sFadeString.Find("bounce"); - spring = -1!=sFadeString.Find("spring"); - left = -1!=sFadeString.Find("left"); - right = -1!=sFadeString.Find("right"); - top = -1!=sFadeString.Find("top"); - bottom = -1!=sFadeString.Find("bottom"); + m_Effect = bob; + m_fEffectPeriodSeconds = fPeriod; + m_vEffectMagnitude = vect; + m_fSecsIntoEffect = 0; } +void Actor::SetEffectSpin( RageVector3 vect ) +{ + m_Effect = spin; + m_vEffectMagnitude = vect; +} + +void Actor::SetEffectVibrate( RageVector3 vect ) +{ + m_Effect = vibrate; + m_vEffectMagnitude = vect; +} void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, bool bFadingOff ) { sFadeString.MakeLower(); + sFadeString.Replace( ' ', ',' ); TweenState original = m_current; TweenState mod = m_current; CStringArray asBits; - split( sFadeString, " ", asBits ); + split( sFadeString, ",", asBits ); #define CONTAINS(needle) (find( asBits.begin(), asBits.end(), needle ) != asBits.end()) TweenType tt; if( CONTAINS("linear") ) tt = TWEEN_LINEAR; - else if( CONTAINS("accelerate") ) tt = bFadingOff ? TWEEN_BIAS_END : TWEEN_BIAS_BEGIN; + else if( CONTAINS("accelerate") ) tt = bFadingOff ? TWEEN_ACCELERATE : TWEEN_DECELERATE; else if( CONTAINS("bounce") ) tt = bFadingOff ? TWEEN_BOUNCE_BEGIN : TWEEN_BOUNCE_END; else if( CONTAINS("spring") ) tt = TWEEN_SPRING; else tt = TWEEN_LINEAR; @@ -553,14 +466,124 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, mod.glow.a *= CONTAINS("glow")?1:0; + + TweenState& start = bFadingOff ? original : mod; + TweenState& end = bFadingOff ? mod : original; + + // apply tweens StopTweening(); - m_current = bFadingOff ? original : mod; - BeginTweening( fSleepSeconds ); - BeginTweening( fFadeSeconds, tt ); - LatestTween() = bFadingOff ? mod : original; + + if( CONTAINS("ghost") ) + { + // start with no glow, no alpha + start.glow.a = 0; + for( int i=0; i<4; i++ ) + start.diffuse[i].a = 0; + + m_current = start; + + + TweenState mid; + TweenState::MakeWeightedAverage( mid, start, end, 0.5 ); + + // tween to full glow, no alpha + mid.glow.a = 1; + for( i=0; i<4; i++ ) + mid.diffuse[i].a = 0; + BeginTweening( fFadeSeconds/2, tt ); + LatestTween() = mid; + + // snap to full alpha + for( i=0; i<4; i++ ) + mid.diffuse[i].a = 1; + BeginTweening( 0.0001f, tt ); + LatestTween() = mid; + + // tween to no glow + mid.glow.a = 0; + BeginTweening( fFadeSeconds/2, tt ); + LatestTween() = mid; + } + else + { + m_current = start; + BeginTweening( fSleepSeconds ); + BeginTweening( fFadeSeconds, tt ); + LatestTween() = end; + } } -float Actor::TweenTime() const +void Actor::Command( CString sCommandString ) +{ + // add a snap tween in case the user forgets to use a tween as the first command +// BeginTweening( 0.0001f, TWEEN_LINEAR ); + + CStringArray asCommands; + split( sCommandString, ";", asCommands, true ); + + for( unsigned c=0; cWarn( "Unrecognized command name '%s' in command string '%s'.", sName.GetString(), sCommandString.GetString() ); + ASSERT(0); + } + } +} + +float Actor::GetTweenTimeLeft() const { float tot = 0; diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 513a7924f3..6a6f7975b7 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -22,180 +22,19 @@ public: enum TweenType { TWEEN_LINEAR, - TWEEN_BIAS_BEGIN, - TWEEN_BIAS_END, + TWEEN_ACCELERATE, + TWEEN_DECELERATE, TWEEN_BOUNCE_BEGIN, TWEEN_BOUNCE_END, TWEEN_SPRING, }; enum Effect { no_effect, - diffuse_blinking, diffuse_shift, - glow_blinking, glow_shift, - wagging, spinning, - vibrating, flickering, - bouncing, bobbing + diffuse_blink, diffuse_shift, + glow_blink, glow_shift, + wag, bounce, bob, + spin, vibrate, }; - - // let subclasses override - - /* Do subclasses really need to override tweening? Tween data should - * probably be private ... - glenn */ - virtual void Restore() {}; - virtual void Invalidate() {}; - - virtual void Draw(); // calls, BeginDraw, DrawPrimitives, EndDraw - virtual void BeginDraw(); // pushes transform onto world matrix stack - virtual void DrawPrimitives() = 0; // override with Actor specific action - virtual void EndDraw(); // pops transform from world matrix stack - bool IsFirstUpdate(); - virtual void Update( float fDeltaTime ); - virtual void UpdateTweening( float fDeltaTime ); - - virtual float GetX() { return m_current.pos.x; }; - virtual float GetY() { return m_current.pos.y; }; - virtual float GetZ() { return m_current.pos.z; }; - virtual void SetX( float x ) { m_current.pos.x = x; }; - virtual void SetY( float y ) { m_current.pos.y = y; }; - virtual void SetZ( float z ) { m_current.pos.z = z; }; - virtual void SetXY( float x, float y ) { m_current.pos.x = x; m_current.pos.y = y; }; - - // height and width vary depending on zoom - virtual float GetUnzoomedWidth() { return m_size.x; } - virtual float GetUnzoomedHeight() { return m_size.y; } - virtual float GetZoomedWidth() { return m_size.x * m_current.scale.x; } - virtual float GetZoomedHeight() { return m_size.y * m_current.scale.y; } -// virtual void SetWidth( float width ) { m_current.size.x = width; } -// virtual void SetHeight( float height ) { m_current.size.y = height; } - - virtual float GetZoom() { return m_current.scale.x; } // not accurate in some cases - virtual float GetZoomX() { return m_current.scale.x; } - virtual float GetZoomY() { return m_current.scale.y; } - virtual void SetZoom( float zoom ) { m_current.scale.x = zoom; m_current.scale.y = zoom; } - virtual void SetZoomX( float zoom ) { m_current.scale.x = zoom; } - virtual void SetZoomY( float zoom ) { m_current.scale.y = zoom; } - virtual void ZoomToWidth( float zoom ) { SetZoomX( zoom / GetUnzoomedWidth() ); } - virtual void ZoomToHeight( float zoom ){ SetZoomY( zoom / GetUnzoomedHeight() ); } - - virtual float GetRotation() { return m_current.rotation.z; } - virtual float GetRotationX() { return m_current.rotation.x; } - virtual float GetRotationY() { return m_current.rotation.y; } - virtual float GetRotationZ() { return m_current.rotation.z; } - virtual void SetRotation( float rot ) { m_current.rotation.z = rot; } - virtual void SetRotationX( float rot ) { m_current.rotation.x = rot; } - virtual void SetRotationY( float rot ) { m_current.rotation.y = rot; } - virtual void SetRotationZ( float rot ) { m_current.rotation.z = rot; } - - virtual void SetDiffuse( RageColor c ) { for(int i=0; i<4; i++) m_current.diffuse[i] = c; }; - virtual void SetDiffuses( int i, RageColor c ) { m_current.diffuse[i] = c; }; - virtual void SetDiffuseUpperLeft( RageColor c ) { m_current.diffuse[0] = c; }; - virtual void SetDiffuseUpperRight( RageColor c ) { m_current.diffuse[1] = c; }; - virtual void SetDiffuseLowerLeft( RageColor c ) { m_current.diffuse[2] = c; }; - virtual void SetDiffuseLowerRight( RageColor c ) { m_current.diffuse[3] = c; }; - virtual void SetDiffuseTopEdge( RageColor c ) { m_current.diffuse[0] = m_current.diffuse[1] = c; }; - virtual void SetDiffuseRightEdge( RageColor c ) { m_current.diffuse[1] = m_current.diffuse[3] = c; }; - virtual void SetDiffuseBottomEdge( RageColor c ) { m_current.diffuse[2] = m_current.diffuse[3] = c; }; - virtual void SetDiffuseLeftEdge( RageColor c ) { m_current.diffuse[0] = m_current.diffuse[2] = c; }; - virtual RageColor GetDiffuse() { return m_current.diffuse[0]; }; - virtual RageColor GetDiffuses( int i ) { return m_current.diffuse[i]; }; - virtual void SetGlow( RageColor c ) { m_current.glow = c; }; - virtual RageColor GetGlow() { return m_current.glow; }; - - - - virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); - virtual void StopTweening(); - /* Amount of time until all tweens have stopped: */ - virtual float TweenTime() const; - virtual void SetTweenX( float x ); - virtual void SetTweenY( float y ); - virtual void SetTweenZ( float z ); - virtual void SetTweenXY( float x, float y ); - virtual void SetTweenZoom( float zoom ); - virtual void SetTweenZoomX( float zoom ); - virtual void SetTweenZoomY( float zoom ); - virtual void SetTweenZoomToWidth( float zoom ); - virtual void SetTweenZoomToHeight( float zoom ); - virtual void SetTweenRotationX( float r ); - virtual void SetTweenRotationY( float r ); - virtual void SetTweenRotationZ( float r ); - virtual void SetTweenDiffuse( RageColor colorDiffuse ); - virtual void SetTweenDiffuseUpperLeft( RageColor colorDiffuse ); - virtual void SetTweenDiffuseUpperRight( RageColor colorDiffuse ); - virtual void SetTweenDiffuseLowerLeft( RageColor colorDiffuse ); - virtual void SetTweenDiffuseLowerRight( RageColor colorDiffuse ); - virtual void SetTweenDiffuseTopEdge( RageColor colorDiffuse ); - virtual void SetTweenDiffuseRightEdge( RageColor colorDiffuse ); - virtual void SetTweenDiffuseBottomEdge( RageColor colorDiffuse ); - virtual void SetTweenDiffuseLeftEdge( RageColor colorDiffuse ); - virtual void SetTweenGlow( RageColor c ); - - enum StretchType { fit_inside, cover }; - - void ScaleToCover( const RectI &rect ) { ScaleTo( rect, cover ); } - void ScaleToFitInside( const RectI &rect ) { ScaleTo( rect, fit_inside); }; - void ScaleTo( const RectI &rect, StretchType st ); - - void StretchTo( const RectI &rect ); - void StretchTo( const RectF &rect ); - - - - - enum HorizAlign { align_left, align_center, align_right }; - virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; } - - enum VertAlign { align_top, align_middle, align_bottom }; - virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; } - - - - // effects - void SetEffectNone(); - void SetEffectDiffuseBlinking( float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(0.5f,0.5f,0.5f,1), - RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectDiffuseShift( float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(0,0,0,1), - RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectGlowBlinking( float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(1,1,1,0.2f), - RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectGlowShift( float fEffectPeriodSeconds = 1.0f, - RageColor c1 = RageColor(1,1,1,0.2f), - RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectWagging( float fWagRadians = 0.2, - float fWagPeriod = 2.0 ); - void SetEffectSpinning( RageVector3 vectRotationVelocity ); - void SetEffectVibrating( float fVibrationDistance = 5.0 ); - void SetEffectFlickering(); - void SetEffectBouncing( RageVector3 vectBounceDir, float fPeriod ); - void SetEffectBobbing( RageVector3 vectBobDir, float fPeriod ); - Effect GetEffect() { return m_Effect; }; - - - // - // other properties - // - void TurnShadowOn() { m_bShadow = true; }; - void TurnShadowOff() { m_bShadow = false; }; - void SetShadowLength( float fLength ) { m_fShadowLength = fLength; }; - - void SetBlendModeAdd() { m_bBlendAdd = true; }; - void SetBlendModeNormal() { m_bBlendAdd = false; }; - - - // - // fade command - // - void Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, bool bFadingOff ); - void FadeOn( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,false); }; - void FadeOff( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,true); }; - - - // - // Stuff for tweening - // struct TweenState { // start and end position for tweening @@ -214,14 +53,220 @@ public: diffuse[i] = RageColor( 1, 1, 1, 1 ); glow = RageColor( 1, 1, 1, 0 ); }; + + static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ) + { + average_out.pos = ts1.pos + (ts2.pos - ts1.pos )*fPercentBetween; + average_out.scale = ts1.scale + (ts2.scale - ts1.scale )*fPercentBetween; + average_out.rotation = ts1.rotation+ (ts2.rotation - ts1.rotation)*fPercentBetween; + for(int i=0; i<4; i++) + average_out.diffuse[i] = ts1.diffuse[i]+ (ts2.diffuse[i] - ts1.diffuse[i])*fPercentBetween; + average_out.glow = ts1.glow + (ts2.glow - ts1.glow )*fPercentBetween; + } }; - /* Intended for a very limited use: you can query the destination - * state (that is, where the actor would end up if its tween finished), - * stop tweening (possibly leaving it partially tweened), do something, - * then tween to the original destination. */ - virtual TweenState GetDestTweenState(); - virtual void SetTweenState( const TweenState &ts ); + // let subclasses override + + /* Do subclasses really need to override tweening? Tween data should + * probably be private ... - glenn */ + virtual void Restore() {}; + virtual void Invalidate() {}; + + virtual void Draw(); // calls, BeginDraw, DrawPrimitives, EndDraw + virtual void BeginDraw(); // pushes transform onto world matrix stack + virtual void DrawPrimitives() = 0; // override with Actor specific action + virtual void EndDraw(); // pops transform from world matrix stack + bool IsFirstUpdate(); + virtual void Update( float fDeltaTime ); + virtual void UpdateTweening( float fDeltaTime ); + + virtual float GetX() { return DestTweenState().pos.x; }; + virtual float GetY() { return DestTweenState().pos.y; }; + virtual float GetZ() { return DestTweenState().pos.z; }; + virtual void SetX( float x ) { DestTweenState().pos.x = x; }; + virtual void SetY( float y ) { DestTweenState().pos.y = y; }; + virtual void SetZ( float z ) { DestTweenState().pos.z = z; }; + virtual void SetXY( float x, float y ) { DestTweenState().pos.x = x; DestTweenState().pos.y = y; }; + + // height and width vary depending on zoom + virtual float GetUnzoomedWidth() { return m_size.x; } + virtual float GetUnzoomedHeight() { return m_size.y; } + virtual float GetZoomedWidth() { return m_size.x * DestTweenState().scale.x; } + virtual float GetZoomedHeight() { return m_size.y * DestTweenState().scale.y; } +// virtual void SetWidth( float width ) { DestTweenState().size.x = width; } +// virtual void SetHeight( float height ) { DestTweenState().size.y = height; } + + virtual float GetZoom() { return DestTweenState().scale.x; } // not accurate in some cases + virtual float GetZoomX() { return DestTweenState().scale.x; } + virtual float GetZoomY() { return DestTweenState().scale.y; } + virtual void SetZoom( float zoom ) { DestTweenState().scale.x = zoom; DestTweenState().scale.y = zoom; } + virtual void SetZoomX( float zoom ) { DestTweenState().scale.x = zoom; } + virtual void SetZoomY( float zoom ) { DestTweenState().scale.y = zoom; } + virtual void ZoomToWidth( float zoom ) { SetZoomX( zoom / GetUnzoomedWidth() ); } + virtual void ZoomToHeight( float zoom ){ SetZoomY( zoom / GetUnzoomedHeight() ); } + + virtual float GetRotationX() { return DestTweenState().rotation.x; } + virtual float GetRotationY() { return DestTweenState().rotation.y; } + virtual float GetRotationZ() { return DestTweenState().rotation.z; } + virtual void SetRotationX( float rot ) { DestTweenState().rotation.x = rot; } + virtual void SetRotationY( float rot ) { DestTweenState().rotation.y = rot; } + virtual void SetRotationZ( float rot ) { DestTweenState().rotation.z = rot; } + + virtual void SetDiffuse( RageColor c ) { for(int i=0; i<4; i++) DestTweenState().diffuse[i] = c; }; + virtual void SetDiffuses( int i, RageColor c ) { DestTweenState().diffuse[i] = c; }; + virtual void SetDiffuseUpperLeft( RageColor c ) { DestTweenState().diffuse[0] = c; }; + virtual void SetDiffuseUpperRight( RageColor c ) { DestTweenState().diffuse[1] = c; }; + virtual void SetDiffuseLowerLeft( RageColor c ) { DestTweenState().diffuse[2] = c; }; + virtual void SetDiffuseLowerRight( RageColor c ) { DestTweenState().diffuse[3] = c; }; + virtual void SetDiffuseTopEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c; }; + virtual void SetDiffuseRightEdge( RageColor c ) { DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c; }; + virtual void SetDiffuseBottomEdge( RageColor c ) { DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c; }; + virtual void SetDiffuseLeftEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c; }; + virtual RageColor GetDiffuse() { return DestTweenState().diffuse[0]; }; + virtual RageColor GetDiffuses( int i ) { return DestTweenState().diffuse[i]; }; + virtual void SetGlow( RageColor c ) { DestTweenState().glow = c; }; + virtual RageColor GetGlow() { return DestTweenState().glow; }; + + + // TODO: Get rid of these once we're sure everything is working + virtual void SetTweenX( float x ) { SetX(x); } + virtual void SetTweenY( float y ) { SetY(y); } + virtual void SetTweenZ( float z ) { SetZ(z); } + virtual void SetTweenXY( float x, float y ) { SetXY(x,y); } + virtual void SetTweenZoom( float zoom ) { SetZoom(zoom); } + virtual void SetTweenZoomX( float zoom ) { SetZoomX(zoom); } + virtual void SetTweenZoomY( float zoom ) { SetZoomY(zoom); } + virtual void SetTweenZoomToWidth( float zoom ) { ZoomToWidth(zoom); } + virtual void SetTweenZoomToHeight( float zoom ) { ZoomToHeight(zoom); } + virtual void SetTweenRotationX( float r ) { SetRotationX(r); } + virtual void SetTweenRotationY( float r ) { SetRotationY(r); } + virtual void SetTweenRotationZ( float r ) { SetRotationZ(r); } + virtual void SetTweenDiffuse( RageColor c ) { SetDiffuse(c); } + virtual void SetTweenDiffuseUpperLeft( RageColor c ) { SetDiffuseUpperLeft(c); } + virtual void SetTweenDiffuseUpperRight( RageColor c ) { SetDiffuseUpperRight(c); } + virtual void SetTweenDiffuseLowerLeft( RageColor c ) { SetDiffuseLowerLeft(c); } + virtual void SetTweenDiffuseLowerRight( RageColor c ) { SetDiffuseLowerRight(c); } + virtual void SetTweenDiffuseTopEdge( RageColor c ) { SetDiffuseTopEdge(c); } + virtual void SetTweenDiffuseRightEdge( RageColor c ) { SetDiffuseRightEdge(c); } + virtual void SetTweenDiffuseBottomEdge( RageColor c ) { SetDiffuseBottomEdge(c); } + virtual void SetTweenDiffuseLeftEdge( RageColor c ) { SetDiffuseLeftEdge(c); } + virtual void SetTweenGlow( RageColor c ) { SetGlow(c); } + + + virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); + virtual void StopTweening(); + virtual float GetTweenTimeLeft() const; // Amount of time until all tweens have stopped + virtual TweenState& DestTweenState() // where Actor will end when its tween finish + { + if( m_TweenStates.empty() ) // not tweening + return m_current; + else + return LatestTween(); + } + virtual void SetLatestTween( TweenState ts ) { LatestTween() = ts; } + + + enum StretchType { fit_inside, cover }; + + void ScaleToCover( const RectI &rect ) { ScaleTo( rect, cover ); } + void ScaleToFitInside( const RectI &rect ) { ScaleTo( rect, fit_inside); }; + void ScaleTo( const RectI &rect, StretchType st ); + + void StretchTo( const RectI &rect ); + void StretchTo( const RectF &rect ); + + + + + enum HorizAlign { align_left, align_center, align_right }; + virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; } + virtual void SetHorizAlign( CString s ) + { + s.MakeLower(); + if (s=="left") m_HorizAlign = align_left; + else if(s=="center") m_HorizAlign = align_center; + else if(s=="right") m_HorizAlign = align_right; + else ASSERT(0); + } + + enum VertAlign { align_top, align_middle, align_bottom }; + virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; } + virtual void SetVertAlign( CString s ) + { + s.MakeLower(); + if (s=="top") m_VertAlign = align_top; + else if(s=="middle") m_VertAlign = align_middle; + else if(s=="bottom") m_VertAlign = align_bottom; + else ASSERT(0); + } + + + + // effects + void SetEffectNone() { m_Effect = no_effect; } + Effect GetEffect() { return m_Effect; } + void SetEffectColor1( RageColor c ) { m_effectColor1 = c; } + void SetEffectColor2( RageColor c ) { m_effectColor2 = c; } + void SetEffectPeriod( float fSecs ) { m_fEffectPeriodSeconds = fSecs; } + void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; } + + void SetEffectDiffuseBlink( + float fEffectPeriodSeconds = 1.0f, + RageColor c1 = RageColor(0.5f,0.5f,0.5f,1), + RageColor c2 = RageColor(1,1,1,1) ); + void SetEffectDiffuseShift( float fEffectPeriodSeconds = 1.f, + RageColor c1 = RageColor(0,0,0,1), + RageColor c2 = RageColor(1,1,1,1) ); + void SetEffectGlowBlink( float fEffectPeriodSeconds = 1.f, + RageColor c1 = RageColor(1,1,1,0.2f), + RageColor c2 = RageColor(1,1,1,0.8f) ); + void SetEffectGlowShift( + float fEffectPeriodSeconds = 1.0f, + RageColor c1 = RageColor(1,1,1,0.2f), + RageColor c2 = RageColor(1,1,1,0.8f) ); + void SetEffectWag( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,0,0.2f) ); + void SetEffectBounce( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,0,20) ); + void SetEffectBob( + float fPeriod = 2.f, + RageVector3 vect = RageVector3(0,0,20) ); + void SetEffectSpin( + RageVector3 vect = RageVector3(0,0,1) ); + void SetEffectVibrate( + RageVector3 vect = RageVector3(10,10,10) ); + + + // + // other properties + // + void SetShadowLength( float fLength ) + { + if( fLength==0 ) + m_bShadow = false; + else + { + m_fShadowLength = fLength; + m_bShadow = true; + } + } + void EnableShadow( bool b ) { m_bShadow = b; }; + + + void EnableAdditiveBlend( bool b ) { m_bBlendAdd = b; }; + + + // + // fade command + // + void Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, bool bFadingOff ); + void FadeOn( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,false); }; + void FadeOff( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,true); }; + + void Command( CString sCommandString ); + protected: @@ -275,25 +320,9 @@ protected: Effect m_Effect; float m_fSecsIntoEffect; float m_fEffectPeriodSeconds; - - // Counting variables for shift and glowing: RageColor m_effectColor1; RageColor m_effectColor2; - - // wagging: - float m_fWagRadians; - - // spinning: - RageVector3 m_vSpinVelocity; // delta per second - - // vibrating: - float m_fVibrationDistance; - - // flickering: - bool m_bVisibleThisFrame; - - // bouncing: - RageVector3 m_vectBounce; + RageVector3 m_vEffectMagnitude; // diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 09a5a7c611..fb5b6e2aa3 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -77,12 +77,12 @@ void ActorFrame::SetDiffuse( RageColor c ) m_SubActors[i]->SetDiffuse(c ); } -float ActorFrame::TweenTime() const +float ActorFrame::GetTweenTimeLeft() const { - float m = Actor::TweenTime(); + float m = Actor::GetTweenTimeLeft(); for( unsigned i=0; iTweenTime()); + m = max(m, m_SubActors[i]->GetTweenTimeLeft()); return m; diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index e7a6cea545..52a73626ae 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -28,7 +28,7 @@ public: virtual void SetDiffuse( RageColor c ); /* Amount of time until all tweens (and all children's tweens) have stopped: */ - virtual float TweenTime() const; + virtual float GetTweenTimeLeft() const; protected: vector m_SubActors; diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 3ecc5d4ca6..142709987e 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -101,7 +101,7 @@ void BGAnimationLayer::LoadFromVisualization( CString sMoviePath ) m_iNumSprites = 1; m_Sprites[0].LoadBG( sMoviePath ); m_Sprites[0].StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); - m_Sprites[0].SetBlendModeAdd(); + m_Sprites[0].EnableAdditiveBlend( true ); } void BGAnimationLayer::LoadFromAniLayerFile( CString sPath, CString sSongBGPath ) @@ -231,7 +231,7 @@ found_effect: { m_Sprites[i].LoadBG( sPath ); m_Sprites[i].SetZoom( randomf(0.2f,2) ); - m_Sprites[i].SetRotation( randomf(0,PI*2) ); + m_Sprites[i].SetRotationZ( randomf(0,PI*2) ); } } break; @@ -317,7 +317,7 @@ found_effect: if( sPath.Find("add") != -1 ) for( int i=0; i SPIRAL_MAX_ZOOM ) m_Sprites[i].SetZoom( SPIRAL_MIN_ZOOM ); - m_Sprites[i].SetRotation( m_Sprites[i].GetRotation() + fDeltaTime ); + m_Sprites[i].SetRotationZ( m_Sprites[i].GetRotationZ() + fDeltaTime ); float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM); fRadius *= fRadius; fRadius *= 200; - m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotation())*fRadius ); - m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotation())*fRadius ); + m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotationZ())*fRadius ); + m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotationZ())*fRadius ); } break; case EFFECT_PARTICLES_SPIRAL_IN: @@ -453,13 +453,13 @@ void BGAnimationLayer::Update( float fDeltaTime ) if( m_Sprites[i].GetZoom() < SPIRAL_MIN_ZOOM ) m_Sprites[i].SetZoom( SPIRAL_MAX_ZOOM ); - m_Sprites[i].SetRotation( m_Sprites[i].GetRotation() - fDeltaTime ); + m_Sprites[i].SetRotationZ( m_Sprites[i].GetRotationZ() - fDeltaTime ); float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM); fRadius *= fRadius; fRadius *= 200; - m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotation())*fRadius ); - m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotation())*fRadius ); + m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotationZ())*fRadius ); + m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotationZ())*fRadius ); } break; case EFFECT_PARTICLES_FLOAT_UP: diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index 5638049e3e..78bc542108 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -30,13 +30,13 @@ BPMDisplay::BPMDisplay() m_bExtraStage = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2(); m_textBPM.LoadFromNumbers( THEME->GetPathTo("Numbers","select music bpm numbers") ); - m_textBPM.TurnShadowOff(); + m_textBPM.EnableShadow( false ); m_textBPM.SetHorizAlign( Actor::align_right ); m_textBPM.SetDiffuse( NORMAL_COLOR ); m_textBPM.SetXY( 0, 0 ); m_sprLabel.Load( THEME->GetPathTo("Graphics","select music bpm label") ); - m_sprLabel.TurnShadowOff(); + m_sprLabel.EnableShadow( false ); m_sprLabel.SetDiffuse( NORMAL_COLOR ); m_sprLabel.SetHorizAlign( Actor::align_left ); m_sprLabel.SetXY( 0, 0 ); diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index 23e5667eb8..804ee2c63a 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -66,7 +66,7 @@ void Banner::SetScrolling( bool bScroll, float Percent) void Banner::LoadFromSong( Song* pSong ) // NULL means no song { - Sprite::TurnShadowOff(); + Sprite::EnableShadow( false ); if( pSong == NULL ) LoadFallback(); else if( pSong->HasBanner() ) Load( pSong->GetBannerPath() ); @@ -92,7 +92,7 @@ void Banner::LoadFromGroup( CString sGroupName ) void Banner::LoadFromCourse( Course* pCourse ) // NULL means no course { - Sprite::TurnShadowOff(); + Sprite::EnableShadow( false ); if( pCourse == NULL ) LoadFallback(); else if( pCourse->m_sBannerPath != "" ) Load( pCourse->m_sBannerPath ); diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 8e6da804bb..ba5cefaf0d 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -54,7 +54,7 @@ Combo::Combo() Reset(); m_sprCombo.Load( THEME->GetPathTo("Graphics", "gameplay combo label") ); - m_sprCombo.TurnShadowOn(); + m_sprCombo.EnableShadow( true ); m_sprCombo.StopAnimating(); m_sprCombo.SetXY( LABEL_X, LABEL_Y ); m_sprCombo.SetHorizAlign( (Actor::HorizAlign)(int)LABEL_HORIZ_ALIGN ); @@ -62,7 +62,7 @@ Combo::Combo() this->AddChild( &m_sprCombo ); m_textComboNumber.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay combo numbers") ); - m_textComboNumber.TurnShadowOn(); + m_textComboNumber.EnableShadow( true ); m_textComboNumber.SetXY( NUMBER_X, NUMBER_Y ); m_textComboNumber.SetHorizAlign( (Actor::HorizAlign)(int)NUMBER_HORIZ_ALIGN ); m_textComboNumber.SetVertAlign( (Actor::VertAlign)(int)NUMBER_VERT_ALIGN ); diff --git a/stepmania/src/CourseEntryDisplay.cpp b/stepmania/src/CourseEntryDisplay.cpp index d8e0cfbbcb..7a6b6db695 100644 --- a/stepmania/src/CourseEntryDisplay.cpp +++ b/stepmania/src/CourseEntryDisplay.cpp @@ -51,7 +51,7 @@ CourseEntryDisplay::CourseEntryDisplay() m_textNumber.LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); m_textNumber.SetXY( NUMBER_X, NUMBER_Y ); - m_textNumber.TurnShadowOff(); + m_textNumber.EnableShadow( false ); this->AddChild( &m_textNumber ); m_TextBanner.SetXY( TEXT_BANNER_X, TEXT_BANNER_Y ); @@ -59,20 +59,20 @@ CourseEntryDisplay::CourseEntryDisplay() m_textFoot.LoadFromTextureAndChars( THEME->GetPathTo("Graphics","select music meter 2x1"),"10" ); m_textFoot.SetXY( FOOT_X, FOOT_Y ); - m_textFoot.TurnShadowOff(); + m_textFoot.EnableShadow( false ); this->AddChild( &m_textFoot ); m_textDifficultyNumber.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textDifficultyNumber.SetXY( DIFFICULTY_X, DIFFICULTY_Y ); m_textDifficultyNumber.SetZoom( DIFFICULTY_ZOOM ); - m_textDifficultyNumber.TurnShadowOff(); + m_textDifficultyNumber.EnableShadow( false ); this->AddChild( &m_textDifficultyNumber ); m_textModifiers.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textModifiers.SetXY( MODIFIERS_X, MODIFIERS_Y ); m_textModifiers.SetZoom( MODIFIERS_ZOOM ); m_textModifiers.SetHorizAlign( (Actor::HorizAlign)MODIFIERS_HORIZ_ALIGN ); - m_textModifiers.TurnShadowOff(); + m_textModifiers.EnableShadow( false ); this->AddChild( &m_textModifiers ); } diff --git a/stepmania/src/FadingBanner.cpp b/stepmania/src/FadingBanner.cpp index 97e0065122..bee9ba7c87 100644 --- a/stepmania/src/FadingBanner.cpp +++ b/stepmania/src/FadingBanner.cpp @@ -15,20 +15,20 @@ void FadingBanner::SetCroppedSize( float fWidth, float fHeight ) { - m_BackBanner.SetCroppedSize( fWidth, fHeight ); + m_FrontBanner.SetCroppedSize( fWidth, fHeight ); Banner::SetCroppedSize( fWidth, fHeight ); } void FadingBanner::Update( float fDeltaTime ) { - m_BackBanner.Update(fDeltaTime); + m_FrontBanner.Update(fDeltaTime); Banner::Update( fDeltaTime ); } void FadingBanner::DrawPrimitives() { Banner::DrawPrimitives(); - m_BackBanner.Draw(); + m_FrontBanner.Draw(); } bool FadingBanner::Load( RageTextureID ID ) @@ -42,13 +42,13 @@ void FadingBanner::BeforeChange() // move the back banner to the front in preparation for a cross fade if( this->GetTexturePath() != "" ) { - m_BackBanner.Load( this->GetTexturePath() ); - m_BackBanner.SetScrolling( this->IsScrolling(), this->ScrollingPercent() ); + m_FrontBanner.Load( this->GetTexturePath() ); + m_FrontBanner.SetScrolling( this->IsScrolling(), this->ScrollingPercent() ); } - m_BackBanner.SetDiffuse( RageColor(1,1,1,1) ); - m_BackBanner.StopTweening(); - m_BackBanner.BeginTweening( 0.25f ); // fade out - m_BackBanner.SetTweenDiffuse( RageColor(1,1,1,0) ); + m_FrontBanner.SetDiffuse( RageColor(1,1,1,1) ); + m_FrontBanner.StopTweening(); + m_FrontBanner.BeginTweening( 0.25f ); // fade out + m_FrontBanner.SetTweenDiffuse( RageColor(1,1,1,0) ); } diff --git a/stepmania/src/FadingBanner.h b/stepmania/src/FadingBanner.h index 1c101ed953..314dcb4cee 100644 --- a/stepmania/src/FadingBanner.h +++ b/stepmania/src/FadingBanner.h @@ -26,7 +26,7 @@ public: protected: void BeforeChange(); - Banner m_BackBanner; + Banner m_FrontBanner; }; #endif diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 77eb894d26..e0214b4b2f 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -23,6 +23,7 @@ #include "SongManager.h" #include "Notes.h" #include "NoteSkinManager.h" +#include "ModeChoice.h" GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program @@ -240,6 +241,18 @@ const StyleDef* GameState::GetCurrentStyleDef() return GAMEMAN->GetStyleDefForStyle( m_CurStyle ); } +void GameState::ApplyModeChoice( const ModeChoice* pModeChoice, PlayerNumber pn ) +{ + if( pModeChoice->game != GAME_INVALID ) + m_CurGame = pModeChoice->game; + if( pModeChoice->pm != PLAY_MODE_INVALID ) + m_PlayMode = pModeChoice->pm; + if( pModeChoice->style != STYLE_INVALID ) + m_CurStyle = pModeChoice->style; + if( pModeChoice->dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID ) + m_PreferredDifficulty[pn] = pModeChoice->dc; +} + bool GameState::IsPlayerEnabled( PlayerNumber pn ) { if( m_CurStyle == STYLE_INVALID ) // if no style set (we're in TitleMenu, ConfigInstruments or something) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index e1d7ba1cde..f48ddad3d8 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -19,12 +19,12 @@ #include "Grade.h" #include "StageStats.h" - class Song; struct Notes; class Course; class GameDef; class StyleDef; +struct ModeChoice; class GameState @@ -44,6 +44,7 @@ public: Style m_CurStyle; bool m_bPlayersCanJoin; // true if it's not too late for a player to join - this only has an effect on the credits message bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side + PlayMode m_PlayMode; // many screens display different info depending on this value int m_iCoins; // not "credits" PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides bool m_bIsOnSystemMenu; // system screens will not be effected by the operator key -- Miryokuteki @@ -56,10 +57,11 @@ public: return iNumSidesJoined; }; - GameDef* GetCurrentGameDef(); const StyleDef* GetCurrentStyleDef(); + void ApplyModeChoice( const ModeChoice* pModeChoice, PlayerNumber pn ); + bool IsPlayerEnabled( PlayerNumber pn ); bool IsPlayerEnabled( int p ) { return IsPlayerEnabled( (PlayerNumber)p ); }; // for those too lasy to cast all those p's to a PlayerNumber bool IsCourseMode() const; @@ -68,7 +70,6 @@ public: CString m_sPreferredGroup; // GROUP_ALL_MUSIC denotes no preferred group Difficulty m_PreferredDifficulty[NUM_PLAYERS]; SongSortOrder m_SongSortOrder; // used by MusicWheel - PlayMode m_PlayMode; // many screen display different info depending on this value bool m_bEditing; // NoteField does special stuff when this is true bool m_bDemonstration; // ScreenGameplay does special stuff when this is true bool m_bJukeboxUsesModifiers; diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index 3d0d8927fa..9af84f7fde 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -58,7 +58,7 @@ void GrooveRadar::TweenOnScreen() m_sprRadarLabels[c].BeginTweening( 0.1f ); // begin fading on screen m_sprRadarLabels[c].SetTweenGlow( RageColor(1,1,1,1) ); - m_sprRadarLabels[c].BeginTweening( 0.3f, Actor::TWEEN_BIAS_BEGIN ); // fly to the right + m_sprRadarLabels[c].BeginTweening( 0.3f, Actor::TWEEN_ACCELERATE ); // fly to the right m_sprRadarLabels[c].SetTweenX( fOriginalX ); m_sprRadarLabels[c].SetTweenZoom( 1 ); m_sprRadarLabels[c].SetTweenGlow( RageColor(1,1,1,0) ); @@ -204,7 +204,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() void GrooveRadar::GrooveRadarValueMap::TweenOnScreen() { SetZoom( 0.5f ); - SetRotation( PI*4 ); + SetRotationZ( PI*4 ); BeginTweening( 0.6f ); SetTweenZoom( 1 ); SetTweenRotationZ( 0 ); diff --git a/stepmania/src/HoldJudgment.cpp b/stepmania/src/HoldJudgment.cpp index cb055c3246..497dc4153a 100644 --- a/stepmania/src/HoldJudgment.cpp +++ b/stepmania/src/HoldJudgment.cpp @@ -33,7 +33,7 @@ HoldJudgment::HoldJudgment() m_fShowCountdown = 0; m_sprJudgment.Load( THEME->GetPathTo("Graphics","gameplay hold Judgment 1x2") ); m_sprJudgment.StopAnimating(); - m_sprJudgment.TurnShadowOn(); + m_sprJudgment.EnableShadow( true ); this->AddChild( &m_sprJudgment ); } diff --git a/stepmania/src/Judgment.cpp b/stepmania/src/Judgment.cpp index 145767581c..4d136a63a4 100644 --- a/stepmania/src/Judgment.cpp +++ b/stepmania/src/Judgment.cpp @@ -45,7 +45,7 @@ Judgment::Judgment() m_sprJudgment.Load( THEME->GetPathTo("Graphics","gameplay Judgment 1x6") ); m_sprJudgment.SetXY( WORD_X, WORD_Y ); m_sprJudgment.StopAnimating(); - m_sprJudgment.TurnShadowOn(); + m_sprJudgment.EnableShadow( true ); this->AddChild( &m_sprJudgment ); } @@ -99,7 +99,7 @@ void Judgment::SetJudgment( TapNoteScore score ) // vibrate m_sprJudgment.SetY( 0 ); m_sprJudgment.SetZoom( 1.0f ); - m_sprJudgment.SetEffectVibrating(); + m_sprJudgment.SetEffectVibrate(); } else { @@ -120,7 +120,7 @@ void Judgment::SetJudgment( TapNoteScore score ) } if( score == TNS_MARVELOUS ) - m_sprJudgment.SetEffectGlowBlinking(0.05f, RageColor(1,1,1,0), RageColor(1,1,1,0.5f)); + m_sprJudgment.SetEffectGlowBlink(0.05f, RageColor(1,1,1,0), RageColor(1,1,1,0.5f)); else m_sprJudgment.SetEffectNone(); } diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index f68c293b51..d8d6907cc5 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -59,21 +59,21 @@ void LifeMeterBattery::Load( PlayerNumber pn ) m_textNumLives.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery life numbers") ); m_textNumLives.SetDiffuse( RageColor(1,1,1,1) ); - m_textNumLives.TurnShadowOff(); + m_textNumLives.EnableShadow( false ); if( bPlayerEnabled ) this->AddChild( &m_textNumLives ); if(PREFSMAN->m_bDancePointsForOni) { m_textPercent.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery dance point numbers") ); - m_textPercent.TurnShadowOff(); + m_textPercent.EnableShadow( false ); m_textPercent.SetZoom( 0.7f ); m_textPercent.SetText( " " ); } else { m_textPercent.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery percent numbers") ); - m_textPercent.TurnShadowOff(); + m_textPercent.EnableShadow( false ); m_textPercent.SetZoom( 0.7f ); m_textPercent.SetText( "00.0%" ); } diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 12f71858be..56e665d93c 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -30,8 +30,8 @@ MenuTimer::MenuTimer() m_textDigit1.LoadFromNumbers( THEME->GetPathTo("Numbers","menu timer numbers") ); m_textDigit2.LoadFromNumbers( THEME->GetPathTo("Numbers","menu timer numbers") ); - m_textDigit1.TurnShadowOff(); - m_textDigit2.TurnShadowOff(); + m_textDigit1.EnableShadow( false ); + m_textDigit2.EnableShadow( false ); const glyph &g = m_textDigit1.m_pFont->GetGlyph('0'); float fCharWidth = (float)g.Texture->GetSourceFrameWidth(); diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h index c3934b4d01..53ceffdf41 100644 --- a/stepmania/src/ModeChoice.h +++ b/stepmania/src/ModeChoice.h @@ -13,6 +13,7 @@ #include "Game.h" #include "Style.h" +#include "GameConstantsAndTypes.h" struct ModeChoice // used in SelectMode { diff --git a/stepmania/src/ModeSelector.cpp b/stepmania/src/ModeSelector.cpp new file mode 100644 index 0000000000..39e94a4f75 --- /dev/null +++ b/stepmania/src/ModeSelector.cpp @@ -0,0 +1,35 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ModeSelector + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ModeSelector.h" +#include "ThemeManager.h" +#include "GameState.h" +#include "ModeChoice.h" + + + +bool ModeSelector::IsSelectable( const ModeChoice& choice ) +{ + return choice.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined(); +} + + +#include "ModeSelectorMaxType1.h" +#include "ModeSelectorMaxType2.h" + +ModeSelector* ModeSelector::Create( CString sClassName ) +{ + if( sClassName.CompareNoCase("ModeSelectorMaxType1") == 0 ) return new ModeSelectorMaxType1; + if( sClassName.CompareNoCase("ModeSelectorMaxType2") == 0 ) return new ModeSelectorMaxType2; + + RageException::Throw( "Invalid ModeSelector class name '%s'.", sClassName.GetString() ); +} diff --git a/stepmania/src/ModeSelector.h b/stepmania/src/ModeSelector.h new file mode 100644 index 0000000000..ca2984a52c --- /dev/null +++ b/stepmania/src/ModeSelector.h @@ -0,0 +1,46 @@ +#ifndef ModeSelector_H +#define ModeSelector_H +/* +----------------------------------------------------------------------------- + Class: ModeSelector + + Desc: Abstract class for a widget that selects a ModeChoice + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +#include "Screen.h" +#include "PlayerNumber.h" +struct ModeChoice; + +// send SM_BeginFadingOut when all players have confirmed choice + + +class ModeSelector : public Screen // instead of ActorFrame so we can use ScreenMessages +{ +public: + ModeSelector() {}; + virtual ~ModeSelector() {}; + + virtual void Init( const vector& choices, CString sClassName, CString sThemeElementPrefix ) = 0; + + virtual void MenuLeft( PlayerNumber pn ) = 0; + virtual void MenuRight( PlayerNumber pn ) = 0; + virtual void MenuUp( PlayerNumber pn ) = 0; + virtual void MenuDown( PlayerNumber pn ) = 0; + virtual void MenuStart( PlayerNumber pn ) = 0; + virtual void MenuBack( PlayerNumber pn ) = 0; + virtual void TweenOffScreen() = 0; + virtual void TweenOnScreen() = 0; + + virtual void GetSelectedModeChoice( PlayerNumber pn, ModeChoice* pModeChoiceOut ) = 0; + bool IsSelectable( const ModeChoice& choice ); + virtual void UpdateSelectableChoices() = 0; + + static ModeSelector* Create( CString sClassName ); +}; + +#endif diff --git a/stepmania/src/ModeSelectorMaxType1.cpp b/stepmania/src/ModeSelectorMaxType1.cpp new file mode 100644 index 0000000000..811487f6ae --- /dev/null +++ b/stepmania/src/ModeSelectorMaxType1.cpp @@ -0,0 +1,276 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ModeSelectorMaxType1 + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ModeSelectorMaxType1.h" +#include "GameManager.h" +#include "ThemeManager.h" +#include "PrefsManager.h" +#include "ScreenManager.h" + + +#define JOINT_PREMIUM_BANNER_X THEME->GetMetricF("ModeSelectorMaxType1","JointPremiumBannerX") +#define JOINT_PREMIUM_BANNER_Y THEME->GetMetricF("ModeSelectorMaxType1","JointPremiumBannerY") +#define ICONS_START_X THEME->GetMetricF("ModeSelectorMaxType1","IconsStartX") +#define ICONS_SPACING_X THEME->GetMetricF("ModeSelectorMaxType1","IconsSpacingX") +#define ICONS_START_Y THEME->GetMetricF("ModeSelectorMaxType1","IconsStartY") +#define ICONS_SPACING_Y THEME->GetMetricF("ModeSelectorMaxType1","IconsSpacingY") +#define ICONS_DISABLED_COLOR THEME->GetMetricC("ModeSelectorMaxType1","IconsDisabledColor") +#define EXPLANATION_X THEME->GetMetricF("ModeSelectorMaxType1","ExplanationX") +#define EXPLANATION_Y THEME->GetMetricF("ModeSelectorMaxType1","ExplanationY") +#define INFO_X THEME->GetMetricF("ModeSelectorMaxType1","InfoX") +#define INFO_Y THEME->GetMetricF("ModeSelectorMaxType1","InfoY") +#define PREVIEW_X THEME->GetMetricF("ModeSelectorMaxType1","PreviewX") +#define PREVIEW_Y THEME->GetMetricF("ModeSelectorMaxType1","PreviewY") +#define FADE_SECONDS THEME->GetMetricF("ModeSelectorMaxType1","FadeSeconds") + + +ModeSelectorMaxType1::ModeSelectorMaxType1() +{ + m_iSelection = 0; +} + +void ModeSelectorMaxType1::Init( const vector& choices, CString sClassName, CString sThemeElementPrefix ) +{ + m_aModeChoices = choices; + + unsigned i; + for( i=0; iGetGameDefForGame(mc.game)->m_szName; + + + // + // Load icon + // + float fIconX = ICONS_START_X + i*ICONS_SPACING_X; + float fIconY = ICONS_START_Y + i*ICONS_SPACING_Y; + CString sIconElementName = ssprintf("%s icon %s %s", sThemeElementPrefix.GetString(), sGameName.GetString(), mc.name ); + CString sIconPath = THEME->GetPathTo("Graphics",sIconElementName); + if( sIconPath.empty() ) // element doesn't exist + { + m_textIcon[i].LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textIcon[i].SetXY( fIconX, fIconY ); + m_textIcon[i].SetText( mc.name ); + m_textIcon[i].SetZoom(0.5f); + this->AddChild( &m_textIcon[i] ); + } + else + { + m_sprIcon[i].Load( sIconPath ); + m_sprIcon[i].SetXY( fIconX, fIconY ); + this->AddChild( &m_sprIcon[i] ); + } + + + // + // Load preview + // + CString sPreviewElementName = ssprintf("%s preview %s %s", sThemeElementPrefix.GetString(), sGameName.GetString(), mc.name ); + CString sPreviewPath = THEME->GetPathTo("Graphics",sPreviewElementName); + if( sPreviewPath != "" ) + { + m_sprPreview[i].Load( sPreviewPath ); + m_sprPreview[i].SetXY( PREVIEW_X, PREVIEW_Y ); + m_sprPreview[i].SetDiffuse( RageColor(1,1,1,0) ); + this->AddChild( &m_sprPreview[i] ); + } + + + // + // Load info + // + CString sInfoElementName = ssprintf("%s info %s %s", sThemeElementPrefix.GetString(), sGameName.GetString(), mc.name ); + CString sInfoPath = THEME->GetPathTo("Graphics",sInfoElementName); + if( sInfoPath != "" ) + { + m_sprInfo[i].Load( sInfoPath ); + m_sprInfo[i].SetXY( INFO_X, INFO_Y ); + m_sprInfo[i].SetDiffuse( RageColor(1,1,1,0) ); + this->AddChild( &m_sprInfo[i] ); + } + } + + // fix Z ordering of Preview and Info so that they draw on top + for( i=0; im_aModeChoices.size(); i++ ) + this->MoveToTail( &m_sprPreview[i] ); + for( i=0; im_aModeChoices.size(); i++ ) + this->MoveToTail( &m_sprInfo[i] ); + + + this->UpdateSelectableChoices(); + + m_sprExplanation.Load( THEME->GetPathTo("Graphics","select style explanation") ); + m_sprExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); + this->AddChild( &m_sprExplanation ); + + if( PREFSMAN->m_bJointPremium ) + { + m_sprJointPremium.Load( THEME->GetPathTo("Graphics","select style joint premium banner") ); + m_sprJointPremium.SetXY( JOINT_PREMIUM_BANNER_X, JOINT_PREMIUM_BANNER_Y ); + this->AddChild( &m_sprJointPremium ); + } + + + m_soundChange.Load( THEME->GetPathTo("Sounds",sThemeElementPrefix + " change") ); + m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") ); + + TweenOnScreen(); +} + +void ModeSelectorMaxType1::MenuLeft( PlayerNumber pn ) +{ + int iSwitchToIndex = -1; // -1 means none found + for( int i=m_iSelection-1; i>=0; i-- ) + { + if( IsSelectable(m_aModeChoices[i]) ) + { + iSwitchToIndex = i; + break; + } + } + + if( iSwitchToIndex == -1 ) + return; + + BeforeChange(); + m_iSelection = iSwitchToIndex; + m_soundChange.Play(); + AfterChange(); +} + +void ModeSelectorMaxType1::MenuRight( PlayerNumber pn ) +{ + int iSwitchToIndex = -1; // -1 means none found + for( unsigned i=m_iSelection+1; iSendMessageToTopScreen( SM_BeginFadingOut, 0 ); +} + +void ModeSelectorMaxType1::MenuBack( PlayerNumber pn ) +{ + +} + +void ModeSelectorMaxType1::TweenOffScreen() +{ + for( unsigned i=0; i& choices, CString sClassName, CString sThemeElementPrefix ); + + virtual void MenuLeft( PlayerNumber pn ); + virtual void MenuRight( PlayerNumber pn ); + virtual void MenuUp( PlayerNumber pn ) {}; + virtual void MenuDown( PlayerNumber pn ) {}; + virtual void MenuStart( PlayerNumber pn ); + virtual void MenuBack( PlayerNumber pn ); + virtual void TweenOffScreen(); + virtual void TweenOnScreen(); + + virtual void GetSelectedModeChoice( PlayerNumber pn, ModeChoice* pModeChoiceOut ); + virtual void UpdateSelectableChoices(); + +protected: + void BeforeChange(); + void AfterChange(); + + vector m_aModeChoices; + int m_iSelection; + + Sprite m_sprIcon[MAX_MODE_CHOICES]; + // Artists don't make graphics for every single Game, so + // have a text representation if textures are missing. + BitmapText m_textIcon[MAX_MODE_CHOICES]; + Sprite m_sprPreview[MAX_MODE_CHOICES]; + Sprite m_sprInfo[MAX_MODE_CHOICES]; + Sprite m_sprExplanation; + Sprite m_sprJointPremium; + + RageSound m_soundChange; + RageSound m_soundSelect; +}; + +#endif diff --git a/stepmania/src/ModeSelectorMaxType2.cpp b/stepmania/src/ModeSelectorMaxType2.cpp new file mode 100644 index 0000000000..c5c063f7b0 --- /dev/null +++ b/stepmania/src/ModeSelectorMaxType2.cpp @@ -0,0 +1,407 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ModeSelectorMaxType2 + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ModeSelectorMaxType2.h" +#include "GameManager.h" +#include "ThemeManager.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "GameState.h" +#include "AnnouncerManager.h" + + +#define NUM_CHOICES_ON_PAGE_1 THEME->GetMetricI("ModeSelectorMaxType2","NumChoicesOnPage1") +#define LOCK_INPUT_SECONDS THEME->GetMetricF("ModeSelectorMaxType2","LockInputSeconds") +#define SLEEP_AFTER_CHOICE_SECONDS THEME->GetMetricF("ModeSelectorMaxType2","SleepAfterChoiceSeconds") +#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF("ModeSelectorMaxType2","SleepAfterTweenOffSeconds") +#define MORE_ON_COMMAND( page ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("MorePage%dOnCommand",page+1)) +#define MORE_OFF_COMMAND( page ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("MorePage%dOffCommand",page+1)) +#define EXPLANATION_ON_COMMAND( page ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("ExplanationPage%dOnCommand",page+1)) +#define EXPLANATION_OFF_COMMAND( page ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("ExplanationPage%dOffCommand",page+1)) +#define HEADER_ON_COMMAND( page, choice ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("HeaderPage%dChoice%dOnCommand",page+1,choice+1)) +#define HEADER_OFF_COMMAND( page, choice ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("HeaderPage%dChoice%dOffCommand",page+1,choice+1)) +#define PICTURE_ON_COMMAND( page, choice ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("PicturePage%dChoice%dOnCommand",page+1,choice+1)) +#define PICTURE_OFF_COMMAND( page, choice ) THEME->GetMetric ("ModeSelectorMaxType2",ssprintf("PicturePage%dChoice%dOffCommand",page+1,choice+1)) +#define CURSOR_ON_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","CursorOnCommand") +#define CURSOR_CHOOSE_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","CursorChooseCommand") +#define CURSOR_OFF_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","CursorOffCommand") +#define CURSOR_OFFSET_X_FROM_PICTURE( p ) THEME->GetMetricF("ModeSelectorMaxType2",ssprintf("CursorP%dOffsetXFromPicture",p+1)) +#define CURSOR_OFFSET_Y_FROM_PICTURE( p ) THEME->GetMetricF("ModeSelectorMaxType2",ssprintf("CursorP%dOffsetYFromPicture",p+1)) +#define SHADOW_ON_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","ShadowOnCommand") +#define SHADOW_CHOOSE_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","ShadowChooseCommand") +#define SHADOW_OFF_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","ShadowOffCommand") +#define SHADOW_LENGTH_X THEME->GetMetricF("ModeSelectorMaxType2","ShadowLengthX") +#define SHADOW_LENGTH_Y THEME->GetMetricF("ModeSelectorMaxType2","ShadowLengthY") +#define OK_ON_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","OKOnCommand") +#define OK_CHOOSE_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","OKChooseCommand") +#define OK_OFF_COMMAND THEME->GetMetric ("ModeSelectorMaxType2","OKOffCommand") +#define DISABLED_COLOR THEME->GetMetricC("ModeSelectorMaxType2","DisabledColor") + + + +ModeSelectorMaxType2::ModeSelectorMaxType2() +{ + m_CurrentPage = PAGE_1; + for( int p=0; p& choices, CString sClassName, CString sThemeElementPrefix ) +{ + for( int c=0; cGetPathTo("Graphics",sPictureFile) ); + m_framePages.AddChild( &m_sprPicture[page][choice] ); + + m_sprHeader[page][choice].Load( THEME->GetPathTo("Graphics",sHeaderFile) ); + m_framePages.AddChild( &m_sprHeader[page][choice] ); + } + + + m_sprMore[page].Load( THEME->GetPathTo("Graphics", ssprintf("%s more page%d",sThemeElementPrefix.GetString(),page+1) ) ); + m_framePages.AddChild( &m_sprMore[page] ); + + m_sprExplanation[page].Load( THEME->GetPathTo("Graphics", ssprintf("%s explanation",sThemeElementPrefix.GetString())) ); + m_sprExplanation[page].StopAnimating(); + m_sprExplanation[page].SetState( page ); + m_framePages.AddChild( &m_sprExplanation[page] ); + } + + + for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + continue; + + m_sprShadow[p].Load( THEME->GetPathTo("Graphics", "select difficulty shadow 2x1") ); + m_sprShadow[p].StopAnimating(); + m_sprShadow[p].SetState( p ); + m_sprShadow[p].SetDiffuse( RageColor(0,0,0,0.6f) ); + m_framePages.AddChild( &m_sprShadow[p] ); + + m_sprCursor[p].Load( THEME->GetPathTo("Graphics", "select difficulty cursor 2x1") ); + m_sprCursor[p].StopAnimating(); + m_sprCursor[p].SetState( p ); + m_framePages.AddChild( &m_sprCursor[p] ); + + m_sprOK[p].Load( THEME->GetPathTo("Graphics", "select difficulty ok 2x1") ); + m_sprOK[p].SetState( p ); + m_sprOK[p].StopAnimating(); + m_sprOK[p].SetDiffuse( RageColor(1,1,1,0) ); + m_framePages.AddChild( &m_sprOK[p] ); + } + + this->AddChild( &m_framePages ); + + m_soundChange.Load( THEME->GetPathTo("Sounds", "select difficulty change") ); + m_soundSelect.Load( THEME->GetPathTo("Sounds", "menu start") ); + m_soundDifficult.Load( ANNOUNCER->GetPathTo("select difficulty challenge") ); + + m_fLockInputTime = LOCK_INPUT_SECONDS; +} + +void ModeSelectorMaxType2::Update( float fDelta ) +{ + ModeSelector::Update( fDelta ); + m_fLockInputTime = max( 0, m_fLockInputTime-fDelta ); +} + +void ModeSelectorMaxType2::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_BeginFadingOut: + TweenOffScreen(); + SCREENMAN->SendMessageToTopScreen( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // nofify parent that we're finished + break; + } +} + +void ModeSelectorMaxType2::GetSelectedModeChoice( PlayerNumber pn, ModeChoice* pModeChoiceOut ) +{ + *pModeChoiceOut = m_ModeChoices[m_CurrentPage][ m_iChoiceOnPage[pn] ]; // doesn't depend on pn +} + +void ModeSelectorMaxType2::UpdateSelectableChoices() +{ + for( int page=0; pageIsPlayerEnabled(p) ) + { + MenuRight( (PlayerNumber)p ); + MenuLeft( (PlayerNumber)p ); + } +} + +void ModeSelectorMaxType2::MenuLeft( PlayerNumber pn ) +{ + if( m_fLockInputTime > 0 ) + return; + if( m_bChosen[pn] ) + return; + if( m_iChoiceOnPage[pn] == 0 ) // can't go left any more + { + if( m_CurrentPage > 0 ) + ChangePage( (Page)(m_CurrentPage-1) ); + } + else + ChangeWithinPage( pn, m_iChoiceOnPage[pn]-1, false ); +} + + +void ModeSelectorMaxType2::MenuRight( PlayerNumber pn ) +{ + if( m_fLockInputTime > 0 ) + return; + if( m_bChosen[pn] ) + return; + if( m_iChoiceOnPage[pn] == (int)m_ModeChoices[m_CurrentPage].size()-1 ) // can't go left any more + { + if( m_CurrentPage < NUM_PAGES-1 ) + ChangePage( (Page)(m_CurrentPage+1) ); + } + else + ChangeWithinPage( pn, m_iChoiceOnPage[pn]+1, false ); +} + +void ModeSelectorMaxType2::ChangePage( Page newPage ) +{ + int p; + + // If anyone has already chosen, don't allow changing of pages + for( p=0; pIsPlayerEnabled(p) && m_bChosen[p] ) + return; + + bool bPageIncreasing = newPage > m_CurrentPage; + m_CurrentPage = newPage; + + if( newPage == PAGE_2 ) + { + m_soundDifficult.Stop(); + m_soundDifficult.PlayRandom(); + } + + // change both players + int iNewChoice = bPageIncreasing ? 0 : m_ModeChoices[m_CurrentPage].size()-1; + for( p=0; pIsPlayerEnabled(p) ) + continue; // skip + + if( p!=pn && m_CurrentPage==PAGE_1 ) + continue; // skip + + m_iChoiceOnPage[p] = iNewChoice; + + float fCursorX = GetCursorX( (PlayerNumber)p ); + float fCursorY = GetCursorY( (PlayerNumber)p ); + + m_sprCursor[p].StopTweening(); + m_sprCursor[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE ); + m_sprCursor[p].SetTweenX( fCursorX ); + m_sprCursor[p].SetTweenY( fCursorY ); + + m_sprShadow[p].StopTweening(); + m_sprShadow[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE ); + m_sprShadow[p].SetTweenX( fCursorX + SHADOW_LENGTH_X ); + m_sprShadow[p].SetTweenY( fCursorY + SHADOW_LENGTH_Y ); + } + + m_soundChange.Play(); +} + +void ModeSelectorMaxType2::MenuStart( PlayerNumber pn ) +{ + if( m_fLockInputTime > 0 ) + return; + if( m_bChosen[pn] == true ) + return; + m_bChosen[pn] = true; + + for( unsigned page=0; pagePlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("select difficulty comment %s",mc.name)) ); + + /* XXX: This will play the same announcer twice at the same time; that'll probably + * result in an echo effect. */ + if( m_CurrentPage == PAGE_2 ) + { + // choose this for all the other players too + for( int p=0; pIsPlayerEnabled((PlayerNumber)p) && m_bChosen[p] == false ) + return; + } + this->SendScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on +} + + +void ModeSelectorMaxType2::MenuBack( PlayerNumber pn ) +{ +} + +void ModeSelectorMaxType2::TweenOnScreen() +{ + unsigned p; + + for( int page=0; pageIsPlayerEnabled((PlayerNumber)p) ) + continue; + + float fCursorX = GetCursorX( (PlayerNumber)p ); + float fCursorY = GetCursorY( (PlayerNumber)p ); + + m_sprCursor[p].SetXY( fCursorX, fCursorY ); + m_sprCursor[p].Command( CURSOR_ON_COMMAND ); + + m_sprShadow[p].SetXY( fCursorX + SHADOW_LENGTH_X, fCursorY + SHADOW_LENGTH_Y ); + m_sprShadow[p].Command( SHADOW_ON_COMMAND ); + } +} + +void ModeSelectorMaxType2::TweenOffScreen() +{ + const int page = m_CurrentPage; + + m_sprExplanation[page].Command( "sleep,0.7;bouncebegin,0.5f;x,-300" ); + m_sprMore[page].FadeOff( 0.7f, "fade", 0.5f ); + + + for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + continue; + + m_sprCursor[p].Command( CURSOR_OFF_COMMAND ); + m_sprOK[p].Command( OK_OFF_COMMAND ); + m_sprShadow[p].Command( SHADOW_OFF_COMMAND ); + } + + for( unsigned c=0; c& choices, CString sClassName, CString sThemeElementPrefix ); + + virtual void Update( float fDelta ); + + virtual void MenuLeft( PlayerNumber pn ); + virtual void MenuRight( PlayerNumber pn ); + virtual void MenuUp( PlayerNumber pn ) {}; + virtual void MenuDown( PlayerNumber pn ) {}; + virtual void MenuStart( PlayerNumber pn ); + virtual void MenuBack( PlayerNumber pn ); + virtual void TweenOffScreen(); + virtual void TweenOnScreen(); + + virtual void GetSelectedModeChoice( PlayerNumber pn, ModeChoice* pModeChoiceOut ); + virtual void UpdateSelectableChoices(); + + virtual void HandleScreenMessage( const ScreenMessage SM ); + +protected: + float GetCursorX( PlayerNumber pn ); + float GetCursorY( PlayerNumber pn ); + void ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages ); + void ChangePage( Page newPage ); + + ActorFrame m_framePages; // to hold the 2 pages + + Sprite m_sprHeader[NUM_PAGES][MAX_CHOICES_PER_PAGE]; + Sprite m_sprPicture[NUM_PAGES][MAX_CHOICES_PER_PAGE]; + Sprite m_sprExplanation[NUM_PAGES]; + Sprite m_sprMore[NUM_PAGES]; + + Sprite m_sprCursor[NUM_PLAYERS]; + Sprite m_sprShadow[NUM_PLAYERS]; + Sprite m_sprOK[NUM_PLAYERS]; + + RageSound m_soundChange; + RageSound m_soundSelect; + RandomSample m_soundDifficult; + + vector m_ModeChoices[NUM_PAGES]; + + Page m_CurrentPage; + int m_iChoiceOnPage[NUM_PLAYERS]; + bool m_bChosen[NUM_PLAYERS]; + + float m_fLockInputTime; +}; + +#endif diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 2d0e28bc8c..06e76dbfa9 100644 --- a/stepmania/src/MotionBlurSprite.h +++ b/stepmania/src/MotionBlurSprite.h @@ -50,12 +50,12 @@ public: virtual void SetZoomX( float zoom ){ for(int i=0; iGetPathTo("Fonts","musicwheel section") ); - m_textSectionName.TurnShadowOff(); + m_textSectionName.EnableShadow( false ); m_textSectionName.SetVertAlign( align_middle ); m_textSectionName.SetXY( SECTION_NAME_X, 0 ); m_textSectionName.SetZoom( SECTION_ZOOM ); m_textRoulette.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel roulette") ); - m_textRoulette.TurnShadowOff(); + m_textRoulette.EnableShadow( false ); m_textRoulette.TurnRainbowOn(); m_textRoulette.SetZoom( ROULETTE_ZOOM ); m_textRoulette.SetXY( ROULETTE_X, 0 ); @@ -88,7 +88,7 @@ WheelItemDisplay::WheelItemDisplay() } m_textCourse.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel course") ); - m_textCourse.TurnShadowOff(); + m_textCourse.EnableShadow( false ); m_textCourse.SetZoom( COURSE_ZOOM ); m_textCourse.SetHorizAlign( align_left ); m_textCourse.SetXY( COURSE_X, 0 ); diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 63f15e1148..8ce803262d 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -665,7 +665,7 @@ void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bOnSame { // draw tap pSprite = GetTapNoteSprite( fBeat ); - pSprite->SetRotation( fRotation ); + pSprite->SetRotationZ( fRotation ); } pSprite->SetXY( fXPos, fYPos ); diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 88b9812b28..c13390348a 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -35,7 +35,7 @@ NoteField::NoteField() m_textMeasureNumber.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textMeasureNumber.SetZoom( 1.0f ); - m_rectMarkerBar.TurnShadowOff(); + m_rectMarkerBar.EnableShadow( false ); m_rectMarkerBar.SetEffectDiffuseShift( 2, RageColor(1,1,1,0.5f), RageColor(0.5f,0.5f,0.5f,0.5f) ); m_sprBars.Load( THEME->GetPathTo("Graphics","edit bars") ); diff --git a/stepmania/src/OptionIcon.cpp b/stepmania/src/OptionIcon.cpp index b492f6529f..151aaaebf1 100644 --- a/stepmania/src/OptionIcon.cpp +++ b/stepmania/src/OptionIcon.cpp @@ -30,7 +30,7 @@ OptionIcon::OptionIcon() this->AddChild( &m_spr ); m_text.LoadFromFont( THEME->GetPathTo("Fonts","option icons") ); - m_text.TurnShadowOff(); + m_text.EnableShadow( false ); m_text.SetZoom( TEXT_ZOOM ); m_text.SetXY( TEXT_OFFSET_X, TEXT_OFFSET_Y ); m_text.SetHorizAlign( (Actor::HorizAlign)TEXT_H_ALIGN ); diff --git a/stepmania/src/ScoreDisplayNormal.cpp b/stepmania/src/ScoreDisplayNormal.cpp index e8a072704b..b38f130d00 100644 --- a/stepmania/src/ScoreDisplayNormal.cpp +++ b/stepmania/src/ScoreDisplayNormal.cpp @@ -29,7 +29,7 @@ ScoreDisplayNormal::ScoreDisplayNormal() // init the text m_text.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay score numbers") ); - m_text.TurnShadowOff(); + m_text.EnableShadow( false ); m_fScore = 0; m_fTrailingScore = 0; diff --git a/stepmania/src/ScoreDisplayOni.cpp b/stepmania/src/ScoreDisplayOni.cpp index a7d42c8c71..94bb1a03d5 100644 --- a/stepmania/src/ScoreDisplayOni.cpp +++ b/stepmania/src/ScoreDisplayOni.cpp @@ -25,7 +25,7 @@ ScoreDisplayOni::ScoreDisplayOni() // init the text m_text.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay score numbers") ); - m_text.TurnShadowOff(); + m_text.EnableShadow( false ); this->AddChild( &m_text ); } diff --git a/stepmania/src/ScreenDemonstration.cpp b/stepmania/src/ScreenDemonstration.cpp index 7c26eec92c..ac85d06cc0 100644 --- a/stepmania/src/ScreenDemonstration.cpp +++ b/stepmania/src/ScreenDemonstration.cpp @@ -140,7 +140,7 @@ ScreenDemonstration::ScreenDemonstration() : ScreenGameplay(SetUpSongOptions()) m_sprDemonstrationBlink.Load( THEME->GetPathTo("Graphics","demonstration blink") ); m_sprDemonstrationBlink.SetXY( CENTER_X, CENTER_Y ); - m_sprDemonstrationBlink.SetEffectDiffuseBlinking(); + m_sprDemonstrationBlink.SetEffectDiffuseBlink(); this->AddChild( &m_sprDemonstrationBlink ); this->MoveToTail( &m_Fade ); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 1df89b3944..a7ff9ce598 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -167,7 +167,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) this->AddChild( &m_BannerWithFrame[0] ); m_textStage.LoadFromFont( THEME->GetPathTo("Fonts","evaluation stage") ); - m_textStage.TurnShadowOff(); + m_textStage.EnableShadow( false ); m_textStage.SetXY( STAGE_X, STAGE_Y ); m_textStage.SetZoom( 0.5f ); m_textStage.SetText( GAMESTATE->GetStageText() + " Stage" ); @@ -328,7 +328,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) this->AddChild( &m_sprPercentFrame[p] ); m_textOniPercentLarge[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); - m_textOniPercentLarge[p].TurnShadowOff(); + m_textOniPercentLarge[p].EnableShadow( false ); m_textOniPercentLarge[p].SetXY( (PREFSMAN->m_bDancePointsForOni ? DANCE_POINT_X(p) : PERCENT_BASE_X(p) ), PERCENT_BASE_Y ); m_textOniPercentLarge[p].SetHorizAlign( Actor::align_right ); m_textOniPercentLarge[p].SetVertAlign( Actor::align_bottom ); @@ -338,7 +338,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) if(!PREFSMAN->m_bDancePointsForOni) { m_textOniPercentSmall[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); - m_textOniPercentSmall[p].TurnShadowOff(); + m_textOniPercentSmall[p].EnableShadow( false ); m_textOniPercentSmall[p].SetZoom( 0.5f ); m_textOniPercentSmall[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); m_textOniPercentSmall[p].SetHorizAlign( Actor::align_left ); @@ -375,7 +375,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) this->AddChild( &m_sprCourseFrame[p] ); m_textSongsSurvived[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation stage numbers") ); - m_textSongsSurvived[p].TurnShadowOff(); + m_textSongsSurvived[p].EnableShadow( false ); m_textSongsSurvived[p].SetXY( SONGS_SURVIVED_X(p), SONGS_SURVIVED_Y ); m_textSongsSurvived[p].SetText( ssprintf("%02d", stageStats.iSongsPlayed[p]) ); this->AddChild( &m_textSongsSurvived[p] ); @@ -416,7 +416,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_sprPossibleBar[p][r].SetHorizAlign( Actor::align_left ); m_sprPossibleBar[p][r].SetX( BAR_BASE_X(p) ); m_sprPossibleBar[p][r].SetY( BAR_START_Y + BAR_SPACING_Y*r ); - m_sprPossibleBar[p][r].SetRotation( BAR_ROTATION(p) ); + m_sprPossibleBar[p][r].SetRotationZ( BAR_ROTATION(p) ); m_sprPossibleBar[p][r].SetZoomX( 0 ); m_sprPossibleBar[p][r].ZoomToHeight( BAR_HEIGHT ); m_sprPossibleBar[p][r].BeginTweening( 0.2f + r*0.1f ); // sleep @@ -430,7 +430,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_sprActualBar[p][r].SetHorizAlign( Actor::align_left ); m_sprActualBar[p][r].SetX( BAR_BASE_X(p) ); m_sprActualBar[p][r].SetY( BAR_START_Y + BAR_SPACING_Y*r ); - m_sprActualBar[p][r].SetRotation( BAR_ROTATION(p) ); + m_sprActualBar[p][r].SetRotationZ( BAR_ROTATION(p) ); m_sprActualBar[p][r].SetZoomX( 0 ); m_sprActualBar[p][r].ZoomToHeight( BAR_HEIGHT ); m_sprActualBar[p][r].BeginTweening( 1.0f + r*0.2f ); // sleep @@ -486,7 +486,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) for( l=0; lGetPathTo("Numbers","evaluation judge numbers") ); - m_textJudgeNumbers[l][p].TurnShadowOff(); + m_textJudgeNumbers[l][p].EnableShadow( false ); m_textJudgeNumbers[l][p].SetXY( JUDGE_X(m_ResultMode==RM_COURSE,p,l), JUDGE_Y(l) ); m_textJudgeNumbers[l][p].SetZoom( 1.0f ); m_textJudgeNumbers[l][p].SetDiffuse( PlayerToColor(p) ); @@ -577,12 +577,12 @@ void ScreenEvaluation::TweenOnScreen() fOriginalY = m_BannerWithFrame[i].GetY(); m_BannerWithFrame[i].SetY( fOriginalY + SCREEN_HEIGHT ); m_BannerWithFrame[i].BeginTweening( 0.0f ); - m_BannerWithFrame[i].BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_BEGIN ); + m_BannerWithFrame[i].BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_ACCELERATE ); m_BannerWithFrame[i].SetTweenY( fOriginalY ); } fOriginalY = m_textStage.GetY(); - m_textStage.BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_BEGIN ); + m_textStage.BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_ACCELERATE ); m_textStage.SetTweenY( fOriginalY ); for( p=0; pGetX(); apActorsInBonusOrStageInfo[i]->SetX( fOriginalX + SCREEN_WIDTH/2*(p==PLAYER_1 ? 1 : -1) ); apActorsInBonusOrStageInfo[i]->BeginTweening( 0.2f ); - apActorsInBonusOrStageInfo[i]->BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_BEGIN ); + apActorsInBonusOrStageInfo[i]->BeginTweening( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_ACCELERATE ); apActorsInBonusOrStageInfo[i]->SetTweenX( fOriginalX ); } diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 6980e2c5f0..8602a34c88 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -81,7 +81,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer() m_sprJoinMessage[p].SetState( p ); m_sprJoinMessage[p].SetXY( JOIN_MESSAGE_X(p), JOIN_MESSAGE_Y(p) ); if( BOUNCE_JOIN_MESSAGE ) - m_sprJoinMessage[p].SetEffectBouncing( RageVector3(0,10,0), 0.5f ); + m_sprJoinMessage[p].SetEffectBounce( 0.5f, RageVector3(0,10,0) ); this->AddChild( &m_sprJoinMessage[p] ); if( GAMESTATE->m_bSideIsJoined[p] ) @@ -275,9 +275,9 @@ void ScreenEz2SelectPlayer::TweenOffScreen() { float fOffScreenOffset = float( (p==PLAYER_1) ? -SCREEN_WIDTH : +SCREEN_WIDTH ); - m_sprJoinMessage[p].BeginTweening( 0.5f, Actor::TWEEN_BIAS_END ); + m_sprJoinMessage[p].BeginTweening( 0.5f, Actor::TWEEN_DECELERATE ); m_sprJoinMessage[p].SetTweenX( m_sprJoinMessage[p].GetX()+fOffScreenOffset ); - m_sprJoinFrame[p].BeginTweening( 0.5f, Actor::TWEEN_BIAS_END ); + m_sprJoinFrame[p].BeginTweening( 0.5f, Actor::TWEEN_DECELERATE ); m_sprJoinFrame[p].SetTweenX( m_sprJoinMessage[p].GetX()+fOffScreenOffset ); } } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 5a4d35cb92..ebc08361c4 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -265,7 +265,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) m_textStageNumber.LoadFromFont( THEME->GetPathTo("Fonts","gameplay stage") ); - m_textStageNumber.TurnShadowOff(); + m_textStageNumber.EnableShadow( false ); m_textStageNumber.SetXY( STAGE_X, STAGE_Y(bExtra) ); m_textStageNumber.SetText( GAMESTATE->GetStageText() ); m_textStageNumber.SetDiffuse( GAMESTATE->GetStageColor() ); @@ -273,7 +273,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) for( p=0; pGetPathTo("Fonts","Header2") ); - m_textCourseSongNumber[p].TurnShadowOff(); + m_textCourseSongNumber[p].EnableShadow( false ); m_textCourseSongNumber[p].SetXY( SONG_NUMBER_X(p), SONG_NUMBER_Y(p,bExtra) ); m_textCourseSongNumber[p].SetText( "" ); m_textCourseSongNumber[p].SetDiffuse( GAMESTATE->GetStageColor() ); // light blue @@ -312,7 +312,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) this->AddChild( &m_sprScoreFrame ); m_StageName.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel text banner") ); - m_StageName.TurnShadowOff(); + m_StageName.EnableShadow( false ); m_StageName.SetXY( STAGENAME_X, STAGENAME_Y ); m_StageName.SetZoom( STAGENAME_ZOOM ); this->AddChild( &m_StageName ); @@ -351,7 +351,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) this->AddChild( m_pScoreDisplay[p] ); m_textPlayerOptions[p].LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textPlayerOptions[p].TurnShadowOff(); + m_textPlayerOptions[p].EnableShadow( false ); m_textPlayerOptions[p].SetXY( PLAYER_OPTIONS_X(p), PLAYER_OPTIONS_Y(p,bExtra) ); m_textPlayerOptions[p].SetZoom( 0.5f ); m_textPlayerOptions[p].SetDiffuse( RageColor(1,1,1,1) ); @@ -359,7 +359,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) } m_textSongOptions.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textSongOptions.TurnShadowOff(); + m_textSongOptions.EnableShadow( false ); m_textSongOptions.SetXY( SONG_OPTIONS_X, SONG_OPTIONS_Y(bExtra) ); m_textSongOptions.SetZoom( 0.5f ); m_textSongOptions.SetDiffuse( RageColor(1,1,1,1) ); @@ -430,7 +430,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) this->AddChild( &m_Fade ); m_textSurviveTime.LoadFromFont( THEME->GetPathTo("Fonts","survive time") ); - m_textSurviveTime.TurnShadowOff(); + m_textSurviveTime.EnableShadow( false ); m_textSurviveTime.SetXY( SURVIVE_TIME_X, SURVIVE_TIME_Y ); m_textSurviveTime.SetText( "" ); m_textSurviveTime.SetDiffuse( RageColor(1,1,1,0) ); @@ -1357,10 +1357,10 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) m_sprToasty.SetDiffuse( RageColor(1,1,1,1) ); m_sprToasty.SetX( SCREEN_RIGHT+m_sprToasty.GetUnzoomedWidth()/2 ); m_sprToasty.SetY( SCREEN_BOTTOM-m_sprToasty.GetUnzoomedHeight()/2 ); - m_sprToasty.BeginTweening( 0.2f, Actor::TWEEN_BIAS_BEGIN ); // slide on + m_sprToasty.BeginTweening( 0.2f, Actor::TWEEN_ACCELERATE ); // slide on m_sprToasty.SetTweenX( SCREEN_RIGHT-m_sprToasty.GetUnzoomedWidth()/2 ); m_sprToasty.BeginTweening( 0.6f ); // sleep - m_sprToasty.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END ); // slide off + m_sprToasty.BeginTweening( 0.3f, Actor::TWEEN_DECELERATE ); // slide off m_sprToasty.SetTweenX( SCREEN_RIGHT+m_sprToasty.GetUnzoomedWidth()/2 ); m_sprToasty.BeginTweening( 0.001f ); // fade out m_sprToasty.SetDiffuse( RageColor(1,1,1,0) ); @@ -1468,7 +1468,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) colorStage.a *= 0.7f; m_sprTryExtraStage.SetZoom( 4 ); - m_sprTryExtraStage.BeginBlurredTweening( 0.8f, TWEEN_BIAS_END ); + m_sprTryExtraStage.BeginBlurredTweening( 0.8f, TWEEN_DECELERATE ); m_sprTryExtraStage.SetTweenZoom( 0.4f ); // zoom out m_sprTryExtraStage.SetTweenDiffuse( colorStage ); // and fade in m_sprTryExtraStage.BeginTweening( 0.2f ); @@ -1549,7 +1549,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) m_Background.SetTweenDiffuse( RageColor(1,1,1,0) ); m_sprFailed.SetZoom( 4 ); - m_sprFailed.BeginBlurredTweening( 0.8f, TWEEN_BIAS_END ); + m_sprFailed.BeginBlurredTweening( 0.8f, TWEEN_DECELERATE ); m_sprFailed.SetTweenZoom( 0.5f ); // zoom out m_sprFailed.SetTweenDiffuse( RageColor(1,1,1,0.7f) ); // and fade in m_sprFailed.BeginTweening( 0.3f ); @@ -1671,5 +1671,5 @@ void ScreenGameplay::ShowOniGameOver( PlayerNumber pn ) m_sprOniGameOver[pn].SetDiffuse( RageColor(1,1,1,1) ); m_sprOniGameOver[pn].BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END ); m_sprOniGameOver[pn].SetTweenY( CENTER_Y ); - m_sprOniGameOver[pn].SetEffectBobbing( RageVector3(0,6,0), 4 ); + m_sprOniGameOver[pn].SetEffectBob( 4, RageVector3(0,6,0) ); } diff --git a/stepmania/src/ScreenInstructions.cpp b/stepmania/src/ScreenInstructions.cpp index d012d05910..a25178e34d 100644 --- a/stepmania/src/ScreenInstructions.cpp +++ b/stepmania/src/ScreenInstructions.cpp @@ -101,7 +101,7 @@ ScreenInstructions::ScreenInstructions() m_sprHowToPlay.SetX( SCREEN_LEFT-SCREEN_WIDTH ); m_sprHowToPlay.BeginTweening( 0.4f ); // sleep - m_sprHowToPlay.BeginTweening( 0.6f, Actor::TWEEN_BIAS_BEGIN ); + m_sprHowToPlay.BeginTweening( 0.6f, Actor::TWEEN_ACCELERATE ); m_sprHowToPlay.SetTweenX( CENTER_X ); SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","instructions music") ); @@ -176,6 +176,6 @@ void ScreenInstructions::MenuStart( PlayerNumber pn ) m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen ); m_sprHowToPlay.StopTweening(); - m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END ); + m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_DECELERATE ); m_sprHowToPlay.SetTweenX( SCREEN_RIGHT+m_sprHowToPlay.GetUnzoomedWidth()/2 ); } diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index c62d8755cd..74b07ddb9b 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -81,7 +81,7 @@ ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sPagePath, CStrin this->AddChild( &m_Wipe ); m_framePage.SetX( SCREEN_LEFT-SCREEN_WIDTH ); - m_framePage.BeginTweening( 0.3f, Actor::TWEEN_BIAS_BEGIN ); + m_framePage.BeginTweening( 0.3f, Actor::TWEEN_DECELERATE ); m_framePage.SetTweenX( 0 ); memset(&m_OptionDim, 0, sizeof(m_OptionDim)); } @@ -194,7 +194,7 @@ void ScreenOptions::InitOptionsText() title.SetZoom( LABELS_ZOOM ); title.SetHorizAlign( (Actor::HorizAlign)LABELS_H_ALIGN ); title.SetVertAlign( Actor::align_middle ); - title.TurnShadowOff(); + title.EnableShadow( false ); Sprite &arrow = m_sprLineArrows[i]; @@ -428,7 +428,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) m_SoundStart.Play(); m_Wipe.CloseWipingRight( SM_GoToNextScreen ); - m_framePage.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END ); + m_framePage.BeginTweening( 0.3f, Actor::TWEEN_DECELERATE ); m_framePage.SetTweenX( SCREEN_RIGHT ); break; } diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index 27b3ec047e..7ddfb71067 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -48,12 +48,12 @@ const ScreenMessage SM_HidePage = (ScreenMessage)(SM_User+68); ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking") { m_textCategory.LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); - m_textCategory.TurnShadowOff(); + m_textCategory.EnableShadow( false ); m_textCategory.SetXY( CATEGORY_X, CATEGORY_Y ); this->AddChild( &m_textCategory ); m_textType.LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); - m_textType.TurnShadowOff(); + m_textType.EnableShadow( false ); m_textType.SetXY( TYPE_X, TYPE_Y ); this->AddChild( &m_textType ); @@ -67,28 +67,28 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking") this->AddChild( &m_sprBullets[i] ); m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); - m_textNames[i].TurnShadowOff(); + m_textNames[i].EnableShadow( false ); m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i ); m_textNames[i].SetZoom( TEXT_ZOOM ); m_textNames[i].SetHorizAlign( Actor::align_left ); this->AddChild( &m_textNames[i] ); m_textScores[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); - m_textScores[i].TurnShadowOff(); + m_textScores[i].EnableShadow( false ); m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i ); m_textScores[i].SetZoom( TEXT_ZOOM ); m_textScores[i].SetHorizAlign( Actor::align_right ); this->AddChild( &m_textScores[i] ); m_textPoints[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); - m_textPoints[i].TurnShadowOff(); + m_textPoints[i].EnableShadow( false ); m_textPoints[i].SetXY( POINTS_START_X+LINE_SPACING_X*i, POINTS_START_Y+LINE_SPACING_Y*i ); m_textPoints[i].SetZoom( TEXT_ZOOM ); m_textPoints[i].SetHorizAlign( Actor::align_right ); this->AddChild( &m_textPoints[i] ); m_textTime[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") ); - m_textTime[i].TurnShadowOff(); + m_textTime[i].EnableShadow( false ); m_textTime[i].SetXY( TIME_START_X+LINE_SPACING_X*i, TIME_START_Y+LINE_SPACING_Y*i ); m_textTime[i].SetZoom( TEXT_ZOOM ); m_textTime[i].SetHorizAlign( Actor::align_right ); @@ -218,8 +218,8 @@ void ScreenRanking::SetPage( PageToShow pts ) if( bRecentHighScore ) { - m_textNames[l].SetEffectGlowBlinking(0.1f); - m_textScores[l].SetEffectGlowBlinking(0.1f); + m_textNames[l].SetEffectGlowBlink(0.1f); + m_textScores[l].SetEffectGlowBlink(0.1f); } else { @@ -254,8 +254,8 @@ void ScreenRanking::SetPage( PageToShow pts ) pts.nt == GAMESTATE->m_RankingNotesType && GAMESTATE->m_iRankingIndex[p] == l ) { - m_textNames[l].SetEffectGlowBlinking(0.1f); - m_textScores[l].SetEffectGlowBlinking(0.1f); + m_textNames[l].SetEffectGlowBlink(0.1f); + m_textScores[l].SetEffectGlowBlink(0.1f); } else { diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 785902559c..3fbe334970 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -87,12 +87,12 @@ ScreenSelectCourse::ScreenSelectCourse() m_textNumSongs.LoadFromFont( THEME->GetPathTo("Fonts","select course num songs") ); m_textNumSongs.SetXY( STAGES_X, STAGES_Y ); - m_textNumSongs.TurnShadowOff(); + m_textNumSongs.EnableShadow( false ); this->AddChild( &m_textNumSongs ); m_textTime.LoadFromFont( THEME->GetPathTo("Fonts","select course total time") ); m_textTime.SetXY( TIME_X, TIME_Y ); - m_textTime.TurnShadowOff(); + m_textTime.EnableShadow( false ); this->AddChild( &m_textTime ); m_CourseContentsFrame.SetXY( CONTENTS_X, CONTENTS_Y ); diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 1928e5ce68..ec3168d0b5 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -20,22 +20,11 @@ #include "GameState.h" #include "RageSoundManager.h" #include "ThemeManager.h" +#include "ModeSelector.h" -const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete - -#define MORE_X( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("MorePage%dX",page+1)) -#define MORE_Y( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("MorePage%dY",page+1)) -#define EXPLANATION_X( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dX",page+1)) -#define EXPLANATION_Y( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dY",page+1)) -#define CHOICES_ON_PAGE( page ) THEME->GetMetric ("ScreenSelectDifficulty",ssprintf("ChoicesOnPage%d",page+1)) -#define CHOICE_X( page, choice ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("Page%dChoice%dX",page+1,choice+1)) -#define CHOICE_Y( page, choice ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("Page%dChoice%dY",page+1,choice+1)) -#define CURSOR_OFFSET_X( p ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dX",p+1)) -#define CURSOR_OFFSET_Y( i ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dY",i+1)) -#define CURSOR_SHADOW_LENGTH_X THEME->GetMetricF("ScreenSelectDifficulty","CursorShadowLengthX") -#define CURSOR_SHADOW_LENGTH_Y THEME->GetMetricF("ScreenSelectDifficulty","CursorShadowLengthY") -#define INITIAL_CHOICE THEME->GetMetricI("ScreenSelectDifficulty","InitialChoice") +#define CHOICES THEME->GetMetric ("ScreenSelectDifficulty","Choices") +#define SELECTOR THEME->GetMetric ("ScreenSelectDifficulty","Selector") #define HELP_TEXT THEME->GetMetric("ScreenSelectDifficulty","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectDifficulty","TimerSeconds") #define NEXT_SCREEN_ARCADE THEME->GetMetric ("ScreenSelectDifficulty","NextScreenArcade") @@ -43,10 +32,6 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to #define NEXT_SCREEN_BATTLE THEME->GetMetric ("ScreenSelectDifficulty","NextScreenBattle") -float CURSOR_X( int page, int choice, int p ) { return CHOICE_X(page,choice) + CURSOR_OFFSET_X(p); } -float CURSOR_Y( int page, int choice, int p ) { return CHOICE_Y(page,choice) + CURSOR_OFFSET_Y(p); } - - const ScreenMessage SM_StartTweeningOffScreen = ScreenMessage(SM_User + 3); const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 4); @@ -58,6 +43,53 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() // Reset the current PlayMode GAMESTATE->m_PlayMode = PLAY_MODE_INVALID; + + + vector aModeChoices; + + CStringArray asBits; + split( CHOICES, ",", asBits ); + + unsigned choice; + + for( choice=0; choicem_CurGame, + PLAY_MODE_ARCADE, + GAMESTATE->m_CurStyle, + dc, + "", + GAMESTATE->GetNumSidesJoined() }; + strcpy( mc.name, DifficultyToString(dc) ); + aModeChoices.push_back( mc ); + } + else if( pm!=PLAY_MODE_INVALID ) // valid play mode + { + ModeChoice mc = { + GAMESTATE->m_CurGame, + pm, + GAMESTATE->m_CurStyle, + DIFFICULTY_MEDIUM, + "", + GAMESTATE->GetNumSidesJoined() }; + strcpy( mc.name, PlayModeToString(pm) ); + aModeChoices.push_back( mc ); + } + else + RageException::Throw( "Invalid Choice%d value '%s'.", choice+1, asBits[choice].GetString() ); + } + + + m_pSelector = ModeSelector::Create( SELECTOR ); + m_pSelector->Init( aModeChoices, "ScreenSelectDifficulty", "select difficulty" ); + this->AddChild( m_pSelector ); + m_Menu.Load( THEME->GetPathTo("BGAnimations","select difficulty"), THEME->GetPathTo("Graphics","select difficulty top edge"), @@ -65,128 +97,13 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() ); this->AddChild( &m_Menu ); - // parse ModeChoices - for( int page=0; page MAX_CHOICES_PER_PAGE ) - RageException::Throw( "Choices exceed max number of choices per page." ); - - unsigned choice; - - for( choice=0; choicem_CurGame, - PLAY_MODE_ARCADE, - GAMESTATE->m_CurStyle, - dc, - "", - GAMESTATE->GetNumSidesJoined() }; - strcpy( mc.name, DifficultyToString(dc) ); - m_ModeChoices[page].push_back( mc ); - } - else if( pm!=PLAY_MODE_INVALID ) // valid play mode - { - ModeChoice mc = { - GAMESTATE->m_CurGame, - pm, - GAMESTATE->m_CurStyle, - DIFFICULTY_MEDIUM, - "", - GAMESTATE->GetNumSidesJoined() }; - strcpy( mc.name, PlayModeToString(pm) ); - m_ModeChoices[page].push_back( mc ); - } - else - RageException::Throw( "Invalid Page%dChoice%d value '%s'.", page+1, choice+1, asBits[choice].GetString() ); - } - - - for( choice=0; choiceGetPathTo("Graphics",sPictureFile) ); - m_sprPicture[page][choice].SetXY( fChoiceX, fChoiceY ); - m_sprPicture[page][choice].SetVertAlign( align_top ); - m_framePages.AddChild( &m_sprPicture[page][choice] ); - - m_sprHeader[page][choice].Load( THEME->GetPathTo("Graphics",sHeaderFile) ); - m_sprHeader[page][choice].SetXY( fChoiceX, fChoiceY ); - m_sprHeader[page][choice].SetVertAlign( align_bottom ); - m_framePages.AddChild( &m_sprHeader[page][choice] ); - } - - - m_sprMoreArrows[page].Load( THEME->GetPathTo("Graphics", ssprintf("select difficulty more page%d",page+1) ) ); - m_sprMoreArrows[page].SetXY( MORE_X(page), MORE_Y(page) ); - m_framePages.AddChild( &m_sprMoreArrows[page] ); - - m_sprExplanation[page].Load( THEME->GetPathTo("Graphics", "select difficulty explanation") ); - m_sprExplanation[page].SetXY( EXPLANATION_X(page), EXPLANATION_Y(page) ); - m_sprExplanation[page].StopAnimating(); - m_sprExplanation[page].SetState( page ); - m_framePages.AddChild( &m_sprExplanation[page] ); - } - - - m_CurrentPage = PAGE_1; - - for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) - continue; - - m_sprJoinMessagehadow[p].Load( THEME->GetPathTo("Graphics", "select difficulty cursor 2x1") ); - m_sprJoinMessagehadow[p].StopAnimating(); - m_sprJoinMessagehadow[p].SetState( p ); - m_sprJoinMessagehadow[p].TurnShadowOff(); - m_sprJoinMessagehadow[p].SetDiffuse( RageColor(0,0,0,0.6f) ); - m_framePages.AddChild( &m_sprJoinMessagehadow[p] ); - - m_sprCursor[p].Load( THEME->GetPathTo("Graphics", "select difficulty cursor 2x1") ); - m_sprCursor[p].StopAnimating(); - m_sprCursor[p].SetState( p ); - m_sprCursor[p].TurnShadowOff(); - m_sprCursor[p].SetEffectGlowShift(); - m_framePages.AddChild( &m_sprCursor[p] ); - - m_sprOK[p].Load( THEME->GetPathTo("Graphics", "select difficulty ok 2x1") ); - m_sprOK[p].SetState( p ); - m_sprOK[p].StopAnimating(); - m_sprOK[p].SetDiffuse( RageColor(1,1,1,0) ); - m_framePages.AddChild( &m_sprOK[p] ); - } - - this->AddChild( &m_framePages ); - - m_soundChange.Load( THEME->GetPathTo("Sounds", "select difficulty change") ); - m_soundSelect.Load( THEME->GetPathTo("Sounds", "menu start") ); - m_soundDifficult.Load( ANNOUNCER->GetPathTo("select difficulty challenge") ); SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty intro") ); m_Menu.TweenOnScreenFromMenu( SM_None ); - TweenOnScreen(); + m_pSelector->TweenOnScreen(); SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","select difficulty music") ); - - m_fLockInputTime = LOCK_INPUT_TIME; } @@ -204,16 +121,12 @@ void ScreenSelectDifficulty::Input( const DeviceInput& DeviceI, const InputEvent if( m_Menu.IsClosing() ) return; - if( m_fLockInputTime > 0 ) - return; - Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler } void ScreenSelectDifficulty::Update( float fDeltaTime ) { Screen::Update( fDeltaTime ); - m_fLockInputTime = max( m_fLockInputTime-fDeltaTime, 0 ); } void ScreenSelectDifficulty::DrawPrimitives() @@ -234,19 +147,26 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) if( GAMESTATE->IsPlayerEnabled(p) ) MenuStart( (PlayerNumber)p ); break; + case SM_BeginFadingOut: // sent by our ModeSelector + { + ModeChoice mc; + for( int p=0; pIsPlayerEnabled(p) ) + { + m_pSelector->GetSelectedModeChoice( (PlayerNumber)p, &mc ); + GAMESTATE->ApplyModeChoice( &mc, (PlayerNumber)p ); + } + + m_Menu.StopTimer(); + m_pSelector->TweenOffScreen(); + + m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen ); + } + break; case SM_GoToPrevScreen: SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); break; case SM_GoToNextScreen: - for( p=0; pIsPlayerEnabled(p) ) - continue; // skip - const ModeChoice& mc = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]]; - GAMESTATE->m_PlayMode = mc.pm; - GAMESTATE->m_PreferredDifficulty[p] = mc.dc; - } - switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_ARCADE: SCREENMAN->SetNewScreen( NEXT_SCREEN_ARCADE ); break; @@ -258,7 +178,7 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) } break; case SM_StartTweeningOffScreen: - TweenOffScreen(); + m_pSelector->TweenOffScreen(); this->SendScreenMessage( SM_StartFadingOut, 0.8f ); break; case SM_StartFadingOut: @@ -269,240 +189,32 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn ) { - if( m_bChosen[pn] ) - return; - if( m_iChoiceOnPage[pn] == 0 ) // can't go left any more - { - if( m_CurrentPage > 0 ) - ChangePage( (Page)(m_CurrentPage-1) ); - } - else - ChangeWithinPage( pn, m_iChoiceOnPage[pn]-1, false ); + m_pSelector->MenuLeft( pn ); } - void ScreenSelectDifficulty::MenuRight( PlayerNumber pn ) { - if( m_bChosen[pn] ) - return; - if( m_iChoiceOnPage[pn] == (int)m_ModeChoices[m_CurrentPage].size()-1 ) // can't go left any more - { - if( m_CurrentPage < NUM_PAGES-1 ) - ChangePage( (Page)(m_CurrentPage+1) ); - } - else - ChangeWithinPage( pn, m_iChoiceOnPage[pn]+1, false ); + m_pSelector->MenuRight( pn ); } -void ScreenSelectDifficulty::ChangePage( Page newPage ) +void ScreenSelectDifficulty::MenuUp( PlayerNumber pn ) { - int p; - - // If anyone has already chosen, don't allow changing of pages - for( p=0; pIsPlayerEnabled(p) && m_bChosen[p] ) - return; - - bool bPageIncreasing = newPage > m_CurrentPage; - m_CurrentPage = newPage; - - if( newPage == PAGE_2 ) - { - m_soundDifficult.Stop(); - m_soundDifficult.PlayRandom(); - } - - // change both players - int iNewChoice = bPageIncreasing ? 0 : m_ModeChoices[m_CurrentPage].size()-1; - for( p=0; pMenuUp( pn ); } -void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages ) +void ScreenSelectDifficulty::MenuDown( PlayerNumber pn ) { - for( int p=0; pIsPlayerEnabled(p) ) - continue; // skip - - if( p!=pn && m_CurrentPage==PAGE_1 ) - continue; // skip - - m_iChoiceOnPage[p] = iNewChoice; - - float fCursorX = CURSOR_X(m_CurrentPage,m_iChoiceOnPage[p],p); - float fCursorY = CURSOR_Y(m_CurrentPage,m_iChoiceOnPage[p],p); - - m_sprCursor[p].StopTweening(); - m_sprCursor[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN ); - m_sprCursor[p].SetTweenX( fCursorX - CURSOR_SHADOW_LENGTH_X ); - m_sprCursor[p].SetTweenY( fCursorY - CURSOR_SHADOW_LENGTH_Y ); - - m_sprJoinMessagehadow[p].StopTweening(); - m_sprJoinMessagehadow[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN ); - m_sprJoinMessagehadow[p].SetTweenX( fCursorX ); - m_sprJoinMessagehadow[p].SetTweenY( fCursorY ); - } - - m_soundChange.Play(); + m_pSelector->MenuDown( pn ); } void ScreenSelectDifficulty::MenuStart( PlayerNumber pn ) { - if( m_bChosen[pn] == true ) - return; - m_bChosen[pn] = true; - - for( unsigned page=0; pagePlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("select difficulty comment %s",mc.name)) ); - - /* XXX: This will play the same announcer twice at the same time; that'll probably - * result in an echo effect. */ - if( m_CurrentPage == PAGE_2 ) - { - // choose this for all the other players too - for( int p=0; pIsPlayerEnabled((PlayerNumber)p) && m_bChosen[p] == false ) - return; - } - m_Menu.StopTimer(); - this->SendScreenMessage( SM_StartTweeningOffScreen, 0.7f ); + m_pSelector->MenuStart( pn ); } void ScreenSelectDifficulty::MenuBack( PlayerNumber pn ) { + SOUNDMAN->StopMusic(); + m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true ); } - -void ScreenSelectDifficulty::TweenOffScreen() -{ - unsigned p; - - for( p=0; p < m_SubActors.size(); p++ ) - m_SubActors[p]->StopTweening(); - - - const int page = m_CurrentPage; - - m_sprExplanation[page].SetXY( EXPLANATION_X(page), EXPLANATION_Y(page) ); - m_sprExplanation[page].BeginTweening( 0.5, Actor::TWEEN_BOUNCE_BEGIN ); - m_sprExplanation[page].SetTweenXY( EXPLANATION_X(page)+700, EXPLANATION_Y(page) ); - - m_sprMoreArrows[page].BeginTweening( 0.5 ); - m_sprMoreArrows[page].SetTweenDiffuse( RageColor(1,1,1,0) ); - - - for( p=0; pIsPlayerEnabled((PlayerNumber)p) ) - continue; - - m_sprCursor[p].BeginTweening( 0.3f ); - m_sprCursor[p].SetTweenZoom( 0 ); - - m_sprOK[p].BeginTweening( 0.3f ); - m_sprOK[p].SetTweenZoom( 0 ); - - m_sprJoinMessagehadow[p].BeginTweening( 0.3f ); - m_sprJoinMessagehadow[p].SetTweenDiffuse( RageColor(0,0,0,0) ); - } - - { - for( unsigned c=0; cIsPlayerEnabled((PlayerNumber)p) ) - continue; - - float fCursorX = CURSOR_X(m_CurrentPage,m_iChoiceOnPage[p],p); - float fCursorY = CURSOR_Y(m_CurrentPage,m_iChoiceOnPage[p],p); - - - m_sprCursor[p].SetXY( fCursorX, fCursorY ); - m_sprCursor[p].FadeOn( 0, "SpinZ Zoom Fade", 0.3f ); - - m_sprJoinMessagehadow[p].SetXY( fCursorX, fCursorY ); - RageColor colorOriginal = m_sprJoinMessagehadow[p].GetDiffuse(); - m_sprJoinMessagehadow[p].SetDiffuse( RageColor(0,0,0,0) ); - m_sprJoinMessagehadow[p].BeginTweening( 0.3f ); - m_sprJoinMessagehadow[p].SetTweenDiffuse( colorOriginal ); - } - - { - const int p = m_CurrentPage; - for( unsigned c=0; c m_ModeChoices[NUM_PAGES]; - - Page m_CurrentPage; - int m_iChoiceOnPage[NUM_PLAYERS]; - bool m_bChosen[NUM_PLAYERS]; - - float m_fLockInputTime; + ModeSelector* m_pSelector; }; diff --git a/stepmania/src/ScreenSelectDifficultyEX.cpp b/stepmania/src/ScreenSelectDifficultyEX.cpp index 3e987330cd..749a66f1b3 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.cpp +++ b/stepmania/src/ScreenSelectDifficultyEX.cpp @@ -105,7 +105,7 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() m_sprCursor[p].SetXY( -1600, -1600 ); m_sprCursor[p].StopAnimating(); m_sprCursor[p].SetState( p ); - m_sprCursor[p].TurnShadowOff(); + m_sprCursor[p].EnableShadow( false ); m_framePages.AddChild( &m_sprCursor[p] ); m_sprOK[p].Load( THEME->GetPathTo("Graphics", "select difficulty ex ok 2x1") ); diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 481326ed47..5f9a518223 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -147,7 +147,7 @@ ScreenSelectGroup::ScreenSelectGroup() m_textNumber.LoadFromFont( THEME->GetPathTo("Fonts","select group num songs") ); m_textNumber.SetXY( NUMBER_X, NUMBER_Y ); m_textNumber.SetHorizAlign( Actor::align_right ); - m_textNumber.TurnShadowOff(); + m_textNumber.EnableShadow( false ); this->AddChild( &m_textNumber ); m_sprContents.Load( THEME->GetPathTo("Graphics","select group contents header") ); @@ -317,7 +317,7 @@ void ScreenSelectGroup::TweenOffScreen() } m_sprContents.BeginTweening( 0.7f ); - m_sprContents.BeginTweening( 0.5f, TWEEN_BIAS_END ); + m_sprContents.BeginTweening( 0.5f, TWEEN_DECELERATE ); m_sprContents.SetTweenY( CONTENTS_Y+400 ); m_MusicList.TweenOffScreen(); @@ -341,8 +341,8 @@ void ScreenSelectGroup::TweenOnScreen() } m_sprContents.SetY( CONTENTS_Y+400 ); - m_sprContents.BeginTweening( 0.5f, TWEEN_BIAS_END ); // sleep - m_sprContents.BeginTweening( 0.5f, TWEEN_BIAS_END ); + m_sprContents.BeginTweening( 0.5f, TWEEN_DECELERATE ); // sleep + m_sprContents.BeginTweening( 0.5f, TWEEN_DECELERATE ); m_sprContents.SetTweenY( CONTENTS_Y ); m_MusicList.TweenOnScreen(); diff --git a/stepmania/src/ScreenSelectMode.cpp b/stepmania/src/ScreenSelectMode.cpp index c7b5284d82..ca8551b749 100644 --- a/stepmania/src/ScreenSelectMode.cpp +++ b/stepmania/src/ScreenSelectMode.cpp @@ -96,7 +96,7 @@ ScreenSelectMode::ScreenSelectMode() m_sprJoinMessage[p].SetState( p ); m_sprJoinMessage[p].SetXY( JOIN_MESSAGE_X(p), JOIN_MESSAGE_Y(p) ); if( BOUNCE_JOIN_MESSAGE ) - m_sprJoinMessage[p].SetEffectBouncing( RageVector3(0,10,0), 0.5f ); + m_sprJoinMessage[p].SetEffectBounce( 0.5f, RageVector3(0,10,0) ); this->AddChild( &m_sprJoinMessage[p] ); if( GAMESTATE->m_bSideIsJoined[p] ) @@ -418,9 +418,9 @@ void ScreenSelectMode::TweenOffScreen() { float fOffScreenOffset = float( (p==PLAYER_1) ? -SCREEN_WIDTH : +SCREEN_WIDTH ); - m_sprJoinMessage[p].BeginTweening( 0.5f, Actor::TWEEN_BIAS_END ); + m_sprJoinMessage[p].BeginTweening( 0.5f, Actor::TWEEN_DECELERATE ); m_sprJoinMessage[p].SetTweenX( m_sprJoinMessage[p].GetX()+fOffScreenOffset ); - m_sprJoinFrame[p].BeginTweening( 0.5f, Actor::TWEEN_BIAS_END ); + m_sprJoinFrame[p].BeginTweening( 0.5f, Actor::TWEEN_DECELERATE ); m_sprJoinFrame[p].SetTweenX( m_sprJoinMessage[p].GetX()+fOffScreenOffset ); } } diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index a696bee483..5b9bef27ca 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -120,7 +120,7 @@ ScreenSelectMusic::ScreenSelectMusic() this->AddChild( &m_StageDisplay ); m_sprCDTitle.Load( THEME->GetPathTo("Graphics","fallback cd title") ); - m_sprCDTitle.TurnShadowOff(); + m_sprCDTitle.EnableShadow( false ); m_sprCDTitle.SetXY( CD_TITLE_X, CD_TITLE_Y ); this->AddChild( &m_sprCDTitle ); @@ -208,7 +208,7 @@ ScreenSelectMusic::ScreenSelectMusic() m_sprMarathonBalloon.SetXY( BALLOON_X, BALLOON_Y ); m_sprMarathonBalloon.SetZoomY( 0 ); m_sprMarathonBalloon.SetDiffuse( RageColor(1,1,1,1) ); - m_sprMarathonBalloon.SetEffectBobbing( RageVector3(0,10,0), 2 ); + m_sprMarathonBalloon.SetEffectBob( 2, RageVector3(0,10,0) ); this->AddChild( &m_sprMarathonBalloon ); m_sprLongBalloon.Load( THEME->GetPathTo("Graphics","select music long balloon") ); @@ -216,7 +216,7 @@ ScreenSelectMusic::ScreenSelectMusic() m_sprLongBalloon.SetXY( BALLOON_X, BALLOON_Y ); m_sprLongBalloon.SetZoomY( 0 ); m_sprLongBalloon.SetDiffuse( RageColor(1,1,1,1) ); - m_sprLongBalloon.SetEffectBobbing( RageVector3(0,10,0), 2 ); + m_sprLongBalloon.SetEffectBob( 2, RageVector3(0,10,0) ); this->AddChild( &m_sprLongBalloon ); m_sprOptionsMessage.Load( THEME->GetPathTo("Graphics","select music options message") ); @@ -346,7 +346,7 @@ void ScreenSelectMusic::TweenOffScreen() } for( unsigned i=0; iBeginTweening( TWEEN_TIME, TWEEN_BIAS_END ); + apActorsInScore[i]->BeginTweening( TWEEN_TIME, TWEEN_DECELERATE ); apActorsInScore[i]->SetTweenX( SCORE_CONNECTED_TO_MUSIC_WHEEL ? apActorsInScore[i]->GetX()+400 : apActorsInScore[i]->GetX()-400 ); } @@ -378,19 +378,19 @@ void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort() { /* Grab the tween destination. (If we're tweening, this is where * it'll end up; otherwise it's the static position.) */ - Actor::TweenState original = apActorsInScore[i]->GetDestTweenState(); + Actor::TweenState original = apActorsInScore[i]->DestTweenState(); apActorsInScore[i]->StopTweening(); float fOriginalX = apActorsInScore[i]->GetX(); - apActorsInScore[i]->BeginTweening( factor*TWEEN_TIME, TWEEN_BIAS_END ); // tween off screen + apActorsInScore[i]->BeginTweening( factor*TWEEN_TIME, TWEEN_DECELERATE ); // tween off screen apActorsInScore[i]->SetTweenX( fOriginalX+400 ); apActorsInScore[i]->BeginTweening( factor*0.5f ); // sleep /* Go back to where we were (or to where we were going.) */ - apActorsInScore[i]->BeginTweening( factor*1, TWEEN_BIAS_BEGIN ); // tween back on screen - apActorsInScore[i]->SetTweenState(original); + apActorsInScore[i]->BeginTweening( factor*1, TWEEN_ACCELERATE ); // tween back on screen + apActorsInScore[i]->SetLatestTween(original); } } diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 033b41cbba..753ab7f075 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------- Class: ScreenSelectStyle - Desc: Testing the Screen class. + Desc: See Header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford @@ -23,100 +23,58 @@ #include "GameState.h" #include "GameConstantsAndTypes.h" #include "ThemeManager.h" +#include "ModeSelector.h" -#define JOINT_PREMIUM_BANNER_X THEME->GetMetricF("ScreenSelectStyle","JointPremiumBannerX") -#define JOINT_PREMIUM_BANNER_Y THEME->GetMetricF("ScreenSelectStyle","JointPremiumBannerY") -#define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX") -#define ICONS_SPACING_X THEME->GetMetricF("ScreenSelectStyle","IconsSpacingX") -#define ICONS_START_Y THEME->GetMetricF("ScreenSelectStyle","IconsStartY") -#define ICONS_SPACING_Y THEME->GetMetricF("ScreenSelectStyle","IconsSpacingY") -#define EXPLANATION_X THEME->GetMetricF("ScreenSelectStyle","ExplanationX") -#define EXPLANATION_Y THEME->GetMetricF("ScreenSelectStyle","ExplanationY") -#define INFO_X THEME->GetMetricF("ScreenSelectStyle","InfoX") -#define INFO_Y THEME->GetMetricF("ScreenSelectStyle","InfoY") -#define PREVIEW_X THEME->GetMetricF("ScreenSelectStyle","PreviewX") -#define PREVIEW_Y THEME->GetMetricF("ScreenSelectStyle","PreviewY") -#define HELP_TEXT THEME->GetMetric("ScreenSelectStyle","HelpText") +#define SELECTOR THEME->GetMetric ("ScreenSelectStyle","Selector") +#define HELP_TEXT THEME->GetMetric ("ScreenSelectStyle","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle","TimerSeconds") -#define NEXT_SCREEN THEME->GetMetric("ScreenSelectStyle","NextScreen") -/* I couldn't find a cleaner way to add this so that SM can show DDREX style, - if configured to, in place of the normal style select difficulty screen.. - I know the screen after this one is supposed to be dynamic to whatever - is in the metrics file.. But logically, shouldn't select difficulty always - come after select style? -- Miryokuteki -*/ +#define NEXT_SCREEN THEME->GetMetric ("ScreenSelectStyle","NextScreen") ScreenSelectStyle::ScreenSelectStyle() { LOG->Trace( "ScreenSelectStyle::ScreenSelectStyle()" ); - // Reset the current style and game - GAMESTATE->m_CurStyle = STYLE_INVALID; + GAMESTATE->m_bPlayersCanJoin = true; - GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles ); - ASSERT( !m_aPossibleStyles.empty() ); // every game should have at least one Style, or else why have the Game? :-) - m_iSelection = 0; - unsigned i; - for( i=0; i aModeChoices; + + vector