From 1500ff94527ea3970a2bbe73070326dbc83933e8 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 00:32:10 +0000 Subject: [PATCH] Decompile fn_22406 (CSoundMaker::OnProcess) Batch #11452 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_22406 CSoundMaker::OnProcess: logic confirmed by peer review Peer-reviewed-by: Yommy, SapitoSucio, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Sound/SoundMaker.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index cfc6f921..53c8b5a8 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -247,7 +247,8 @@ bool CSoundMaker::OnProcess() { const float deltaZ = player->render.position.z - this->render.position.z; float signX = 1.0f; float signZ = 1.0f; - if (deltaX < 0.0f && deltaZ >= 0.0f) { + if (deltaX >= 0.0f && deltaZ >= 0.0f) { + } else if (deltaX < 0.0f && deltaZ >= 0.0f) { signX = -1.0f; } else if (deltaX < 0.0f && deltaZ < 0.0f) { signX = -1.0f; @@ -256,12 +257,12 @@ bool CSoundMaker::OnProcess() { signZ = -1.0f; } - const float slope = deltaZ / std::fmax(deltaX, 0.001f); + const float slope = deltaZ / std::max(deltaX, 0.001f); float offsetX; float offsetZ; if (!(static_cast(this->height / this->width) >= std::fabs(slope))) { offsetZ = static_cast(this->height) * signZ * 0.5f; - offsetX = offsetZ / std::fmax(slope, 0.001f); + offsetX = offsetZ / std::max(slope, 0.001f); } else { offsetX = static_cast(this->width) * signX * 0.5f; offsetZ = slope * offsetX; @@ -276,9 +277,8 @@ bool CSoundMaker::OnProcess() { if (timeGetTime() > this->lastTick + this->cycle) { this->lastTick = timeGetTime(); g_soundMgr->PlayWave( - this->file.c_str(), x - player->render.position.x, 0.0f, z - player->render.position.z, TruncateToInt(this->range), - TruncateToInt(this->range / 6.0f), this->volume, 0 - ); + this->file.c_str(), x - player->render.position.x, 0.0f, z - player->render.position.z, static_cast(this->range), + static_cast(this->range / 6.0f), this->volume, 0); } return true; }