diff --git a/assets/data/dialogue/characters/senpai.hx b/assets/data/dialogue/characters/senpai.hx index cd17b115..1ea774d7 100644 --- a/assets/data/dialogue/characters/senpai.hx +++ b/assets/data/dialogue/characters/senpai.hx @@ -1,6 +1,6 @@ function postHide() { if(curTween != null) { - if(animation.curAnim?.name == 'angry-show') curTween.cancel(); + if(getAnimName() == 'angry-show') curTween.cancel(); else curTween.percent = 1; } -} \ No newline at end of file +} diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index d18585ae..fa79a95b 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -1,5 +1,7 @@ package funkin.backend; +import flixel.animation.FlxAnimation; +import flxanimate.animate.FlxAnim.FlxSymbolAnimation; import funkin.backend.utils.XMLUtil.BeatAnim; import funkin.backend.utils.XMLUtil.AnimData; import funkin.backend.utils.XMLUtil.IXMLEvents; @@ -11,6 +13,7 @@ import funkin.backend.system.interfaces.IOffsetCompatible; import flixel.math.FlxMatrix; import flixel.math.FlxRect; import flixel.math.FlxPoint; +import flixel.util.typeLimit.OneOfTwo; import funkin.backend.system.interfaces.IBeatReceiver; enum abstract XMLAnimType(Int) @@ -325,6 +328,12 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I lastAnimContext = Context; } + public function getAnim(name:String):OneOfTwo { + if(animateAtlas != null) + return animateAtlas.anim.getByName(name); + return animation.getByName(name); + } + public inline function getAnimOffset(name:String) { if (animOffsets.exists(name)) @@ -378,7 +387,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I public inline function isAnimFinished() { - return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true); + return animateAtlas != null ? animateAtlas.anim.finished : (animation.curAnim != null ? animation.curAnim.finished : true); + } + + public inline function isAnimAtEnd() { + return animateAtlas != null ? animateAtlas.anim.isAtEnd : (animation.curAnim != null ? animation.curAnim.isAtEnd : false); } #end diff --git a/source/funkin/backend/assets/Paths.hx b/source/funkin/backend/assets/Paths.hx index d8c6ba39..1bc880ff 100644 --- a/source/funkin/backend/assets/Paths.hx +++ b/source/funkin/backend/assets/Paths.hx @@ -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'); diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index 70feb55f..9fd7f3c5 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -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; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 1806fee2..17ed9bc0 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -865,12 +865,12 @@ class PlayState extends MusicBeatState Conductor.songPosition = 0; Conductor.songPosition -= Conductor.crochet * introLength - Conductor.songOffset; - var swagCounter:Int = 0; - - startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer) - { - countdown(swagCounter++); - }, introLength); + if(introLength > 0) { + var swagCounter:Int = 0; + startTimer = new FlxTimer().start(Conductor.crochet / 1000, (tmr:FlxTimer) -> { + countdown(swagCounter++); + }, introLength); + } scripts.call("onPostStartCountdown"); } @@ -1047,7 +1047,7 @@ class PlayState extends MusicBeatState vocals.pause(); } - if (!startTimer.finished) + if (startTimer != null && !startTimer.finished) startTimer.active = false; } @@ -1067,7 +1067,7 @@ class PlayState extends MusicBeatState resyncVocals(); } - if (!startTimer.finished) + if (startTimer != null && !startTimer.finished) startTimer.active = true; paused = false; diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 17650a5a..3e88bc7c 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -309,7 +309,7 @@ class StrumLine extends FlxTypedGroup { babyArrow.scrollSpeed = data.scrollSpeed; var event = EventManager.get(StrumCreationEvent).recycle(babyArrow, PlayState.instance.strumLines.members.indexOf(this), i, animPrefix); - event.__doAnimation = !MusicBeatState.skipTransIn; + event.__doAnimation = !MusicBeatState.skipTransIn && (PlayState.instance != null ? PlayState.instance.introLength > 0 : true); event = PlayState.instance.scripts.event("onStrumCreation", event); if (!event.cancelled) { diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx index 579360ed..e6c717c0 100644 --- a/source/funkin/menus/credits/CreditsCodename.hx +++ b/source/funkin/menus/credits/CreditsCodename.hx @@ -11,9 +11,11 @@ using StringTools; class CreditsCodename extends funkin.options.OptionsScreen { public var error:Bool = false; public var author:String = "FNF-CNE-Devs"; + public var totalContributions:Int = 0; + public var mainDevCol:FlxColor = 0xFF9C35D5; public var minContrCol:FlxColor = 0xFFB4A7DA; - public var totalContributions:Int = 0; + public var contribFormats:Array = []; public override function new() { @@ -58,12 +60,17 @@ class CreditsCodename extends funkin.options.OptionsScreen { if(parent == null || parent.treeParent == null) return; var text:String = parent.treeParent.pathDesc.text; parent.treeParent.pathDesc.text = ""; - parent.treeParent.pathDesc.applyMarkup(text, [ + parent.treeParent.pathDesc.applyMarkup(text, contribFormats = [ new FlxTextFormatMarkerPair(new FlxTextFormat(mainDevCol), '*'), new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.interpolate(minContrCol, mainDevCol, Options.contributors[curSelected].contributions / totalContributions)), '~') ]); } + override function close() { + super.close(); + for (frmt in contribFormats) parent.treeParent.pathDesc.removeFormat(frmt.format); + } + public function checkUpdate():Bool { var curTime:Float = Date.now().getTime(); if(Options.lastUpdated != null && curTime < Options.lastUpdated + 120000) return false; // Fuck you Github rate limits - Nex