Merge branch 'master' of https://github.com/tildearrow/furnace
This commit is contained in:
commit
bcc85dee20
16 changed files with 457 additions and 75 deletions
|
|
@ -193,6 +193,26 @@ void FurnaceGUI::drawCompatFlags() {
|
|||
ImGui::SetTooltip("select to not reset channels on loop.");
|
||||
}
|
||||
|
||||
ImGui::Text("Cut/delay effect policy:");
|
||||
if (ImGui::RadioButton("Strict",e->song.delayBehavior==0)) {
|
||||
e->song.delayBehavior=0;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("only when time is less than speed (like DefleMask/ProTracker)");
|
||||
}
|
||||
if (ImGui::RadioButton("Strict (old)",e->song.delayBehavior==1)) {
|
||||
e->song.delayBehavior=1;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("only when time is less than or equal to speed (original buggy behavior)");
|
||||
}
|
||||
if (ImGui::RadioButton("Lax",e->song.delayBehavior==2)) {
|
||||
e->song.delayBehavior=2;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("no checks (like FamiTracker)");
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::TextWrapped("the following flags are for compatibility with older Furnace versions.");
|
||||
|
|
|
|||
|
|
@ -276,13 +276,13 @@ void FurnaceGUI::decodeMMLStrW(String& source, int* macro, int& macroLen, int ma
|
|||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::decodeMMLStr(String& source, int* macro, unsigned char& macroLen, signed char& macroLoop, int macroMin, int macroMax, signed char& macroRel) {
|
||||
void FurnaceGUI::decodeMMLStr(String& source, int* macro, unsigned char& macroLen, unsigned char& macroLoop, int macroMin, int macroMax, unsigned char& macroRel) {
|
||||
int buf=0;
|
||||
bool negaBuf=false;
|
||||
bool hasVal=false;
|
||||
macroLen=0;
|
||||
macroLoop=-1;
|
||||
macroRel=-1;
|
||||
macroLoop=255;
|
||||
macroRel=255;
|
||||
for (char& i: source) {
|
||||
switch (i) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
|
|
@ -318,7 +318,7 @@ void FurnaceGUI::decodeMMLStr(String& source, int* macro, unsigned char& macroLe
|
|||
macroLen++;
|
||||
buf=0;
|
||||
}
|
||||
if (macroLoop==-1) {
|
||||
if (macroLoop==255) {
|
||||
macroLoop=macroLen;
|
||||
}
|
||||
break;
|
||||
|
|
@ -332,14 +332,14 @@ void FurnaceGUI::decodeMMLStr(String& source, int* macro, unsigned char& macroLe
|
|||
macroLen++;
|
||||
buf=0;
|
||||
}
|
||||
if (macroRel==-1) {
|
||||
if (macroRel==255) {
|
||||
macroRel=macroLen;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (macroLen>=128) break;
|
||||
if (macroLen>=255) break;
|
||||
}
|
||||
if (hasVal && macroLen<128) {
|
||||
if (hasVal && macroLen<255) {
|
||||
hasVal=false;
|
||||
macro[macroLen]=negaBuf?-buf:buf;
|
||||
negaBuf=false;
|
||||
|
|
|
|||
|
|
@ -1409,7 +1409,7 @@ class FurnaceGUI {
|
|||
|
||||
ImVec2 macroLoopDragStart;
|
||||
ImVec2 macroLoopDragAreaSize;
|
||||
signed char* macroLoopDragTarget;
|
||||
unsigned char* macroLoopDragTarget;
|
||||
int macroLoopDragLen;
|
||||
bool macroLoopDragActive;
|
||||
|
||||
|
|
@ -1690,7 +1690,7 @@ class FurnaceGUI {
|
|||
void initSystemPresets();
|
||||
|
||||
void encodeMMLStr(String& target, int* macro, int macroLen, int macroLoop, int macroRel, bool hex=false);
|
||||
void decodeMMLStr(String& source, int* macro, unsigned char& macroLen, signed char& macroLoop, int macroMin, int macroMax, signed char& macroRel);
|
||||
void decodeMMLStr(String& source, int* macro, unsigned char& macroLen, unsigned char& macroLoop, int macroMin, int macroMax, unsigned char& macroRel);
|
||||
void decodeMMLStrW(String& source, int* macro, int& macroLen, int macroMax, bool hex=false);
|
||||
|
||||
String encodeKeyMap(std::map<int,int>& map);
|
||||
|
|
|
|||
|
|
@ -1215,14 +1215,14 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
}
|
||||
ImGui::TableNextColumn();
|
||||
float availableWidth=ImGui::GetContentRegionAvail().x-reservedSpace;
|
||||
int totalFit=MIN(128,availableWidth/MAX(1,macroPointSize*dpiScale));
|
||||
if (macroDragScroll>128-totalFit) {
|
||||
macroDragScroll=128-totalFit;
|
||||
int totalFit=MIN(255,availableWidth/MAX(1,macroPointSize*dpiScale));
|
||||
if (macroDragScroll>255-totalFit) {
|
||||
macroDragScroll=255-totalFit;
|
||||
}
|
||||
ImGui::SetNextItemWidth(availableWidth);
|
||||
if (CWSliderInt("##MacroScroll",¯oDragScroll,0,128-totalFit,"")) {
|
||||
if (CWSliderInt("##MacroScroll",¯oDragScroll,0,255-totalFit,"")) {
|
||||
if (macroDragScroll<0) macroDragScroll=0;
|
||||
if (macroDragScroll>128-totalFit) macroDragScroll=128-totalFit;
|
||||
if (macroDragScroll>255-totalFit) macroDragScroll=255-totalFit;
|
||||
}
|
||||
|
||||
// draw macros
|
||||
|
|
@ -1239,8 +1239,32 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
}
|
||||
if (i.macro->open) {
|
||||
ImGui::SetNextItemWidth(lenAvail);
|
||||
if (ImGui::InputScalar("##IMacroLen",ImGuiDataType_U8,&i.macro->len,&_ONE,&_THREE)) { MARK_MODIFIED
|
||||
if (i.macro->len>128) i.macro->len=128;
|
||||
int macroLen=i.macro->len;
|
||||
if (ImGui::InputScalar("##IMacroLen",ImGuiDataType_U8,¯oLen,&_ONE,&_THREE)) { MARK_MODIFIED
|
||||
if (macroLen<0) macroLen=0;
|
||||
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!
|
||||
|
|
@ -1267,7 +1291,7 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
if (j+macroDragScroll>=i.macro->len || (j+macroDragScroll>i.macro->rel && i.macro->loop<i.macro->rel)) {
|
||||
loopIndicator[j]=0;
|
||||
} else {
|
||||
loopIndicator[j]=((i.macro->loop!=-1 && (j+macroDragScroll)>=i.macro->loop))|((i.macro->rel!=-1 && (j+macroDragScroll)==i.macro->rel)<<1);
|
||||
loopIndicator[j]=((i.macro->loop!=255 && (j+macroDragScroll)>=i.macro->loop))|((i.macro->rel!=255 && (j+macroDragScroll)==i.macro->rel)<<1);
|
||||
}
|
||||
}
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f));
|
||||
|
|
@ -1414,9 +1438,9 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
}
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) {
|
||||
i.macro->rel=-1;
|
||||
i.macro->rel=255;
|
||||
} else {
|
||||
i.macro->loop=-1;
|
||||
i.macro->loop=255;
|
||||
}
|
||||
}
|
||||
ImGui::SetNextItemWidth(availableWidth);
|
||||
|
|
@ -1437,9 +1461,9 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(availableWidth);
|
||||
if (CWSliderInt("##MacroScroll",¯oDragScroll,0,128-totalFit,"")) {
|
||||
if (CWSliderInt("##MacroScroll",¯oDragScroll,0,255-totalFit,"")) {
|
||||
if (macroDragScroll<0) macroDragScroll=0;
|
||||
if (macroDragScroll>128-totalFit) macroDragScroll=128-totalFit;
|
||||
if (macroDragScroll>255-totalFit) macroDragScroll=255-totalFit;
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
|
@ -4311,8 +4335,8 @@ void FurnaceGUI::drawInsEdit() {
|
|||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("clear")) {
|
||||
lastMacroDesc.macro->len=0;
|
||||
lastMacroDesc.macro->loop=-1;
|
||||
lastMacroDesc.macro->rel=-1;
|
||||
lastMacroDesc.macro->loop=255;
|
||||
lastMacroDesc.macro->rel=255;
|
||||
for (int i=0; i<256; i++) {
|
||||
lastMacroDesc.macro->val[i]=0;
|
||||
}
|
||||
|
|
@ -4341,15 +4365,15 @@ void FurnaceGUI::drawInsEdit() {
|
|||
lastMacroDesc.macro->val[i]=val;
|
||||
}
|
||||
|
||||
if (lastMacroDesc.macro->loop>=0 && lastMacroDesc.macro->loop<lastMacroDesc.macro->len) {
|
||||
if (lastMacroDesc.macro->loop<lastMacroDesc.macro->len) {
|
||||
lastMacroDesc.macro->loop+=macroOffX;
|
||||
} else {
|
||||
lastMacroDesc.macro->loop=-1;
|
||||
lastMacroDesc.macro->loop=255;
|
||||
}
|
||||
if ((lastMacroDesc.macro->rel+macroOffX)>=0 && (lastMacroDesc.macro->rel+macroOffX)<lastMacroDesc.macro->len) {
|
||||
lastMacroDesc.macro->rel+=macroOffX;
|
||||
} else {
|
||||
lastMacroDesc.macro->rel=-1;
|
||||
lastMacroDesc.macro->rel=255;
|
||||
}
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue