Skip to content

Commit 22a450a

Browse files
committed
Use the oldFrameTimestamp to keep consistency timing between different FPS
1 parent e8d91e0 commit 22a450a

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

art

Submodule art deleted from 429ab72

art

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/ilauncher/Documentos/funkin.art

assets

Submodule assets deleted from d9ebd43

assets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/ilauncher/Documentos/funkin.assets

source/funkin/play/PlayState.hx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,12 +3016,18 @@ class PlayState extends MusicBeatSubState
30163016
opponentStrumline.handleSkippedNotes();
30173017
}
30183018

3019+
private var oldFrameTimestamp:Int64 = 0;
3020+
private var newFrameTimestamp:Int64 = 0;
3021+
30193022
/**
30203023
* PreciseInputEvents are put into a queue between update() calls,
30213024
* and then processed here.
30223025
*/
30233026
function processInputQueue():Void
30243027
{
3028+
oldFrameTimestamp = newFrameTimestamp;
3029+
newFrameTimestamp = PreciseInputManager.getCurrentTimestamp();
3030+
30253031
if (inputPressQueue.length + inputReleaseQueue.length == 0) return;
30263032

30273033
// Ignore inputs during cutscenes.
@@ -3108,8 +3114,8 @@ class PlayState extends MusicBeatSubState
31083114
function goodNoteHit(note:NoteSprite, input:PreciseInputEvent):Void
31093115
{
31103116
// Calculate the input latency (do this as late as possible).
3111-
// trace('Compare: ${PreciseInputManager.getCurrentTimestamp()} - ${input.timestamp}');
3112-
var inputLatencyNs:Int64 = PreciseInputManager.getCurrentTimestamp() - input.timestamp;
3117+
// trace('Compare: ${input.timestamp} - ${oldFrameTimestamp}');
3118+
var inputLatencyNs:Int64 = input.timestamp - oldFrameTimestamp;
31133119
var inputLatencyMs:Float = inputLatencyNs.toFloat() / Constants.NS_PER_MS;
31143120
// trace('Input: ${daNote.noteData.getDirectionName()} pressed ${inputLatencyMs}ms ago!');
31153121

0 commit comments

Comments
 (0)