quake2ts 0.0.231 → 0.0.233
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 +11 -11
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +90 -0
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +90 -0
- 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 +5 -1
- package/packages/client/dist/types/demo/handler.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +3 -3
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +80 -0
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +80 -0
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/demo/parser.d.ts +30 -2
- package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
- package/packages/engine/dist/types/index.d.ts +1 -1
- package/packages/engine/dist/types/index.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -6848,6 +6848,7 @@ var DemoReader = class {
|
|
|
6848
6848
|
};
|
|
6849
6849
|
|
|
6850
6850
|
// src/demo/parser.ts
|
|
6851
|
+
var PROTOCOL_VERSION_RERELEASE = 2023;
|
|
6851
6852
|
var U_ORIGIN12 = 1 << 0;
|
|
6852
6853
|
var U_ORIGIN22 = 1 << 1;
|
|
6853
6854
|
var U_ANGLE22 = 1 << 2;
|
|
@@ -6951,6 +6952,9 @@ var NetworkMessageParser = class {
|
|
|
6951
6952
|
if (cmd === 6) return ServerCommand.reconnect;
|
|
6952
6953
|
if (cmd === 16) return ServerCommand.temp_entity;
|
|
6953
6954
|
}
|
|
6955
|
+
if (this.protocolVersion === PROTOCOL_VERSION_RERELEASE) {
|
|
6956
|
+
return cmd;
|
|
6957
|
+
}
|
|
6954
6958
|
return cmd;
|
|
6955
6959
|
}
|
|
6956
6960
|
parseMessage() {
|
|
@@ -7033,10 +7037,12 @@ var NetworkMessageParser = class {
|
|
|
7033
7037
|
if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
|
|
7034
7038
|
break;
|
|
7035
7039
|
case ServerCommand.damage:
|
|
7040
|
+
this.parseDamage();
|
|
7036
7041
|
break;
|
|
7037
7042
|
case ServerCommand.locprint:
|
|
7038
7043
|
break;
|
|
7039
7044
|
case ServerCommand.fog:
|
|
7045
|
+
this.parseFog();
|
|
7040
7046
|
break;
|
|
7041
7047
|
case ServerCommand.waitingforplayers:
|
|
7042
7048
|
if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
|
|
@@ -7173,6 +7179,80 @@ var NetworkMessageParser = class {
|
|
|
7173
7179
|
const weapon = this.stream.readShort();
|
|
7174
7180
|
if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
|
|
7175
7181
|
}
|
|
7182
|
+
parseFog() {
|
|
7183
|
+
let bits = this.stream.readByte();
|
|
7184
|
+
if (bits & 128) {
|
|
7185
|
+
const high = this.stream.readByte();
|
|
7186
|
+
bits |= high << 8;
|
|
7187
|
+
}
|
|
7188
|
+
const fog = {};
|
|
7189
|
+
if (bits & 1) {
|
|
7190
|
+
fog.density = this.stream.readFloat();
|
|
7191
|
+
fog.skyfactor = this.stream.readByte();
|
|
7192
|
+
}
|
|
7193
|
+
if (bits & 2) {
|
|
7194
|
+
fog.red = this.stream.readByte();
|
|
7195
|
+
}
|
|
7196
|
+
if (bits & 4) {
|
|
7197
|
+
fog.green = this.stream.readByte();
|
|
7198
|
+
}
|
|
7199
|
+
if (bits & 8) {
|
|
7200
|
+
fog.blue = this.stream.readByte();
|
|
7201
|
+
}
|
|
7202
|
+
if (bits & 16) {
|
|
7203
|
+
fog.time = this.stream.readShort();
|
|
7204
|
+
}
|
|
7205
|
+
if (bits & 32) {
|
|
7206
|
+
fog.hf_falloff = this.stream.readFloat();
|
|
7207
|
+
}
|
|
7208
|
+
if (bits & 64) {
|
|
7209
|
+
fog.hf_density = this.stream.readFloat();
|
|
7210
|
+
}
|
|
7211
|
+
if (bits & 256) {
|
|
7212
|
+
fog.hf_start_r = this.stream.readByte();
|
|
7213
|
+
}
|
|
7214
|
+
if (bits & 512) {
|
|
7215
|
+
fog.hf_start_g = this.stream.readByte();
|
|
7216
|
+
}
|
|
7217
|
+
if (bits & 1024) {
|
|
7218
|
+
fog.hf_start_b = this.stream.readByte();
|
|
7219
|
+
}
|
|
7220
|
+
if (bits & 2048) {
|
|
7221
|
+
fog.hf_start_dist = this.stream.readLong();
|
|
7222
|
+
}
|
|
7223
|
+
if (bits & 4096) {
|
|
7224
|
+
fog.hf_end_r = this.stream.readByte();
|
|
7225
|
+
}
|
|
7226
|
+
if (bits & 8192) {
|
|
7227
|
+
fog.hf_end_g = this.stream.readByte();
|
|
7228
|
+
}
|
|
7229
|
+
if (bits & 16384) {
|
|
7230
|
+
fog.hf_end_b = this.stream.readByte();
|
|
7231
|
+
}
|
|
7232
|
+
if (bits & 32768) {
|
|
7233
|
+
fog.hf_end_dist = this.stream.readLong();
|
|
7234
|
+
}
|
|
7235
|
+
if (this.handler && this.handler.onFog) {
|
|
7236
|
+
this.handler.onFog(fog);
|
|
7237
|
+
}
|
|
7238
|
+
}
|
|
7239
|
+
parseDamage() {
|
|
7240
|
+
const num = this.stream.readByte();
|
|
7241
|
+
const indicators = [];
|
|
7242
|
+
for (let i = 0; i < num; i++) {
|
|
7243
|
+
const encoded = this.stream.readByte();
|
|
7244
|
+
const dir = { x: 0, y: 0, z: 0 };
|
|
7245
|
+
this.stream.readDir(dir);
|
|
7246
|
+
const damage = encoded & 31;
|
|
7247
|
+
const health = (encoded & 32) !== 0;
|
|
7248
|
+
const armor = (encoded & 64) !== 0;
|
|
7249
|
+
const power = (encoded & 128) !== 0;
|
|
7250
|
+
indicators.push({ damage, health, armor, power, dir });
|
|
7251
|
+
}
|
|
7252
|
+
if (this.handler && this.handler.onDamage) {
|
|
7253
|
+
this.handler.onDamage(indicators);
|
|
7254
|
+
}
|
|
7255
|
+
}
|
|
7176
7256
|
parseTempEntity() {
|
|
7177
7257
|
const type = this.stream.readByte();
|
|
7178
7258
|
const pos = { x: 0, y: 0, z: 0 };
|