move RadarValues into a separate file

clean up usage of RadarValues
This commit is contained in:
Chris Danford
2004-07-11 07:21:33 +00:00
parent 5f58c7e2cf
commit 96ca652c94
26 changed files with 128 additions and 125 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
#include "ThemeManager.h"
static const CString DifficultyNames[NUM_RADAR_CATEGORIES] = {
static const CString DifficultyNames[NUM_DIFFICULTIES] = {
"Beginner",
"Easy",
"Medium",
+1 -21
View File
@@ -33,6 +33,7 @@
const int MAX_METER = 12;
const int MIN_METER = 1;
/* This is just cached song data. Not all of it may actually be displayed
* in the radar. */
enum RadarCategory
@@ -53,27 +54,6 @@ enum RadarCategory
const CString& RadarCategoryToString( RadarCategory cat );
CString RadarCategoryToThemedString( RadarCategory cat );
struct RadarValues
{
float value[NUM_RADAR_CATEGORIES];
RadarValues()
{
FOREACH_RadarCategory( rc )
value[rc] = 0;
}
operator const float* () const { return value; };
operator float* () { return value; };
RadarValues& operator+=( const RadarValues& other )
{
FOREACH_RadarCategory( rc )
value[rc] += other.value[rc];
return *this;
}
};
enum StepsType
+8 -8
View File
@@ -633,17 +633,17 @@ void GameState::FinishStage()
GAMESTATE->m_iRoundSeed = rand();
//
// Add step totals. Use fRadarActual, since the player might have failed partway
// Add step totals. Use radarActual, since the player might have failed part way
// through the song, in which case we don't want to give credit for the rest of the
// song.
//
FOREACH_HumanPlayer( pn )
{
int iNumTapsAndHolds = (int) g_CurStageStats.fRadarActual[pn][RADAR_NUM_TAPS_AND_HOLDS];
int iNumJumps = (int) g_CurStageStats.fRadarActual[pn][RADAR_NUM_JUMPS];
int iNumHolds = (int) g_CurStageStats.fRadarActual[pn][RADAR_NUM_HOLDS];
int iNumMines = (int) g_CurStageStats.fRadarActual[pn][RADAR_NUM_MINES];
int iNumHands = (int) g_CurStageStats.fRadarActual[pn][RADAR_NUM_HANDS];
int iNumTapsAndHolds = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_TAPS_AND_HOLDS];
int iNumJumps = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_JUMPS];
int iNumHolds = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_HOLDS];
int iNumMines = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_MINES];
int iNumHands = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_HANDS];
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands );
}
}
@@ -1011,8 +1011,8 @@ void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>&
{
for( int r = 0; r < RADAR_NUM_TAPS_AND_HOLDS; r++)
{
statsOut.fRadarPossible[p][r] /= vSongsOut.size();
statsOut.fRadarActual[p][r] /= vSongsOut.size();
statsOut.radarPossible[p][r] /= vSongsOut.size();
statsOut.radarActual[p][r] /= vSongsOut.size();
}
}
}
+1 -1
View File
@@ -64,7 +64,7 @@ void GrooveGraph::SetFromSong( Song* pSong )
FOREACH_Difficulty( dc )
{
fValues[dc] = rvs[j][dc];
}
}
m_Mountains[j].SetValues( fValues );
}
}
+4 -6
View File
@@ -55,8 +55,7 @@ XNode* HighScore::CreateNode() const
FOREACH_HoldNoteScore( hns )
pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
XNode* pRadarCategories = pNode->AppendChild( "RadarActuals" );
FOREACH_RadarCategory( rc )
pRadarCategories->AppendChild( RadarCategoryToString(rc), fRadarActual[rc] );
pRadarCategories->AppendChild( radarValues.CreateNode() );
return pNode;
}
@@ -90,10 +89,9 @@ void HighScore::LoadFromNode( const XNode* pNode )
if( pHoldNoteScores )
FOREACH_HoldNoteScore( hns )
pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
XNode* pRadarCategories = pNode->GetChild( "RadarActuals" );
if( pRadarCategories )
FOREACH_RadarCategory( rc )
pRadarCategories->GetChildValue( RadarCategoryToString(rc), fRadarActual[rc] );
XNode* pRadarValues = pNode->GetChild( "RadarValues" );
if( pRadarValues )
radarValues.LoadFromNode( pRadarValues );
/* Validate input. */
grade = clamp( grade, GRADE_TIER_1, GRADE_FAILED );
+5 -4
View File
@@ -5,8 +5,10 @@
#include "Grade.h"
#include "GameConstantsAndTypes.h"
#include "RadarValues.h"
struct XNode;
struct HighScore
{
CString sName; // name that shows in the machine's ranking screen
@@ -21,7 +23,7 @@ struct HighScore
int iProductID;
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
float fRadarActual[NUM_RADAR_CATEGORIES];
RadarValues radarValues;
HighScore() { Unset(); }
void Unset()
@@ -38,7 +40,7 @@ struct HighScore
iProductID = 0;
ZERO( iTapNoteScores );
ZERO( iHoldNoteScores );
ZERO( fRadarActual );
radarValues.Init();
}
bool operator>=( const HighScore& other ) const;
@@ -59,8 +61,7 @@ struct HighScore
COMPARE( iTapNoteScores[tns] );
FOREACH_HoldNoteScore( hns )
COMPARE( iHoldNoteScores[hns] );
FOREACH_RadarCategory( rc )
COMPARE( fRadarActual[rc] );
COMPARE( radarValues );
#undef COMPARE
return true;
}
+2 -1
View File
@@ -64,7 +64,8 @@ NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesL
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
NotesLoaderSM.cpp NotesLoaderSM.h NotesWriterDWI.cpp NotesWriterDWI.h NotesWriterSM.cpp NotesWriterSM.h \
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h Profile.cpp Profile.h \
RandomSample.cpp RandomSample.h ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
RandomSample.cpp RandomSample.h RadarValues.cpp RadarValues.h \
ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
ScoreKeeperRave.cpp ScoreKeeperRave.h Song.cpp song.h SongCacheIndex.cpp SongCacheIndex.h \
SongOptions.cpp SongOptions.h SongUtil.cpp SongUtil.h StageStats.cpp StageStats.h Steps.cpp Steps.h \
StepsUtil.cpp StepsUtil.h Style.cpp Style.h \
+1
View File
@@ -117,6 +117,7 @@ public:
int GetNumRowsWithTap( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumRowsWithTapOrHoldHead( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumN( int MinTaps, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
// should hands also count as a jump?
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = -1 ) const { return GetNumN( 2, fStartBeat, fEndBeat ); }
/* optimization: for the default of start to end, use the second (faster) */
int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = -1 ) const;
+19 -13
View File
@@ -5,6 +5,7 @@
#include "PlayerOptions.h"
#include "song.h"
#include "GameState.h"
#include "RadarValues.h"
NoteType NoteDataUtil::GetSmallestNoteTypeForMeasure( const NoteData &n, int iMeasureIndex )
{
@@ -287,21 +288,26 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
out.Convert4sToHoldNotes();
}
float NoteDataUtil::GetRadarValue( const NoteData &in, RadarCategory rv, float fSongSeconds )
void NoteDataUtil::GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out )
{
switch( rv )
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
FOREACH_RadarCategory( rc )
{
case RADAR_STREAM: return GetStreamRadarValue( in, fSongSeconds );
case RADAR_VOLTAGE: return GetVoltageRadarValue( in, fSongSeconds );
case RADAR_AIR: return GetAirRadarValue( in, fSongSeconds );
case RADAR_FREEZE: return GetFreezeRadarValue( in, fSongSeconds );
case RADAR_CHAOS: return GetChaosRadarValue( in, fSongSeconds );
case RADAR_NUM_TAPS_AND_HOLDS: return (float) in.GetNumRowsWithTapOrHoldHead();
case RADAR_NUM_JUMPS: return (float) in.GetNumDoubles(); // should hands also count as a jump?
case RADAR_NUM_HOLDS: return (float) in.GetNumHoldNotes();
case RADAR_NUM_MINES: return (float) in.GetNumMines();
case RADAR_NUM_HANDS: return (float) in.GetNumHands();
default: ASSERT(0); return 0;
switch( rc )
{
case RADAR_STREAM: out[rc] = GetStreamRadarValue( in, fSongSeconds ); break;
case RADAR_VOLTAGE: out[rc] = GetVoltageRadarValue( in, fSongSeconds ); break;
case RADAR_AIR: out[rc] = GetAirRadarValue( in, fSongSeconds ); break;
case RADAR_FREEZE: out[rc] = GetFreezeRadarValue( in, fSongSeconds ); break;
case RADAR_CHAOS: out[rc] = GetChaosRadarValue( in, fSongSeconds ); break;
case RADAR_NUM_TAPS_AND_HOLDS: out[rc] = (float) in.GetNumRowsWithTapOrHoldHead(); break;
case RADAR_NUM_JUMPS: out[rc] = (float) in.GetNumDoubles(); break;
case RADAR_NUM_HOLDS: out[rc] = (float) in.GetNumHoldNotes(); break;
case RADAR_NUM_MINES: out[rc] = (float) in.GetNumMines(); break;
case RADAR_NUM_HANDS: out[rc] = (float) in.GetNumHands(); break;
default: ASSERT(0);
}
}
}
+3 -2
View File
@@ -8,6 +8,7 @@
#include "NoteData.h"
struct PlayerOptions;
struct RadarValues;
/* Utils for NoteData. Things should go in here if they can be (cleanly and
* efficiently) implemented using only NoteData's primitives; this improves
@@ -20,14 +21,14 @@ namespace NoteDataUtil
void GetSMNoteDataString( const NoteData &in, CString &notes_out, CString &attacks_out );
void LoadTransformedLights( const NoteData &in, NoteData &out, int iNewNumTracks );
// radar values - return between 0.0 and 1.2
float GetStreamRadarValue( const NoteData &in, float fSongSeconds );
float GetVoltageRadarValue( const NoteData &in, float fSongSeconds );
float GetAirRadarValue( const NoteData &in, float fSongSeconds );
float GetFreezeRadarValue( const NoteData &in, float fSongSeconds );
float GetChaosRadarValue( const NoteData &in, float fSongSeconds );
// radar values - return between 0.0 and 1.2
float GetRadarValue( const NoteData &in, RadarCategory rv, float fSongSeconds );
void GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out );
void RemoveHoldNotes( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
void RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous, float fStartBeat = 0, float fEndBeat = 99999 );
+18 -13
View File
@@ -249,21 +249,26 @@ TapNoteScore NoteDataWithScoring::LastTapNoteScore(unsigned row) const
* No idea what it actually could be, though.
*/
float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, PlayerNumber pn, float fSongSeconds ) const
void NoteDataWithScoring::GetActualRadarValues( PlayerNumber pn, float fSongSeconds, RadarValues& out ) const
{
switch( rv )
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
FOREACH_RadarCategory( rc )
{
case RADAR_STREAM: return GetActualStreamRadarValue( fSongSeconds, pn ); break;
case RADAR_VOLTAGE: return GetActualVoltageRadarValue( fSongSeconds, pn ); break;
case RADAR_AIR: return GetActualAirRadarValue( fSongSeconds, pn ); break;
case RADAR_FREEZE: return GetActualFreezeRadarValue( fSongSeconds, pn ); break;
case RADAR_CHAOS: return GetActualChaosRadarValue( fSongSeconds, pn ); break;
case RADAR_NUM_TAPS_AND_HOLDS: return (float) GetNumNWithScore( TNS_GOOD, 1 );
case RADAR_NUM_JUMPS: return (float) GetNumNWithScore( TNS_GOOD, 2 );
case RADAR_NUM_HOLDS: return (float) GetNumHoldNotesWithScore( HNS_OK );
case RADAR_NUM_MINES: return (float) GetSuccessfulMines();
case RADAR_NUM_HANDS: return (float) GetSuccessfulHands();
default: ASSERT(0); return 0;
switch( rc )
{
case RADAR_STREAM: out[rc] = GetActualStreamRadarValue( fSongSeconds, pn ); break;
case RADAR_VOLTAGE: out[rc] = GetActualVoltageRadarValue( fSongSeconds, pn ); break;
case RADAR_AIR: out[rc] = GetActualAirRadarValue( fSongSeconds, pn ); break;
case RADAR_FREEZE: out[rc] = GetActualFreezeRadarValue( fSongSeconds, pn ); break;
case RADAR_CHAOS: out[rc] = GetActualChaosRadarValue( fSongSeconds, pn ); break;
case RADAR_NUM_TAPS_AND_HOLDS: out[rc] = (float) GetNumNWithScore( TNS_GOOD, 1 ); break;
case RADAR_NUM_JUMPS: out[rc] = (float) GetNumNWithScore( TNS_GOOD, 2 ); break;
case RADAR_NUM_HOLDS: out[rc] = (float) GetNumHoldNotesWithScore( HNS_OK ); break;
case RADAR_NUM_MINES: out[rc] = (float) GetSuccessfulMines(); break;
case RADAR_NUM_HANDS: out[rc] = (float) GetSuccessfulHands(); break;
default: ASSERT(0);
}
}
}
+3 -1
View File
@@ -8,6 +8,8 @@
#include "PlayerNumber.h"
#include <map>
struct RadarValues;
struct RowTrack: public pair<int,int>
{
RowTrack( const HoldNote &hn ): pair<int,int>( hn.iEndRow, hn.iTrack ) { }
@@ -78,7 +80,7 @@ public:
int LastTapNoteScoreTrack(unsigned row) const;
TapNoteScore LastTapNoteScore(unsigned row) const;
float GetActualRadarValue( RadarCategory rv, PlayerNumber pn, float fSongSeconds ) const;
void GetActualRadarValues( PlayerNumber pn, float fSongSeconds, RadarValues& out ) const;
private:
float GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const;
+6 -2
View File
@@ -48,8 +48,12 @@ void SMLoader::LoadFromSMTokens(
CStringArray saValues;
split( sRadarValues, ",", saValues, true );
if( saValues.size() == NUM_RADAR_CATEGORIES )
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
out.SetRadarValue(r, (float)atof(saValues[r]));
{
RadarValues v;
FOREACH_RadarCategory(rc)
v[rc] = (float)atof(saValues[rc]);
out.SetRadarValues( v );
}
out.SetSMNoteData(sNoteData, sAttackData);
+4 -5
View File
@@ -61,8 +61,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
}
RadarValues radarValuesPostModifiers;
FOREACH_RadarCategory( rc )
radarValuesPostModifiers[rc] += NoteDataUtil::GetRadarValue( playerNoteDataPostModifiers, rc, pSong->m_fMusicLengthSeconds );
NoteDataUtil::GetRadarValues( playerNoteDataPostModifiers, pSong->m_fMusicLengthSeconds, radarValuesPostModifiers );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( pSteps->GetRadarValues(), radarValuesPostModifiers );
}
@@ -420,13 +419,13 @@ void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tap
}
int ScoreKeeperMAX2::GetPossibleDancePoints( const RadarValues& fRadars )
int ScoreKeeperMAX2::GetPossibleDancePoints( const RadarValues& radars )
{
/* Note that, if Marvelous timing is disabled or not active (not course mode),
* PERFECT will be used instead. */
int NumTaps = int(fRadars[RADAR_NUM_TAPS_AND_HOLDS]);
int NumHolds = int(fRadars[RADAR_NUM_HOLDS]);
int NumTaps = int(radars[RADAR_NUM_TAPS_AND_HOLDS]);
int NumHolds = int(radars[RADAR_NUM_HOLDS]);
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
}
+8 -8
View File
@@ -214,8 +214,8 @@ void ScreenEvaluation::Init()
FOREACH_PlayerNumber( p ) // foreach line
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ ) // foreach line
{
stageStats.fRadarPossible[p][r] = 0.5f + r/10.0f;
stageStats.fRadarActual[p][r] = 0.5f + r/10.0f;
stageStats.radarPossible[p][r] = 0.5f + r/10.0f;
stageStats.radarActual[p][r] = 0.5f + r/10.0f;
}
}
*/
@@ -538,14 +538,14 @@ void ScreenEvaluation::Init()
for( int r=0; r<NUM_SHOWN_RADAR_CATEGORIES; r++ ) // foreach line
{
m_sprPossibleBar[p][r].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation bar possible p%d",p+1)) );
m_sprPossibleBar[p][r].SetWidth( m_sprPossibleBar[p][r].GetUnzoomedWidth() * stageStats.fRadarPossible[p][r] );
m_sprPossibleBar[p][r].SetWidth( m_sprPossibleBar[p][r].GetUnzoomedWidth() * stageStats.radarPossible[p][r] );
m_sprPossibleBar[p][r].SetName( ssprintf("BarPossible%dP%d",r+1,p+1) );
SET_XY_AND_ON_COMMAND( m_sprPossibleBar[p][r] );
this->AddChild( &m_sprPossibleBar[p][r] );
m_sprActualBar[p][r].Load( THEME->GetPathToG(ssprintf("ScreenEvaluation bar actual p%d",p+1)) );
// should be out of the possible bar, not actual (whatever value that is at)
m_sprActualBar[p][r].SetWidth( m_sprPossibleBar[p][r].GetUnzoomedWidth() * stageStats.fRadarActual[p][r] );
m_sprActualBar[p][r].SetWidth( m_sprPossibleBar[p][r].GetUnzoomedWidth() * stageStats.radarActual[p][r] );
float value = (float)100 * m_sprActualBar[p][r].GetUnzoomedWidth() / m_sprPossibleBar[p][r].GetUnzoomedWidth();
LOG->Trace("Radar bar %d of 5 - %f percent", r, value);
@@ -554,7 +554,7 @@ void ScreenEvaluation::Init()
SET_XY_AND_ON_COMMAND( m_sprActualBar[p][r] );
// .99999 is fairly close to 1.00, so we use that
if( stageStats.fRadarActual[p][r] > 0.99999f )
if( stageStats.radarActual[p][r] > 0.99999f )
m_sprActualBar[p][r].Command( BAR_ACTUAL_MAX_COMMAND );
this->AddChild( &m_sprActualBar[p][r] );
}
@@ -679,8 +679,8 @@ void ScreenEvaluation::Init()
RADAR_NUM_JUMPS, RADAR_NUM_HOLDS, RADAR_NUM_MINES, RADAR_NUM_HANDS
};
const int ind = indeces[l];
const int iActual = (int) roundf(stageStats.fRadarActual[p][ind]);
const int iPossible = (int) roundf(stageStats.fRadarPossible[p][ind]);
const int iActual = (int) roundf(stageStats.radarActual[p][ind]);
const int iPossible = (int) roundf(stageStats.radarPossible[p][ind]);
m_textStatsText[l][p].SetText( ssprintf("%3d/%3d",iActual,iPossible) );
}
@@ -940,7 +940,7 @@ void ScreenEvaluation::CommitScores(
hs.iProductID = PREFSMAN->m_iProductID;
memcpy( hs.iTapNoteScores, stageStats.iTapNoteScores[p], sizeof(hs.iTapNoteScores) );
memcpy( hs.iHoldNoteScores, stageStats.iHoldNoteScores[p], sizeof(hs.iHoldNoteScores) );
memcpy( hs.fRadarActual, stageStats.fRadarActual[p], sizeof(hs.fRadarActual) );
hs.radarValues = stageStats.radarActual[p];
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
+9 -8
View File
@@ -1879,14 +1879,15 @@ void ScreenGameplay::SongFinished()
// save any statistics
FOREACH_EnabledPlayer(p)
{
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
/* Note that adding stats is only meaningful for the counters (eg. RADAR_NUM_JUMPS),
* not for the percentages (RADAR_AIR). */
RadarCategory rc = (RadarCategory)r;
g_CurStageStats.fRadarPossible[p][r] += NoteDataUtil::GetRadarValue( m_Player[p], rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
g_CurStageStats.fRadarActual[p][r] += m_Player[p].GetActualRadarValue( rc, (PlayerNumber)p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
}
/* Note that adding stats is only meaningful for the counters (eg. RADAR_NUM_JUMPS),
* not for the percentages (RADAR_AIR). */
RadarValues v;
NoteDataUtil::GetRadarValues( m_Player[p], GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.radarPossible[p] += v;
m_Player[p].GetActualRadarValues( p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.radarActual[p] += v;
}
/* Extremely important: if we don't remove attacks before moving on to the next
+3 -5
View File
@@ -855,11 +855,9 @@ void Song::ReCalculateRadarValuesAndLastBeat()
NoteData tempNoteData;
pSteps->GetNoteData( &tempNoteData );
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
float fVal = NoteDataUtil::GetRadarValue( tempNoteData, (RadarCategory)r, m_fMusicLengthSeconds );
pSteps->SetRadarValue(r, fVal);
}
RadarValues v;
NoteDataUtil::GetRadarValues( tempNoteData, m_fMusicLengthSeconds, v );
pSteps->SetRadarValues( v );
/* Calculate first/last beat.
+1 -1
View File
@@ -354,7 +354,7 @@ void SongUtil::SortSongPointerArrayByMeter( vector<Song*> &arraySongPointers, Di
CString &s = song_sort_val[arraySongPointers[i]];
s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0);
if( PREFSMAN->m_bSubSortByNumSteps )
s += ssprintf("%06.0f",pSteps ? pSteps->GetRadarValues().value[RADAR_NUM_TAPS_AND_HOLDS] : 0);
s += ssprintf("%06.0f",pSteps ? pSteps->GetRadarValues()[RADAR_NUM_TAPS_AND_HOLDS] : 0);
}
stable_sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersBySortValueAscending );
}
+4 -7
View File
@@ -32,8 +32,8 @@ void StageStats::Init()
memset( iTapNoteScores[p], 0, sizeof(iTapNoteScores[p]) );
memset( iHoldNoteScores[p], 0, sizeof(iHoldNoteScores[p]) );
memset( fRadarPossible[p], 0, sizeof(fRadarPossible[p]) );
memset( fRadarActual[p], 0, sizeof(fRadarActual[p]) );
radarPossible[p].Init();
radarActual[p].Init();
fFirstPos[p] = 999999;
fLastPos[p] = 0;
@@ -70,11 +70,8 @@ void StageStats::AddStats( const StageStats& other )
iMaxCombo[p] += other.iMaxCombo[p];
iCurMissCombo[p] += other.iCurMissCombo[p];
iScore[p] += other.iScore[p];
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fRadarPossible[p][r] += other.fRadarPossible[p][r];
fRadarActual[p][r] += other.fRadarActual[p][r];
}
radarPossible[p] += other.radarPossible[p];
radarActual[p] += other.radarActual[p];
fSecondsBeforeFail[p] += other.fSecondsBeforeFail[p];
iSongsPassed[p] += other.iSongsPassed[p];
iSongsPlayed[p] += other.iSongsPlayed[p];
+3 -2
View File
@@ -6,6 +6,7 @@
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
#include "Grade.h"
#include "RadarValues.h"
#include <map>
class Song;
class Steps;
@@ -48,8 +49,8 @@ struct StageStats
int iCurMissCombo[NUM_PLAYERS];
int iScore[NUM_PLAYERS];
int iBonus[NUM_PLAYERS]; // bonus to be added on screeneval
float fRadarPossible[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
float fRadarActual[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
RadarValues radarPossible[NUM_PLAYERS]; // filled in by ScreenGameplay on start of notes
RadarValues radarActual[NUM_PLAYERS];
float fSecondsBeforeFail[NUM_PLAYERS]; // -1 means didn't/hasn't failed
/* The number of songs played and passed, respectively. */
int iSongsPassed[NUM_PLAYERS];
+10 -2
View File
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -99,7 +99,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -884,6 +884,14 @@ SOURCE=.\Profile.h
# End Source File
# Begin Source File
SOURCE=.\RadarValues.cpp
# End Source File
# Begin Source File
SOURCE=.\RadarValues.h
# End Source File
# Begin Source File
SOURCE=.\RandomSample.cpp
# End Source File
# Begin Source File
+6
View File
@@ -794,6 +794,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="Profile.h">
</File>
<File
RelativePath="RadarValues.cpp">
</File>
<File
RelativePath="RadarValues.h">
</File>
<File
RelativePath=".\RandomSample.cpp">
</File>
+3 -8
View File
@@ -123,7 +123,6 @@ float Steps::PredictMeter() const
return pMeter;
}
void Steps::TidyUpData()
{
if( GetDifficulty() == DIFFICULTY_INVALID )
@@ -247,10 +246,7 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have
this->SetDescription( "Copied from "+pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() );
const float* radarValues = pSource->GetRadarValues();
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
this->SetRadarValue( (RadarCategory)r, radarValues[r] );
this->SetRadarValues( pSource->GetRadarValues() );
}
void Steps::CreateBlank( StepsType ntTo )
@@ -292,11 +288,10 @@ void Steps::SetMeter(int meter)
m_iMeter = meter;
}
void Steps::SetRadarValue(int r, float val)
void Steps::SetRadarValues( const RadarValues& v )
{
DeAutogen();
ASSERT(r < NUM_RADAR_CATEGORIES);
m_RadarValues[r] = val;
m_RadarValues = v;
}
/*
+2 -1
View File
@@ -6,6 +6,7 @@
#include "GameConstantsAndTypes.h"
#include "PlayerNumber.h"
#include "Grade.h"
#include "RadarValues.h"
class NoteData;
class Profile;
@@ -39,7 +40,7 @@ public:
void SetDifficulty(Difficulty d);
void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; }
void SetMeter(int meter);
void SetRadarValue(int r, float val);
void SetRadarValues( const RadarValues& v );
bool IsAutogen() const; // Was created by autogen?
float PredictMeter() const;
+2 -5
View File
@@ -69,11 +69,8 @@ bool StepsUtil::CompareNotesPointersByRadarValues(const Steps* pSteps1, const St
float fScore1 = 0;
float fScore2 = 0;
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fScore1 += pSteps1->GetRadarValues()[r];
fScore2 += pSteps2->GetRadarValues()[r];
}
fScore1 += pSteps1->GetRadarValues()[RADAR_NUM_TAPS_AND_HOLDS];
fScore2 += pSteps2->GetRadarValues()[RADAR_NUM_TAPS_AND_HOLDS];
return fScore1 < fScore2;
}
+1
View File
@@ -4,6 +4,7 @@
#define TRAIL_H
#include "Attack.h"
#include "RadarValues.h"
class Song;
class Steps;