From 224bcf3397cee2f8cfa9b3eeeda0485c853c33a0 Mon Sep 17 00:00:00 2001 From: DelinWorks Date: Sun, 12 Jun 2022 01:39:11 +0300 Subject: [PATCH] Fix RANDOM_KISS rounding crash. --- core/2d/CCParticleSystem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/2d/CCParticleSystem.cpp b/core/2d/CCParticleSystem.cpp index 94c68ec973..47488f5ac9 100644 --- a/core/2d/CCParticleSystem.cpp +++ b/core/2d/CCParticleSystem.cpp @@ -860,7 +860,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe Vec2 point = {0, 0}; { - int rand0 = abs(RANDOM_KISS() * shape.mask.points.size()); + int rand0 = RANDOM_KISS_ABS() * shape.mask.points.size(); int index = MIN(rand0, shape.mask.points.size() - 1); point = shape.mask.points[index]; } @@ -915,7 +915,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe { for (int i = start; i < _particleCount; ++i) { - int rand0 = abs(RANDOM_KISS() * _animIndexCount); + int rand0 = RANDOM_KISS_ABS() * _animIndexCount; _particleData.animCellIndex[i] = MIN(rand0, _animIndexCount - 1); } } @@ -927,7 +927,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe for (int i = start; i < _particleCount; ++i) { - int rand0 = abs(RANDOM_KISS() * _randomAnimations.size()); + int rand0 = RANDOM_KISS_ABS() * _randomAnimations.size(); int index = MIN(rand0, _randomAnimations.size() - 1); _particleData.animIndex[i] = _randomAnimations[index]; auto& descriptor = _animations.at(_particleData.animIndex[i]);