diff --git a/source/funkin/backend/chart/VSliceParser.hx b/source/funkin/backend/chart/VSliceParser.hx index b6533777..e9ce0151 100644 --- a/source/funkin/backend/chart/VSliceParser.hx +++ b/source/funkin/backend/chart/VSliceParser.hx @@ -80,10 +80,11 @@ class VSliceParser { switch (event.e) { case "FocusCamera": + var cneEase = values.ease == null || values.ease == "INSTANT" ? ["CLASSIC", null] : parseEase(values.ease); result.events.push({ time: event.t, name: "Camera Movement", - params: [values.char == -1 ? 2 : values.char, values.ease != "INSTANT", values.duration == null ? 4 : values.duration, values.ease == null || values.ease == "INSTANT" ? "CLASSIC" : values.ease, ""] + params: [values.char == -1 ? 2 : values.char, values.ease != "INSTANT", values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1]] }); case "PlayAnimation": result.events.push({ @@ -96,10 +97,11 @@ class VSliceParser { }, values.anim, values.force == null ? false : values.force] }); case "ScrollSpeed": + var cneEase = values.ease == null || values.ease == "INSTANT" ? ["linear", null] : parseEase(values.ease); result.events.push({ time: event.t, name: "Scroll Speed Change", // we dont support the strumline value and also i will put the whole ease name into a single parameter since it works anyways - Nex - params: [values.ease != "INSTANT", values.scroll == null ? 1 : values.scroll, values.duration == null ? 4 : values.duration, values.ease == null || values.ease == "INSTANT" ? "linear" : values.ease, "", values.absolute != true] + params: [values.ease != "INSTANT", values.scroll == null ? 1 : values.scroll, values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1], values.absolute != true] }); case "SetCameraBop": result.events.push({ @@ -108,10 +110,11 @@ class VSliceParser { params: [values.rate == null ? 4 : values.rate, values.intensity == null ? 1 : values.intensity] }); case "ZoomCamera": + var cneEase = values.ease == null || values.ease == "INSTANT" ? ["linear", null] : parseEase(values.ease); result.events.push({ time: event.t, name: "Camera Zoom", // we dont support the direct mode since welp, its kind of useless here - Nex - params: [values.ease != "INSTANT", values.zoom == null ? 1 : values.zoom, "camGame", values.duration == null ? 4 : values.duration, values.ease == null || values.ease == "INSTANT" ? "linear" : values.ease, "", false] + params: [values.ease != "INSTANT", values.zoom == null ? 1 : values.zoom, "camGame", values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1], false] }); } } @@ -260,13 +263,17 @@ class VSliceParser { }; return result; - return null; } public static function encodeChart(chart:ChartData):NewSwagSong { // TO DO return null; } + + public static function parseEase(vsliceEase:String):Array { + for (key in ['InOut', 'In', 'Out']) if (vsliceEase.endsWith(key)) return [vsliceEase.substr(0, vsliceEase.length - key.length), key]; + return [vsliceEase]; + } } // METADATA STRUCTURES diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index e29778b9..dc7f5977 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1452,11 +1452,11 @@ class PlayState extends MusicBeatState if (event.params[1] == false) { moveCamera(); FlxG.camera.snapToTarget(); - } else if (event.params[3] != null && event.params[3] != "CLASSIC") { + } else if (event.params[3] != null && event.params[3] != "CLASSIC") { // making more nullchecks in this event because of the default save value being false - Nex moveCamera(); // i feel like i shouldnt nullify the camera target or else is gonna be annoying when scripts cancel the tween with setting back the target onComplete - Nex - var followPos:FlxPoint = camFollow.getPosition() - FlxPoint.weak(FlxG.camera.width * 0.5, FlxG.camera.height * 0.5); - eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: followPos.x, y: followPos.y}, (Conductor.stepCrochet / 1000) * event.params[2], {ease: CoolUtil.flxeaseFromString(event.params[3], event.params[4])})); - followPos.put(); + eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5}, + (Conductor.stepCrochet / 1000) * (event.params[2] == null ? 4 : event.params[2]), {ease: CoolUtil.flxeaseFromString(event.params[3], event.params[4])}) + ); } } case "Add Camera Zoom":