1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-26 22:27:47 +00:00

stuf in progres

This commit is contained in:
Cameron Taylor 2023-12-12 23:28:16 -05:00
parent d62042a99a
commit 7058d9baa7
2 changed files with 29 additions and 20 deletions

View file

@ -51,6 +51,7 @@ class DebugMenuSubState extends MusicBeatSubState
// Create each menu item. // Create each menu item.
// Call onMenuChange when the first item is created to move the camera . // Call onMenuChange when the first item is created to move the camera .
onMenuChange(createItem("CHART EDITOR", openChartEditor)); onMenuChange(createItem("CHART EDITOR", openChartEditor));
createItem("Input Offset Testing", openInputOffsetTesting);
createItem("ANIMATION EDITOR", openAnimationEditor); createItem("ANIMATION EDITOR", openAnimationEditor);
createItem("STAGE EDITOR", openStageEditor); createItem("STAGE EDITOR", openStageEditor);
createItem("TEST STICKERS", testStickers); createItem("TEST STICKERS", testStickers);
@ -92,6 +93,12 @@ class DebugMenuSubState extends MusicBeatSubState
FlxG.switchState(new ChartEditorState()); FlxG.switchState(new ChartEditorState());
} }
function openInputOffsetTesting()
{
FlxG.switchState(new funkin.ui.debug.latency.LatencyState());
trace('Input Offset Testing');
}
function openAnimationEditor() function openAnimationEditor()
{ {
FlxG.switchState(new funkin.ui.debug.anim.DebugBoundingState()); FlxG.switchState(new funkin.ui.debug.anim.DebugBoundingState());

View file

@ -41,6 +41,10 @@ class LatencyState extends MusicBeatSubState
override function create() override function create()
{ {
super.create();
if (FlxG.sound.music != null) FlxG.sound.music.stop();
swagSong = new HomemadeMusic(); swagSong = new HomemadeMusic();
swagSong.loadEmbedded(Paths.sound('soundTest'), true); swagSong.loadEmbedded(Paths.sound('soundTest'), true);
@ -66,8 +70,8 @@ class LatencyState extends MusicBeatSubState
trace("\tFR FR PRESS: \t" + swagSong.getTimeWithDiff()); trace("\tFR FR PRESS: \t" + swagSong.getTimeWithDiff());
// trace("\tREDDIT: \t" + swagSong.frfrTime + " " + Timer.stamp()); // trace("\tREDDIT: \t" + swagSong.frfrTime + " " + Timer.stamp());
@:privateAccess // @:privateAccess
trace("\tREDDIT: \t" + FlxG.sound.music._channel.position + " " + Timer.stamp()); // trace("\tREDDIT: \t" + FlxG.sound.music._channel.position + " " + Timer.stamp());
// trace("EVENT LISTENER: " + key); // trace("EVENT LISTENER: " + key);
}); });
@ -91,14 +95,14 @@ class LatencyState extends MusicBeatSubState
// // musSpec.visType = FREQUENCIES; // // musSpec.visType = FREQUENCIES;
// add(musSpec); // add(musSpec);
for (beat in 0...Math.floor(FlxG.sound.music.length / Conductor.instance.beatLengthMs)) for (beat in 0...Math.floor(FlxG.sound.music.length / (Conductor.stepLengthMs * 2)))
{ {
var beatTick:FlxSprite = new FlxSprite(songPosToX(beat * Conductor.instance.beatLengthMs), FlxG.height - 15); var beatTick:FlxSprite = new FlxSprite(songPosToX(beat * (Conductor.stepLengthMs * 2)), FlxG.height - 15);
beatTick.makeGraphic(2, 15); beatTick.makeGraphic(2, 15);
beatTick.alpha = 0.3; beatTick.alpha = 0.3;
add(beatTick); add(beatTick);
var offsetTxt:FlxText = new FlxText(songPosToX(beat * Conductor.instance.beatLengthMs), FlxG.height - 26, 0, "swag"); var offsetTxt:FlxText = new FlxText(songPosToX(beat * (Conductor.stepLengthMs * 2)), FlxG.height - 26, 0, "swag");
offsetTxt.alpha = 0.5; offsetTxt.alpha = 0.5;
diffGrp.add(offsetTxt); diffGrp.add(offsetTxt);
@ -130,7 +134,7 @@ class LatencyState extends MusicBeatSubState
for (i in 0...32) for (i in 0...32)
{ {
var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), Conductor.instance.beatLengthMs * i); var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), (Conductor.stepLengthMs * 2) * i);
noteGrp.add(note); noteGrp.add(note);
} }
@ -140,8 +144,6 @@ class LatencyState extends MusicBeatSubState
strumLine = new FlxSprite(FlxG.width / 2, 100).makeGraphic(FlxG.width, 5); strumLine = new FlxSprite(FlxG.width / 2, 100).makeGraphic(FlxG.width, 5);
add(strumLine); add(strumLine);
super.create();
} }
override function stepHit():Bool override function stepHit():Bool
@ -183,12 +185,12 @@ class LatencyState extends MusicBeatSubState
trace("\tUPDATE PRESS: \t" + FlxG.sound.music.time + " " + Timer.stamp()); trace("\tUPDATE PRESS: \t" + FlxG.sound.music.time + " " + Timer.stamp());
} }
if (FlxG.keys.justPressed.SPACE) // if (FlxG.keys.justPressed.SPACE)
{ // {
if (FlxG.sound.music.playing) FlxG.sound.music.pause(); // if (FlxG.sound.music.playing) FlxG.sound.music.pause();
else // else
FlxG.sound.music.resume(); // FlxG.sound.music.resume();
} // }
if (FlxG.keys.pressed.D) FlxG.sound.music.time += 1000 * FlxG.elapsed; if (FlxG.keys.pressed.D) FlxG.sound.music.time += 1000 * FlxG.elapsed;
@ -217,7 +219,7 @@ class LatencyState extends MusicBeatSubState
if (FlxG.keys.pressed.SHIFT) multiply = 1; if (FlxG.keys.pressed.SHIFT) multiply = 1;
if (FlxG.keys.pressed.CONTROL) if (FlxG.keys.pressed.CONTROL || FlxG.keys.pressed.SPACE)
{ {
if (FlxG.keys.justPressed.RIGHT) if (FlxG.keys.justPressed.RIGHT)
{ {
@ -250,7 +252,7 @@ class LatencyState extends MusicBeatSubState
}*/ }*/
noteGrp.forEach(function(daNote:NoteSprite) { noteGrp.forEach(function(daNote:NoteSprite) {
daNote.y = (strumLine.y - ((Conductor.instance.songPosition - Conductor.instance.instrumentalOffset) - daNote.noteData.time) * 0.45); daNote.y = (strumLine.y - ((Conductor.songPosition - Conductor.instrumentalOffset) - daNote.strumTime) * 0.45);
daNote.x = strumLine.x + 30; daNote.x = strumLine.x + 30;
if (daNote.y < strumLine.y) daNote.alpha = 0.5; if (daNote.y < strumLine.y) daNote.alpha = 0.5;
@ -269,12 +271,12 @@ class LatencyState extends MusicBeatSubState
{ {
Conductor.instance.update(swagSong.getTimeWithDiff()); Conductor.instance.update(swagSong.getTimeWithDiff());
var closestBeat:Int = Math.round(Conductor.instance.songPosition / Conductor.instance.beatLengthMs) % diffGrp.members.length; var closestBeat:Int = Math.round(Conductor.songPosition / (Conductor.stepLengthMs * 2)) % diffGrp.members.length;
var getDiff:Float = Conductor.instance.songPosition - (closestBeat * Conductor.instance.beatLengthMs); var getDiff:Float = Conductor.songPosition - (closestBeat * (Conductor.stepLengthMs * 2));
getDiff -= Conductor.instance.inputOffset; getDiff -= Conductor.inputOffset;
// lil fix for end of song // lil fix for end of song
if (closestBeat == 0 && getDiff >= Conductor.instance.beatLengthMs * 2) getDiff -= FlxG.sound.music.length; if (closestBeat == 0 && getDiff >= Conductor.stepLengthMs * 2) getDiff -= FlxG.sound.music.length;
trace("\tDISTANCE TO CLOSEST BEAT: " + getDiff + "ms"); trace("\tDISTANCE TO CLOSEST BEAT: " + getDiff + "ms");
trace("\tCLOSEST BEAT: " + closestBeat); trace("\tCLOSEST BEAT: " + closestBeat);