[sm130score] Cleanup, lua prep.

This commit is contained in:
Jason Felds
2011-04-10 02:31:29 -04:00
parent 4c1cb1f85f
commit 9af85b48b1
2 changed files with 26 additions and 6 deletions
+23 -3
View File
@@ -234,7 +234,7 @@ float PlayerStageStats::MakePercentScore( int iActual, int iPossible )
int iPercentTotalDigits = 3 + CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES; // "100" + "." + "00"
// TRICKY: printf will round, but we want to truncate. therwise, we may display
// TRICKY: printf will round, but we want to truncate. Otherwise, we may display
// a percent score that's too high and doesn't match up with the calculated grade.
float fTruncInterval = powf( 0.1f, (float)iPercentTotalDigits-1 );
@@ -250,7 +250,9 @@ RString PlayerStageStats::FormatPercentScore( float fPercentDancePoints )
{
int iPercentTotalDigits = 3 + CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES; // "100" + "." + "00"
RString s = ssprintf( "%*.*f%%", iPercentTotalDigits, (int)CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES, fPercentDancePoints*100 );
RString s = ssprintf( "%*.*f%%", iPercentTotalDigits,
(int)CommonMetrics::PERCENT_SCORE_DECIMAL_PLACES,
fPercentDancePoints*100 );
return s;
}
@@ -725,7 +727,24 @@ public:
static int GetRadarPossible( T* p, lua_State *L ) { p->m_radarPossible.PushSelf(L); return 1; }
static int GetRadarActual( T* p, lua_State *L ) { p->m_radarActual.PushSelf(L); return 1; }
static int SetScore( T* p, lua_State *L ) { if( IArg(1) >= 0 ){ p->m_iScore = IArg(1); return 1; } return 0; }
static int SetScore( T* p, lua_State *L )
{
if( IArg(1) >= 0 )
{
p->m_iScore = IArg(1);
return 1;
}
return 0;
}
static int SetCurMaxScore( T* p, lua_State *L )
{
if( IArg(1) >= 0 )
{
p->m_iCurMaxScore = IArg(1);
return 1;
}
return 0;
}
LunaPlayerStageStats()
{
@@ -763,6 +782,7 @@ public:
ADD_METHOD( GetRadarPossible );
ADD_METHOD( GetBestFullComboTapNoteScore );
ADD_METHOD( SetScore );
ADD_METHOD( SetCurMaxScore );
}
};
+3 -3
View File
@@ -236,11 +236,11 @@ void ScoreKeeperNormal::OnNextSong( int iSongInCourseIndex, const Steps* pSteps,
m_iMaxPossiblePoints = (iMeter * iLengthMultiplier + 1) * 5000000;
break;
case SCORING_CUSTOM:
/* This is just simple additive/subtractive scoring, but cap the
* score at the size of the score counter */
/* This is no longer just simple additive/subtractive scoring,
* but start with capping the score at the size of the score counter. */
m_iMaxPossiblePoints = 10 * 10000000 * iLengthMultiplier;
break;
DEFAULT_FAIL( int(PREFSMAN->m_ScoringType) );
DEFAULT_FAIL( static_cast<int>(PREFSMAN->m_ScoringType) );
}
}
ASSERT( m_iMaxPossiblePoints >= 0 );