Skip to content

Commit 66a6430

Browse files
committed
Fixes for Freeplay Sync Routine.
1 parent d8c9696 commit 66a6430

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

source/archipelago/APDisconnectSubstate.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ class APDisconnectSubstate extends FlxSubState
2424
super(FlxColor.fromRGBFloat(0, 0, 0, .5));
2525
_ap = ap;
2626
Cursor.show();
27+
28+
// AP.disconnect_socket();
29+
states.ExitState.addExitCallback(function() {
30+
var restartProcess = new Process("Mixtape.exe", ["APDisconnectError", "restart"]);
31+
32+
});
33+
FlxG.switchState(new states.ExitState());
2734
}
2835

2936
public function setSeed(seed:String):Void {

source/archipelago/APGameState.hx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,11 @@ class APGameState {
574574
}
575575
isSync = false;
576576
info().casualSync = false;
577-
if (states.FreeplayState.instance != null) states.FreeplayState.instance.reloadSongs(true);
577+
try {
578+
if (states.FreeplayState.instance != null) states.FreeplayState.instance.reloadSongs(true);
579+
} catch (e:Dynamic) {
580+
archipelago.APItem.popup("Error", "You need to wait for all of the data to load, silly!", true);
581+
}
578582
}
579583

580584
// A bandage fix till we have enough brainpower to fix this properly

source/archipelago/APPlayState.hx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,11 +1396,15 @@ class APPlayState extends PlayState {
13961396
return;
13971397
}
13981398

1399-
if (effectMap.exists(effect)) {
1399+
try {
1400+
if (effectMap.exists(effect)) {
14001401
effectMap.get(effect)();
14011402
trace('running effect: $effect');
1402-
} else {
1403+
} else {
14031404
trace("Effect not found: " + effect);
1405+
}
1406+
} catch (e:Dynamic) {
1407+
trace("Error while executing effect: " + effect + " - " + e);
14041408
}
14051409
}
14061410

source/archipelago/Client.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,11 @@ class Client {
14421442
APGameState.instance.APLocations = missingLocations.concat(checkedLocations);
14431443
APGameState.instance.APItems = APGameState.instance.findSpecialItems();
14441444
APGameState.instance.initSaveData();
1445+
try {
1446+
if (states.FreeplayState.instance != null) states.FreeplayState.instance.reloadSongs(true);
1447+
} catch (e:Dynamic) {
1448+
backend.MusicBeatState.resetState();
1449+
}
14451450
return ArchPopup.startPopupCustom("The game can now be played!", "You are now connected to the server. Have fun!", "archColor");
14461451
}
14471452

source/archipelago/CountdownPopup.hx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ class CountdownPopup extends openfl.display.Sprite {
8484
FlxG.sound.play(Paths.sound('countdown/end'));
8585
}
8686
}
87-
8887
private function drawTextAt(text:FlxText, str:String, textX:Float, textY:Float) {
89-
text.text = str;
90-
text.updateHitbox();
91-
var clonedBitmap:BitmapData = text.graphic.bitmap.clone();
92-
bitmaps.push(clonedBitmap);
93-
graphics.beginBitmapFill(clonedBitmap, new Matrix(1, 0, 0, 1, textX, textY), false, false);
94-
graphics.drawRect(textX, textY, text.width + textX, text.height + textY);
88+
try {
89+
text.text = str;
90+
text.updateHitbox();
91+
var clonedBitmap:BitmapData = text.graphic.bitmap.clone();
92+
bitmaps.push(clonedBitmap);
93+
graphics.beginBitmapFill(clonedBitmap, new Matrix(1, 0, 0, 1, textX, textY), false, false);
94+
graphics.drawRect(textX, textY, text.width + textX, text.height + textY);
95+
} catch (e:Dynamic) {
96+
trace('Error in drawTextAt: ' + e);
97+
}
9598
}
9699

97100
private function update(e:Event) {

0 commit comments

Comments
 (0)