Handle timestamps in Step.
This commit is contained in:
@@ -394,7 +394,8 @@ int Player::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fM
|
|||||||
return Fwd;
|
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
|
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead
|
||||||
return; // do nothing
|
return; // do nothing
|
||||||
@@ -414,14 +415,20 @@ void Player::Step( int col )
|
|||||||
if( iIndexOverlappingNote != -1 )
|
if( iIndexOverlappingNote != -1 )
|
||||||
{
|
{
|
||||||
// compute the score for this hit
|
// 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:
|
// 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
|
// calculate TapNoteScore
|
||||||
TapNoteScore score;
|
TapNoteScore score;
|
||||||
@@ -606,10 +613,13 @@ void Player::CrossedRow( int iNoteRow )
|
|||||||
RandomiseNotes( iNoteRow );
|
RandomiseNotes( iNoteRow );
|
||||||
|
|
||||||
// check to see if there's at the crossed row
|
// check to see if there's at the crossed row
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
RageTimer now;
|
||||||
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
|
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
|
||||||
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
|
{
|
||||||
Step( t );
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
|
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
|
||||||
|
Step( t, now );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::RandomiseNotes( int iNoteRow )
|
void Player::RandomiseNotes( int iNoteRow )
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include "GhostArrowRow.h"
|
#include "GhostArrowRow.h"
|
||||||
#include "NoteDataWithScoring.h"
|
#include "NoteDataWithScoring.h"
|
||||||
#include "ArrowBackdrop.h"
|
#include "ArrowBackdrop.h"
|
||||||
|
#include "RageTimer.h"
|
||||||
|
|
||||||
class ScoreDisplay;
|
class ScoreDisplay;
|
||||||
class LifeMeter;
|
class LifeMeter;
|
||||||
class CombinedLifeMeter;
|
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 Load( PlayerNumber player_no, NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScore, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper );
|
||||||
void CrossedRow( int iNoteRow );
|
void CrossedRow( int iNoteRow );
|
||||||
void Step( int col );
|
void Step( int col, RageTimer tm );
|
||||||
void RandomiseNotes( int iNoteRow );
|
void RandomiseNotes( int iNoteRow );
|
||||||
void FadeToFail();
|
void FadeToFail();
|
||||||
void DontShowJudgement() { m_bShowJudgment = false; } // Used in ScreenHowToPlay
|
void DontShowJudgement() { m_bShowJudgment = false; } // Used in ScreenHowToPlay
|
||||||
|
|||||||
@@ -1062,10 +1062,10 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
|
|
||||||
switch( StyleI.player )
|
switch( StyleI.player )
|
||||||
{
|
{
|
||||||
case PLAYER_1:
|
case PLAYER_1:
|
||||||
if( !PREFSMAN->m_bAutoPlay )
|
if( !PREFSMAN->m_bAutoPlay )
|
||||||
m_Player.Step( StyleI.col );
|
m_Player.Step( StyleI.col, DeviceI.ts );
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1330,7 +1330,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
StyleI.IsValid() &&
|
StyleI.IsValid() &&
|
||||||
GAMESTATE->IsPlayerEnabled( StyleI.player ) )
|
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 &&
|
else if( type==IET_FIRST_PRESS &&
|
||||||
!PREFSMAN->m_bAutoPlay &&
|
!PREFSMAN->m_bAutoPlay &&
|
||||||
|
|||||||
Reference in New Issue
Block a user