Write JASC files with \r\n line endings
This commit is contained in:
parent
fe22a2fbbc
commit
a61dd168cf
2 changed files with 6 additions and 15 deletions
|
@ -277,14 +277,14 @@ void PaletteUtil::writeJASC(QString filepath, QVector<QRgb> palette, int offset,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text = "JASC-PAL\n0100\n";
|
QString text = "JASC-PAL\r\n0100\r\n";
|
||||||
text += QString::number(nColors) + "\n";
|
text += QString::number(nColors) + "\r\n";
|
||||||
|
|
||||||
for (int i = offset; i < offset + nColors; i++) {
|
for (int i = offset; i < offset + nColors; i++) {
|
||||||
QRgb color = palette.at(i);
|
QRgb color = palette.at(i);
|
||||||
text += QString::number(qRed(color)) + " "
|
text += QString::number(qRed(color)) + " "
|
||||||
+ QString::number(qGreen(color)) + " "
|
+ QString::number(qGreen(color)) + " "
|
||||||
+ QString::number(qBlue(color)) + "\n";
|
+ QString::number(qBlue(color)) + "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile file(filepath);
|
QFile file(filepath);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "historyitem.h"
|
#include "historyitem.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "parseutil.h"
|
#include "parseutil.h"
|
||||||
|
#include "paletteutil.h"
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
#include "tileset.h"
|
#include "tileset.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
@ -720,20 +721,10 @@ void Project::saveTilesetTilesImage(Tileset *tileset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::saveTilesetPalettes(Tileset *tileset, bool primary) {
|
void Project::saveTilesetPalettes(Tileset *tileset, bool primary) {
|
||||||
|
PaletteUtil parser;
|
||||||
for (int i = 0; i < Project::getNumPalettesTotal(); i++) {
|
for (int i = 0; i < Project::getNumPalettesTotal(); i++) {
|
||||||
QString filepath = tileset->palettePaths.at(i);
|
QString filepath = tileset->palettePaths.at(i);
|
||||||
QString content = "JASC-PAL\r\n";
|
parser.writeJASC(filepath, tileset->palettes->at(i).toVector(), 0, 16);
|
||||||
content += "0100\r\n";
|
|
||||||
content += "16\r\n";
|
|
||||||
for (int j = 0; j < 16; j++) {
|
|
||||||
QRgb color = tileset->palettes->at(i).at(j);
|
|
||||||
content += QString("%1 %2 %3\r\n")
|
|
||||||
.arg(qRed(color))
|
|
||||||
.arg(qGreen(color))
|
|
||||||
.arg(qBlue(color));
|
|
||||||
}
|
|
||||||
|
|
||||||
saveTextFile(filepath, content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue