quake2ts 0.0.483 → 0.0.484

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.
@@ -15759,6 +15759,22 @@ function createClient(imports) {
15759
15759
  multiplayer.setDemoRecorder(demoRecorder);
15760
15760
  multiplayer.setEffectSystem(effectSystem);
15761
15761
  const multiplayerFactory = new MultiplayerMenuFactory(menuSystem, multiplayer);
15762
+ const processCdTrack = (trackStr) => {
15763
+ if (!imports.engine.audio) return;
15764
+ const track = parseInt(trackStr, 10);
15765
+ if (!isNaN(track)) {
15766
+ if (track >= 2) {
15767
+ if (imports.engine.audio.play_track) {
15768
+ void imports.engine.audio.play_track(track);
15769
+ } else {
15770
+ const trackName = `music/track${track.toString().padStart(2, "0")}.ogg`;
15771
+ void imports.engine.audio.play_music(trackName);
15772
+ }
15773
+ } else {
15774
+ imports.engine.audio.stop_music();
15775
+ }
15776
+ }
15777
+ };
15762
15778
  demoHandler.setCallbacks({
15763
15779
  onCenterPrint: (msg) => cg.ParseCenterPrint(msg, 0, false),
15764
15780
  onPrint: (level, msg) => {
@@ -15772,6 +15788,9 @@ function createClient(imports) {
15772
15788
  scoreboardManager.parseConfigString(index, str3);
15773
15789
  scoreboardManager.notifyUpdate();
15774
15790
  }
15791
+ if (index === ConfigStringIndex2.CdTrack) {
15792
+ processCdTrack(str3);
15793
+ }
15775
15794
  },
15776
15795
  onServerData: (protocol, tickRate) => {
15777
15796
  if (tickRate && tickRate > 0) {
@@ -16504,6 +16523,9 @@ function createClient(imports) {
16504
16523
  ParseConfigString(index, value) {
16505
16524
  configStrings.set(index, value);
16506
16525
  cg.ParseConfigString(index, value);
16526
+ if (index === ConfigStringIndex2.CdTrack) {
16527
+ processCdTrack(value);
16528
+ }
16507
16529
  },
16508
16530
  demoHandler,
16509
16531
  multiplayer,