diff --git a/README.md b/README.md index 422d820..5e129a2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ABOUT DEVELOPMENT - I feel like working on this again! - stuff im planning to add: -- version checker +- [DONE] version checker - Events (play animations, change characters, etc) - Compatibility with other engines - [DONE] option pack saver (saving all the options into a json that you can put back into the game) diff --git a/source/NoteHoldCover.hx b/source/NoteHoldCover.hx deleted file mode 100644 index a973b14..0000000 --- a/source/NoteHoldCover.hx +++ /dev/null @@ -1,68 +0,0 @@ -package; -import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; -import flixel.input.gamepad.FlxGamepad; -import openfl.Lib; -import flixel.FlxG; -import flixel.input.keyboard.FlxKey; -import flixel.FlxObject; -import flixel.math.FlxRandom; -import flixel.addons.effects.FlxSkewedSprite; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.graphics.frames.FlxAtlasFrames; -import flixel.math.FlxMath; -import flixel.util.FlxColor; -import PlayState; -import Note; - -/** - * Splash for Sustain Notes -*/ -class NoteHoldCover extends FlxTypedSpriteGroup -{ - var holdCover:FlxSprite; - - public function new(note:Note, fin:Bool = false, theY:Float) - { - super(0, 0); - if (!fin) { - make(note, theY); - } else { - end(note); - } - } - function make(note:Note, theY):Void - { - var notesArrayThings = note.notesArray; - - var nots = note.noteData % Main.keyAmmo[PlayState.mania]; - - holdCover = new FlxSprite(note.x, theY); - holdCover.frames = Paths.getSparrowAtlas('notes/noteSplash/holdCover'+notesArrayThings[nots], 'shared'); - holdCover.animation.addByPrefix('holdCoverStart', 'holdCoverStart${notesArrayThings[nots]}0', 30, false, false, false); - holdCover.animation.addByPrefix('holdCover', 'holdCover${notesArrayThings[nots]}0', 30, true, false, false); - holdCover.animation.addByPrefix('holdCoverEnd', 'holdCoverEnd${notesArrayThings[nots]}0', 30, false, false, false); - add(holdCover); - - holdCover.setGraphicSize(Std.int(note.width * 4), Std.int(note.height * 4)); - - if (holdCover.animation.exists("holdCoverStart")) { - holdCover.animation.play("holdCoverStart"); - holdCover.animation.finishCallback = function(name:String) { - trace('finshed ' + name); - holdCover.animation.play("holdCover"); - } - } - - offset.x += 135; - offset.y += 118; - } - function end(note:Note):Void - { - holdCover.animation.play("holdCoverEnd"); - holdCover.animation.finishCallback = function(name:String) { - trace('finshed ' + name); - this.kill(); - } - } -} \ No newline at end of file diff --git a/source/SaveDataHandler.hx b/source/SaveDataHandler.hx index 06fc46c..2896b23 100644 --- a/source/SaveDataHandler.hx +++ b/source/SaveDataHandler.hx @@ -165,5 +165,8 @@ class SaveDataHandler if (FlxG.save.data.curRS == null) FlxG.save.data.curRS = ''; + + if (FlxG.save.data.checkVersion == null) + FlxG.save.data.checkVersion = true; } } \ No newline at end of file diff --git a/source/TitleState.hx b/source/TitleState.hx index 34720d9..5ac971e 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -67,6 +67,7 @@ class TitleState extends MusicBeatState public static var currentMod:String = 'test'; public static var modFolder:String = ''; public static var onlyforabug:Bool = false; + public static var checkedVersion:Bool; override public function create():Void @@ -403,6 +404,29 @@ class TitleState extends MusicBeatState /* #if debug FlxG.save.data.exploitationState = null; #end */ + if (FlxG.save.data.checkVersion) { + var http = new haxe.Http("https://raw.githubusercontent.com/CamtheKirby/VsDave-Modable/refs/heads/main/version.downloadMe"); + var returnedData:Array = []; + + http.onData = function(data:String) + { + returnedData[0] = data.substring(0, data.indexOf(';')); + returnedData[1] = data.substring(data.indexOf('-'), data.length); + if (!MainMenuState.kadeEngineVer.contains(returnedData[0].trim()) && !checkedVersion) + { + fancyOpenURL("https://github.com/CamtheKirby/VsDave-Modable/releases/latest"); + } + checkedVersion = true; + } + + http.onError = function(error) + { + trace('error: $error'); + } + + http.request(); + } + FlxG.switchState(FlxG.save.data.alreadyGoneToWarningScreen && FlxG.save.data.exploitationState != 'playing' ? new MainMenuState() : new OutdatedSubState()); }); } diff --git a/source/UISelectState.hx b/source/UISelectState.hx deleted file mode 100644 index 95d73be..0000000 --- a/source/UISelectState.hx +++ /dev/null @@ -1,226 +0,0 @@ -package; - -import options.OptionsMenu; -import flixel.group.FlxGroup; -import haxe.Json; -import haxe.Http; -import flixel.math.FlxRandom; -import Controls.Control; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.FlxSubState; -import flixel.group.FlxGroup.FlxTypedGroup; -import flixel.system.FlxSound; -import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; -import flixel.addons.display.FlxBackdrop; -import lime.app.Application; -import options.OptionsMenu; -import haxe.Json; -import sys.io.File; - -typedef UIReplace = -{ - var replacements:Array; -} - -typedef ReplaceJson = -{ - var name:String; - var ui:String; - var image:String; - var maxNotes:Int; -} - -class UISelectState extends MusicBeatSubstate -{ - var grpMenuShit:FlxTypedGroup; - var bg:FlxBackdrop; - var bga:FlxSprite; - -var menuItems:Array = []; -var menuType:Array = []; - var curSelected:Int = 0; - - var expungedSelectWaitTime:Float = 0; - var timeElapsed:Float = 0; - var patienceTime:Float = 0; - public var rawJsonUI:String; - public var jsonUI:UIReplace; - - var funnyTexts:FlxTypedGroup = new FlxTypedGroup(); - - public function new() - { - super(); - } - - override public function create():Void - { - super.create(); - - rawJsonUI = File.getContent('mods/global/UI.json'); - jsonUI = cast Json.parse(rawJsonUI); - for (i in jsonUI.replacements) { - menuItems.push(new UIOption(i.name)); - } - - bga = new FlxSprite(-80).loadGraphic(MainMenuState.randomizeBG()); - bga.scrollFactor.set(); - bga.setGraphicSize(Std.int(bga.width * 1.1)); - bga.updateHitbox(); - bga.screenCenter(); - bga.antialiasing = FlxG.save.data.antialiasing; - bga.color = 0xFF7F7F7F; - add(bga); - - funnyTexts = new FlxTypedGroup(); - add(funnyTexts); - - var backBg:FlxSprite = new FlxSprite(); - backBg.makeGraphic(FlxG.width + 1, FlxG.height + 1, FlxColor.BLACK); - backBg.alpha = 0; - backBg.scrollFactor.set(); - add(backBg); - - bg = new FlxBackdrop(Paths.image('ui/checkeredBG', 'preload'), 1, 1, true, true, 1, 1); - bg.alpha = 0; - bg.antialiasing = FlxG.save.data.antialiasing; - bg.scrollFactor.set(); - add(bg); - - - FlxTween.tween(backBg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut}); - FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut}); - - grpMenuShit = new FlxTypedGroup(); - add(grpMenuShit); - - for (i in 0...menuItems.length) - { - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, LanguageManager.getTextString('${menuItems[i].optionName}'), true, false); - songText.isMenuItem = true; - songText.targetY = i; - if (FlxG.save.data.curRS == menuItems[i].optionName) { - songText.color = 0xFF2FFF18; - } - grpMenuShit.add(songText); - } - - changeSelection(); - - cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; - } - - override function update(elapsed:Float) - { - var scrollSpeed:Float = 50; - bg.x -= scrollSpeed * elapsed; - bg.y -= scrollSpeed * elapsed; - - timeElapsed += elapsed; - - super.update(elapsed); - - var upP = controls.UP_P; - var downP = controls.DOWN_P; - var accepted = controls.ACCEPT; - - if (upP) - { - changeSelection(-1); - } - if (downP) - { - changeSelection(1); - } - - - if (accepted) - { - selectOption(); - } - if (controls.BACK) - { - FlxG.save.flush(); - FlxG.switchState(new OptionsMenu()); - } - } - function selectOption() - { - var daSelected:String = menuItems[curSelected].optionName; - - switch (daSelected) - { - - default: - for (item in grpMenuShit.members) - { - item.color = 0xFFFFFFFF; - } - if (FlxG.save.data.curRS == daSelected) { - grpMenuShit.members[curSelected].color = 0xFFFFFFFF; - FlxG.save.data.curRS = ''; - } else { - grpMenuShit.members[curSelected].color = 0xFF2FFF18; - FlxG.save.data.curRS = daSelected; - } - trace(FlxG.save.data.curRS); - } - } - - override function destroy() - { - super.destroy(); - } - - function changeSelection(change:Int = 0):Void - { - curSelected += change; - - if (curSelected < 0) - curSelected = menuItems.length - 1; - if (curSelected >= menuItems.length) - curSelected = 0; - - var bullShit:Int = 0; - - for (item in grpMenuShit.members) - { - item.targetY = bullShit - curSelected; - bullShit++; - - item.alpha = 0.6; - // item.setGraphicSize(Std.int(item.width * 0.8)); - - if (item.targetY == 0) - { - item.alpha = 1; - // item.setGraphicSize(Std.int(item.width)); - } - } - } -} -class UIOption -{ - public var optionName:String; - - public function new(optionName:String) - { - this.optionName = optionName; - } - - public static function getOption(list:Array, optionName:String):UIOption - { - for (option in list) - { - if (option.optionName == optionName) - { - return option; - } - } - return null; - } -} \ No newline at end of file diff --git a/source/options/OptionsMenu.hx b/source/options/OptionsMenu.hx index be4110d..99b8a30 100644 --- a/source/options/OptionsMenu.hx +++ b/source/options/OptionsMenu.hx @@ -66,6 +66,7 @@ typedef OptionsJson = var playerLight:Bool; var adminMode:Bool; var wantShaders:Bool; + var checkVersion:Bool; } class OptionsMenu extends MusicBeatState @@ -130,7 +131,6 @@ class OptionsMenu extends MusicBeatState controlsStrings = CoolUtil.coolStringFile( LanguageManager.getTextString('option_change_langauge') + "\n" + LanguageManager.getTextString('option_change_keybinds') - + "\n" + ("UI Selecter") + "\n" + ("Gameplay") + "\n" + ("Visuals") + "\n" + ("Optimization") @@ -214,17 +214,12 @@ class OptionsMenu extends MusicBeatState }); updateGroupControls(LanguageManager.getTextString('option_change_keybinds'), 0, 'Vertical'); case 2: - if (FileSystem.exists('mods/global/UI.json')) { - FlxG.switchState(new UISelectState()); - } - updateGroupControls("UI Selecter", 12, 'Vertical'); - case 3: FlxG.switchState(new GamePlay()); updateGroupControls("Gameplay", 12, 'Vertical'); - case 4: + case 3: FlxG.switchState(new Visuals()); updateGroupControls("Visuals", 12, 'Vertical'); - case 5: + case 4: FlxG.switchState(new Optimization()); updateGroupControls("Optimization", 12, 'Vertical'); } @@ -289,7 +284,8 @@ class OptionsMenu extends MusicBeatState "cameraZoom": FlxG.save.data.cameraZoom, "comboStack": FlxG.save.data.comboStack, "discord": FlxG.save.data.discord, - "healthBO": FlxG.save.data.healthBO + "healthBO": FlxG.save.data.healthBO, + "checkVersion": FlxG.save.data.checkVersion }; var data:String = Json.stringify(json); @@ -395,6 +391,7 @@ class OptionsMenu extends MusicBeatState FlxG.save.data.comboStack = jsonOptions.comboStack; FlxG.save.data.discord = jsonOptions.discord; FlxG.save.data.healthBO = jsonOptions.healthBO; + FlxG.save.data.checkVersion = jsonOptions.checkVersion; _file = null; diff --git a/source/options/Visuals.hx b/source/options/Visuals.hx index 5284df1..ee402e6 100644 --- a/source/options/Visuals.hx +++ b/source/options/Visuals.hx @@ -74,6 +74,7 @@ class Visuals extends MusicBeatState + "\n" + (FlxG.save.data.comboStack ? "Combo Stacking ON" : "Combo Stacking OFF") + "\n" + (FlxG.save.data.discord ? "Discord Rich Presence ON" : "Discord Rich Presence OFF") + "\n" + ("Health Bar and Icon Transparency") + + "\n" + (FlxG.save.data.checkVersion ? "Check For Updates ON" : "Check For Updates OFF") ); grpControls = new FlxTypedGroup(); @@ -206,6 +207,9 @@ class Visuals extends MusicBeatState updateGroupControls('Health Bar and Icon Transparency', 12, 'Vertical'); numberOption = 'Health Bar and Icon Transparency: ' + FlxG.save.data.healthBO; versionShit.text = numberOption + "\nOffset (Left, Right): " + FlxG.save.data.offset; + case 16: + FlxG.save.data.checkVersion = !FlxG.save.data.checkVersion; + updateGroupControls(FlxG.save.data.checkVersion ? 'Check For Updates ON' : 'Check For Updates OFF', 12, 'Vertical'); } } }