diff options
Diffstat (limited to 'lsrlytexporter.cpp')
-rw-r--r-- | lsrlytexporter.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/lsrlytexporter.cpp b/lsrlytexporter.cpp index 42fb587..29338a4 100644 --- a/lsrlytexporter.cpp +++ b/lsrlytexporter.cpp @@ -5,6 +5,7 @@ #include <QDir> #include <QFile> #include <QSet> +#include <QBitArray> #include <QMapIterator> static void collectPanesForList(QList<LYTPane *> *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<int> 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"); } |