void AddActorInfo(json::Value& values, uint32 aid, bool hair, bool fixEmitter, uint32 orig = 0) { SnoFile<Actor> actor(Actor::name(aid)); if (!actor) return; uint32 emitId = (fixEmitter ? FixEmitter(actor) : aid); if (emitId != actor->x000_Header.id) { AddActorInfo(values, emitId, hair, false, aid); return; } auto& value = values[fmtstring("%d", orig ? orig : aid)]; if (hair) { std::map<uint32, uint32> tags; for (uint32 i = 1; i + 3 <= actor->x060_TagMap.size(); i += 3) { tags[actor->x060_TagMap[i + 1]] = actor->x060_TagMap[i + 2]; } value["hair"] = tags[66564]; } SnoFile<AnimSet> animSet(actor->x068_AnimSetSno.name()); if (animSet) { uint32 anim = 0; for (auto& tm : animSet->x010_AnimSetTagMaps) { if (!tm.x08_TagMap.size() || tm.x08_TagMap.size() != tm.x08_TagMap[0] * 3 + 1) continue; for (uint32 i = 1; i + 3 <= tm.x08_TagMap.size(); i += 3) { if (Anim::name(tm.x08_TagMap[i + 2])) { anim = tm.x08_TagMap[i + 2]; } } } if (anim) { value["animation"] = anim; } } SnoFile<Appearance> app(actor->x014_AppearanceSno.name()); if (app) { json::Value enable(json::Value::tObject); uint32 index = 0; for (auto& object : app->x010_Structure.x088_GeoSets[0].x10_SubObjects) { if (strcmp(object.x05C_Text, "FX_EMIT")) { enable[fmtstring("%d", index)] = 0; } ++index; } value["enable"] = enable; } }
void DumpActorSets(Archive& ans, uint32 aid) { SnoFile<Actor> actor(Actor::name(aid)); if (!actor) return; SnoFile<AnimSet> animSet(actor->x068_AnimSetSno.name()); if (!animSet) return; File& dst = ans.create(aid); for (auto& tm : animSet->x010_AnimSetTagMaps) { uint32 count = tm.x08_TagMap[0]; if (!count || tm.x08_TagMap.size() != count * 3 + 1) { dst.write32(0); continue; } dst.write32(count); for (uint32 i = 0; i < count; ++i) { dst.write32(tm.x08_TagMap[i * 3 + 2]); dst.write32(tm.x08_TagMap[i * 3 + 3]); } } }
void animReset(AnimData* anim) { animSet(anim, anim->def); }