Files
mtgodot-poc/formats/msm.cpp
T
shenandshen c93894313a fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
2026-09-21 16:38:59 -07:00

38 lines
1.2 KiB
C++

// 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");
out.motion_list_file = root.str("MotionListFileName");
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