Skip to content

Commit

Permalink
Allow to edit shifted tiles (by changing the shift to another value)
Browse files Browse the repository at this point in the history
  • Loading branch information
myst6re committed Jan 16, 2024
1 parent 0fc58b1 commit 96f1c9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/core/field/BackgroundTiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ void Tile::calcIDBig(CaFile *ca)
if (manualIDBig) {
return;
}

if (layerID >= 2) {
IDBig = 0;

return;
}

// Used for conversion to PC format
if (ID == 0) {
Expand Down
12 changes: 6 additions & 6 deletions src/widgets/BackgroundEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,11 @@ void BackgroundEditor::refreshImage(int layer, int section, ParamState paramStat
quint8 tileSize = layer > 1 ? 32 : 16;
QRect area = layerTiles.rect();
QPoint shift = layerTiles.dstShift(tileSize);

qDebug() << "BackgroundEditor::refreshImage" << "area" << area << shift;

qDebug() << "BackgroundEditor::refreshImage" << "area" << area;

_shiftX->setMaximum(tileSize / 2);
_shiftY->setMaximum(tileSize / 2);
_shiftX->setMaximum(tileSize - 1);
_shiftY->setMaximum(tileSize - 1);
_shiftX->setValue(shift.x());
_shiftY->setValue(shift.y());
_shiftX->setEnabled(true);
Expand Down Expand Up @@ -520,9 +520,9 @@ void BackgroundEditor::updateSelectedTiles(const QList<Cell> &cells)
} else {
tiles = _backgroundFile->tiles().tiles(layerID, ID);
}

qDebug() << "updateSelectedTiles" << cellSize << layerID << ID << paramState.param << paramState.state << tiles.size();

QPoint shift(_shiftX->value(), _shiftY->value());
qDebug() << "updateSelectedTiles" << "cellSize" << cellSize << "layerID" << layerID << "ID" << ID << "param" << paramState.param << "state" << paramState.state << "tilescount" << tiles.size() << "shift" << shift;

for (const Tile &tile : std::as_const(tiles)) {
if (layerID >= 1 && !effectTileIds.isEmpty() && !effectTileIds.contains(tile.tileID)) {
Expand Down

0 comments on commit 96f1c9f

Please sign in to comment.