fixed more things that pissed me off
This commit is contained in:
@@ -13,6 +13,11 @@ import sys.FileSystem;
|
||||
using StringTools;
|
||||
|
||||
class Chart {
|
||||
/**
|
||||
* Default background colors for songs without bg color
|
||||
*/
|
||||
public inline static var defaultColor:FlxColor = 0xFF9271FD;
|
||||
|
||||
public static function loadChartMeta(songName:String, difficulty:String = "normal", fromMods:Bool = true) {
|
||||
var metaPath = Paths.file('songs/${songName.toLowerCase()}/meta.json');
|
||||
var metaDiffPath = Paths.file('songs/${songName.toLowerCase()}/meta-${difficulty.toLowerCase()}.json');
|
||||
@@ -45,7 +50,7 @@ class Chart {
|
||||
data.setFieldDefault("coopAllowed", false);
|
||||
data.setFieldDefault("opponentModeAllowed", false);
|
||||
data.setFieldDefault("displayName", data.name);
|
||||
data.setFieldDefault("parsedColor", data.color.getColorFromDynamic());
|
||||
data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor));
|
||||
|
||||
if (data.difficulties.length <= 0) {
|
||||
data.difficulties = [for(f in Paths.getFolderContent('songs/${songName.toLowerCase()}/charts/', false, !fromMods)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
|
||||
|
||||
@@ -80,7 +80,7 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
}
|
||||
|
||||
if (!isEnding && ((!lossSFX.playing) || (character.animation.curAnim != null && character.animation.curAnim.name == "firstDeath" && character.animation.curAnim.finished)) && (FlxG.sound.music == null || !FlxG.sound.music.playing)) {
|
||||
CoolUtil.playMusic(Paths.music(gameOverSong), 100);
|
||||
CoolUtil.playMusic(Paths.music(gameOverSong), false, 1, true, 100);
|
||||
beatHit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ using StringTools;
|
||||
|
||||
class FreeplayState extends MusicBeatState
|
||||
{
|
||||
/**
|
||||
* Default background colors for songs without bg color
|
||||
*/
|
||||
public inline static var defaultColor:FlxColor = 0xFF9271FD;
|
||||
|
||||
/**
|
||||
* How much time a song stays selected until it autoplays.
|
||||
@@ -112,9 +108,23 @@ class FreeplayState extends MusicBeatState
|
||||
|
||||
override function create()
|
||||
{
|
||||
CoolUtil.playMenuSong();
|
||||
songList = FreeplaySonglist.get();
|
||||
songs = songList.songs;
|
||||
|
||||
for(k=>s in songs) {
|
||||
if (s.name == Options.freeplayLastSong) {
|
||||
curSelected = k;
|
||||
}
|
||||
}
|
||||
if (songs[curSelected] != null) {
|
||||
for(k=>diff in songs[curSelected].difficulties) {
|
||||
if (diff == Options.freeplayLastDifficulty) {
|
||||
curDifficulty = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DiscordUtil.changePresence("In the Menus", null);
|
||||
|
||||
// LOAD CHARACTERS
|
||||
@@ -266,6 +276,9 @@ class FreeplayState extends MusicBeatState
|
||||
|
||||
if (event.cancelled) return;
|
||||
|
||||
Options.freeplayLastSong = songs[curSelected].name;
|
||||
Options.freeplayLastDifficulty = songs[curSelected].difficulties[curDifficulty];
|
||||
|
||||
CoolUtil.loadSong(event.song, event.difficulty, event.opponentMode, event.coopMode);
|
||||
FlxG.switchState(new PlayState());
|
||||
}
|
||||
|
||||
@@ -40,6 +40,12 @@ class Options
|
||||
public static var resizableEditors:Bool = true;
|
||||
public static var maxUndos:Int = 120;
|
||||
|
||||
/**
|
||||
* QOL FEATURES
|
||||
*/
|
||||
public static var freeplayLastSong:String = null;
|
||||
public static var freeplayLastDifficulty:String = "normal";
|
||||
|
||||
// CHARTER
|
||||
public static var charterMetronomeEnabled:Bool = false;
|
||||
|
||||
|
||||
@@ -190,7 +190,8 @@ class CoolUtil
|
||||
public static function playMenuSong(fadeIn:Bool = false) {
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
||||
{
|
||||
playMusic(Paths.music('freakyMenu'), 102, fadeIn ? 0 : 1);
|
||||
playMusic(Paths.music('freakyMenu'), true, fadeIn ? 0 : 1, true, 102);
|
||||
FlxG.sound.music.persist = true;
|
||||
if (fadeIn)
|
||||
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
||||
}
|
||||
@@ -212,14 +213,18 @@ class CoolUtil
|
||||
/**
|
||||
* Plays music, while resetting the Conductor, and taking info from INI in count.
|
||||
* @param path Path to the music
|
||||
* @param Persist Whenever the music should persist while switching states
|
||||
* @param DefaultBPM Default BPM of the music (102)
|
||||
* @param Volume Volume of the music (1)
|
||||
* @param Looped Whenever the music loops (true)
|
||||
* @param Group A group that this music belongs to (default)
|
||||
*/
|
||||
public static function playMusic(path:String, DefaultBPM:Int = 102, Volume:Int = 1, Looped:Bool = true, ?Group:FlxSoundGroup) {
|
||||
public static function playMusic(path:String, Persist:Bool = false, Volume:Int = 1, Looped:Bool = true, DefaultBPM:Int = 102, ?Group:FlxSoundGroup) {
|
||||
Conductor.reset();
|
||||
FlxG.sound.playMusic(path, Volume, Looped, Group);
|
||||
if (FlxG.sound.music != null) {
|
||||
FlxG.sound.music.persist = Persist;
|
||||
}
|
||||
|
||||
var infoPath = '${Path.withoutExtension(path)}.ini';
|
||||
if (Assets.exists(infoPath)) {
|
||||
@@ -614,6 +619,8 @@ class CoolUtil
|
||||
* @param music Music
|
||||
*/
|
||||
public static function setMusic(frontEnd:SoundFrontEnd, music:FlxSound) {
|
||||
if (frontEnd.music != null)
|
||||
@:privateAccess frontEnd.destroySound(frontEnd.music);
|
||||
frontEnd.list.remove(music);
|
||||
frontEnd.music = music;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,12 @@ class XMLUtil {
|
||||
spr.name = node.getAtt("name");
|
||||
spr.antialiasing = true;
|
||||
|
||||
spr.loadAnimatedGraphic(Paths.image('$parentFolder${node.getAtt("sprite")}', null, true));
|
||||
spr.loadSprite(Paths.image('$parentFolder${node.getAtt("sprite")}', null, true));
|
||||
|
||||
if (spr.frames != null && spr.frames.frames != null) {
|
||||
spr.animation.add("idle", [for(i in 0...spr.frames.frames.length) i], 24, true);
|
||||
spr.animation.play("idle");
|
||||
}
|
||||
|
||||
spr.spriteAnimType = defaultAnimType;
|
||||
if (node.has.type)
|
||||
|
||||
Reference in New Issue
Block a user