From bd0756a28b54fdff3a0192915b4ce355fe6f3c54 Mon Sep 17 00:00:00 2001 From: George Kurelic Date: Mon, 15 Apr 2024 22:20:56 -0500 Subject: [PATCH] fix pooling in cameras following (#3108) --- flixel/FlxCamera.hx | 16 ++++++++-------- flixel/util/FlxPool.hx | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/flixel/FlxCamera.hx b/flixel/FlxCamera.hx index 4d39203fdc..f902a0188f 100644 --- a/flixel/FlxCamera.hx +++ b/flixel/FlxCamera.hx @@ -1477,14 +1477,14 @@ class FlxCamera extends FlxBasic style = Style; target = Target; followLerp = Lerp; - var helper:Float; - var w:Float = 0; - var h:Float = 0; - _lastTargetPosition = null; + _lastTargetPosition = FlxDestroyUtil.put(_lastTargetPosition); + deadzone = FlxDestroyUtil.put(deadzone); switch (Style) { case LOCKON: + var w:Float = 0; + var h:Float = 0; if (target != null) { w = target.width; @@ -1493,16 +1493,16 @@ class FlxCamera extends FlxBasic deadzone = FlxRect.get((width - w) / 2, (height - h) / 2 - h * 0.25, w, h); case PLATFORMER: - var w:Float = (width / 8); - var h:Float = (height / 3); + final w:Float = (width / 8); + final h:Float = (height / 3); deadzone = FlxRect.get((width - w) / 2, (height - h) / 2 - h * 0.25, w, h); case TOPDOWN: - helper = Math.max(width, height) / 4; + final helper = Math.max(width, height) / 4; deadzone = FlxRect.get((width - helper) / 2, (height - helper) / 2, helper, helper); case TOPDOWN_TIGHT: - helper = Math.max(width, height) / 8; + final helper = Math.max(width, height) / 8; deadzone = FlxRect.get((width - helper) / 2, (height - helper) / 2, helper, helper); case SCREEN_BY_SCREEN: diff --git a/flixel/util/FlxPool.hx b/flixel/util/FlxPool.hx index 9c68c5041a..ce74fcfcae 100644 --- a/flixel/util/FlxPool.hx +++ b/flixel/util/FlxPool.hx @@ -174,7 +174,7 @@ class FlxPool implements IFlxPool function trackGet(obj:T) { final callStack = haxe.CallStack.callStack(); - final stack = stackToString(callStack[3]); + final stack = stackToString(callStack[2]); if (stack == null) return;