Skip to content

Commit

Permalink
Merge branch 'FNF-CNE-Devs:main' into cne-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 authored Oct 8, 2024
2 parents a108791 + a886060 commit cf12832
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions source/funkin/backend/assets/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,28 @@ class Paths
return scriptPath;
}

static public function chart(song:String, ?difficulty:String = "normal"):String {
static public function chart(song:String, ?difficulty:String = "normal"):String
{
difficulty = difficulty.toLowerCase();
song = song.toLowerCase();

return getPath('songs/$song/charts/$difficulty.json', null);
}

static public function character(character:String):String {
inline static public function character(character:String):String
{
return getPath('data/characters/$character.xml', null);
}

/**
* Gets the name of a registered font.
* @param font The font's path (if it's already passed as a font name, the same name will be returned)
*/
inline static public function getFontName(font:String)
{
return OpenFlAssets.exists(font, FONT) ? OpenFlAssets.getFont(font).fontName : font;
}

inline static public function font(key:String)
{
return getPath('fonts/$key');
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/backend/utils/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ class CoolUtil
var fmt = new FlxTextFormat();

fmt.format.color = Reflect.hasField(fmtt, "color") ? FlxColor.fromString(fmtt.color) : text.color;
fmt.format.font = Reflect.hasField(fmtt, "font") ? Paths.font(fmtt.font) : text.font;
fmt.format.font = Reflect.hasField(fmtt, "font") ? Paths.getFontName(Paths.font(fmtt.font)) : text.font;
fmt.format.size = Reflect.hasField(fmtt, "size") ? Std.parseInt(fmtt.size) : text.size;
fmt.format.italic = Reflect.hasField(fmtt, "italic") ? fmtt.italic == "true" : text.italic;
fmt.format.bold = Reflect.hasField(fmtt, "bold") ? fmtt.bold == "true" : text.bold;
Expand Down

0 comments on commit cf12832

Please sign in to comment.