gamepad support and keybind cleaning up
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import openfl.ui.KeyLocation;
|
||||
import openfl.events.Event;
|
||||
import haxe.EnumTools;
|
||||
import openfl.ui.Keyboard;
|
||||
@ -1399,6 +1400,10 @@ class PlayState extends MusicBeatState
|
||||
data = i;
|
||||
}
|
||||
|
||||
if (evt.keyLocation == KeyLocation.NUM_PAD)
|
||||
{
|
||||
trace(String.fromCharCode(evt.charCode) + " " + key);
|
||||
}
|
||||
|
||||
if (data == -1)
|
||||
return;
|
||||
@ -3114,7 +3119,7 @@ class PlayState extends MusicBeatState
|
||||
var rightHold:Bool = false;
|
||||
var leftHold:Bool = false;
|
||||
|
||||
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY
|
||||
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY (also gamepad shit)
|
||||
|
||||
private function keyShit():Void // I've invested in emma stocks
|
||||
{
|
||||
@ -3149,11 +3154,6 @@ class PlayState extends MusicBeatState
|
||||
releaseArray = [false, false, false, false];
|
||||
}
|
||||
|
||||
var anas:Array<Ana> = [null,null,null,null];
|
||||
|
||||
/*for (i in 0...pressArray.length)
|
||||
if (pressArray[i])
|
||||
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);*/
|
||||
|
||||
// HOLDS, check for sustain notes
|
||||
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
|
||||
@ -3165,103 +3165,110 @@ class PlayState extends MusicBeatState
|
||||
});
|
||||
}
|
||||
|
||||
// PRESSES, check for note hits
|
||||
/*if (pressArray.contains(true) && generatedMusic)
|
||||
if (KeyBinds.gamepad && !FlxG.keys.pressed.ANY)
|
||||
{
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
var possibleNotes:Array<Note> = []; // notes that can be hit
|
||||
var directionList:Array<Int> = []; // directions that can be hit
|
||||
var dumbNotes:Array<Note> = []; // notes to kill later
|
||||
var directionsAccounted:Array<Bool> = [false,false,false,false]; // we don't want to do judgments for more than one presses
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
var anas:Array<Ana> = [null,null,null,null];
|
||||
|
||||
for (i in 0...pressArray.length)
|
||||
if (pressArray[i])
|
||||
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);
|
||||
|
||||
// PRESSES, check for note hits
|
||||
if (pressArray.contains(true) && generatedMusic)
|
||||
{
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
var possibleNotes:Array<Note> = []; // notes that can be hit
|
||||
var directionList:Array<Int> = []; // directions that can be hit
|
||||
var dumbNotes:Array<Note> = []; // notes to kill later
|
||||
var directionsAccounted:Array<Bool> = [false,false,false,false]; // we don't want to do judgments for more than one presses
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if (!directionsAccounted[daNote.noteData])
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
||||
{
|
||||
if (directionList.contains(daNote.noteData))
|
||||
{
|
||||
directionsAccounted[daNote.noteData] = true;
|
||||
for (coolNote in possibleNotes)
|
||||
if (!directionsAccounted[daNote.noteData])
|
||||
{
|
||||
if (directionList.contains(daNote.noteData))
|
||||
{
|
||||
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
|
||||
{ // if it's the same note twice at < 10ms distance, just delete it
|
||||
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
|
||||
dumbNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
|
||||
{ // if daNote is earlier than existing note (coolNote), replace
|
||||
possibleNotes.remove(coolNote);
|
||||
possibleNotes.push(daNote);
|
||||
break;
|
||||
directionsAccounted[daNote.noteData] = true;
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
|
||||
{ // if it's the same note twice at < 10ms distance, just delete it
|
||||
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
|
||||
dumbNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
|
||||
{ // if daNote is earlier than existing note (coolNote), replace
|
||||
possibleNotes.remove(coolNote);
|
||||
possibleNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
possibleNotes.push(daNote);
|
||||
directionList.push(daNote.noteData);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
trace('notes that can be hit: ' + possibleNotes.length);
|
||||
|
||||
for (note in dumbNotes)
|
||||
{
|
||||
FlxG.log.add("killing dumb ass note at " + note.strumTime);
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
|
||||
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
if (perfectMode)
|
||||
goodNoteHit(possibleNotes[0]);
|
||||
else if (possibleNotes.length > 0)
|
||||
{
|
||||
if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
{ // if a direction is hit that shouldn't be
|
||||
if (pressArray[shit] && !directionList.contains(shit))
|
||||
noteMiss(shit, null);
|
||||
else
|
||||
{
|
||||
possibleNotes.push(daNote);
|
||||
directionList.push(daNote.noteData);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (coolNote in possibleNotes)
|
||||
}
|
||||
});
|
||||
|
||||
for (note in dumbNotes)
|
||||
{
|
||||
if (pressArray[coolNote.noteData])
|
||||
FlxG.log.add("killing dumb ass note at " + note.strumTime);
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
|
||||
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
if (perfectMode)
|
||||
goodNoteHit(possibleNotes[0]);
|
||||
else if (possibleNotes.length > 0)
|
||||
{
|
||||
if (!FlxG.save.data.ghost)
|
||||
{
|
||||
if (mashViolations != 0)
|
||||
mashViolations--;
|
||||
scoreTxt.color = FlxColor.WHITE;
|
||||
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
|
||||
anas[coolNote.noteData].hit = true;
|
||||
anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
|
||||
anas[coolNote.noteData].nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
|
||||
goodNoteHit(coolNote);
|
||||
for (shit in 0...pressArray.length)
|
||||
{ // if a direction is hit that shouldn't be
|
||||
if (pressArray[shit] && !directionList.contains(shit))
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
}
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (pressArray[coolNote.noteData])
|
||||
{
|
||||
if (mashViolations != 0)
|
||||
mashViolations--;
|
||||
scoreTxt.color = FlxColor.WHITE;
|
||||
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
|
||||
anas[coolNote.noteData].hit = true;
|
||||
anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
|
||||
anas[coolNote.noteData].nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
|
||||
goodNoteHit(coolNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
if (pressArray[shit])
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
|
||||
}
|
||||
else if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
if (pressArray[shit])
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
|
||||
}*/
|
||||
if (!loadRep)
|
||||
for (i in anas)
|
||||
if (i != null)
|
||||
replayAna.anaArray.push(i); // put em all there*/
|
||||
}
|
||||
|
||||
/*if (!loadRep)
|
||||
for (i in anas)
|
||||
if (i != null)
|
||||
replayAna.anaArray.push(i); // put em all there*/
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if(PlayStateChangeables.useDownscroll && daNote.y > strumLine.y ||
|
||||
|
Reference in New Issue
Block a user