Skip to content

Commit

Permalink
Daniel/orbit/blend and randomizer fix (#206)
Browse files Browse the repository at this point in the history
* fix blend flips and randomizer
* recorded tests
  • Loading branch information
Unreal-Dan authored Jan 13, 2024
1 parent fd082a6 commit e9a04ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions VortexEngine/src/Menus/MenuList/Randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,13 @@ bool Randomizer::rollCustomPattern(Random &ctx, Mode *pMode, LedPos pos)
// colors instead of blinking each color in the set
if (!ctx.next8(0, 3)) {
newPat = PATTERN_BLEND;
// this is the number of blinks to a complementary color
args.arg7 = ctx.next8(0, 3);
// set the blend speed
args.arg6 = ctx.next8(1, 10);
// 1/2 chance to make the blend a flipping blend of some kind
if (!ctx.next8(0, 2)) {
// this is the number of blinks to a complementary color
args.arg7 = ctx.next8(0, 3);
}
// up to arg7 is filled now
args.numArgs = 7;
}
Expand Down
5 changes: 4 additions & 1 deletion VortexEngine/src/Patterns/Single/BlendPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ void BlendPattern::onBlinkOn()
interpolate(m_cur.green, m_next.green);
interpolate(m_cur.blue, m_next.blue);
RGBColor col = m_cur;
if (m_flip) {
// it should be impossible for m_numFlips to be 0 and m_flip to be 1
// unless the pattern arg is changed mid-play which could happen with
// and editor or something, so check both for 0
if (m_flip && m_numFlips) {
// convert to hsv
HSVColor hsvCol = m_cur;
// shift the hue by a flip size
Expand Down

0 comments on commit e9a04ca

Please sign in to comment.