From df72631f6c1ce747e30484a385b130a13028d5a1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 8 Mar 2004 07:49:01 +0000 Subject: [PATCH] add "disqualify" graphic to options screen for options that make a song easier --- stepmania/Themes/default/metrics.ini | 8 ++++++ stepmania/src/PlayerOptions.cpp | 29 ++++++++++++++++++++++ stepmania/src/PlayerOptions.h | 8 ++++++ stepmania/src/ScreenOptions.cpp | 9 +++++++ stepmania/src/ScreenOptions.h | 3 +++ stepmania/src/ScreenPlayerOptions.cpp | 35 +++++++++++++++++++++++++++ stepmania/src/ScreenPlayerOptions.h | 2 ++ stepmania/src/Song.cpp | 10 ++++++++ stepmania/src/TimingData.cpp | 5 ++++ stepmania/src/TimingData.h | 1 + stepmania/src/song.h | 2 +- 11 files changed, 111 insertions(+), 1 deletion(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index a16513d2ed..29be5c7661 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -2847,6 +2847,14 @@ ExplanationTogetherOnCommand=wrapwidthpixels,1000;horizalign,left;cropright,1;li ExplanationZoom=0.5 ExplanationP1OnCommand=wrapwidthpixels,500;horizalign,left;cropright,1;linear,0.5;cropright,0 ExplanationP2OnCommand=wrapwidthpixels,500;horizalign,right;cropright,1;linear,0.5;cropright,0 +DisqualifyP1X=0 +DisqualifyP1Y=0 +DisqualifyP1OnCommand= +DisqualifyP1OffCommand= +DisqualifyP2X=0 +DisqualifyP2Y=0 +DisqualifyP2OnCommand= +DisqualifyP2OffCommand= PlayerNameP1X=0 PlayerNameP1Y=0 PlayerNameP1OnCommand=hidden,1 diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index 1acfbfb30d..22667ba168 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -18,6 +18,8 @@ #include "GameState.h" #include "NoteFieldPositioning.h" #include "NoteSkinManager.h" +#include "song.h" +#include "Course.h" #define ONE( arr ) { for( unsigned Z = 0; Z < ARRAYSIZE(arr); ++Z ) arr[Z]=1.0f; } @@ -537,3 +539,30 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const #undef COMPARE return true; } + +bool PlayerOptions::IsHandicapForSong( Song* pSong ) +{ + if( m_bTimeSpacing && pSong->HasSignificantBpmChangesOrStops() ) + return true; + + if( m_bTransforms[TRANSFORM_NOHOLDS] ) return true; + if( m_bTransforms[TRANSFORM_NOMINES] ) return true; + if( m_bTransforms[TRANSFORM_NOJUMPS] ) return true; + if( m_bTransforms[TRANSFORM_NOHANDS] ) return true; + if( m_bTransforms[TRANSFORM_NOQUADS] ) return true; + if( m_bTransforms[TRANSFORM_PLANTED] ) return true; + if( m_bTransforms[TRANSFORM_TWISTER] ) return true; + + return false; +} + +bool PlayerOptions::IsHandicapForCourse( Course* pCourse ) +{ + for( int i=0; im_entries.size(); i++ ) + { + const CourseEntry& ce = pCourse->m_entries[i]; + if( IsHandicapForSong(ce.pSong) ) + return true; + } + return false; +} diff --git a/stepmania/src/PlayerOptions.h b/stepmania/src/PlayerOptions.h index da5b461f54..b589cf1f81 100644 --- a/stepmania/src/PlayerOptions.h +++ b/stepmania/src/PlayerOptions.h @@ -11,6 +11,9 @@ ----------------------------------------------------------------------------- */ +class Song; +class Course; + struct PlayerOptions { PlayerOptions() { Init(); }; @@ -134,6 +137,11 @@ struct PlayerOptions void SetOneAppearance( Appearance a ); void SetOneScroll( Scroll s ); void ToggleOneTurn( Turn t ); + + + // return true if any mods being used will make the song(s) easier + bool IsHandicapForSong( Song* pSong ); + bool IsHandicapForCourse( Course* pCourse ); }; #endif diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 26172d3a9b..61bf5eeffe 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -439,6 +439,15 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti ASSERT(0); } + for( int p=0; pGetPathToG( "ScreenOptions disqualify") ); + m_sprDisqualify[p]->SetName( "ScreenOptions", ssprintf("DisqualifyP%i",p+1) ); + UtilSetXYAndOnCommand( m_sprDisqualify[p], "ScreenOptions" ); + m_sprDisqualify[p]->SetHidden( true ); // unhide later if handicapping options are discovered + m_framePage.AddChild( m_sprDisqualify[p] ); + } + m_sprFrame.Load( THEME->GetPathToG( "ScreenOptions frame") ); m_sprFrame->SetXY( CENTER_X, CENTER_Y ); m_framePage.AddChild( m_sprFrame ); diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index ad20445408..8c3cbf2c67 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -170,6 +170,9 @@ protected: AutoActor m_sprMore; bool m_bMoreShown, m_bWasOnExit[NUM_PLAYERS]; + + // show if the current selections will disqualify a high score + AutoActor m_sprDisqualify[NUM_PLAYERS]; // TRICKY: People hold Start to get to PlayerOptions, then // the repeat events cause them to zip to the bottom. So, ignore diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 2b2e708853..87c0e7a9d2 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -52,6 +52,8 @@ ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) : m_bGoToOptions = ( PREFSMAN->m_ShowSongOptions == PrefsManager::YES ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") ); + + UpdateDisqualified(); } @@ -134,6 +136,10 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp } ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI ); + + // UGLY: Update m_Disqualified whenever Start is pressed + if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_START ) + UpdateDisqualified(); } void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) @@ -164,3 +170,32 @@ void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) ScreenOptionsMaster::HandleScreenMessage( SM ); } + +void ScreenPlayerOptions::UpdateDisqualified() +{ + // save current player options + PlayerOptions po[2]; + { + for( int p=0; pm_PlayerOptions[p]; + } + } + + // export the currently selection options, which will fill GAMESTATE->m_PlayerOptions + this->ExportOptions(); + + { + for( int p=0; pIsCourseMode() ? + GAMESTATE->m_PlayerOptions[p].IsHandicapForCourse( GAMESTATE->m_pCurCourse ) : + GAMESTATE->m_PlayerOptions[p].IsHandicapForSong( GAMESTATE->m_pCurSong ); + + m_sprDisqualify[p]->SetHidden( !bIsHandicap ); + + // restore previous player options in case the user escapes back after this + GAMESTATE->m_PlayerOptions[p] = po[p]; + } + } +} diff --git a/stepmania/src/ScreenPlayerOptions.h b/stepmania/src/ScreenPlayerOptions.h index e81c8a02f3..c60a98e5b3 100644 --- a/stepmania/src/ScreenPlayerOptions.h +++ b/stepmania/src/ScreenPlayerOptions.h @@ -25,6 +25,8 @@ private: void GoToNextState(); void GoToPrevState(); + void UpdateDisqualified(); + bool m_bAcceptedChoices; bool m_bGoToOptions; bool m_bAskOptionsMessage; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 7b799924eb..c36a84cfad 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1679,3 +1679,13 @@ void Song::FreeAllLoadedFromProfiles() this->RemoveNotes( pSteps ); } } + +bool Song::HasSignificantBpmChangesOrStops() const +{ + // Don't consider BPM changes that only are only for maintaining sync as + // a real BpmChange. + if( m_DisplayBPMType == DISPLAY_SPECIFIED ) + return false; + + return m_Timing.HasBpmChangesOrStops(); +} diff --git a/stepmania/src/TimingData.cpp b/stepmania/src/TimingData.cpp index 63eeb728a4..7eec3e53a6 100644 --- a/stepmania/src/TimingData.cpp +++ b/stepmania/src/TimingData.cpp @@ -252,6 +252,11 @@ void TimingData::ShiftRows( float fStartBeat, float fBeatsToShift ) } } +bool TimingData::HasBpmChangesOrStops() const +{ + return m_BPMSegments.size()>1 || m_StopSegments.size()>0; +} + /* * Copyright (c) 2001-2004 by the person(s) listed below. All rights reserved. * Chris Danford diff --git a/stepmania/src/TimingData.h b/stepmania/src/TimingData.h index 8570975602..16bc5119fe 100644 --- a/stepmania/src/TimingData.h +++ b/stepmania/src/TimingData.h @@ -38,6 +38,7 @@ public: return fBeat; } float GetElapsedTimeFromBeat( float fBeat ) const; + bool HasBpmChangesOrStops() const; // used for editor fix - expand/contract needs to move BPMSegments // and StopSegments that land during/after the edited range. diff --git a/stepmania/src/song.h b/stepmania/src/song.h index dd98967a9b..1d2f05ae0c 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -174,7 +174,7 @@ public: void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const { m_Timing.GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeatOut, fBPSOut, bFreezeOut ); } float GetBeatFromElapsedTime( float fElapsedTime ) const { return m_Timing.GetBeatFromElapsedTime( fElapsedTime ); } float GetElapsedTimeFromBeat( float fBeat ) const { return m_Timing.GetElapsedTimeFromBeat( fBeat ); } - + bool HasSignificantBpmChangesOrStops() const; vector m_apNotes;