translated the remaining german notes, python comments, help and messages to english (in-game strings, parsed report lines and cli values stay german)
This commit is contained in:
1 parent
86fe26d786
commit
526f6072f6
36 files changed
+1553
-1544
No files matched your search
+16
-16
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
"""TEXT-Chunk (Texturen) von Level-WADs lesen/schreiben.
|
||||
"""Read/write the TEXT chunk (textures) of level WADs.
|
||||
|
||||
Aufbau (aus groove.exe 0x4067b0):
|
||||
Layout (from groove.exe 0x4067b0):
|
||||
u32 nPal; nPal x { u32 id, u32 n, u16 col[n], u8 extra[n] }
|
||||
u32 nPages; nPages x { u32 flags, u32 w, u32 h, Daten }
|
||||
flags==0 : w*h Byte (8-Bit, Palette)
|
||||
flags&0x80 : u32 Länge, RLE16 (s16 n: n>0 -> n Literal-u16, n<0 -> nächstes u16 (-n)-mal)
|
||||
sonst : w*h u16 roh
|
||||
u32 nTex; Rest = Textur-Einträge (8 Byte) + Anhang (siehe notes/textures.md)
|
||||
u32 nPages; nPages x { u32 flags, u32 w, u32 h, data }
|
||||
flags==0 : w*h bytes (8-bit, palette)
|
||||
flags&0x80 : u32 length, RLE16 (s16 n: n>0 -> n literal u16, n<0 -> next u16 repeated -n times)
|
||||
otherwise : w*h u16 raw
|
||||
u32 nTex; rest = texture entries (8 bytes) + appendix (see notes/textures.md)
|
||||
"""
|
||||
import struct
|
||||
import numpy as np
|
||||
@@ -33,10 +33,10 @@ def rle_encode(px):
|
||||
j = i
|
||||
while j + 1 < N and px[j + 1] == px[i] and j - i < 32766:
|
||||
j += 1
|
||||
if j > i: # Lauf >= 2
|
||||
if j > i: # run >= 2
|
||||
out += [(-(j - i + 1)) & 0xffff, int(px[i])]; i = j + 1
|
||||
continue
|
||||
k = i # Literale bis zum nächsten Lauf
|
||||
k = i # literals up to the next run
|
||||
while k < N and k - i < 32767 and not (k + 1 < N and px[k + 1] == px[k]):
|
||||
k += 1
|
||||
out += [k - i] + [int(x) for x in px[i:k]]; i = k
|
||||
@@ -85,9 +85,9 @@ def build(t, compress=True):
|
||||
|
||||
|
||||
def abgr1555_to_rgba(px):
|
||||
"""PS1-Format: Bits 0-4 R, 5-9 G, 10-14 B, Bit 15 = STP.
|
||||
0x0000 = durchsichtig (Alpha 0). STP=1 -> Alpha 255, STP=0 (Pixel != 0) -> Alpha 128
|
||||
(auf Seiten mit Blendmodus = halbtransparent)."""
|
||||
"""PS1 format: bits 0-4 R, 5-9 G, 10-14 B, bit 15 = STP.
|
||||
0x0000 = transparent (alpha 0). STP=1 -> alpha 255, STP=0 (pixel != 0) -> alpha 128
|
||||
(semi-transparent on pages with a blend mode)."""
|
||||
px = px.astype(np.uint32)
|
||||
r = (px & 31) * 255 // 31
|
||||
g = ((px >> 5) & 31) * 255 // 31
|
||||
@@ -97,13 +97,13 @@ def abgr1555_to_rgba(px):
|
||||
|
||||
|
||||
def rgba_to_abgr1555(img):
|
||||
"""Umkehrung: Alpha < 64 -> 0x0000, 64..191 -> STP=0, >= 192 (oder RGB-Bild) -> STP=1."""
|
||||
"""Inverse: alpha < 64 -> 0x0000, 64..191 -> STP=0, >= 192 (or RGB image) -> STP=1."""
|
||||
img = np.asarray(img).astype(np.uint32)
|
||||
v = ((img[..., 2] >> 3) << 10) | ((img[..., 1] >> 3) << 5) | (img[..., 0] >> 3)
|
||||
if img.shape[-1] == 4:
|
||||
a = img[..., 3]
|
||||
v = np.where(a >= 192, v | 0x8000, v)
|
||||
v = np.where((a >= 64) & (a < 192) & (v == 0), 0x0421, v) # fast schwarz statt durchsichtig
|
||||
v = np.where((a >= 64) & (a < 192) & (v == 0), 0x0421, v) # near-black instead of transparent
|
||||
v = np.where(a < 64, 0, v)
|
||||
else:
|
||||
v = v | 0x8000
|
||||
@@ -111,7 +111,7 @@ def rgba_to_abgr1555(img):
|
||||
|
||||
|
||||
def tex_entries(tail):
|
||||
"""Textur-Einträge (Faces referenzieren diese Indizes): u16 flags, u8 page, u8 clut(0xff),
|
||||
u8 x0, u8 x1, u8 y0, u8 y1 (inklusive Kanten)."""
|
||||
"""Texture entries (faces reference these indices): u16 flags, u8 page, u8 clut(0xff),
|
||||
u8 x0, u8 x1, u8 y0, u8 y1 (edges inclusive)."""
|
||||
n = struct.unpack_from('<I', tail, 0)[0]
|
||||
return [struct.unpack_from('<H6B', tail, 4 + 8 * i) for i in range(n)]
|
||||
Reference in new issue
Block a user