From e1cd334a3cdcd080a8a7b8a515c7714e9db2bb24 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 07:28:36 +0000 Subject: [PATCH] Decompile 2 functions in Source/Resource/World/GroundResource.cpp Batch #15601 by Yommy: 1 byte-identical, 1 confirmed by peer review. - fn_07911 CGndRes::Parse: byte-identical - fn_07912 CGndRes::ReadWater: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Resource/World/GroundResource.cpp | 42 ++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/Source/Resource/World/GroundResource.cpp b/Source/Resource/World/GroundResource.cpp index 89c1b3a22..de12583fe 100644 --- a/Source/Resource/World/GroundResource.cpp +++ b/Source/Resource/World/GroundResource.cpp @@ -59,10 +59,12 @@ bool CGndRes::Parse() { } this->m_file.Read(&this->lightmapCount, sizeof(this->lightmapCount)); - std::uint32_t unused[3]; - this->m_file.Read(&unused[0], sizeof(unused[0])); - this->m_file.Read(&unused[1], sizeof(unused[1])); - this->m_file.Read(&unused[2], sizeof(unused[2])); + std::uint32_t lightmapWidth; + std::uint32_t lightmapHeight; + std::uint32_t lightmapCells; + this->m_file.Read(&lightmapWidth, sizeof(lightmapWidth)); + this->m_file.Read(&lightmapHeight, sizeof(lightmapHeight)); + this->m_file.Read(&lightmapCells, sizeof(lightmapCells)); if (this->minor >= 7) { this->lightmaps = static_cast(this->m_file.ReadPtr(static_cast(this->lightmapCount) << 8)); } else { @@ -85,36 +87,42 @@ bool CGndRes::Parse() { // OFFSET: 0x0074E870 // FUNCTION: fn_07912 void CGndRes::ReadWater() { - GroundWater record; - this->m_file.Read(&record.parameters, sizeof(record.parameters)); + GroundWaterParameters parameters; + GroundWater entry; + this->m_file.Read(¶meters, sizeof(parameters)); this->m_file.Read(&this->waterWidth, sizeof(this->waterWidth)); this->m_file.Read(&this->waterHeight, sizeof(this->waterHeight)); const float count = static_cast(this->waterWidth * this->waterHeight); - const auto reserveCount = count < 0.0f ? static_cast(-1) : static_cast(count); - this->waterHeights.reserve(reserveCount); - this->water.reserve(reserveCount); + this->waterHeights.reserve(static_cast(count)); + this->water.reserve(static_cast(count)); if (this->major != 1) { return; } if (this->minor == 8) { - this->waterDefault = record.parameters; + this->waterDefault = parameters; float level = 0.0f; for (int index = 0; static_cast(index) < count; ++index) { this->m_file.Read(&level, sizeof(level)); this->waterHeights.push_back(level); - record.parameters.level = level; - std::memset(record.reserved, 0, sizeof(record.reserved)); - this->water.push_back(record); + parameters.level = level; + entry.parameters = parameters; + entry.reserved[0] = 0; + entry.reserved[1] = 0; + entry.reserved[2] = 0; + this->water.push_back(entry); } } else if (this->minor == 9) { for (int index = 0; static_cast(index) < count; ++index) { - this->m_file.Read(&record.parameters, sizeof(record.parameters)); - std::memset(record.reserved, 0, sizeof(record.reserved)); - this->water.push_back(record); - this->waterHeights.push_back(record.parameters.level); + this->m_file.Read(¶meters, sizeof(parameters)); + entry.parameters = parameters; + entry.reserved[0] = 0; + entry.reserved[1] = 0; + entry.reserved[2] = 0; + this->water.push_back(entry); + this->waterHeights.push_back(parameters.level); } } }