From 1c75c526141040d0a2066a2b89e8019cab9f3d5c Mon Sep 17 00:00:00 2001 From: Flameshadowxeroshin Date: Tue, 16 Jan 2018 22:06:32 -0600 Subject: [PATCH 1/2] Added NoteColorMode ProgressOnBeatAtEnd Almost the same as progress, but 4ths use the last frame rather than the first. This lets rainbow and vivid from DDR be made properly. --- src/NoteDisplay.cpp | 8 ++++++++ src/NoteDisplay.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index 65c5b52285..866238a6ec 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -41,6 +41,7 @@ LuaXType( NotePart ); static const char *NoteColorTypeNames[] = { "Denominator", "Progress", + "ProgressOnBeatAtEnd" }; XToString( NoteColorType ); StringToX( NoteColorType ); @@ -1331,6 +1332,13 @@ void NoteDisplay::DrawActor(const TapNote& tn, Actor* pActor, NotePart part, color = float( BeatToNoteType( fBeat ) ); color = clamp( color, 0, (cache->m_iNoteColorCount[part]-1) ); break; + case NoteColorType_ProgressOnBeatAtEnd: + //if we're at the very beginning of the beat, it should be the last color. + if ( fBeat-int64_t(fBeat) == 0.0f ) { + color = float(cache->m_iNoteColorCount[part]-1); + break; + } + //otherwise, handle it the same as Progress. case NoteColorType_Progress: color = fmodf( ceilf( fBeat * cache->m_iNoteColorCount[part] ), (float)cache->m_iNoteColorCount[part] ); break; diff --git a/src/NoteDisplay.h b/src/NoteDisplay.h index f8b1f9734f..28d842f2bf 100644 --- a/src/NoteDisplay.h +++ b/src/NoteDisplay.h @@ -36,6 +36,7 @@ enum NoteColorType { NoteColorType_Denominator, /**< Color by note type. */ NoteColorType_Progress, /**< Color by progress. */ + NoteColorType_ProgressOnBeatAtEnd, /**< Color by progress, except 4th notes are considered to occur at the end of the beat. */ NUM_NoteColorType, NoteColorType_Invalid }; From 529af138338487ca224ca299f97765416df9cfc7 Mon Sep 17 00:00:00 2001 From: Flameshadowxeroshin Date: Wed, 17 Jan 2018 00:20:10 -0600 Subject: [PATCH 2/2] ProgressAlternate back up one frame on boundaries --- src/NoteDisplay.cpp | 18 ++++++++++-------- src/NoteDisplay.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index 866238a6ec..8450f5ce19 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -41,7 +41,7 @@ LuaXType( NotePart ); static const char *NoteColorTypeNames[] = { "Denominator", "Progress", - "ProgressOnBeatAtEnd" + "ProgressAlternate" }; XToString( NoteColorType ); StringToX( NoteColorType ); @@ -1326,22 +1326,24 @@ void NoteDisplay::DrawActor(const TapNote& tn, Actor* pActor, NotePart part, { DISPLAY->TexturePushMatrix(); float color = 0.0f; + //this is only used for ProgressAlternate but must be declared here + float fScaledBeat = 0.0f; switch( cache->m_NoteColorType[part] ) { case NoteColorType_Denominator: color = float( BeatToNoteType( fBeat ) ); color = clamp( color, 0, (cache->m_iNoteColorCount[part]-1) ); break; - case NoteColorType_ProgressOnBeatAtEnd: - //if we're at the very beginning of the beat, it should be the last color. - if ( fBeat-int64_t(fBeat) == 0.0f ) { - color = float(cache->m_iNoteColorCount[part]-1); - break; - } - //otherwise, handle it the same as Progress. case NoteColorType_Progress: color = fmodf( ceilf( fBeat * cache->m_iNoteColorCount[part] ), (float)cache->m_iNoteColorCount[part] ); break; + case NoteColorType_ProgressAlternate: + fScaledBeat = fBeat * cache->m_iNoteColorCount[part]; + //knock it back into the last frame if it's on a boundary + if (fScaledBeat - int64_t(fScaledBeat) == 0.0f) + fScaledBeat -= 1.0f; + color = fmodf( ceilf( fScaledBeat ), (float)cache->m_iNoteColorCount[part] ); + break; default: FAIL_M(ssprintf("Invalid NoteColorType: %i", cache->m_NoteColorType[part])); } diff --git a/src/NoteDisplay.h b/src/NoteDisplay.h index 28d842f2bf..83833a3a4d 100644 --- a/src/NoteDisplay.h +++ b/src/NoteDisplay.h @@ -36,7 +36,7 @@ enum NoteColorType { NoteColorType_Denominator, /**< Color by note type. */ NoteColorType_Progress, /**< Color by progress. */ - NoteColorType_ProgressOnBeatAtEnd, /**< Color by progress, except 4th notes are considered to occur at the end of the beat. */ + NoteColorType_ProgressAlternate, /**< Color by progress, except the frame boundaries are slightly later. */ NUM_NoteColorType, NoteColorType_Invalid };