diff --git a/src/engine/macroInt.cpp b/src/engine/macroInt.cpp index 1566b9438..36850818f 100644 --- a/src/engine/macroInt.cpp +++ b/src/engine/macroInt.cpp @@ -32,6 +32,18 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic had=false; return; } + if (delay>0) { + delay--; + return; + } + if (began && source.delay>0) { + delay=source.delay; + } else { + delay=source.speed-1; + } + if (began) { + began=false; + } if (finished) { finished=false; } diff --git a/src/engine/macroInt.h b/src/engine/macroInt.h index 8569dce42..ad761ba53 100644 --- a/src/engine/macroInt.h +++ b/src/engine/macroInt.h @@ -25,21 +25,24 @@ class DivEngine; struct DivMacroStruct { - int pos, lastPos; + int pos, lastPos, delay; int val; - bool has, had, actualHad, finished, will, linger; + bool has, had, actualHad, finished, will, linger, began; unsigned int mode; void doMacro(DivInstrumentMacro& source, bool released, bool tick); void init() { - pos=lastPos=mode=0; + pos=lastPos=mode=delay=0; has=had=actualHad=will=false; linger=false; + began=true; // TODO: test whether this breaks anything? val=0; } void prepare(DivInstrumentMacro& source, DivEngine* e); DivMacroStruct(): pos(0), + lastPos(0), + delay(0), val(0), has(false), had(false), @@ -47,6 +50,7 @@ struct DivMacroStruct { finished(false), will(false), linger(false), + began(false), mode(0) {} }; diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 2a97744ff..f7e80c535 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1245,6 +1245,27 @@ void FurnaceGUI::drawMacros(std::vector& macros) { if (macroLen>255) macroLen=255; i.macro->len=macroLen; } + if (ImGui::Button(ICON_FA_BAR_CHART "##IMacroType")) { + + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Coming soon!"); + } + ImGui::SameLine(); + ImGui::Button(ICON_FA_ELLIPSIS_H "##IMacroSet"); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Delay/Step Length"); + } + if (ImGui::BeginPopupContextItem("IMacroSetP",ImGuiPopupFlags_MouseButtonLeft)) { + if (ImGui::InputScalar("Step Length (ticks)##IMacroSpeed",ImGuiDataType_U8,&i.macro->speed,&_ONE,&_THREE)) { + if (i.macro->speed<1) i.macro->speed=1; + MARK_MODIFIED; + } + if (ImGui::InputScalar("Delay##IMacroDelay",ImGuiDataType_U8,&i.macro->delay,&_ONE,&_THREE)) { + MARK_MODIFIED; + } + ImGui::EndPopup(); + } // do not change this! // anything other than a checkbox will look ugly! // if you really need more than two macro modes please tell me.