diff --git a/assets/data/stages/philly.hx b/assets/data/stages/philly.hx index 989b29b5..6b120b51 100644 --- a/assets/data/stages/philly.hx +++ b/assets/data/stages/philly.hx @@ -1,3 +1,4 @@ +// import funkin.game.PlayState; // phillyTrain is automatically added by Stage.hx diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index a5f90b06..58c43bb4 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -101,7 +101,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I if (!debugMode && isAnimFinished()) { var name = getAnimName() + '-loop'; if (hasAnimation(name)) - playAnim(name, false, lastAnimContext); + playAnim(name, null, lastAnimContext); } } @@ -133,7 +133,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I // TODO: find a solution without countedBeat var anim = beatAnims[FlxMath.wrap(countedBeat++, 0, beatAnims.length - 1)]; if (anim.name != null && anim.name != "null" && anim.name != "none") - playAnim(anim.name, anim.forced); + playAnim(anim.name); } } @@ -294,11 +294,16 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I #if REGION public var lastAnimContext:PlayAnimContext = DANCE; - public function playAnim(AnimName:String, Force:Bool = false, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0):Void + public function playAnim(AnimName:String, ?Force:Null, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0):Void { if (AnimName == null) return; + if (Force == null) { + var anim = animDatas.get(AnimName); + Force = anim != null && anim.forced; + } + if (animateAtlas != null) { @:privateAccess diff --git a/source/funkin/backend/scripting/events/DirectionAnimEvent.hx b/source/funkin/backend/scripting/events/DirectionAnimEvent.hx index a23626f4..dce2eaff 100644 --- a/source/funkin/backend/scripting/events/DirectionAnimEvent.hx +++ b/source/funkin/backend/scripting/events/DirectionAnimEvent.hx @@ -26,7 +26,7 @@ final class DirectionAnimEvent extends CancellableEvent { **/ public var frame:Int; /** - Force the animation to replay even if it's already playing. + Force the animation to replay even if it's already playing (if it's null it will be forced based on the sprite's data xml, if it has one). **/ - public var force:Bool = true; + public var force:Null; } diff --git a/source/funkin/backend/scripting/events/NoteHitEvent.hx b/source/funkin/backend/scripting/events/NoteHitEvent.hx index d5f64dc3..bab6c958 100644 --- a/source/funkin/backend/scripting/events/NoteHitEvent.hx +++ b/source/funkin/backend/scripting/events/NoteHitEvent.hx @@ -100,9 +100,9 @@ final class NoteHitEvent extends CancellableEvent { */ public var ratingAntialiasing:Bool = true; /** - * Whenever the animation should be forced to play. + * Whenever the animation should be forced to play (if it's null it will be forced based on the sprite's data xml, if it has one). */ - public var forceAnim:Bool = true; + public var forceAnim:Null = null; /** * Prevents the default sing animation from being played. diff --git a/source/funkin/backend/scripting/events/NoteMissEvent.hx b/source/funkin/backend/scripting/events/NoteMissEvent.hx index e9475bb0..72f87ddd 100644 --- a/source/funkin/backend/scripting/events/NoteMissEvent.hx +++ b/source/funkin/backend/scripting/events/NoteMissEvent.hx @@ -29,9 +29,9 @@ final class NoteMissEvent extends CancellableEvent { public var gfSadAnim:String; public var forceGfAnim:Bool; /** - * Whenever the animation should be forced to play. + * Whenever the animation should be forced to play (if it's null it will be forced based on the sprite's data xml, if it has one). */ - public var forceAnim:Bool; + public var forceAnim:Null; /** * Suffix of the animation. "miss" for miss notes, "-alt" for alt notes, "" for normal ones. */ diff --git a/source/funkin/backend/scripting/events/PlayAnimEvent.hx b/source/funkin/backend/scripting/events/PlayAnimEvent.hx index a555c3ed..f51c8243 100644 --- a/source/funkin/backend/scripting/events/PlayAnimEvent.hx +++ b/source/funkin/backend/scripting/events/PlayAnimEvent.hx @@ -7,9 +7,9 @@ final class PlayAnimEvent extends CancellableEvent { public var animName:String; /** - Whenever the animation will be forced or not. + Whenever the animation will be forced or not (if it's null it will be forced based on the sprite's data xml, if it has one). **/ - public var force:Bool; + public var force:Null; /** Whenever the animation will play in reverse or not diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index cf942fbd..5f42d443 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -218,7 +218,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset /** * Like `playSingAnimUnsafe` but checks if the character has the animation with the suffix part, otherwise it plays the animation without the suffix part. */ - public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) + public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, ?Force:Null = null, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); script.call("onPlaySingAnim", [event]); @@ -235,7 +235,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset playAnim(event.animName, event.force, event.context, event.reversed, event.frame); } - public override function playAnim(AnimName:String, Force:Bool = false, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { + public override function playAnim(AnimName:String, ?Force:Bool, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(PlayAnimEvent).recycle(AnimName, Force, Reversed, Frame, Context); script.call("onPlayAnim", [event]); if (event.cancelled) return; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 8699b92e..a3844e1e 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1926,7 +1926,7 @@ class PlayState extends MusicBeatState } } -class ComboRating { +final class ComboRating { public var percent:Float; public var rating:String; public var color:FlxColor; diff --git a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx index 8885f56a..a948344d 100644 --- a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx +++ b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx @@ -94,7 +94,7 @@ class DialogueBox extends FunkinSprite { dialogueBoxScript.call("postCreate"); } - public override function playAnim(AnimName:String, Force:Bool = false, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { + public override function playAnim(AnimName:String, ?Force:Bool, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(PlayAnimEvent).recycle(AnimName, Force, Reversed, Frame, Context); dialogueBoxScript.call("onPlayAnim", [event]); if(event.cancelled) return; diff --git a/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx b/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx index 9fe4c44e..d53bcbd9 100644 --- a/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx +++ b/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx @@ -61,7 +61,7 @@ class DialogueCharacter extends FunkinSprite { dialogueCharScript.call("postCreate"); } - public override function playAnim(AnimName:String, Force:Bool = false, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { + public override function playAnim(AnimName:String, ?Force:Bool, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(PlayAnimEvent).recycle(AnimName, Force, Reversed, Frame, Context); dialogueCharScript.call("playAnim", [event]); if(event.cancelled) return;