diff --git a/src/core/Palette.js b/src/core/Palette.js index 868681f..d1b955f 100644 --- a/src/core/Palette.js +++ b/src/core/Palette.js @@ -83,7 +83,7 @@ class Palette { let pos = 0; for (let i = 0; i < length; i++) { - value = (buffer[i] & 0x1F); + value = (buffer[i] & 0x3F); colors[pos++] = this.abgr[value]; } return colors; @@ -105,7 +105,7 @@ class Palette { for (let i = 0; i < length; i++) { value = buffer[i]; - color = (value & 0x1F) * 3; + color = (value & 0x3F) * 3; colors[c++] = this.rgb[color++]; colors[c++] = this.rgb[color++]; colors[c++] = this.rgb[color]; diff --git a/src/core/Tile.js b/src/core/Tile.js index 7e00228..e19656d 100644 --- a/src/core/Tile.js +++ b/src/core/Tile.js @@ -87,7 +87,7 @@ function addIndexedSubtiletoTile( let channelOffset = (chunkOffset + row * TILE_SIZE * subtilesInTile) * 3; const max = channelOffset + TILE_SIZE * 3; while (channelOffset < max) { - clr = (subtile[pos++] & 0x1F) * 3; + clr = (subtile[pos++] & 0x3F) * 3; buffer[channelOffset++] = palette.rgb[clr++]; buffer[channelOffset++] = palette.rgb[clr++]; buffer[channelOffset++] = palette.rgb[clr]; diff --git a/src/core/tilesBackup.js b/src/core/tilesBackup.js index e441ff4..d8c52b7 100644 --- a/src/core/tilesBackup.js +++ b/src/core/tilesBackup.js @@ -120,7 +120,7 @@ export async function incrementialBackupRedis( if (!tileBuffer) { tileBuffer = new Uint32Array(TILE_SIZE * TILE_SIZE); } - const color = palette.abgr[curChunk[pxl] & 0x1F]; + const color = palette.abgr[curChunk[pxl] & 0x3F]; tileBuffer[pxl] = color; } pxl += 1;