diff --git a/src/gui/editing.cpp b/src/gui/editing.cpp index 181c8abd9..296674524 100644 --- a/src/gui/editing.cpp +++ b/src/gui/editing.cpp @@ -1427,7 +1427,7 @@ void FurnaceGUI::doScale(float top) { makeUndo(GUI_UNDO_PATTERN_SCALE); } -void FurnaceGUI::doRandomize(int bottom, int top, bool mode) { +void FurnaceGUI::doRandomize(int bottom, int top, bool mode, bool eff, int effVal) { finishSelection(); prepareUndo(GUI_UNDO_PATTERN_RANDOMIZE); @@ -1463,6 +1463,9 @@ void FurnaceGUI::doRandomize(int bottom, int top, bool mode) { } else { pat->data[j][iFine+1]=value; } + if (eff && iFine>2 && (iFine&1)) { + pat->data[j][iFine+1]=effVal; + } } } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9b5e6218a..74be097aa 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3166,9 +3166,17 @@ void FurnaceGUI::editOptions(bool topMenu) { if (randomizeMax>255) randomizeMax=255; } } - // TODO: add an option to set effect to specific value? + if (selStart.xFine>2 || selEnd.xFine>2 || selStart.xCoarse!=selEnd.xCoarse) { + ImGui::Checkbox(_("Set effect"),&randomizeEffect); + if (randomizeEffect) { + if (ImGui::InputScalar(_("Effect"),ImGuiDataType_S32,&randomizeEffectVal,&_ONE,&_SIXTEEN,"%.2X",ImGuiInputTextFlags_CharsHexadecimal)) { + if (randomizeEffectVal<0) randomizeEffectVal=0; + if (randomizeEffectVal>255) randomizeEffectVal=255; + } + } + } if (ImGui::Button(_("Randomize"))) { - doRandomize(randomizeMin,randomizeMax,randomMode); + doRandomize(randomizeMin,randomizeMax,randomMode,randomizeEffect,randomizeEffectVal); ImGui::CloseCurrentPopup(); } ImGui::EndMenu(); @@ -8671,11 +8679,13 @@ FurnaceGUI::FurnaceGUI(): fadeMin(0), fadeMax(255), collapseAmount(2), + randomizeEffectVal(0), playheadY(0.0f), scaleMax(100.0f), fadeMode(false), randomMode(false), haveHitBounds(false), + randomizeEffect(false), pendingStepUpdate(0), oldOrdersLen(0), sampleZoom(1.0), diff --git a/src/gui/gui.h b/src/gui/gui.h index a4bd2405a..ea4765bb1 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2548,10 +2548,10 @@ class FurnaceGUI { ImVec2 noteCellSize, insCellSize, volCellSize, effectCellSize, effectValCellSize; SelectionPoint sel1, sel2; int dummyRows; - int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax, collapseAmount; + int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax, collapseAmount, randomizeEffectVal; float playheadY; float scaleMax; - bool fadeMode, randomMode, haveHitBounds; + bool fadeMode, randomMode, haveHitBounds, randomizeEffect; signed char pendingStepUpdate; int oldOrdersLen; @@ -2986,7 +2986,7 @@ class FurnaceGUI { void doFade(int p0, int p1, bool mode); void doInvertValues(); void doScale(float top); - void doRandomize(int bottom, int top, bool mode); + void doRandomize(int bottom, int top, bool mode, bool eff, int effVal); void doFlip(); void doCollapse(int divider, const SelectionPoint& sStart, const SelectionPoint& sEnd); void doExpand(int multiplier, const SelectionPoint& sStart, const SelectionPoint& sEnd);