Skip to content

Commit

Permalink
Song Fix (not completely)
Browse files Browse the repository at this point in the history
Will patch out later myself
  • Loading branch information
Yoshubs authored Aug 29, 2021
2 parents 400f389 + 8a8f7bc commit 2306b23
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
15 changes: 13 additions & 2 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package;
*/
import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;
import gameFolder.meta.CoolUtil;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets;

Expand Down Expand Up @@ -132,12 +133,22 @@ class Paths

inline static public function voices(song:String)
{
return getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC, null);
var voicePath = 'songs/${song.toLowerCase()}/Voices.$SOUND_EXT';
if (!OpenFlAssets.exists(voicePath))
{
voicePath = 'songs/${CoolUtil.swapSpaceDash(song.toLowerCase())}/Voices.$SOUND_EXT';
}
return getPath(voicePath, MUSIC, null);
}

inline static public function inst(song:String)
{
return getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
var instPath = 'songs/${song.toLowerCase()}/Inst.$SOUND_EXT';
if (!OpenFlAssets.exists(instPath))
{
instPath = 'songs/${CoolUtil.swapSpaceDash(song.toLowerCase())}/Inst.$SOUND_EXT';
}
return getPath(instPath, MUSIC, null);
}

inline static public function image(key:String, ?library:String)
Expand Down
3 changes: 2 additions & 1 deletion source/gameFolder/gameObjects/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import flixel.math.FlxPoint;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import gameFolder.gameObjects.background.*;
import gameFolder.meta.CoolUtil;
import gameFolder.meta.state.PlayState;

using StringTools;
Expand Down Expand Up @@ -57,7 +58,7 @@ class Stage extends FlxTypedGroup<FlxBasic>
{
// this is because I want to avoid editing the fnf chart type
// custom stage stuffs will come with forever charts
switch (PlayState.SONG.song.toLowerCase())
switch (CoolUtil.spaceToDash(PlayState.SONG.song.toLowerCase()))
{
case 'spookeez' | 'south' | 'monster':
curStage = 'spooky';
Expand Down
10 changes: 10 additions & 0 deletions source/gameFolder/meta/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ class CoolUtil
return string.replace("-", " ");
}

public static function spaceToDash(string:String):String
{
return string.replace(" ", "-");
}

public static function swapSpaceDash(string:String):String
{
return StringTools.contains(string, '-') ? dashToSpace(string) : spaceToDash(string);
}

public static function coolTextFile(path:String):Array<String>
{
var daList:Array<String> = Assets.getText(path).trim().split('\n');
Expand Down

0 comments on commit 2306b23

Please sign in to comment.