diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tileset.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/tileset.py b/src/tileset.py index a68f733..244cf8e 100644 --- a/src/tileset.py +++ b/src/tileset.py @@ -440,18 +440,10 @@ class KPTileset(object): newpixel = struct.unpack_from('>H', tex, i)[0] # newpixel = (int(tex[i]) << 8) | int(tex[i+1]) - - if(newpixel >= 0x8000): # Check if it's RGB555 - red = ((newpixel >> 10) & 0x1F) * 255 / 0x1F - green = ((newpixel >> 5) & 0x1F) * 255 / 0x1F - blue = (newpixel & 0x1F) * 255 / 0x1F - alpha = 0xFF - - else: # If not, it's RGB4A3 - alpha = ((newpixel & 0x7000) >> 12) * 255 / 0x7 - blue = ((newpixel & 0xF00) >> 8) * 255 / 0xF - green = ((newpixel & 0xF0) >> 4) * 255 / 0xF - red = (newpixel & 0xF) * 255 / 0xF + alpha = ((newpixel & 0x7000) >> 12) * 255 / 0x7 + red = ((newpixel & 0xF00) >> 8) * 255 / 0xF + green = ((newpixel & 0xF0) >> 4) * 255 / 0xF + blue = (newpixel & 0xF) * 255 / 0xF argb = (blue) | (green << 8) | (red << 16) | (alpha << 24) dest.setPixel(xpixel, ypixel, argb) |