@@ -6,12 +6,14 @@ import funkin.modding.events.ScriptEventDispatcher;
66import funkin .play .character .ScriptedCharacter .ScriptedAnimateAtlasCharacter ;
77import funkin .play .character .ScriptedCharacter .ScriptedBaseCharacter ;
88import funkin .play .character .ScriptedCharacter .ScriptedMultiSparrowCharacter ;
9+ import funkin .play .character .ScriptedCharacter .ScriptedMultiAnimateAtlasCharacter ;
910import funkin .play .character .ScriptedCharacter .ScriptedPackerCharacter ;
1011import funkin .play .character .ScriptedCharacter .ScriptedSparrowCharacter ;
1112import funkin .play .character .AnimateAtlasCharacter ;
1213import funkin .play .character .BaseCharacter ;
1314import funkin .play .character .SparrowCharacter ;
1415import funkin .play .character .MultiSparrowCharacter ;
16+ import funkin .play .character .MultiAnimateAtlasCharacter ;
1517import funkin .play .character .PackerCharacter ;
1618import funkin .util .assets .DataAssets ;
1719import funkin .util .VersionUtil ;
@@ -160,14 +162,34 @@ class CharacterDataParser
160162 }
161163 }
162164
165+ var scriptedCharClassNames5 : Array <String > = ScriptedMultiAnimateAtlasCharacter .listScriptClasses ();
166+ if (scriptedCharClassNames5 .length > 0 )
167+ {
168+ trace (' Instantiating ${scriptedCharClassNames5 .length } (Multi-Animate Atlas) scripted characters...' );
169+ for (charCls in scriptedCharClassNames5 )
170+ {
171+ try
172+ {
173+ var character : MultiAnimateAtlasCharacter = ScriptedMultiAnimateAtlasCharacter .init (charCls , DEFAULT_CHAR_ID );
174+ characterScriptedClass .set (character .characterId , charCls );
175+ }
176+ catch (e )
177+ {
178+ trace (' FAILED to instantiate scripted Multi-Animate Atlas character: ${charCls }' );
179+ trace (e );
180+ }
181+ }
182+ }
183+
163184 // NOTE: Only instantiate the ones not populated above.
164185 // ScriptedBaseCharacter.listScriptClasses() will pick up scripts extending the other classes.
165186 var scriptedCharClassNames : Array <String > = ScriptedBaseCharacter .listScriptClasses ();
166187 scriptedCharClassNames = scriptedCharClassNames .filter (function (charCls : String ): Bool {
167188 return ! (scriptedCharClassNames1 .contains (charCls )
168189 || scriptedCharClassNames2 .contains (charCls )
169190 || scriptedCharClassNames3 .contains (charCls )
170- || scriptedCharClassNames4 .contains (charCls ));
191+ || scriptedCharClassNames4 .contains (charCls )
192+ || scriptedCharClassNames5 .contains (charCls ));
171193 });
172194
173195 if (scriptedCharClassNames .length > 0 )
@@ -226,6 +248,8 @@ class CharacterDataParser
226248 char = ScriptedSparrowCharacter .init (charScriptClass , charId );
227249 case CharacterRenderType . Packer :
228250 char = ScriptedPackerCharacter .init (charScriptClass , charId );
251+ case CharacterRenderType . MultiAnimateAtlas :
252+ char = ScriptedMultiAnimateAtlasCharacter .init (charScriptClass , charId );
229253 default :
230254 // We're going to assume that the script class does the rendering.
231255 char = ScriptedBaseCharacter .init (charScriptClass , charId , CharacterRenderType . Custom );
@@ -243,6 +267,8 @@ class CharacterDataParser
243267 char = new SparrowCharacter (charId );
244268 case CharacterRenderType . Packer :
245269 char = new PackerCharacter (charId );
270+ case CharacterRenderType . MultiAnimateAtlas :
271+ char = new MultiAnimateAtlasCharacter (charId );
246272 default :
247273 trace (' [WARN] Creating character with undefined renderType ${charData .renderType }' );
248274 char = new BaseCharacter (charId , CharacterRenderType . Custom );
@@ -431,6 +457,15 @@ class CharacterDataParser
431457 public static final DEFAULT_SCALE : Float = 1 ;
432458 public static final DEFAULT_SCROLL : Array <Float > = [0 , 0 ];
433459 public static final DEFAULT_STARTINGANIM : String = ' idle' ;
460+ public static final DEFAULT_APPLYSTAGEMATRIX : Bool = false ;
461+ public static final DEFAULT_ANIMTYPE : String = " framelabel" ;
462+ public static final DEFAULT_ATLASSETTINGS : funkin.data.stage. StageData . TextureAtlasData =
463+ {
464+ swfMode : true ,
465+ cacheOnLoad : false ,
466+ filterQuality : 1 ,
467+ applyStageMatrix : false
468+ };
434469
435470 /**
436471 * Set unspecified parameters to their defaults.
@@ -559,6 +594,16 @@ class CharacterDataParser
559594 input .flipX = DEFAULT_FLIPX ;
560595 }
561596
597+ if (input .applyStageMatrix == null )
598+ {
599+ input .applyStageMatrix = DEFAULT_APPLYSTAGEMATRIX ;
600+ }
601+
602+ if (input .atlasSettings == null )
603+ {
604+ input .atlasSettings = DEFAULT_ATLASSETTINGS ;
605+ }
606+
562607 if (input .animations .length == 0 && input .startingAnimation != null )
563608 {
564609 return null ;
@@ -596,6 +641,11 @@ class CharacterDataParser
596641 {
597642 inputAnimation .flipY = DEFAULT_FLIPY ;
598643 }
644+
645+ if (inputAnimation .animType == null )
646+ {
647+ inputAnimation .animType = DEFAULT_ANIMTYPE ;
648+ }
599649 }
600650
601651 // All good!
@@ -624,10 +674,15 @@ enum abstract CharacterRenderType(String) from String to String
624674 public var MultiSparrow = ' multisparrow' ;
625675
626676 /**
627- * Renders the character using a spritesheet of symbols and JSON data.
677+ * Renders the character using a single spritesheet of symbols and JSON data.
628678 */
629679 public var AnimateAtlas = ' animateatlas' ;
630680
681+ /**
682+ * Renders the character using multiple spritesheets of symbols and JSON data.
683+ */
684+ public var MultiAnimateAtlas = ' multianimateatlas' ;
685+
631686 /**
632687 * Renders the character using a custom method.
633688 */
@@ -674,6 +729,9 @@ typedef CharacterData =
674729 */
675730 var healthIcon : Null <HealthIconData >;
676731
732+ /**
733+ * Optional data about the death animation for the character.
734+ */
677735 var death : Null <DeathData >;
678736
679737 /**
@@ -734,6 +792,23 @@ typedef CharacterData =
734792 * @default false
735793 */
736794 var flipX : Null <Bool >;
795+
796+ /**
797+ * NOTE: This only applies to animate atlas characters.
798+ *
799+ * Whether to apply the stage matrix, if it was exported from a symbol instance.
800+ * Also positions the Texture Atlas as it displays in Animate.
801+ * Turning this on is only recommended if you prepositioned the character in Animate.
802+ * For other cases, it should be turned off to act similarly to a normal FlxSprite.
803+ */
804+ var applyStageMatrix : Null <Bool >;
805+
806+ /**
807+ * Various settings for the prop.
808+ * Only available for texture atlases.
809+ */
810+ @:optional
811+ var atlasSettings : funkin.data.stage. StageData . TextureAtlasData ;
737812};
738813
739814/**
0 commit comments