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
|
@@ -2842,6 +2842,7 @@ var DemoReader = class {
|
|
|
2842
2842
|
return this.offset;
|
|
2843
2843
|
}
|
|
2844
2844
|
};
|
|
2845
|
+
var PROTOCOL_VERSION_RERELEASE = 2023;
|
|
2845
2846
|
var U_ORIGIN12 = 1 << 0;
|
|
2846
2847
|
var U_ORIGIN22 = 1 << 1;
|
|
2847
2848
|
var U_ANGLE22 = 1 << 2;
|
|
@@ -2944,6 +2945,9 @@ var NetworkMessageParser = class {
|
|
|
2944
2945
|
if (cmd === 6) return ServerCommand.reconnect;
|
|
2945
2946
|
if (cmd === 16) return ServerCommand.temp_entity;
|
|
2946
2947
|
}
|
|
2948
|
+
if (this.protocolVersion === PROTOCOL_VERSION_RERELEASE) {
|
|
2949
|
+
return cmd;
|
|
2950
|
+
}
|
|
2947
2951
|
return cmd;
|
|
2948
2952
|
}
|
|
2949
2953
|
parseMessage() {
|
|
@@ -3026,10 +3030,12 @@ var NetworkMessageParser = class {
|
|
|
3026
3030
|
if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
|
|
3027
3031
|
break;
|
|
3028
3032
|
case ServerCommand.damage:
|
|
3033
|
+
this.parseDamage();
|
|
3029
3034
|
break;
|
|
3030
3035
|
case ServerCommand.locprint:
|
|
3031
3036
|
break;
|
|
3032
3037
|
case ServerCommand.fog:
|
|
3038
|
+
this.parseFog();
|
|
3033
3039
|
break;
|
|
3034
3040
|
case ServerCommand.waitingforplayers:
|
|
3035
3041
|
if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
|
|
@@ -3166,6 +3172,80 @@ var NetworkMessageParser = class {
|
|
|
3166
3172
|
const weapon = this.stream.readShort();
|
|
3167
3173
|
if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
|
|
3168
3174
|
}
|
|
3175
|
+
parseFog() {
|
|
3176
|
+
let bits = this.stream.readByte();
|
|
3177
|
+
if (bits & 128) {
|
|
3178
|
+
const high = this.stream.readByte();
|
|
3179
|
+
bits |= high << 8;
|
|
3180
|
+
}
|
|
3181
|
+
const fog = {};
|
|
3182
|
+
if (bits & 1) {
|
|
3183
|
+
fog.density = this.stream.readFloat();
|
|
3184
|
+
fog.skyfactor = this.stream.readByte();
|
|
3185
|
+
}
|
|
3186
|
+
if (bits & 2) {
|
|
3187
|
+
fog.red = this.stream.readByte();
|
|
3188
|
+
}
|
|
3189
|
+
if (bits & 4) {
|
|
3190
|
+
fog.green = this.stream.readByte();
|
|
3191
|
+
}
|
|
3192
|
+
if (bits & 8) {
|
|
3193
|
+
fog.blue = this.stream.readByte();
|
|
3194
|
+
}
|
|
3195
|
+
if (bits & 16) {
|
|
3196
|
+
fog.time = this.stream.readShort();
|
|
3197
|
+
}
|
|
3198
|
+
if (bits & 32) {
|
|
3199
|
+
fog.hf_falloff = this.stream.readFloat();
|
|
3200
|
+
}
|
|
3201
|
+
if (bits & 64) {
|
|
3202
|
+
fog.hf_density = this.stream.readFloat();
|
|
3203
|
+
}
|
|
3204
|
+
if (bits & 256) {
|
|
3205
|
+
fog.hf_start_r = this.stream.readByte();
|
|
3206
|
+
}
|
|
3207
|
+
if (bits & 512) {
|
|
3208
|
+
fog.hf_start_g = this.stream.readByte();
|
|
3209
|
+
}
|
|
3210
|
+
if (bits & 1024) {
|
|
3211
|
+
fog.hf_start_b = this.stream.readByte();
|
|
3212
|
+
}
|
|
3213
|
+
if (bits & 2048) {
|
|
3214
|
+
fog.hf_start_dist = this.stream.readLong();
|
|
3215
|
+
}
|
|
3216
|
+
if (bits & 4096) {
|
|
3217
|
+
fog.hf_end_r = this.stream.readByte();
|
|
3218
|
+
}
|
|
3219
|
+
if (bits & 8192) {
|
|
3220
|
+
fog.hf_end_g = this.stream.readByte();
|
|
3221
|
+
}
|
|
3222
|
+
if (bits & 16384) {
|
|
3223
|
+
fog.hf_end_b = this.stream.readByte();
|
|
3224
|
+
}
|
|
3225
|
+
if (bits & 32768) {
|
|
3226
|
+
fog.hf_end_dist = this.stream.readLong();
|
|
3227
|
+
}
|
|
3228
|
+
if (this.handler && this.handler.onFog) {
|
|
3229
|
+
this.handler.onFog(fog);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
parseDamage() {
|
|
3233
|
+
const num = this.stream.readByte();
|
|
3234
|
+
const indicators = [];
|
|
3235
|
+
for (let i = 0; i < num; i++) {
|
|
3236
|
+
const encoded = this.stream.readByte();
|
|
3237
|
+
const dir = { x: 0, y: 0, z: 0 };
|
|
3238
|
+
this.stream.readDir(dir);
|
|
3239
|
+
const damage = encoded & 31;
|
|
3240
|
+
const health = (encoded & 32) !== 0;
|
|
3241
|
+
const armor = (encoded & 64) !== 0;
|
|
3242
|
+
const power = (encoded & 128) !== 0;
|
|
3243
|
+
indicators.push({ damage, health, armor, power, dir });
|
|
3244
|
+
}
|
|
3245
|
+
if (this.handler && this.handler.onDamage) {
|
|
3246
|
+
this.handler.onDamage(indicators);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3169
3249
|
parseTempEntity() {
|
|
3170
3250
|
const type = this.stream.readByte();
|
|
3171
3251
|
const pos = { x: 0, y: 0, z: 0 };
|
|
@@ -4596,6 +4676,16 @@ var ClientNetworkHandler = class {
|
|
|
4596
4676
|
this.callbacks.onMuzzleFlash3(ent, weapon);
|
|
4597
4677
|
}
|
|
4598
4678
|
}
|
|
4679
|
+
onFog(data) {
|
|
4680
|
+
if (this.callbacks?.onFog) {
|
|
4681
|
+
this.callbacks.onFog(data);
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
onDamage(indicators) {
|
|
4685
|
+
if (this.callbacks?.onDamage) {
|
|
4686
|
+
this.callbacks.onDamage(indicators);
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4599
4689
|
// New Rerelease Handlers (Stubbed)
|
|
4600
4690
|
onLevelRestart() {
|
|
4601
4691
|
if (this.callbacks?.onLevelRestart) this.callbacks.onLevelRestart();
|