1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-29 07:47:31 +00:00

save/load for inputOffsets

This commit is contained in:
Cameron Taylor 2024-01-09 19:57:33 -05:00
parent 3544f2a804
commit b11bf09687
2 changed files with 12 additions and 9 deletions

View file

@ -6,6 +6,7 @@ import flixel.math.FlxMath;
import funkin.play.song.Song.SongDifficulty; import funkin.play.song.Song.SongDifficulty;
import funkin.data.song.SongData.SongTimeChange; import funkin.data.song.SongData.SongTimeChange;
import funkin.data.song.SongDataUtils; import funkin.data.song.SongDataUtils;
import funkin.save.Save;
/** /**
* A core class which handles musical timing throughout the game, * A core class which handles musical timing throughout the game,
@ -209,16 +210,18 @@ class Conductor
/** /**
* An offset set by the user to compensate for input lag. * An offset set by the user to compensate for input lag.
*/ */
public var inputOffset(get, set):Float; public var inputOffset(get, set):Int;
function get_inputOffset():Float function get_inputOffset():Int
{ {
return Save.get().options.inputOffset; return Save.get().options.inputOffset;
} }
function set_inputOffset(value:Float):Float function set_inputOffset(value:Int):Int
{ {
return Save.get().options.inputOffset = value; Save.get().options.inputOffset = value;
Save.get().flush();
return Save.get().options.inputOffset;
} }
/** /**

View file

@ -200,7 +200,7 @@ class LatencyState extends MusicBeatSubState
offsetText.text += "\naverage input offset needed: " + avgOffsetInput; offsetText.text += "\naverage input offset needed: " + avgOffsetInput;
var multiply:Float = 10; var multiply:Int = 10;
if (FlxG.keys.pressed.SHIFT) multiply = 1; if (FlxG.keys.pressed.SHIFT) multiply = 1;
@ -208,24 +208,24 @@ class LatencyState extends MusicBeatSubState
{ {
if (FlxG.keys.justPressed.RIGHT) if (FlxG.keys.justPressed.RIGHT)
{ {
Conductor.instance.instrumentalOffset += 1.0 * multiply; Conductor.instance.instrumentalOffset += 1 * multiply;
} }
if (FlxG.keys.justPressed.LEFT) if (FlxG.keys.justPressed.LEFT)
{ {
Conductor.instance.instrumentalOffset -= 1.0 * multiply; Conductor.instance.instrumentalOffset -= 1 * multiply;
} }
} }
else else
{ {
if (FlxG.keys.justPressed.RIGHT) if (FlxG.keys.justPressed.RIGHT)
{ {
Conductor.instance.inputOffset += 1.0 * multiply; Conductor.instance.inputOffset += 1 * multiply;
} }
if (FlxG.keys.justPressed.LEFT) if (FlxG.keys.justPressed.LEFT)
{ {
Conductor.instance.inputOffset -= 1.0 * multiply; Conductor.instance.inputOffset -= 1 * multiply;
} }
} }