quake2ts 0.0.232 → 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 +4 -4
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +86 -0
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +86 -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 +1 -1
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +76 -0
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +76 -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 +29 -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
|
@@ -3030,10 +3030,12 @@ var NetworkMessageParser = class {
|
|
|
3030
3030
|
if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
|
|
3031
3031
|
break;
|
|
3032
3032
|
case ServerCommand.damage:
|
|
3033
|
+
this.parseDamage();
|
|
3033
3034
|
break;
|
|
3034
3035
|
case ServerCommand.locprint:
|
|
3035
3036
|
break;
|
|
3036
3037
|
case ServerCommand.fog:
|
|
3038
|
+
this.parseFog();
|
|
3037
3039
|
break;
|
|
3038
3040
|
case ServerCommand.waitingforplayers:
|
|
3039
3041
|
if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
|
|
@@ -3170,6 +3172,80 @@ var NetworkMessageParser = class {
|
|
|
3170
3172
|
const weapon = this.stream.readShort();
|
|
3171
3173
|
if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
|
|
3172
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
|
+
}
|
|
3173
3249
|
parseTempEntity() {
|
|
3174
3250
|
const type = this.stream.readByte();
|
|
3175
3251
|
const pos = { x: 0, y: 0, z: 0 };
|
|
@@ -4600,6 +4676,16 @@ var ClientNetworkHandler = class {
|
|
|
4600
4676
|
this.callbacks.onMuzzleFlash3(ent, weapon);
|
|
4601
4677
|
}
|
|
4602
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
|
+
}
|
|
4603
4689
|
// New Rerelease Handlers (Stubbed)
|
|
4604
4690
|
onLevelRestart() {
|
|
4605
4691
|
if (this.callbacks?.onLevelRestart) this.callbacks.onLevelRestart();
|