Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified game/bin/x64/benchmark_cpu.ps1
100644 → 100755
Empty file.
36 changes: 19 additions & 17 deletions game/bin/x64/bsp_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,14 +657,13 @@ def read_face_side_ids(self) -> Optional[List[List[int]]]:
# Each index entry is 8 bytes: int32 firstId, int32 numIds
num_faces = len(idx_data) // 8
result: List[List[int]] = []
for i in range(num_faces):
first_id, num_ids = struct.unpack_from('<ii', idx_data, i * 8)
ids = []
for j in range(num_ids):
ofs = (first_id + j) * 4
if ofs + 4 <= len(sid_data):
ids.append(struct.unpack_from('<i', sid_data, ofs)[0])
result.append(ids)

# Parse all side IDs first using iter_unpack
sid_count = len(sid_data) // 4
all_sids = [v[0] for v in struct.iter_unpack('<i', sid_data[:sid_count * 4])]

for first_id, num_ids in struct.iter_unpack('<ii', idx_data[:num_faces * 8]):
result.append(all_sids[first_id : first_id + num_ids])
return result

def read_texinfos(self) -> List[BSPTexInfo]:
Expand Down Expand Up @@ -703,8 +702,7 @@ def read_material_names(self) -> List[str]:
"""Read material names via texdata → string table → string data chain."""
table_data = self._get_lump_data(LUMP_TEXDATA_STRING_TABLE)
table_count = len(table_data) // 4
offsets = [struct.unpack_from('<i', table_data, i * 4)[0]
for i in range(table_count)]
offsets = [v[0] for v in struct.iter_unpack('<i', table_data[:table_count * 4])]

string_data = self._get_lump_data(LUMP_TEXDATA_STRING_DATA)

Expand Down Expand Up @@ -756,13 +754,17 @@ def read_visibility(self) -> Optional[Tuple[int, List[Tuple[int, int]], bytes]]:
num_clusters = struct.unpack_from('<i', data, 0)[0]
if num_clusters <= 0:
return None
offsets = []
for i in range(num_clusters):
ofs = 4 + i * 8
if ofs + 8 > len(data):
break
pvs_ofs, pas_ofs = struct.unpack_from('<2i', data, ofs)
offsets.append((pvs_ofs, pas_ofs))

# Truncate to available cluster definitions in case of bad header
cluster_bytes = num_clusters * 8
if 4 + cluster_bytes > len(data):
cluster_bytes = ((len(data) - 4) // 8) * 8
num_clusters = cluster_bytes // 8

offsets = [
(pvs_ofs, pas_ofs)
for pvs_ofs, pas_ofs in struct.iter_unpack('<2i', data[4:4 + cluster_bytes])
]
return (num_clusters, offsets, data)

def get_face_vertices(self, face: BSPFace,
Expand Down
Empty file modified game/bin/x64/run_vrad_tests.ps1
100644 → 100755
Empty file.
Empty file modified game/bin/x64/run_vvis_tests.ps1
100644 → 100755
Empty file.
Empty file modified game/bin/x64/test_world_shadows.ps1
100644 → 100755
Empty file.
Empty file modified game/bin/x64/vrad_test_harness.ps1
100644 → 100755
Empty file.
Empty file modified game/bin/x64/vvis_test_harness.ps1
100644 → 100755
Empty file.
68 changes: 0 additions & 68 deletions test_unpack_perf.py

This file was deleted.