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
|
@@ -6661,6 +6661,7 @@ var DemoReader = class {
|
|
|
6661
6661
|
};
|
|
6662
6662
|
|
|
6663
6663
|
// src/demo/parser.ts
|
|
6664
|
+
var PROTOCOL_VERSION_RERELEASE = 2023;
|
|
6664
6665
|
var U_ORIGIN12 = 1 << 0;
|
|
6665
6666
|
var U_ORIGIN22 = 1 << 1;
|
|
6666
6667
|
var U_ANGLE22 = 1 << 2;
|
|
@@ -6764,6 +6765,9 @@ var NetworkMessageParser = class {
|
|
|
6764
6765
|
if (cmd === 6) return ServerCommand.reconnect;
|
|
6765
6766
|
if (cmd === 16) return ServerCommand.temp_entity;
|
|
6766
6767
|
}
|
|
6768
|
+
if (this.protocolVersion === PROTOCOL_VERSION_RERELEASE) {
|
|
6769
|
+
return cmd;
|
|
6770
|
+
}
|
|
6767
6771
|
return cmd;
|
|
6768
6772
|
}
|
|
6769
6773
|
parseMessage() {
|
|
@@ -6846,10 +6850,12 @@ var NetworkMessageParser = class {
|
|
|
6846
6850
|
if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
|
|
6847
6851
|
break;
|
|
6848
6852
|
case ServerCommand.damage:
|
|
6853
|
+
this.parseDamage();
|
|
6849
6854
|
break;
|
|
6850
6855
|
case ServerCommand.locprint:
|
|
6851
6856
|
break;
|
|
6852
6857
|
case ServerCommand.fog:
|
|
6858
|
+
this.parseFog();
|
|
6853
6859
|
break;
|
|
6854
6860
|
case ServerCommand.waitingforplayers:
|
|
6855
6861
|
if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
|
|
@@ -6986,6 +6992,80 @@ var NetworkMessageParser = class {
|
|
|
6986
6992
|
const weapon = this.stream.readShort();
|
|
6987
6993
|
if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
|
|
6988
6994
|
}
|
|
6995
|
+
parseFog() {
|
|
6996
|
+
let bits = this.stream.readByte();
|
|
6997
|
+
if (bits & 128) {
|
|
6998
|
+
const high = this.stream.readByte();
|
|
6999
|
+
bits |= high << 8;
|
|
7000
|
+
}
|
|
7001
|
+
const fog = {};
|
|
7002
|
+
if (bits & 1) {
|
|
7003
|
+
fog.density = this.stream.readFloat();
|
|
7004
|
+
fog.skyfactor = this.stream.readByte();
|
|
7005
|
+
}
|
|
7006
|
+
if (bits & 2) {
|
|
7007
|
+
fog.red = this.stream.readByte();
|
|
7008
|
+
}
|
|
7009
|
+
if (bits & 4) {
|
|
7010
|
+
fog.green = this.stream.readByte();
|
|
7011
|
+
}
|
|
7012
|
+
if (bits & 8) {
|
|
7013
|
+
fog.blue = this.stream.readByte();
|
|
7014
|
+
}
|
|
7015
|
+
if (bits & 16) {
|
|
7016
|
+
fog.time = this.stream.readShort();
|
|
7017
|
+
}
|
|
7018
|
+
if (bits & 32) {
|
|
7019
|
+
fog.hf_falloff = this.stream.readFloat();
|
|
7020
|
+
}
|
|
7021
|
+
if (bits & 64) {
|
|
7022
|
+
fog.hf_density = this.stream.readFloat();
|
|
7023
|
+
}
|
|
7024
|
+
if (bits & 256) {
|
|
7025
|
+
fog.hf_start_r = this.stream.readByte();
|
|
7026
|
+
}
|
|
7027
|
+
if (bits & 512) {
|
|
7028
|
+
fog.hf_start_g = this.stream.readByte();
|
|
7029
|
+
}
|
|
7030
|
+
if (bits & 1024) {
|
|
7031
|
+
fog.hf_start_b = this.stream.readByte();
|
|
7032
|
+
}
|
|
7033
|
+
if (bits & 2048) {
|
|
7034
|
+
fog.hf_start_dist = this.stream.readLong();
|
|
7035
|
+
}
|
|
7036
|
+
if (bits & 4096) {
|
|
7037
|
+
fog.hf_end_r = this.stream.readByte();
|
|
7038
|
+
}
|
|
7039
|
+
if (bits & 8192) {
|
|
7040
|
+
fog.hf_end_g = this.stream.readByte();
|
|
7041
|
+
}
|
|
7042
|
+
if (bits & 16384) {
|
|
7043
|
+
fog.hf_end_b = this.stream.readByte();
|
|
7044
|
+
}
|
|
7045
|
+
if (bits & 32768) {
|
|
7046
|
+
fog.hf_end_dist = this.stream.readLong();
|
|
7047
|
+
}
|
|
7048
|
+
if (this.handler && this.handler.onFog) {
|
|
7049
|
+
this.handler.onFog(fog);
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
parseDamage() {
|
|
7053
|
+
const num = this.stream.readByte();
|
|
7054
|
+
const indicators = [];
|
|
7055
|
+
for (let i = 0; i < num; i++) {
|
|
7056
|
+
const encoded = this.stream.readByte();
|
|
7057
|
+
const dir = { x: 0, y: 0, z: 0 };
|
|
7058
|
+
this.stream.readDir(dir);
|
|
7059
|
+
const damage = encoded & 31;
|
|
7060
|
+
const health = (encoded & 32) !== 0;
|
|
7061
|
+
const armor = (encoded & 64) !== 0;
|
|
7062
|
+
const power = (encoded & 128) !== 0;
|
|
7063
|
+
indicators.push({ damage, health, armor, power, dir });
|
|
7064
|
+
}
|
|
7065
|
+
if (this.handler && this.handler.onDamage) {
|
|
7066
|
+
this.handler.onDamage(indicators);
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
6989
7069
|
parseTempEntity() {
|
|
6990
7070
|
const type = this.stream.readByte();
|
|
6991
7071
|
const pos = { x: 0, y: 0, z: 0 };
|