save survival life seconds remaining in HighScore
show SurvivalLifeTime in Ranking
This commit is contained in:
@@ -509,6 +509,8 @@ public:
|
|||||||
static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); return 0; }
|
static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); return 0; }
|
||||||
static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); return 0; }
|
static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); return 0; }
|
||||||
static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); return 0; }
|
static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); return 0; }
|
||||||
|
static int basezoomx( T* p, lua_State *L ) { p->SetBaseZoomX(FArg(1)); return 0; }
|
||||||
|
static int basezoomy( T* p, lua_State *L ) { p->SetBaseZoomY(FArg(1)); return 0; }
|
||||||
static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; }
|
static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; }
|
||||||
static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); return 0; }
|
static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); return 0; }
|
||||||
static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); return 0; }
|
static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); return 0; }
|
||||||
@@ -628,6 +630,8 @@ public:
|
|||||||
ADD_METHOD( zoomto )
|
ADD_METHOD( zoomto )
|
||||||
ADD_METHOD( zoomtowidth )
|
ADD_METHOD( zoomtowidth )
|
||||||
ADD_METHOD( zoomtoheight )
|
ADD_METHOD( zoomtoheight )
|
||||||
|
ADD_METHOD( basezoomx )
|
||||||
|
ADD_METHOD( basezoomy )
|
||||||
ADD_METHOD( stretchto )
|
ADD_METHOD( stretchto )
|
||||||
ADD_METHOD( cropleft )
|
ADD_METHOD( cropleft )
|
||||||
ADD_METHOD( croptop )
|
ADD_METHOD( croptop )
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ XNode* HighScore::CreateNode() const
|
|||||||
if( hns != HNS_NONE ) // HACK: don't save meaningless "none" count
|
if( hns != HNS_NONE ) // HACK: don't save meaningless "none" count
|
||||||
pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
|
pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
|
||||||
pNode->AppendChild( radarValues.CreateNode() );
|
pNode->AppendChild( radarValues.CreateNode() );
|
||||||
|
pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds );
|
||||||
return pNode;
|
return pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +94,7 @@ void HighScore::LoadFromNode( const XNode* pNode )
|
|||||||
const XNode* pRadarValues = pNode->GetChild( "RadarValues" );
|
const XNode* pRadarValues = pNode->GetChild( "RadarValues" );
|
||||||
if( pRadarValues )
|
if( pRadarValues )
|
||||||
radarValues.LoadFromNode( pRadarValues );
|
radarValues.LoadFromNode( pRadarValues );
|
||||||
|
pNode->GetChildValue( "LifeRemainingSeconds", fLifeRemainingSeconds );
|
||||||
|
|
||||||
/* Validate input. */
|
/* Validate input. */
|
||||||
grade = clamp( grade, GRADE_TIER01, GRADE_FAILED );
|
grade = clamp( grade, GRADE_TIER01, GRADE_FAILED );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct HighScore
|
|||||||
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
|
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
|
||||||
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
|
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
|
||||||
RadarValues radarValues;
|
RadarValues radarValues;
|
||||||
|
float fLifeRemainingSeconds;
|
||||||
|
|
||||||
HighScore() { Unset(); }
|
HighScore() { Unset(); }
|
||||||
void Unset()
|
void Unset()
|
||||||
@@ -42,6 +43,7 @@ struct HighScore
|
|||||||
ZERO( iTapNoteScores );
|
ZERO( iTapNoteScores );
|
||||||
ZERO( iHoldNoteScores );
|
ZERO( iHoldNoteScores );
|
||||||
radarValues.MakeUnknown();
|
radarValues.MakeUnknown();
|
||||||
|
fLifeRemainingSeconds = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>=( const HighScore& other ) const;
|
bool operator>=( const HighScore& other ) const;
|
||||||
@@ -63,10 +65,13 @@ struct HighScore
|
|||||||
FOREACH_HoldNoteScore( hns )
|
FOREACH_HoldNoteScore( hns )
|
||||||
COMPARE( iHoldNoteScores[hns] );
|
COMPARE( iHoldNoteScores[hns] );
|
||||||
COMPARE( radarValues );
|
COMPARE( radarValues );
|
||||||
|
COMPARE( fLifeRemainingSeconds );
|
||||||
#undef COMPARE
|
#undef COMPARE
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GetSurvivalSeconds() { return fSurviveSeconds + fLifeRemainingSeconds; }
|
||||||
|
|
||||||
XNode* CreateNode() const;
|
XNode* CreateNode() const;
|
||||||
void LoadFromNode( const XNode* pNode );
|
void LoadFromNode( const XNode* pNode );
|
||||||
|
|
||||||
|
|||||||
@@ -467,10 +467,14 @@ public:
|
|||||||
LunaPlayerStageStats() { LUA->Register( Register ); }
|
LunaPlayerStageStats() { LUA->Register( Register ); }
|
||||||
|
|
||||||
static int GetCaloriesBurned( T* p, lua_State *L ) { lua_pushnumber(L, p->fCaloriesBurned ); return 1; }
|
static int GetCaloriesBurned( T* p, lua_State *L ) { lua_pushnumber(L, p->fCaloriesBurned ); return 1; }
|
||||||
|
static int GetLifeRemainingSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->fLifeRemainingSeconds); return 1; }
|
||||||
|
static int GetSurvivalSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSurvivalSeconds()); return 1; }
|
||||||
|
|
||||||
static void Register(lua_State *L)
|
static void Register(lua_State *L)
|
||||||
{
|
{
|
||||||
ADD_METHOD( GetCaloriesBurned )
|
ADD_METHOD( GetCaloriesBurned )
|
||||||
|
ADD_METHOD( GetLifeRemainingSeconds )
|
||||||
|
ADD_METHOD( GetSurvivalSeconds )
|
||||||
Luna<T>::Register( L );
|
Luna<T>::Register( L );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ struct PlayerStageStats
|
|||||||
void UpdateComboList( float fSecond, bool rollover );
|
void UpdateComboList( float fSecond, bool rollover );
|
||||||
Combo_t GetMaxCombo() const;
|
Combo_t GetMaxCombo() const;
|
||||||
|
|
||||||
|
float GetSurvivalSeconds() { return fAliveSeconds + fLifeRemainingSeconds; }
|
||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -138,6 +138,19 @@ CString SecondsToMMSSMsMs( float fSecs )
|
|||||||
return sReturn;
|
return sReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString SecondsToMSSMsMs( float fSecs )
|
||||||
|
{
|
||||||
|
const int iMinsDisplay = (int)fSecs/60;
|
||||||
|
const int iSecsDisplay = (int)fSecs - iMinsDisplay*60;
|
||||||
|
const int iLeftoverDisplay = (int) ( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100 );
|
||||||
|
CString sReturn = ssprintf( "%01d:%02d.%02d", iMinsDisplay, iSecsDisplay, min(99,iLeftoverDisplay) );
|
||||||
|
return sReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "LuaFunctions.h"
|
||||||
|
#include "LuaManager.h"
|
||||||
|
LuaFunction_Float( SecondsToMSSMsMs, SecondsToMSSMsMs(a1) )
|
||||||
|
|
||||||
CString SecondsToMMSSMsMsMs( float fSecs )
|
CString SecondsToMMSSMsMsMs( float fSecs )
|
||||||
{
|
{
|
||||||
const int iMinsDisplay = (int)fSecs/60;
|
const int iMinsDisplay = (int)fSecs/60;
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ bool IsAnInt( const CString &s );
|
|||||||
bool IsHexVal( const CString &s );
|
bool IsHexVal( const CString &s );
|
||||||
float HHMMSSToSeconds( const CString &sHMS );
|
float HHMMSSToSeconds( const CString &sHMS );
|
||||||
CString SecondsToHHMMSS( float fSecs );
|
CString SecondsToHHMMSS( float fSecs );
|
||||||
|
CString SecondsToMSSMsMs( float fSecs );
|
||||||
CString SecondsToMMSSMsMs( float fSecs );
|
CString SecondsToMMSSMsMs( float fSecs );
|
||||||
CString SecondsToMMSSMsMsMs( float fSecs );
|
CString SecondsToMMSSMsMsMs( float fSecs );
|
||||||
CString PrettyPercent( float fNumerator, float fDenominator );
|
CString PrettyPercent( float fNumerator, float fDenominator );
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ void ScoreDisplayLifeTime::Update( float fDelta )
|
|||||||
|
|
||||||
float fSecs = STATSMAN->m_CurStageStats.m_player[m_pPlayerState->m_PlayerNumber].fLifeRemainingSeconds;
|
float fSecs = STATSMAN->m_CurStageStats.m_player[m_pPlayerState->m_PlayerNumber].fLifeRemainingSeconds;
|
||||||
|
|
||||||
CString s = SecondsToMMSSMsMs(fSecs);
|
CString s = SecondsToMSSMsMs(fSecs);
|
||||||
s.erase( s.begin() ); // erase first digit
|
|
||||||
m_textTimeRemaining.SetText( s );
|
m_textTimeRemaining.SetText( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,49 +136,33 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : ScreenWithMenuElement
|
|||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f );
|
STATSMAN->m_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f );
|
||||||
}
|
}
|
||||||
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iActualDancePoints = rand()%3;
|
FOREACH_PlayerNumber( p )
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2;
|
{
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iActualDancePoints = rand()%2;
|
STATSMAN->m_CurStageStats.m_player[p].iActualDancePoints = rand()%3;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1;
|
STATSMAN->m_CurStageStats.m_player[p].iPossibleDancePoints = 2;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 0;
|
STATSMAN->m_CurStageStats.m_player[p].iCurCombo = 0;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false );
|
STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 0, false );
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 1;
|
STATSMAN->m_CurStageStats.m_player[p].iCurCombo = 1;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false );
|
STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 1, false );
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 50;
|
STATSMAN->m_CurStageStats.m_player[p].iCurCombo = 50;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false );
|
STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 25, false );
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 250;
|
STATSMAN->m_CurStageStats.m_player[p].iCurCombo = 250;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false );
|
STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 100, false );
|
||||||
if( rand()%2 )
|
if( rand()%2 )
|
||||||
{
|
{
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = rand()%11000;
|
STATSMAN->m_CurStageStats.m_player[p].iCurCombo = rand()%11000;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 110, false );
|
STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 110, false );
|
||||||
}
|
}
|
||||||
if( rand()%5 == 0 )
|
if( rand()%5 == 0 )
|
||||||
{
|
{
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].bFailedEarlier = true;
|
STATSMAN->m_CurStageStats.m_player[p].bFailedEarlier = true;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].bFailedEarlier = true;
|
|
||||||
}
|
}
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 0;
|
STATSMAN->m_CurStageStats.m_player[p].iTapNoteScores[TNS_MARVELOUS] = rand()%3;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 0, false );
|
STATSMAN->m_CurStageStats.m_player[p].iTapNoteScores[TNS_PERFECT] = rand()%3;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 1;
|
STATSMAN->m_CurStageStats.m_player[p].iTapNoteScores[TNS_GREAT] = rand()%3;
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 1, false );
|
STATSMAN->m_CurStageStats.m_player[p].fLifeRemainingSeconds = randomf( 90, 580 );
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 50;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 25, false );
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 250;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 100, false );
|
|
||||||
if( rand()%2 )
|
|
||||||
{
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = rand()%11000;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 110, false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_MARVELOUS] = rand()%3;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_PERFECT] = rand()%3;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_GREAT] = rand()%3;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_MARVELOUS] = rand()%3;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_PERFECT] = rand()%3;
|
|
||||||
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_GREAT] = rand()%3;
|
|
||||||
|
|
||||||
STATSMAN->m_vPlayedStageStats.clear();
|
STATSMAN->m_vPlayedStageStats.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -938,6 +922,8 @@ void ScreenEvaluation::CommitScores(
|
|||||||
memcpy( hs.iTapNoteScores, stageStats.m_player[p].iTapNoteScores, sizeof(hs.iTapNoteScores) );
|
memcpy( hs.iTapNoteScores, stageStats.m_player[p].iTapNoteScores, sizeof(hs.iTapNoteScores) );
|
||||||
memcpy( hs.iHoldNoteScores, stageStats.m_player[p].iHoldNoteScores, sizeof(hs.iHoldNoteScores) );
|
memcpy( hs.iHoldNoteScores, stageStats.m_player[p].iHoldNoteScores, sizeof(hs.iHoldNoteScores) );
|
||||||
hs.radarValues = stageStats.m_player[p].radarActual;
|
hs.radarValues = stageStats.m_player[p].radarActual;
|
||||||
|
hs.fLifeRemainingSeconds = stageStats.m_player[p].fLifeRemainingSeconds;
|
||||||
|
|
||||||
|
|
||||||
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName )
|
|||||||
SONG_SCORE_ROWS_TO_SHOW (m_sName,"SongScoreRowsToShow"),
|
SONG_SCORE_ROWS_TO_SHOW (m_sName,"SongScoreRowsToShow"),
|
||||||
SONG_SCORE_SECONDS_PER_ROW (m_sName,"SongScoreSecondsPerRow"),
|
SONG_SCORE_SECONDS_PER_ROW (m_sName,"SongScoreSecondsPerRow"),
|
||||||
MANUAL_SCROLLING (m_sName,"ManualScroling"),
|
MANUAL_SCROLLING (m_sName,"ManualScroling"),
|
||||||
|
SHOW_SURVIVAL_TIME (m_sName,"ShowSurvivalTime"),
|
||||||
|
|
||||||
BULLET_START_X (m_sName,"BulletStartX"),
|
BULLET_START_X (m_sName,"BulletStartX"),
|
||||||
BULLET_START_Y (m_sName,"BulletStartY"),
|
BULLET_START_Y (m_sName,"BulletStartY"),
|
||||||
@@ -871,6 +872,8 @@ float ScreenRanking::SetPage( PageToShow pts )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
||||||
|
if( SHOW_SURVIVAL_TIME )
|
||||||
|
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
|
||||||
pTextStepsScore->SetText( s );
|
pTextStepsScore->SetText( s );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -914,6 +917,8 @@ float ScreenRanking::SetPage( PageToShow pts )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.fPercentDP );
|
||||||
|
if( SHOW_SURVIVAL_TIME )
|
||||||
|
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
|
||||||
pTextStepsScore->SetText( s );
|
pTextStepsScore->SetText( s );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ protected:
|
|||||||
ThemeMetric<int> SONG_SCORE_ROWS_TO_SHOW;
|
ThemeMetric<int> SONG_SCORE_ROWS_TO_SHOW;
|
||||||
ThemeMetric<float> SONG_SCORE_SECONDS_PER_ROW;
|
ThemeMetric<float> SONG_SCORE_SECONDS_PER_ROW;
|
||||||
ThemeMetric<bool> MANUAL_SCROLLING;
|
ThemeMetric<bool> MANUAL_SCROLLING;
|
||||||
|
ThemeMetric<bool> SHOW_SURVIVAL_TIME;
|
||||||
|
|
||||||
ThemeMetric<float> BULLET_START_X;
|
ThemeMetric<float> BULLET_START_X;
|
||||||
ThemeMetric<float> BULLET_START_Y;
|
ThemeMetric<float> BULLET_START_Y;
|
||||||
|
|||||||
Reference in New Issue
Block a user