quake2ts 0.0.591 → 0.0.592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,6 +78,7 @@ __export(index_exports, {
78
78
  Md3ParseError: () => Md3ParseError,
79
79
  Md3Pipeline: () => Md3Pipeline,
80
80
  Md3SurfaceMesh: () => Md3SurfaceMesh,
81
+ MessageWriter: () => MessageWriter,
81
82
  MusicSystem: () => MusicSystem,
82
83
  NetworkMessageParser: () => NetworkMessageParser,
83
84
  PARTICLE_FRAGMENT_SHADER: () => PARTICLE_FRAGMENT_SHADER,
@@ -2407,6 +2408,7 @@ var VirtualFileSystem = class {
2407
2408
  sources.unshift(source);
2408
2409
  sources.sort((a, b) => b.priority - a.priority);
2409
2410
  }
2411
+ return archive;
2410
2412
  }
2411
2413
  setPriority(archive, priority) {
2412
2414
  this.mountPak(archive, priority);
@@ -2508,6 +2510,12 @@ var VirtualFileSystem = class {
2508
2510
  return listing.files;
2509
2511
  }
2510
2512
  findByExtension(extension) {
2513
+ if (extension instanceof RegExp) {
2514
+ return this.searchFiles(extension);
2515
+ }
2516
+ if (Array.isArray(extension)) {
2517
+ return this.listByExtension(extension);
2518
+ }
2511
2519
  const normalizedExt = extension.startsWith(".") ? extension.toLowerCase() : `.${extension.toLowerCase()}`;
2512
2520
  const results = [];
2513
2521
  for (const [path, sources] of this.files) {
@@ -16724,39 +16732,6 @@ var DemoRecorder = class {
16724
16732
  }
16725
16733
  };
16726
16734
 
16727
- // src/demo/validator.ts
16728
- var DemoValidator = class {
16729
- /**
16730
- * Validates a Quake 2 demo file buffer.
16731
- * Checks for minimum size, first block length, and initial serverdata command.
16732
- */
16733
- static validate(buffer, filename) {
16734
- if (filename && !filename.toLowerCase().endsWith(".dm2")) {
16735
- return { valid: false, error: "Invalid file extension (expected .dm2)" };
16736
- }
16737
- if (buffer.byteLength < 5) {
16738
- return { valid: false, error: "File too small to be a valid demo" };
16739
- }
16740
- const view = new DataView(buffer);
16741
- const length2 = view.getInt32(0, true);
16742
- if (length2 <= 0 || length2 > buffer.byteLength - 4) {
16743
- return { valid: false, error: `Invalid first block length: ${length2}` };
16744
- }
16745
- const firstCmd = view.getUint8(4);
16746
- if (firstCmd !== ServerCommand.serverdata) {
16747
- return {
16748
- valid: false,
16749
- error: `First command is not svc_serverdata (expected ${ServerCommand.serverdata}, got ${firstCmd})`
16750
- };
16751
- }
16752
- let version = -1;
16753
- if (length2 >= 5) {
16754
- version = view.getInt32(5, true);
16755
- }
16756
- return { valid: true, version };
16757
- }
16758
- };
16759
-
16760
16735
  // src/demo/writer.ts
16761
16736
  var PROTO34_REVERSE_MAP = {
16762
16737
  [ServerCommand.bad]: 0,
@@ -17229,6 +17204,39 @@ var MessageWriter = class {
17229
17204
  }
17230
17205
  };
17231
17206
 
17207
+ // src/demo/validator.ts
17208
+ var DemoValidator = class {
17209
+ /**
17210
+ * Validates a Quake 2 demo file buffer.
17211
+ * Checks for minimum size, first block length, and initial serverdata command.
17212
+ */
17213
+ static validate(buffer, filename) {
17214
+ if (filename && !filename.toLowerCase().endsWith(".dm2")) {
17215
+ return { valid: false, error: "Invalid file extension (expected .dm2)" };
17216
+ }
17217
+ if (buffer.byteLength < 5) {
17218
+ return { valid: false, error: "File too small to be a valid demo" };
17219
+ }
17220
+ const view = new DataView(buffer);
17221
+ const length2 = view.getInt32(0, true);
17222
+ if (length2 <= 0 || length2 > buffer.byteLength - 4) {
17223
+ return { valid: false, error: `Invalid first block length: ${length2}` };
17224
+ }
17225
+ const firstCmd = view.getUint8(4);
17226
+ if (firstCmd !== ServerCommand.serverdata) {
17227
+ return {
17228
+ valid: false,
17229
+ error: `First command is not svc_serverdata (expected ${ServerCommand.serverdata}, got ${firstCmd})`
17230
+ };
17231
+ }
17232
+ let version = -1;
17233
+ if (length2 >= 5) {
17234
+ version = view.getInt32(5, true);
17235
+ }
17236
+ return { valid: true, version };
17237
+ }
17238
+ };
17239
+
17232
17240
  // src/demo/demoWriter.ts
17233
17241
  var DemoWriter = class {
17234
17242
  constructor() {
@@ -18186,6 +18194,7 @@ function createEngine(imports) {
18186
18194
  Md3ParseError,
18187
18195
  Md3Pipeline,
18188
18196
  Md3SurfaceMesh,
18197
+ MessageWriter,
18189
18198
  MusicSystem,
18190
18199
  NetworkMessageParser,
18191
18200
  PARTICLE_FRAGMENT_SHADER,