Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nd3r-ssbm authored Aug 4, 2020
1 parent 69e4ed8 commit ea36d74
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 2 deletions.
21 changes: 20 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Slippi Light v1.3.0</title>
<title>Slippi Light v1.4.0</title>
<meta charset='utf-8'>
</head>
<body>
Expand All @@ -28,9 +28,28 @@ <h2>Choose Your File</h2>
<button onclick="toggleHitbox()">Show/Hide "Hitboxes"</button>
Playback Speed (default is 1):
<input type="number" id="speed" placeholder="1.0" step="0.25" onchange="updateSpeed()" min="0.25" max="4.0">
<button onclick="comboPage()">Generate/View Combos</button>
<button id="pause" onclick="pause()">Pause</button>
<a href="https://github.com/b3nd3r-ssbm/slippi-light/blob/master/actionStateReference.csv">What do the action states mean?</a>
</div>
<div id="combos" style="display:none">
<label for="percent">Minimum Percentage Done</label>
<input type="number" id="percent" step="1" min="0" value="60"><br>
<input type="checkbox" id="didKill">
<label for="didKill">Combo Must Kill</label><br>
<label for="minMoves">Minimum Move Count</label>
<input type="number" id="minMoves" min="1" step="1" value="1"><br>
Accept Combos From Players:<br>
<input type="checkbox" id="port1" checked>
<label for="port1">1</label>
<input type="checkbox" id="port2" checked>
<label for="port2">2</label><br>
<button onclick="filterCombos()">Submit!</button>
</div>
<div id="comboPick" style="display:none">
<select id="comboDropdown"></select><br>
<button onclick="submitCombos()">View selected Combo</button>
</div>
<button id="play" onclick="play()" style="display:none">Play</button>
</body>
</html>
102 changes: 102 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var speed=1;
var frameMil=16.67;
var speedHandler;
var showHitbox=true;
var combos;
var dropdownIndex=[];
var generated=false;
fs.readFile('setup.txt', 'utf8', function(err, data){
fileDir=data;
});
Expand Down Expand Up @@ -135,6 +138,23 @@ function showButtons(){
selection.style('display','none');
selectionPage();
}
function makeOption(textStr){
var thisSelect=document.getElementById("comboDropdown");
var newOption=document.createElement("option");
newOption.text=textStr;
thisSelect.add(newOption);
}
function submitCombos(){
var hideIt=select('#comboPick');
hideIt.style('display','none');
hideIt=select('#unhide');
hideIt.style('display','block');
var curSel=document.getElementById("comboDropdown");
currentFrame=combos[dropdownIndex[curSel.selectedIndex]].startFrame;
lastFrame=combos[dropdownIndex[curSel.selectedIndex]].endFrame;
play();
pause();
}
function showDir(){
fs.readFile('setup.txt', 'utf8', function(err, data){
fileDir=data;
Expand All @@ -156,6 +176,7 @@ function process(){
stage=settings.stageId;
stats=game.getStats();
lastFrame=stats.lastFrame;
combos=game.comboComputer.combos;
starting=true;
switch(stage){
case 2:
Expand Down Expand Up @@ -323,6 +344,87 @@ function ys(){
rect(232.4,289.1,63,5);
rect(407.4,289.1,63,5);
}
function comboPage(){
pause();
fill(255);
rect(0,0,2000,2000);
var hideStuff=select('#unhide');
hideStuff.style('display','none');
hideStuff=select('#play');
hideStuff.style('display','none');
if(!generated){
hideStuff=select('#combos');
hideStuff.style('display','block');
generated=true;
}
else{
filterCombos();
}
}
function filterCombos(){
var hideStuff=select('#combos');
hideStuff.style('display','none');
if(dropdownIndex==0){
var minPercent=parseInt(document.getElementById("percent").value);
var ports;
if(document.getElementById("port1").checked){
if(document.getElementById("port2").checked){
ports=2;
}
else{
ports=0;
}
}
else{
ports=1;
}
var didKill=document.getElementById("didKill").checked;
var moveCount=parseInt(document.getElementById("minMoves").value);
var i=0;
var percentDone;
var textSend;
var roundedPercent;
console.log(didKill+" "+ports+" "+minPercent+" "+moveCount);
for(i=0;i<combos.length;i++){
percentDone=combos[i].endPercent;
percentDone-=combos[i].startPercent;
roundedPercent=Math.floor(percentDone);
textSend="Performed by player ";
textSend+=combos[i].playerIndex+1;
textSend+=", Starting Frame: "
textSend+=combos[i].startFrame;
textSend+=", Ending Frame: ";
textSend+=combos[i].endFrame;
textSend+=", Length: ";
textSend+=combos[i].moves.length;
textSend+=", Percent Done: ";
textSend+=roundedPercent;
if(didKill){
console.log(didKill);
if(combos[i].didKill&&combos[i].moves.length>=moveCount&&percentDone>=minPercent){
if(ports==combos[i].playerIndex||ports==2){
makeOption(textSend);
dropdownIndex.push(i);
}
}
}
else{
if(combos[i].moves.length>=moveCount&&percentDone>=minPercent){
console.log("huh");
if(ports==combos[i].playerIndex||ports==2){
makeOption(textSend);
dropdownIndex.push(i);
}
}
}
}
}
var unhideItNow=select('#comboPick');
unhideItNow.style('display','block');
fill(255);
noStroke();
square(0,0,2000);
}
function players(){
var stockAdd=((addX*2)/3)-20;
var stockAdd1=(((addX*2)/3)*2)-20;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slippi-light",
"version": "1.3.0",
"version": "1.4.0",
"main": "main.js",
"author": "b3nd3r_ssbm",
"description": "GPL-3.0-or-later",
Expand Down

0 comments on commit ea36d74

Please sign in to comment.