From 05e9c6314f305fc2749df985df7f1380a53bac39 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 06:30:01 +0000 Subject: [PATCH] Decompile fn_23492 (CSession::LoadFogParameters) Batch #7219 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23492 CSession::LoadFogParameters: logic confirmed by peer review Peer-reviewed-by: meitogi, gordaoprogramas, Lumen, aDw Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/ClientTiming.cpp | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Source/Contents/ClientTiming.cpp b/Source/Contents/ClientTiming.cpp index 84b22f69..bce2ac4f 100644 --- a/Source/Contents/ClientTiming.cpp +++ b/Source/Contents/ClientTiming.cpp @@ -778,6 +778,54 @@ void CSession::LoadDamageSkinSettings() { } // OFFSET: 0x00DE5620 +// FUNCTION: fn_23492 +bool CSession::LoadFogParameters() { + this->m_fogParameters.clear(); + + CFile file; + if (!file.Open("fogParameterTable.txt", 0, true, false)) { + return false; + } + + const char* cursor = static_cast(file.GetData()); + const char* end = cursor + file.GetSize(); + std::string name; + std::vector values; + + for (const char* start = cursor; cursor < end; ++cursor) { + const char value = *cursor; + if (value == '\n' || value == '\r') { + start = cursor + 1; + continue; + } + + if (value != '#') { + continue; + } + + if (name.empty()) { + name.assign(start, cursor - start); + } else if (values.size() < 3) { + values.push_back(std::string(start, cursor)); + } else { + std::string last(start, cursor); + values.push_back(last); + this->m_fogParameters.push_back(std::make_pair(name, values)); + name.clear(); + values.clear(); + } + + start = cursor + 1; + } + + std::sort(this->m_fogParameters.begin(), this->m_fogParameters.end(), + [](const std::pair>& left, + const std::pair>& right) { + return std::strcmp(left.first.c_str(), right.first.c_str()) < 0; + }); + file.Close(); + return true; +} // OFFSET: 0x00DE5B40 // FUNCTION: fn_23493