show hopo-possible notes with addition coloring

This commit is contained in:
Chris Danford
2006-12-01 14:18:18 +00:00
parent e58c980aef
commit 8dad4f1ac1
7 changed files with 60 additions and 14 deletions
+11
View File
@@ -290,6 +290,17 @@ int NoteData::GetFirstTrackWithTapOrHoldHead( int row ) const
return -1;
}
int NoteData::GetLastTrackWithTapOrHoldHead( int row ) const
{
for( int t=GetNumTracks()-1; t>=0; t-- )
{
const TapNote &tn = GetTapNote( t, row );
if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
return t;
}
return -1;
}
void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
{
ASSERT( iStartRow>=0 && iEndRow>=0 );
+3
View File
@@ -8,6 +8,8 @@
#include <set>
#include <iterator>
static const float HOPO_CHAIN_SECONDS = 0.5f;
#define FOREACH_NONEMPTY_ROW_IN_TRACK( nd, track, row ) \
for( int row = -1; (nd).GetNextTapNoteRowForTrack(track,row); )
#define FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( nd, track, row, start, last ) \
@@ -164,6 +166,7 @@ public:
int GetNumTracksWithTapOrHoldHead( int row ) const;
int GetFirstTrackWithTap( int row ) const;
int GetFirstTrackWithTapOrHoldHead( int row ) const;
int GetLastTrackWithTapOrHoldHead( int row ) const;
inline bool IsThereATapAtRow( int row ) const { return GetFirstTrackWithTap( row ) != -1; }
inline bool IsThereATapOrHoldHeadAtRow( int row ) const { return GetFirstTrackWithTapOrHoldHead( row ) != -1; }
+36 -10
View File
@@ -686,17 +686,17 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
{
switch( rc )
{
case RadarCategory_Stream: out[rc] = GetStreamRadarValue( in, fSongSeconds ); break;
case RadarCategory_Voltage: out[rc] = GetVoltageRadarValue( in, fSongSeconds ); break;
case RadarCategory_Air: out[rc] = GetAirRadarValue( in, fSongSeconds ); break;
case RadarCategory_Freeze: out[rc] = GetFreezeRadarValue( in, fSongSeconds ); break;
case RadarCategory_Chaos: out[rc] = GetChaosRadarValue( in, fSongSeconds ); break;
case RadarCategory_Stream: out[rc] = GetStreamRadarValue( in, fSongSeconds ); break;
case RadarCategory_Voltage: out[rc] = GetVoltageRadarValue( in, fSongSeconds ); break;
case RadarCategory_Air: out[rc] = GetAirRadarValue( in, fSongSeconds ); break;
case RadarCategory_Freeze: out[rc] = GetFreezeRadarValue( in, fSongSeconds ); break;
case RadarCategory_Chaos: out[rc] = GetChaosRadarValue( in, fSongSeconds ); break;
case RadarCategory_TapsAndHolds: out[rc] = (float) in.GetNumRowsWithTapOrHoldHead(); break;
case RadarCategory_Jumps: out[rc] = (float) in.GetNumJumps(); break;
case RadarCategory_Holds: out[rc] = (float) in.GetNumHoldNotes(); break;
case RadarCategory_Mines: out[rc] = (float) in.GetNumMines(); break;
case RadarCategory_Hands: out[rc] = (float) in.GetNumHands(); break;
case RadarCategory_Rolls: out[rc] = (float) in.GetNumRolls(); break;
case RadarCategory_Jumps: out[rc] = (float) in.GetNumJumps(); break;
case RadarCategory_Holds: out[rc] = (float) in.GetNumHoldNotes(); break;
case RadarCategory_Mines: out[rc] = (float) in.GetNumMines(); break;
case RadarCategory_Hands: out[rc] = (float) in.GetNumHands(); break;
case RadarCategory_Rolls: out[rc] = (float) in.GetNumRolls(); break;
default: ASSERT(0);
}
}
@@ -2179,6 +2179,32 @@ bool NoteDataUtil::GetPrevEditorPosition( const NoteData& in, int &rowInOut )
return true;
}
void NoteDataUtil::SetHopoPossibleFlags( const Song *pSong, NoteData& ndInOut )
{
float fLastRowMusicSeconds = -1;
int iLastTapTrackOfLastRow = -1;
FOREACH_NONEMPTY_ROW_ALL_TRACKS( ndInOut, r )
{
float fBeat = NoteRowToBeat( r );
float fSeconds = pSong->GetElapsedTimeFromBeat( fBeat );
int iLastTapTrack = ndInOut.GetLastTrackWithTapOrHoldHead( r );
if( iLastTapTrack != -1 && fSeconds <= fLastRowMusicSeconds + HOPO_CHAIN_SECONDS )
{
int iNumNotesInRow = ndInOut.GetNumTapNotesInRow( r );
TapNote &tn = ndInOut.FindTapNote( iLastTapTrack, r )->second;
if( iNumNotesInRow == 1 && iLastTapTrack != iLastTapTrackOfLastRow )
{
tn.bHopoPossible = true;
}
}
fLastRowMusicSeconds = fSeconds;
iLastTapTrackOfLastRow = iLastTapTrack;
}
}
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
+2
View File
@@ -116,6 +116,8 @@ namespace NoteDataUtil
bool GetNextEditorPosition( const NoteData& in, int &rowInOut );
bool GetPrevEditorPosition( const NoteData& in, int &rowInOut );
void SetHopoPossibleFlags( const Song *pSong, NoteData& ndInOut );
};
#endif
+3 -1
View File
@@ -842,6 +842,8 @@ void NoteField::DrawPrimitives()
bIsInSelectionRange = m_iBeginMarker<=i && i<m_iEndMarker;
bool bIsAddition = (tn.source == TapNote::addition);
bool bIsHopoPossible = (tn.bHopoPossible);
bool bUseAdditionColoring = bIsAddition || bIsHopoPossible;
bool bIsMine = (tn.type == TapNote::mine);
bool bIsAttack = (tn.type == TapNote::attack);
bool bIsLift = (tn.type == TapNote::lift);
@@ -856,7 +858,7 @@ void NoteField::DrawPrimitives()
}
else
{
displayCols->display[c].DrawTap( c, NoteRowToBeat(i), bHoldNoteBeginsOnThisBeat, bIsAddition, bIsMine, bIsLift, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, iDrawDistanceBeforeTargetsPixels, FADE_BEFORE_TARGETS_PERCENT );
displayCols->display[c].DrawTap( c, NoteRowToBeat(i), bHoldNoteBeginsOnThisBeat, bUseAdditionColoring, bIsMine, bIsLift, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, iDrawDistanceBeforeTargetsPixels, FADE_BEFORE_TARGETS_PERCENT );
}
}
}
+2 -1
View File
@@ -97,6 +97,7 @@ struct TapNote
Source source;
TapNoteResult result;
PlayerNumber pn;
bool bHopoPossible;
// attack only
RString sAttackModifiers;
@@ -113,7 +114,7 @@ struct TapNote
XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode );
TapNote() : type(empty), subType(SubType_invalid), source(original), pn(PLAYER_INVALID),
TapNote() : type(empty), subType(SubType_invalid), source(original), pn(PLAYER_INVALID), bHopoPossible(false),
fAttackDurationSeconds(0.f), iKeysoundIndex(-1), iDuration(0) { }
TapNote(
Type type_,
+3 -2
View File
@@ -48,7 +48,6 @@ RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ) { return "AttackDis
/* Distance to search for a note in Step(), in seconds. */
static const float StepSearchDistance = 1.0f;
static const float JUMP_WINDOW_SECONDS = 0.25f;
static const float HOPO_CHAIN_SECONDS = 0.5f;
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut )
{
@@ -392,6 +391,9 @@ void Player::Load()
/* Apply transforms. */
NoteDataUtil::TransformNoteData( m_NoteData, m_pPlayerState->m_PlayerOptions.GetStage(), GAMESTATE->GetCurrentStyle()->m_StepsType );
const Song* pSong = GAMESTATE->m_pCurSong;
NoteDataUtil::SetHopoPossibleFlags( pSong, m_NoteData );
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_RAVE:
@@ -459,7 +461,6 @@ void Player::Load()
// We don't have to load separate copies to set player fade: always make a copy, and set the
// fade on the copy.
//
const Song* pSong = GAMESTATE->m_pCurSong;
RString sSongDir = pSong->GetSongDir();
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );