quake2ts 0.0.228 → 0.0.230

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +11 -11
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +98 -11
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +98 -11
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/client/dist/types/demo/handler.d.ts +6 -0
  10. package/packages/client/dist/types/demo/handler.d.ts.map +1 -1
  11. package/packages/engine/dist/browser/index.global.js +9 -9
  12. package/packages/engine/dist/browser/index.global.js.map +1 -1
  13. package/packages/engine/dist/cjs/index.cjs +81 -11
  14. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  15. package/packages/engine/dist/esm/index.js +80 -11
  16. package/packages/engine/dist/esm/index.js.map +1 -1
  17. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  18. package/packages/engine/dist/types/demo/parser.d.ts +26 -0
  19. package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
  20. package/packages/engine/dist/types/index.d.ts +1 -1
  21. package/packages/engine/dist/types/index.d.ts.map +1 -1
  22. package/packages/engine/dist/types/render/bsp/geometry.d.ts +1 -0
  23. package/packages/engine/dist/types/render/bsp/geometry.d.ts.map +1 -1
  24. package/packages/engine/dist/types/render/bsp/renderer.d.ts +2 -0
  25. package/packages/engine/dist/types/render/bsp/renderer.d.ts.map +1 -1
  26. package/packages/engine/dist/types/render/lightStyles.d.ts +10 -0
  27. package/packages/engine/dist/types/render/lightStyles.d.ts.map +1 -0
  28. package/packages/game/dist/browser/index.global.js +2 -2
  29. package/packages/game/dist/browser/index.global.js.map +1 -1
  30. package/packages/game/dist/cjs/index.cjs +13 -0
  31. package/packages/game/dist/cjs/index.cjs.map +1 -1
  32. package/packages/game/dist/esm/index.js +13 -0
  33. package/packages/game/dist/esm/index.js.map +1 -1
  34. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  35. package/packages/shared/dist/browser/index.global.js +1 -1
  36. package/packages/shared/dist/browser/index.global.js.map +1 -1
  37. package/packages/shared/dist/cjs/index.cjs +13 -0
  38. package/packages/shared/dist/cjs/index.cjs.map +1 -1
  39. package/packages/shared/dist/esm/index.js +13 -0
  40. package/packages/shared/dist/esm/index.js.map +1 -1
  41. package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
  42. package/packages/shared/dist/types/protocol/entityState.d.ts +11 -0
  43. package/packages/shared/dist/types/protocol/entityState.d.ts.map +1 -1
  44. package/packages/shared/dist/types/protocol/ops.d.ts +14 -1
  45. package/packages/shared/dist/types/protocol/ops.d.ts.map +1 -1
  46. package/packages/shared/dist/types/protocol/player-state.d.ts +4 -0
  47. package/packages/shared/dist/types/protocol/player-state.d.ts.map +1 -1
  48. package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
@@ -2082,6 +2082,19 @@ var ServerCommand = /* @__PURE__ */ ((ServerCommand2) => {
2082
2082
  ServerCommand2[ServerCommand2["packetentities"] = 18] = "packetentities";
2083
2083
  ServerCommand2[ServerCommand2["deltapacketentities"] = 19] = "deltapacketentities";
2084
2084
  ServerCommand2[ServerCommand2["frame"] = 20] = "frame";
2085
+ ServerCommand2[ServerCommand2["splitclient"] = 21] = "splitclient";
2086
+ ServerCommand2[ServerCommand2["configblast"] = 22] = "configblast";
2087
+ ServerCommand2[ServerCommand2["spawnbaselineblast"] = 23] = "spawnbaselineblast";
2088
+ ServerCommand2[ServerCommand2["level_restart"] = 24] = "level_restart";
2089
+ ServerCommand2[ServerCommand2["damage"] = 25] = "damage";
2090
+ ServerCommand2[ServerCommand2["locprint"] = 26] = "locprint";
2091
+ ServerCommand2[ServerCommand2["fog"] = 27] = "fog";
2092
+ ServerCommand2[ServerCommand2["waitingforplayers"] = 28] = "waitingforplayers";
2093
+ ServerCommand2[ServerCommand2["bot_chat"] = 29] = "bot_chat";
2094
+ ServerCommand2[ServerCommand2["poi"] = 30] = "poi";
2095
+ ServerCommand2[ServerCommand2["help_path"] = 31] = "help_path";
2096
+ ServerCommand2[ServerCommand2["muzzleflash3"] = 32] = "muzzleflash3";
2097
+ ServerCommand2[ServerCommand2["achievement"] = 33] = "achievement";
2085
2098
  return ServerCommand2;
2086
2099
  })(ServerCommand || {});
