diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 584ef7a473..b606ee8046 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -27,6 +27,7 @@ #include "DancingCharacters.h" #include "arch/arch.h" #include "BeginnerHelper.h" +#include "StageStats.h" const float FADE_SECONDS = 1.0f; @@ -539,15 +540,18 @@ bool Background::IsDangerAllVisible() if( !PREFSMAN->m_bShowDanger ) return false; - if( GAMESTATE->AllAreInDangerOrWorse() ) - { - if( BLINK_DANGER_ALL ) - return (RageTimer::GetTimeSinceStart() - (int)RageTimer::GetTimeSinceStart()) < 0.5f; - else - return true; - } - else + /* Don't show it if everyone is already failing: it's already too late and it's + * annoying for it to show for the entire duration of a song. */ + if( g_CurStageStats.AllFailedEarlier() ) return false; + + if( !GAMESTATE->AllAreInDangerOrWorse() ) + return false; + + if( BLINK_DANGER_ALL ) + return (RageTimer::GetTimeSinceStart() - (int)RageTimer::GetTimeSinceStart()) < 0.5f; + else + return true; } bool Background::IsDangerPlayerVisible( PlayerNumber pn ) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index e70a035203..42c2256507 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -689,10 +689,55 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas } } +RageVector2 Bezier( RageVector2 p1, RageVector2 p2, RageVector2 p3, float t ) +{ + const float t2 = t * t; + const float tm1 = 1 - t; + const float tm12 = tm1 * tm1; + + return RageVector2( + p1.x*tm12 + 2*p2.x * tm1 * t + p3.x * t2, + p1.y*tm12 + 2*p2.y * tm1 * t + p3.y * t2 + ); +} + void MusicWheel::GetItemPosition( float fPosOffsetsFromMiddle, float& fX_out, float& fY_out, float& fZ_out, float& fRotationX_out ) { if( USE_3D ) { +/* bool neg = false; + if( fPosOffsetsFromMiddle < 0 ) + { + neg = true; + fPosOffsetsFromMiddle *= -1; + } + + float fv[6] = { + THEME->GetMetricF("MusicWheel","X1"), + THEME->GetMetricF("MusicWheel","Y1"), + THEME->GetMetricF("MusicWheel","X2"), + THEME->GetMetricF("MusicWheel","Y2"), + THEME->GetMetricF("MusicWheel","X3"), + THEME->GetMetricF("MusicWheel","Y3") }; + const float t = SCALE( fPosOffsetsFromMiddle, 0, NUM_WHEEL_ITEMS/2.0f, 0.0f, 1.0f ); + RageVector2 c1(fv[0], fv[1]); + RageVector2 c2(fv[2], fv[3]); + RageVector2 c3(fv[4], fv[5]); + const RageVector2 v = Bezier( c1, c2, c3, t ); + LOG->Trace("%f, Y %f X %f, %f x %f", +fPosOffsetsFromMiddle * (neg? -1.0f:+1.0f), + v.x, v.y, + v.x * (neg? -1.0f:+1.0f), v.y ); + + fY_out = v.x * (neg? -1.0f:+1.0f); + fZ_out = v.y; + + const float curve = CIRCLE_PERCENT*2*PI; + fRotationX_out = SCALE(fPosOffsetsFromMiddle,0,NUM_WHEEL_ITEMS/2.0f,0,+curve/2.f); + if( neg ) + fRotationX_out *= -1; +*/ + const float curve = CIRCLE_PERCENT*2*PI; fRotationX_out = SCALE(fPosOffsetsFromMiddle,-NUM_WHEEL_ITEMS/2.0f,+NUM_WHEEL_ITEMS/2.0f,-curve/2.f,+curve/2.f); fX_out = 0;