Skip to content

Commit

Permalink
YESSS I FIGURED IT OUT | Song Support added
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed May 18, 2024
1 parent 67bc155 commit 37a1c0b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mods/test/data/charts/test.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FreeplayState extends MusicBeatState
private var InMainFreeplayState:Bool = false;

private var CurrentSongIcon:FlxSprite;
var customSongs = CoolUtil.coolTextFile('mods/' + TitleState.currentMod + '/data/CustomSongs.txt'); // idk should work
var customSongs = CoolUtil.coolTextFile(TitleState.modFolder + '/data/CustomSongs.txt'); // idk should work

private var Catagories:Array<String> = ['dave', 'joke', 'extras', 'mod'];
var translatedCatagory:Array<String> = [LanguageManager.getTextString('freeplay_dave'), LanguageManager.getTextString('freeplay_joke'), LanguageManager.getTextString('freeplay_extra')];
Expand Down
14 changes: 11 additions & 3 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,19 @@ class Paths
return sound(key + FlxG.random.int(min, max), library);
}

inline static public function customChart(key:String)
{
return TitleState.modFolder + '/data/charts/$key.json';
}

inline static public function music(key:String, ?library:String)
{
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
}

inline static public function voices(song:String, addon:String = "")
{
if (OpenFlAssets.exists('${(song)}/Voices${(addon)}')) {
if (!FreeplayState.isaCustomSong) {
var songKey:String = '${(song)}/Voices${(addon)}';
var voices = returnSound(null, songKey, 'songs');
return voices;
Expand All @@ -169,7 +174,7 @@ class Paths

inline static public function inst(song:String)
{
if (OpenFlAssets.exists('${(song)}/Inst')) {
if (!FreeplayState.isaCustomSong) {
var songKey:String = '${(song)}/Inst';
var inst = returnSound(null, songKey, 'songs');
return inst;
Expand Down Expand Up @@ -226,7 +231,10 @@ class Paths
}
var gottenPath:String = '$key.$SOUND_EXT';
if(path != null) gottenPath = '$path/$gottenPath';
// gottenPath = getPath(gottenPath, SOUND, library);
if (!FreeplayState.isaCustomSong)
{
gottenPath = getPath(gottenPath, SOUND, library);
}
gottenPath = gottenPath.substring(gottenPath.indexOf(':') + 1, gottenPath.length);
if(!currentTrackedSounds.exists(gottenPath))

Expand Down
2 changes: 1 addition & 1 deletion source/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Song
public static function loadFromCustomJson(jsonInput:String):SwagSong
{
#if sys
var rawJson = File.getContent('mods/' + TitleState.currentMod + '/data/charts/' + jsonInput.toLowerCase()).trim() + '.json';
var rawJson = File.getContent(Paths.customChart(jsonInput.toLowerCase())).trim();
#else
var rawJson = Assets.getText(Paths.chart(jsonInput.toLowerCase())).trim();
#end
Expand Down
1 change: 1 addition & 0 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TitleState extends MusicBeatState
var loopEyeTween:FlxTween;
public static var mods:Array<String> = [];
public static var currentMod:String = "test";
public static var modFolder:String = 'mods/' + currentMod;


override public function create():Void
Expand Down

0 comments on commit 37a1c0b

Please sign in to comment.