Files
mtgodot-poc/formats/property.h
T
shenandClaude Sonnet 5 47baf6c0c6 Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
  phases, EntityStore world model, ~all GC/CG headers. char create/delete,
  private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
  quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
  char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
  token), system-option + game-option + ESC system menu, private-shop 39-grid,
  party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
  dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.

Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.

Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).

ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
2026-08-31 20:02:12 +09:00

56 lines
2.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Property 文件(`.prb` Building / `.prt` Tree / `.pre` Effect / `.prd` DungeonBlock /
// `.pra` Ambience+ CRC 注册表。SHINSOO §5.6 / §9-W0 / BACKLOG E13。
//
// 文件格式(文本):
// 行1: YPRT
// 行2: <crc> 十进制 uint32
// 行3+: <key>\t"<value>" key 小写,value 去引号)
//
// AreaData 的 property_crc 指向这里的 crc。W0 只建 crc -> Property 索引,不做实例化。
#pragma once
#include <cstdint>
#include <map>
#include <string>
#include <vector>
namespace fmt {
enum class PropertyType { Unknown, Tree, Building, Effect, Ambience, DungeonBlock };
struct Property {
uint32_t crc = 0;
PropertyType type = PropertyType::Unknown;
std::string name; // propertyname
std::string type_str; // propertytype 原字符串
std::map<std::string, std::string> kv; // 全部键值(含 buildingfile / treefile / ...
std::string source_path; // 来源文件(诊断用)
std::string get(const std::string& key, const std::string& def = "") const;
};
PropertyType property_type_from_string(const std::string& s);
bool parse_property(const std::string& text, Property& out, std::string* err);
bool parse_property_file(const std::string& path, Property& out, std::string* err);
// 扫一个目录树,收集所有 property 文件,按 crc 索引。
struct PropertyRegistry {
std::map<uint32_t, Property> by_crc;
int files_scanned = 0;
int parse_failed = 0;
int crc_collisions = 0; // 同 crc 出现多次(保留第一个)
std::vector<std::string> failed_paths;
std::map<std::string, int> type_counts; // "Tree" -> N ...
const Property* find(uint32_t crc) const;
// root 通常是 `<assets>/Property`。递归找 *.prb/*.prt/*.pre/*.prd/*.prastd::filesystem)。
bool scan(const std::string& root, std::string* err);
// 同上,但文件清单外部给(PCK 里没法 recursive_directory_iterator)。
// rel_paths 里挑属性扩展名的,逐个 read_file(root + "/" + rel) 解析。
bool scan_list(const std::string& root, const std::vector<std::string>& rel_paths,
std::string* err);
};
} // namespace fmt