From 1882e1edc341bdb6d9c1cd7bc70586e3315c033b Mon Sep 17 00:00:00 2001 From: Betopia <73242725+betpowo@users.noreply.github.com> Date: Mon, 20 Jul 2026 07:11:12 -0400 Subject: [PATCH] `centeredCamera` for characters (fixes atlas cam pos) it pmo that no one was bothered to fix it in source........for some reason --- source/funkin/game/Character.hx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 7ecbe0b777..87e2719c91 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -47,6 +47,11 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset public var iconColor:Null = null; public var gameOverCharacter:String = Character.FALLBACK_DEAD_CHARACTER; + /* + Whether to use the center or the top-left of the character as the camera origin point. + This is for compatibility with old texture atlas characters. + */ + public var centeredCamera:Bool = true; public var cameraOffset:FlxPoint = FlxPoint.get(0, 0); public var globalOffset:FlxPoint = FlxPoint.get(0, 0); public var extraOffset:FlxPoint = FlxPoint.get(0, 0); @@ -300,7 +305,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } public inline function getCameraPosition() { - var midpoint:FlxPoint = getMidpoint(); + var midpoint:FlxPoint = centeredCamera ? getMidpoint() : getPosition(); var event = EventManager.get(PointEvent).recycle( midpoint.x + (isPlayer ? -100 : 150) + globalOffset.x + cameraOffset.x, midpoint.y - 100 + globalOffset.y + cameraOffset.y); @@ -406,6 +411,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset if (hasInterval) beatInterval = Std.parseInt(xml.x.get("interval")); loadSprite(Paths.image('characters/$sprite')); + + if (xml.x.exists("centercam")) centeredCamera = (xml.x.get("centercam") == "true"); + else centeredCamera = !isAnimate; + for(node in xml.elements) { switch(node.name) { case "anim": @@ -438,7 +447,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset public static var characterProperties:Array = [ "x", "y", "sprite", "scale", "antialiasing", - "flipX", "camx", "camy", "isPlayer", "icon", + "flipX", "camx", "camy", "centercam", "isPlayer", "icon", "color", "gameOverChar", "holdTime", "applyStageMatrix" ]; public static var characterAnimProperties:Array = [