@@ -8,6 +8,7 @@ import states.CategoryState;
88import states .StoryMenuState ;
99import lime .utils .Assets ;
1010import metadata .STMetaFile .MetadataFile ;
11+ import yutautil .AprilFools ;
1112
1213#if ARCHIPELAGO_ALLOWED
1314import archipelago .* ;
@@ -620,7 +621,7 @@ class FreeplayManager {
620621
621622 for (locationIdInt in locationIdInts ) {
622623 trace (" Processing locationIdInt for victory song check: " + locationIdInt );
623- if (locationIdInt != 0 && FreeplayManager . isVictorySong (songName , modName )) {
624+ if (locationIdInt != 0 && isVictorySong (songName , modName )) {
624625 trace (" Victory song condition met. Triggering victory popup..." );
625626 archipelago. ArchPopup .startPopupCustom (" You've completed your goal!" , " You win!" , " archipelago" , function () {
626627 trace (" Popup triggered for completing goal." );
@@ -643,6 +644,48 @@ class FreeplayManager {
643644 }
644645 }
645646
647+ public static function checkSongStatus () {
648+ for (i in 0 ... songList .length )
649+ {
650+ var songName : String = ' ' ;
651+ var modName : String = ' ' ;
652+ var locationId : Array <Int > = [];
653+ var isMissing : Bool = false ;
654+ var color : FlxColor = 0xFFFFFFFF ;
655+ var someLocationsNotMissing : Bool = false ;
656+
657+ if (APEntryState .inArchipelagoMode ) {
658+ songName = songList [i ].songName ;
659+ modName = WeekData .weeksLoaded .get (WeekData .weeksList [songList [i ].week ]).folder ;
660+ locationId = APEntryState .apGame .locationData (songName , modName ).concat (APEntryState .apGame .noteData (songName , modName ));
661+ isMissing = [for (ID in locationId ) APEntryState .apGame .isLocationMissing (APEntryState .apGame .info ().get_location_name (ID ))].indexOf (true ) != - 1 || locationId .length == 0 ;
662+ color = isMissing ? FlxColor .RED : FlxColor .GREEN ;
663+
664+
665+ someLocationsNotMissing = isMissing && [for (ID in locationId ) APEntryState .apGame .isLocationMissing (APEntryState .apGame .info ().get_location_name (ID ))].contains (false );
666+
667+ for (songObj in curUnlocked )
668+ {
669+ if (((songName .trim ().toLowerCase ().replace (' -' , ' ' ) == songObj .song .trim ().toLowerCase ().replace (' -' , ' ' )) && modName == songObj .mod ) && isMissing ) {
670+ color = someLocationsNotMissing ? FlxColor .GRAY : FlxColor .WHITE ;
671+ unplayedList .push (songName );
672+ }
673+ }
674+
675+ if (! unplayedList .contains (songName ) && isMissing ) {
676+ trueMissing .push (songName );
677+ }
678+ }
679+
680+ FreeplayManager .callVictory = FreeplayManager .isVictorySong (songName , modName ) && ! isMissing && ! someLocationsNotMissing ;
681+
682+ if (FreeplayManager .callVictory ) {
683+ trace (" Apparently, the victory song has been cleared, so... Goaling!" );
684+ APEntryState .apGame .checkGoal (songName , modName );
685+ }
686+ }
687+ }
688+
646689 public static function checkVictory () {
647690 // Check if the Victory Song is cleared.
648691 var victorySong = APEntryState .apGame ?. getSongAndMod (APEntryState .victorySong );
@@ -718,4 +761,22 @@ class GlobalSongMetadata
718761 this .folder = Mods .currentModDirectory ;
719762 if (this .folder == null ) this .folder = ' ' ;
720763 }
764+ }
765+
766+ class VictorySong extends DynamicColoredAlphabet
767+ {
768+
769+ public function new (x : Float , y : Float , text : String , color : Int , preserve : Bool )
770+ {
771+ super (x , y , text , color , preserve );
772+ }
773+
774+ var e : Int = 0 ;
775+
776+ override function update (elapsed : Float )
777+ {
778+ e ++ ;
779+ super .update (elapsed );
780+ this .color = FlxColor .fromHSL (((e / 2 ) / 300 * 360 ) % 360 , 1.0 , 0.5 * 1.0 );
781+ }
721782}
0 commit comments