2087
2100
  var TempEntity = /* @__PURE__ */ ((TempEntity2) => {
@@ -2856,6 +2869,7 @@ var U_OLDORIGIN = 1 << 24;
2856
2869
  var U_SKIN16 = 1 << 25;
2857
2870
  var U_SOUND2 = 1 << 26;
2858
2871
  var U_SOLID2 = 1 << 27;
2872
+ var U_ALPHA = 1 << 13;
2859
2873
  var RECORD_CLIENT = 1;
2860
2874
  var RECORD_SERVER = 2;
2861
2875
  var RECORD_RELAY = 128;
@@ -2875,7 +2889,14 @@ var createEmptyEntityState = () => ({
2875
2889
  sound: 0,
2876
2890
  event: 0,
2877
2891
  solid: 0,
2878
- bits: 0
2892
+ bits: 0,
2893
+ alpha: 0,
2894
+ scale: 0,
2895
+ instanceBits: 0,
2896
+ loopVolume: 0,
2897
+ loopAttenuation: 0,
2898
+ owner: 0,
2899
+ oldFrame: 0
2879
2900
  });
2880
2901
  var createEmptyProtocolPlayerState = () => ({
2881
2902
  pm_type: 0,
@@ -2895,7 +2916,11 @@ var createEmptyProtocolPlayerState = () => ({
2895
2916
  blend: [0, 0, 0, 0],
2896
2917
  fov: 0,
2897
2918
  rdflags: 0,
2898
- stats: new Array(32).fill(0)
2919
+ stats: new Array(32).fill(0),
2920
+ gunskin: 0,
2921
+ gunrate: 0,
2922
+ damage_blend: [0, 0, 0, 0],
2923
+ team_id: 0
2899
2924
  });
2900
2925
  var NetworkMessageParser = class {
2901
2926
  constructor(stream, handler) {
@@ -2906,17 +2931,11 @@ var NetworkMessageParser = class {
2906
2931
  }
2907
2932
  translateCommand(cmd) {
2908
2933
  if (this.protocolVersion === 0) {
2909
- if (cmd === 7) {
2910
- return ServerCommand.serverdata;
2911
- }
2912
- if (cmd === 12) {
2913
- return ServerCommand.serverdata;
2914
- }
2934
+ if (cmd === 7) return ServerCommand.serverdata;
2935
+ if (cmd === 12) return ServerCommand.serverdata;
2915
2936
  }
2916
2937
  if (this.protocolVersion === 25) {
2917
- if (cmd >= 7 && cmd <= 15) {
2918
- return cmd + 5;
2919
- }
2938
+ if (cmd >= 7 && cmd <= 15) return cmd + 5;
2920
2939
  if (cmd === 1) return ServerCommand.print;
2921
2940
  if (cmd === 2) return ServerCommand.stufftext;
2922
2941
  if (cmd === 3) return ServerCommand.sound;
@@ -2940,8 +2959,10 @@ var NetworkMessageParser = class {
2940
2959
  case ServerCommand.nop:
2941
2960
  break;
2942
2961
  case ServerCommand.disconnect:
2962
+ if (this.handler && this.handler.onDisconnect) this.handler.onDisconnect();
2943
2963
  break;
2944
2964
  case ServerCommand.reconnect:
2965
+ if (this.handler && this.handler.onReconnect) this.handler.onReconnect();
2945
2966
  break;
2946
2967
  case ServerCommand.print:
2947
2968
  this.parsePrint();
@@ -2994,6 +3015,36 @@ var NetworkMessageParser = class {
2994
3015
  case ServerCommand.temp_entity:
2995
3016
  this.parseTempEntity();
2996
3017
  break;
3018
+ // New Rerelease Commands
3019
+ case ServerCommand.splitclient:
3020
+ break;
3021
+ case ServerCommand.configblast:
3022
+ break;
3023
+ case ServerCommand.spawnbaselineblast:
3024
+ break;
3025
+ case ServerCommand.level_restart:
3026
+ if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
3027
+ break;
3028
+ case ServerCommand.damage:
3029
+ break;
3030
+ case ServerCommand.locprint:
3031
+ break;
3032
+ case ServerCommand.fog:
3033
+ break;
3034
+ case ServerCommand.waitingforplayers:
3035
+ if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
3036
+ break;
3037
+ case ServerCommand.bot_chat:
3038
+ break;
3039
+ case ServerCommand.poi:
3040
+ break;
3041
+ case ServerCommand.help_path:
3042
+ break;
3043
+ case ServerCommand.muzzleflash3:
3044
+ this.parseMuzzleFlash3();
3045
+ break;
3046
+ case ServerCommand.achievement:
3047
+ break;
2997
3048
  default:
2998
3049
  console.warn(`Unknown server command: ${originalCmd} (translated: ${cmd}) at offset ${this.stream.getPosition() - 1}`);
2999
3050
  return;
@@ -3007,15 +3058,27 @@ var NetworkMessageParser = class {
3007
3058
  parsePrint() {
3008
3059
  const id = this.stream.readByte();
3009
3060
  const str3 = this.stream.readString();
3061
+ if (this.handler) {
3062
+ this.handler.onPrint(id, str3);
3063
+ }
3010
3064
  }
3011
3065
  parseStuffText() {
3012
3066
  const text = this.stream.readString();
3067
+ if (this.handler) {
3068
+ this.handler.onStuffText(text);
3069
+ }
3013
3070
  }
3014
3071
  parseLayout() {
3015
3072
  const layout = this.stream.readString();
3073
+ if (this.handler) {
3074
+ this.handler.onLayout(layout);
3075
+ }
3016
3076
  }
3017
3077
  parseCenterPrint() {
3018
3078
  const centerMsg = this.stream.readString();
3079
+ if (this.handler) {
3080
+ this.handler.onCenterPrint(centerMsg);
3081
+ }
3019
3082
  }
3020
3083
  parseServerData() {
3021
3084
  this.protocolVersion = this.stream.readLong();
@@ -3098,6 +3161,11 @@ var NetworkMessageParser = class {
3098
3161
  const weapon = this.stream.readByte();
3099
3162
  if (this.handler) this.handler.onMuzzleFlash2(ent, weapon);
3100
3163
  }
3164
+ parseMuzzleFlash3() {
3165
+ const ent = this.stream.readShort();
3166
+ const weapon = this.stream.readShort();
3167
+ if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
3168
+ }
3101
3169
  parseTempEntity() {
3102
3170
  const type = this.stream.readByte();
3103
3171
  const pos = { x: 0, y: 0, z: 0 };
@@ -4473,6 +4541,13 @@ var ClientNetworkHandler = class {
4473
4541
  if (bits & U_SOUND2) to.sound = from.sound;
4474
4542
  if (bits & U_EVENT2) to.event = from.event;
4475
4543
  if (bits & U_SOLID2) to.solid = from.solid;
4544
+ if (from.alpha !== 0) to.alpha = from.alpha;
4545
+ if (from.scale !== 0) to.scale = from.scale;
4546
+ if (from.instanceBits !== 0) to.instanceBits = from.instanceBits;
4547
+ if (from.loopVolume !== 0) to.loopVolume = from.loopVolume;
4548
+ if (from.loopAttenuation !== 0) to.loopAttenuation = from.loopAttenuation;
4549
+ if (from.owner !== 0) to.owner = from.owner;
4550
+ if (from.oldFrame !== 0) to.oldFrame = from.oldFrame;
4476
4551
  }
4477
4552
  onCenterPrint(msg) {
4478
4553
  if (this.callbacks?.onCenterPrint) {
@@ -4516,6 +4591,18 @@ var ClientNetworkHandler = class {
4516
4591
  }
4517
4592
  onMuzzleFlash2(ent, weapon) {
4518
4593
  }
4594
+ onMuzzleFlash3(ent, weapon) {
4595
+ if (this.callbacks?.onMuzzleFlash3) {
4596
+ this.callbacks.onMuzzleFlash3(ent, weapon);
4597
+ }
4598
+ }
4599
+ // New Rerelease Handlers (Stubbed)
4600
+ onLevelRestart() {
4601
+ if (this.callbacks?.onLevelRestart) this.callbacks.onLevelRestart();
4602
+ }
4603
+ onWaitingForPlayers() {
4604
+ if (this.callbacks?.onWaitingForPlayers) this.callbacks.onWaitingForPlayers();
4605
+ }
4519
4606
  onDisconnect() {
4520
4607
  console.log("Demo disconnected");
4521
4608
  }