diff --git a/art/ffmpeg.exe b/art/ffmpeg.exe deleted file mode 100644 index 378e79da..00000000 Binary files a/art/ffmpeg.exe and /dev/null differ diff --git a/project.xml b/project.xml index ad30a332..2176eadd 100644 --- a/project.xml +++ b/project.xml @@ -42,9 +42,6 @@ - - - @@ -72,7 +69,6 @@ - diff --git a/source/funkin/objects/NotesGroup.hx b/source/funkin/objects/NotesGroup.hx index af830704..59d52b79 100644 --- a/source/funkin/objects/NotesGroup.hx +++ b/source/funkin/objects/NotesGroup.hx @@ -106,7 +106,7 @@ class NotesGroup extends Group instance = this; game = isPlayState ? PlayState.instance : null; this.isPlayState = isPlayState; - //SONG = Song.checkSong(song, null, false); //Double check null values + SONG = song; curSong = SONG.song; diff --git a/source/funkin/objects/RatingGroup.hx b/source/funkin/objects/RatingGroup.hx index 6e1ed384..65301891 100644 --- a/source/funkin/objects/RatingGroup.hx +++ b/source/funkin/objects/RatingGroup.hx @@ -76,15 +76,19 @@ class RatingGroup extends TypedSpriteGroup } } -class JudgeRating extends RemoveRating { - public static var judgeRatings:Array = ['shit', 'bad', 'good', 'sick']; +class JudgeRating extends RemoveRating +{ var animated:Bool = true; + public function new() { super(); + + var judgeRatings:Array = ['shit', 'bad', 'good', 'sick']; + judgeRatings.fastForEach((i, _) -> { var oldJudge = Paths.png('skins/${SkinUtil.curSkin}/ratings/$i'); if (Paths.exists(oldJudge, IMAGE)) { - animated = false; // Backwards compatibility ??? + animated = false; // Backwards compatibility break; } }); @@ -123,25 +127,39 @@ class ComboRating extends RemoveRating { } } -class NumRating extends RemoveRating { +class NumRating extends RemoveRating +{ public var initScale:Float = 1; + var animated:Bool = true; public function new() { super(); - final path:String = 'skins/${SkinUtil.curSkin}/ratings/nums'; - loadImage(path, false, null, null, lodLevel); - loadGraphic(graphic, true, Std.int(width * 0.1 / lodScale), Std.int(height / lodScale)); for (i in 0...10) - animation.add(Std.string(i), [i], 1); + { + var oldNum = Paths.png('skins/${SkinUtil.curSkin}/ratings/num$i'); + if (Paths.exists(oldNum, IMAGE)) { + animated = false; // Backwards compatibility + break; + } + } - setScale(scale.x); - initScale = scale.x; + if (animated) { + final path:String = 'skins/${SkinUtil.curSkin}/ratings/nums'; + loadImage(path, false, null, null, lodLevel); + + loadGraphic(graphic, true, Std.int(width * 0.1 / lodScale), Std.int(height / lodScale)); + for (i in 0...10) + animation.add(Std.string(i), [i], 1); + + setScale(scale.x); + initScale = scale.x; + } } public function init(num:String, id:Int = 0) { setPosition(0, 100); - animation.play(num, true); + animated ? animation.play(num, true) : loadImage('skins/${SkinUtil.curSkin}/ratings/num$num', false, null, null, lodLevel); updateHitbox(); start(Conductor.crochetMills * 2, Conductor.stepCrochet * 0.025); jump(0.8); diff --git a/source/funkin/states/PlayState.hx b/source/funkin/states/PlayState.hx index 67424648..cc313390 100644 --- a/source/funkin/states/PlayState.hx +++ b/source/funkin/states/PlayState.hx @@ -140,8 +140,6 @@ class PlayState extends MusicBeatState FlxG.cameras.setDefaultDrawTarget(camGame, true); persistentUpdate = persistentDraw = true; - //SONG = Song.checkSong(SONG, null, false); - #if discord_rpc detailsText = isStoryMode ? 'Story Mode: ${storyWeek.toUpperCase()}' : 'Freeplay'; detailsPausedText = 'Paused - $detailsText'; diff --git a/source/funkin/states/options/ModFoldersState.hx b/source/funkin/states/options/ModFoldersState.hx index 3c27de0b..671815fa 100644 --- a/source/funkin/states/options/ModFoldersState.hx +++ b/source/funkin/states/options/ModFoldersState.hx @@ -1,10 +1,6 @@ package funkin.states.options; import funkin.states.options.items.ModItem; import funkin.states.options.items.SpriteButton; -#if ZIPS_ALLOWED -import haxe.io.Path; -import funkin.util.backend.SongZip; -#end class ModFoldersState extends MusicBeatState { @@ -50,23 +46,6 @@ class ModFoldersState extends MusicBeatState } super.create(); - - #if ZIPS_ALLOWED - FlxG.stage.window.onDropFile.removeAll(); - FlxG.stage.window.onDropFile.add(function (file:String) { - var extension = Path.extension(file).toLowerCase(); - if (SongZip.zipMap.exists(extension)) - { - var newPath = "./mods/" + Path.withoutDirectory(file); - sys.io.File.copy(file, newPath); - reloadFolders(); - } - else - { // Invalid mod zip format - CoolUtil.playSound("rejectMenu"); - } - }); - #end } function reloadFolders():Void { diff --git a/source/funkin/substates/NotesSubstate.hx b/source/funkin/substates/NotesSubstate.hx index 2cd40b82..972831d4 100644 --- a/source/funkin/substates/NotesSubstate.hx +++ b/source/funkin/substates/NotesSubstate.hx @@ -14,8 +14,7 @@ class NotesSubstate extends MusicBeatSubstate { super(true, 0x98000000); this.position = position; - - //SONG = Song.checkSong(song); + SONG = song; notesGroup = new NotesGroup(SONG, false); notesGroup.skipStrumIntro = true; diff --git a/source/funkin/util/CoolUtil.hx b/source/funkin/util/CoolUtil.hx index a76cf378..6a6829bf 100644 --- a/source/funkin/util/CoolUtil.hx +++ b/source/funkin/util/CoolUtil.hx @@ -30,9 +30,6 @@ class CoolUtil { public static var debugMode:Bool = false; inline public static function init():Void { - #if ZIPS_ALLOWED - FunkThread.run(funkin.util.backend.SongZip.init); - #end #if desktop ModdingUtil.reloadMods(); #end diff --git a/source/funkin/util/backend/SongZip.hx b/source/funkin/util/backend/SongZip.hx deleted file mode 100644 index 14d0ec8c..00000000 --- a/source/funkin/util/backend/SongZip.hx +++ /dev/null @@ -1,164 +0,0 @@ -package funkin.util.backend; - -import haxe.io.Path; -import flixel.util.FlxArrayUtil; -import funkin.states.editors.ModSetupState; - -enum ZipFormat { - OSU; - QUAVER; - STEPMANIA; -} - -typedef UnZipType = { - var getMap: (chart:String) -> Dynamic; - var convert: (map:Dynamic) -> SongJson; - var title: String; - var diff: String; - var audio: String; -}; - -class SongZip { - #if ZIPS_ALLOWED - - public static final zipMap:Map = [ - "osz" => OSU, - "qp" => QUAVER, - //"sm" => STEPMANIA, - //"ssc" => STEPMANIA - ]; - - static var removeQueue:Array = []; // Files that will be deleted after zips are unzipped - - public static function init() { - FlxArrayUtil.clearArray(removeQueue); - var zipArrays:Map> = []; - - for (i in zipMap.keys()) { - var zipList:Array = Paths.getModFileList('', i, false, true, false); - for (i in 0...zipList.length) zipList[i] = zipList[i].replace("//", "/"); - zipArrays.set(i, zipList); - } - - for (a in zipArrays.keys()) { - final zipType = zipMap.get(a); - for (i in zipArrays.get(a)) { - final zipPath = Paths.getModPath('$i.$a'); - final folderFormat = formatFolder(i, zipType); - final modPath = Paths.getModPath(folderFormat); - - var zipFiles = UnZipper.unzipInPath(zipPath, modPath); // Unzip and get zip files - ModSetupState.setupModFolder(folderFormat); // Setup folders - removeQueue.push(zipPath); - - switch (zipType) { - case OSU: unzipFormat("osu", modPath, zipFiles); - case QUAVER: unzipFormat("qua", modPath, zipFiles); - case STEPMANIA: - } - } - } - - if (removeQueue.length > 0) { - removeFilesFromQueue(); - ModdingUtil.reloadMods(); - } - } - - static function formatFolder(folder:String, type:ZipFormat) { - switch (type) { - case OSU: - folder = ~/(\d+ )/.replace(folder, ''); - folder = "osu-" + folder; - default: - } - return folder; - } - - static final UNZIP_FORMAT:Map = [ - /*"osu" => { - getMap: function(chart) return cast new OsuFormat(chart), - convert: function(map) return OsuFormat.convertSong("", map), - title: "Title", - diff: "Version", - audio: "AudioFilename" - }, - "qua" => { - getMap: function(chart) return cast new QuaFormat(chart), - convert: function(map) return QuaFormat.convertSong("", map), - title: "Title", - diff: "DifficultyName", - audio: "AudioFile" - }*/ - ]; - - static function unzipFormat(format:String, modPath:String, zipFiles:Array) { - var _charts:Array = []; - for (i in zipFiles) { - final _ext = Path.extension(i); - switch (_ext) { - case "qua" | "osu": _charts.push(i); - default: removeQueue.push(i); - } - } - - var formatUnzip = UNZIP_FORMAT.get(format); - var _songDiffs:Map> = []; - for (i in _charts) { - var map = formatUnzip.getMap(i); - final title = map.getVar(formatUnzip.title); - final formatTitle = Song.formatSongFolder(title); - - final mapDiff = Song.formatSongFolder(map.getVar(formatUnzip.diff)); - final mapAudio = '$modPath/${map.getVar(formatUnzip.audio)}'; - - if (_songDiffs.exists(title)) _songDiffs.get(title).push(mapDiff); - else _songDiffs.set(title, [mapDiff]); - - var chart = formatUnzip.convert(map); - createSongFolder('$modPath/songs/$formatTitle', chart, mapAudio, mapDiff); - removeQueue.push(i); - } - - for (i in _songDiffs.keys()) { - var weekJson:WeekJson = JsonUtil.copyJson(WeekSetup.DEFAULT_WEEK); - weekJson.weekDiffs = CoolUtil.customSort(_songDiffs.get(i), ['easy', 'Easy', 'EASY', 'normal', 'Normal', 'NORMAL', 'hard', 'Hard', 'HARD']); - weekJson.songList.songs = [i]; - weekJson.hideStory = true; - saveJson(weekJson, '$modPath/data/weeks/${Song.formatSongFolder(i)}.json'); - } - } - - static function saveJson(input:Dynamic, path:String) { - final jsonString = FunkyJson.stringify(cast input, "\t"); - File.saveContent(path, jsonString); - } - - static function createSongFolder(prefix:String, chart:SongJson, audio:String, diff:String = 'hard') { - for (i in ["charts", "audio"]) ModSetupState.createFolder('$prefix/$i', ""); - saveJson({song: Song.optimizeJson(chart)}, '$prefix/charts/$diff.json'); - final finalAudio = '$prefix/audio/Inst.ogg'; - if (!FileSystem.exists(finalAudio)) { - if (audio.endsWith(".ogg")) { - FileSystem.rename(audio, finalAudio); // Is an ogg, just rename it - } else { - audioToOgg(audio, finalAudio); - } - } - } - - static public function audioToOgg(path:String, output:String) { - ModSetupState.createFolder(output, ""); - Sys.command("assets/data/ffmpeg.exe", ['-y', '-loglevel', '0', '-i', path, - '-c:a', 'libvorbis', '-b:a', '64k', '-map', 'a', output]); - removeQueue.push(path); - } - - static function removeFilesFromQueue() { - for (i in removeQueue) { - if (FileSystem.exists(i)) - FileSystem.deleteFile(i); - } - } - #end -} \ No newline at end of file