Handle timestamps in Step.

This commit is contained in:
Glenn Maynard
2003-07-13 00:34:30 +00:00
parent 6fb42b9bab
commit 350ce47a00
4 changed files with 27 additions and 15 deletions
+19 -9
View File
@@ -394,7 +394,8 @@ int Player::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fM
return Fwd;
}
void Player::Step( int col )
void Player::Step( int col, RageTimer tm )
{
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead
return; // do nothing
@@ -414,14 +415,20 @@ void Player::Step( int col )
if( iIndexOverlappingNote != -1 )
{
// compute the score for this hit
float fStepBeat = NoteRowToBeat( (float)iIndexOverlappingNote );
const float fStepBeat = NoteRowToBeat( (float)iIndexOverlappingNote );
float fStepSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fStepBeat);
const float fStepSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fStepBeat);
/* XXX: Double-check that we're handling m_fMusicRate correctly. */
/* We actually stepped on the note this long ago: */
const float fAgo = tm.Ago();
/* ... which means it happened at this point in the music: */
const float fMusicSeconds = GAMESTATE->m_fMusicSeconds - (fAgo / GAMESTATE->m_SongOptions.m_fMusicRate);
// The offset from the actual step in seconds:
float fNoteOffset = fStepSeconds - GAMESTATE->m_fMusicSeconds;
const float fNoteOffset = fStepSeconds - fMusicSeconds;
float fSecondsFromPerfect = fabsf( fNoteOffset ) / GAMESTATE->m_SongOptions.m_fMusicRate; // account for music rate
const float fSecondsFromPerfect = fabsf( fNoteOffset ) / GAMESTATE->m_SongOptions.m_fMusicRate; // account for music rate
// calculate TapNoteScore
TapNoteScore score;
@@ -606,10 +613,13 @@ void Player::CrossedRow( int iNoteRow )
RandomiseNotes( iNoteRow );
// check to see if there's at the crossed row
for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
Step( t );
RageTimer now;
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
{
for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
Step( t, now );
}
}
void Player::RandomiseNotes( int iNoteRow )
+3 -1
View File
@@ -30,6 +30,8 @@
#include "GhostArrowRow.h"
#include "NoteDataWithScoring.h"
#include "ArrowBackdrop.h"
#include "RageTimer.h"
class ScoreDisplay;
class LifeMeter;
class CombinedLifeMeter;
@@ -50,7 +52,7 @@ public:
void Load( PlayerNumber player_no, NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScore, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper );
void CrossedRow( int iNoteRow );
void Step( int col );
void Step( int col, RageTimer tm );
void RandomiseNotes( int iNoteRow );
void FadeToFail();
void DontShowJudgement() { m_bShowJudgment = false; } // Used in ScreenHowToPlay
+4 -4
View File
@@ -1062,10 +1062,10 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
switch( StyleI.player )
{
case PLAYER_1:
if( !PREFSMAN->m_bAutoPlay )
m_Player.Step( StyleI.col );
return;
case PLAYER_1:
if( !PREFSMAN->m_bAutoPlay )
m_Player.Step( StyleI.col, DeviceI.ts );
break;
}
}
+1 -1
View File
@@ -1330,7 +1330,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
StyleI.IsValid() &&
GAMESTATE->IsPlayerEnabled( StyleI.player ) )
{
m_Player[StyleI.player].Step( StyleI.col );
m_Player[StyleI.player].Step( StyleI.col, DeviceI.ts );
}
else if( type==IET_FIRST_PRESS &&
!PREFSMAN->m_bAutoPlay &&