From 225ee24fc349beb68a83bd0321686d0c25881602 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Wed, 10 Feb 2021 14:18:14 -0600 Subject: [PATCH] move files to weeks and load songs individually --- Project.xml | 56 +++++++----- source/ChartParser.hx | 2 +- source/ChartingState.hx | 4 +- source/DialogueBox.hx | 59 ++++++------ source/FreeplayState.hx | 8 +- source/LoadingState.hx | 193 ++++++++++++++++----------------------- source/Note.hx | 2 + source/OptionsMenu.hx | 2 +- source/Paths.hx | 30 +++++- source/PlayState.hx | 33 ++++--- source/Song.hx | 2 +- source/StoryMenuState.hx | 2 +- source/TitleState.hx | 9 +- 13 files changed, 205 insertions(+), 197 deletions(-) diff --git a/Project.xml b/Project.xml index 80f5bc764..9215a2185 100644 --- a/Project.xml +++ b/Project.xml @@ -40,42 +40,56 @@ - - + + + + + + + + + - - - - - + + - + + + + + + + - + - + - + - + - - - + @@ -101,7 +115,7 @@ - + diff --git a/source/ChartParser.hx b/source/ChartParser.hx index cba97ce80..3884c0e54 100644 --- a/source/ChartParser.hx +++ b/source/ChartParser.hx @@ -11,7 +11,7 @@ class ChartParser var IMG_WIDTH:Int = 8; var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g"); - var csvData = FlxStringUtil.imageToCSV('assets/data/' + songName + '/' + songName + '_section' + section + '.png'); + var csvData = FlxStringUtil.imageToCSV(Paths.file('data/' + songName + '/' + songName + '_section' + section + '.png')); var lines:Array = regex.split(csvData); var rows:Array = lines.filter(function(line) return line != ""); diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 0e7afa2a2..cc7d91846 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -225,7 +225,7 @@ class ChartingState extends MusicBeatState stepperBPM.value = Conductor.bpm; stepperBPM.name = 'song_bpm'; - var characters:Array = CoolUtil.coolTextFile('assets/data/characterList.txt'); + var characters:Array = CoolUtil.coolTextFile(Paths.txt('characterList')); var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) { @@ -351,7 +351,7 @@ class ChartingState extends MusicBeatState // vocals.stop(); } - FlxG.sound.playMusic('assets/music/' + daSong + "_Inst" + TitleState.soundExt, 0.6); + FlxG.sound.playMusic(Paths.inst(daSong), 0.6); // WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER vocals = new FlxSound().loadEmbedded(Paths.music(daSong + "_Voices")); diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index 868c780f2..4b4252506 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -60,24 +60,6 @@ class DialogueBox extends FlxSpriteGroup bgFade.alpha = 0.7; }, 5); - portraitLeft = new FlxSprite(-20, 40); - portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); - portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); - portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9)); - portraitLeft.updateHitbox(); - portraitLeft.scrollFactor.set(); - add(portraitLeft); - portraitLeft.visible = false; - - portraitRight = new FlxSprite(0, 40); - portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait'); - portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false); - portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9)); - portraitRight.updateHitbox(); - portraitRight.scrollFactor.set(); - add(portraitRight); - portraitRight.visible = false; - box = new FlxSprite(-20, 45); var hasDialog = false; @@ -107,19 +89,40 @@ class DialogueBox extends FlxSpriteGroup add(face); } - if (hasDialog) - { - box.animation.play('normalOpen'); - box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); - box.updateHitbox(); - add(box); - } + this.dialogueList = dialogueList; + + if (!hasDialog) + return; + + portraitLeft = new FlxSprite(-20, 40); + portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); + portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); + portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9)); + portraitLeft.updateHitbox(); + portraitLeft.scrollFactor.set(); + add(portraitLeft); + portraitLeft.visible = false; + + portraitRight = new FlxSprite(0, 40); + portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait'); + portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false); + portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9)); + portraitRight.updateHitbox(); + portraitRight.scrollFactor.set(); + add(portraitRight); + portraitRight.visible = false; + + box.animation.play('normalOpen'); + box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); + box.updateHitbox(); + add(box); + + box.screenCenter(X); + portraitLeft.screenCenter(X); handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox')); add(handSelect); - box.screenCenter(X); - portraitLeft.screenCenter(X); if (!talkingRight) { @@ -140,8 +143,6 @@ class DialogueBox extends FlxSpriteGroup dialogue = new Alphabet(0, 80, "", false, true); // dialogue.x = 90; // add(dialogue); - - this.dialogueList = dialogueList; } var dialogueOpened:Bool = false; diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index c1f02ce07..b39ebc973 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -30,7 +30,7 @@ class FreeplayState extends MusicBeatState override function create() { - songs = CoolUtil.coolTextFile('assets/data/freeplaySonglist.txt'); + songs = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); /* if (FlxG.sound.music != null) @@ -104,7 +104,7 @@ class FreeplayState extends MusicBeatState scoreText = new FlxText(FlxG.width * 0.7, 5, 0, "", 32); // scoreText.autoSize = false; - scoreText.setFormat("assets/fonts/vcr.ttf", 32, FlxColor.WHITE, RIGHT); + scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT); // scoreText.alignment = RIGHT; var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 66, 0xFF000000); @@ -249,7 +249,9 @@ class FreeplayState extends MusicBeatState // lerpScore = 0; #end - FlxG.sound.playMusic('assets/music/' + songs[curSelected] + "_Inst" + TitleState.soundExt, 0); + #if PRELOAD_ALL + FlxG.sound.playMusic(Paths.inst(songs[curSelected]), 0); + #end var bullShit:Int = 0; diff --git a/source/LoadingState.hx b/source/LoadingState.hx index 64fb3c87f..8e3676ec0 100644 --- a/source/LoadingState.hx +++ b/source/LoadingState.hx @@ -1,5 +1,7 @@ package; +import lime.app.Promise; +import lime.app.Future; import flixel.FlxG; import flixel.FlxState; import flixel.FlxSprite; @@ -8,11 +10,8 @@ import flixel.util.FlxTimer; import openfl.utils.Assets; import lime.utils.Assets as LimeAssets; -import lime.utils.AssetBundle; import lime.utils.AssetLibrary; import lime.utils.AssetManifest; -import lime.app.Future; -import lime.app.Promise; import haxe.io.Path; @@ -38,7 +37,7 @@ class LoadingState extends MusicBeatState override function create() { logo = new FlxSprite(-150, -100); - logo.frames = FlxAtlasFrames.fromSparrow('assets/images/logoBumpin.png', 'assets/images/logoBumpin.xml'); + logo.frames = Paths.getSparrowAtlas('logoBumpin'); logo.antialiasing = true; logo.animation.addByPrefix('bump', 'logo bumpin', 24); logo.animation.play('bump'); @@ -47,31 +46,33 @@ class LoadingState extends MusicBeatState // logoBl.color = FlxColor.BLACK; gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); - gfDance.frames = FlxAtlasFrames.fromSparrow('assets/images/gfDanceTitle.png', 'assets/images/gfDanceTitle.xml'); + gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); gfDance.antialiasing = true; add(gfDance); add(logo); - // function onSongsManifestInit() - // { - callbacks = new MultiCallback(onLoad); - var introComplete = callbacks.add("introComplete"); - checkLoadSong(getSongPath()); - checkLoadSong(getVocalPath()); - checkLibrary("shared"); - if (PlayState.storyWeek > 0) - checkLibrary("week" + PlayState.storyWeek); - else - checkLibrary("tutorial"); - - var fadeTime = 0.5; - FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true); - new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete()); - // } - - // initSongsManifest(onSongsManifestInit); + initSongsManifest().onComplete + ( + function (lib) + { + callbacks = new MultiCallback(onLoad); + var introComplete = callbacks.add("introComplete"); + checkLoadSong(getSongPath()); + if (PlayState.SONG.needsVoices) + checkLoadSong(getVocalPath()); + checkLibrary("shared"); + if (PlayState.storyWeek > 0) + checkLibrary("week" + PlayState.storyWeek); + else + checkLibrary("tutorial"); + + var fadeTime = 0.5; + FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true); + new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete()); + } + ); } function checkLoadSong(path:String) @@ -80,10 +81,10 @@ class LoadingState extends MusicBeatState { var library = Assets.getLibrary("songs"); final symbolPath = path.split(":").pop(); - @:privateAccess - library.types.set(symbolPath, SOUND); - @:privateAccess - library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]); + // @:privateAccess + // library.types.set(symbolPath, SOUND); + // @:privateAccess + // library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]); var callback = callbacks.add("song:" + path); Assets.loadSound(path).onComplete(function (_) { callback(); }); } @@ -91,8 +92,13 @@ class LoadingState extends MusicBeatState function checkLibrary(library:String) { + trace(Assets.hasLibrary(library)); if (Assets.getLibrary(library) == null) { + @:privateAccess + if (!LimeAssets.libraryPaths.exists(library)) + throw "Missing library: " + library; + var callback = callbacks.add("library:" + library); Assets.loadLibrary(library).onComplete(function (_) { callback(); }); } @@ -114,6 +120,10 @@ class LoadingState extends MusicBeatState override function update(elapsed:Float) { super.update(elapsed); + #if debug + if (FlxG.keys.justPressed.SPACE) + trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired()); + #end } function onLoad() @@ -141,6 +151,7 @@ class LoadingState extends MusicBeatState static function getNextState(target:FlxState, stopMusic = false):FlxState { + Paths.setCurrentLevel("week" + PlayState.storyWeek); #if js var loaded = isSoundLoaded(getSongPath()) && (!PlayState.SONG.needsVoices || isSoundLoaded(getVocalPath())) @@ -174,110 +185,68 @@ class LoadingState extends MusicBeatState callbacks = null; } - - /** - * creates the song manifest without loading all the songs so we can load them individually - * @param onComplete called on load - * @return Future - */ - static function initSongsManifest(onComplete:Void->Void):Future + static function initSongsManifest() { - final id = "songs"; + var id = "songs"; var promise = new Promise(); - // #if (tools && !display && !macro) var library = LimeAssets.getLibrary(id); if (library != null) { - onComplete(); return Future.withValue(library); } - + var path = id; var rootPath = null; - - // @:privateAccess - // if (LimeAssets.bundlePaths.exists(id)) - // { - // AssetBundle.loadFromFile(bundlePaths.get(id)).onComplete(function(bundle) - // { - // if (bundle == null) - // { - // promise.error("Cannot load bundle for library \"" + id + "\""); - // return; - // } - // var library = AssetLibrary.fromBundle(bundle); - - // if (library == null) - // { - // promise.error("Cannot open library \"" + id + "\""); - // } - // else - // { - // libraries.set(id, library); - // library.onChange.add(LimeAssets.onChange.dispatch); - // promise.completeWith(Future.withValue(library)); - // onComplete(); - // } - // }).onError(function(_) - // { - // promise.error("There is no asset library with an ID of \"" + id + "\""); - // }); - // } - // else - // { - @:privateAccess - final libraryPaths = LimeAssets.libraryPaths; - if (libraryPaths.exists(id)) + @:privateAccess + var libraryPaths = LimeAssets.libraryPaths; + if (libraryPaths.exists(id)) + { + path = libraryPaths[id]; + rootPath = Path.directory(path); + } + else + { + if (StringTools.endsWith(path, ".bundle")) { - path = libraryPaths[id]; - rootPath = Path.directory(path); + rootPath = path; + path += "/library.json"; } else { - if (StringTools.endsWith(path, ".bundle")) - { - rootPath = path; - path += "/library.json"; - } - else - { - rootPath = Path.directory(path); - } - @:privateAccess - path = LimeAssets.__cacheBreak(path); + rootPath = Path.directory(path); + } + @:privateAccess + path = LimeAssets.__cacheBreak(path); + } + + AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest) + { + if (manifest == null) + { + promise.error("Cannot parse asset manifest for library \"" + id + "\""); + return; } - AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest) - { - if (manifest == null) - { - promise.error("Cannot parse asset manifest for library \"" + id + "\""); - return; - } + var library = AssetLibrary.fromManifest(manifest); - var library = AssetLibrary.fromManifest(manifest); - - if (library == null) - { - promise.error("Cannot open library \"" + id + "\""); - } - else - { - @:privateAccess - LimeAssets.libraries.set(id, library); - library.onChange.add(LimeAssets.onChange.dispatch); - promise.completeWith(Future.withValue(library)); - onComplete(); - } - }).onError(function(_) + if (library == null) { - promise.error("There is no asset library with an ID of \"" + id + "\""); - }); - // } - // #end + promise.error("Cannot open library \"" + id + "\""); + } + else + { + @:privateAccess + LimeAssets.libraries.set(id, library); + library.onChange.add(LimeAssets.onChange.dispatch); + promise.completeWith(Future.withValue(library)); + } + }).onError(function(_) + { + promise.error("There is no asset library with an ID of \"" + id + "\""); + }); return promise.future; } @@ -337,5 +306,5 @@ class MultiCallback } public function getFired() return fired.copy(); - public function getUnfired() return [for (id in unfired) id]; + public function getUnfired() return [for (id in unfired.keys()) id]; } \ No newline at end of file diff --git a/source/Note.hx b/source/Note.hx index 781206b3f..d0560636c 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -4,7 +4,9 @@ import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.math.FlxMath; import flixel.util.FlxColor; +#if polymod import polymod.format.ParseRules.TargetSignatureElement; +#end using StringTools; diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 76a175890..bf36c83d5 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -24,7 +24,7 @@ class OptionsMenu extends MusicBeatState override function create() { var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat')); - controlsStrings = CoolUtil.coolTextFile('assets/data/controls.txt'); + controlsStrings = CoolUtil.coolTextFile(Paths.txt('controls')); menuBG.color = 0xFFea71fd; menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); menuBG.updateHitbox(); diff --git a/source/Paths.hx b/source/Paths.hx index 4e2094c42..73214c00c 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -30,7 +30,7 @@ class Paths return levelPath; } - return 'assets/$file'; + return 'assets/preload/$file'; } inline static function getLibraryPath(library:String, file:String) @@ -43,14 +43,29 @@ class Paths return getPath(file, type); } - inline static public function sound(key:String) + inline static public function txt(key:String) + { + return getPath('data/$key.txt', TEXT); + } + + inline static public function xml(key:String) + { + return getPath('data/$key.xml', TEXT); + } + + inline static public function json(key:String) + { + return getPath('data/$key.json', TEXT); + } + + static public function sound(key:String) { return getPath('sounds/$key.$SOUND_EXT', SOUND); } inline static public function soundRandom(key:String, min:Int, max:Int) { - return getPath('sounds/$key${FlxG.random.int(min, max)}.$SOUND_EXT', SOUND); + return sound(key + FlxG.random.int(min, max)); } inline static public function music(key:String) @@ -60,12 +75,12 @@ class Paths inline static public function voices(song:String) { - return "songs:" + getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC); + return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT'; } inline static public function inst(song:String) { - return "songs:" + getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC); + return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT'; } inline static public function image(key:String) @@ -73,6 +88,11 @@ class Paths return getPath('images/$key.png', IMAGE); } + inline static public function font(key:String) + { + return 'assets/fonts/$key'; + } + inline static public function getSparrowAtlas(key:String) { return FlxAtlasFrames.fromSparrow(image(key), file('images/$key.xml')); diff --git a/source/PlayState.hx b/source/PlayState.hx index 45149110e..225f3e44e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -139,7 +139,6 @@ class PlayState extends MusicBeatState if (SONG == null) SONG = Song.loadFromJson('tutorial'); - Paths.setCurrentLevel(SONG.song); Conductor.changeBPM(SONG.bpm); @@ -163,11 +162,11 @@ class PlayState extends MusicBeatState "Only then I will even CONSIDER letting you\ndate my daughter!" ]; case 'senpai': - dialogue = CoolUtil.coolTextFile('assets/data/senpai/senpaiDialogue.txt'); + dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue')); case 'roses': - dialogue = CoolUtil.coolTextFile('assets/data/roses/rosesDialogue.txt'); + dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue')); case 'thorns': - dialogue = CoolUtil.coolTextFile('assets/data/thorns/thornsDialogue.txt'); + dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south') @@ -676,7 +675,7 @@ class PlayState extends MusicBeatState add(healthBar); scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20); - scoreTxt.setFormat("assets/fonts/vcr.ttf", 16, FlxColor.WHITE, RIGHT); + scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT); scoreTxt.scrollFactor.set(); add(scoreTxt); @@ -866,16 +865,16 @@ class PlayState extends MusicBeatState boyfriend.playAnim('idle'); var introAssets:Map> = new Map>(); - introAssets.set('default', ['ready.png', "set.png", "go.png"]); + introAssets.set('default', ['ready', "set", "go"]); introAssets.set('school', [ - 'weeb/pixelUI/ready-pixel.png', - 'weeb/pixelUI/set-pixel.png', - 'weeb/pixelUI/date-pixel.png' + 'weeb/pixelUI/ready-pixel', + 'weeb/pixelUI/set-pixel', + 'weeb/pixelUI/date-pixel' ]); introAssets.set('schoolEvil', [ - 'weeb/pixelUI/ready-pixel.png', - 'weeb/pixelUI/set-pixel.png', - 'weeb/pixelUI/date-pixel.png' + 'weeb/pixelUI/ready-pixel', + 'weeb/pixelUI/set-pixel', + 'weeb/pixelUI/date-pixel' ]); var introAlts:Array = introAssets.get('default'); @@ -896,7 +895,7 @@ class PlayState extends MusicBeatState case 0: FlxG.sound.play(Paths.sound('intro3'), 0.6); case 1: - var ready:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[0]); + var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0])); ready.scrollFactor.set(); ready.updateHitbox(); @@ -914,7 +913,7 @@ class PlayState extends MusicBeatState }); FlxG.sound.play(Paths.sound('intro2'), 0.6); case 2: - var set:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[1]); + var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1])); set.scrollFactor.set(); if (curStage.startsWith('school')) @@ -931,7 +930,7 @@ class PlayState extends MusicBeatState }); FlxG.sound.play(Paths.sound('intro1'), 0.6); case 3: - var go:FlxSprite = new FlxSprite().loadGraphic('assets/images/' + introAlts[2]); + var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2])); go.scrollFactor.set(); if (curStage.startsWith('school')) @@ -1743,7 +1742,7 @@ class PlayState extends MusicBeatState pixelShitPart2 = '-pixel'; } - rating.loadGraphic('assets/images/' + pixelShitPart1 + daRating + pixelShitPart2 + ".png"); + rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2)); rating.screenCenter(); rating.x = coolText.x - 40; rating.y -= 60; @@ -2041,7 +2040,7 @@ class PlayState extends MusicBeatState if (!boyfriend.stunned) { health -= 0.04; - if (combo > 5) + if (combo > 5 && gf.animOffsets.exists('sad')) { gf.playAnim('sad'); } diff --git a/source/Song.hx b/source/Song.hx index 55827e79b..51d0f3191 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -50,7 +50,7 @@ class Song public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong { - var rawJson = Assets.getText('assets/data/' + folder.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim(); + var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim(); while (!rawJson.endsWith("}")) { diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index bd5f13e51..27c63e7b6 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -86,7 +86,7 @@ class StoryMenuState extends MusicBeatState var rankText:FlxText = new FlxText(0, 10); rankText.text = 'RANK: GREAT'; - rankText.setFormat("assets/fonts/vcr.ttf", 32); + rankText.setFormat(Paths.font("vcr.ttf"), 32); rankText.size = scoreText.size; rankText.screenCenter(X); diff --git a/source/TitleState.hx b/source/TitleState.hx index cfdaea54c..afd7bd5bb 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -23,7 +23,6 @@ import flixel.util.FlxTimer; import io.newgrounds.NG; import lime.app.Application; import openfl.Assets; -import polymod.Polymod; using StringTools; @@ -44,8 +43,10 @@ class TitleState extends MusicBeatState override public function create():Void { - Polymod.init({modRoot: "mods", dirs: ['introMod']}); - + #if polymod + polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); + #end + #if (!web) TitleState.soundExt = '.ogg'; #end @@ -206,7 +207,7 @@ class TitleState extends MusicBeatState function getIntroTextShit():Array> { - var fullText:String = Assets.getText('assets/data/introText.txt'); + var fullText:String = Assets.getText(Paths.txt('introText')); var firstArray:Array = fullText.split('\n'); var swagGoodArray:Array> = [];