@@ -377,9 +377,9 @@ class OsuFreeplayState extends MusicBeatState
377377 return ;
378378 }
379379
380- // loadDiffs(FreeplayManager.songList[curSelected] );
381- inSub = true ;
382- openSubState (new DifficultySelectorSubState (FreeplayManager .songList [curSelected ]));
380+ reloadSongArray ( );
381+ // inSub = true;
382+ // openSubState(new DifficultySelectorSubState(FreeplayManager.songList[curSelected]));
383383 }
384384
385385 if (FlxG .keys .justPressed .TAB )
@@ -645,4 +645,118 @@ class OsuFreeplayState extends MusicBeatState
645645
646646 changeSong ();
647647 }
648+
649+ var trueInt : Int = 0 ;
650+ function reloadSongArray ()
651+ {
652+ songBox .clear ();
653+ iconGrp .clear ();
654+ textGrp .clear ();
655+
656+ trueInt = 0 ;
657+
658+ if (APEntryState .inArchipelagoMode )
659+ FreeplayManager .checkSongStatus ();
660+
661+ for (i in 0 ... FreeplayManager .songList .length )
662+ {
663+ var songName : String = ' ' ;
664+ var modName : String = ' ' ;
665+ var isMissing : Bool = false ;
666+ var locationId : Array <Int > = [];
667+ var color : FlxColor = 0xFFFFFFFF ;
668+ var someLocationsNotMissing : Bool = false ;
669+
670+ if (APEntryState .inArchipelagoMode ) {
671+ songName = FreeplayManager .songList [i ].songName ;
672+ modName = FreeplayManager .songList [i ].folder ;
673+ locationId = APEntryState .apGame .locationData (songName , modName ).concat (APEntryState .apGame .noteData (songName , modName ));
674+ isMissing = [for (ID in locationId ) APEntryState .apGame .isLocationMissing (APEntryState .apGame .info ().get_location_name (ID ))].indexOf (true ) != - 1 || locationId .length == 0 ;
675+ color = isMissing ? FlxColor .RED : FlxColor .GREEN ;
676+ }
677+
678+ Mods .currentModDirectory = FreeplayManager .songList [i ].folder ;
679+
680+ var songBox : SongBox = new SongBox (320 , 100 );
681+ songBox .loadGraphic (Paths .image (' OSUState/bars/background2' ));
682+ songBox .setGraphicSize (650 , 100 );
683+
684+ if (APEntryState .inArchipelagoMode ) {
685+ var isBronze : Bool = FlxG .random .bool (50 ); // Randomly decide between orange and bronze
686+ var bronzeOrOrangeColor : Int = isBronze ? 0xFFCD7F32 : 0xFFFFA500 ; // Bronze or Orange color
687+ songBox .color = FreeplayManager .isVictorySong (songName , modName ) ?
688+ (isMissing ?
689+ (someLocationsNotMissing ?
690+ songBox .color = bronzeOrOrangeColor
691+ : songBox .color = victoryColor )
692+ : songBox .color = 0xFFFFD700 )
693+ : songBox .color = color ;
694+ } else {
695+ songBox .setColorTransform (- 1 , - 1 , - 1 , 1 , FreeplayManager .songList [i ].color [0 ][0 ], FreeplayManager .songList [i ].color [0 ][1 ], FreeplayManager .songList [i ].color [0 ][2 ], 1 );
696+ }
697+ songBox. ID = i + trueInt ;
698+ this .songBox .add (songBox );
699+
700+ var isLock : Bool = APEntryState .inArchipelagoMode && CategoryState .loadWeekForce == " all" && isMissing && ! FreeplayManager .unplayedList .contains (songName );
701+ var icon : HealthIcon = new HealthIcon (isLock ? " lock" : FreeplayManager .songList [i ].songCharacter , false );
702+ icon .setPosition (320 , 100 );
703+ icon. ID = i + trueInt ;
704+ icon .setGraphicSize (Std .int (icon .width / 1.7 ), Std .int (icon .height / 1.7 ));
705+ iconGrp .add (icon );
706+
707+ try {metadata = FreeplayManager .metadata .get (FreeplayManager .songList [i ].songName .toLowerCase ());}
708+ catch (e ) {metadata = null ;}
709+
710+ var text : FlxText = new FlxText (0 , 0 , 500 , ' ' , 20 );
711+ if (metadata != null )
712+ text .text = FreeplayManager .songList [i ].songName + ' \n By ${metadata .song .artist }' ;
713+ else
714+ text .text = FreeplayManager .songList [i ].songName + ' \n By Unknown' ;
715+ text .alignment = ' left' ;
716+ text. ID = i + trueInt ;
717+ textGrp .add (text );
718+
719+ var week : WeekData = WeekData .weeksLoaded .get (WeekData .weeksList [FreeplayManager .songList [i ].week ]);
720+ Difficulty .loadFromWeek (week );
721+
722+ if (FreeplayManager .songList [i ].songName == FreeplayManager .songList [curSelected ].songName ) {
723+ trace (songName );
724+ trueInt = i + 1 ;
725+ for (j in 0 ... Difficulty .list .length )
726+ {
727+
728+ var songBox : SongBox = new SongBox (320 , 100 );
729+ songBox .loadGraphic (Paths .image (' OSUState/bars/background2' ));
730+ songBox .setGraphicSize (650 , 100 );
731+ songBox .setColorTransform (- 1 , - 1 , - 1 , 1 , FreeplayManager .songList [i ].color [0 ][0 ], FreeplayManager .songList [i ].color [0 ][1 ], FreeplayManager .songList [i ].color [0 ][2 ], 1 );
732+ songBox. ID = trueInt ;
733+ this .songBox .add (songBox );
734+
735+ var icon : HealthIcon = new HealthIcon (FreeplayManager .songList [i ].songCharacter , false );
736+ icon .setPosition (320 , 100 );
737+ icon. ID = trueInt ;
738+ icon .setGraphicSize (Std .int (icon .width / 1.7 ), Std .int (icon .height / 1.7 ));
739+ this .iconGrp .add (icon );
740+
741+ try {metadata = FreeplayManager .metadata .get (FreeplayManager .songList [i ].songName .toLowerCase ());}
742+ catch (e ) {metadata = null ;}
743+
744+ var text : FlxText = new FlxText (0 , 0 , 500 , ' ' , 20 );
745+ text .text = FreeplayManager .songList [i ].songName + ' \n ' + Difficulty .list [j ];
746+ text .alignment = ' left' ;
747+ text. ID = trueInt ;
748+ this .textGrp .add (text );
749+
750+ trueInt ++ ;
751+ }
752+ } else {
753+ // trace(FreeplayManager.songList[i].songName);
754+ // trace(FreeplayManager.songList[curSelected].songName);
755+ }
756+ }
757+
758+ maxSelected = songBox .length ;
759+
760+ changeSong ();
761+ }
648762}
0 commit comments