From 84ca444bd2e2b8f2f45854c72552d08c89a5985d Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 27 Feb 2011 21:52:59 -0500 Subject: [PATCH 1/6] New branch: attempt to add Fakes to the radar. At this point, the code still compiles. Running? No guarantees. More work to be done. --- src/GameConstantsAndTypes.cpp | 1 + src/GameConstantsAndTypes.h | 1 + src/RadarValues.h | 1 + 3 files changed, 3 insertions(+) diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index bfc8dc2194..a5bcb68002 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -36,6 +36,7 @@ static const char *RadarCategoryNames[] = { "Hands", "Rolls", "Lifts", + "Fakes", }; XToString( RadarCategory ); XToLocalizedString( RadarCategory ); diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index ddd6bd2e91..b3696328a5 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -39,6 +39,7 @@ enum RadarCategory RadarCategory_Hands, /**< How many hands are in the song? */ RadarCategory_Rolls, /**< How many rolls are in the song? */ RadarCategory_Lifts, /**< How many lifts are in the song? */ + RadarCategory_Fakes, /**< How many fakes are in the song? */ NUM_RadarCategory, /**< The number of radar categories. */ RadarCategory_Invalid }; diff --git a/src/RadarValues.h b/src/RadarValues.h index 3305293674..560739c079 100644 --- a/src/RadarValues.h +++ b/src/RadarValues.h @@ -28,6 +28,7 @@ struct RadarValues float fNumHands; float fNumRolls; float fNumLifts; + float fNumFakes; } v; float f[NUM_RadarCategory]; } m_Values; From ca83d063f8cae97b077078b681cfc15cee913334 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 27 Feb 2011 22:17:18 -0500 Subject: [PATCH 2/6] More on the branch. NotesLoader/Writer set up. --- src/NotesLoaderSM.cpp | 13 ++++++++++--- src/NotesLoaderSSC.cpp | 17 ++++++++++++++--- src/NotesLoaderSSC.h | 2 ++ src/NotesWriterSM.cpp | 8 +++++++- src/Song.cpp | 4 ++-- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 5dbbe73bfe..9b3b3e9ff8 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -55,12 +55,19 @@ void SMLoader::LoadFromSMTokens( out.SetMeter( atoi(sMeter) ); vector saValues; split( sRadarValues, ",", saValues, true ); - if( saValues.size() == NUM_RadarCategory * NUM_PLAYERS ) + int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values. + if( saValues.size() == (unsigned)categories * NUM_PLAYERS ) { RadarValues v[NUM_PLAYERS]; FOREACH_PlayerNumber( pn ) - FOREACH_ENUM( RadarCategory, rc ) - v[pn][rc] = StringToFloat( saValues[pn*NUM_RadarCategory + rc] ); + { + // Can't use the foreach anymore due to flexible radar lines. + for( RadarCategory rc = (RadarCategory)0; rc < categories; + enum_add( rc, 1 ) ) + { + v[pn][rc] = StringToFloat( saValues[pn*categories + rc] ); + } + } out.SetCachedRadarValues( v ); } diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index de6b5dffb9..82f6135342 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -658,12 +658,23 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach { vector saValues; split( sParams[1], ",", saValues, true ); - if( saValues.size() == NUM_RadarCategory * NUM_PLAYERS ) + + int categories = NUM_RadarCategory; + if( out.m_fVersion < VERSION_RADAR_FAKE ) + categories -= 1; + + if( saValues.size() == (unsigned)categories * NUM_PLAYERS ) { RadarValues v[NUM_PLAYERS]; FOREACH_PlayerNumber( pn ) - FOREACH_ENUM( RadarCategory, rc ) - v[pn][rc] = StringToFloat( saValues[pn*NUM_RadarCategory + rc] ); + { + // Can't use the foreach anymore due to flexible radar lines. + for( RadarCategory rc = (RadarCategory)0; rc < categories; + enum_add( rc, +1 ) ) + { + v[pn][rc] = StringToFloat( saValues[pn*categories + rc] ); + } + } pNewNotes->SetCachedRadarValues( v ); } } diff --git a/src/NotesLoaderSSC.h b/src/NotesLoaderSSC.h index 675a91a2e8..ae8f00bc9c 100644 --- a/src/NotesLoaderSSC.h +++ b/src/NotesLoaderSSC.h @@ -21,6 +21,8 @@ enum SSCLoadingStates NUM_SSCLoadingStates /**< The number of states used. */ }; +const float VERSION_RADAR_FAKE = 0.53f; + /** * @brief The SSCLoader handles all of the parsing needed for .ssc files. */ diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index f43643b343..df1ac5e87d 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -273,11 +273,17 @@ static RString GetSMNotesTag( const Song &song, const Steps &in ) lines.push_back( ssprintf( " %d:", in.GetMeter() ) ); vector asRadarValues; + // SM files don't use fakes for radar data. Keep it that way. + int categories = NUM_RadarCategory - 1; FOREACH_PlayerNumber( pn ) { const RadarValues &rv = in.GetRadarValues( pn ); - FOREACH_ENUM( RadarCategory, rc ) + // Can't use the foreach anymore due to flexible radar lines. + for( RadarCategory rc = (RadarCategory)0; rc < categories; + enum_add( rc, 1 ) ) + { asRadarValues.push_back( ssprintf("%.3f", rv[rc]) ); + } } lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) ); diff --git a/src/Song.cpp b/src/Song.cpp index 7c648aaf8c..2f45d43e29 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -37,12 +37,12 @@ #include /** @brief The version of the .ssc file format. */ -const static float VERSION_NUMBER = 0.52f; +const static float VERSION_NUMBER = 0.53f; /** * @brief The internal version of the cache for StepMania. * * Increment this value to invalidate the current cache. */ -const int FILE_CACHE_VERSION = 164; +const int FILE_CACHE_VERSION = 165; /** @brief How long does a song sample last by default? */ const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; From 86f3bf7e79d727c2d1c4612bf3bee7069dc3461a Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 27 Feb 2011 22:36:04 -0500 Subject: [PATCH 3/6] Radar branch: add Fakes wherever it made sense. Need to check metrics, then ready to test. --- src/NoteData.cpp | 14 ++++++++++++++ src/NoteData.h | 1 + src/NoteDataUtil.cpp | 1 + src/NoteDataWithScoring.cpp | 3 ++- src/PaneDisplay.cpp | 2 ++ src/PaneDisplay.h | 1 + src/ScreenEvaluation.cpp | 5 +++-- src/ScreenEvaluation.h | 2 ++ src/Steps.cpp | 2 +- 9 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/NoteData.cpp b/src/NoteData.cpp index 49449cc833..3c993235e6 100644 --- a/src/NoteData.cpp +++ b/src/NoteData.cpp @@ -635,6 +635,20 @@ int NoteData::GetNumLifts( int iStartIndex, int iEndIndex ) const return iNumLifts; } +int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const +{ + int iNumFakes = 0; + + for( int t=0; tm_player[p].m_radarActual[ind]); diff --git a/src/ScreenEvaluation.h b/src/ScreenEvaluation.h index 3e6c3f1280..d302e5b1bf 100644 --- a/src/ScreenEvaluation.h +++ b/src/ScreenEvaluation.h @@ -41,6 +41,8 @@ enum DetailLine DetailLine_Mines, /**< The number of mines avoided. */ DetailLine_Hands, /**< The number of hands hit (somehow) */ DetailLine_Rolls, /**< The number of rolls hit repeatedly. */ + DetailLine_Lifts, /**< The number of lifts lifted up. */ + DetailLine_Fakes, /**< The number of fakes to be ignored. */ NUM_DetailLine /**< The nuber of detailed lines. */ }; /** @brief Shows the player their score after gameplay has ended. */ diff --git a/src/Steps.cpp b/src/Steps.cpp index 838d55704f..fb17405c61 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -123,7 +123,7 @@ float Steps::PredictMeter() const const float RadarCoeffs[NUM_RadarCategory] = { 10.1f, 5.27f,-0.905f, -1.10f, 2.86f, - 0,0,0,0,0,0 + 0,0,0,0,0,0,0,0 }; const RadarValues &rv = GetRadarValues( PLAYER_1 ); for( int r = 0; r < NUM_RadarCategory; ++r ) From 7d4a5ab26b90d3c4271555e1e8297772c5492a48 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 27 Feb 2011 22:50:26 -0500 Subject: [PATCH 4/6] =?UTF-8?q?Radar=20branch.=20See=20description.=20?= =?UTF-8?q?=E2=86=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) Allow displaying Lift and Fake counts in the Editor. 2) Display the number of Fakes in the music select screen. --- Themes/_fallback/Languages/en.ini | 2 ++ Themes/_fallback/metrics.ini | 2 ++ Themes/default/Graphics/PaneDisplay text.lua | 8 ++++---- src/ScreenEdit.cpp | 6 ++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index f7c61ddf24..d3561d3f52 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -1246,6 +1246,8 @@ Hands=Hands Holds=Holds Mines=Mines Rolls=Rolls +Lifts=Lifts +Fakes=Fakes Beat 0 offset=Beat 0 offset Preview Start=Preview Start Preview Length=Preview Length diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 3bc0718e63..bbfe73a778 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -3631,6 +3631,8 @@ NumHoldsFormat="%s: %d\n" NumMinesFormat="%s: %d\n" NumHandsFormat="%s: %d\n" NumRollsFormat="%s: %d\n" +NumLiftsFormat="%s: %d\n" +NumFakesFormat="%s: %d\n" Beat0OffsetFormat="%s:\n %.5f secs\n" PreviewStartFormat="%s:\n %.5f secs\n" PreviewLengthFormat="%s:\n %.5f secs\n" diff --git a/Themes/default/Graphics/PaneDisplay text.lua b/Themes/default/Graphics/PaneDisplay text.lua index e0277a18df..d3b2e33716 100644 --- a/Themes/default/Graphics/PaneDisplay text.lua +++ b/Themes/default/Graphics/PaneDisplay text.lua @@ -120,16 +120,16 @@ t[#t+1] = Def.ActorFrame { InitCommand=cmd(x,-128+16+8;y,-14+16*3); }; -- Center - CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Mines' ) .. { + CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Hands' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14); }; - CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. { + CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Rolls' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16); }; - CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. { + CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Lifts' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16*2); }; - CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. { + CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Fakes' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16*3); }; -- Right diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 2ca5d26235..4f515bcea9 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -1027,6 +1027,8 @@ static LocalizedString HANDS("ScreenEdit", "Hands"); static LocalizedString HOLDS("ScreenEdit", "Holds"); static LocalizedString MINES("ScreenEdit", "Mines"); static LocalizedString ROLLS("ScreenEdit", "Rolls"); +static LocalizedString LIFTS("ScreenEdit", "Lifts"); +static LocalizedString FAKES("ScreenEdit", "Fakes"); static LocalizedString BEAT_0_OFFSET("ScreenEdit", "Beat 0 offset"); static LocalizedString PREVIEW_START("ScreenEdit", "Preview Start"); static LocalizedString PREVIEW_LENGTH("ScreenEdit", "Preview Length"); @@ -1049,6 +1051,8 @@ static ThemeMetric NUM_HOLDS_FORMAT("ScreenEdit", "NumHoldsFormat"); static ThemeMetric NUM_MINES_FORMAT("ScreenEdit", "NumMinesFormat"); static ThemeMetric NUM_HANDS_FORMAT("ScreenEdit", "NumHandsFormat"); static ThemeMetric NUM_ROLLS_FORMAT("ScreenEdit", "NumRollsFormat"); +static ThemeMetric NUM_LIFTS_FORMAT("ScreenEdit", "NumLiftsFormat"); +static ThemeMetric NUM_FAKES_FORMAT("ScreenEdit", "NumFakesFormat"); static ThemeMetric BEAT_0_OFFSET_FORMAT("ScreenEdit", "Beat0OffsetFormat"); static ThemeMetric PREVIEW_START_FORMAT("ScreenEdit", "PreviewStartFormat"); static ThemeMetric PREVIEW_LENGTH_FORMAT("ScreenEdit", "PreviewLengthFormat"); @@ -1117,6 +1121,8 @@ void ScreenEdit::UpdateTextInfo() sText += ssprintf( NUM_HOLDS_FORMAT.GetValue(), HOLDS.GetValue().c_str(), m_NoteDataEdit.GetNumHoldNotes() ); sText += ssprintf( NUM_MINES_FORMAT.GetValue(), MINES.GetValue().c_str(), m_NoteDataEdit.GetNumMines() ); sText += ssprintf( NUM_ROLLS_FORMAT.GetValue(), ROLLS.GetValue().c_str(), m_NoteDataEdit.GetNumRolls() ); + sText += ssprintf( NUM_LIFTS_FORMAT.GetValue(), LIFTS.GetValue().c_str(), m_NoteDataEdit.GetNumLifts() ); + sText += ssprintf( NUM_FAKES_FORMAT.GetValue(), FAKES.GetValue().c_str(), m_NoteDataEdit.GetNumFakes() ); switch( EDIT_MODE.GetValue() ) { DEFAULT_FAIL( EDIT_MODE.GetValue() ); From c86214e144dc4214479d10edb8f8c255bd4985f6 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 27 Feb 2011 22:56:02 -0500 Subject: [PATCH 5/6] Radar branch: forgot to fix labels. --- Themes/default/Graphics/PaneDisplay text.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Themes/default/Graphics/PaneDisplay text.lua b/Themes/default/Graphics/PaneDisplay text.lua index d3b2e33716..3738f5bdb1 100644 --- a/Themes/default/Graphics/PaneDisplay text.lua +++ b/Themes/default/Graphics/PaneDisplay text.lua @@ -120,16 +120,16 @@ t[#t+1] = Def.ActorFrame { InitCommand=cmd(x,-128+16+8;y,-14+16*3); }; -- Center - CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Hands' ) .. { + CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14); }; - CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Rolls' ) .. { + CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16); }; - CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Lifts' ) .. { + CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16*2); }; - CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Fakes' ) .. { + CreatePaneDisplayItem( iPN, "FAKES", 'RadarCategory_Fakes' ) .. { InitCommand=cmd(x,-128+16+8+74;y,-14+16*3); }; -- Right From 59558d0e32226d825c9a14f194ded92a5f0712a2 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 28 Feb 2011 00:12:13 -0500 Subject: [PATCH 6/6] Radar branch: update SSC version number in cache. --- src/NotesLoaderSSC.cpp | 1 + src/NotesWriterSSC.cpp | 2 +- src/Song.cpp | 5 ++--- src/Song.h | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 82f6135342..1721e01dfa 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -928,6 +928,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach } } } + out.m_fVersion = STEPFILE_VERSION_NUMBER; return true; } diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index 0a77bae975..e26d3d6c69 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -47,7 +47,7 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc ) * @param out the Song in question. */ static void WriteGlobalTags( RageFile &f, const Song &out ) { - f.PutLine( ssprintf( "#VERSION:%.2f;", out.m_fVersion ) ); + f.PutLine( ssprintf( "#VERSION:%.2f;", STEPFILE_VERSION_NUMBER ) ); f.PutLine( ssprintf( "#TITLE:%s;", SmEscape(out.m_sMainTitle).c_str() ) ); f.PutLine( ssprintf( "#SUBTITLE:%s;", SmEscape(out.m_sSubTitle).c_str() ) ); f.PutLine( ssprintf( "#ARTIST:%s;", SmEscape(out.m_sArtist).c_str() ) ); diff --git a/src/Song.cpp b/src/Song.cpp index 2f45d43e29..67b730ee61 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -36,8 +36,7 @@ #include #include -/** @brief The version of the .ssc file format. */ -const static float VERSION_NUMBER = 0.53f; + /** * @brief The internal version of the cache for StepMania. * @@ -66,7 +65,7 @@ Song::Song() m_ForegroundChanges = AutoPtrCopyOnWrite(new VBackgroundChange); m_LoadedFromProfile = ProfileSlot_Invalid; - m_fVersion = VERSION_NUMBER; + m_fVersion = STEPFILE_VERSION_NUMBER; m_fMusicSampleStartSeconds = -1; m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH; m_fMusicLengthSeconds = 0; diff --git a/src/Song.h b/src/Song.h index aefc16f763..07d05a7742 100644 --- a/src/Song.h +++ b/src/Song.h @@ -16,6 +16,9 @@ class StepsID; struct lua_State; struct BackgroundChange; +/** @brief The version of the .ssc file format. */ +const static float STEPFILE_VERSION_NUMBER = 0.53f; + /** @brief How many edits for this song can each profile have? */ const int MAX_EDITS_PER_SONG_PER_PROFILE = 5; /** @brief How many edits for this song can be available? */ @@ -73,7 +76,7 @@ public: ~Song(); void Reset(); void DetachSteps(); - + /** * @brief Load a song from the chosen directory. *