From 776330d2db32ef36b73244edf1f1ece68de6e69b Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 29 Oct 2026 22:52:44 +0000 Subject: [PATCH] Decompile fn_03437 (CMapSkyMgr::Apply) Batch #3627 by willerthal: 0 byte-identical, 1 confirmed by peer review. - fn_03437 CMapSkyMgr::Apply: logic confirmed by peer review Peer-reviewed-by: eAthena, Yommy, meitogi, youko Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/MapSkyMgr.cpp | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Source/Contents/MapSkyMgr.cpp b/Source/Contents/MapSkyMgr.cpp index 2d0daf4d..4ad439a7 100644 --- a/Source/Contents/MapSkyMgr.cpp +++ b/Source/Contents/MapSkyMgr.cpp @@ -222,3 +222,45 @@ void CMapSkyMgr::CreateClouds(const std::string& mapName) { } // OFFSET: 0x005B95F0 +// FUNCTION: fn_03437 +void CMapSkyMgr::Apply(const std::string& mapName) { + std::string sky = ScriptMapName(mapName); + unsigned char exists = 0; + this->m_script->Call("IsExistMapSkyData", "s>b", sky.c_str(), &exists); + if (exists == 0) { + g_renderer->SetClearColor(0xFF000000u); + return; + } + + int red = 0; + int green = 0; + int blue = 0; + this->m_script->Call("GetBackgroundColor", "s>ddd", sky.c_str(), &red, &green, &blue); + g_renderer->SetClearColor( + 0xFF000000u | ((static_cast(red) & 255u) << 16) | ((static_cast(green) & 255u) << 8) | (static_cast(blue) & 255u) + ); + + unsigned char drawStar = 0; + this->m_script->Call("IsDrawStar", "s>b", sky.c_str(), &drawStar); + if (drawStar == 1) { + g_weatherEffect.Play(9); + } + + this->CreateClouds(sky); + + int oldCount = 0; + this->m_script->Call("GetOldCloudTypeNum", "s>d", sky.c_str(), &oldCount); + for (int index = 1; index <= oldCount; ++index) { + int info = -1; + this->m_script->Call("GetOldCloudInfo", "sd>d", sky.c_str(), index, &info); + if (info != -1) { + g_weatherEffect.Play(static_cast(info)); + } + } + + unsigned char fog = 0; + this->m_script->Call("IsBackGroundFog", "s>b", sky.c_str(), &fog); + if (fog == 1) { + static_cast(g_modeMgr.GetGameMode())->scene->unknown_00FC = true; + } +}