mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-19 06:24:56 +00:00
Merge pull request #175 from FunkinCrew/rewrite/bugfix/hold-note-scoring
Fix a bug where hold notes wouldn't grant score
This commit is contained in:
commit
9fe74d719b
|
@ -1893,6 +1893,7 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
// Grant the player health.
|
||||
health += Constants.HEALTH_HOLD_BONUS_PER_SECOND * elapsed;
|
||||
songScore += Std.int(Constants.SCORE_HOLD_BONUS_PER_SECOND * elapsed);
|
||||
}
|
||||
|
||||
// TODO: Potential penalty for dropping a hold note?
|
||||
|
@ -2013,103 +2014,6 @@ class PlayState extends MusicBeatSubState
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle player inputs.
|
||||
*/
|
||||
function keyShit(test:Bool):Void
|
||||
{
|
||||
// control arrays, order L D R U
|
||||
var holdArray:Array<Bool> = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT];
|
||||
var pressArray:Array<Bool> = [
|
||||
controls.NOTE_LEFT_P,
|
||||
controls.NOTE_DOWN_P,
|
||||
controls.NOTE_UP_P,
|
||||
controls.NOTE_RIGHT_P
|
||||
];
|
||||
var releaseArray:Array<Bool> = [
|
||||
controls.NOTE_LEFT_R,
|
||||
controls.NOTE_DOWN_R,
|
||||
controls.NOTE_UP_R,
|
||||
controls.NOTE_RIGHT_R
|
||||
];
|
||||
|
||||
// if (pressArray.contains(true))
|
||||
// {
|
||||
// var lol:Array<Int> = cast pressArray;
|
||||
// inputSpitter.push(Std.int(Conductor.songPosition) + ' ' + lol.join(' '));
|
||||
// }
|
||||
|
||||
// HOLDS, check for sustain notes
|
||||
if (holdArray.contains(true) && generatedMusic)
|
||||
{
|
||||
/*
|
||||
activeNotes.forEachAlive(function(daNote:Note) {
|
||||
if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.data.noteData]) goodNoteHit(daNote);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
// PRESSES, check for note hits
|
||||
if (pressArray.contains(true) && generatedMusic)
|
||||
{
|
||||
Haptic.vibrate(100, 100);
|
||||
|
||||
if (currentStage != null && currentStage.getBoyfriend() != null)
|
||||
{
|
||||
currentStage.getBoyfriend().holdTimer = 0;
|
||||
}
|
||||
|
||||
var possibleNotes:Array<NoteSprite> = []; // notes that can be hit
|
||||
var directionList:Array<Int> = []; // directions that can be hit
|
||||
var dumbNotes:Array<NoteSprite> = []; // notes to kill later
|
||||
|
||||
for (note in dumbNotes)
|
||||
{
|
||||
FlxG.log.add('killing dumb ass note at ' + note.noteData.time);
|
||||
note.kill();
|
||||
// activeNotes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
|
||||
possibleNotes.sort((a, b) -> Std.int(a.noteData.time - b.noteData.time));
|
||||
|
||||
if (perfectMode)
|
||||
{
|
||||
goodNoteHit(possibleNotes[0], null);
|
||||
}
|
||||
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)) ghostNoteMiss(shit);
|
||||
}
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (pressArray[coolNote.noteData.getDirection()]) goodNoteHit(coolNote, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// HNGGG I really want to add an option for ghost tapping
|
||||
// L + ratio
|
||||
for (shit in 0...pressArray.length)
|
||||
if (pressArray[shit]) ghostNoteMiss(shit, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStage == null) return;
|
||||
|
||||
for (keyId => isPressed in pressArray)
|
||||
{
|
||||
if (playerStrumline == null) continue;
|
||||
|
||||
var dir:NoteDirection = Strumline.DIRECTIONS[keyId];
|
||||
|
||||
if (isPressed && !playerStrumline.isConfirm(dir)) playerStrumline.playPress(dir);
|
||||
if (!holdArray[keyId]) playerStrumline.playStatic(dir);
|
||||
}
|
||||
}
|
||||
|
||||
function goodNoteHit(note:NoteSprite, input:PreciseInputEvent):Void
|
||||
{
|
||||
var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_HIT, note, Highscore.tallies.combo + 1, true);
|
||||
|
@ -2118,19 +2022,16 @@ class PlayState extends MusicBeatSubState
|
|||
// Calling event.cancelEvent() skips all the other logic! Neat!
|
||||
if (event.eventCanceled) return;
|
||||
|
||||
if (!note.isHoldNote)
|
||||
{
|
||||
Highscore.tallies.combo++;
|
||||
Highscore.tallies.totalNotesHit++;
|
||||
Highscore.tallies.combo++;
|
||||
Highscore.tallies.totalNotesHit++;
|
||||
|
||||
if (Highscore.tallies.combo > Highscore.tallies.maxCombo) Highscore.tallies.maxCombo = Highscore.tallies.combo;
|
||||
if (Highscore.tallies.combo > Highscore.tallies.maxCombo) Highscore.tallies.maxCombo = Highscore.tallies.combo;
|
||||
|
||||
popUpScore(note, input);
|
||||
}
|
||||
popUpScore(note, input);
|
||||
|
||||
playerStrumline.hitNote(note);
|
||||
|
||||
if (note.holdNoteSprite != null)
|
||||
if (note.isHoldNote && note.holdNoteSprite != null)
|
||||
{
|
||||
playerStrumline.playNoteHoldCover(note.holdNoteSprite);
|
||||
}
|
||||
|
|
|
@ -288,16 +288,27 @@ class Constants
|
|||
public static final HEALTH_MINE_PENALTY:Float = 15.0 / 100.0 * HEALTH_MAX; // 15.0%
|
||||
|
||||
/**
|
||||
* If true, the player will not receive the ghost miss penalty if there are no notes within the hit window.
|
||||
* This is the thing people have been begging for forever lolol.
|
||||
* SCORE VALUES
|
||||
*/
|
||||
public static final GHOST_TAPPING:Bool = false;
|
||||
// ==============================
|
||||
|
||||
/**
|
||||
* The amount of score the player gains for every send they hold a hold note.
|
||||
* A fraction of this value is granted every frame.
|
||||
*/
|
||||
public static final SCORE_HOLD_BONUS_PER_SECOND:Float = 250.0;
|
||||
|
||||
/**
|
||||
* OTHER
|
||||
*/
|
||||
// ==============================
|
||||
|
||||
/**
|
||||
* If true, the player will not receive the ghost miss penalty if there are no notes within the hit window.
|
||||
* This is the thing people have been begging for forever lolol.
|
||||
*/
|
||||
public static final GHOST_TAPPING:Bool = false;
|
||||
|
||||
/**
|
||||
* The separator between an asset library and the asset path.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue