quake2ts 0.0.235 → 0.0.237
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/cgame/dist/index.cjs +10 -2
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.d.cts +1 -0
- package/packages/cgame/dist/index.d.ts +1 -0
- package/packages/cgame/dist/index.js +10 -2
- package/packages/cgame/dist/index.js.map +1 -1
- package/packages/client/dist/browser/index.global.js +13 -13
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +237 -2
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +264 -29
- 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 +4 -1
- package/packages/client/dist/types/demo/handler.d.ts.map +1 -1
- package/packages/client/dist/types/index.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +5 -5
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/render/scene.d.ts +2 -0
- package/packages/engine/dist/types/render/scene.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +20 -2
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +20 -2
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
- package/packages/game/dist/types/combat/weapons/state.d.ts +1 -0
- package/packages/game/dist/types/combat/weapons/state.d.ts.map +1 -1
- package/packages/game/dist/types/entities/playerStats.d.ts.map +1 -1
- package/packages/game/dist/types/entities/projectiles.d.ts +1 -1
- package/packages/game/dist/types/entities/projectiles.d.ts.map +1 -1
- package/packages/game/dist/types/index.d.ts +1 -0
- package/packages/game/dist/types/index.d.ts.map +1 -1
- package/packages/game/dist/types/inventory/items.d.ts.map +1 -1
- package/packages/server/dist/index.cjs +1 -0
- package/packages/server/dist/index.js +1 -0
- package/packages/shared/dist/browser/index.global.js +1 -1
- package/packages/shared/dist/browser/index.global.js.map +1 -1
- package/packages/shared/dist/cjs/index.cjs +43 -0
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +29 -0
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/items/weapons.d.ts +1 -0
- package/packages/shared/dist/types/items/weapons.d.ts.map +1 -1
- package/packages/shared/dist/types/protocol/constants.d.ts +14 -0
- package/packages/shared/dist/types/protocol/constants.d.ts.map +1 -1
- package/packages/shared/dist/types/protocol/player-state.d.ts +1 -0
- package/packages/shared/dist/types/protocol/player-state.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -8188,6 +8188,67 @@ function mouseDeltaToViewDelta(delta, options) {
|
|
|
8188
8188
|
z: 0
|
|
8189
8189
|
};
|
|
8190
8190
|
}
|
|
8191
|
+
var MZ_BLASTER = 0;
|
|
8192
|
+
var MZ_MACHINEGUN = 1;
|
|
8193
|
+
var MZ_SHOTGUN = 2;
|
|
8194
|
+
var MZ_CHAINGUN1 = 3;
|
|
8195
|
+
var MZ_CHAINGUN2 = 4;
|
|
8196
|
+
var MZ_CHAINGUN3 = 5;
|
|
8197
|
+
var MZ_RAILGUN = 6;
|
|
8198
|
+
var MZ_ROCKET = 7;
|
|
8199
|
+
var MZ_GRENADE = 8;
|
|
8200
|
+
var MZ_SSHOTGUN = 11;
|
|
8201
|
+
var MZ_BFG = 12;
|
|
8202
|
+
var MZ_HYPERBLASTER = 13;
|
|
8203
|
+
function readUint16LE(stats, startIndex, byteOffset) {
|
|
8204
|
+
const elementIndex = Math.floor(byteOffset / 2);
|
|
8205
|
+
const isOdd = byteOffset % 2 !== 0;
|
|
8206
|
+
const index = startIndex + elementIndex;
|
|
8207
|
+
const val0 = stats[index] || 0;
|
|
8208
|
+
if (!isOdd) {
|
|
8209
|
+
return val0 & 65535;
|
|
8210
|
+
} else {
|
|
8211
|
+
const val1 = stats[index + 1] || 0;
|
|
8212
|
+
const low = val0 >>> 8 & 255;
|
|
8213
|
+
const high = val1 & 255;
|
|
8214
|
+
return high << 8 | low;
|
|
8215
|
+
}
|
|
8216
|
+
}
|
|
8217
|
+
function getCompressedInteger(stats, startIndex, id, bitsPerValue) {
|
|
8218
|
+
const bitOffset = bitsPerValue * id;
|
|
8219
|
+
const byteOffset = Math.floor(bitOffset / 8);
|
|
8220
|
+
const bitShift = bitOffset % 8;
|
|
8221
|
+
const mask = (1 << bitsPerValue) - 1 << bitShift;
|
|
8222
|
+
const base = readUint16LE(stats, startIndex, byteOffset);
|
|
8223
|
+
return (base & mask) >>> bitShift;
|
|
8224
|
+
}
|
|
8225
|
+
var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
|
|
8226
|
+
PowerupId22["QuadDamage"] = "quad";
|
|
8227
|
+
PowerupId22["Invulnerability"] = "invulnerability";
|
|
8228
|
+
PowerupId22["EnviroSuit"] = "enviro_suit";
|
|
8229
|
+
PowerupId22["Rebreather"] = "rebreather";
|
|
8230
|
+
PowerupId22["Silencer"] = "silencer";
|
|
8231
|
+
PowerupId22["PowerScreen"] = "power_screen";
|
|
8232
|
+
PowerupId22["PowerShield"] = "power_shield";
|
|
8233
|
+
PowerupId22["QuadFire"] = "quad_fire";
|
|
8234
|
+
PowerupId22["Invisibility"] = "invisibility";
|
|
8235
|
+
PowerupId22["Bandolier"] = "bandolier";
|
|
8236
|
+
PowerupId22["AmmoPack"] = "ammo_pack";
|
|
8237
|
+
PowerupId22["IRGoggles"] = "ir_goggles";
|
|
8238
|
+
PowerupId22["DoubleDamage"] = "double_damage";
|
|
8239
|
+
PowerupId22["SphereVengeance"] = "sphere_vengeance";
|
|
8240
|
+
PowerupId22["SphereHunter"] = "sphere_hunter";
|
|
8241
|
+
PowerupId22["SphereDefender"] = "sphere_defender";
|
|
8242
|
+
PowerupId22["Doppelganger"] = "doppelganger";
|
|
8243
|
+
PowerupId22["TagToken"] = "tag_token";
|
|
8244
|
+
PowerupId22["TechResistance"] = "tech_resistance";
|
|
8245
|
+
PowerupId22["TechStrength"] = "tech_strength";
|
|
8246
|
+
PowerupId22["TechHaste"] = "tech_haste";
|
|
8247
|
+
PowerupId22["TechRegeneration"] = "tech_regeneration";
|
|
8248
|
+
PowerupId22["Flashlight"] = "flashlight";
|
|
8249
|
+
PowerupId22["Compass"] = "compass";
|
|
8250
|
+
return PowerupId22;
|
|
8251
|
+
})(PowerupId || {});
|
|
8191
8252
|
var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
|
|
8192
8253
|
PlayerStat2[PlayerStat2["STAT_HEALTH_ICON"] = 0] = "STAT_HEALTH_ICON";
|
|
8193
8254
|
PlayerStat2[PlayerStat2["STAT_HEALTH"] = 1] = "STAT_HEALTH";
|
|
@@ -8244,6 +8305,104 @@ var NUM_AMMO_STATS2 = Math.ceil(AMMO_MAX2 * NUM_BITS_FOR_AMMO2 / 16);
|
|
|
8244
8305
|
var POWERUP_MAX2 = 23;
|
|
8245
8306
|
var NUM_BITS_FOR_POWERUP2 = 2;
|
|
8246
8307
|
var NUM_POWERUP_STATS2 = Math.ceil(POWERUP_MAX2 * NUM_BITS_FOR_POWERUP2 / 16);
|
|
8308
|
+
var POWERUP_STAT_MAP = {
|
|
8309
|
+
[
|
|
8310
|
+
"power_screen"
|
|
8311
|
+
/* PowerScreen */
|
|
8312
|
+
]: 0,
|
|
8313
|
+
[
|
|
8314
|
+
"power_shield"
|
|
8315
|
+
/* PowerShield */
|
|
8316
|
+
]: 1,
|
|
8317
|
+
// 2 is POWERUP_AM_BOMB (not in PowerupId?)
|
|
8318
|
+
[
|
|
8319
|
+
"quad"
|
|
8320
|
+
/* QuadDamage */
|
|
8321
|
+
]: 3,
|
|
8322
|
+
[
|
|
8323
|
+
"quad_fire"
|
|
8324
|
+
/* QuadFire */
|
|
8325
|
+
]: 4,
|
|
8326
|
+
[
|
|
8327
|
+
"invulnerability"
|
|
8328
|
+
/* Invulnerability */
|
|
8329
|
+
]: 5,
|
|
8330
|
+
[
|
|
8331
|
+
"invisibility"
|
|
8332
|
+
/* Invisibility */
|
|
8333
|
+
]: 6,
|
|
8334
|
+
[
|
|
8335
|
+
"silencer"
|
|
8336
|
+
/* Silencer */
|
|
8337
|
+
]: 7,
|
|
8338
|
+
[
|
|
8339
|
+
"rebreather"
|
|
8340
|
+
/* Rebreather */
|
|
8341
|
+
]: 8,
|
|
8342
|
+
[
|
|
8343
|
+
"enviro_suit"
|
|
8344
|
+
/* EnviroSuit */
|
|
8345
|
+
]: 9,
|
|
8346
|
+
// 10 is POWERUP_ADRENALINE (not in PowerupId?)
|
|
8347
|
+
[
|
|
8348
|
+
"ir_goggles"
|
|
8349
|
+
/* IRGoggles */
|
|
8350
|
+
]: 11,
|
|
8351
|
+
[
|
|
8352
|
+
"double_damage"
|
|
8353
|
+
/* DoubleDamage */
|
|
8354
|
+
]: 12,
|
|
8355
|
+
[
|
|
8356
|
+
"sphere_vengeance"
|
|
8357
|
+
/* SphereVengeance */
|
|
8358
|
+
]: 13,
|
|
8359
|
+
[
|
|
8360
|
+
"sphere_hunter"
|
|
8361
|
+
/* SphereHunter */
|
|
8362
|
+
]: 14,
|
|
8363
|
+
[
|
|
8364
|
+
"sphere_defender"
|
|
8365
|
+
/* SphereDefender */
|
|
8366
|
+
]: 15,
|
|
8367
|
+
[
|
|
8368
|
+
"doppelganger"
|
|
8369
|
+
/* Doppelganger */
|
|
8370
|
+
]: 16,
|
|
8371
|
+
[
|
|
8372
|
+
"flashlight"
|
|
8373
|
+
/* Flashlight */
|
|
8374
|
+
]: 17,
|
|
8375
|
+
[
|
|
8376
|
+
"compass"
|
|
8377
|
+
/* Compass */
|
|
8378
|
+
]: 18,
|
|
8379
|
+
[
|
|
8380
|
+
"tech_resistance"
|
|
8381
|
+
/* TechResistance */
|
|
8382
|
+
]: 19,
|
|
8383
|
+
[
|
|
8384
|
+
"tech_strength"
|
|
8385
|
+
/* TechStrength */
|
|
8386
|
+
]: 20,
|
|
8387
|
+
[
|
|
8388
|
+
"tech_haste"
|
|
8389
|
+
/* TechHaste */
|
|
8390
|
+
]: 21,
|
|
8391
|
+
[
|
|
8392
|
+
"tech_regeneration"
|
|
8393
|
+
/* TechRegeneration */
|
|
8394
|
+
]: 22
|
|
8395
|
+
};
|
|
8396
|
+
function G_GetPowerupStat(stats, powerupId) {
|
|
8397
|
+
let index;
|
|
8398
|
+
if (typeof powerupId === "number") {
|
|
8399
|
+
index = powerupId;
|
|
8400
|
+
} else {
|
|
8401
|
+
index = POWERUP_STAT_MAP[powerupId];
|
|
8402
|
+
}
|
|
8403
|
+
if (index === void 0 || index < 0 || index >= POWERUP_MAX2) return 0;
|
|
8404
|
+
return getCompressedInteger(stats, 41, index, NUM_BITS_FOR_POWERUP2);
|
|
8405
|
+
}
|
|
8247
8406
|
var entityFlags_exports2 = {};
|
|
8248
8407
|
__export3(entityFlags_exports2, {
|
|
8249
8408
|
U_ANGLE1: () => U_ANGLE13,
|
|
@@ -8308,7 +8467,7 @@ var AMMO_TYPE_COUNT2 = Object.keys(AmmoType2).length / 2;
|
|
|
8308
8467
|
|
|
8309
8468
|
// src/index.ts
|
|
8310
8469
|
import { ClientPrediction, interpolatePredictionState as interpolatePredictionState2, GetCGameAPI } from "@quake2ts/cgame";
|
|
8311
|
-
import { ViewEffects } from "@quake2ts/cgame";
|
|
8470
|
+
import { ViewEffects as ViewEffects2 } from "@quake2ts/cgame";
|
|
8312
8471
|
|
|
8313
8472
|
// src/cgameBridge.ts
|
|
8314
8473
|
function createCGameImport(imports, state) {
|
|
@@ -8640,7 +8799,7 @@ var Init_Hud = async (renderer, assets) => {
|
|
|
8640
8799
|
import { defaultPredictionState, interpolatePredictionState } from "@quake2ts/cgame";
|
|
8641
8800
|
|
|
8642
8801
|
// src/demo/itemMapping.ts
|
|
8643
|
-
import { WeaponId, PowerupId as
|
|
8802
|
+
import { WeaponId, PowerupId as PowerupId3, KeyId } from "@quake2ts/game";
|
|
8644
8803
|
import { AmmoType as AmmoType3 } from "@quake2ts/game";
|
|
8645
8804
|
import { ArmorType } from "@quake2ts/game";
|
|
8646
8805
|
var DEMO_ITEM_MAPPING = [
|
|
@@ -8727,19 +8886,19 @@ var DEMO_ITEM_MAPPING = [
|
|
|
8727
8886
|
{ type: "ammo", id: AmmoType3.Rounds },
|
|
8728
8887
|
// IT_AMMO_ROUNDS
|
|
8729
8888
|
// Items / Powerups
|
|
8730
|
-
{ type: "powerup", id:
|
|
8889
|
+
{ type: "powerup", id: PowerupId3.QuadDamage },
|
|
8731
8890
|
// IT_ITEM_QUAD
|
|
8732
|
-
{ type: "powerup", id:
|
|
8891
|
+
{ type: "powerup", id: PowerupId3.QuadFire },
|
|
8733
8892
|
// IT_ITEM_QUADFIRE
|
|
8734
|
-
{ type: "powerup", id:
|
|
8893
|
+
{ type: "powerup", id: PowerupId3.Invulnerability },
|
|
8735
8894
|
// IT_ITEM_INVULNERABILITY
|
|
8736
|
-
{ type: "powerup", id:
|
|
8895
|
+
{ type: "powerup", id: PowerupId3.Invisibility },
|
|
8737
8896
|
// IT_ITEM_INVISIBILITY
|
|
8738
|
-
{ type: "powerup", id:
|
|
8897
|
+
{ type: "powerup", id: PowerupId3.Silencer },
|
|
8739
8898
|
// IT_ITEM_SILENCER
|
|
8740
|
-
{ type: "powerup", id:
|
|
8899
|
+
{ type: "powerup", id: PowerupId3.Rebreather },
|
|
8741
8900
|
// IT_ITEM_REBREATHER
|
|
8742
|
-
{ type: "powerup", id:
|
|
8901
|
+
{ type: "powerup", id: PowerupId3.EnviroSuit },
|
|
8743
8902
|
// IT_ITEM_ENVIROSUIT
|
|
8744
8903
|
{ type: "health", id: "ancient_head" },
|
|
8745
8904
|
// IT_ITEM_ANCIENT_HEAD
|
|
@@ -8747,23 +8906,23 @@ var DEMO_ITEM_MAPPING = [
|
|
|
8747
8906
|
// IT_ITEM_LEGACY_HEAD
|
|
8748
8907
|
{ type: "health", id: "adrenaline" },
|
|
8749
8908
|
// IT_ITEM_ADRENALINE
|
|
8750
|
-
{ type: "powerup", id:
|
|
8909
|
+
{ type: "powerup", id: PowerupId3.Bandolier },
|
|
8751
8910
|
// IT_ITEM_BANDOLIER
|
|
8752
|
-
{ type: "powerup", id:
|
|
8911
|
+
{ type: "powerup", id: PowerupId3.AmmoPack },
|
|
8753
8912
|
// IT_ITEM_PACK
|
|
8754
|
-
{ type: "powerup", id:
|
|
8913
|
+
{ type: "powerup", id: PowerupId3.IRGoggles },
|
|
8755
8914
|
// IT_ITEM_IR_GOGGLES
|
|
8756
|
-
{ type: "powerup", id:
|
|
8915
|
+
{ type: "powerup", id: PowerupId3.DoubleDamage },
|
|
8757
8916
|
// IT_ITEM_DOUBLE
|
|
8758
|
-
{ type: "powerup", id:
|
|
8917
|
+
{ type: "powerup", id: PowerupId3.SphereVengeance },
|
|
8759
8918
|
// IT_ITEM_SPHERE_VENGEANCE
|
|
8760
|
-
{ type: "powerup", id:
|
|
8919
|
+
{ type: "powerup", id: PowerupId3.SphereHunter },
|
|
8761
8920
|
// IT_ITEM_SPHERE_HUNTER
|
|
8762
|
-
{ type: "powerup", id:
|
|
8921
|
+
{ type: "powerup", id: PowerupId3.SphereDefender },
|
|
8763
8922
|
// IT_ITEM_SPHERE_DEFENDER
|
|
8764
|
-
{ type: "powerup", id:
|
|
8923
|
+
{ type: "powerup", id: PowerupId3.Doppelganger },
|
|
8765
8924
|
// IT_ITEM_DOPPELGANGER
|
|
8766
|
-
{ type: "powerup", id:
|
|
8925
|
+
{ type: "powerup", id: PowerupId3.TagToken },
|
|
8767
8926
|
// IT_ITEM_TAG_TOKEN
|
|
8768
8927
|
// Keys
|
|
8769
8928
|
{ type: "key", id: KeyId.DataCD },
|
|
@@ -8811,17 +8970,17 @@ var DEMO_ITEM_MAPPING = [
|
|
|
8811
8970
|
{ type: "key", id: KeyId.BlueFlag },
|
|
8812
8971
|
// IT_FLAG2
|
|
8813
8972
|
// Tech
|
|
8814
|
-
{ type: "powerup", id:
|
|
8973
|
+
{ type: "powerup", id: PowerupId3.TechResistance },
|
|
8815
8974
|
// IT_TECH_RESISTANCE
|
|
8816
|
-
{ type: "powerup", id:
|
|
8975
|
+
{ type: "powerup", id: PowerupId3.TechStrength },
|
|
8817
8976
|
// IT_TECH_STRENGTH
|
|
8818
|
-
{ type: "powerup", id:
|
|
8977
|
+
{ type: "powerup", id: PowerupId3.TechHaste },
|
|
8819
8978
|
// IT_TECH_HASTE
|
|
8820
|
-
{ type: "powerup", id:
|
|
8979
|
+
{ type: "powerup", id: PowerupId3.TechRegeneration },
|
|
8821
8980
|
// IT_TECH_REGENERATION
|
|
8822
|
-
{ type: "powerup", id:
|
|
8981
|
+
{ type: "powerup", id: PowerupId3.Flashlight },
|
|
8823
8982
|
// IT_ITEM_FLASHLIGHT
|
|
8824
|
-
{ type: "powerup", id:
|
|
8983
|
+
{ type: "powerup", id: PowerupId3.Compass }
|
|
8825
8984
|
// IT_ITEM_COMPASS
|
|
8826
8985
|
];
|
|
8827
8986
|
|
|
@@ -8838,6 +8997,7 @@ var ClientNetworkHandler = class {
|
|
|
8838
8997
|
// Stats for HUD
|
|
8839
8998
|
this.stats = new Array(32).fill(0);
|
|
8840
8999
|
this.inventory = new Array(256).fill(0);
|
|
9000
|
+
this.playerNum = 0;
|
|
8841
9001
|
this.imports = imports;
|
|
8842
9002
|
this.callbacks = callbacks;
|
|
8843
9003
|
}
|
|
@@ -8847,12 +9007,16 @@ var ClientNetworkHandler = class {
|
|
|
8847
9007
|
setCallbacks(callbacks) {
|
|
8848
9008
|
this.callbacks = callbacks;
|
|
8849
9009
|
}
|
|
9010
|
+
setView(view) {
|
|
9011
|
+
this.view = view;
|
|
9012
|
+
}
|
|
8850
9013
|
onServerData(protocol, serverCount, attractLoop, gameDir, playerNum, levelName) {
|
|
8851
9014
|
console.log(`Demo: Server Data - Protocol: ${protocol}, Level: ${levelName}`);
|
|
8852
9015
|
this.configstrings.fill("");
|
|
8853
9016
|
this.entities.clear();
|
|
8854
9017
|
this.baselines.clear();
|
|
8855
9018
|
this.latestFrame = null;
|
|
9019
|
+
this.playerNum = playerNum;
|
|
8856
9020
|
}
|
|
8857
9021
|
onConfigString(index, str3) {
|
|
8858
9022
|
this.configstrings[index] = str3;
|
|
@@ -8974,6 +9138,63 @@ var ClientNetworkHandler = class {
|
|
|
8974
9138
|
onMuzzleFlash2(ent, weapon) {
|
|
8975
9139
|
}
|
|
8976
9140
|
onMuzzleFlash3(ent, weapon) {
|
|
9141
|
+
const isLocalPlayer = ent === this.playerNum + 1;
|
|
9142
|
+
if (isLocalPlayer && this.view) {
|
|
9143
|
+
let pitch = 0;
|
|
9144
|
+
let yaw = 0;
|
|
9145
|
+
let roll = 0;
|
|
9146
|
+
let kickOrigin = ZERO_VEC3;
|
|
9147
|
+
const quad = G_GetPowerupStat(this.stats, PowerupId.QuadDamage);
|
|
9148
|
+
const scale3 = quad ? 4 : 1;
|
|
9149
|
+
switch (weapon) {
|
|
9150
|
+
case MZ_SHOTGUN:
|
|
9151
|
+
pitch = -2;
|
|
9152
|
+
kickOrigin = { x: -2, y: 0, z: 0 };
|
|
9153
|
+
break;
|
|
9154
|
+
case MZ_SSHOTGUN:
|
|
9155
|
+
pitch = -4;
|
|
9156
|
+
kickOrigin = { x: -4, y: 0, z: 0 };
|
|
9157
|
+
break;
|
|
9158
|
+
case MZ_MACHINEGUN:
|
|
9159
|
+
pitch = -1;
|
|
9160
|
+
yaw = Math.random() - 0.5;
|
|
9161
|
+
break;
|
|
9162
|
+
case MZ_CHAINGUN1:
|
|
9163
|
+
case MZ_CHAINGUN2:
|
|
9164
|
+
case MZ_CHAINGUN3:
|
|
9165
|
+
pitch = -0.5;
|
|
9166
|
+
yaw = Math.random() - 0.5;
|
|
9167
|
+
break;
|
|
9168
|
+
case MZ_RAILGUN:
|
|
9169
|
+
pitch = -3;
|
|
9170
|
+
kickOrigin = { x: -3, y: 0, z: 0 };
|
|
9171
|
+
break;
|
|
9172
|
+
case MZ_ROCKET:
|
|
9173
|
+
case MZ_GRENADE:
|
|
9174
|
+
pitch = -2;
|
|
9175
|
+
kickOrigin = { x: -2, y: 0, z: 0 };
|
|
9176
|
+
break;
|
|
9177
|
+
case MZ_BFG:
|
|
9178
|
+
pitch = -5;
|
|
9179
|
+
kickOrigin = { x: -2, y: 0, z: 0 };
|
|
9180
|
+
break;
|
|
9181
|
+
case MZ_HYPERBLASTER:
|
|
9182
|
+
case MZ_BLASTER:
|
|
9183
|
+
pitch = -0.5;
|
|
9184
|
+
break;
|
|
9185
|
+
}
|
|
9186
|
+
if (pitch !== 0 || yaw !== 0 || roll !== 0) {
|
|
9187
|
+
this.view.addKick({
|
|
9188
|
+
pitch: pitch * scale3,
|
|
9189
|
+
roll: roll * scale3,
|
|
9190
|
+
durationMs: 200,
|
|
9191
|
+
origin: kickOrigin
|
|
9192
|
+
// Should origin be scaled? Q2 source P_AddWeaponKick only scales angles.
|
|
9193
|
+
// But we have origin kick logic now. Let's assume origin kick is physical recoil and maybe doesn't scale with quad (magic damage)?
|
|
9194
|
+
// P_AddWeaponKick only scales kick_angles.
|
|
9195
|
+
});
|
|
9196
|
+
}
|
|
9197
|
+
}
|
|
8977
9198
|
if (this.callbacks?.onMuzzleFlash3) {
|
|
8978
9199
|
this.callbacks.onMuzzleFlash3(ent, weapon);
|
|
8979
9200
|
}
|
|
@@ -9090,6 +9311,7 @@ var ClientNetworkHandler = class {
|
|
|
9090
9311
|
// Stubs
|
|
9091
9312
|
stats: [...ps.stats],
|
|
9092
9313
|
kick_angles: ZERO_VEC3,
|
|
9314
|
+
kick_origin: ZERO_VEC3,
|
|
9093
9315
|
gunoffset: ZERO_VEC3,
|
|
9094
9316
|
gunangles: ZERO_VEC3,
|
|
9095
9317
|
gunindex: 0,
|
|
@@ -10453,7 +10675,7 @@ import {
|
|
|
10453
10675
|
ClientPrediction as ClientPrediction2,
|
|
10454
10676
|
interpolatePredictionState as interpolatePredictionState3
|
|
10455
10677
|
} from "@quake2ts/cgame";
|
|
10456
|
-
import { ViewEffects as
|
|
10678
|
+
import { ViewEffects as ViewEffects3 } from "@quake2ts/cgame";
|
|
10457
10679
|
var ZERO_VEC32 = { x: 0, y: 0, z: 0 };
|
|
10458
10680
|
function lerp2(a, b, t) {
|
|
10459
10681
|
return a + (b - a) * t;
|
|
@@ -10484,11 +10706,20 @@ function buildRenderableEntities(latestEntities, previousEntities, alpha, config
|
|
|
10484
10706
|
};
|
|
10485
10707
|
const frame = ent.frame;
|
|
10486
10708
|
const prevFrame = prev.frame;
|
|
10709
|
+
const scaleA = prev.scale !== void 0 ? prev.scale : 1;
|
|
10710
|
+
const scaleB = ent.scale !== void 0 ? ent.scale : 1;
|
|
10711
|
+
const scale3 = lerp2(scaleA, scaleB, alpha);
|
|
10712
|
+
const getAlpha = (val) => val === void 0 || val === 0 ? 255 : val;
|
|
10713
|
+
const alphaA = getAlpha(prev.alpha);
|
|
10714
|
+
const alphaB = getAlpha(ent.alpha);
|
|
10715
|
+
const alphaVal = lerp2(alphaA, alphaB, alpha);
|
|
10716
|
+
const normalizedAlpha = alphaVal / 255;
|
|
10487
10717
|
const mat = mat4_exports.create();
|
|
10488
10718
|
mat4_exports.translate(mat, mat, [origin.x, origin.y, origin.z]);
|
|
10489
10719
|
mat4_exports.rotateZ(mat, mat, angles.z * Math.PI / 180);
|
|
10490
10720
|
mat4_exports.rotateY(mat, mat, angles.y * Math.PI / 180);
|
|
10491
10721
|
mat4_exports.rotateX(mat, mat, angles.x * Math.PI / 180);
|
|
10722
|
+
mat4_exports.scale(mat, mat, [scale3, scale3, scale3]);
|
|
10492
10723
|
if (model.header.magic === 844121161) {
|
|
10493
10724
|
renderables.push({
|
|
10494
10725
|
type: "md2",
|
|
@@ -10500,7 +10731,8 @@ function buildRenderableEntities(latestEntities, previousEntities, alpha, config
|
|
|
10500
10731
|
lerp: alpha
|
|
10501
10732
|
},
|
|
10502
10733
|
transform: mat,
|
|
10503
|
-
skin: ent.skinNum > 0 ? configStrings.getImageName(ent.skinNum) : void 0
|
|
10734
|
+
skin: ent.skinNum > 0 ? configStrings.getImageName(ent.skinNum) : void 0,
|
|
10735
|
+
alpha: normalizedAlpha
|
|
10504
10736
|
});
|
|
10505
10737
|
} else if (model.header.magic === 860898377) {
|
|
10506
10738
|
renderables.push({
|
|
@@ -10511,7 +10743,8 @@ function buildRenderableEntities(latestEntities, previousEntities, alpha, config
|
|
|
10511
10743
|
frame1: frame,
|
|
10512
10744
|
lerp: alpha
|
|
10513
10745
|
},
|
|
10514
|
-
transform: mat
|
|
10746
|
+
transform: mat,
|
|
10747
|
+
alpha: normalizedAlpha
|
|
10515
10748
|
// Lighting? Skins?
|
|
10516
10749
|
});
|
|
10517
10750
|
}
|
|
@@ -10520,9 +10753,10 @@ function buildRenderableEntities(latestEntities, previousEntities, alpha, config
|
|
|
10520
10753
|
}
|
|
10521
10754
|
function createClient(imports) {
|
|
10522
10755
|
const prediction = new ClientPrediction(imports.engine.trace);
|
|
10523
|
-
const view = new
|
|
10756
|
+
const view = new ViewEffects2();
|
|
10524
10757
|
const demoPlayback = new DemoPlaybackController();
|
|
10525
10758
|
const demoHandler = new ClientNetworkHandler(imports);
|
|
10759
|
+
demoHandler.setView(view);
|
|
10526
10760
|
const menuSystem = new MenuSystem();
|
|
10527
10761
|
const loadingScreen = new LoadingScreen();
|
|
10528
10762
|
const errorDialog = new ErrorDialog();
|
|
@@ -10848,6 +11082,7 @@ function createClient(imports) {
|
|
|
10848
11082
|
// Ensure stats are safely initialized
|
|
10849
11083
|
stats: lastRendered.stats ? [...lastRendered.stats] : new Array(32).fill(0),
|
|
10850
11084
|
kick_angles: ZERO_VEC32,
|
|
11085
|
+
kick_origin: ZERO_VEC32,
|
|
10851
11086
|
gunoffset: ZERO_VEC32,
|
|
10852
11087
|
gunangles: ZERO_VEC32,
|
|
10853
11088
|
gunindex: 0,
|
|
@@ -10946,7 +11181,7 @@ export {
|
|
|
10946
11181
|
InputBindings,
|
|
10947
11182
|
InputCommandBuffer,
|
|
10948
11183
|
InputController,
|
|
10949
|
-
|
|
11184
|
+
ViewEffects3 as ViewEffects,
|
|
10950
11185
|
createClient,
|
|
10951
11186
|
createDefaultBindings,
|
|
10952
11187
|
interpolatePredictionState3 as interpolatePredictionState,
|