// areadata.txt / areaambiencedata.txt / areaproperty.txt —— 每个区块的对象记录。 // 对标 GameLib/Area.cpp __Load_LoadObject / __Load_LoadAmbience 和 // MapOutdoorLoad.cpp 的 AreaProperty 解析。SHINSOO §5.3 / §5.6。 // // 坐标系(W0 判明 → W3 修正,2026-08-29):areadata 的 position 是**地图全局厘米**(不是 // 区块本地!只有 000000 因为在原点附近才看着像本地)。x 正 = 东,y 负 = 南(幅度 = 距地图 // 北边缘),随 tile_y 增大而更负。`Area::SetCoordinate` 不偏移,正因为 position 已是全局。 // 各区块 x∈[tile_x·25600, +25600]、|y|∈[tile_y·25600, +25600](实测 A1 全 20 区块)。 // z 是竖直(高度)轴 cm。heightBias 加在 z 上。转换:直接 position_to_godot(x, y, z)。 #pragma once #include #include #include namespace fmt { struct AreaObject { double x = 0, y = 0, z = 0; // 区块本地 cm uint32_t crc = 0; // property CRC float yaw = 0, pitch = 0, roll = 0; float height_bias = 0; std::vector portal_ids; }; struct AreaData { int declared_count = 0; // ObjectCount std::vector objects; // 实际解析到的(缺块会跳过,故可能 < declared) }; struct AreaAmbienceObject { double x = 0, y = 0, z = 0; uint32_t crc = 0; float range = 0; }; struct AreaAmbienceData { int declared_count = 0; std::vector objects; }; struct AreaProperty { std::string area_name; // AreaName(去引号) int num_water = 0; }; bool parse_area_data(const std::string& text, AreaData& out, std::string* err); bool parse_area_data_file(const std::string& path, AreaData& out, std::string* err); bool parse_area_ambience(const std::string& text, AreaAmbienceData& out, std::string* err); bool parse_area_ambience_file(const std::string& path, AreaAmbienceData& out, std::string* err); bool parse_area_property(const std::string& text, AreaProperty& out, std::string* err); bool parse_area_property_file(const std::string& path, AreaProperty& out, std::string* err); } // namespace fmt