quake2ts 0.0.512 → 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
|
@@ -3149,8 +3149,8 @@ var RERELEASE_KNOWN_PAKS = Object.freeze([
|
|
|
3149
3149
|
{ name: "pak0.pak@xatrix", checksum: 1358269824, description: "The Reckoning (xatrix) mission pack" }
|
|
3150
3150
|
]);
|
|
3151
3151
|
var HEADER_LUMPS = 19;
|
|
3152
|
-
var
|
|
3153
|
-
var
|
|
3152
|
+
var HEADER_SIZE3 = 4 + 4 + HEADER_LUMPS * 8;
|
|
3153
|
+
var HEADER_SIZE4 = 17 * 4;
|
|
3154
3154
|
var FLOAT_BYTES = 4;
|
|
3155
3155
|
var STRIDE = 7 * FLOAT_BYTES;
|
|
3156
3156
|
var BSP_VERTEX_LAYOUT = [
|
|
@@ -9527,6 +9527,7 @@ var DemoPlaybackController = class {
|
|
|
9527
9527
|
this.cachedStatistics = null;
|
|
9528
9528
|
this.cachedPlayerStats = null;
|
|
9529
9529
|
this.cachedWeaponStats = null;
|
|
9530
|
+
this.tracker = null;
|
|
9530
9531
|
this.cameraMode = 0;
|
|
9531
9532
|
this.thirdPersonDistance = 80;
|
|
9532
9533
|
this.thirdPersonOffset = { x: 0, y: 0, z: 0 };
|
|
@@ -9651,6 +9652,41 @@ var DemoPlaybackController = class {
|
|
|
9651
9652
|
seekToFrame(frameIndex) {
|
|
9652
9653
|
this.seek(frameIndex);
|
|
9653
9654
|
}
|
|
9655
|
+
frameToTime(frame) {
|
|
9656
|
+
return frame * this.frameDuration / 1e3;
|
|
9657
|
+
}
|
|
9658
|
+
timeToFrame(seconds) {
|
|
9659
|
+
return Math.floor(seconds * 1e3 / this.frameDuration);
|
|
9660
|
+
}
|
|
9661
|
+
playFrom(offset) {
|
|
9662
|
+
if (offset.type === "frame") {
|
|
9663
|
+
this.seek(offset.frame);
|
|
9664
|
+
} else {
|
|
9665
|
+
this.seekToTime(offset.seconds);
|
|
9666
|
+
}
|
|
9667
|
+
this.play();
|
|
9668
|
+
}
|
|
9669
|
+
playRange(start, end) {
|
|
9670
|
+
this.playFrom(start);
|
|
9671
|
+
const endFrame = end.type === "frame" ? end.frame : this.timeToFrame(end.seconds);
|
|
9672
|
+
const originalOnFrameUpdate = this.callbacks?.onFrameUpdate;
|
|
9673
|
+
const rangeCallback = {
|
|
9674
|
+
...this.callbacks,
|
|
9675
|
+
onFrameUpdate: (frame) => {
|
|
9676
|
+
if (originalOnFrameUpdate) originalOnFrameUpdate(frame);
|
|
9677
|
+
if (this.currentFrameIndex >= endFrame) {
|
|
9678
|
+
this.pause();
|
|
9679
|
+
if (this.callbacks === rangeCallback) {
|
|
9680
|
+
this.setCallbacks({ ...this.callbacks, onFrameUpdate: originalOnFrameUpdate });
|
|
9681
|
+
}
|
|
9682
|
+
if (this.callbacks?.onPlaybackComplete) {
|
|
9683
|
+
this.callbacks.onPlaybackComplete();
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
}
|
|
9687
|
+
};
|
|
9688
|
+
this.setCallbacks(rangeCallback);
|
|
9689
|
+
}
|
|
9654
9690
|
/**
|
|
9655
9691
|
* Seeks to a specific frame number.
|
|
9656
9692
|
*/
|
|
@@ -9734,6 +9770,10 @@ var DemoPlaybackController = class {
|
|
|
9734
9770
|
return false;
|
|
9735
9771
|
}
|
|
9736
9772
|
this.currentFrameIndex++;
|
|
9773
|
+
if (this.tracker) {
|
|
9774
|
+
this.tracker.setCurrentFrame(this.currentFrameIndex);
|
|
9775
|
+
this.tracker.setCurrentTime(this.getCurrentTime());
|
|
9776
|
+
}
|
|
9737
9777
|
try {
|
|
9738
9778
|
const proxyHandler = {
|
|
9739
9779
|
...this.handler,
|
|
@@ -9968,6 +10008,96 @@ var DemoPlaybackController = class {
|
|
|
9968
10008
|
setThirdPersonOffset(offset) {
|
|
9969
10009
|
this.thirdPersonOffset = offset;
|
|
9970
10010
|
}
|
|
10011
|
+
async playWithTracking(tracker, options = {}) {
|
|
10012
|
+
this.tracker = tracker;
|
|
10013
|
+
tracker.startTracking();
|
|
10014
|
+
if (options.fastForward) {
|
|
10015
|
+
try {
|
|
10016
|
+
if (this.state === 0 && this.reader) {
|
|
10017
|
+
}
|
|
10018
|
+
this.transitionState(
|
|
10019
|
+
1
|
|
10020
|
+
/* Playing */
|
|
10021
|
+
);
|
|
10022
|
+
const CHUNK_SIZE = 100;
|
|
10023
|
+
const processChunk = async () => {
|
|
10024
|
+
if (this.state !== 1) {
|
|
10025
|
+
throw new Error("Playback stopped unexpectedly during fast forward");
|
|
10026
|
+
}
|
|
10027
|
+
let count = 0;
|
|
10028
|
+
while (count < CHUNK_SIZE) {
|
|
10029
|
+
if (!this.processNextFrame()) {
|
|
10030
|
+
const log = tracker.stopTracking();
|
|
10031
|
+
this.tracker = null;
|
|
10032
|
+
if (this.callbacks?.onPlaybackComplete) this.callbacks.onPlaybackComplete();
|
|
10033
|
+
return log;
|
|
10034
|
+
}
|
|
10035
|
+
count++;
|
|
10036
|
+
}
|
|
10037
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
10038
|
+
return processChunk();
|
|
10039
|
+
};
|
|
10040
|
+
return await processChunk();
|
|
10041
|
+
} catch (e) {
|
|
10042
|
+
tracker.stopTracking();
|
|
10043
|
+
this.tracker = null;
|
|
10044
|
+
throw e;
|
|
10045
|
+
}
|
|
10046
|
+
} else {
|
|
10047
|
+
return new Promise((resolve, reject) => {
|
|
10048
|
+
const originalComplete = this.callbacks?.onPlaybackComplete;
|
|
10049
|
+
const originalError = this.callbacks?.onPlaybackError;
|
|
10050
|
+
const cleanup = () => {
|
|
10051
|
+
this.setCallbacks({ ...this.callbacks, onPlaybackComplete: originalComplete, onPlaybackError: originalError });
|
|
10052
|
+
this.tracker = null;
|
|
10053
|
+
};
|
|
10054
|
+
this.setCallbacks({
|
|
10055
|
+
...this.callbacks,
|
|
10056
|
+
onPlaybackComplete: () => {
|
|
10057
|
+
const log = tracker.stopTracking();
|
|
10058
|
+
if (originalComplete) originalComplete();
|
|
10059
|
+
cleanup();
|
|
10060
|
+
resolve(log);
|
|
10061
|
+
},
|
|
10062
|
+
onPlaybackError: (err2) => {
|
|
10063
|
+
tracker.stopTracking();
|
|
10064
|
+
if (originalError) originalError(err2);
|
|
10065
|
+
cleanup();
|
|
10066
|
+
reject(err2);
|
|
10067
|
+
}
|
|
10068
|
+
});
|
|
10069
|
+
this.play();
|
|
10070
|
+
});
|
|
10071
|
+
}
|
|
10072
|
+
}
|
|
10073
|
+
async playRangeWithTracking(start, end, tracker) {
|
|
10074
|
+
this.tracker = tracker;
|
|
10075
|
+
tracker.startTracking();
|
|
10076
|
+
return new Promise((resolve, reject) => {
|
|
10077
|
+
const originalComplete = this.callbacks?.onPlaybackComplete;
|
|
10078
|
+
const originalError = this.callbacks?.onPlaybackError;
|
|
10079
|
+
const cleanup = () => {
|
|
10080
|
+
this.setCallbacks({ ...this.callbacks, onPlaybackComplete: originalComplete, onPlaybackError: originalError });
|
|
10081
|
+
this.tracker = null;
|
|
10082
|
+
};
|
|
10083
|
+
this.setCallbacks({
|
|
10084
|
+
...this.callbacks,
|
|
10085
|
+
onPlaybackComplete: () => {
|
|
10086
|
+
const log = tracker.stopTracking();
|
|
10087
|
+
if (originalComplete) originalComplete();
|
|
10088
|
+
cleanup();
|
|
10089
|
+
resolve(log);
|
|
10090
|
+
},
|
|
10091
|
+
onPlaybackError: (err2) => {
|
|
10092
|
+
tracker.stopTracking();
|
|
10093
|
+
if (originalError) originalError(err2);
|
|
10094
|
+
cleanup();
|
|
10095
|
+
reject(err2);
|
|
10096
|
+
}
|
|
10097
|
+
});
|
|
10098
|
+
this.playRange(start, end);
|
|
10099
|
+
});
|
|
10100
|
+
}
|
|
9971
10101
|
};
|
|
9972
10102
|
var DemoRecorder = class {
|
|
9973
10103
|
// -1 means start of demo
|
|
@@ -10038,6 +10168,41 @@ var DemoValidator = class {
|
|
|
10038
10168
|
return { valid: true, version };
|
|
10039
10169
|
}
|
|
10040
10170
|
};
|
|
10171
|
+
function applyEntityDelta(to, from) {
|
|
10172
|
+
const bits = from.bits;
|
|
10173
|
+
const bitsHigh = from.bitsHigh;
|
|
10174
|
+
to.number = from.number;
|
|
10175
|
+
if (bits & U_MODEL5) to.modelindex = from.modelindex;
|
|
10176
|
+
if (bits & U_MODEL22) to.modelindex2 = from.modelindex2;
|
|
10177
|
+
if (bits & U_MODEL32) to.modelindex3 = from.modelindex3;
|
|
10178
|
+
if (bits & U_MODEL42) to.modelindex4 = from.modelindex4;
|
|
10179
|
+
if (bits & U_FRAME8) to.frame = from.frame;
|
|
10180
|
+
if (bits & U_FRAME16) to.frame = from.frame;
|
|
10181
|
+
if (bits & U_SKIN8 || bits & U_SKIN16) to.skinnum = from.skinnum;
|
|
10182
|
+
if (bits & U_EFFECTS8 || bits & U_EFFECTS16) to.effects = from.effects;
|
|
10183
|
+
if (bits & U_RENDERFX8 || bits & U_RENDERFX16) to.renderfx = from.renderfx;
|
|
10184
|
+
if (bits & U_ORIGIN12) to.origin.x = from.origin.x;
|
|
10185
|
+
if (bits & U_ORIGIN22) to.origin.y = from.origin.y;
|
|
10186
|
+
if (bits & U_ORIGIN32) to.origin.z = from.origin.z;
|
|
10187
|
+
if (bits & U_ANGLE12) to.angles.x = from.angles.x;
|
|
10188
|
+
if (bits & U_ANGLE22) to.angles.y = from.angles.y;
|
|
10189
|
+
if (bits & U_ANGLE32) to.angles.z = from.angles.z;
|
|
10190
|
+
if (bits & U_OLDORIGIN) {
|
|
10191
|
+
to.old_origin.x = from.old_origin.x;
|
|
10192
|
+
to.old_origin.y = from.old_origin.y;
|
|
10193
|
+
to.old_origin.z = from.old_origin.z;
|
|
10194
|
+
}
|
|
10195
|
+
if (bits & U_SOUND2) to.sound = from.sound;
|
|
10196
|
+
if (bits & U_EVENT2) to.event = from.event;
|
|
10197
|
+
if (bits & U_SOLID2) to.solid = from.solid;
|
|
10198
|
+
if (bits & U_ALPHA) to.alpha = from.alpha;
|
|
10199
|
+
if (bits & U_SCALE) to.scale = from.scale;
|
|
10200
|
+
if (bits & U_INSTANCE_BITS) to.instanceBits = from.instanceBits;
|
|
10201
|
+
if (bits & U_LOOP_VOLUME) to.loopVolume = from.loopVolume;
|
|
10202
|
+
if (bitsHigh & U_LOOP_ATTENUATION_HIGH) to.loopAttenuation = from.loopAttenuation;
|
|
10203
|
+
if (bitsHigh & U_OWNER_HIGH) to.owner = from.owner;
|
|
10204
|
+
if (bitsHigh & U_OLD_FRAME_HIGH) to.oldFrame = from.oldFrame;
|
|
10205
|
+
}
|
|
10041
10206
|
|
|
10042
10207
|
// ../shared/dist/esm/index.js
|
|
10043
10208
|
var __defProp3 = Object.defineProperty;
|
|
@@ -12270,46 +12435,11 @@ var ClientNetworkHandler = class {
|
|
|
12270
12435
|
source = createEmptyEntityState();
|
|
12271
12436
|
}
|
|
12272
12437
|
const final = structuredClone(source);
|
|
12273
|
-
|
|
12438
|
+
applyEntityDelta(final, partial);
|
|
12274
12439
|
newEntities.set(number, final);
|
|
12275
12440
|
}
|
|
12276
12441
|
this.entities = newEntities;
|
|
12277
12442
|
}
|
|
12278
|
-
applyDelta(to, from) {
|
|
12279
|
-
const bits = from.bits;
|
|
12280
|
-
const bitsHigh = from.bitsHigh;
|
|
12281
|
-
to.number = from.number;
|
|
12282
|
-
if (bits & U_MODEL5) to.modelindex = from.modelindex;
|
|
12283
|
-
if (bits & U_MODEL22) to.modelindex2 = from.modelindex2;
|
|
12284
|
-
if (bits & U_MODEL32) to.modelindex3 = from.modelindex3;
|
|
12285
|
-
if (bits & U_MODEL42) to.modelindex4 = from.modelindex4;
|
|
12286
|
-
if (bits & U_FRAME8) to.frame = from.frame;
|
|
12287
|
-
if (bits & U_FRAME16) to.frame = from.frame;
|
|
12288
|
-
if (bits & U_SKIN8 || bits & U_SKIN16) to.skinnum = from.skinnum;
|
|
12289
|
-
if (bits & U_EFFECTS8 || bits & U_EFFECTS16) to.effects = from.effects;
|
|
12290
|
-
if (bits & U_RENDERFX8 || bits & U_RENDERFX16) to.renderfx = from.renderfx;
|
|
12291
|
-
if (bits & U_ORIGIN12) to.origin.x = from.origin.x;
|
|
12292
|
-
if (bits & U_ORIGIN22) to.origin.y = from.origin.y;
|
|
12293
|
-
if (bits & U_ORIGIN32) to.origin.z = from.origin.z;
|
|
12294
|
-
if (bits & U_ANGLE12) to.angles.x = from.angles.x;
|
|
12295
|
-
if (bits & U_ANGLE22) to.angles.y = from.angles.y;
|
|
12296
|
-
if (bits & U_ANGLE32) to.angles.z = from.angles.z;
|
|
12297
|
-
if (bits & U_OLDORIGIN) {
|
|
12298
|
-
to.old_origin.x = from.old_origin.x;
|
|
12299
|
-
to.old_origin.y = from.old_origin.y;
|
|
12300
|
-
to.old_origin.z = from.old_origin.z;
|
|
12301
|
-
}
|
|
12302
|
-
if (bits & U_SOUND2) to.sound = from.sound;
|
|
12303
|
-
if (bits & U_EVENT2) to.event = from.event;
|
|
12304
|
-
if (bits & U_SOLID2) to.solid = from.solid;
|
|
12305
|
-
if (bits & U_ALPHA) to.alpha = from.alpha;
|
|
12306
|
-
if (bits & U_SCALE) to.scale = from.scale;
|
|
12307
|
-
if (bits & U_INSTANCE_BITS) to.instanceBits = from.instanceBits;
|
|
12308
|
-
if (bits & U_LOOP_VOLUME) to.loopVolume = from.loopVolume;
|
|
12309
|
-
if (bitsHigh & U_LOOP_ATTENUATION_HIGH) to.loopAttenuation = from.loopAttenuation;
|
|
12310
|
-
if (bitsHigh & U_OWNER_HIGH) to.owner = from.owner;
|
|
12311
|
-
if (bitsHigh & U_OLD_FRAME_HIGH) to.oldFrame = from.oldFrame;
|
|
12312
|
-
}
|
|
12313
12443
|
onCenterPrint(msg) {
|
|
12314
12444
|
if (this.callbacks?.onCenterPrint) {
|
|
12315
12445
|
this.callbacks.onCenterPrint(msg);
|