make keysounds on hold notes work on pump mode.
This commit is contained in:
+46
-33
@@ -1291,6 +1291,8 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector<TrackRowTap
|
||||
}
|
||||
}
|
||||
|
||||
float fLifeFraction = fLife / MAX_HOLD_LIFE;
|
||||
|
||||
FOREACH( TrackRowTapNote, vTN, trtn )
|
||||
{
|
||||
TapNote &tn = *trtn->pTN;
|
||||
@@ -1303,15 +1305,11 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector<TrackRowTap
|
||||
{
|
||||
if( tn.subType == TapNote::hold_head_roll )
|
||||
{
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", max(0.0, min(1.0, fLife * 2.0)));
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", max(0.0, min(1.0, fLifeFraction * 2.0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", max(0.0, min(1.0, fLife * 10.0 - 8.5)));
|
||||
}
|
||||
if (tn.HoldResult.fLife == 0)
|
||||
{
|
||||
m_vKeysounds[tn.iKeysoundIndex].StopPlaying();
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", max(0.0, min(1.0, fLifeFraction * 10.0 - 8.5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1813,6 +1811,35 @@ void Player::ScoreAllActiveHoldsLetGo()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::PlayKeysound( const TapNote &tn, TapNoteScore score )
|
||||
{
|
||||
// tap note must have keysound
|
||||
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
||||
{
|
||||
// handle a case for hold notes
|
||||
if( tn.type == TapNote::hold_head )
|
||||
{
|
||||
// if the hold is not already held
|
||||
if( tn.HoldResult.hns == HNS_None )
|
||||
{
|
||||
// if the hold is already activated
|
||||
TapNoteScore tns = tn.result.tns;
|
||||
if( tns != TNS_None && tns != TNS_Miss && score == TNS_None )
|
||||
{
|
||||
// the sound must also be already playing
|
||||
if( m_vKeysounds[tn.iKeysoundIndex].IsPlaying() )
|
||||
{
|
||||
// if all of these conditions are met, don't play the sound.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_vKeysounds[tn.iKeysoundIndex].Play();
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, bool bRelease, Player::ButtonType pbt )
|
||||
{
|
||||
if( IsOniDead() )
|
||||
@@ -2461,37 +2488,23 @@ done_checking_hopo:
|
||||
}
|
||||
if( iRowOfOverlappingNoteOrRow != -1 )
|
||||
{
|
||||
bool bShouldPlayNextKeysound = true;
|
||||
|
||||
if( bShouldPlayNextKeysound )
|
||||
switch( pbt )
|
||||
{
|
||||
|
||||
switch( pbt )
|
||||
DEFAULT_FAIL(pbt);
|
||||
case ButtonType_StrumFretsChanged:
|
||||
for( int i=0; i<m_NoteData.GetNumTracks(); i++ )
|
||||
{
|
||||
DEFAULT_FAIL(pbt);
|
||||
case ButtonType_StrumFretsChanged:
|
||||
for( int i=0; i<m_NoteData.GetNumTracks(); i++ )
|
||||
{
|
||||
const TapNote &tn = m_NoteData.GetTapNote( i, iRowOfOverlappingNoteOrRow );
|
||||
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() && (tn.type != TapNote::hold_head || (!tn.HoldResult.bActive || (tn.HoldResult.fOverlappedTime == 0 || (tn.HoldResult.hns == HNS_Held)))) )
|
||||
{
|
||||
m_vKeysounds[tn.iKeysoundIndex].Play();
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ButtonType_Step:
|
||||
case ButtonType_Hopo:
|
||||
const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow );
|
||||
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() && (tn.type != TapNote::hold_head || (!tn.HoldResult.bActive || (tn.HoldResult.fOverlappedTime == 0 || (tn.HoldResult.hns == HNS_Held)))) )
|
||||
{
|
||||
m_vKeysounds[tn.iKeysoundIndex].Play();
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1);
|
||||
}
|
||||
break;
|
||||
const TapNote &tn = m_NoteData.GetTapNote( i, iRowOfOverlappingNoteOrRow );
|
||||
PlayKeysound( tn, score );
|
||||
}
|
||||
|
||||
break;
|
||||
case ButtonType_Step:
|
||||
case ButtonType_Hopo:
|
||||
const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow );
|
||||
PlayKeysound( tn, score );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// XXX:
|
||||
|
||||
Reference in New Issue
Block a user