From 54ca697cefa7b30e927af9abbe4cc31d1ef2185d Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 9 Nov 2026 21:17:51 +0000 Subject: [PATCH] Decompile fn_20116 (CRagEffect::TurnUndead) Batch #15336 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_20116 CRagEffect::TurnUndead: logic confirmed by peer review Peer-reviewed-by: eAthena, gordaoprogramas Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/RagEffect.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Contents/Effects/RagEffect.cpp b/Source/Contents/Effects/RagEffect.cpp index 9d9fcb018..bd16af8f9 100644 --- a/Source/Contents/Effects/RagEffect.cpp +++ b/Source/Contents/Effects/RagEffect.cpp @@ -9603,20 +9603,20 @@ void CRagEffect::TurnUndead() { this->state.lastPrim->state.speed3d.x = this->state.parent->render.position.x; this->state.lastPrim->state.speed3d.y = this->state.parent->render.position.z; this->state.lastPrim->state.deltaPos2.y = -40.0f; - this->state.lastPrim->state.longitude = static_cast(std::max(rand() % 360, 0)); - this->state.lastPrim->state.longSpeed = static_cast(std::max(rand() % 60, 0) + 10) / 10.0f; + this->state.lastPrim->state.longitude = static_cast(ClampedRandom(360)); + this->state.lastPrim->state.longSpeed = static_cast(ClampedRandom(60) + 10) / 10.0f; EffectPrimitiveState& flash = this->state.lastPrim->state; flash.longAccel = -(flash.longSpeed / static_cast(flash.duration)) / 1.5f; - this->state.lastPrim->state.arcAngle = static_cast(std::max(rand() % 25, 0) + 5) / 10.0f; + this->state.lastPrim->state.arcAngle = static_cast(ClampedRandom(25) + 5) / 10.0f; if (this->state.stateCnt == 0) { - this->state.lastPrim->state.heightSize = static_cast(std::max(rand() % 30, 0) + 350); - this->state.lastPrim->state.heightSpeed = -static_cast(std::max(rand() % 30, 0) + 150) / 10.0f; + this->state.lastPrim->state.heightSize = static_cast(ClampedRandom(30) + 350); + this->state.lastPrim->state.heightSpeed = -static_cast(ClampedRandom(30) + 150) / 10.0f; } else { this->state.lastPrim->state.heightSize = 0.0f; - this->state.lastPrim->state.heightSpeed = static_cast(std::max(rand() % 20, 0) + 50) / 10.0f; + this->state.lastPrim->state.heightSpeed = static_cast(ClampedRandom(20) + 50) / 10.0f; this->state.lastPrim->state.changePoint = 40; - this->state.lastPrim->state.changeSpeed = static_cast(std::max(rand() % 10, 0) + 15) / 10.0f; + this->state.lastPrim->state.changeSpeed = static_cast(ClampedRandom(10) + 15) / 10.0f; this->state.lastPrim->state.changeAccel = 0.0f; this->state.lastPrim->state.changeHeightSpeed = 0.0f; }