"forced" anim attribute finally working
big changes here maybe
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//
|
||||
import funkin.game.PlayState;
|
||||
|
||||
// phillyTrain is automatically added by Stage.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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,11 +292,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<Bool>, 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
|
||||
|
||||
@@ -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<Bool> = true;
|
||||
|
||||
/**
|
||||
* Prevents the default sing animation from being played.
|
||||
|
||||
@@ -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<Bool>;
|
||||
/**
|
||||
* Suffix of the animation. "miss" for miss notes, "-alt" for alt notes, "" for normal ones.
|
||||
*/
|
||||
|
||||
@@ -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<Bool>;
|
||||
|
||||
/**
|
||||
Whenever the animation will play in reverse or not
|
||||
|
||||
@@ -207,14 +207,14 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
}
|
||||
|
||||
public var singAnims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
|
||||
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:Bool = true, Reversed:Bool = false, Frame:Int = 0) {
|
||||
var event = EventManager.get(DirectionAnimEvent).recycle(singAnims[direction % singAnims.length] + suffix, direction, suffix, Context, Reversed, Frame, Force);
|
||||
script.call("onPlaySingAnim", [event]);
|
||||
if (!event.cancelled)
|
||||
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;
|
||||
|
||||
@@ -97,7 +97,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user