fix early judgements on jack held's
This commit is contained in:
parent
5105c95929
commit
0024798715
@ -1129,6 +1129,7 @@ class PlayState extends MusicBeatState
|
||||
rep = new Replay("na");
|
||||
|
||||
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.addEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
|
||||
super.create();
|
||||
}
|
||||
@ -1368,6 +1369,41 @@ class PlayState extends MusicBeatState
|
||||
return null;
|
||||
}
|
||||
|
||||
var keys = [false,false,false,false];
|
||||
|
||||
private function releaseInput(evt:KeyboardEvent):Void // handles releases
|
||||
{
|
||||
@:privateAccess
|
||||
var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode));
|
||||
|
||||
var binds:Array<String> = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind];
|
||||
|
||||
var data = -1;
|
||||
|
||||
switch(evt.keyCode) // arrow keys
|
||||
{
|
||||
case 37:
|
||||
data = 0;
|
||||
case 40:
|
||||
data = 1;
|
||||
case 38:
|
||||
data = 2;
|
||||
case 39:
|
||||
data = 3;
|
||||
}
|
||||
|
||||
for (i in 0...binds.length) // binds
|
||||
{
|
||||
if (binds[i].toLowerCase() == key.toLowerCase())
|
||||
data = i;
|
||||
}
|
||||
|
||||
if (data == -1)
|
||||
return;
|
||||
|
||||
keys[data] = false;
|
||||
}
|
||||
|
||||
private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs
|
||||
|
||||
if (PlayStateChangeables.botPlay || loadRep || paused)
|
||||
@ -1401,15 +1437,14 @@ class PlayState extends MusicBeatState
|
||||
if (binds[i].toLowerCase() == key.toLowerCase())
|
||||
data = i;
|
||||
}
|
||||
|
||||
if (evt.keyLocation == KeyLocation.NUM_PAD)
|
||||
{
|
||||
trace(String.fromCharCode(evt.charCode) + " " + key);
|
||||
}
|
||||
|
||||
if (data == -1)
|
||||
return;
|
||||
|
||||
if (keys[data])
|
||||
return;
|
||||
|
||||
keys[data] = true;
|
||||
|
||||
var ana = new Ana(Conductor.songPosition, null, false, "miss", data);
|
||||
|
||||
var dataNotes = [];
|
||||
@ -2053,6 +2088,7 @@ class PlayState extends MusicBeatState
|
||||
#end
|
||||
FlxG.switchState(new ChartingState());
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2105,6 +2141,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
FlxG.switchState(new AnimationDebug(SONG.player2));
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2118,6 +2155,7 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
FlxG.switchState(new AnimationDebug(SONG.player1));
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2672,6 +2710,7 @@ class PlayState extends MusicBeatState
|
||||
function endSong():Void
|
||||
{
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
if (useVideo)
|
||||
{
|
||||
GlobalVideo.get().stop();
|
||||
|
Loading…
x
Reference in New Issue
Block a user