From 4616571caec46ee4ec71a1d4e50259d7f0248155 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 06:03:14 +0000 Subject: [PATCH] Decompile fn_06918 (CCloud::Slot07) Batch #13789 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_06918 CCloud::Slot07: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, Toshiro Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/CloudEffect.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Contents/Effects/CloudEffect.cpp b/Source/Contents/Effects/CloudEffect.cpp index f55b50561..96b346934 100644 --- a/Source/Contents/Effects/CloudEffect.cpp +++ b/Source/Contents/Effects/CloudEffect.cpp @@ -46,18 +46,18 @@ void CCloud::Slot01() { // OFFSET: 0x006FBC30 // FUNCTION: fn_06918 void CCloud::Slot07() { - this->driftX = std::max(rand() % 360, 0); - this->driftTargetX = std::max(rand() % 360, 0); - this->driftZ = std::max(rand() % 360, 0); - this->driftTargetZ = std::max(rand() % 360, 0); - this->phase = std::max(rand() % 360, 0); + this->driftX = std::max(0, rand() % 360); + this->driftTargetX = std::max(0, rand() % 360); + this->driftZ = std::max(0, rand() % 360); + this->driftTargetZ = std::max(0, rand() % 360); + this->phase = std::max(0, rand() % 360); const int scaleRange = static_cast(this->scaleRange); - const int scaleOffset = scaleRange ? std::max(rand() % scaleRange, 0) : 0; + const int scaleOffset = scaleRange ? std::max(0, rand() % scaleRange) : 0; this->alpha = 0.0f; this->baseScale = static_cast(scaleOffset) + this->scaleBase; - this->fadeInEnd = this->fadeInBase + (this->fadeInRange ? std::max(rand() % this->fadeInRange, 0) : 0); - this->fadeOutStart = this->fadeOutBase + (this->fadeOutRange ? std::max(rand() % this->fadeOutRange, 0) : 0); + this->fadeInEnd = this->fadeInBase + (this->fadeInRange ? std::max(0, rand() % this->fadeInRange) : 0); + this->fadeOutStart = this->fadeOutBase + (this->fadeOutRange ? std::max(0, rand() % this->fadeOutRange) : 0); if (!this->particle) { return; @@ -66,11 +66,11 @@ void CCloud::Slot07() { this->particle->unknown_00E8 = 0; CParticle* particle = this->particle; const int rangeZ = static_cast(this->offsetRangeZ); - const int offsetZ = rangeZ ? std::max(rand() % rangeZ, 0) : 0; + const int offsetZ = rangeZ ? std::max(0, rand() % rangeZ) : 0; const int rangeY = static_cast(this->offsetRangeY); - const int offsetY = rangeY ? std::max(rand() % rangeY, 0) : 0; + const int offsetY = rangeY ? std::max(0, rand() % rangeY) : 0; const int rangeX = static_cast(this->offsetRangeX); - const int offsetX = rangeX ? std::max(rand() % rangeX, 0) : 0; + const int offsetX = rangeX ? std::max(0, rand() % rangeX) : 0; particle->unknown_00D0 = static_cast(offsetX); particle->unknown_00D4 = static_cast(offsetY); particle->unknown_00D8 = static_cast(offsetZ); @@ -78,7 +78,7 @@ void CCloud::Slot07() { this->particle->SetColor(this->red, this->green, this->blue); this->particle->alpha = 0; this->particle->scale = this->baseScale; - this->particle->SetTexture(FormatOwnedString("effect\\cloud%d.tga", std::max(rand() % 4, 0) + 1).c_str()); + this->particle->SetTexture(FormatOwnedString("effect\\cloud%d.tga", std::max(0, rand() % 4) + 1).c_str()); this->particle->SetRenderFlag(this->renderFlag); }