@@ -38,7 +38,6 @@ class Paths
3838 for (extension in extArray ) {
3939 var extPath : String = sanitizedPath + ' . $extension ' ;
4040 if (OpenFlAssets .exists (extPath )) {
41- trace (extPath , OpenFlAssets .exists (extPath ));
4241 returnedPath = extPath ;
4342 break ;
4443 }
@@ -125,12 +124,12 @@ class Paths
125124 return OpenFlAssets .exists (diff ) ? diff : getPath (' songs/ $song /song/Inst $suffix ' , null , ext != null ? ext : Flags .SOUND_EXT );
126125 }
127126
128- static public function image (key : String , ? library : String , checkForAtlas : Bool = false , ? ext : OneOfTwo <String , Array <String >>) {
127+ static public function image (key : String , ? library : String , checkForAtlas : Bool = true , ? ext : OneOfTwo <String , Array <String >>) {
129128 if (checkForAtlas ) {
130- var atlasPath = getPath (' images/ $key /spritemap ' , library , ext != null ? ext : Flags .IMAGE_EXT );
129+ var atlasPath = getPath (' images/ $key /spritemap1 ' , library , ext != null ? ext : Flags .IMAGE_EXT );
131130 var multiplePath = getPath (' images/ $key /1' , library , ext != null ? ext : Flags .IMAGE_EXT );
132131 if (atlasPath != null && OpenFlAssets .exists (atlasPath )) return atlasPath .substr (0 , atlasPath .length - 14 );
133- if (multiplePath != null && OpenFlAssets .exists (multiplePath )) return multiplePath . substr ( 0 , multiplePath . length - 6 ) ;
132+ if (multiplePath != null && OpenFlAssets .exists (multiplePath )) return multiplePath ;
134133 }
135134 return getPath (' images/ $key ' , library , ext != null ? ext : Flags .IMAGE_EXT );
136135 }
@@ -245,9 +244,10 @@ class Paths
245244 public static function framesExists (key : String , checkAtlas : Bool = false , checkMulti : Bool = true , assetsPath : Bool = false , ? library : String ) {
246245 var path = assetsPath ? key : Paths .image (key , library , true );
247246 var noExt = Path .withoutExtension (path );
247+ var ext = Path .extension (path );
248248 if (checkAtlas && Assets .exists (' $noExt /Animation.json' ))
249249 return true ;
250- if (checkMulti && Assets .exists (' $noExt /1.png ' ))
250+ if (checkMulti && Assets .exists (' $noExt /1. $ ext ' ))
251251 return true ;
252252 if (Assets .exists (' $noExt .xml' ))
253253 return true ;
@@ -266,17 +266,18 @@ class Paths
266266 * @param ext (Additional) Extension of the images.
267267 * @return FlxFramesCollection Frames
268268 */
269- public static function getMultiFrames (sheets : Array <String >, ? unique : Bool = true , ? key : String = null , ? ext : OneOfTwo <String , Array <String >> = null , ? animateSettings : FlxAnimateSettings ): FlxFramesCollection {
270- // TODO: cache properly
271- if (sheets .length == 1 ) return loadFrames (sheets [0 ], unique , key , false , false , animateSettings );
269+ public static function getMultiFrames (sheets : Array <String >, ? unique : Bool = true , ? key : String = null , ? skipMulti : Bool = false , ? ext : OneOfTwo <String , Array <String >> = null , ? animateSettings : FlxAnimateSettings ): FlxFramesCollection {
270+ if (sheets .length == 1 ) return loadFrames (' ${sheets [0 ]}. $ext ' , unique , key , false , false , animateSettings );
272271 if (key == null ) key = ' combo/' + sheets .join (' ,' );
273272 var graphic = FlxG .bitmap .add (" flixel/images/logo/default.png" , unique , key );
274273 var sprFrames : FlxAtlasFrames = new FlxAtlasFrames (graphic );
275274 try {
276275 for (x => path in sheets ) {
277- var noExt = haxe.io. Path .withoutExtension (Paths .image (path , null , true , ext ));
276+ final coolPath = Paths .image (path , null , true , ext );
277+ final noExt = haxe.io. Path .withoutExtension (coolPath );
278+ final ext = haxe.io. Path .extension (coolPath );
278279 @:privateAccess
279- var newFrames = cast Paths .loadFrames (noExt , true , key + ' _ $path ' , false , false , animateSettings );
280+ var newFrames = cast Paths .loadFrames (' $ noExt . $ ext ' , true , key + ' _ $path ' , false , skipMulti , animateSettings );
280281 if (newFrames == null ) {
281282 Logs .warn (' There is no Bitmap asset for " $noExt ". Skipping...' );
282283 continue ;
@@ -302,24 +303,24 @@ class Paths
302303 static function loadFrames (path : String , Unique : Bool = false , Key : String = null , SkipAtlasCheck : Bool = false , SkipMultiCheck : Bool = false , ? animateSettings : FlxAnimateSettings ): FlxFramesCollection {
303304 var noExt = Path .withoutExtension (path );
304305 var ext = Path .extension (path );
305-
306+ // there NEEDS to be a better way dude
307+ if (! SkipMultiCheck && noExt .endsWith (' /1' ))
308+ noExt = noExt .substr (0 , noExt .length - 2 );
306309 if (! SkipMultiCheck && Assets .exists (' $noExt /1. ${ext }' )) {
307- // MULTIPLE SPRITESHEETS!!
308-
309- var graphic = FlxG .bitmap .add (" flixel/images/logo/default.png" , false , ' $noExt /mult' );
310- var frames = MultiFramesCollection .findFrame (graphic );
311- if (frames != null )
312- return frames ;
313-
314- var cur = 1 ;
315- var finalFrames = new MultiFramesCollection (graphic );
316- while (Assets .exists (' $noExt / $cur . ${ext }' )) {
317- var spr = loadFrames (' $noExt / $cur . ${ext }' , false , null , false , true );
318- finalFrames .addFrames (spr );
310+ var cur : Int = 1 ;
311+ final finalFrames = [];
312+ while (Assets .exists (' $noExt / $cur . ${ext }' )) {
313+ finalFrames .push (' ${noExt .substr (
314+ // there should be a Paths.unimage tbh
315+ ' assets/images/' .length
316+ )}/ $cur ' );
319317 cur ++ ;
320318 }
321- return finalFrames ;
319+ return getMultiFrames (finalFrames , true ,
320+ ' $noExt /mult' , true , ext , animateSettings );
322321 } else if (! SkipAtlasCheck && Assets .exists (' $noExt /Animation.json' )) {
322+ // ???
323+ if (noExt .endsWith (' /' )) noExt = noExt .substr (0 , noExt .length - 1 );
323324 return Paths .getAnimateAtlasAlt (noExt , animateSettings );
324325 } else if (Assets .exists (' $noExt .xml' )) {
325326 return Paths .getSparrowAtlasAlt (noExt , ext );
0 commit comments