quake2ts 0.0.511 → 0.0.513
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.
- package/package.json +1 -1
- package/packages/client/dist/browser/index.global.js +17 -17
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +168 -38
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +168 -38
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/demo/handler.d.ts +0 -1
- package/packages/client/dist/types/demo/handler.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +17 -17
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +461 -9
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +456 -9
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/assets/manager.d.ts +3 -0
- package/packages/engine/dist/types/assets/manager.d.ts.map +1 -1
- package/packages/engine/dist/types/assets/pakWriter.d.ts +8 -0
- package/packages/engine/dist/types/assets/pakWriter.d.ts.map +1 -0
- package/packages/engine/dist/types/assets/resourceTracker.d.ts +33 -0
- package/packages/engine/dist/types/assets/resourceTracker.d.ts.map +1 -0
- package/packages/engine/dist/types/demo/clipper.d.ts +22 -0
- package/packages/engine/dist/types/demo/clipper.d.ts.map +1 -0
- package/packages/engine/dist/types/demo/delta.d.ts +3 -0
- package/packages/engine/dist/types/demo/delta.d.ts.map +1 -0
- package/packages/engine/dist/types/demo/playback.d.ts +40 -0
- package/packages/engine/dist/types/demo/playback.d.ts.map +1 -1
- package/packages/engine/dist/types/index.d.ts +4 -0
- package/packages/engine/dist/types/index.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -3186,8 +3186,8 @@ var RERELEASE_KNOWN_PAKS = Object.freeze([
|
|
|
3186
3186
|
{ name: "pak0.pak@xatrix", checksum: 1358269824, description: "The Reckoning (xatrix) mission pack" }
|
|
3187
3187
|
]);
|
|
3188
3188
|
var HEADER_LUMPS = 19;
|
|
3189
|
-
var
|
|
3190
|
-
var
|
|
3189
|
+
var HEADER_SIZE3 = 4 + 4 + HEADER_LUMPS * 8;
|
|
3190
|
+
var HEADER_SIZE4 = 17 * 4;
|
|
3191
3191
|
var FLOAT_BYTES = 4;
|
|
3192
3192
|
var STRIDE = 7 * FLOAT_BYTES;
|
|
3193
3193
|
var BSP_VERTEX_LAYOUT = [
|
|
@@ -9564,6 +9564,7 @@ var DemoPlaybackController = class {
|
|
|
9564
9564
|
this.cachedStatistics = null;
|
|
9565
9565
|
this.cachedPlayerStats = null;
|
|
9566
9566
|
this.cachedWeaponStats = null;
|
|
9567
|
+
this.tracker = null;
|
|
9567
9568
|
this.cameraMode = 0;
|
|
9568
9569
|
this.thirdPersonDistance = 80;
|
|
9569
9570
|
this.thirdPersonOffset = { x: 0, y: 0, z: 0 };
|
|
@@ -9688,6 +9689,41 @@ var DemoPlaybackController = class {
|
|
|
9688
9689
|
seekToFrame(frameIndex) {
|
|
9689
9690
|
this.seek(frameIndex);
|
|
9690
9691
|
}
|
|
9692
|
+
frameToTime(frame) {
|
|
9693
|
+
return frame * this.frameDuration / 1e3;
|
|
9694
|
+
}
|
|
9695
|
+
timeToFrame(seconds) {
|
|
9696
|
+
return Math.floor(seconds * 1e3 / this.frameDuration);
|
|
9697
|
+
}
|
|
9698
|
+
playFrom(offset) {
|
|
9699
|
+
if (offset.type === "frame") {
|
|
9700
|
+
this.seek(offset.frame);
|
|
9701
|
+
} else {
|
|
9702
|
+
this.seekToTime(offset.seconds);
|
|
9703
|
+
}
|
|
9704
|
+
this.play();
|
|
9705
|
+
}
|
|
9706
|
+
playRange(start, end) {
|
|
9707
|
+
this.playFrom(start);
|
|
9708
|
+
const endFrame = end.type === "frame" ? end.frame : this.timeToFrame(end.seconds);
|
|
9709
|
+
const originalOnFrameUpdate = this.callbacks?.onFrameUpdate;
|
|
9710
|
+
const rangeCallback = {
|
|
9711
|
+
...this.callbacks,
|
|
9712
|
+
onFrameUpdate: (frame) => {
|
|
9713
|
+
if (originalOnFrameUpdate) originalOnFrameUpdate(frame);
|
|
9714
|
+
if (this.currentFrameIndex >= endFrame) {
|
|
9715
|
+
this.pause();
|
|
9716
|
+
if (this.callbacks === rangeCallback) {
|
|
9717
|
+
this.setCallbacks({ ...this.callbacks, onFrameUpdate: originalOnFrameUpdate });
|
|
9718
|
+
}
|
|
9719
|
+
if (this.callbacks?.onPlaybackComplete) {
|
|
9720
|
+
this.callbacks.onPlaybackComplete();
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
}
|
|
9724
|
+
};
|
|
9725
|
+
this.setCallbacks(rangeCallback);
|
|
9726
|
+
}
|
|
9691
9727
|
/**
|
|
9692
9728
|
* Seeks to a specific frame number.
|
|
9693
9729
|
*/
|
|
@@ -9771,6 +9807,10 @@ var DemoPlaybackController = class {
|
|
|
9771
9807
|
return false;
|
|
9772
9808
|
}
|
|
9773
9809
|
this.currentFrameIndex++;
|
|
9810
|
+
if (this.tracker) {
|
|
9811
|
+
this.tracker.setCurrentFrame(this.currentFrameIndex);
|
|
9812
|
+
this.tracker.setCurrentTime(this.getCurrentTime());
|
|
9813
|
+
}
|
|
9774
9814
|
try {
|
|
9775
9815
|
const proxyHandler = {
|
|
9776
9816
|
...this.handler,
|
|
@@ -10005,6 +10045,96 @@ var DemoPlaybackController = class {
|
|
|
10005
10045
|
setThirdPersonOffset(offset) {
|
|
10006
10046
|
this.thirdPersonOffset = offset;
|
|
10007
10047
|
}
|
|
10048
|
+
async playWithTracking(tracker, options = {}) {
|
|
10049
|
+
this.tracker = tracker;
|
|
10050
|
+
tracker.startTracking();
|
|
10051
|
+
if (options.fastForward) {
|
|
10052
|
+
try {
|
|
10053
|
+
if (this.state === 0 && this.reader) {
|
|
10054
|
+
}
|
|
10055
|
+
this.transitionState(
|
|
10056
|
+
1
|
|
10057
|
+
/* Playing */
|
|
10058
|
+
);
|
|
10059
|
+
const CHUNK_SIZE = 100;
|
|
10060
|
+
const processChunk = async () => {
|
|
10061
|
+
if (this.state !== 1) {
|
|
10062
|
+
throw new Error("Playback stopped unexpectedly during fast forward");
|
|
10063
|
+
}
|
|
10064
|
+
let count = 0;
|
|
10065
|
+
while (count < CHUNK_SIZE) {
|
|
10066
|
+
if (!this.processNextFrame()) {
|
|
10067
|
+
const log = tracker.stopTracking();
|
|
10068
|
+
this.tracker = null;
|
|
10069
|
+
if (this.callbacks?.onPlaybackComplete) this.callbacks.onPlaybackComplete();
|
|
10070
|
+
return log;
|
|
10071
|
+
}
|
|
10072
|
+
count++;
|
|
10073
|
+
}
|
|
10074
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
10075
|
+
return processChunk();
|
|
10076
|
+
};
|
|
10077
|
+
return await processChunk();
|
|
10078
|
+
} catch (e) {
|
|
10079
|
+
tracker.stopTracking();
|
|
10080
|
+
this.tracker = null;
|
|
10081
|
+
throw e;
|
|
10082
|
+
}
|
|
10083
|
+
} else {
|
|
10084
|
+
return new Promise((resolve, reject) => {
|
|
10085
|
+
const originalComplete = this.callbacks?.onPlaybackComplete;
|
|
10086
|
+
const originalError = this.callbacks?.onPlaybackError;
|
|
10087
|
+
const cleanup = () => {
|
|
10088
|
+
this.setCallbacks({ ...this.callbacks, onPlaybackComplete: originalComplete, onPlaybackError: originalError });
|
|
10089
|
+
this.tracker = null;
|
|
10090
|
+
};
|
|
10091
|
+
this.setCallbacks({
|
|
10092
|
+
...this.callbacks,
|
|
10093
|
+
onPlaybackComplete: () => {
|
|
10094
|
+
const log = tracker.stopTracking();
|
|
10095
|
+
if (originalComplete) originalComplete();
|
|
10096
|
+
cleanup();
|
|
10097
|
+
resolve(log);
|
|
10098
|
+
},
|
|
10099
|
+
onPlaybackError: (err2) => {
|
|
10100
|
+
tracker.stopTracking();
|
|
10101
|
+
if (originalError) originalError(err2);
|
|
10102
|
+
cleanup();
|
|
10103
|
+
reject(err2);
|
|
10104
|
+
}
|
|
10105
|
+
});
|
|
10106
|
+
this.play();
|
|
10107
|
+
});
|
|
10108
|
+
}
|
|
10109
|
+
}
|
|
10110
|
+
async playRangeWithTracking(start, end, tracker) {
|
|
10111
|
+
this.tracker = tracker;
|
|
10112
|
+
tracker.startTracking();
|
|
10113
|
+
return new Promise((resolve, reject) => {
|
|
10114
|
+
const originalComplete = this.callbacks?.onPlaybackComplete;
|
|
10115
|
+
const originalError = this.callbacks?.onPlaybackError;
|
|
10116
|
+
const cleanup = () => {
|
|
10117
|
+
this.setCallbacks({ ...this.callbacks, onPlaybackComplete: originalComplete, onPlaybackError: originalError });
|
|
10118
|
+
this.tracker = null;
|
|
10119
|
+
};
|
|
10120
|
+
this.setCallbacks({
|
|
10121
|
+
...this.callbacks,
|
|
10122
|
+
onPlaybackComplete: () => {
|
|
10123
|
+
const log = tracker.stopTracking();
|
|
10124
|
+
if (originalComplete) originalComplete();
|
|
10125
|
+
cleanup();
|
|
10126
|
+
resolve(log);
|
|
10127
|
+
},
|
|
10128
|
+
onPlaybackError: (err2) => {
|
|
10129
|
+
tracker.stopTracking();
|
|
10130
|
+
if (originalError) originalError(err2);
|
|
10131
|
+
cleanup();
|
|
10132
|
+
reject(err2);
|
|
10133
|
+
}
|
|
10134
|
+
});
|
|
10135
|
+
this.playRange(start, end);
|
|
10136
|
+
});
|
|
10137
|
+
}
|
|
10008
10138
|
};
|
|
10009
10139
|
var DemoRecorder = class {
|
|
10010
10140
|
// -1 means start of demo
|
|
@@ -10075,6 +10205,41 @@ var DemoValidator = class {
|
|
|
10075
10205
|
return { valid: true, version };
|
|
10076
10206
|
}
|
|
10077
10207
|
};
|
|
10208
|
+
function applyEntityDelta(to, from) {
|
|
10209
|
+
const bits = from.bits;
|
|
10210
|
+
const bitsHigh = from.bitsHigh;
|
|
10211
|
+
to.number = from.number;
|
|
10212
|
+
if (bits & U_MODEL5) to.modelindex = from.modelindex;
|
|
10213
|
+
if (bits & U_MODEL22) to.modelindex2 = from.modelindex2;
|
|
10214
|
+
if (bits & U_MODEL32) to.modelindex3 = from.modelindex3;
|
|
10215
|
+
if (bits & U_MODEL42) to.modelindex4 = from.modelindex4;
|
|
10216
|
+
if (bits & U_FRAME8) to.frame = from.frame;
|
|
10217
|
+
if (bits & U_FRAME16) to.frame = from.frame;
|
|
10218
|
+
if (bits & U_SKIN8 || bits & U_SKIN16) to.skinnum = from.skinnum;
|
|
10219
|
+
if (bits & U_EFFECTS8 || bits & U_EFFECTS16) to.effects = from.effects;
|
|
10220
|
+
if (bits & U_RENDERFX8 || bits & U_RENDERFX16) to.renderfx = from.renderfx;
|
|
10221
|
+
if (bits & U_ORIGIN12) to.origin.x = from.origin.x;
|
|
10222
|
+
if (bits & U_ORIGIN22) to.origin.y = from.origin.y;
|
|
10223
|
+
if (bits & U_ORIGIN32) to.origin.z = from.origin.z;
|
|
10224
|
+
if (bits & U_ANGLE12) to.angles.x = from.angles.x;
|
|
10225
|
+
if (bits & U_ANGLE22) to.angles.y = from.angles.y;
|
|
10226
|
+
if (bits & U_ANGLE32) to.angles.z = from.angles.z;
|
|
10227
|
+
if (bits & U_OLDORIGIN) {
|
|
10228
|
+
to.old_origin.x = from.old_origin.x;
|
|
10229
|
+
to.old_origin.y = from.old_origin.y;
|
|
10230
|
+
to.old_origin.z = from.old_origin.z;
|
|
10231
|
+
}
|
|
10232
|
+
if (bits & U_SOUND2) to.sound = from.sound;
|
|
10233
|
+
if (bits & U_EVENT2) to.event = from.event;
|
|
10234
|
+
if (bits & U_SOLID2) to.solid = from.solid;
|
|
10235
|
+
if (bits & U_ALPHA) to.alpha = from.alpha;
|
|
10236
|
+
if (bits & U_SCALE) to.scale = from.scale;
|
|
10237
|
+
if (bits & U_INSTANCE_BITS) to.instanceBits = from.instanceBits;
|
|
10238
|
+
if (bits & U_LOOP_VOLUME) to.loopVolume = from.loopVolume;
|
|
10239
|
+
if (bitsHigh & U_LOOP_ATTENUATION_HIGH) to.loopAttenuation = from.loopAttenuation;
|
|
10240
|
+
if (bitsHigh & U_OWNER_HIGH) to.owner = from.owner;
|
|
10241
|
+
if (bitsHigh & U_OLD_FRAME_HIGH) to.oldFrame = from.oldFrame;
|
|
10242
|
+
}
|
|
10078
10243
|
|
|
10079
10244
|
// ../shared/dist/esm/index.js
|
|
10080
10245
|
var __defProp3 = Object.defineProperty;
|
|
@@ -12307,46 +12472,11 @@ var ClientNetworkHandler = class {
|
|
|
12307
12472
|
source = createEmptyEntityState();
|
|
12308
12473
|
}
|
|
12309
12474
|
const final = structuredClone(source);
|
|
12310
|
-
|
|
12475
|
+
applyEntityDelta(final, partial);
|
|
12311
12476
|
newEntities.set(number, final);
|
|
12312
12477
|
}
|
|
12313
12478
|
this.entities = newEntities;
|
|
12314
12479
|
}
|
|
12315
|
-
applyDelta(to, from) {
|
|
12316
|
-
const bits = from.bits;
|
|
12317
|
-
const bitsHigh = from.bitsHigh;
|
|
12318
|
-
to.number = from.number;
|
|
12319
|
-
if (bits & U_MODEL5) to.modelindex = from.modelindex;
|
|
12320
|
-
if (bits & U_MODEL22) to.modelindex2 = from.modelindex2;
|
|
12321
|
-
if (bits & U_MODEL32) to.modelindex3 = from.modelindex3;
|
|
12322
|
-
if (bits & U_MODEL42) to.modelindex4 = from.modelindex4;
|
|
12323
|
-
if (bits & U_FRAME8) to.frame = from.frame;
|
|
12324
|
-
if (bits & U_FRAME16) to.frame = from.frame;
|
|
12325
|
-
if (bits & U_SKIN8 || bits & U_SKIN16) to.skinnum = from.skinnum;
|
|
12326
|
-
if (bits & U_EFFECTS8 || bits & U_EFFECTS16) to.effects = from.effects;
|
|
12327
|
-
if (bits & U_RENDERFX8 || bits & U_RENDERFX16) to.renderfx = from.renderfx;
|
|
12328
|
-
if (bits & U_ORIGIN12) to.origin.x = from.origin.x;
|
|
12329
|
-
if (bits & U_ORIGIN22) to.origin.y = from.origin.y;
|
|
12330
|
-
if (bits & U_ORIGIN32) to.origin.z = from.origin.z;
|
|
12331
|
-
if (bits & U_ANGLE12) to.angles.x = from.angles.x;
|
|
12332
|
-
if (bits & U_ANGLE22) to.angles.y = from.angles.y;
|
|
12333
|
-
if (bits & U_ANGLE32) to.angles.z = from.angles.z;
|
|
12334
|
-
if (bits & U_OLDORIGIN) {
|
|
12335
|
-
to.old_origin.x = from.old_origin.x;
|
|
12336
|
-
to.old_origin.y = from.old_origin.y;
|
|
12337
|
-
to.old_origin.z = from.old_origin.z;
|
|
12338
|
-
}
|
|
12339
|
-
if (bits & U_SOUND2) to.sound = from.sound;
|
|
12340
|
-
if (bits & U_EVENT2) to.event = from.event;
|
|
12341
|
-
if (bits & U_SOLID2) to.solid = from.solid;
|
|
12342
|
-
if (bits & U_ALPHA) to.alpha = from.alpha;
|
|
12343
|
-
if (bits & U_SCALE) to.scale = from.scale;
|
|
12344
|
-
if (bits & U_INSTANCE_BITS) to.instanceBits = from.instanceBits;
|
|
12345
|
-
if (bits & U_LOOP_VOLUME) to.loopVolume = from.loopVolume;
|
|
12346
|
-
if (bitsHigh & U_LOOP_ATTENUATION_HIGH) to.loopAttenuation = from.loopAttenuation;
|
|
12347
|
-
if (bitsHigh & U_OWNER_HIGH) to.owner = from.owner;
|
|
12348
|
-
if (bitsHigh & U_OLD_FRAME_HIGH) to.oldFrame = from.oldFrame;
|
|
12349
|
-
}
|
|
12350
12480
|
onCenterPrint(msg) {
|
|
12351
12481
|
if (this.callbacks?.onCenterPrint) {
|
|
12352
12482
|
this.callbacks.onCenterPrint(msg);
|