diff options
author | Treeki <treeki@gmail.com> | 2013-05-09 03:42:43 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-05-09 03:42:43 +0200 |
commit | ed869b55411d51a829e5b502cbbf41cd450458e1 (patch) | |
tree | f35c77684a5a62d4eec569aa49d7c31fd3cc0241 | |
parent | 9ab95a0f0efa2fa1d15da6bd6c2b5e923bb1af42 (diff) | |
download | LayoutStudio-ed869b55411d51a829e5b502cbbf41cd450458e1.tar.gz LayoutStudio-ed869b55411d51a829e5b502cbbf41cd450458e1.zip |
fix pattern animsprivate-nw4r-exporter
-rw-r--r-- | lsrlytexporter.cpp | 35 | ||||
-rw-r--r-- | lyt/animation.cpp | 3 |
2 files changed, 35 insertions, 3 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"); } diff --git a/lyt/animation.cpp b/lyt/animation.cpp index d5e87d3..bcb6bc1 100644 --- a/lyt/animation.cpp +++ b/lyt/animation.cpp @@ -77,12 +77,13 @@ LYTAnimation::LYTAnimation(QByteArray data) { importedFiles.reserve(fileCount); + qint64 strTabBegin = in.device()->pos(); for (int i = 0; i < fileCount; i++) { quint32 offs; in >> offs; qint64 saveMe = in.device()->pos(); - in.device()->seek(offs-8); + in.device()->seek(strTabBegin + offs); importedFiles.append(ReadVariableLengthASCII(in)); in.device()->seek(saveMe); |