@@ -182,7 +182,7 @@ class LoadingState extends MusicBeatState
182182
183183 if (stateChangeDelay <= 0 && checkLoaded ())
184184 {
185- dontUpdate = true ;
185+ // dontUpdate = true;
186186 onLoad ();
187187 }
188188 }
@@ -477,7 +477,7 @@ class LoadingState extends MusicBeatState
477477 {
478478 var path : String = Paths .json (' $folder /preload' );
479479 var json : Dynamic = null ;
480-
480+
481481 #if MODS_ALLOWED
482482 var moddyFile : String = Paths .modsJson (' $folder /preload' );
483483 if (FileSystem .exists (moddyFile )) json = Json .parse (File .getContent (moddyFile ));
@@ -507,9 +507,32 @@ class LoadingState extends MusicBeatState
507507 }
508508 }
509509 prepare (imgs , snds , mscs );
510+ } else { // if it is null then just grab everything
511+ trace (' NO PRELOAD JSON FOUND! LOADING EVERYTHING THAT CAN BE FOUND INSTEAD!' );
512+ var curDirct : String = Mods .currentModDirectory == ' ' ? ' assets/ ${Paths .currentLevel }' : ' mods/ ${Mods .currentModDirectory }' ;
513+ var moddedImages : Array <String > = Paths .crawlDirectory (' $curDirct /images' , ' png' );
514+ var moddedSounds : Array <String > = Paths .crawlDirectory (' $curDirct /sounds' , ' png' );
515+ var moddedMusic : Array <String > = Paths .crawlDirectory (' $curDirct /music' , ' png' );
516+ prepare (moddedImages , moddedSounds , moddedMusic );
517+ trace (' IMAGE LOADING LIST: $moddedImages \n SOUND LOADING LIST: $moddedSounds \n MUSIC LOADING LIST: $moddedMusic ' );
510518 }
511519 }
512- catch (e : Dynamic ) {}
520+ catch (e : Dynamic ) {
521+ trace (' SOMETHING WENT WRONG! LOADING EVERYTHING THAT CAN BE FOUND INSTEAD!' );
522+ // This annoys me to no end
523+ var curDirct : String = Mods .currentModDirectory == ' ' ? ' assets/ ${Paths .currentLevel }' : ' mods/ ${Mods .currentModDirectory }' ;
524+ var moddedImages : Array <String > = [];
525+ var moddedSounds : Array <String > = [];
526+ var moddedMusic : Array <String > = [];
527+ for (thing in Paths .crawlDirectory (' $curDirct /images' , ' png' ))
528+ moddedImages .push (thing .replace (' $curDirct /images/' , ' ' ).replace (' .png' , ' ' ));
529+ for (thing in Paths .crawlDirectory (' $curDirct /sounds' , ' ogg' ))
530+ moddedSounds .push (thing .replace (' $curDirct /sounds/' , ' ' ).replace (' .ogg' , ' ' ));
531+ for (thing in Paths .crawlDirectory (' $curDirct /music' , ' ogg' ))
532+ moddedMusic .push (thing .replace (' $curDirct /music/' , ' ' ).replace (' .ogg' , ' ' ));
533+ prepare (moddedImages , moddedSounds , moddedMusic );
534+ // trace('IMAGE LOADING LIST: $moddedImages\nSOUND LOADING LIST: $moddedSounds\nMUSIC LOADING LIST: $moddedMusic');
535+ }
513536 return true ;
514537 }, isIntrusive )
515538 .then ((_ ) -> new Future <Bool >(() -> {
@@ -676,7 +699,7 @@ class LoadingState extends MusicBeatState
676699 for (song in songsToPrepare ) initThread (() -> preloadSound (song , ' songs' , true , false ), ' song $song ' );
677700
678701 // for images, they get to have their own thread
679- for (image in imagesToPrepare ) initThread (() -> preloadGraphic (image ), ' image $image ' );
702+ for (image in imagesToPrepare ) preloadGraphic ( image ); // initThread(() -> preloadGraphic(image), 'image $image');
680703 }
681704
682705 static function initThread (func : Void -> Dynamic , traceData : String )
@@ -818,11 +841,12 @@ class LoadingState extends MusicBeatState
818841 requestedBitmaps .set (file , bitmap );
819842 originalBitmapKeys .set (file , requestKey );
820843 mutex .release ();
844+ loaded ++ ;
821845 return bitmap ;
822846 }
823847 else trace (' no such image $key exists' );
824848 }
825-
849+ loaded ++ ;
826850 return Paths .currentTrackedAssets .get (requestKey ).bitmap ;
827851 }
828852 catch (e : haxe. Exception )
0 commit comments