From ef72c0df2f1a2db23b447dc12cf12969a5518fd3 Mon Sep 17 00:00:00 2001 From: Tomas Heinsohn Huala Date: Fri, 16 Mar 2018 16:07:58 +0100 Subject: [PATCH] Removed unused assignment and extended condition where necessary as this variable could cause a 1/0 sometimes --- src/cameras/2d/Camera.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cameras/2d/Camera.js b/src/cameras/2d/Camera.js index a3acf4d8bb..b642ef5a74 100644 --- a/src/cameras/2d/Camera.js +++ b/src/cameras/2d/Camera.js @@ -480,8 +480,6 @@ var Camera = new Class({ var culledObjects = this.culledObjects; var length = renderableObjects.length; - determinant = 1 / determinant; - culledObjects.length = 0; for (var index = 0; index < length; ++index) @@ -556,8 +554,6 @@ var Camera = new Class({ var cameraH = this.height; var length = interactiveObjects.length; - determinant = 1 / determinant; - var culledObjects = []; for (var index = 0; index < length; ++index) @@ -615,7 +611,7 @@ var Camera = new Class({ if (!determinant) { - return tiles; + return tilemap.tiles; } var mve = cameraMatrix[4]; @@ -634,8 +630,6 @@ var Camera = new Class({ var scrollFactorX = tilemap.scrollFactorX; var scrollFactorY = tilemap.scrollFactorY; - determinant = 1 / determinant; - culledObjects.length = 0; for (var index = 0; index < length; ++index) @@ -765,7 +759,7 @@ var Camera = new Class({ /* First Invert Matrix */ var determinant = (mva * mvd) - (mvb * mvc); - if (!determinant) + if (!determinant || determinant === 0) { output.x = x; output.y = y; @@ -1323,7 +1317,7 @@ var Camera = new Class({ { this._shakeOffsetX = (Math.random() * intensity * this.width * 2 - intensity * this.width) * this.zoom; this._shakeOffsetY = (Math.random() * intensity * this.height * 2 - intensity * this.height) * this.zoom; - + if (this.roundPixels) { this._shakeOffsetX |= 0;