From 95109daedb288e2f57b50754187faa1ffed0c0dc Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Wed, 7 Jan 2026 21:50:27 +0100 Subject: [PATCH] use character's camera focus point to determine the game over cam position --- source/funkin/play/GameOverSubState.hx | 31 +++++++++++--------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index 600a6cb15..d0e77c620 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -168,7 +168,7 @@ class GameOverSubState extends MusicBeatSubState boyfriend.canPlayOtherAnims = true; boyfriend.isDead = true; add(boyfriend); - boyfriend.resetCharacter(); + boyfriend.resetCharacter(false); } } @@ -199,8 +199,18 @@ class GameOverSubState extends MusicBeatSubState // Assign a camera follow point to the boyfriend's position. cameraFollowPoint = new FlxObject(parentPlayState.cameraFollowPoint.x, parentPlayState.cameraFollowPoint.y, 1, 1); - cameraFollowPoint.x = getMidPointOld(boyfriend).x; - cameraFollowPoint.y = getMidPointOld(boyfriend).y; + cameraFollowPoint.x = boyfriend.cameraFocusPoint.x; + cameraFollowPoint.y = boyfriend.cameraFocusPoint.y; + + @:privateAccess + { + cameraFollowPoint.x -= Std.int(boyfriend._data.cameraOffsets[0]); + cameraFollowPoint.y -= Std.int(boyfriend._data.cameraOffsets[1]); + + cameraFollowPoint.x -= Std.int((parentPlayState?.currentStage?._data?.characters?.bf?.cameraOffsets ?? [0, 0])[0]); + cameraFollowPoint.y -= Std.int((parentPlayState?.currentStage?._data?.characters?.bf?.cameraOffsets ?? [0, 0])[1]); + } + var offsets:Array = boyfriend.getDeathCameraOffsets(); cameraFollowPoint.x += offsets[0]; cameraFollowPoint.y += offsets[1]; @@ -212,21 +222,6 @@ class GameOverSubState extends MusicBeatSubState targetCameraZoom = (parentPlayState?.currentStage?.camZoom ?? 1.0) * boyfriend.getDeathCameraZoom(); } - /** - * FlxSprite.getMidpoint(); calculations changed in this git commit - * https://github.com/HaxeFlixel/flixel/commit/1553b5af0871462fcefedc091b7885437d6c36d2 - * https://github.com/HaxeFlixel/flixel/pull/3125 - * - * So we use this to do the old math that gets the midpoint of our graphics - * Luckily, we don't use getGraphicMidpoint() much in the code, so it's fine being in GameoverSubState here. - * @return FlxPoint - */ - function getMidPointOld(spr:FlxSprite, ?point:FlxPoint):FlxPoint - { - if (point == null) point = FlxPoint.get(); - return point.set(spr.x + spr.frameWidth * 0.5 * spr.scale.x, spr.y + spr.frameHeight * 0.5 * spr.scale.y); - } - /** * Forcibly reset the camera zoom level to that of the current stage. * This prevents camera zoom events from adversely affecting the game over state.