Commit 0ca9dc40 authored by 16서원빈's avatar 16서원빈

Updated motion keys, short/long motion check, and fixed underflow issue

parent bb48d3ba
No preview for this file type
......@@ -24,20 +24,38 @@ namespace ButtonPusherEditor
///////////////////////////////////////// SMO
CP = 0b10000000000000000000000000000100,
JP = 0b01000000000000000000000000000100,
PU = 0b00100000000000000000000000000100,
PI = 0b00010000000000000000000000000100,
GD = 0b00001000000000000000000000000100,
BP = 0b00100000000000000000000000000100,
LP = 0b00010000000000000000000000000100,
RP = 0b00001000000000000000000000000100,
BK = 0b00000100000000000000000000000100,
LK = 0b00000010000000000000000000000100,
RK = 0b00000001000000000000000000000100,
BI = 0b00000000100000000000000000000100,
LI = 0b00000000010000000000000000000100,
RI = 0b00000000001000000000000000000100,
BG = 0b00000000000100000000000000000100,
LG = 0b00000000000010000000000000000100,
RG = 0b00000000000001000000000000000100,
BL = 0b00000000000000100000000000000100,
LL = 0b00000000000000010000000000000100,
RL = 0b00000000000000001000000000000100,
/////////////////////////////////////////L MO
HU = 0b00000000000000000000000100001000,
HD = 0b00000000000000000000000010001000,
JS = 0b00000000000000000000000001001000,
HP = 0b00000000000000000000000000101000,
BU = 0b00000000000000000100000000001000,
LU = 0b00000000000000000010000000001000,
RU = 0b00000000000000000001000000001000,
BD = 0b00000000000000000000100000001000,
LD = 0b00000000000000000000010000001000,
RD = 0b00000000000000000000001000001000,
JS = 0b00000000000000000000000100001000,
BH = 0b00000000000000000000000010001000,
LH = 0b00000000000000000000000001001000,
RH = 0b00000000000000000000000000101000,
OT = 0b00000000000000000000000000011000,
// Reset ////SSSSSSSSSSSSSSLLLLLLLLLLLLLLCCCC
SMOReset = 0b00000000000000111111111111111011,
LMOReset = 0b11111111111111000000000000000111
// Reset ////SSSSSSSSSSSSSSSSSLLLLLLLLLLLCCCC
SMOReset = 0b00000000000000000111111111111011,
LMOReset = 0b11111111111111111000000000000111
}
public partial class Form1 : Form
......@@ -117,14 +135,17 @@ namespace ButtonPusherEditor
DrawMeasures();
}
private void SelectNote(bool isMotion, int posX, int posEndX = -1)
private void SelectNote(bool isMotion, int posX, int? posEndX = null)
{
if (posEndX == -1)
if (posEndX == null)
posEndX = posX;
else if (posX > posEndX)
else if (posEndX.Value < 0)
posEndX = 0;
if (posX > posEndX.Value)
{
int tmp = posX;
posX = posEndX;
posX = posEndX.Value;
posEndX = tmp;
}
......@@ -135,11 +156,12 @@ namespace ButtonPusherEditor
int measureEnd = measure;
int beatEnd = beat;
if (posEndX != -1)
if (posEndX.Value != posX)
{
measureEnd = (int)(posEndX / MeasureSize);
beatEnd = (int)Math.Round((posEndX - (MeasureSize * measureEnd))
* npm / MeasureSize);
beatEnd = (int)Math.Round(
(posEndX.Value - (MeasureSize * measureEnd))
* npm / MeasureSize);
}
while (measureEnd >= measures.Count)
......@@ -155,8 +177,7 @@ namespace ButtonPusherEditor
Note? motion = null;
if (isMotion)
{
Func<string> MotionKeyDialog = delegate()
string res = new Func<string>(() =>
{
Form prompt = new Form()
{
......@@ -186,9 +207,7 @@ namespace ButtonPusherEditor
return prompt.ShowDialog() == DialogResult.OK
? textBox.Text : "";
};
string res = MotionKeyDialog();
})();
motion = Enum.GetValues(typeof(Note)).OfType<Note>()
.Where(x => x.ToString() == res.Trim())
......@@ -199,6 +218,16 @@ namespace ButtonPusherEditor
MessageBox.Show("Motion not found: " + res);
return;
}
else if (posX != posEndX && (motion.Value & ~Note.LMOReset) == 0)
{
MessageBox.Show(res + " is short motion");
return;
}
else if (posX == posEndX && (motion.Value & ~Note.SMOReset) == 0)
{
MessageBox.Show(res + " is long motion");
return;
}
}
if (posX == posEndX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment