From 4ab0fbd62de0782b837362eb1410f291dc140db4 Mon Sep 17 00:00:00 2001 From: DelinWorks Date: Thu, 2 Jun 2022 22:26:26 +0300 Subject: [PATCH] Fix rectangular torus stretched dimensions. --- core/2d/CCParticleSystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/2d/CCParticleSystem.cpp b/core/2d/CCParticleSystem.cpp index 685f57b795..f5876dedfc 100644 --- a/core/2d/CCParticleSystem.cpp +++ b/core/2d/CCParticleSystem.cpp @@ -802,10 +802,10 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe } case EmissionShapeType::RECTTORUS: { - float width = (shape.outerWidth - shape.innerWidth) * abs(RANDOM_KISS()) + shape.outerWidth; - float height = (shape.outerHeight - shape.innerHeight) * abs(RANDOM_KISS()) + shape.outerHeight; - width = RANDOM_KISS() < 0.0F ? (width - ((shape.outerWidth - shape.innerWidth) / 2)) * -1 : width - ((shape.outerWidth - shape.innerWidth) / 2); - height = RANDOM_KISS() < 0.0F ? (height - ((shape.outerHeight - shape.innerHeight) / 2)) * -1 : height - ((shape.outerHeight - shape.innerHeight) / 2); + float width = (shape.outerWidth - shape.innerWidth) * abs(RANDOM_KISS()) + shape.innerWidth; + float height = (shape.outerHeight - shape.innerHeight) * abs(RANDOM_KISS()) + shape.innerHeight; + width = RANDOM_KISS() < 0.0F ? width * -1 : width; + height = RANDOM_KISS() < 0.0F ? height * -1 : height; float prob = RANDOM_KISS(); _particleData.posx[i] = _sourcePosition.x + shape.x + width / 2 * (prob >= 0.0F ? 1.0F : RANDOM_KISS()); _particleData.posy[i] = _sourcePosition.y + shape.y + height / 2 * (prob < 0.0F ? 1.0F : RANDOM_KISS());