change pixel bitmask from 0x1F to 0x3F to allow 64 color palette

This commit is contained in:
HF 2020-01-31 00:59:23 +01:00
parent 6f9dc2ec32
commit 8b6d0ba698
3 changed files with 4 additions and 4 deletions

View File

@ -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];

View File

@ -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];

View File

@ -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;