// M2 T1 —— .msm 解析(照 RaceManager.cpp CRaceData::LoadRaceData 的字段子集)。 #include "msm.h" #include "textscript.h" namespace fmt { static bool fill(const Node& root, Msm& out, std::string* err) { out = Msm{}; out.base_model_gr2 = root.str("BaseModelFileName"); if (const Node* hd = root.group("HairData")) { out.hair_path = hd->str("PathName"); for (const Node& h : hd->groups) { HairEntry e; e.index = h.inum("HairIndex"); e.model = h.str("Model"); e.source_skin = h.str("SourceSkin"); e.target_skin = h.str("TargetSkin"); out.hairs.push_back(std::move(e)); } } if (out.base_model_gr2.empty()) { if (err) *err = "msm: 缺 BaseModelFileName"; return false; } return true; } bool parse_msm(const std::string& text, Msm& out, std::string* err) { Node root; if (!parse_textscript(text, root, err)) return false; return fill(root, out, err); } bool parse_msm_file(const std::string& path, Msm& out, std::string* err) { Node root; if (!parse_textscript_file(path, root, err)) return false; return fill(root, out, err); } } // namespace fmt