quake2ts 0.0.293 → 0.0.294
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
|
@@ -8340,28 +8340,48 @@ var DemoPlaybackController = class {
|
|
|
8340
8340
|
setFrameDuration(ms) {
|
|
8341
8341
|
this.frameDuration = ms;
|
|
8342
8342
|
}
|
|
8343
|
+
setSpeed(speed) {
|
|
8344
|
+
this.playbackSpeed = Math.max(0.1, Math.min(speed, 16));
|
|
8345
|
+
}
|
|
8346
|
+
getSpeed() {
|
|
8347
|
+
return this.playbackSpeed;
|
|
8348
|
+
}
|
|
8343
8349
|
update(dt) {
|
|
8344
8350
|
if (this.state !== 1 || !this.reader) {
|
|
8345
8351
|
return;
|
|
8346
8352
|
}
|
|
8347
8353
|
this.accumulatedTime += dt * 1e3 * this.playbackSpeed;
|
|
8348
8354
|
while (this.accumulatedTime >= this.frameDuration) {
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
return;
|
|
8352
|
-
}
|
|
8353
|
-
const block = this.reader.readNextBlock();
|
|
8354
|
-
if (!block) {
|
|
8355
|
-
this.state = 3;
|
|
8355
|
+
const hasMore = this.processNextFrame();
|
|
8356
|
+
if (!hasMore) {
|
|
8356
8357
|
return;
|
|
8357
8358
|
}
|
|
8358
|
-
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
8359
|
-
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
8360
|
-
parser.parseMessage();
|
|
8361
|
-
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
8362
8359
|
this.accumulatedTime -= this.frameDuration;
|
|
8363
8360
|
}
|
|
8364
8361
|
}
|
|
8362
|
+
stepForward() {
|
|
8363
|
+
if (!this.reader) return;
|
|
8364
|
+
this.processNextFrame();
|
|
8365
|
+
}
|
|
8366
|
+
stepBackward() {
|
|
8367
|
+
console.warn("stepBackward not implemented");
|
|
8368
|
+
}
|
|
8369
|
+
processNextFrame() {
|
|
8370
|
+
if (!this.reader || !this.reader.hasMore()) {
|
|
8371
|
+
this.state = 3;
|
|
8372
|
+
return false;
|
|
8373
|
+
}
|
|
8374
|
+
const block = this.reader.readNextBlock();
|
|
8375
|
+
if (!block) {
|
|
8376
|
+
this.state = 3;
|
|
8377
|
+
return false;
|
|
8378
|
+
}
|
|
8379
|
+
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
8380
|
+
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
8381
|
+
parser.parseMessage();
|
|
8382
|
+
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
8383
|
+
return true;
|
|
8384
|
+
}
|
|
8365
8385
|
getState() {
|
|
8366
8386
|
return this.state;
|
|
8367
8387
|
}
|