GUI: add "set effect" option to randomize

This commit is contained in:
tildearrow 2025-02-06 17:25:50 -05:00
parent 096d9ebba8
commit 4019066a64
3 changed files with 19 additions and 6 deletions

View file

@ -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;
}
}
}
}

View file

@ -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),

View file

@ -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);