experimental GH-style hold scoring

This commit is contained in:
Chris Danford
2007-01-05 01:20:32 +00:00
parent 35e4d3c295
commit 306cdf7ab5
7 changed files with 40 additions and 7 deletions
+3 -3
View File
@@ -36,13 +36,13 @@ struct HoldNoteResult
* 0.0 means this HoldNote is dead
* When this value hits 0.0 for the first time, m_HoldScore becomes HNS_LetGo.
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HNS_Held. */
float fLife;
float fLife;
/* Last index where fLife was greater than 0. If the tap was missed, this will
* be the first index of the hold. */
int iLastHeldRow;
bool bHeld;
bool bActive;
bool bHeld; // Was button held during last update?
bool bActive; // Is life > 0 && overlaps current beat
// XML
XNode* CreateNode() const;
+10
View File
@@ -741,6 +741,16 @@ void Player::Update( float fDeltaTime )
}
}
// TODO: Cap the active time passed to the score keeper to the actual start time and end time of the hold.
if( tn.HoldResult.bActive )
{
float fSecondsActiveSinceLastUpdate = fDeltaTime * GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
if( m_pPrimaryScoreKeeper )
m_pPrimaryScoreKeeper->HandleHoldActiveSeconds( fSecondsActiveSinceLastUpdate );
if( m_pSecondaryScoreKeeper )
m_pSecondaryScoreKeeper->HandleHoldActiveSeconds( fSecondsActiveSinceLastUpdate );
}
/* check for LetGo. If the head was missed completely, don't count an LetGo. */
if( bSteppedOnTapNote && fLife == 0 ) // the player has not pressed the button for a long time!
hns = HNS_LetGo;
+1
View File
@@ -55,6 +55,7 @@ public:
virtual void HandleTapScore( const TapNote &tn ) = 0;
virtual void HandleTapRowScore( const NoteData &nd, int iRow ) = 0;
virtual void HandleHoldScore( const TapNote &tn ) = 0;
virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ) = 0;
virtual void HandleTapScoreNone() = 0;
protected:
+21 -4
View File
@@ -7,6 +7,7 @@
ScoreKeeperGuitar::ScoreKeeperGuitar( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) :
ScoreKeeperNormal(pPlayerState, pPlayerStageStats)
{
m_fMusicSecondsHeldRemainder = 0;
}
void ScoreKeeperGuitar::AddTapScore( TapNoteScore tns )
@@ -15,10 +16,26 @@ void ScoreKeeperGuitar::AddTapScore( TapNoteScore tns )
void ScoreKeeperGuitar::AddHoldScore( HoldNoteScore hns )
{
if( hns == HNS_Held )
AddTapScore( TNS_W1 );
else if ( hns == HNS_LetGo )
AddTapScore( TNS_W4 ); // required for subtractive score display to work properly
}
void ScoreKeeperGuitar::HandleHoldActiveSeconds( float fMusicSecondsHeld )
{
int &iScore = m_pPlayerStageStats->m_iScore;
int &iCurMaxScore = m_pPlayerStageStats->m_iCurMaxScore;
const float fPointsPerSecond = 25;
const float fMusicSecondsHeldPlusRemainer = m_fMusicSecondsHeldRemainder + fMusicSecondsHeld;
const float fPoints = fMusicSecondsHeldPlusRemainer * fPointsPerSecond;
const int iPoints = (int)floorf( fPoints );
const float fPointsRemainder = fPoints - iPoints;
m_fMusicSecondsHeldRemainder = (fPointsRemainder) / fPointsPerSecond;
if( iPoints != 0 )
{
iScore += iPoints;
iCurMaxScore += iPoints;
MESSAGEMAN->Broadcast( Message_ScoreChangedP1 );
}
}
void ScoreKeeperGuitar::AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow )
+3
View File
@@ -12,7 +12,10 @@ public:
ScoreKeeperGuitar( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
virtual void AddTapScore( TapNoteScore score );
void AddHoldScore( HoldNoteScore hns );
void HandleHoldActiveSeconds( float fMusicSecondsHeld );
virtual void AddTapRowScore( TapNoteScore score, const NoteData &nd, int iRow );
protected:
float m_fMusicSecondsHeldRemainder; // seconds from a hold note that have not yet been counted toward CurScore
};
#endif
+1
View File
@@ -58,6 +58,7 @@ public:
void HandleTapScore( const TapNote &tn );
void HandleTapRowScore( const NoteData &nd, int iRow );
void HandleHoldScore( const TapNote &tn );
void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {};
// This must be calculated using only cached radar values so that we can
// do it quickly.
+1
View File
@@ -15,6 +15,7 @@ public:
void HandleTapScore( const TapNote &tn );
void HandleTapRowScore( const NoteData &nd, int iRow );
void HandleHoldScore( const TapNote &tn );
void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {}
void HandleTapScoreNone();
protected: