quake2ts 0.0.289 → 0.0.291
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 +22 -12
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +22 -12
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/net/connection.d.ts +1 -0
- package/packages/client/dist/types/net/connection.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +16 -16
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +33 -35
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +33 -35
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/audio/constants.d.ts +1 -23
- package/packages/engine/dist/types/audio/constants.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +3 -3
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +65 -19
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +65 -19
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/monsters/actor.d.ts.map +1 -1
- package/packages/game/dist/types/entities/monsters/arachnid.d.ts.map +1 -1
- package/packages/game/dist/types/entities/system.d.ts +1 -0
- package/packages/game/dist/types/entities/system.d.ts.map +1 -1
- package/packages/game/dist/types/index.d.ts +2 -0
- package/packages/game/dist/types/index.d.ts.map +1 -1
- 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 +53 -0
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +42 -0
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/audio/constants.d.ts +24 -0
- package/packages/shared/dist/types/audio/constants.d.ts.map +1 -0
- package/packages/shared/dist/types/index.d.ts +1 -0
- package/packages/shared/dist/types/index.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -1120,6 +1120,35 @@ var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
|
|
|
1120
1120
|
return AmmoType2;
|
|
1121
1121
|
})(AmmoType || {});
|
|
1122
1122
|
var AMMO_TYPE_COUNT = Object.keys(AmmoType).length / 2;
|
|
1123
|
+
var MAX_SOUND_CHANNELS = 32;
|
|
1124
|
+
var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
|
|
1125
|
+
SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
|
|
1126
|
+
SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
|
|
1127
|
+
SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
|
|
1128
|
+
SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
|
|
1129
|
+
SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
|
|
1130
|
+
SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
|
|
1131
|
+
SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
|
|
1132
|
+
SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
|
|
1133
|
+
SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
|
|
1134
|
+
SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
|
|
1135
|
+
SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
|
|
1136
|
+
return SoundChannel2;
|
|
1137
|
+
})(SoundChannel || {});
|
|
1138
|
+
var ATTN_LOOP_NONE = -1;
|
|
1139
|
+
var ATTN_NONE = 0;
|
|
1140
|
+
var ATTN_NORM = 1;
|
|
1141
|
+
var ATTN_IDLE = 2;
|
|
1142
|
+
var ATTN_STATIC = 3;
|
|
1143
|
+
var SOUND_FULLVOLUME = 80;
|
|
1144
|
+
var SOUND_LOOP_ATTENUATE = 3e-3;
|
|
1145
|
+
function attenuationToDistanceMultiplier(attenuation) {
|
|
1146
|
+
return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
|
|
1147
|
+
}
|
|
1148
|
+
function calculateMaxAudibleDistance(attenuation) {
|
|
1149
|
+
const distMult = attenuationToDistanceMultiplier(attenuation);
|
|
1150
|
+
return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
|
|
1151
|
+
}
|
|
1123
1152
|
|
|
1124
1153
|
// src/cvars.ts
|
|
1125
1154
|
var Cvar = class {
|
|
@@ -3970,37 +3999,6 @@ var AssetManager = class {
|
|
|
3970
3999
|
}
|
|
3971
4000
|
};
|
|
3972
4001
|
|
|
3973
|
-
// src/audio/constants.ts
|
|
3974
|
-
var MAX_SOUND_CHANNELS = 32;
|
|
3975
|
-
var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
|
|
3976
|
-
SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
|
|
3977
|
-
SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
|
|
3978
|
-
SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
|
|
3979
|
-
SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
|
|
3980
|
-
SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
|
|
3981
|
-
SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
|
|
3982
|
-
SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
|
|
3983
|
-
SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
|
|
3984
|
-
SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
|
|
3985
|
-
SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
|
|
3986
|
-
SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
|
|
3987
|
-
return SoundChannel2;
|
|
3988
|
-
})(SoundChannel || {});
|
|
3989
|
-
var ATTN_LOOP_NONE = -1;
|
|
3990
|
-
var ATTN_NONE = 0;
|
|
3991
|
-
var ATTN_NORM = 1;
|
|
3992
|
-
var ATTN_IDLE = 2;
|
|
3993
|
-
var ATTN_STATIC = 3;
|
|
3994
|
-
var SOUND_FULLVOLUME = 80;
|
|
3995
|
-
var SOUND_LOOP_ATTENUATE = 3e-3;
|
|
3996
|
-
function attenuationToDistanceMultiplier(attenuation) {
|
|
3997
|
-
return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
|
|
3998
|
-
}
|
|
3999
|
-
function calculateMaxAudibleDistance(attenuation) {
|
|
4000
|
-
const distMult = attenuationToDistanceMultiplier(attenuation);
|
|
4001
|
-
return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
|
|
4002
|
-
}
|
|
4003
|
-
|
|
4004
4002
|
// src/audio/context.ts
|
|
4005
4003
|
var AudioContextController = class {
|
|
4006
4004
|
constructor(factory) {
|
|
@@ -4126,7 +4124,7 @@ var baseChannel = (entchannel) => entchannel & CHANNEL_MASK;
|
|
|
4126
4124
|
function createInitialChannels(playerEntity) {
|
|
4127
4125
|
return Array.from({ length: MAX_SOUND_CHANNELS }, () => ({
|
|
4128
4126
|
entnum: 0,
|
|
4129
|
-
entchannel:
|
|
4127
|
+
entchannel: SoundChannel.Auto,
|
|
4130
4128
|
endTimeMs: 0,
|
|
4131
4129
|
isPlayer: false,
|
|
4132
4130
|
active: false
|
|
@@ -4142,7 +4140,7 @@ function pickChannel(channels, entnum, entchannel, context) {
|
|
|
4142
4140
|
for (let i = 0; i < channels.length; i += 1) {
|
|
4143
4141
|
const channel = channels[i];
|
|
4144
4142
|
const channelBase = baseChannel(channel.entchannel);
|
|
4145
|
-
if (normalizedEntchannel !==
|
|
4143
|
+
if (normalizedEntchannel !== SoundChannel.Auto && channel.entnum === entnum && channelBase === normalizedEntchannel) {
|
|
4146
4144
|
firstToDie = i;
|
|
4147
4145
|
break;
|
|
4148
4146
|
}
|
|
@@ -4304,7 +4302,7 @@ var AudioSystem = class {
|
|
|
4304
4302
|
positionedSound(origin, soundIndex, volume, attenuation) {
|
|
4305
4303
|
return this.play({
|
|
4306
4304
|
entity: 0,
|
|
4307
|
-
channel:
|
|
4305
|
+
channel: SoundChannel.Auto,
|
|
4308
4306
|
soundIndex,
|
|
4309
4307
|
volume,
|
|
4310
4308
|
attenuation,
|
|
@@ -4314,7 +4312,7 @@ var AudioSystem = class {
|
|
|
4314
4312
|
ambientSound(origin, soundIndex, volume) {
|
|
4315
4313
|
return this.play({
|
|
4316
4314
|
entity: 0,
|
|
4317
|
-
channel:
|
|
4315
|
+
channel: SoundChannel.Auto,
|
|
4318
4316
|
soundIndex,
|
|
4319
4317
|
volume,
|
|
4320
4318
|
attenuation: ATTN_NONE,
|