Skip to content

Commit 4bf2750

Browse files
committed
e
1 parent a5bcf86 commit 4bf2750

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed

source/managers/FreeplayManager.hx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,11 @@ class FreeplayManager {
416416

417417
public static inline function openFreeplay()
418418
{
419-
if (CategoryState.loadWeekForce != null)
419+
if (CategoryState.loadWeekForce != null && !states.PlayState.Crashed) {
420420
MusicBeatState.preloadAndSwitchState(Type.createInstance(getFreeplay(), []));
421+
} else if (CategoryState.loadWeekForce != null && states.PlayState.Crashed) {
422+
FlxG.switchState(Type.createInstance(getFreeplay(), []));
423+
}
421424
else //You cant play a song without picking a category first!
422425
FlxG.switchState(new states.CategoryState());
423426

source/stages/cutscenes/VideoCutscene.hx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ class VideoCutscene {
88
#if VIDEOS_ALLOWED
99
game.startVideo(videoName);
1010
#if !LEGACY_PSYCH
11-
game.videoCutscene.finishCallback = game.videoCutscene.onSkip = function()
12-
{
13-
game.videoCutscene = null;
11+
try {
12+
game.videoCutscene.finishCallback = game.videoCutscene.onSkip = function()
13+
{
14+
game.videoCutscene = null;
15+
onEnd();
16+
};
17+
} catch (e:Dynamic) {
18+
trace("Error setting video cutscene callbacks: " + e);
19+
trace("It is likely that the video wasn't able to be loaded.");
1420
onEnd();
15-
};
21+
}
1622
#else
1723
@:privateAccess
1824
game.video.bitmap.onEndReached.add(function()

source/yutautil/FlxSafeTween.hx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package yutautil;
2+
3+
// This will be a class which simply takes FlxTween, and manages if it crashes, so that the Global Error Handler can simply handle
4+
// the crash, and this class will just kill the tween and return to the game.
5+
6+
import flixel.FlxG;
7+
import flixel.tweens.FlxTween;
8+
import flixel.util.FlxArrayUtil;
9+
import flixel.util.FlxTimer;
10+
11+
12+
class FlxSafeTween
13+
{
14+
// This will be a list of all the tweens that are currently running.
15+
private var _tweens:Array<FlxTween>;
16+
17+
public function new()
18+
{
19+
_tweens = [];
20+
}
21+

source/yutautil/MetaData.hx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,47 @@ class MetaData {
114114
add("type", Type.getClassName(Type.getClass(variable)));
115115
add("pointer", PointerTools.pointer(variable));
116116

117+
// Special function which will take 2 objects, one a bunch of fields for a start value, and one for an end value.
118+
// This will create a tween for the object, and also automatically null-check itself, so nothing breaks.
119+
// add("tween", function(start:Dynamic, end:Dynamic, duration:Float, ?ease:FlxEase):Void {
120+
// if (variable != null) {
121+
// FlxTween.num(start, start, end, duration, {
122+
// ease: ease,
123+
// onUpdate: function(progress:Float):Void {
124+
// if (variable != null) {
125+
// for (key in Reflect.fields(variable)) {
126+
// var value = Reflect.field(variable, key);
127+
// if (value != null) {
128+
// if (Std.is(value, Float) || Std.is(value, Int)) {
129+
// var startValue = Reflect.field(start, key);
130+
// var endValue = Reflect.field(end, key);
131+
// if (startValue != null && endValue != null) {
132+
// var interpolated = startValue + (endValue - startValue) * progress;
133+
// if (Std.is(value, Int)) {
134+
// Reflect.setField(variable, key, Std.int(interpolated));
135+
// } else {
136+
// Reflect.setField(variable, key, interpolated);
137+
// }
138+
// }
139+
// }
140+
// }
141+
// }
142+
// }
143+
// },
144+
// onComplete: function(tween:FlxTween):Void {
145+
// if (variable != null) {
146+
// for (key in Reflect.fields(variable)) {
147+
// var value = Reflect.field(variable, key);
148+
// if (value != null) {
149+
// metadata(value);
150+
// }
151+
// }
152+
// }
153+
// }
154+
// });
155+
// }
156+
// });
157+
117158
}
118159

119160
private static function cleanup():Void {

0 commit comments

Comments
 (0)