From 4ad7463d258a4e7cc510feb3fe9fef121b32ecb9 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 20:09:08 +0000 Subject: [PATCH] Decompile fn_07056 (CMeteorEffect::Open) Batch #15738 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_07056 CMeteorEffect::Open: logic confirmed by peer review Peer-reviewed-by: eAthena, youko, kyoshi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/MeteorEffect.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/Contents/Effects/MeteorEffect.cpp b/Source/Contents/Effects/MeteorEffect.cpp index 8addf86aa..7fe7d3796 100644 --- a/Source/Contents/Effects/MeteorEffect.cpp +++ b/Source/Contents/Effects/MeteorEffect.cpp @@ -45,24 +45,20 @@ void CMeteorEffect::Open() { switch (this->id) { case 1099: case 1111: { - const long long counts[6] = {0, 3, 3, 5, 5, 7}; + const long long counts[5] = {3, 3, 5, 5, 7}; unsigned int level = this->effectLevel; if (level > 5) { level = 5; } - const long long count = counts[level]; - const int span = static_cast(count * 5); - const float halfSpan = static_cast(span) * g_depthAverageHalf; - const int spanPlus1 = span + 1; + const long long count = counts[level - 1]; + const float halfSpan = static_cast(count * 5) * g_depthAverageHalf; + const int range = static_cast(count) * 5 + 1; for (long long i = 0; i < count; ++i) { - vector3d pos; - const int r1 = spanPlus1 != 0 ? std::ranges::max(rand() % spanPlus1, 0) : 0; - pos.x = static_cast(r1) - halfSpan + this->position[0]; - pos.y = this->position[1]; - const int r2 = spanPlus1 != 0 ? std::ranges::max(rand() % spanPlus1, 0) : 0; - pos.z = static_cast(r2) - halfSpan + this->position[2]; + vector3d pos = *reinterpret_cast(this->position); + pos.x = static_cast(RandomIndex(range)) - halfSpan + pos.x; + pos.z = static_cast(RandomIndex(range)) - halfSpan + pos.z; CSpriteParticle* particle = static_cast(CreateSpriteParticle(&pos, 1)); if (!particle) {