X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Ftarget_music.qc;h=77cb2536eccad2d9e800b2f58695f049b0f5c81b;hb=cb6fe34871089613c9f47e173b38fc679cd8e45b;hp=a7a46d80ad5788c19e58e649c7d25c0a147b1376;hpb=992529cda6e328df91113b580eae2f1b3ef0cdfd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/target_music.qc b/qcsrc/client/target_music.qc index a7a46d80a..77cb2536e 100644 --- a/qcsrc/client/target_music.qc +++ b/qcsrc/client/target_music.qc @@ -19,7 +19,7 @@ void TargetMusic_Advance() for(e = world; (e = findfloat(e, enttype, ENT_CLIENT_TRIGGER_MUSIC)); ) if(e.noise) { vol0 = e.lastvol; - if(getsoundtime(e, CHAN_VOICE) < 0) + if(getsoundtime(e, CH_BGM_SINGLE) < 0) { vol0 = -1; } @@ -39,17 +39,22 @@ void TargetMusic_Advance() else e.state = 0; } - vol = e.state * e.volume * cvar("bgmvolume"); + vol = e.state * e.volume * autocvar_bgmvolume; if(vol != vol0) { if(vol0 < 0) - sound(e, CHAN_VOICE, e.noise, vol, ATTN_NONE); // restart + sound(e, CH_BGM_SINGLE, e.noise, vol, ATTN_NONE); // restart else - sound(e, CHAN_VOICE, "", vol, ATTN_NONE); + sound(e, CH_BGM_SINGLE, "", vol, ATTN_NONE); e.lastvol = vol; } } music_trigger = world; + + if(best) + bgmtime = getsoundtime(best, CH_BGM_SINGLE); + else + bgmtime = gettime(GETTIME_CDTRACK); } void Net_TargetMusic() @@ -82,10 +87,10 @@ void Net_TargetMusic() strunzone(e.noise); e.noise = strzone(noi); precache_sound(e.noise); - sound(e, CHAN_VOICE, e.noise, 0, ATTN_NONE); - if(getsoundtime(e, CHAN_VOICE) < 0) + sound(e, CH_BGM_SINGLE, e.noise, 0, ATTN_NONE); + if(getsoundtime(e, CH_BGM_SINGLE) < 0) { - print("Cannot initialize sound ", e.noise, "\n"); + print(sprintf(_("Cannot initialize sound %s\n"), e.noise)); strunzone(e.noise); e.noise = string_null; } @@ -101,6 +106,7 @@ void Net_TargetMusic() if(!music_disabled) { e.state = 2; + cvar_settemp("music_playlist_index", "-1"); // don't use playlists localcmd("cd stop\n"); // just in case music_disabled = 1; } @@ -170,10 +176,10 @@ void Ent_ReadTriggerMusic() if(self.noise != s) { precache_sound(self.noise); - sound(self, CHAN_VOICE, self.noise, 0, ATTN_NONE); - if(getsoundtime(self, CHAN_VOICE) < 0) + sound(self, CH_BGM_SINGLE, self.noise, 0, ATTN_NONE); + if(getsoundtime(self, CH_BGM_SINGLE) < 0) { - print("Cannot initialize sound ", self.noise, "\n"); + print(sprintf(_("Cannot initialize sound %s\n"), self.noise)); strunzone(self.noise); self.noise = string_null; }