diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx new file mode 100644 index 0000000..8de9076 --- /dev/null +++ b/source/KadeEngineData.hx @@ -0,0 +1,31 @@ +import flixel.FlxG; + +class KadeEngineData +{ + public static function initSave() + { + if (FlxG.save.data.newInput == null) + FlxG.save.data.newInput = true; + + if (FlxG.save.data.downscroll == null) + FlxG.save.data.downscroll = false; + + if (FlxG.save.data.dfjk == null) + FlxG.save.data.dfjk = false; + + if (FlxG.save.data.accuracyDisplay == null) + FlxG.save.data.accuracyDisplay = true; + + if (FlxG.save.data.accuracyDisplay == null) + FlxG.save.data.accuracyDisplay = true; + + if (FlxG.save.data.offset == null) + FlxG.save.data.offset = 0; + + if (FlxG.save.data.offset == null) + FlxG.save.data.offset = 0; + + if (FlxG.save.data.songPosition == null) + FlxG.save.data.songPosition = false; + } +} \ No newline at end of file diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 72849a5..00bb779 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -25,7 +25,13 @@ class OptionsMenu extends MusicBeatState override function create() { var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat')); - controlsStrings = CoolUtil.coolStringFile((FlxG.save.data.dfjk ? 'DFJK' : 'WASD') + "\n" + (FlxG.save.data.newInput ? "New input" : "Old Input") + "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + "\nAccuracy " + (!FlxG.save.data.accuracyDisplay ? "off" : "on") + "\nLoad replays"); + controlsStrings = CoolUtil.coolStringFile( + (FlxG.save.data.dfjk ? 'DFJK' : 'WASD') + + "\n" + (FlxG.save.data.newInput ? "New input" : "Old Input") + + "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + + "\nAccuracy " + (!FlxG.save.data.accuracyDisplay ? "off" : "on") + + "\nSong Position " + (!FlxG.save.data.songPosition ? "off" : "on") + + "\nLoad replays"); trace(controlsStrings); @@ -83,7 +89,7 @@ class OptionsMenu extends MusicBeatState if (controls.ACCEPT) { - if (curSelected != 4) + if (curSelected != 5) grpControls.remove(grpControls.members[curSelected]); switch(curSelected) { @@ -117,6 +123,12 @@ class OptionsMenu extends MusicBeatState ctrl.targetY = curSelected - 3; grpControls.add(ctrl); case 4: + FlxG.save.data.songPosition = !FlxG.save.data.songPosition; + var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, "Song Position " + (!FlxG.save.data.songPosition ? "off" : "on"), true, false); + ctrl.isMenuItem = true; + ctrl.targetY = curSelected - 4; + grpControls.add(ctrl); + case 5: trace('switch'); FlxG.switchState(new LoadReplayState()); } diff --git a/source/PlayState.hx b/source/PlayState.hx index fcef655..345e672 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -59,6 +59,9 @@ class PlayState extends MusicBeatState public static var goods:Int = 0; public static var sicks:Int = 0; + public static var songPosBG:FlxSprite; + public static var songPosBar:FlxBar; + public static var rep:Replay; public static var loadRep:Bool = false; @@ -107,7 +110,8 @@ class PlayState extends MusicBeatState private var healthBarBG:FlxSprite; private var healthBar:FlxBar; - + private var songPositionBar:Float = 0; + private var generatedMusic:Bool = false; private var startingSong:Bool = false; @@ -128,7 +132,7 @@ class PlayState extends MusicBeatState var limo:FlxSprite; var grpLimoDancers:FlxTypedGroup; var fastCar:FlxSprite; - + var songName:FlxText; var upperBoppers:FlxSprite; var bottomBoppers:FlxSprite; var santa:FlxSprite; @@ -762,6 +766,33 @@ class PlayState extends MusicBeatState FlxG.fixedTimestep = false; + if (FlxG.save.data.songPosition) // I dont wanna talk about this code :( + { + songPosBG = new FlxSprite(0, strumLine.y - 15).loadGraphic(Paths.image('healthBar')); + if (FlxG.save.data.downscroll) + songPosBG.y = FlxG.height * 0.9 + 45; + songPosBG.screenCenter(X); + songPosBG.scrollFactor.set(); + add(songPosBG); + + if (curStage.contains("school") && FlxG.save.data.downscroll) + songPosBG.y -= 45; + + songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, + 'songPositionBar', 0, 90000); + songPosBar.scrollFactor.set(); + songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); + add(songPosBar); + + var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16); + if (FlxG.save.data.downscroll) + songName.y -= 3; + if (!curStage.contains("school")) + songName.x -= 15; + songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + songName.scrollFactor.set(); + add(songName); + } healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar')); if (FlxG.save.data.downscroll) @@ -1095,11 +1126,46 @@ class PlayState extends MusicBeatState FlxG.sound.music.onComplete = endSong; vocals.play(); + if (FlxG.save.data.songPosition) + { + remove(songPosBG); + remove(songPosBar); + remove(songName); + + songPosBG = new FlxSprite(0, strumLine.y - 15).loadGraphic(Paths.image('healthBar')); + if (FlxG.save.data.downscroll) + songPosBG.y = FlxG.height * 0.9 + 45; + songPosBG.screenCenter(X); + songPosBG.scrollFactor.set(); + add(songPosBG); + + if (curStage.contains("school") && FlxG.save.data.downscroll) + songPosBG.y -= 45; + + songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, + 'songPositionBar', 0, 90000); + songPosBar.scrollFactor.set(); + songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); + add(songPosBar); + + var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16); + if (FlxG.save.data.downscroll) + songName.y -= 3; + if (!curStage.contains("school")) + songName.x -= 15; + songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + songName.scrollFactor.set(); + add(songName); + } + #if desktop // Song duration in a float, useful for the time left feature songLength = FlxG.sound.music.length; // Updating Discord Rich Presence (with Time Left) + + + DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ")", "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end } @@ -1395,6 +1461,8 @@ class PlayState extends MusicBeatState perfectMode = false; #end + songPositionBar = Conductor.songPosition; + if (FlxG.keys.justPressed.NINE) { if (iconP1.animation.curAnim.name == 'bf-old') @@ -1970,6 +2038,7 @@ class PlayState extends MusicBeatState rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2)); rating.screenCenter(); + rating.y += 200; rating.x = coolText.x - 40; rating.y -= 60; rating.acceleration.y = 550; @@ -1979,6 +2048,7 @@ class PlayState extends MusicBeatState var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); comboSpr.screenCenter(); comboSpr.x = coolText.x; + comboSpr.y += 200; comboSpr.acceleration.y = 600; comboSpr.velocity.y -= 150; @@ -2020,7 +2090,7 @@ class PlayState extends MusicBeatState var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2)); numScore.screenCenter(); numScore.x = coolText.x + (43 * daLoop) - 90; - numScore.y += 80; + numScore.y += 80 + 200; if (!curStage.startsWith('school')) { diff --git a/source/TitleState.hx b/source/TitleState.hx index d27a84b..c4587f2 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -78,23 +78,7 @@ class TitleState extends MusicBeatState FlxG.save.bind('funkin', 'ninjamuffin99'); - if (FlxG.save.data.newInput == null) - FlxG.save.data.newInput = true; - - if (FlxG.save.data.downscroll == null) - FlxG.save.data.downscroll = false; - - if (FlxG.save.data.dfjk == null) - FlxG.save.data.dfjk = false; - - if (FlxG.save.data.accuracyDisplay == null) - FlxG.save.data.accuracyDisplay = true; - - if (FlxG.save.data.accuracyDisplay == null) - FlxG.save.data.accuracyDisplay = true; - - if (FlxG.save.data.offset == null) - FlxG.save.data.offset = 0; + KadeEngineData.initSave(); Highscore.load();