continuinggg (very cool improvements)

asynced video loadings, classes rewrites, bugfixes and a lot more
This commit is contained in:
⍚~Nex
2024-08-31 04:37:00 +02:00
parent 562f1d8fc6
commit 8e81d17fb0
22 changed files with 411 additions and 205 deletions
+9
View File
@@ -43,6 +43,8 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public var debugMode:Bool = false;
public var animDatas:Map<String, AnimData> = [];
public var globalCurFrame(get, set):Int;
/**
* ODD interval -> asynced; EVEN interval -> synced
*/
@@ -374,4 +376,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
return beatInterval = v;
}
@:noCompletion private inline function get_globalCurFrame() {
return animateAtlas != null ? (animateAtlas.anim.curFrame) : (animation.curAnim != null ? animation.curAnim.curFrame : 0);
}
@:noCompletion private inline function set_globalCurFrame(val:Int) {
return animateAtlas != null ? (animateAtlas.anim.curFrame = val) : (animation.curAnim != null ? animation.curAnim.curFrame = val : val);
}
}
+3 -5
View File
@@ -228,7 +228,7 @@ class MusicBeatState extends FlxState implements IBeatReceiver
public override function openSubState(subState:FlxSubState) {
var e = event("onOpenSubState", EventManager.get(StateEvent).recycle(subState));
if (!e.cancelled)
super.openSubState(subState);
super.openSubState(e.substate is FlxSubState ? cast e.substate : subState);
}
public override function onResize(w:Int, h:Int) {
@@ -256,11 +256,9 @@ class MusicBeatState extends FlxState implements IBeatReceiver
if (e.cancelled)
return false;
if (skipTransOut)
if (skipTransOut || (subState is MusicBeatTransition && cast(subState, MusicBeatTransition).newState != null))
return true;
if (subState is MusicBeatTransition && cast(subState, MusicBeatTransition).newState != null)
return true;
openSubState(new MusicBeatTransition(nextState));
openSubState(new MusicBeatTransition(e.substate));
persistentUpdate = false;
return false;
}
+2 -2
View File
@@ -217,7 +217,7 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver
public override function openSubState(subState:FlxSubState) {
var e = event("onOpenSubState", EventManager.get(StateEvent).recycle(subState));
if (!e.cancelled)
super.openSubState(subState);
super.openSubState(e.substate is FlxSubState ? cast e.substate : subState);
}
public override function onResize(w:Int, h:Int) {
@@ -235,7 +235,7 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver
var e = event("onStateSwitch", EventManager.get(StateEvent).recycle(nextState));
if (e.cancelled)
return false;
return super.switchTo(nextState);
return super.switchTo(e.substate);
}
public override function onFocus() {
@@ -4,7 +4,7 @@ import flixel.FlxState;
final class StateEvent extends CancellableEvent {
/**
* Substate that is about to be opened/closed
* Substate or State that is about to be opened/closed
*/
public var substate:FlxState;
public var substate:FlxState; // WHY is it named substate :sob: - Nex
}
+1 -1
View File
@@ -18,8 +18,8 @@ class MainState extends FlxState {
public override function create() {
super.create();
if (!initiated) {
Main.loadGameSettings();
Constants.init();
Main.loadGameSettings();
}
initiated = true;