From bcb389023130e834e05b1b620723f7f961ca0c0a Mon Sep 17 00:00:00 2001 From: Zep Date: Sun, 13 Sep 2026 12:29:08 -0500 Subject: [PATCH] Updated getStrumlineCamPos and getCharactersCamPos. Decided to add checks for the alpha and exists fields when getting the camera position of characters. The parameter name is inaccurate for not accounting for the alpha, and it is inconvenient to have to set exists along with visible whenever hiding a character. Thanks to Pharaotis bringing it to my attention, I also added the ignoreInactive parameter. --- source/funkin/game/PlayState.hx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 6f203a741..ffac44571 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1539,9 +1539,10 @@ class PlayState extends MusicBeatState * @param strumLine The strumline to get the camera position of. * @param pos The position to put the camera position in. If `null`, a new FlxPoint will be created. * @param ignoreInvisible Whenever invisible characters should be ignored. + * @param ignoreInactive Whether inactive characters should be ignored. **/ - public inline function getStrumlineCamPos(strumLine:Int, ?pos:FlxPoint = null, ?ignoreInvisible:Bool = true):CamPosData { - return getCharactersCamPos(strumLines.members[strumLine].characters, pos, ignoreInvisible); + public inline function getStrumlineCamPos(strumLine:Int, ?pos:FlxPoint = null, ?ignoreInvisible:Bool = true, ?ignoreInactive = false):CamPosData { + return getCharactersCamPos(strumLines.members[strumLine].characters, pos, ignoreInvisible, ignoreInactive); } /** @@ -1549,12 +1550,13 @@ class PlayState extends MusicBeatState * @param chars The characters to get the camera position of. * @param pos The position to put the camera position in. If `null`, a new FlxPoint will be created. * @param ignoreInvisible Whenever invisible characters should be ignored. + * @param ignoreInactive Whether inactive characters should be ignored. **/ - public dynamic function getCharactersCamPos(chars:Array, ?pos:FlxPoint = null, ?ignoreInvisible:Bool = true):CamPosData { + public dynamic function getCharactersCamPos(chars:Array, ?pos:FlxPoint = null, ?ignoreInvisible:Bool = true, ?ignoreInactive = false):CamPosData { if (pos == null) pos = FlxPoint.get(); - var amount = 0; + var amount:Int = 0; for(c in chars) { - if (c == null || (ignoreInvisible && !c.visible)) continue; + if (c == null || (ignoreInvisible && (c.alpha <= 0 || !c.visible || !c.exists)) || (ignoreInactive && !c.active)) continue; var cpos = c.getCameraPosition(); pos.x += cpos.x; pos.y += cpos.y;