porygon.py: planar2 now works.

current
Kiyoshi Aman 2017-12-08 14:37:52 -06:00
parent 846080b3b9
commit eaadbbd4d1
1 changed files with 10 additions and 6 deletions

View File

@ -58,17 +58,21 @@ def planar2(tile):
for y in range(8): for y in range(8):
byte = 0 byte = 0
shift = 0
for x in range(4): for x in range(4):
pixel = tile.pixelIndex(x, y) pixel = tile.pixelIndex(x, y)
byte = byte & (pixel << (4 - x)) pixel &= 0x3
byte = byte + (pixel << x * 2)
data.append(byte) data.append(byte)
byte = 0 byte = 0
for x in range(4, 8): for x in range(4, 8):
pixel = tile.pixelIndex(x, y) pixel = tile.pixelIndex(x, y)
byte = byte & (pixel << (8 - x)) pixel &= 0x3
byte = byte + (pixel << shift)
shift += 2
data.append(byte) data.append(byte)
@ -91,13 +95,13 @@ def linear4(tile):
c = pixel & 0x4 c = pixel & 0x4
d = pixel & 0x8 d = pixel & 0x8
if a: if a:
bp1 += 2**(8 - x) bp1 += 2**(7 - x)
if b: if b:
bp2 += 2**(8 - x) bp2 += 2**(7 - x)
if c: if c:
bp3 += 2**(8 - x) bp3 += 2**(7 - x)
if d: if d:
bp3 += 2**(8 - x) bp3 += 2**(7 - x)
data.extend((bp1, bp2, bp3, bp4)) data.extend((bp1, bp2, bp3, bp4))