1
Fork 0
mirror of https://github.com/Steffo99/lihzahrd.git synced 2024-11-21 15:44:24 +00:00

Handle UNKNOWN_3 RLEEncodings, found in tModLoader worlds

This commit is contained in:
Steffo 2019-08-21 13:06:45 +02:00
parent 81fe56469c
commit 0eec5a9fce
2 changed files with 6 additions and 1 deletions

View file

@ -13,6 +13,11 @@ class RLEEncoding(enum.IntEnum):
DOUBLE_BYTE = 2
"""The read data refers to 256-4800 tiles (2 bytes)."""
UNKNOWN_3 = 3
"""The read data refers to unknown tiles, assuming 256-4800 (2 bytes).
Found in certain tModLoader worlds."""
@classmethod
def from_flags(cls, flags1):
return cls(flags1[7] * 2 + flags1[6])

View file

@ -254,7 +254,7 @@ class World:
liquid = Liquid(type_=liquid_type, volume=fr.uint1())
else:
liquid = None
if rle_compression == RLEEncoding.DOUBLE_BYTE:
if rle_compression == RLEEncoding.DOUBLE_BYTE or rle_compression == RLEEncoding.UNKNOWN_3:
multiply_by = fr.uint2() + 1
elif rle_compression == RLEEncoding.SINGLE_BYTE:
multiply_by = fr.uint1() + 1