Mission complete: Fakes are a RadarCategory.

This commit is contained in:
Jason Felds
2011-02-28 00:21:04 -05:00
23 changed files with 86 additions and 21 deletions
+2
View File
@@ -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
+2
View File
@@ -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"
+4 -4
View File
@@ -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, "HANDS", 'RadarCategory_Hands' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14);
};
CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. {
CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16);
};
CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. {
CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16*2);
};
CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. {
CreatePaneDisplayItem( iPN, "FAKES", 'RadarCategory_Fakes' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16*3);
};
-- Right
+1
View File
@@ -36,6 +36,7 @@ static const char *RadarCategoryNames[] = {
"Hands",
"Rolls",
"Lifts",
"Fakes",
};
XToString( RadarCategory );
XToLocalizedString( RadarCategory );
+1
View File
@@ -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
};
+14
View File
@@ -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; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNote(t, r).type == TapNote::fake )
iNumFakes++;
}
return iNumFakes;
}
/*
int NoteData::GetNumMinefields( int iStartIndex, int iEndIndex ) const
{
+1
View File
@@ -233,6 +233,7 @@ public:
// and the other notetypes
int GetNumLifts( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumFakes( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
// Transformations
void LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track
+1
View File
@@ -749,6 +749,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
case RadarCategory_Hands: out[rc] = (float) in.GetNumHands(); break;
case RadarCategory_Rolls: out[rc] = (float) in.GetNumRolls(); break;
case RadarCategory_Lifts: out[rc] = (float) in.GetNumLifts(); break;
case RadarCategory_Fakes: out[rc] = (float) in.GetNumFakes(); break;
default: ASSERT(0);
}
}
+2 -1
View File
@@ -348,7 +348,8 @@ void NoteDataWithScoring::GetActualRadarValues( const NoteData &in, const Player
case RadarCategory_Mines: out[rc] = (float) GetSuccessfulMines( in ); break;
case RadarCategory_Hands: out[rc] = (float) GetSuccessfulHands( in ); break;
case RadarCategory_Rolls: out[rc] = (float) GetNumHoldNotesWithScore( in, TapNote::hold_head_roll, HNS_Held ); break;
case RadarCategory_Lifts: out[rc] = (float) GetSuccessfulLifts( in, TNS_W4 ); break;
case RadarCategory_Lifts: out[rc] = (float) GetSuccessfulLifts( in, TNS_W4 ); break;
case RadarCategory_Fakes: out[rc] = (float) in.GetNumLifts(); break;
//case RadarCategory_Minefields: out[rc] = (float) GetNumMinefieldsWithScore( in, TapNote::hold_head_mine, HNS_Held ); break;
DEFAULT_FAIL( rc );
}
+10 -3
View File
@@ -55,12 +55,19 @@ void SMLoader::LoadFromSMTokens(
out.SetMeter( atoi(sMeter) );
vector<RString> 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<RadarCategory>( rc, 1 ) )
{
v[pn][rc] = StringToFloat( saValues[pn*categories + rc] );
}
}
out.SetCachedRadarValues( v );
}
+15 -3
View File
@@ -658,12 +658,23 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
{
vector<RString> 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<RadarCategory>( rc, +1 ) )
{
v[pn][rc] = StringToFloat( saValues[pn*categories + rc] );
}
}
pNewNotes->SetCachedRadarValues( v );
}
}
@@ -917,6 +928,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
}
}
}
out.m_fVersion = STEPFILE_VERSION_NUMBER;
return true;
}
+2
View File
@@ -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.
*/
+7 -1
View File
@@ -273,11 +273,17 @@ static RString GetSMNotesTag( const Song &song, const Steps &in )
lines.push_back( ssprintf( " %d:", in.GetMeter() ) );
vector<RString> 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<RadarCategory>( rc, 1 ) )
{
asRadarValues.push_back( ssprintf("%.3f", rv[rc]) );
}
}
lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) );
+1 -1
View File
@@ -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() ) );
+2
View File
@@ -26,6 +26,7 @@ static const char *PaneCategoryNames[] = {
"Mines",
"Hands",
"Lifts",
"Fakes",
"MachineHighScore",
"MachineHighName",
"ProfileHighScore",
@@ -206,6 +207,7 @@ void PaneDisplay::SetContent( PaneCategory c )
case PaneCategory_Mines: val = rv[RadarCategory_Mines]; break;
case PaneCategory_Hands: val = rv[RadarCategory_Hands]; break;
case PaneCategory_Lifts: val = rv[RadarCategory_Lifts]; break;
case PaneCategory_Fakes: val = rv[RadarCategory_Fakes]; break;
case PaneCategory_ProfileHighScore:
case PaneCategory_MachineHighName: // set val for color
case PaneCategory_MachineHighScore:
+1
View File
@@ -22,6 +22,7 @@ enum PaneCategory
PaneCategory_Mines,
PaneCategory_Hands,
PaneCategory_Lifts,
PaneCategory_Fakes,
PaneCategory_MachineHighScore,
PaneCategory_MachineHighName,
PaneCategory_ProfileHighScore,
+1
View File
@@ -28,6 +28,7 @@ struct RadarValues
float fNumHands;
float fNumRolls;
float fNumLifts;
float fNumFakes;
} v;
float f[NUM_RadarCategory];
} m_Values;
+6
View File
@@ -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<RString> NUM_HOLDS_FORMAT("ScreenEdit", "NumHoldsFormat");
static ThemeMetric<RString> NUM_MINES_FORMAT("ScreenEdit", "NumMinesFormat");
static ThemeMetric<RString> NUM_HANDS_FORMAT("ScreenEdit", "NumHandsFormat");
static ThemeMetric<RString> NUM_ROLLS_FORMAT("ScreenEdit", "NumRollsFormat");
static ThemeMetric<RString> NUM_LIFTS_FORMAT("ScreenEdit", "NumLiftsFormat");
static ThemeMetric<RString> NUM_FAKES_FORMAT("ScreenEdit", "NumFakesFormat");
static ThemeMetric<RString> BEAT_0_OFFSET_FORMAT("ScreenEdit", "Beat0OffsetFormat");
static ThemeMetric<RString> PREVIEW_START_FORMAT("ScreenEdit", "PreviewStartFormat");
static ThemeMetric<RString> 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() );
+3 -2
View File
@@ -198,6 +198,7 @@ void ScreenEvaluation::Init()
case RadarCategory_Hands:
case RadarCategory_Rolls:
case RadarCategory_Lifts:
case RadarCategory_Fakes:
ss.m_player[p].m_radarPossible[rc] = 1 + (rand() % 200);
ss.m_player[p].m_radarActual[rc] = rand() % (int)(ss.m_player[p].m_radarPossible[rc]);
break;
@@ -541,8 +542,8 @@ void ScreenEvaluation::Init()
static const int indeces[NUM_DetailLine] =
{
RadarCategory_TapsAndHolds, RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls
//, RadarCategory_Lifts
RadarCategory_TapsAndHolds, RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines,
RadarCategory_Hands, RadarCategory_Rolls, RadarCategory_Lifts, RadarCategory_Fakes
};
const int ind = indeces[l];
const int iActual = lrintf(m_pStageStats->m_player[p].m_radarActual[ind]);
+2
View File
@@ -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. */
+3 -4
View File
@@ -36,13 +36,12 @@
#include <set>
#include <float.h>
/** @brief The version of the .ssc file format. */
const static float VERSION_NUMBER = 0.52f;
/**
* @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;
@@ -66,7 +65,7 @@ Song::Song()
m_ForegroundChanges = AutoPtrCopyOnWrite<VBackgroundChange>(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;
+4 -1
View File
@@ -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.
*
+1 -1
View File
@@ -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 )