quake2ts 0.0.96 → 0.0.97
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 +87 -26
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +86 -26
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/configStrings.d.ts +21 -0
- package/packages/client/dist/types/configStrings.d.ts.map +1 -0
- package/packages/client/dist/types/hud/crosshair.d.ts +1 -0
- package/packages/client/dist/types/hud/crosshair.d.ts.map +1 -1
- package/packages/client/dist/types/index.d.ts +11 -3
- package/packages/client/dist/types/index.d.ts.map +1 -1
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ClientConfigStrings: () => ClientConfigStrings,
|
|
23
24
|
ClientPrediction: () => ClientPrediction,
|
|
24
25
|
InputAction: () => InputAction,
|
|
25
26
|
InputBindings: () => InputBindings,
|
|
@@ -4263,6 +4264,50 @@ var ClientNetworkHandler = class {
|
|
|
4263
4264
|
}
|
|
4264
4265
|
};
|
|
4265
4266
|
|
|
4267
|
+
// src/configStrings.ts
|
|
4268
|
+
var ClientConfigStrings = class {
|
|
4269
|
+
constructor() {
|
|
4270
|
+
this.strings = /* @__PURE__ */ new Map();
|
|
4271
|
+
this.models = [];
|
|
4272
|
+
this.sounds = [];
|
|
4273
|
+
this.images = [];
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Called when a config string is received from the server.
|
|
4277
|
+
*/
|
|
4278
|
+
set(index, value) {
|
|
4279
|
+
this.strings.set(index, value);
|
|
4280
|
+
if (index >= ConfigStringIndex2.Models && index < ConfigStringIndex2.Models + MAX_MODELS2) {
|
|
4281
|
+
const modelIndex = index - ConfigStringIndex2.Models;
|
|
4282
|
+
this.models[modelIndex] = value;
|
|
4283
|
+
} else if (index >= ConfigStringIndex2.Sounds && index < ConfigStringIndex2.Sounds + MAX_SOUNDS2) {
|
|
4284
|
+
const soundIndex = index - ConfigStringIndex2.Sounds;
|
|
4285
|
+
this.sounds[soundIndex] = value;
|
|
4286
|
+
} else if (index >= ConfigStringIndex2.Images && index < ConfigStringIndex2.Images + MAX_IMAGES2) {
|
|
4287
|
+
const imageIndex = index - ConfigStringIndex2.Images;
|
|
4288
|
+
this.images[imageIndex] = value;
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
get(index) {
|
|
4292
|
+
return this.strings.get(index);
|
|
4293
|
+
}
|
|
4294
|
+
getModelName(index) {
|
|
4295
|
+
return this.models[index];
|
|
4296
|
+
}
|
|
4297
|
+
getSoundName(index) {
|
|
4298
|
+
return this.sounds[index];
|
|
4299
|
+
}
|
|
4300
|
+
getImageName(index) {
|
|
4301
|
+
return this.images[index];
|
|
4302
|
+
}
|
|
4303
|
+
clear() {
|
|
4304
|
+
this.strings.clear();
|
|
4305
|
+
this.models.length = 0;
|
|
4306
|
+
this.sounds.length = 0;
|
|
4307
|
+
this.images.length = 0;
|
|
4308
|
+
}
|
|
4309
|
+
};
|
|
4310
|
+
|
|
4266
4311
|
// src/input/bindings.ts
|
|
4267
4312
|
var DEFAULT_BINDINGS = [
|
|
4268
4313
|
{ code: "KeyW", command: "+forward" },
|
|
@@ -4758,13 +4803,17 @@ function createClient(imports) {
|
|
|
4758
4803
|
const messageSystem = new MessageSystem();
|
|
4759
4804
|
const demoPlayback = new DemoPlaybackController();
|
|
4760
4805
|
const demoHandler = new ClientNetworkHandler();
|
|
4806
|
+
const configStrings = new ClientConfigStrings();
|
|
4761
4807
|
demoPlayback.setHandler(demoHandler);
|
|
4762
4808
|
let latestFrame;
|
|
4763
4809
|
let lastRendered;
|
|
4764
4810
|
let lastView;
|
|
4765
4811
|
let camera;
|
|
4766
|
-
|
|
4812
|
+
const clientExports = {
|
|
4767
4813
|
init(initial) {
|
|
4814
|
+
this.Init(initial);
|
|
4815
|
+
},
|
|
4816
|
+
Init(initial) {
|
|
4768
4817
|
latestFrame = initial;
|
|
4769
4818
|
if (initial?.state) {
|
|
4770
4819
|
prediction.setAuthoritative(initial);
|
|
@@ -4810,35 +4859,41 @@ function createClient(imports) {
|
|
|
4810
4859
|
fps: 0,
|
|
4811
4860
|
vertexCount: 0
|
|
4812
4861
|
};
|
|
4813
|
-
const playerState = {
|
|
4814
|
-
origin: lastRendered.origin,
|
|
4815
|
-
velocity: lastRendered.velocity,
|
|
4816
|
-
viewAngles: lastRendered.viewangles,
|
|
4817
|
-
onGround: hasPmFlag(lastRendered.pmFlags, PmFlag.OnGround),
|
|
4818
|
-
waterLevel: lastRendered.waterlevel,
|
|
4819
|
-
mins: { x: -16, y: -16, z: -24 },
|
|
4820
|
-
maxs: { x: 16, y: 16, z: 32 },
|
|
4821
|
-
damageAlpha: 0,
|
|
4822
|
-
damageIndicators: []
|
|
4823
|
-
};
|
|
4824
4862
|
const timeMs = sample.latest?.timeMs ?? 0;
|
|
4825
|
-
|
|
4826
|
-
imports.engine.renderer,
|
|
4827
|
-
playerState,
|
|
4828
|
-
lastRendered.client,
|
|
4829
|
-
lastRendered.health,
|
|
4830
|
-
lastRendered.armor,
|
|
4831
|
-
lastRendered.ammo,
|
|
4832
|
-
stats,
|
|
4833
|
-
messageSystem,
|
|
4834
|
-
timeMs
|
|
4835
|
-
);
|
|
4863
|
+
this.DrawHUD(stats, timeMs);
|
|
4836
4864
|
}
|
|
4837
|
-
void imports;
|
|
4838
|
-
void sample;
|
|
4839
4865
|
return command;
|
|
4840
4866
|
},
|
|
4867
|
+
DrawHUD(stats, timeMs) {
|
|
4868
|
+
if (!imports.engine.renderer || !lastRendered || !lastRendered.client) return;
|
|
4869
|
+
const stateAsPlayerState = lastRendered;
|
|
4870
|
+
const playerState = {
|
|
4871
|
+
origin: lastRendered.origin,
|
|
4872
|
+
velocity: lastRendered.velocity,
|
|
4873
|
+
viewAngles: lastRendered.viewangles,
|
|
4874
|
+
onGround: hasPmFlag(lastRendered.pmFlags, PmFlag.OnGround),
|
|
4875
|
+
waterLevel: lastRendered.waterlevel,
|
|
4876
|
+
mins: { x: -16, y: -16, z: -24 },
|
|
4877
|
+
maxs: { x: 16, y: 16, z: 32 },
|
|
4878
|
+
damageAlpha: stateAsPlayerState.damageAlpha ?? 0,
|
|
4879
|
+
damageIndicators: stateAsPlayerState.damageIndicators ?? []
|
|
4880
|
+
};
|
|
4881
|
+
Draw_Hud(
|
|
4882
|
+
imports.engine.renderer,
|
|
4883
|
+
playerState,
|
|
4884
|
+
lastRendered.client,
|
|
4885
|
+
lastRendered.health,
|
|
4886
|
+
lastRendered.armor,
|
|
4887
|
+
lastRendered.ammo,
|
|
4888
|
+
stats,
|
|
4889
|
+
messageSystem,
|
|
4890
|
+
timeMs
|
|
4891
|
+
);
|
|
4892
|
+
},
|
|
4841
4893
|
shutdown() {
|
|
4894
|
+
this.Shutdown();
|
|
4895
|
+
},
|
|
4896
|
+
Shutdown() {
|
|
4842
4897
|
latestFrame = void 0;
|
|
4843
4898
|
lastRendered = void 0;
|
|
4844
4899
|
},
|
|
@@ -4866,11 +4921,17 @@ function createClient(imports) {
|
|
|
4866
4921
|
const timeMs = latestFrame?.timeMs ?? 0;
|
|
4867
4922
|
messageSystem.addNotify(msg, timeMs);
|
|
4868
4923
|
},
|
|
4869
|
-
|
|
4924
|
+
ParseConfigString(index, value) {
|
|
4925
|
+
configStrings.set(index, value);
|
|
4926
|
+
},
|
|
4927
|
+
demoHandler,
|
|
4928
|
+
configStrings
|
|
4870
4929
|
};
|
|
4930
|
+
return clientExports;
|
|
4871
4931
|
}
|
|
4872
4932
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4873
4933
|
0 && (module.exports = {
|
|
4934
|
+
ClientConfigStrings,
|
|
4874
4935
|
ClientPrediction,
|
|
4875
4936
|
InputAction,
|
|
4876
4937
|
InputBindings,
|