fix fill machine stats
This commit is contained in:
@@ -67,6 +67,9 @@ Delete=Delete Existing
|
|||||||
Edit=Edit Existing
|
Edit=Edit Existing
|
||||||
Practice=Practice
|
Practice=Practice
|
||||||
|
|
||||||
|
[EditMenu]
|
||||||
|
Blank=Blank
|
||||||
|
|
||||||
[EditMenuRow]
|
[EditMenuRow]
|
||||||
Action=Action
|
Action=Action
|
||||||
Group=Group
|
Group=Group
|
||||||
@@ -951,6 +954,7 @@ The name you chose conflicts with another profile. Please use a different name.=
|
|||||||
These steps will be lost permanently.=These steps will be lost permanently.
|
These steps will be lost permanently.=These steps will be lost permanently.
|
||||||
This song is missing a music file and cannot be edited.=This song is missing a music file and cannot be edited.
|
This song is missing a music file and cannot be edited.=This song is missing a music file and cannot be edited.
|
||||||
You must supply a name for your new edit.=You must supply a name for your new edit.
|
You must supply a name for your new edit.=You must supply a name for your new edit.
|
||||||
|
Blank=Blank
|
||||||
|
|
||||||
[ScreenEditOptions]
|
[ScreenEditOptions]
|
||||||
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes
|
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes
|
||||||
@@ -1159,7 +1163,6 @@ Edits not cleared - No memory cards ready.=Edits not cleared - No memory cards r
|
|||||||
Edits not copied - No memory cards ready.=Edits not copied - No memory cards ready.
|
Edits not copied - No memory cards ready.=Edits not copied - No memory cards ready.
|
||||||
Error saving machine stats to P%d card.=Error saving machine stats to P%d card.
|
Error saving machine stats to P%d card.=Error saving machine stats to P%d card.
|
||||||
Machine stats cleared.=Machine stats cleared.
|
Machine stats cleared.=Machine stats cleared.
|
||||||
Machine stats filled.=Machine stats filled.
|
|
||||||
Machine stats loaded from P%d card.=Machine stats loaded from P%d card.
|
Machine stats loaded from P%d card.=Machine stats loaded from P%d card.
|
||||||
Machine stats saved to P%d card.=Machine stats saved to P%d card.
|
Machine stats saved to P%d card.=Machine stats saved to P%d card.
|
||||||
Preferences reset.=Preferences reset.
|
Preferences reset.=Preferences reset.
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "InputEventPlus.h"
|
#include "InputEventPlus.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
#include "Profile.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
|
||||||
static bool g_bIsDisplayed = false;
|
static bool g_bIsDisplayed = false;
|
||||||
static bool g_bIsSlow = false;
|
static bool g_bIsSlow = false;
|
||||||
@@ -574,6 +576,77 @@ class DebugLineClearMachineStats : public IDebugLine
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static HighScore MakeRandomHighScore( float fPercentDP )
|
||||||
|
{
|
||||||
|
HighScore hs;
|
||||||
|
hs.SetName( "FAKE" );
|
||||||
|
hs.SetGrade( (Grade)SCALE( rand()%5, 0, 4, Grade_Tier01, Grade_Tier05 ) );
|
||||||
|
hs.SetScore( rand()%100*1000 );
|
||||||
|
hs.SetPercentDP( fPercentDP );
|
||||||
|
hs.SetSurviveSeconds( randomf(30.0f, 100.0f) );
|
||||||
|
PlayerOptions po;
|
||||||
|
po.ChooseRandomModifiers();
|
||||||
|
hs.SetModifiers( po.GetString() );
|
||||||
|
hs.SetDateTime( DateTime::GetNowDateTime() );
|
||||||
|
hs.SetPlayerGuid( Profile::MakeGuid() );
|
||||||
|
hs.SetMachineGuid( Profile::MakeGuid() );
|
||||||
|
hs.SetProductID( rand()%10 );
|
||||||
|
FOREACH_TapNoteScore( tns )
|
||||||
|
hs.SetTapNoteScore( tns, rand() % 100 );
|
||||||
|
FOREACH_HoldNoteScore( hns )
|
||||||
|
hs.SetHoldNoteScore( hns, rand() % 100 );
|
||||||
|
RadarValues rv;
|
||||||
|
FOREACH_RadarCategory( rc )
|
||||||
|
rv.m_Values.f[rc] = randomf( 0, 1 );
|
||||||
|
hs.SetRadarValues( rv );
|
||||||
|
|
||||||
|
return hs;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FillProfile( Profile *pProfile )
|
||||||
|
{
|
||||||
|
// Choose a percent for all scores. This is useful for testing unlocks
|
||||||
|
// where some elements are unlocked at a certain percent complete
|
||||||
|
float fPercentDP = randomf( 0.6f, 1.2f );
|
||||||
|
CLAMP( fPercentDP, 0.0f, 1.0f );
|
||||||
|
|
||||||
|
int iCount = pProfile->IsMachine()?
|
||||||
|
PREFSMAN->m_iMaxHighScoresPerListForMachine.Get():
|
||||||
|
PREFSMAN->m_iMaxHighScoresPerListForPlayer.Get();
|
||||||
|
|
||||||
|
vector<Song*> vpAllSongs = SONGMAN->GetAllSongs();
|
||||||
|
FOREACH( Song*, vpAllSongs, pSong )
|
||||||
|
{
|
||||||
|
vector<Steps*> vpAllSteps = (*pSong)->GetAllSteps();
|
||||||
|
FOREACH( Steps*, vpAllSteps, pSteps )
|
||||||
|
{
|
||||||
|
pProfile->IncrementStepsPlayCount( *pSong, *pSteps );
|
||||||
|
for( int i=0; i<iCount; i++ )
|
||||||
|
{
|
||||||
|
int iIndex = 0;
|
||||||
|
pProfile->AddStepsHighScore( *pSong, *pSteps, MakeRandomHighScore(fPercentDP), iIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<Course*> vpAllCourses;
|
||||||
|
SONGMAN->GetAllCourses( vpAllCourses, true );
|
||||||
|
FOREACH( Course*, vpAllCourses, pCourse )
|
||||||
|
{
|
||||||
|
vector<Trail*> vpAllTrails;
|
||||||
|
(*pCourse)->GetAllTrails( vpAllTrails );
|
||||||
|
FOREACH( Trail*, vpAllTrails, pTrail )
|
||||||
|
{
|
||||||
|
pProfile->IncrementCoursePlayCount( *pCourse, *pTrail );
|
||||||
|
for( int i=0; i<iCount; i++ )
|
||||||
|
{
|
||||||
|
int iIndex = 0;
|
||||||
|
pProfile->AddCourseHighScore( *pCourse, *pTrail, MakeRandomHighScore(fPercentDP), iIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DebugLineFillMachineStats : public IDebugLine
|
class DebugLineFillMachineStats : public IDebugLine
|
||||||
{
|
{
|
||||||
virtual CString GetDescription() { return FILL_MACHINE_STATS.GetValue(); }
|
virtual CString GetDescription() { return FILL_MACHINE_STATS.GetValue(); }
|
||||||
@@ -581,9 +654,9 @@ class DebugLineFillMachineStats : public IDebugLine
|
|||||||
virtual bool IsEnabled() { return true; }
|
virtual bool IsEnabled() { return true; }
|
||||||
virtual void Do( CString &sMessageOut )
|
virtual void Do( CString &sMessageOut )
|
||||||
{
|
{
|
||||||
GameCommand gc;
|
Profile* pProfile = PROFILEMAN->GetMachineProfile();
|
||||||
gc.Load( 0, ParseCommands("FillMachineStats") );
|
FillProfile( pProfile );
|
||||||
gc.ApplyToAllPlayers();
|
PROFILEMAN->SaveMachineProfile();
|
||||||
IDebugLine::Do( sMessageOut );
|
IDebugLine::Do( sMessageOut );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,86 +106,6 @@ static CString ClearMemoryCardEdits()
|
|||||||
return ssprintf(EDITS_CLEARED.GetValue(),iNumSuccessful,iNumAttempted-iNumSuccessful);
|
return ssprintf(EDITS_CLEARED.GetValue(),iNumSuccessful,iNumAttempted-iNumSuccessful);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HighScore MakeRandomHighScore( float fPercentDP )
|
|
||||||
{
|
|
||||||
HighScore hs;
|
|
||||||
hs.SetName( "FAKE" );
|
|
||||||
hs.SetGrade( (Grade)SCALE( rand()%5, 0, 4, Grade_Tier01, Grade_Tier05 ) );
|
|
||||||
hs.SetScore( rand()%100*1000 );
|
|
||||||
hs.SetPercentDP( fPercentDP );
|
|
||||||
hs.SetSurviveSeconds( randomf(30.0f, 100.0f) );
|
|
||||||
PlayerOptions po;
|
|
||||||
po.ChooseRandomModifiers();
|
|
||||||
hs.SetModifiers( po.GetString() );
|
|
||||||
hs.SetDateTime( DateTime::GetNowDateTime() );
|
|
||||||
hs.SetPlayerGuid( Profile::MakeGuid() );
|
|
||||||
hs.SetMachineGuid( Profile::MakeGuid() );
|
|
||||||
hs.SetProductID( rand()%10 );
|
|
||||||
FOREACH_TapNoteScore( tns )
|
|
||||||
hs.SetTapNoteScore( tns, rand() % 100 );
|
|
||||||
FOREACH_HoldNoteScore( hns )
|
|
||||||
hs.SetHoldNoteScore( hns, rand() % 100 );
|
|
||||||
RadarValues rv;
|
|
||||||
FOREACH_RadarCategory( rc )
|
|
||||||
rv.m_Values.f[rc] = randomf( 0, 1 );
|
|
||||||
hs.SetRadarValues( rv );
|
|
||||||
|
|
||||||
return hs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void FillProfile( Profile *pProfile )
|
|
||||||
{
|
|
||||||
// Choose a percent for all scores. This is useful for testing unlocks
|
|
||||||
// where some elements are unlocked at a certain percent complete
|
|
||||||
float fPercentDP = randomf( 0.6f, 1.2f );
|
|
||||||
CLAMP( fPercentDP, 0.0f, 1.0f );
|
|
||||||
|
|
||||||
int iCount = pProfile->IsMachine()?
|
|
||||||
PREFSMAN->m_iMaxHighScoresPerListForMachine.Get():
|
|
||||||
PREFSMAN->m_iMaxHighScoresPerListForPlayer.Get();
|
|
||||||
|
|
||||||
vector<Song*> vpAllSongs = SONGMAN->GetAllSongs();
|
|
||||||
FOREACH( Song*, vpAllSongs, pSong )
|
|
||||||
{
|
|
||||||
vector<Steps*> vpAllSteps = (*pSong)->GetAllSteps();
|
|
||||||
FOREACH( Steps*, vpAllSteps, pSteps )
|
|
||||||
{
|
|
||||||
pProfile->IncrementStepsPlayCount( *pSong, *pSteps );
|
|
||||||
for( int i=0; i<iCount; i++ )
|
|
||||||
{
|
|
||||||
int iIndex = 0;
|
|
||||||
pProfile->AddStepsHighScore( *pSong, *pSteps, MakeRandomHighScore(fPercentDP), iIndex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<Course*> vpAllCourses;
|
|
||||||
SONGMAN->GetAllCourses( vpAllCourses, true );
|
|
||||||
FOREACH( Course*, vpAllCourses, pCourse )
|
|
||||||
{
|
|
||||||
vector<Trail*> vpAllTrails;
|
|
||||||
(*pCourse)->GetAllTrails( vpAllTrails );
|
|
||||||
FOREACH( Trail*, vpAllTrails, pTrail )
|
|
||||||
{
|
|
||||||
pProfile->IncrementCoursePlayCount( *pCourse, *pTrail );
|
|
||||||
for( int i=0; i<iCount; i++ )
|
|
||||||
{
|
|
||||||
int iIndex = 0;
|
|
||||||
pProfile->AddCourseHighScore( *pCourse, *pTrail, MakeRandomHighScore(fPercentDP), iIndex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static LocalizedString MACHINE_STATS_FILLED( "ScreenServiceAction", "Machine stats filled." );
|
|
||||||
static CString FillMachineStats()
|
|
||||||
{
|
|
||||||
Profile* pProfile = PROFILEMAN->GetMachineProfile();
|
|
||||||
FillProfile( pProfile );
|
|
||||||
|
|
||||||
PROFILEMAN->SaveMachineProfile();
|
|
||||||
return MACHINE_STATS_FILLED.GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
static LocalizedString STATS_NOT_SAVED ( "ScreenServiceAction", "Stats not saved - No memory cards ready." );
|
static LocalizedString STATS_NOT_SAVED ( "ScreenServiceAction", "Stats not saved - No memory cards ready." );
|
||||||
static LocalizedString MACHINE_STATS_SAVED ( "ScreenServiceAction", "Machine stats saved to P%d card." );
|
static LocalizedString MACHINE_STATS_SAVED ( "ScreenServiceAction", "Machine stats saved to P%d card." );
|
||||||
@@ -461,7 +381,6 @@ void ScreenServiceAction::Init()
|
|||||||
else if( sAction == "ClearMachineStats" ) pfn = ClearMachineStats;
|
else if( sAction == "ClearMachineStats" ) pfn = ClearMachineStats;
|
||||||
else if( sAction == "ClearMachineEdits" ) pfn = ClearMachineEdits;
|
else if( sAction == "ClearMachineEdits" ) pfn = ClearMachineEdits;
|
||||||
else if( sAction == "ClearMemoryCardEdits" ) pfn = ClearMemoryCardEdits;
|
else if( sAction == "ClearMemoryCardEdits" ) pfn = ClearMemoryCardEdits;
|
||||||
else if( sAction == "FillMachineStats" ) pfn = FillMachineStats;
|
|
||||||
else if( sAction == "TransferStatsMachineToMemoryCard" ) pfn = TransferStatsMachineToMemoryCard;
|
else if( sAction == "TransferStatsMachineToMemoryCard" ) pfn = TransferStatsMachineToMemoryCard;
|
||||||
else if( sAction == "TransferStatsMemoryCardToMachine" ) pfn = TransferStatsMemoryCardToMachine;
|
else if( sAction == "TransferStatsMemoryCardToMachine" ) pfn = TransferStatsMemoryCardToMachine;
|
||||||
else if( sAction == "CopyEditsMachineToMemoryCard" ) pfn = CopyEditsMachineToMemoryCard;
|
else if( sAction == "CopyEditsMachineToMemoryCard" ) pfn = CopyEditsMachineToMemoryCard;
|
||||||
|
|||||||
Reference in New Issue
Block a user