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.
@@ -15726,6 +15726,22 @@ function createClient(imports) {
15726
15726
  multiplayer.setDemoRecorder(demoRecorder);
15727
15727
  multiplayer.setEffectSystem(effectSystem);
15728
15728
  const multiplayerFactory = new MultiplayerMenuFactory(menuSystem, multiplayer);
15729
+ const processCdTrack = (trackStr) => {
15730
+ if (!imports.engine.audio) return;
15731
+ const track = parseInt(trackStr, 10);
15732
+ if (!isNaN(track)) {
15733
+ if (track >= 2) {
15734
+ if (imports.engine.audio.play_track) {
15735
+ void imports.engine.audio.play_track(track);
15736
+ } else {
15737
+ const trackName = `music/track${track.toString().padStart(2, "0")}.ogg`;
15738
+ void imports.engine.audio.play_music(trackName);
15739
+ }
15740
+ } else {
15741
+ imports.engine.audio.stop_music();
15742
+ }
15743
+ }
15744
+ };
15729
15745
  demoHandler.setCallbacks({
15730
15746
  onCenterPrint: (msg) => cg.ParseCenterPrint(msg, 0, false),
15731
15747
  onPrint: (level, msg) => {
@@ -15739,6 +15755,9 @@ function createClient(imports) {
15739
15755
  scoreboardManager.parseConfigString(index, str3);
15740
15756
  scoreboardManager.notifyUpdate();
15741
15757
  }
15758
+ if (index === ConfigStringIndex2.CdTrack) {
15759
+ processCdTrack(str3);
15760
+ }
15742
15761
  },
15743
15762
  onServerData: (protocol, tickRate) => {
15744
15763
  if (tickRate && tickRate > 0) {
@@ -16471,6 +16490,9 @@ function createClient(imports) {
16471
16490
  ParseConfigString(index, value) {
16472
16491
  configStrings.set(index, value);
16473
16492
  cg.ParseConfigString(index, value);
16493
+ if (index === ConfigStringIndex2.CdTrack) {
16494
+ processCdTrack(value);
16495
+ }
16474
16496
  },
16475
16497
  demoHandler,
16476
16498
  multiplayer,