From 668df9754b93800b52d5ea19970dbd826022efb5 Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Mon, 3 Apr 2023 17:47:46 +0200 Subject: [PATCH] Added skew to xml Added Conductor onMeasureHit --- source/funkin/game/Stage.hx | 8 +++ source/funkin/system/CommandLineHandler.hx | 2 +- source/funkin/system/Conductor.hx | 61 ++++++++++++---------- source/funkin/utils/XMLUtil.hx | 8 +++ 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index fa43d7cc..a937e645 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -218,6 +218,14 @@ class Stage extends FlxBasic implements IBeatReceiver { var scroll:Null = Std.parseFloat(node.att.scroll); if (scroll != null) char.scrollFactor.set(scroll, scroll); } + if (node.has.skewx) { + var skew:Null = Std.parseFloat(node.att.skewx); + if (skew != null) char.skew.x = skew; + } + if (node.has.skewy) { + var skew:Null = Std.parseFloat(node.att.skewy); + if (skew != null) char.skew.x = skew; + } } public function beatHit(curBeat:Int) {} diff --git a/source/funkin/system/CommandLineHandler.hx b/source/funkin/system/CommandLineHandler.hx index 67445485..467b623c 100644 --- a/source/funkin/system/CommandLineHandler.hx +++ b/source/funkin/system/CommandLineHandler.hx @@ -15,8 +15,8 @@ class CommandLineHandler { #if MOD_SUPPORT Sys.println("-mod [mod name] | Load a specific mod"); Sys.println("-modfolder [path] | Sets the mod folder path"); - Sys.println("-nogpubitmap | Forces GPU only bitmaps off"); #end + Sys.println("-nogpubitmap | Forces GPU only bitmaps off"); Sys.exit(0); #if MOD_SUPPORT case "-m" | "-mod" | "-currentmod": diff --git a/source/funkin/system/Conductor.hx b/source/funkin/system/Conductor.hx index 1210609e..2d30a6b7 100644 --- a/source/funkin/system/Conductor.hx +++ b/source/funkin/system/Conductor.hx @@ -24,6 +24,7 @@ class Conductor /** * FlxSignals */ + public static var onMeasureHit:FlxTypedSignalVoid> = new FlxTypedSignal(); public static var onBeatHit:FlxTypedSignalVoid> = new FlxTypedSignal(); public static var onStepHit:FlxTypedSignalVoid> = new FlxTypedSignal(); public static var onBPMChange:FlxTypedSignalVoid> = new FlxTypedSignal(); @@ -37,7 +38,7 @@ class Conductor * Current Crochet (time per beat), in milliseconds. */ public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds - + /** * Current StepCrochet (time per step), in milliseconds. */ @@ -47,51 +48,51 @@ class Conductor * Number of beats per mesure (top number in time signature). Defaults to 4. */ public static var beatsPerMesure:Float = 4; - + /** * Number of steps per beat (bottom number in time signature). Defaults to 4. */ public static var stepsPerBeat:Float = 4; - + /** * Current position of the song, in milliseconds. */ public static var songPosition:Float; - + /** * Current step */ public static var curStep:Int = 0; - - /** - * Current beat - */ + + /** + * Current beat + */ public static var curBeat:Int = 0; - - /** - * Current measure - */ + + /** + * Current measure + */ public static var curMeasure:Int = 0; - - - /** - * Current step, as a `Float` (ex: 4.94, instead of 4) - */ + + + /** + * Current step, as a `Float` (ex: 4.94, instead of 4) + */ public static var curStepFloat:Float = 0; - - /** - * Current beat, as a `Float` (ex: 1.24, instead of 1) - */ + + /** + * Current beat, as a `Float` (ex: 1.24, instead of 1) + */ public static var curBeatFloat:Float = 0; - - /** - * Current measure, as a `Float` (ex: 1.24, instead of 1) - */ + + /** + * Current measure, as a `Float` (ex: 1.24, instead of 1) + */ public static var curMeasureFloat:Float = 0; - + @:dox(hide) public static var lastSongPos:Float = 0; @:dox(hide) public static var offset:Float = 0; @@ -189,7 +190,7 @@ class Conductor if (Conductor.songPosition >= change.songTime) __lastChange = change; } - + if (__lastChange.bpm > 0 && bpm != __lastChange.bpm) changeBPM(__lastChange.bpm); curStepFloat = __lastChange.stepTime + ((Conductor.songPosition - __lastChange.songTime) / Conductor.stepCrochet); @@ -215,6 +216,11 @@ class Conductor onBeatHit.dispatch(i+1); } } + if (__updateMeasure && curMeasure > oldMeasure) { + for(i in oldMeasure...curMeasure) { + onMeasureHit.dispatch(i+1); + } + } if (FlxG.state is IBeatReceiver) { var state = FlxG.state; @@ -254,7 +260,6 @@ class Conductor Conductor.beatsPerMesure = beatsPerMesure; Conductor.stepsPerBeat = stepsPerBeat; - onBPMChange.dispatch(bpm); } diff --git a/source/funkin/utils/XMLUtil.hx b/source/funkin/utils/XMLUtil.hx index 175989aa..8bb63475 100644 --- a/source/funkin/utils/XMLUtil.hx +++ b/source/funkin/utils/XMLUtil.hx @@ -93,6 +93,14 @@ class XMLUtil { if (scroll != null) spr.scrollFactor.y = scroll; } } + if (node.has.skewx) { + var skew:Null = Std.parseFloat(node.att.skewx); + if (skew != null) spr.skew.x = skew; + } + if (node.has.skewy) { + var skew:Null = Std.parseFloat(node.att.skewy); + if (skew != null) spr.skew.y = skew; + } if (node.has.antialiasing) spr.antialiasing = node.att.antialiasing == "true"; if (node.has.scale) { var scale:Null = Std.parseFloat(node.att.scale);