From 41d8073ac1b00409827968308689c6844bdf7ab8 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 17 Feb 2012 03:27:27 -0600 Subject: Fixed tileset shit --- src/tileset.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src') 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) -- cgit v1.2.3