From 44aba206e829e834dc3b0e08262d83994e0c1ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Mon, 5 May 2025 01:46:43 +0200 Subject: [PATCH] im gonna end it all dawg i swear sleeping 4h doesnt help --- source/funkin/backend/chart/VSliceParser.hx | 13 +++++---- source/funkin/game/PlayState.hx | 30 ++++++++++++--------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/source/funkin/backend/chart/VSliceParser.hx b/source/funkin/backend/chart/VSliceParser.hx index f94d8308..606054a2 100644 --- a/source/funkin/backend/chart/VSliceParser.hx +++ b/source/funkin/backend/chart/VSliceParser.hx @@ -124,16 +124,19 @@ class VSliceParser { arr = arr.concat([true, values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1]]); } } + if (isPosOnly || ((values.x != null && values.x != 0) || (values.y != null && values.y != 0))) { + var useNull = arr.length <= 2; + result.events.push({ + time: event.t, + name: "Camera Position", + params: [values.x, values.y, useNull ? null : arr[1], useNull ? null : arr[2], useNull ? null : arr[3], useNull ? null : arr[4], true] + }); + } if (!isPosOnly) result.events.push({ time: event.t, name: "Camera Movement", params: arr }); - if (isPosOnly || ((values.x != null && values.x > 0) || (values.y != null && values.y > 0))) result.events.push({ - time: event.t, - name: "Camera Position", - params: [values.x, values.y, arr[1], arr[2], arr[3], arr[4], true] - }); case "PlayAnimation": result.events.push({ time: event.t, diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 59aa9338..0e12d20a 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1465,15 +1465,17 @@ class PlayState extends MusicBeatState } case "Camera Movement": var tween = eventsTween.get("cameraMovement"); - if (tween != null) tween.cancel(); + if (tween != null) { + if (tween.onComplete != null) tween.onComplete(tween); + tween.cancel(); + } curCameraTarget = event.params[0]; + moveCamera(); + if (strumLines.members[curCameraTarget] != null) { - if (event.params[1] == false) { - moveCamera(); - FlxG.camera.snapToTarget(); - } 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(); + if (event.params[1] == false) FlxG.camera.snapToTarget(); + 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 var oldFollow = FlxG.camera.followEnabled; FlxG.camera.followEnabled = false; eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5}, @@ -1486,19 +1488,21 @@ class PlayState extends MusicBeatState } case "Camera Position": var tween = eventsTween.get("cameraMovement"); - if (tween != null) tween.cancel(); + if (tween != null) { + if (tween.onComplete != null) tween.onComplete(tween); + tween.cancel(); + } curCameraTarget = -1; - var isOffset = event.params[6] == "true"; - camFollow.setPosition(isOffset ? camFollow.x + event.params[0] : event.params[0], isOffset ? camFollow.y + event.params[1] : event.params[1]); + var isOffset = event.params[6] == true; + camFollow.setPosition(isOffset ? (camFollow.x + event.params[0]) : event.params[0], isOffset ? (camFollow.y + event.params[1]) : event.params[1]); - if (event.params[2] == false) { - FlxG.camera.snapToTarget(); - } else if (event.params[4] != "CLASSIC") { + if (event.params[2] == false) FlxG.camera.snapToTarget(); + else if (event.params[4] != null && event.params[4] != "CLASSIC") { var oldFollow = FlxG.camera.followEnabled; FlxG.camera.followEnabled = false; 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[3], { + (Conductor.stepCrochet / 1000) * (event.params[3] == null ? 4 : event.params[3]), { ease: CoolUtil.flxeaseFromString(event.params[4], event.params[5]), onComplete: (_) -> FlxG.camera.followEnabled = oldFollow })