Skip to content

Commit

Permalink
Add support for Blue Shift bsp format. Fixes #288
Browse files Browse the repository at this point in the history
  • Loading branch information
REDxEYE committed May 4, 2024
1 parent 4cdd1d6 commit 76ddb5b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions library/goldsrc/bsp/bsp_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,24 @@ def from_filename(cls, filepath: Path):
self = cls(filepath, buffer)
self.version = buffer.read_uint32()
self.lumps_info = []
for lump_id in LumpType:
lump_info = LumpInfo.from_buffer(buffer, lump_id)
self.lumps_info.append(lump_info)

lump0 = LumpInfo.from_buffer(buffer, LumpType.LUMP_ENTITIES)
lump1 = LumpInfo.from_buffer(buffer, LumpType.LUMP_PLANES)

if lump0.offset <= lump1.offset:
lump0.id = LumpType.LUMP_PLANES
lump1.id = LumpType.LUMP_ENTITIES
self.lumps_info.append(lump1)
self.lumps_info.append(lump0)
for lump_id in range(2, 15):
lump_info = LumpInfo.from_buffer(buffer, LumpType(lump_id))
self.lumps_info.append(lump_info)
else:
self.lumps_info.append(lump0)
self.lumps_info.append(lump1)
for lump_id in range(2, 15):
lump_info = LumpInfo.from_buffer(buffer, LumpType(lump_id))
self.lumps_info.append(lump_info)
assert self.version in (29, 30), 'Not a GoldSRC map file (BSP29, BSP30)'
return self

Expand Down

0 comments on commit 76ddb5b

Please sign in to comment.