quake2ts 0.0.293 → 0.0.295
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 +1 -1
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +31 -11
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +31 -11
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/browser/index.global.js +7 -7
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +31 -11
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +31 -11
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/demo/playback.d.ts +5 -0
- package/packages/engine/dist/types/demo/playback.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -12402,28 +12402,48 @@ var DemoPlaybackController = class {
|
|
|
12402
12402
|
setFrameDuration(ms) {
|
|
12403
12403
|
this.frameDuration = ms;
|
|
12404
12404
|
}
|
|
12405
|
+
setSpeed(speed) {
|
|
12406
|
+
this.playbackSpeed = Math.max(0.1, Math.min(speed, 16));
|
|
12407
|
+
}
|
|
12408
|
+
getSpeed() {
|
|
12409
|
+
return this.playbackSpeed;
|
|
12410
|
+
}
|
|
12405
12411
|
update(dt) {
|
|
12406
12412
|
if (this.state !== 1 /* Playing */ || !this.reader) {
|
|
12407
12413
|
return;
|
|
12408
12414
|
}
|
|
12409
12415
|
this.accumulatedTime += dt * 1e3 * this.playbackSpeed;
|
|
12410
12416
|
while (this.accumulatedTime >= this.frameDuration) {
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
return;
|
|
12414
|
-
}
|
|
12415
|
-
const block = this.reader.readNextBlock();
|
|
12416
|
-
if (!block) {
|
|
12417
|
-
this.state = 3 /* Finished */;
|
|
12417
|
+
const hasMore = this.processNextFrame();
|
|
12418
|
+
if (!hasMore) {
|
|
12418
12419
|
return;
|
|
12419
12420
|
}
|
|
12420
|
-
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
12421
|
-
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
12422
|
-
parser.parseMessage();
|
|
12423
|
-
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
12424
12421
|
this.accumulatedTime -= this.frameDuration;
|
|
12425
12422
|
}
|
|
12426
12423
|
}
|
|
12424
|
+
stepForward() {
|
|
12425
|
+
if (!this.reader) return;
|
|
12426
|
+
this.processNextFrame();
|
|
12427
|
+
}
|
|
12428
|
+
stepBackward() {
|
|
12429
|
+
console.warn("stepBackward not implemented");
|
|
12430
|
+
}
|
|
12431
|
+
processNextFrame() {
|
|
12432
|
+
if (!this.reader || !this.reader.hasMore()) {
|
|
12433
|
+
this.state = 3 /* Finished */;
|
|
12434
|
+
return false;
|
|
12435
|
+
}
|
|
12436
|
+
const block = this.reader.readNextBlock();
|
|
12437
|
+
if (!block) {
|
|
12438
|
+
this.state = 3 /* Finished */;
|
|
12439
|
+
return false;
|
|
12440
|
+
}
|
|
12441
|
+
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
12442
|
+
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
12443
|
+
parser.parseMessage();
|
|
12444
|
+
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
12445
|
+
return true;
|
|
12446
|
+
}
|
|
12427
12447
|
getState() {
|
|
12428
12448
|
return this.state;
|
|
12429
12449
|
}
|