forked from jtauber/ultima4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shapes.py
35 lines (31 loc) · 801 Bytes
/
shapes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
EGA2RGB = [
(0x00, 0x00, 0x00),
(0x00, 0x00, 0xAA),
(0x00, 0xAA, 0x00),
(0x00, 0xAA, 0xAA),
(0xAA, 0x00, 0x00),
(0xAA, 0x00, 0xAA),
(0xAA, 0x55, 0x00),
(0xAA, 0xAA, 0xAA),
(0x55, 0x55, 0x55),
(0x55, 0x55, 0xFF),
(0x55, 0xFF, 0x55),
(0x55, 0xFF, 0xFF),
(0xFF, 0x55, 0x55),
(0xFF, 0x55, 0xFF),
(0xFF, 0xFF, 0x55),
(0xFF, 0xFF, 0xFF),
]
def load_shapes():
shapes = []
bytes = open("ULT/SHAPES.EGA", 'rb').read()
for i in range(256):
shape = []
for j in range(16):
for k in range(8):
d = bytes[k + 8 * j + 128 * i]
a, b = divmod(d, 16)
shape.append(EGA2RGB[a])
shape.append(EGA2RGB[b])
shapes.append(shape)
return shapes