From 014c9aa35060bb9adeb650ab12e88766a838c416 Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Sun, 2 Jul 2023 18:01:52 +0200 Subject: [PATCH] Added backwards compatability for strumLinePos --- source/funkin/backend/chart/ChartData.hx | 2 ++ .../editors/charter/CharterStrumlineScreen.hx | 15 ++++++++------- source/funkin/game/PlayState.hx | 11 ++++++----- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/source/funkin/backend/chart/ChartData.hx b/source/funkin/backend/chart/ChartData.hx index b6f0a639..14eee4be 100644 --- a/source/funkin/backend/chart/ChartData.hx +++ b/source/funkin/backend/chart/ChartData.hx @@ -39,6 +39,8 @@ typedef ChartStrumLine = { var ?visible:Null; var ?strumPos:Array; var ?strumScale:Float; + + var ?strumLinePos:Float; // Backwards compatability } typedef ChartNote = { diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 3bf64618..b67d40a7 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -32,7 +32,7 @@ class CharterStrumlineScreen extends UISubstateWindow { } public override function create() { - var creatingStrumLine:Bool = strumLine == null; + var creatingStrumLine:Bool = strumLine == null; if (creatingStrumLine) strumLine = { @@ -63,7 +63,7 @@ class CharterStrumlineScreen extends UISubstateWindow { }; add(charactersTextBox); addLabelOn(charactersTextBox, "Characters"); - + updateCharacterIcons(strumLine.characters); typeDropdown = new UIDropDown(charactersTextBox.x, charactersTextBox.y + 32 + 58, 200, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], strumLine.type); @@ -71,7 +71,7 @@ class CharterStrumlineScreen extends UISubstateWindow { addLabelOn(typeDropdown, "Type"); var stagePositionI = strumLine.position == null ? strumLine.type : ["DAD", "BOYFRIEND", "GIRLFRIEND"].indexOf(strumLine.position.toUpperCase()); - + stagePositionDropdown = new UIDropDown(typeDropdown.x + 200 - 32 + 26, typeDropdown.y, 200, 32, ["DAD", "BOYFRIEND", "GIRLFRIEND"], stagePositionI); add(stagePositionDropdown); addLabelOn(stagePositionDropdown, "Stage Position"); @@ -80,10 +80,11 @@ class CharterStrumlineScreen extends UISubstateWindow { add(hudScaleStepper); addLabelOn(hudScaleStepper, "Scale"); - var startingPos:FlxPoint = strumLine.strumPos == null ? switch (strumLine.type) { - case 1: FlxPoint.get((FlxG.width * 0.75) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), 50); - default: FlxPoint.get((FlxG.width * 0.25) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), 50); - } : FlxPoint.get(strumLine.strumPos[0], strumLine.strumPos[1]); + var strOffset:Float = strumLine.strumLinePos == null ? (strumLine.type == 1 ? 0.75 : 0.25) : strumLine.strumLinePos; + + var startingPos:FlxPoint = strumLine.strumPos == null ? + FlxPoint.get((FlxG.width * strOffset) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), 50) : + FlxPoint.get(strumLine.strumPos[0], strumLine.strumPos[1]); hudXStepper = new UINumericStepper(hudScaleStepper.x + 80 - 32 + 26, hudScaleStepper.y, startingPos.x, 0.001, 2, null, null, 84); add(hudXStepper); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index b5c8b163..80ecc19e 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -622,13 +622,14 @@ class PlayState extends MusicBeatState chars.push(char); } - var startingPos:FlxPoint = strumLine.strumPos == null ? switch (strumLine.type) { - case 1: FlxPoint.get((FlxG.width * 0.75) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), this.strumLine.y); - default: FlxPoint.get((FlxG.width * 0.25) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), this.strumLine.y); - } : FlxPoint.get(strumLine.strumPos[0], strumLine.strumPos[1]); + var strOffset:Float = strumLine.strumLinePos == null ? (strumLine.type == 1 ? 0.75 : 0.25) : strumLine.strumLinePos; + + var startingPos:FlxPoint = strumLine.strumPos == null ? + FlxPoint.get((FlxG.width * strOffset) - ((Note.swagWidth * (strumLine.strumScale == null ? 1 : strumLine.strumScale)) * 2), this.strumLine.y) : + FlxPoint.get(strumLine.strumPos[0], strumLine.strumPos[1]); var strLine = new StrumLine(chars, - startingPos, + startingPos, strumLine.strumScale == null ? 1 : strumLine.strumScale, strumLine.type == 2 || (!coopMode && !((strumLine.type == 1 && !opponentMode) || (strumLine.type == 0 && opponentMode))), strumLine.type != 1, coopMode ? (strumLine.type == 1 ? controlsP1 : controlsP2) : controls