From de463d2c65acaaf76271e013cd18acc3f9d98f61 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 09:28:17 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/Effects/StarEffect.cpp Batch #15640 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_19205 CStarEffect::SetupParticle: logic confirmed by peer review - fn_19208 CStarEffect::UpdateParticle: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/StarEffect.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Contents/Effects/StarEffect.cpp b/Source/Contents/Effects/StarEffect.cpp index 0794e8723..1c886c889 100644 --- a/Source/Contents/Effects/StarEffect.cpp +++ b/Source/Contents/Effects/StarEffect.cpp @@ -65,22 +65,22 @@ void CStarEffect::SetupParticle(CParticle* particle) { particle->elapsedFrames = 0; particle->alpha = 0; for (int index = 0; index < 4; ++index) { - state.angles[index] = static_cast(std::max(rand() % 360, 0)); + state.angles[index] = static_cast(std::max(0, rand() % 360)); } - state.lifetime = static_cast(std::max(rand() % 200, 0) + 300); + state.lifetime = static_cast(std::max(0, rand() % 200) + 300); state.texture = 1.0f; - state.baseScale = static_cast(std::max(rand() % 20, 0)) + 20.0f; - state.phase = static_cast(std::max(rand() % 360, 0)); + state.baseScale = static_cast(std::max(0, rand() % 20)) + 20.0f; + state.phase = static_cast(std::max(0, rand() % 360)); particle->SetTexture("effect\\star01.bmp"); - float speedZ = static_cast(std::max(rand() % 200, 0) + 25); - const float speedY = static_cast(std::max(rand() % 10, 0)) + 80.0f; - float speedX = static_cast(std::max(rand() % 200, 0) + 25); - if (std::max(rand() % 2, 0) == 0) { + float speedZ = static_cast(std::max(0, rand() % 200) + 25); + const float speedY = static_cast(std::max(0, rand() % 10)) + 80.0f; + float speedX = static_cast(std::max(0, rand() % 200) + 25); + if (std::max(0, rand() % 2) == 0) { speedX *= -1.0f; } - if (std::max(rand() % 2, 0) == 0) { + if (std::max(0, rand() % 2) == 0) { speedZ *= -1.0f; } @@ -144,12 +144,12 @@ void CStarEffect::UpdateParticle(CParticle* particle) { if (target > current) { current = std::min(current + 1, 359); if (target < current) { - target = current ? std::max(rand() % current, 0) : 0; + target = current ? std::max(0, rand() % current) : 0; } } else { - current = std::max(current - 1, 0); + current = std::max(0, current - 1); if (target >= current) { - target = 359 - (current ? std::max(rand() % current, 0) : 0); + target = 359 - (current ? std::max(0, rand() % current) : 0); } } state.angles[pair * 2 + 1] = static_cast(target); @@ -170,7 +170,7 @@ void CStarEffect::UpdateParticle(CParticle* particle) { if (phase >= 360) { phase -= 360; } - phase = std::max(phase, 0); + phase = std::max(0, phase); particle->scale = state.baseScale * g_sinTable[phase] * 0.05f + state.baseScale; state.phase = static_cast(phase);