Skip to content

Commit

Permalink
(respawn.titanfall2) use local PrimitiveType for Primitive.type
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Apr 26, 2024
1 parent ce8b18d commit 244dada
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions bsp_tool/branches/respawn/titanfall2.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,21 @@ def from_bytes(cls, raw_lump: bytes):
def as_bytes(self) -> bytes:
assert all([isinstance(p, self.StaticPropClass) for p in self.props])
assert all([len(u) == 64 for u in self.unknown_3])
return b"".join([len(self.model_names).to_bytes(4, "little"),
*[struct.pack("128s", n.encode("ascii")) for n in self.model_names],
len(self.props).to_bytes(4, self.endianness),
self.unknown_1.to_bytes(4, self.endianness),
self.unknown_2.to_bytes(4, self.endianness),
*[p.as_bytes() for p in self.props],
len(self.unknown_3).to_bytes(4, "little"),
*self.unknown_3])
return b"".join([
len(self.model_names).to_bytes(4, "little"),
*[struct.pack("128s", n.encode("ascii")) for n in self.model_names],
len(self.props).to_bytes(4, self.endianness),
self.unknown_1.to_bytes(4, self.endianness),
self.unknown_2.to_bytes(4, self.endianness),
*[p.as_bytes() for p in self.props],
len(self.unknown_3).to_bytes(4, "little"),
*self.unknown_3])


# {"LUMP_NAME": {version: LumpClass}}
BASIC_LUMP_CLASSES = titanfall.BASIC_LUMP_CLASSES.copy()
BASIC_LUMP_CLASSES.update({
"CM_PRIMITIVES": {0: Primitive}})

LUMP_CLASSES = titanfall.LUMP_CLASSES.copy()
LUMP_CLASSES.update({
Expand Down

0 comments on commit 244dada

Please sign in to comment.