FIX NOTE HITS
fixes weird note misses when multiple notes are hittable also fixes notes on HUD appearing pressed when the button is released during game pause/window unfocus
This commit is contained in:
parent
333cd2711b
commit
8ae8aaec51
|
@ -2014,157 +2014,92 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
private function keyShit():Void
|
private function keyShit():Void
|
||||||
{
|
{
|
||||||
// HOLDING
|
// control arrays, order L D R U
|
||||||
var up = controls.NOTE_UP;
|
var holdArray:Array<Bool> = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT];
|
||||||
var right = controls.NOTE_RIGHT;
|
var pressArray:Array<Bool> = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P];
|
||||||
var down = controls.NOTE_DOWN;
|
var releaseArray:Array<Bool> = [controls.NOTE_LEFT_R, controls.NOTE_DOWN_R, controls.NOTE_UP_R, controls.NOTE_RIGHT_R];
|
||||||
var left = controls.NOTE_LEFT;
|
|
||||||
|
|
||||||
var upP = controls.NOTE_UP_P;
|
// HOLDS, check for sustain notes
|
||||||
var rightP = controls.NOTE_RIGHT_P;
|
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
|
||||||
var downP = controls.NOTE_DOWN_P;
|
|
||||||
var leftP = controls.NOTE_LEFT_P;
|
|
||||||
|
|
||||||
var upR = controls.NOTE_UP_R;
|
|
||||||
var rightR = controls.NOTE_RIGHT_R;
|
|
||||||
var downR = controls.NOTE_DOWN_R;
|
|
||||||
var leftR = controls.NOTE_LEFT_R;
|
|
||||||
|
|
||||||
var controlArray:Array<Bool> = [leftP, downP, upP, rightP];
|
|
||||||
|
|
||||||
// FlxG.watch.addQuick('asdfa', upP);
|
|
||||||
if ((upP || rightP || downP || leftP) && generatedMusic)
|
|
||||||
{
|
{
|
||||||
// note to self, used to have stunned
|
notes.forEachAlive(function(daNote:Note)
|
||||||
// && !boyfriend.stunned
|
{
|
||||||
|
if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.noteData])
|
||||||
|
goodNoteHit(daNote);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// PRESSES, check for note hits
|
||||||
|
if (pressArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
|
||||||
|
{
|
||||||
boyfriend.holdTimer = 0;
|
boyfriend.holdTimer = 0;
|
||||||
|
|
||||||
var possibleNotes:Array<Note> = [];
|
var possibleNotes:Array<Note> = []; // notes that can be hit
|
||||||
|
var directionList:Array<Int> = []; // directions that can be hit
|
||||||
var ignoreList:Array<Int> = [];
|
var dumbNotes:Array<Note> = []; // notes to kill later
|
||||||
|
|
||||||
notes.forEachAlive(function(daNote:Note)
|
notes.forEachAlive(function(daNote:Note)
|
||||||
{
|
{
|
||||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
||||||
{
|
{
|
||||||
// the sorting probably doesn't need to be in here? who cares lol
|
if (directionList.contains(daNote.noteData))
|
||||||
possibleNotes.push(daNote);
|
|
||||||
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
|
||||||
|
|
||||||
ignoreList.push(daNote.noteData);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (possibleNotes.length > 0)
|
|
||||||
{
|
|
||||||
var daNote = possibleNotes[0];
|
|
||||||
|
|
||||||
if (perfectMode)
|
|
||||||
noteCheck(true, daNote);
|
|
||||||
|
|
||||||
// Jump notes
|
|
||||||
if (possibleNotes.length >= 2)
|
|
||||||
{
|
|
||||||
if (possibleNotes[0].strumTime == possibleNotes[1].strumTime)
|
|
||||||
{
|
{
|
||||||
for (coolNote in possibleNotes)
|
for (coolNote in possibleNotes)
|
||||||
{
|
{
|
||||||
if (controlArray[coolNote.noteData])
|
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
|
||||||
goodNoteHit(coolNote);
|
{ // if it's the same note twice at < 10ms distance, just delete it
|
||||||
else
|
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
|
||||||
{
|
dumbNotes.push(daNote);
|
||||||
var inIgnoreList:Bool = false;
|
break;
|
||||||
for (shit in 0...ignoreList.length)
|
}
|
||||||
{
|
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
|
||||||
if (controlArray[ignoreList[shit]])
|
{ // if daNote is earlier than existing note (coolNote), replace
|
||||||
inIgnoreList = true;
|
possibleNotes.remove(coolNote);
|
||||||
}
|
possibleNotes.push(daNote);
|
||||||
if (!inIgnoreList)
|
break;
|
||||||
badNoteCheck();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (possibleNotes[0].noteData == possibleNotes[1].noteData)
|
|
||||||
{
|
|
||||||
noteCheck(controlArray[daNote.noteData], daNote);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (coolNote in possibleNotes)
|
possibleNotes.push(daNote);
|
||||||
{
|
directionList.push(daNote.noteData);
|
||||||
noteCheck(controlArray[coolNote.noteData], coolNote);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // regular notes?
|
|
||||||
{
|
|
||||||
noteCheck(controlArray[daNote.noteData], daNote);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (controlArray[daNote.noteData])
|
|
||||||
goodNoteHit(daNote);
|
|
||||||
*/
|
|
||||||
// trace(daNote.noteData);
|
|
||||||
/*
|
|
||||||
switch (daNote.noteData)
|
|
||||||
{
|
|
||||||
case 2: // NOTES YOU JUST PRESSED
|
|
||||||
if (upP || rightP || downP || leftP)
|
|
||||||
noteCheck(upP, daNote);
|
|
||||||
case 3:
|
|
||||||
if (upP || rightP || downP || leftP)
|
|
||||||
noteCheck(rightP, daNote);
|
|
||||||
case 1:
|
|
||||||
if (upP || rightP || downP || leftP)
|
|
||||||
noteCheck(downP, daNote);
|
|
||||||
case 0:
|
|
||||||
if (upP || rightP || downP || leftP)
|
|
||||||
noteCheck(leftP, daNote);
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is already done in noteCheck / goodNoteHit
|
|
||||||
if (daNote.wasGoodHit)
|
|
||||||
{
|
|
||||||
daNote.kill();
|
|
||||||
notes.remove(daNote, true);
|
|
||||||
daNote.destroy();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
badNoteCheck();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((up || right || down || left) && /*!boyfriend.stunned && */ generatedMusic)
|
|
||||||
{
|
|
||||||
notes.forEachAlive(function(daNote:Note)
|
|
||||||
{
|
|
||||||
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
|
|
||||||
{
|
|
||||||
switch (daNote.noteData)
|
|
||||||
{
|
|
||||||
// NOTES YOU ARE HOLDING
|
|
||||||
case 0:
|
|
||||||
if (left)
|
|
||||||
goodNoteHit(daNote);
|
|
||||||
case 1:
|
|
||||||
if (down)
|
|
||||||
goodNoteHit(daNote);
|
|
||||||
case 2:
|
|
||||||
if (up)
|
|
||||||
goodNoteHit(daNote);
|
|
||||||
case 3:
|
|
||||||
if (right)
|
|
||||||
goodNoteHit(daNote);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
for (shit in 0...pressArray.length)
|
||||||
|
{ // if a direction is hit that shouldn't be
|
||||||
|
if (pressArray[shit] && !directionList.contains(shit))
|
||||||
|
badNoteHit();
|
||||||
|
}
|
||||||
|
for (coolNote in possibleNotes)
|
||||||
|
{
|
||||||
|
if (pressArray[coolNote.noteData])
|
||||||
|
goodNoteHit(coolNote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
badNoteHit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !up && !down && !right && !left)
|
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !holdArray.contains(true))
|
||||||
{
|
{
|
||||||
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
|
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
|
||||||
{
|
{
|
||||||
|
@ -2174,29 +2109,10 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
playerStrums.forEach(function(spr:FlxSprite)
|
playerStrums.forEach(function(spr:FlxSprite)
|
||||||
{
|
{
|
||||||
switch (spr.ID)
|
if (pressArray[spr.ID] && spr.animation.curAnim.name != 'confirm')
|
||||||
{
|
spr.animation.play('pressed');
|
||||||
case 0:
|
if (!holdArray[spr.ID])
|
||||||
if (leftP && spr.animation.curAnim.name != 'confirm')
|
spr.animation.play('static');
|
||||||
spr.animation.play('pressed');
|
|
||||||
if (leftR)
|
|
||||||
spr.animation.play('static');
|
|
||||||
case 1:
|
|
||||||
if (downP && spr.animation.curAnim.name != 'confirm')
|
|
||||||
spr.animation.play('pressed');
|
|
||||||
if (downR)
|
|
||||||
spr.animation.play('static');
|
|
||||||
case 2:
|
|
||||||
if (upP && spr.animation.curAnim.name != 'confirm')
|
|
||||||
spr.animation.play('pressed');
|
|
||||||
if (upR)
|
|
||||||
spr.animation.play('static');
|
|
||||||
case 3:
|
|
||||||
if (rightP && spr.animation.curAnim.name != 'confirm')
|
|
||||||
spr.animation.play('pressed');
|
|
||||||
if (rightR)
|
|
||||||
spr.animation.play('static');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
||||||
{
|
{
|
||||||
|
@ -2248,14 +2164,14 @@ class PlayState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function badNoteCheck()
|
function badNoteHit()
|
||||||
{
|
{
|
||||||
// just double pasting this shit cuz fuk u
|
// just double pasting this shit cuz fuk u
|
||||||
// REDO THIS SYSTEM!
|
// REDO THIS SYSTEM!
|
||||||
|
var leftP = controls.NOTE_LEFT_P;
|
||||||
|
var downP = controls.NOTE_DOWN_P;
|
||||||
var upP = controls.NOTE_UP_P;
|
var upP = controls.NOTE_UP_P;
|
||||||
var rightP = controls.NOTE_RIGHT_P;
|
var rightP = controls.NOTE_RIGHT_P;
|
||||||
var downP = controls.NOTE_DOWN_P;
|
|
||||||
var leftP = controls.NOTE_LEFT_P;
|
|
||||||
|
|
||||||
if (leftP)
|
if (leftP)
|
||||||
noteMiss(0);
|
noteMiss(0);
|
||||||
|
@ -2267,16 +2183,6 @@ class PlayState extends MusicBeatState
|
||||||
noteMiss(3);
|
noteMiss(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
function noteCheck(keyP:Bool, note:Note):Void
|
|
||||||
{
|
|
||||||
if (keyP)
|
|
||||||
goodNoteHit(note);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
badNoteCheck();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function goodNoteHit(note:Note):Void
|
function goodNoteHit(note:Note):Void
|
||||||
{
|
{
|
||||||
if (!note.wasGoodHit)
|
if (!note.wasGoodHit)
|
||||||
|
|
Loading…
Reference in New Issue