start merging NoteDataWithScoring and NoteField per-hold and per-tap
data into TapNote and HoldNote. This reduces lookup costs significantly. It's a bit simpler, though I'm not entirely happy with the resulting encapsulation ...
This commit is contained in:
@@ -15,8 +15,6 @@ void NoteDataWithScoring::Init()
|
|||||||
|
|
||||||
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
||||||
m_TapNoteScores[t].clear();
|
m_TapNoteScores[t].clear();
|
||||||
|
|
||||||
m_HoldNoteScores.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
||||||
@@ -90,7 +88,7 @@ int NoteDataWithScoring::GetNumHoldNotesWithScore( HoldNoteScore hns, const floa
|
|||||||
const HoldNote &hn = GetHoldNote(i);
|
const HoldNote &hn = GetHoldNote(i);
|
||||||
if( iStartIndex > hn.iStartRow || hn.iEndRow > iEndIndex )
|
if( iStartIndex > hn.iStartRow || hn.iEndRow > iEndIndex )
|
||||||
continue;
|
continue;
|
||||||
if( GetHoldNoteScore(hn) == hns )
|
if( hn.result.hns == hns )
|
||||||
iNumSuccessfulHolds++;
|
iNumSuccessfulHolds++;
|
||||||
}
|
}
|
||||||
return iNumSuccessfulHolds;
|
return iNumSuccessfulHolds;
|
||||||
@@ -158,7 +156,6 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
|
|||||||
for( int j=0; j<GetNumHoldNotes(); j++ )
|
for( int j=0; j<GetNumHoldNotes(); j++ )
|
||||||
{
|
{
|
||||||
const HoldNote &hn = GetHoldNote(j);
|
const HoldNote &hn = GetHoldNote(j);
|
||||||
HoldNoteResult hnr = GetHoldNoteResult( hn );
|
|
||||||
|
|
||||||
/* Check if the row we're checking is in range. */
|
/* Check if the row we're checking is in range. */
|
||||||
if( !hn.RowIsInRange(i) )
|
if( !hn.RowIsInRange(i) )
|
||||||
@@ -169,7 +166,7 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
|
|||||||
* to be sure that the hold was still held at the point of this row.
|
* to be sure that the hold was still held at the point of this row.
|
||||||
* (Note that if the hold head tap was missed, then iLastHeldRow == i
|
* (Note that if the hold head tap was missed, then iLastHeldRow == i
|
||||||
* and this won't fail--but the tap check above will have already failed.) */
|
* and this won't fail--but the tap check above will have already failed.) */
|
||||||
if( hnr.iLastHeldRow < i )
|
if( hn.result.iLastHeldRow < i )
|
||||||
Missed = true;
|
Missed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,58 +365,6 @@ void NoteDataWithScoring::SetTapNoteOffset(unsigned track, unsigned row, float o
|
|||||||
m_TapNoteScores[track][row] = tnr;
|
m_TapNoteScores[track][row] = tnr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We use the end row to index hold notes, instead of the start row, because the start row
|
|
||||||
* changes when hold notes are being stepped on, but end rows never change. */
|
|
||||||
HoldNoteScore NoteDataWithScoring::GetHoldNoteScore( const HoldNote &hn ) const
|
|
||||||
{
|
|
||||||
return GetHoldNoteResult(hn).hns;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteDataWithScoring::SetHoldNoteScore( const HoldNote &hn, HoldNoteScore hns )
|
|
||||||
{
|
|
||||||
HoldNoteResult *hnr = CreateHoldNoteResult( hn );
|
|
||||||
hnr->hns = hns;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteDataWithScoring::SetHoldNoteLife( const HoldNote &hn, float f )
|
|
||||||
{
|
|
||||||
HoldNoteResult *hnr = CreateHoldNoteResult( hn );
|
|
||||||
hnr->fLife = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float NoteDataWithScoring::GetHoldNoteLife( const HoldNote &hn ) const
|
|
||||||
{
|
|
||||||
return GetHoldNoteResult(hn).fLife;
|
|
||||||
}
|
|
||||||
|
|
||||||
const HoldNoteResult NoteDataWithScoring::GetHoldNoteResult( const HoldNote &hn ) const
|
|
||||||
{
|
|
||||||
map<RowTrack, HoldNoteResult>::const_iterator it = m_HoldNoteScores.find( RowTrack(hn) );
|
|
||||||
if( it == m_HoldNoteScores.end() )
|
|
||||||
return HoldNoteResult(hn);
|
|
||||||
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
HoldNoteResult *NoteDataWithScoring::CreateHoldNoteResult( const HoldNote &hn )
|
|
||||||
{
|
|
||||||
map<RowTrack, HoldNoteResult>::iterator it = m_HoldNoteScores.find( RowTrack(hn) );
|
|
||||||
if( it == m_HoldNoteScores.end() )
|
|
||||||
{
|
|
||||||
HoldNoteResult *ret = &m_HoldNoteScores[hn];
|
|
||||||
ret->iLastHeldRow = hn.iStartRow;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return &it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
HoldNoteResult::HoldNoteResult( const HoldNote &hn )
|
|
||||||
{
|
|
||||||
hns = HNS_NONE;
|
|
||||||
fLife = 1.0f;
|
|
||||||
iLastHeldRow = hn.iStartRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -15,51 +15,10 @@ struct RowTrack: public pair<int,int>
|
|||||||
RowTrack( const HoldNote &hn ): pair<int,int>( hn.iEndRow, hn.iTrack ) { }
|
RowTrack( const HoldNote &hn ): pair<int,int>( hn.iEndRow, hn.iTrack ) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TapNoteResult
|
|
||||||
{
|
|
||||||
TapNoteResult()
|
|
||||||
{
|
|
||||||
tns = TNS_NONE;
|
|
||||||
fTapNoteOffset = 0;
|
|
||||||
}
|
|
||||||
TapNoteScore tns;
|
|
||||||
|
|
||||||
/* Offset, in seconds, for a tap grade. Negative numbers mean the note
|
|
||||||
* was hit early; positive numbers mean it was hit late. These values are
|
|
||||||
* only meaningful for graded taps (tns >= TNS_BOO). */
|
|
||||||
float fTapNoteOffset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct HoldNoteResult
|
|
||||||
{
|
|
||||||
HoldNoteScore hns;
|
|
||||||
|
|
||||||
/* 1.0 means this HoldNote has full life.
|
|
||||||
* 0.0 means this HoldNote is dead
|
|
||||||
* When this value hits 0.0 for the first time, m_HoldScore becomes HSS_NG.
|
|
||||||
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HSS_OK. */
|
|
||||||
float fLife;
|
|
||||||
|
|
||||||
/* Last index where fLife was greater than 0. If the tap was missed, this will
|
|
||||||
* be the first index of the hold. */
|
|
||||||
int iLastHeldRow;
|
|
||||||
|
|
||||||
HoldNoteResult()
|
|
||||||
{
|
|
||||||
hns = HNS_NONE;
|
|
||||||
fLife = 1.0f;
|
|
||||||
iLastHeldRow = 0;
|
|
||||||
}
|
|
||||||
HoldNoteResult( const HoldNote &hn );
|
|
||||||
|
|
||||||
float GetLastHeldBeat() const { return NoteRowToBeat(iLastHeldRow); }
|
|
||||||
};
|
|
||||||
|
|
||||||
class NoteDataWithScoring : public NoteData
|
class NoteDataWithScoring : public NoteData
|
||||||
{
|
{
|
||||||
// maintain this extra data in addition to the NoteData
|
// maintain this extra data in addition to the NoteData
|
||||||
vector<TapNoteResult> m_TapNoteScores[MAX_NOTE_TRACKS];
|
vector<TapNoteResult> m_TapNoteScores[MAX_NOTE_TRACKS];
|
||||||
map<RowTrack, HoldNoteResult> m_HoldNoteScores;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NoteDataWithScoring();
|
NoteDataWithScoring();
|
||||||
@@ -76,13 +35,6 @@ public:
|
|||||||
float GetTapNoteOffset(unsigned track, unsigned row) const;
|
float GetTapNoteOffset(unsigned track, unsigned row) const;
|
||||||
void SetTapNoteOffset(unsigned track, unsigned row, float offset);
|
void SetTapNoteOffset(unsigned track, unsigned row, float offset);
|
||||||
|
|
||||||
HoldNoteScore GetHoldNoteScore( const HoldNote &hn ) const;
|
|
||||||
void SetHoldNoteScore( const HoldNote &hn, HoldNoteScore hns );
|
|
||||||
float GetHoldNoteLife( const HoldNote &hn ) const;
|
|
||||||
void SetHoldNoteLife( const HoldNote &hn, float f );
|
|
||||||
const HoldNoteResult GetHoldNoteResult( const HoldNote &hn ) const;
|
|
||||||
HoldNoteResult *CreateHoldNoteResult( const HoldNote &hn );
|
|
||||||
|
|
||||||
bool IsRowCompletelyJudged(unsigned row) const;
|
bool IsRowCompletelyJudged(unsigned row) const;
|
||||||
TapNoteScore MinTapNoteScore(unsigned row) const;
|
TapNoteScore MinTapNoteScore(unsigned row) const;
|
||||||
int LastTapNoteScoreTrack(unsigned row) const;
|
int LastTapNoteScoreTrack(unsigned row) const;
|
||||||
|
|||||||
@@ -928,7 +928,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActiv
|
|||||||
|
|
||||||
int iCol = hn.iTrack;
|
int iCol = hn.iTrack;
|
||||||
bool bReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(iCol) > 0.5;
|
bool bReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(iCol) > 0.5;
|
||||||
float fStartYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, Result.GetLastHeldBeat() );
|
float fStartBeat = NoteRowToBeat( max(hn.result.iLastHeldRow, hn.iStartRow) );
|
||||||
|
float fStartYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, fStartBeat );
|
||||||
|
|
||||||
// HACK: If active, don't allow the top of the hold to go above the receptor
|
// HACK: If active, don't allow the top of the hold to go above the receptor
|
||||||
if( bIsActive )
|
if( bIsActive )
|
||||||
@@ -946,7 +947,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActiv
|
|||||||
/* Hack: Z effects need a finer grain step. */
|
/* Hack: Z effects need a finer grain step. */
|
||||||
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
||||||
|
|
||||||
const float fColorScale = 1*Result.fLife + (1-Result.fLife)*cache->m_fHoldNGGrayPercent;
|
const float fColorScale = 1*hn.result.fLife + (1-hn.result.fLife)*cache->m_fHoldNGGrayPercent;
|
||||||
|
|
||||||
bool bFlipHeadAndTail = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
bool bFlipHeadAndTail = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
||||||
|
|
||||||
|
|||||||
@@ -117,9 +117,6 @@ void NoteField::Load(
|
|||||||
|
|
||||||
NoteDataWithScoring::Init();
|
NoteDataWithScoring::Init();
|
||||||
|
|
||||||
m_HeldHoldNotes.clear();
|
|
||||||
m_ActiveHoldNotes.clear();
|
|
||||||
|
|
||||||
this->CopyAll( *pNoteData );
|
this->CopyAll( *pNoteData );
|
||||||
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer );
|
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer );
|
||||||
|
|
||||||
@@ -564,7 +561,7 @@ void NoteField::DrawPrimitives()
|
|||||||
if( hn.iTrack != c ) // this HoldNote doesn't belong to this column
|
if( hn.iTrack != c ) // this HoldNote doesn't belong to this column
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const HoldNoteResult Result = GetHoldNoteResult( hn );
|
const HoldNoteResult &Result = hn.result;
|
||||||
if( Result.hns == HNS_OK ) // if this HoldNote was completed
|
if( Result.hns == HNS_OK ) // if this HoldNote was completed
|
||||||
continue; // don't draw anything
|
continue; // don't draw anything
|
||||||
|
|
||||||
@@ -584,8 +581,8 @@ void NoteField::DrawPrimitives()
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool bIsActive = m_ActiveHoldNotes[hn];
|
const bool bIsActive = hn.bActive;
|
||||||
const bool bIsHoldingNote = m_HeldHoldNotes[hn];
|
const bool bIsHoldingNote = hn.bHeld;
|
||||||
if( bIsActive )
|
if( bIsActive )
|
||||||
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
|
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ public:
|
|||||||
float fYReverseOffsetPixels );
|
float fYReverseOffsetPixels );
|
||||||
virtual void Unload();
|
virtual void Unload();
|
||||||
|
|
||||||
map<RowTrack,bool> m_HeldHoldNotes; // true if button is being held down
|
|
||||||
map<RowTrack,bool> m_ActiveHoldNotes; // true if hold has life > 0
|
|
||||||
|
|
||||||
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
|
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
|
||||||
|
|
||||||
void FadeToFail();
|
void FadeToFail();
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ bool IsNoteOfType( int row, NoteType t )
|
|||||||
return GetNoteType(row) == t;
|
return GetNoteType(row) == t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float HoldNoteResult::GetLastHeldBeat() const
|
||||||
|
{
|
||||||
|
return NoteRowToBeat(iLastHeldRow);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -1,6 +1,48 @@
|
|||||||
#ifndef NOTE_TYPES_H
|
#ifndef NOTE_TYPES_H
|
||||||
#define NOTE_TYPES_H
|
#define NOTE_TYPES_H
|
||||||
|
|
||||||
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
|
struct TapNoteResult
|
||||||
|
{
|
||||||
|
TapNoteResult()
|
||||||
|
{
|
||||||
|
tns = TNS_NONE;
|
||||||
|
fTapNoteOffset = 0;
|
||||||
|
}
|
||||||
|
TapNoteScore tns;
|
||||||
|
|
||||||
|
/* Offset, in seconds, for a tap grade. Negative numbers mean the note
|
||||||
|
* was hit early; positive numbers mean it was hit late. These values are
|
||||||
|
* only meaningful for graded taps (tns >= TNS_BOO). */
|
||||||
|
float fTapNoteOffset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HoldNoteResult
|
||||||
|
{
|
||||||
|
HoldNoteScore hns;
|
||||||
|
|
||||||
|
/* 1.0 means this HoldNote has full life.
|
||||||
|
* 0.0 means this HoldNote is dead
|
||||||
|
* When this value hits 0.0 for the first time, m_HoldScore becomes HSS_NG.
|
||||||
|
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HSS_OK. */
|
||||||
|
float fLife;
|
||||||
|
|
||||||
|
/* Last index where fLife was greater than 0. If the tap was missed, this will
|
||||||
|
* be the first index of the hold. */
|
||||||
|
int iLastHeldRow;
|
||||||
|
|
||||||
|
HoldNoteResult()
|
||||||
|
{
|
||||||
|
hns = HNS_NONE;
|
||||||
|
fLife = 1.0f;
|
||||||
|
iLastHeldRow = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetLastHeldBeat() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct TapNote
|
struct TapNote
|
||||||
{
|
{
|
||||||
enum Type {
|
enum Type {
|
||||||
@@ -66,6 +108,10 @@ struct TapNote
|
|||||||
#undef COMPARE
|
#undef COMPARE
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
||||||
|
* here for the sake of efficiency. */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
|
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
|
||||||
@@ -125,7 +171,7 @@ inline float NoteRowToBeat( int row ) { return NoteRowToBeat( (float)row ); }
|
|||||||
|
|
||||||
struct HoldNote
|
struct HoldNote
|
||||||
{
|
{
|
||||||
HoldNote( int t, int s, int e ) { iTrack=t; iStartRow=s; iEndRow=e; }
|
HoldNote( int t, int s, int e ) { iTrack=t; iStartRow=s; iEndRow=e; bHeld = bActive = false; }
|
||||||
bool RowIsInRange( int row ) const { return iStartRow <= row && row <= iEndRow; }
|
bool RowIsInRange( int row ) const { return iStartRow <= row && row <= iEndRow; }
|
||||||
bool RangeOverlaps( int start, int end ) const
|
bool RangeOverlaps( int start, int end ) const
|
||||||
{
|
{
|
||||||
@@ -145,6 +191,12 @@ struct HoldNote
|
|||||||
int iStartRow;
|
int iStartRow;
|
||||||
int iEndRow;
|
int iEndRow;
|
||||||
int iTrack;
|
int iTrack;
|
||||||
|
|
||||||
|
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
||||||
|
* here for the sake of efficiency. */
|
||||||
|
HoldNoteResult result;
|
||||||
|
bool bHeld;
|
||||||
|
bool bActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+25
-20
@@ -340,16 +340,25 @@ void Player::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
for( int i=0; i < m_NoteData.GetNumHoldNotes(); i++ ) // for each HoldNote
|
for( int i=0; i < m_NoteData.GetNumHoldNotes(); i++ ) // for each HoldNote
|
||||||
{
|
{
|
||||||
const HoldNote &hn = m_NoteData.GetHoldNote(i);
|
HoldNote &hn = m_NoteData.GetHoldNote(i);
|
||||||
HoldNoteScore hns = m_NoteData.GetHoldNoteScore(hn);
|
|
||||||
|
|
||||||
|
/* Find the associated hold note in m_pNoteField. */
|
||||||
|
/* ack: this iterates over all hold notes */
|
||||||
|
int iHN = m_pNoteField->GetMatchingHoldNote( hn );
|
||||||
|
HoldNote &NoteFieldHoldNote = m_pNoteField->GetHoldNote( iHN );
|
||||||
|
|
||||||
|
|
||||||
|
// set hold flags so NoteField can do intelligent drawing
|
||||||
|
hn.bHeld = false;
|
||||||
|
hn.bActive = false;
|
||||||
if( m_pNoteField )
|
if( m_pNoteField )
|
||||||
{
|
{
|
||||||
m_pNoteField->m_HeldHoldNotes[hn] = false; // set hold flag so NoteField can do intelligent drawing
|
NoteFieldHoldNote.bHeld = false;
|
||||||
m_pNoteField->m_ActiveHoldNotes[hn] = false; // set hold flag so NoteField can do intelligent drawing
|
NoteFieldHoldNote.bActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HoldNoteScore hns = hn.result.hns;
|
||||||
if( hns != HNS_NONE ) // if this HoldNote already has a result
|
if( hns != HNS_NONE ) // if this HoldNote already has a result
|
||||||
continue; // we don't need to update the logic for this one
|
continue; // we don't need to update the logic for this one
|
||||||
if( iSongRow < hn.iStartRow )
|
if( iSongRow < hn.iStartRow )
|
||||||
@@ -365,38 +374,34 @@ void Player::Update( float fDeltaTime )
|
|||||||
const TapNoteScore tns = m_NoteData.GetTapNoteScore( hn.iTrack, hn.iStartRow );
|
const TapNoteScore tns = m_NoteData.GetTapNoteScore( hn.iTrack, hn.iStartRow );
|
||||||
const bool bSteppedOnTapNote = tns != TNS_NONE && tns != TNS_MISS; // did they step on the start of this hold?
|
const bool bSteppedOnTapNote = tns != TNS_NONE && tns != TNS_MISS; // did they step on the start of this hold?
|
||||||
|
|
||||||
float fLife = m_NoteData.GetHoldNoteLife(hn);
|
float fLife = hn.result.fLife;
|
||||||
|
|
||||||
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
||||||
// TODO: Make the CPU miss sometimes.
|
// TODO: Make the CPU miss sometimes.
|
||||||
if( m_pPlayerState->m_PlayerController != PC_HUMAN )
|
if( m_pPlayerState->m_PlayerController != PC_HUMAN )
|
||||||
bIsHoldingButton = true;
|
bIsHoldingButton = true;
|
||||||
|
|
||||||
if( bSteppedOnTapNote && bIsHoldingButton )
|
if( bSteppedOnTapNote && fLife != 0 )
|
||||||
{
|
{
|
||||||
/* This hold note is not judged and we stepped on its head. Update iLastHeldRow.
|
/* This hold note is not judged and we stepped on its head. Update iLastHeldRow.
|
||||||
* Do this even if we're a little beyond the end of the hold note, to make sure
|
* Do this even if we're a little beyond the end of the hold note, to make sure
|
||||||
* iLastHeldRow is clamped to iEndRow if the hold note is held all the way. */
|
* iLastHeldRow is clamped to iEndRow if the hold note is held all the way. */
|
||||||
HoldNoteResult *hnr = NULL;
|
|
||||||
|
|
||||||
if( m_pNoteField )
|
if( m_pNoteField )
|
||||||
{
|
NoteFieldHoldNote.result.iLastHeldRow = min( iSongRow, hn.iEndRow );
|
||||||
hnr = m_pNoteField->CreateHoldNoteResult( hn );
|
|
||||||
hnr->iLastHeldRow = min( iSongRow, hn.iEndRow );
|
|
||||||
}
|
|
||||||
|
|
||||||
hnr = m_NoteData.CreateHoldNoteResult( hn );
|
hn.result.iLastHeldRow = min( iSongRow, hn.iEndRow );
|
||||||
hnr->iLastHeldRow = min( iSongRow, hn.iEndRow );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the song beat is in the range of this hold:
|
// If the song beat is in the range of this hold:
|
||||||
if( hn.RowIsInRange(iSongRow) )
|
if( hn.RowIsInRange(iSongRow) )
|
||||||
{
|
{
|
||||||
// set hold flag so NoteField can do intelligent drawing
|
// set hold flag so NoteField can do intelligent drawing
|
||||||
|
hn.bHeld = bIsHoldingButton && bSteppedOnTapNote;
|
||||||
|
hn.bActive = bSteppedOnTapNote;
|
||||||
if( m_pNoteField )
|
if( m_pNoteField )
|
||||||
{
|
{
|
||||||
m_pNoteField->m_HeldHoldNotes[hn] = bIsHoldingButton && bSteppedOnTapNote;
|
NoteFieldHoldNote.bHeld = bIsHoldingButton && bSteppedOnTapNote;
|
||||||
m_pNoteField->m_ActiveHoldNotes[hn] = bSteppedOnTapNote;
|
NoteFieldHoldNote.bActive = bSteppedOnTapNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bSteppedOnTapNote && bIsHoldingButton )
|
if( bSteppedOnTapNote && bIsHoldingButton )
|
||||||
@@ -452,12 +457,12 @@ void Player::Update( float fDeltaTime )
|
|||||||
|
|
||||||
if( m_pNoteField )
|
if( m_pNoteField )
|
||||||
{
|
{
|
||||||
m_pNoteField->SetHoldNoteLife(hn, fLife); // update the NoteField display
|
NoteFieldHoldNote.result.fLife = fLife;
|
||||||
m_pNoteField->SetHoldNoteScore(hn, hns); // update the NoteField display
|
NoteFieldHoldNote.result.hns = hns;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NoteData.SetHoldNoteLife(hn, fLife);
|
hn.result.fLife = fLife;
|
||||||
m_NoteData.SetHoldNoteScore(hn, hns);
|
hn.result.hns = hns;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove use of PlayerNumber.
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
|||||||
Reference in New Issue
Block a user