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:
Steve Checkoway
2006-07-09 20:20:57 +00:00
parent 04ad8b5a73
commit 3d83bdf906
2 changed files with 19 additions and 0 deletions
+16
View File
@@ -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 )
{
// 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;
}
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 )
{