Qt: Fix indices when swapping palette sets

This commit is contained in:
Jeffrey Pfau 2016-10-20 22:17:23 -07:00
parent 2f0501d3c4
commit 9c5d434d90
1 changed files with 2 additions and 1 deletions

View File

@ -65,6 +65,7 @@ void AssetTile::setPalette(int palette) {
} }
void AssetTile::setPaletteSet(int palette, int boundary, int max) { void AssetTile::setPaletteSet(int palette, int boundary, int max) {
m_index = m_index * (1 + m_paletteSet) / (1 + palette);
if (m_index >= max) { if (m_index >= max) {
m_index = max - 1; m_index = max - 1;
} }
@ -76,7 +77,7 @@ void AssetTile::setPaletteSet(int palette, int boundary, int max) {
void AssetTile::selectIndex(int index) { void AssetTile::selectIndex(int index) {
m_index = index; m_index = index;
const uint16_t* data; const uint16_t* data;
m_ui.tileId->setText(QString::number(index)); m_ui.tileId->setText(QString::number(index * (1 + m_paletteSet)));
mTileCacheSetPalette(m_tileCache.get(), m_paletteSet); mTileCacheSetPalette(m_tileCache.get(), m_paletteSet);
unsigned bpp = 8 << m_tileCache->bpp; unsigned bpp = 8 << m_tileCache->bpp;