load music file
misc vars
[[beat, bpm], [beat, bpm], ...]
[[difficulty, line number], [difficulty, line number], ...]
difficulty vars
sm file conversion vars
note position and display vars
speed in units of milliseconds per 10 pixels
controller visualization vars
second controller visualization vars
noteskin vars
function drawArrow
Draws a vector-based arrow
Parameters:
arrowAngle must be a float.
(The angle in degrees that the arrow will be pointing. Right is zero, and increases counterclockwise.)
arrowSize must be a float.
(The height of the arrow in pixels, as well as four times the width of the arrow.)
arrowCenter must be an array.
(The position of the center of the arrow [x,y].)
left base
right base
right inner
right arm bottom
right arm top
tip
left arm top
left arm bottom
left inner
Module Stepfile conversion
Converts the stepfile into note, timing, and other information
Parameters:
Returns an array
(
bpms
- The beats per minute of a section of music and the beat at which that bpm goes into effect, in the form [[beat, bpm], ...] for each change in bpm, with the first bpm being defined at beat 0 )difficulties
- The list of difficulties available within a stepfile, and the line number in lines[] at which the notes for that difficulty start, in the form [[difficulty, line number], ...]. )notes
- All of the notes contained in a specified difficulty, organized so that notes[0] = the set of notes for receptor 1, and notes[i][j] = the time position relative to the start of the notes (does not factor in offset at this point).)Begin stepfile conversion
Grab stepfile info: title, artist, offset, bpmsassumes bpms are in one line
convert the array of strings to an array of floats
this loop extracts difficulties in the form: ["difficulty", line number where notes start]
encountered bizarre error where difficulties array would simply return "C6" or "C5", fixed after PC restart
NOTE: lines array starts counting at zero, therefore values may seem like they are off by one
user prompt to select difficulty goes here
begin note conversion loop
count number of notes in a measure
assumes #NOTES ends with a semicolon
check if the notes have finished, if true, this is last loop
console.log(notesInMeasure);
get current bpm measureNum is initially 1 assumes bpm starts at the beginning of a measure assumes bpms are in chronological order
console.log(bpms[i][1]);
get seconds per notes
console.log(secPerNote);
put notes into array with time values
console.log(linesProcessed + " , " + currentLine + " , " + currentBpm);
end stepfile conversion
initialize time for display loop
Module Display notes and receptors
Converts notes[] timing information into position information and displays it
Parameters:
Returns an array
(
receptors
- The position of each receptor, where the position of receptor (i+1) is given by receptors[i] = [x,y] (in pixels). )notePos
- The position of each note on screen, in the form notePos[receptorNumber][noteNumber] = [x,y]. Receptor and note number initialize at zero and notes are in ascending chronological order. )noteLocators
- The position of the earliest note on screen in notes[], or, the array index for each earliest note for each receptor, and noteLocators[receptorNumber] = #)begin note and receptor display loop
populate note positions
draw receptors
draw notes
if(scroll == "Down"){ var test = timeRead - (notePos[i][j][1] - receptors[i][1])*speed/10000;
var test = timeRead + (notePos[i][j][1] - receptors[i][1])*speed/10000;
text(test.toFixed(3), notePos[i][j][0] + 45, notePos[i][j][1] + 5);
Module Controller visualization
Parameters:
notePos must be an array.
(The position of each note on screen, in the form notePos[receptorNumber][noteNumber] = [x,y]. Receptor and note number initialize at zero and notes are in ascending chronological order.)
receptors must be an array.
(The position of each receptor, where the position of receptor (i+1) is given by receptors[i] = [x,y] (in pixels).)
noteLocators must be an array.
(The position of the earliest note on screen in notes[], or, the array index for each earliest note for each receptor, and noteLocators[receptorNumber] = #.)
Returns an array
(
hit
- The old and new position of the hit circle, where hit[0] = [x_old, y_old] and hit[1] = [x_new, y_new])begin controller visualization loop
button set 1
button set 2
if there is no nearest note, do not cause nearest note to update
noteType = 0;
noteType = 1;
noteType = 2;
text(nearestNote + " , " + nearestDist.toFixed(3),receptors[0][0]-25,receptors[0][1] + 30); text(nearestDist.toFixed(3),receptors[1][0],receptors[1][1] + 30); text((nearestDist < 5000) + " , " + (currentNote[0] != nearestNote[0]) + " , " + (currentNote[1] != nearestNote[1]), 0, 120); text(currentNote, 0, 135); text(nearestNote, 0, 150);
replace old note with new note when appropriate
do up
old = new
do down
old = new
calculate percent animation
controller visualization 2
if there is no nearest note, do not cause nearest note to update
replace old note with new note when appropriate
do up
old = new
do down
old = new
calculate percent animation
load stepfile into lines array