|
|
|
|
@@ -14,7 +14,8 @@ namespace Graphics {
|
|
|
|
|
TilesPattern::TilesPattern() {
|
|
|
|
|
tilesPerRow = 16;
|
|
|
|
|
numberOfTiles = 16;
|
|
|
|
|
// std::vector<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 11, 12, 13, 14, 15, 16});
|
|
|
|
|
// std::vector<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 11, 12, 13, 14, 15,
|
|
|
|
|
// 16});
|
|
|
|
|
|
|
|
|
|
transformVector.push_back(std::vector<int>{0, 1, 2, 3});
|
|
|
|
|
transformVector.push_back(std::vector<int>{4, 5, 6, 7});
|
|
|
|
|
@@ -38,10 +39,8 @@ void TilesPattern::default_settings() {
|
|
|
|
|
|
|
|
|
|
int pos = 0;
|
|
|
|
|
while (std::regex_search(patternString, cm, arrayRegExp)) {
|
|
|
|
|
// while (arrayRegExp.indexIn(patternString, pos) != -1) {
|
|
|
|
|
std::string arrayString = cm[1];
|
|
|
|
|
std::vector<int> tmpVect;
|
|
|
|
|
// std::cout << arrayString;
|
|
|
|
|
unsigned int stringPos = 1;
|
|
|
|
|
|
|
|
|
|
while (arrayString[stringPos] != ']') {
|
|
|
|
|
@@ -98,7 +97,6 @@ std::vector<std::vector<tile8> > TilesPattern::transform(
|
|
|
|
|
unsigned int posX = i + repeatOffsetX;
|
|
|
|
|
unsigned int posY = j + repeatOffsetY;
|
|
|
|
|
printf("X: %d - Y: %d - posTile : %d", posX, posY, posTile);
|
|
|
|
|
// toret[posY][posX] = tiles[posTile];
|
|
|
|
|
toret.at(posY).at(posX) = tiles[posTile];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -134,11 +132,9 @@ std::vector<tile8> TilesPattern::reverse(
|
|
|
|
|
unsigned int blockNB =
|
|
|
|
|
(i % (nbTransPerRow * numberOfTiles) % tilesPerRow) / tVectWidth;
|
|
|
|
|
|
|
|
|
|
// std::cout << colInTab << lineInTab << " = " << tileNb;
|
|
|
|
|
// unsigned int pos = tileNb + ((i % tilesPerRow) / nbTransPerRow) *
|
|
|
|
|
// numberOfTiles;
|
|
|
|
|
std::cout << colInTab << lineInTab << " = " << tileNb;
|
|
|
|
|
unsigned int pos = tileNb + (lineBlock + blockNB) * numberOfTiles;
|
|
|
|
|
// std::cout << i << "Goes to : " << pos;
|
|
|
|
|
std::cout << i << "Goes to : " << pos;
|
|
|
|
|
toretVec[pos] = tiles[i];
|
|
|
|
|
}
|
|
|
|
|
return toretVec;
|
|
|
|
|
@@ -150,70 +146,15 @@ std::vector<std::vector<tile8> > TilesPattern::transform(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TilePreset::TilePreset() {
|
|
|
|
|
bpp = 0;
|
|
|
|
|
length = 0;
|
|
|
|
|
pcTilesLocation = -1;
|
|
|
|
|
SNESTilesLocation = 0;
|
|
|
|
|
length = 0;
|
|
|
|
|
bpp = 0;
|
|
|
|
|
compression = "None";
|
|
|
|
|
pcPaletteLocation = 0;
|
|
|
|
|
SNESPaletteLocation = 0;
|
|
|
|
|
paletteNoZeroColor = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TilePreset::save(const std::string &file) {
|
|
|
|
|
// QSettings pFile(file, QSettings::IniFormat);
|
|
|
|
|
|
|
|
|
|
// if (pFile.isWritable() == false)
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
// pFile.setValue("_/name", name);
|
|
|
|
|
// pFile.setValue("rom/name", romName);
|
|
|
|
|
// pFile.setValue("rom/type", romType);
|
|
|
|
|
|
|
|
|
|
// pFile.setValue("tiles/pc_location", QString::number(pcTilesLocation, 16));
|
|
|
|
|
// pFile.setValue("tiles/snes_location", QString::number(SNESTilesLocation,
|
|
|
|
|
// 16)); pFile.setValue("tiles/length", length); pFile.setValue("tiles/bpp",
|
|
|
|
|
// bpp); pFile.setValue("tiles/compression", compression);
|
|
|
|
|
// pFile.setValue("tiles/pattern", tilesPattern.name);
|
|
|
|
|
|
|
|
|
|
// pFile.setValue("palette/pc_location", QString::number(pcPaletteLocation,
|
|
|
|
|
// 16)); pFile.setValue("palette/snes_location",
|
|
|
|
|
// QString::number(SNESPaletteLocation, 16));
|
|
|
|
|
// pFile.setValue("palette/nozerocolor", paletteNoZeroColor);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TilePreset::load(const std::string &file) {
|
|
|
|
|
// QSettings pFile(file, QSettings::IniFormat);
|
|
|
|
|
|
|
|
|
|
// /* Meh solution to know if the file is right*/
|
|
|
|
|
// if (pFile.value("_/name").toString().isEmpty())
|
|
|
|
|
// return false;
|
|
|
|
|
// name = pFile.value("_/name").toString();
|
|
|
|
|
// romName = pFile.value("rom/name").toString();
|
|
|
|
|
// romType = pFile.value("rom/type").toString();
|
|
|
|
|
|
|
|
|
|
// /* Locations are stored in a hex string */
|
|
|
|
|
// bool ok;
|
|
|
|
|
// pcTilesLocation = pFile.value("tiles/pc_location").toString().toUInt(&ok,
|
|
|
|
|
// 16); SNESTilesLocation =
|
|
|
|
|
// pFile.value("tiles/snes_location").toString().toUInt(&ok, 16); length =
|
|
|
|
|
// pFile.value("tiles/length").toInt(); bpp =
|
|
|
|
|
// pFile.value("tiles/bpp").toInt(); compression =
|
|
|
|
|
// pFile.value("tiles/compression").toString(); QString patternName =
|
|
|
|
|
// pFile.value("tiles/pattern").toString(); if (patternName.isEmpty())
|
|
|
|
|
// patternName = "normal";
|
|
|
|
|
// tilesPattern = TilesPattern::pattern(patternName);
|
|
|
|
|
|
|
|
|
|
// pcPaletteLocation =
|
|
|
|
|
// pFile.value("palette/pc_location").toString().toUInt(&ok, 16);
|
|
|
|
|
// SNESPaletteLocation =
|
|
|
|
|
// pFile.value("palette/snes_location").toString().toUInt(&ok, 16);
|
|
|
|
|
// paletteNoZeroColor = pFile.value("palette/nozerocolor").toBool();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Graphics
|
|
|
|
|
} // namespace Application
|
|
|
|
|
} // namespace yaze
|
|
|
|
|
|