Skip to content

Commit f10ce9e

Browse files
committed
a
1 parent 2b6da15 commit f10ce9e

File tree

5 files changed

+78
-53
lines changed

5 files changed

+78
-53
lines changed

source/managers/FreeplayManager.hx

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import states.CategoryState;
88
import states.StoryMenuState;
99
import lime.utils.Assets;
1010
import metadata.STMetaFile.MetadataFile;
11+
import yutautil.AprilFools;
1112

1213
#if ARCHIPELAGO_ALLOWED
1314
import 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
}

source/options/CategoriesSubstate.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,10 @@ class CategoriesSubstate extends LightBaseOptionsMenu
1919

2020
super();
2121
}
22+
23+
override function destroy() {
24+
ClientPrefs.saveSettings();
25+
super.destroy();
26+
}
2227
}
2328

source/psychlua/FunkinLua.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class FunkinLua {
235235
}
236236
});
237237
}
238-
}
238+
239239

240240
//Fun cursor things for lua
241241
Lua_helper.add_callback(lua, "getCursorMode", function()

source/states/freeplay/FreeplayState.hx

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -445,34 +445,14 @@ class FreeplayState extends MusicBeatState
445445
for (i in 0...FreeplayManager.songList.length)
446446
{
447447
var songName:String = '';
448-
var modName:String = '';
449-
var locationId:Array<Int> = [];
448+
var modName:String = '';
450449
var isMissing:Bool = false;
451450
var color:FlxColor = 0xFFFFFFFF;
452451
var someLocationsNotMissing:Bool = false;
453-
454-
if (APEntryState.inArchipelagoMode) {
455-
songName = FreeplayManager.songList[i].songName;
456-
modName = WeekData.weeksLoaded.get(WeekData.weeksList[FreeplayManager.songList[i].week]).folder;
457-
locationId = APEntryState.apGame.locationData(songName, modName).concat(APEntryState.apGame.noteData(songName, modName));
458-
isMissing = [for (ID in locationId) APEntryState.apGame.isLocationMissing(APEntryState.apGame.info().get_location_name(ID))].indexOf(true) != -1 || locationId.length == 0;
459-
color = isMissing ? FlxColor.RED : FlxColor.GREEN;
460-
461-
462-
someLocationsNotMissing = isMissing && [for (ID in locationId) APEntryState.apGame.isLocationMissing(APEntryState.apGame.info().get_location_name(ID))].contains(false);
463-
464-
for (songObj in FreeplayManager.curUnlocked)
465-
{
466-
if (((songName.trim().toLowerCase().replace('-', ' ') == songObj.song.trim().toLowerCase().replace('-', ' ')) && modName == songObj.mod) && isMissing) {
467-
color = someLocationsNotMissing ? FlxColor.GRAY : FlxColor.WHITE;
468-
FreeplayManager.unplayedList.push(songName);
469-
}
470-
}
471-
472-
if (!FreeplayManager.unplayedList.contains(songName) && isMissing) {
473-
FreeplayManager.trueMissing.push(songName);
474-
}
475-
}
452+
453+
songName = songList[i].songName;
454+
modName = WeekData.weeksLoaded.get(WeekData.weeksList[songList[i].week]).folder;
455+
476456
var songText:Alphabet = null;
477457
// for (locId in locationId) {
478458
// // trace("Location ID: " + locId + " Location Name -> " + APEntryState.apGame.info().get_location_name(locId));

source/states/freeplay/OsuFreeplayState.hx

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ class OsuFreeplayState extends MusicBeatState
293293
isTyping = false;
294294
if(searchTypeText.text == '') {
295295
searchTypeText.text = 'Type Here To Search!';
296-
loadSongArray(true, false);
296+
FreeplayManager.reloadFreeplay(true);
297297
}
298298
else
299-
loadSongArray(true, true, searchTypeText.text);
299+
FreeplayManager.reloadFreeplay(false, searchTypeText.text);
300300
}
301301
}
302302

@@ -399,30 +399,9 @@ class OsuFreeplayState extends MusicBeatState
399399
curSelected = 0;
400400

401401
//run this 100 times cause running once only removes half of the items in the group!!??
402-
for(i in 0...100)
403-
{
404-
if(songBox.length != 0)
405-
{
406-
songBox.forEach(function(box:SongBox)
407-
{
408-
songBox.remove(box, true);
409-
box.kill();
410-
box.destroy();
411-
});
412-
413-
for(icon in iconGrp) {
414-
iconGrp.remove(icon, true);
415-
icon.kill();
416-
icon.destroy();
417-
}
418-
419-
for(text in textGrp) {
420-
textGrp.remove(text, true);
421-
text.kill();
422-
text.destroy();
423-
}
424-
}
425-
}
402+
songBox.clear();
403+
iconGrp.clear();
404+
textGrp.clear();
426405

427406
for (i in 0...FreeplayManager.songList.length)
428407
{

0 commit comments

Comments
 (0)