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
|
@@ -12208,28 +12208,48 @@ var DemoPlaybackController = class {
|
|
|
12208
12208
|
setFrameDuration(ms) {
|
|
12209
12209
|
this.frameDuration = ms;
|
|
12210
12210
|
}
|
|
12211
|
+
setSpeed(speed) {
|
|
12212
|
+
this.playbackSpeed = Math.max(0.1, Math.min(speed, 16));
|
|
12213
|
+
}
|
|
12214
|
+
getSpeed() {
|
|
12215
|
+
return this.playbackSpeed;
|
|
12216
|
+
}
|
|
12211
12217
|
update(dt) {
|
|
12212
12218
|
if (this.state !== 1 /* Playing */ || !this.reader) {
|
|
12213
12219
|
return;
|
|
12214
12220
|
}
|
|
12215
12221
|
this.accumulatedTime += dt * 1e3 * this.playbackSpeed;
|
|
12216
12222
|
while (this.accumulatedTime >= this.frameDuration) {
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
return;
|
|
12220
|
-
}
|
|
12221
|
-
const block = this.reader.readNextBlock();
|
|
12222
|
-
if (!block) {
|
|
12223
|
-
this.state = 3 /* Finished */;
|
|
12223
|
+
const hasMore = this.processNextFrame();
|
|
12224
|
+
if (!hasMore) {
|
|
12224
12225
|
return;
|
|
12225
12226
|
}
|
|
12226
|
-
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
12227
|
-
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
12228
|
-
parser.parseMessage();
|
|
12229
|
-
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
12230
12227
|
this.accumulatedTime -= this.frameDuration;
|
|
12231
12228
|
}
|
|
12232
12229
|
}
|
|
12230
|
+
stepForward() {
|
|
12231
|
+
if (!this.reader) return;
|
|
12232
|
+
this.processNextFrame();
|
|
12233
|
+
}
|
|
12234
|
+
stepBackward() {
|
|
12235
|
+
console.warn("stepBackward not implemented");
|
|
12236
|
+
}
|
|
12237
|
+
processNextFrame() {
|
|
12238
|
+
if (!this.reader || !this.reader.hasMore()) {
|
|
12239
|
+
this.state = 3 /* Finished */;
|
|
12240
|
+
return false;
|
|
12241
|
+
}
|
|
12242
|
+
const block = this.reader.readNextBlock();
|
|
12243
|
+
if (!block) {
|
|
12244
|
+
this.state = 3 /* Finished */;
|
|
12245
|
+
return false;
|
|
12246
|
+
}
|
|
12247
|
+
const parser = new NetworkMessageParser(block.data, this.handler);
|
|
12248
|
+
parser.setProtocolVersion(this.currentProtocolVersion);
|
|
12249
|
+
parser.parseMessage();
|
|
12250
|
+
this.currentProtocolVersion = parser.getProtocolVersion();
|
|
12251
|
+
return true;
|
|
12252
|
+
}
|
|
12233
12253
|
getState() {
|
|
12234
12254
|
return this.state;
|
|
12235
12255
|
}
|