From 83d6f59a28ae15d06c0a6bbd12230cbe1c21d644 Mon Sep 17 00:00:00 2001 From: AT <101066547+UmbratheUmbreon@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:50:09 -0700 Subject: [PATCH] 0.8.0e Patch Hopefully last patch so many crashes... --- assets/preload/update/tracking/GitVer.txt | 2 +- source/Character.hx | 34 +++++++++++++---------- source/Main.hx | 2 +- source/SoundTestState.hx | 12 ++++---- source/editors/CharacterEditorState.hx | 2 +- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/assets/preload/update/tracking/GitVer.txt b/assets/preload/update/tracking/GitVer.txt index 43f7227..437cab5 100644 --- a/assets/preload/update/tracking/GitVer.txt +++ b/assets/preload/update/tracking/GitVer.txt @@ -1 +1 @@ -0.8.0d \ No newline at end of file +0.8.0e \ No newline at end of file diff --git a/source/Character.hx b/source/Character.hx index d61a86f..eea6f4e 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -678,23 +678,27 @@ class Character extends FlxSprite public function getAnimationsFromXml():Array { + Paths.setModsDirectoryFromType(CHARACTER, curCharacter, false); var arr:Array = []; - switch (_spriteType) { - case 'sparrow': - var data:Access = new Access(Xml.parse(Paths.getTextFromFile('images/$imageFile.xml')).firstElement()); - for (texture in data.nodes.SubTexture) arr.push(texture.att.name.substr(0, texture.att.name.length - 3)); - //? do i need substr here? i cant really check since no one uses these - /*case 'packer': - var data = Paths.getTextFromFile('images/$imageFile.xml').trim().split('\n'); - for (i in 0...data.length) - { - var currImageData = data[i].split("="); - arr.push(currImageData[0].trim()); - } - case 'texpack': - var xml = Xml.parse(Paths.getTextFromFile('images/$imageFile.xml')); - for (sprite in xml.firstElement().elements()) arr.push(sprite.get("n"));*/ + if (Paths.fileExists('images/$imageFile.xml', TEXT)) { + switch (_spriteType) { + case 'sparrow': + var data:Access = new Access(Xml.parse(Paths.getTextFromFile('images/$imageFile.xml')).firstElement()); + for (texture in data.nodes.SubTexture) arr.push(texture.att.name.substr(0, texture.att.name.length - 3)); + //? do i need substr here? i cant really check since no one uses these + /*case 'packer': + var data = Paths.getTextFromFile('images/$imageFile.xml').trim().split('\n'); + for (i in 0...data.length) + { + var currImageData = data[i].split("="); + arr.push(currImageData[0].trim()); + } + case 'texpack': + var xml = Xml.parse(Paths.getTextFromFile('images/$imageFile.xml')); + for (sprite in xml.firstElement().elements()) arr.push(sprite.get("n"));*/ + } } + Paths.setModsDirectoryFromType(NONE, '', true); return CoolUtil.removeDuplicates(arr); } } diff --git a/source/Main.hx b/source/Main.hx index e569216..6b2a0f2 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -60,7 +60,7 @@ class Main extends Sprite * * Use `debugVersion` to get the version with build date. */ - public static final denpaEngineVersion:GameVersion = new GameVersion(0, 8, 0, 'd'); + public static final denpaEngineVersion:GameVersion = new GameVersion(0, 8, 0, 'e'); public static var fpsCounter:FramerateDisplay; public static var ramCount:DebugDisplay; diff --git a/source/SoundTestState.hx b/source/SoundTestState.hx index 2079e42..c5158f6 100644 --- a/source/SoundTestState.hx +++ b/source/SoundTestState.hx @@ -98,11 +98,13 @@ class SoundTestState extends MusicBeatState } #if MODS_ALLOWED path = Paths.modFolders("data/albums"); - for (file in FileSystem.readDirectory(path)) { - if (file.endsWith(".json")) { - albums.push(Json.parse(Paths.getTextFromFile("data/albums" + '/' + file))); - } - } + if (FileSystem.exists(path)) { + for (file in FileSystem.readDirectory(path)) { + if (file.endsWith(".json")) { + albums.push(Json.parse(Paths.getTextFromFile("data/albums" + '/' + file))); + } + } + } #end totalDisks = albums.length-1; diff --git a/source/editors/CharacterEditorState.hx b/source/editors/CharacterEditorState.hx index 5b5667b..7da0741 100644 --- a/source/editors/CharacterEditorState.hx +++ b/source/editors/CharacterEditorState.hx @@ -2019,7 +2019,7 @@ class CharacterEditorState extends MusicBeatState switch(event.type) { case MouseEvent.MOUSE_DOWN | MouseEvent.RIGHT_MOUSE_DOWN: - if (char == null || char.iconProperties == null || char.animationsArray == null) return; + if (char == null || char.iconProperties == null || char.animationsArray == null || editOffsetsCheckbox == null || char.animationsArray[curAnim] == null) return; initialXY = editOffsetsCheckbox.checked ? [Std.int(char.iconProperties.offsets[0]), Std.int(char.iconProperties.offsets[1])] : char.animationsArray[curAnim].offsets; camXY = [char.cameraPosition.x, char.cameraPosition.y]; mouseXY = [FlxG.mouse.x, FlxG.mouse.y];