mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Read strings as strings rather than bytes.
This commit is contained in:
parent
a32e45d2d5
commit
9a4e5aef53
1 changed files with 10 additions and 3 deletions
|
@ -53,7 +53,7 @@ class MDL:
|
|||
|
||||
def read_pixels(self, mdl):
|
||||
size = self.width * self.height
|
||||
self.pixels = mdl.read_string(size)
|
||||
self.pixels = mdl.read_bytes(size)
|
||||
|
||||
class STVert:
|
||||
def __init__(self):
|
||||
|
@ -142,9 +142,16 @@ class MDL:
|
|||
return data[0]
|
||||
return data
|
||||
|
||||
def read_string(self, size):
|
||||
def read_bytes(self, size):
|
||||
return self.file.read(size)
|
||||
|
||||
def read_string(self, size):
|
||||
data = self.file.read(size)
|
||||
s = ""
|
||||
for c in data:
|
||||
s = s + chr(c)
|
||||
return s
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
def read(self, filepath):
|
||||
|
@ -153,7 +160,7 @@ class MDL:
|
|||
self.name = self.name.split('.')[0]
|
||||
self.ident = self.read_string(4)
|
||||
self.version = self.read_int()
|
||||
if self.ident not in [b"IDPO", b"MD16"] or self.version not in [3, 6]:
|
||||
if self.ident not in ["IDPO", "MD16"] or self.version not in [3, 6]:
|
||||
return None
|
||||
self.scale = Vector(self.read_float(3))
|
||||
self.scale_origin = Vector(self.read_float(3))
|
||||
|
|
Loading…
Reference in a new issue