Allow one Player to share the NoteField of another Player. Also calculate the distance to the closest note or -1 if no note is close.
This commit is contained in:
@@ -443,6 +443,12 @@ void Player::Load( const NoteData& noteData )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::SetSharedNoteField( Player *pPlayer )
|
||||||
|
{
|
||||||
|
ASSERT( m_pNoteField );
|
||||||
|
m_pNoteField->SetSharedNoteField( pPlayer->m_pNoteField );
|
||||||
|
}
|
||||||
|
|
||||||
void Player::Update( float fDeltaTime )
|
void Player::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
// Don't update if we havn't been loaded yet.
|
// Don't update if we havn't been loaded yet.
|
||||||
@@ -923,6 +929,16 @@ int Player::GetClosestNote( int col, int iNoteRow, int iMaxRowsAhead, int iMaxRo
|
|||||||
return iNextIndex;
|
return iNextIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Player::GetClosestNoteDistance( int col, int row ) const
|
||||||
|
{
|
||||||
|
const int iStepSearchRows = BeatToNoteRow( StepSearchDistance * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate );
|
||||||
|
int iIndexOverlappingNote = GetClosestNote( col, row, iStepSearchRows, iStepSearchRows, false );
|
||||||
|
|
||||||
|
if( iIndexOverlappingNote <= 0 )
|
||||||
|
return iIndexOverlappingNote;
|
||||||
|
return abs( iIndexOverlappingNote - row );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::Step( int col, const RageTimer &tm, bool bHeld )
|
void Player::Step( int col, const RageTimer &tm, bool bHeld )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,10 +69,13 @@ public:
|
|||||||
void SetPaused( bool bPaused ) { m_bPaused = bPaused; }
|
void SetPaused( bool bPaused ) { m_bPaused = bPaused; }
|
||||||
|
|
||||||
float GetMaxStepDistanceSeconds();
|
float GetMaxStepDistanceSeconds();
|
||||||
|
// Returns -1 if no notes are close, otherwise return the distance to a nongraded note.
|
||||||
|
int GetClosestNoteDistance( int col, int row ) const;
|
||||||
|
|
||||||
NoteData m_NoteData;
|
NoteData m_NoteData;
|
||||||
|
|
||||||
bool HasNoteField() { return m_pNoteField != NULL; }
|
bool HasNoteField() { return m_pNoteField != NULL; }
|
||||||
|
void SetSharedNoteField( Player *pPlayer );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void HandleStep( int col, const RageTimer &tm, bool bHeld );
|
void HandleStep( int col, const RageTimer &tm, bool bHeld );
|
||||||
|
|||||||
Reference in New Issue
Block a user