Skip to content

Commit 8470941

Browse files
committed
Meep.
1 parent 47b9771 commit 8470941

File tree

3 files changed

+44
-14
lines changed

3 files changed

+44
-14
lines changed

source/archipelago/APGameState.hx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,40 @@ class APGameState {
103103

104104
public function locationData(songName:String):Array<Int> {
105105
var matchingLocations:Array<Int> = [];
106-
107-
for (missing in info().missingLocations) {
108-
if (info().get_location_name(missing).startsWith(songName)) {
109-
matchingLocations.push(missing);
106+
var exactMatch:Int = -1;
107+
var hasDashNumber:Bool = false;
108+
109+
var missingLocations = info()?.missingLocations;
110+
var checkedLocations = info()?.checkedLocations;
111+
112+
if (missingLocations != null) {
113+
for (missing in missingLocations) {
114+
var locationName = info().get_location_name(missing);
115+
if (locationName == songName) {
116+
exactMatch = missing;
117+
} else if (new EReg("^" + songName + "-\\d+$", "").match(locationName)) {
118+
matchingLocations.push(missing);
119+
hasDashNumber = true;
120+
}
110121
}
111122
}
112123

113-
for (checked in info().checkedLocations) {
114-
if (info().get_location_name(checked).startsWith(songName)) {
115-
matchingLocations.push(checked);
124+
if (checkedLocations != null) {
125+
for (checked in checkedLocations) {
126+
var locationName = info().get_location_name(checked);
127+
if (locationName == songName) {
128+
exactMatch = checked;
129+
} else if (new EReg("^" + songName + "-\\d+$", "").match(locationName)) {
130+
matchingLocations.push(checked);
131+
hasDashNumber = true;
132+
}
116133
}
117134
}
118135

136+
if (!hasDashNumber && exactMatch != -1) {
137+
return [exactMatch];
138+
}
139+
119140
return matchingLocations;
120141
}
121142

@@ -336,7 +357,6 @@ class APGameState {
336357
}
337358
}
338359
return false;
339-
340360
}
341361

342362
function isModName(name:String):Bool {

source/states/FreeplayState.hx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,15 +642,15 @@ class FreeplayState extends MusicBeatState
642642

643643
var songName:String = '';
644644
var modName:String = '';
645-
var locationId:Int = 0;
645+
var locationId:Array<Int> = [];
646646
var isMissing:Bool = false;
647647
var color:FlxColor = 0xFFFFFFFF;
648648

649649
if (APEntryState.inArchipelagoMode) {
650650
songName = songs[i].songName;
651651
modName = WeekData.weeksLoaded.get(WeekData.weeksList[songs[i].week]).folder;
652-
locationId = APEntryState.apGame.info().get_location_id(songName + (modName != "" ? " (" + modName + ")" : "") + "-0");
653-
isMissing = APEntryState.apGame.isLocationMissing(APEntryState.apGame.info().get_location_name(locationId));
652+
locationId = APEntryState.apGame.locationData(songName + (modName != "" ? " (" + modName + ")" : ""));
653+
isMissing = [for (ID in locationId) APEntryState.apGame.isLocationMissing(APEntryState.apGame.info().get_location_name(ID))].indexOf(true) != -1 || locationId.length == 0;
654654
color = isMissing ? FlxColor.RED : FlxColor.GREEN;
655655

656656
for (daSongName in curUnlocked.keys())
@@ -665,14 +665,18 @@ class FreeplayState extends MusicBeatState
665665
trueMissing.push(songName);
666666
}
667667
}
668-
669668
var songText:Alphabet;
670669
if (APEntryState.inArchipelagoMode) {
671-
//trace('Song: ' + songName + ', Mod: ' + (modName != "" ? modName : "(not modded)") + ', Missing: ' + isMissing);
672-
songText = isVictorySong(songName, modName) ? (isMissing ? new VictorySong(90, 320, songName, color) : new ColoredAlphabet(90, 320, songName, true, 0xFFFFD700)) : new ColoredAlphabet(90, 320, songName, true, color);
670+
if (locationId.length > 0 && locationId.indexOf(0) == -1) {
671+
//trace('Song: ' + songName + ', Mod: ' + (modName != "" ? modName : "(not modded)") + ', Missing: ' + isMissing);
672+
songText = isVictorySong(songName, modName) ? (isMissing ? new VictorySong(90, 320, songName, color) : new ColoredAlphabet(90, 320, songName, true, 0xFFFFD700)) : new ColoredAlphabet(90, 320, songName, true, color);
673+
} else {
674+
continue;
675+
}
673676
} else {
674677
songText = new Alphabet(90, 320, songs[i].songName, true);
675678
}
679+
// if (songText.exists(true)) {
676680
songText.targetY = i;
677681
grpSongs.add(songText);
678682

@@ -692,6 +696,7 @@ class FreeplayState extends MusicBeatState
692696
// but over on mixtape engine we do arrays better
693697
iconArray.push(icon);
694698
iconList.add(icon);
699+
// }
695700

696701
// songText.x += 40;
697702
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!

source/yutautil/CollectionUtils.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ class CollectionUtils
160160
}
161161
}
162162

163+
164+
public static inline function matchRegex(input:String, pattern:EReg):Bool {
165+
return pattern.match(input);
166+
}
167+
163168
public static inline function exists(input:Dynamic, ?checkUninitialized:Bool = false):Dynamic {
164169
if (checkUninitialized) {
165170
try {

0 commit comments

Comments
 (0)