From ed869b55411d51a829e5b502cbbf41cd450458e1 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 9 May 2013 03:42:43 +0200 Subject: fix pattern anims --- lsrlytexporter.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'lsrlytexporter.cpp') diff --git a/lsrlytexporter.cpp b/lsrlytexporter.cpp index 42fb587..29338a4 100644 --- a/lsrlytexporter.cpp +++ b/lsrlytexporter.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include static void collectPanesForList(QList *list, LYTPane *pane) { @@ -1058,6 +1059,8 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) { thing.hermites.append(newKey); } } + + thing.refRes = anim->importedFiles; } } } @@ -1105,6 +1108,11 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) { "Image", "Palette" }; + // FOR TEXPATS + QStringList originalRes = tuIter.value().refRes; + QVector mappings; + QStringList newResList; + switch (type) { case LYTAnimPiece::PaneAnim: aw.writeStartElement("animPainSRTTarget"); @@ -1137,7 +1145,27 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) { aw.writeAttribute("id", QString::number(ak>>8)); aw.writeAttribute("target", PatTargets[ak&0xFF]); - //foreach (const QString &bee, ) + QBitArray whichUsed; + whichUsed.resize(originalRes.size()); + mappings.resize(originalRes.size()); + + foreach (const LYTAnimStepKey &key, tuIter.value().steps) + whichUsed.setBit(key.value); + + for (int i = 0; i < originalRes.size(); i++) { + if (whichUsed.testBit(i)) { + mappings.insert(i, newResList.count()); + newResList.append(originalRes.at(i)); + } + } + + foreach (const QString &bee, newResList) { + aw.writeEmptyElement("refRes"); + QString bee2 = bee; + bee2.replace(".tpl", ""); + aw.writeAttribute("name", bee2); + } + break; } @@ -1151,7 +1179,10 @@ void LSExportPackage(LYTPackageBase *pkg, QString dirStr) { foreach (const LYTAnimStepKey &key, tuIter.value().steps) { aw.writeEmptyElement("key"); aw.writeAttribute("frame", QString::number(key.frame)); - aw.writeAttribute("value", QString::number(key.value)); + int manipValue = key.value; + if (type == LYTAnimPiece::TexPatAnim) + manipValue = mappings.at(manipValue); + aw.writeAttribute("value", QString::number(manipValue)); aw.writeAttribute("slopeType", "Step"); } -- cgit v1.2.3