string autocvar__hud_panelorder;
float autocvar__menu_alpha;
string autocvar_accuracy_color_levels;
-float autocvar_bgmvolume;
+float autocvar_musicvolume;
float autocvar_camera_chase_smoothly;
float autocvar_camera_enable;
float autocvar_camera_forward_follows;
-float music_disabled;
entity music_default;
entity music_target;
entity music_trigger;
-// FIXME also control bgmvolume here, to not require a target_music for the default track.
.float state;
.float lastvol;
else
e.state = 0;
}
- vol = e.state * e.volume * autocvar_bgmvolume;
+ vol = e.state * e.volume * autocvar_musicvolume;
if(vol != vol0)
{
- if(vol0 < 0)
+ if(e.noise == "")
+ cvar_set("bgmvolume", ftos(vol));
+ else if(vol0 < 0)
sound(e, CH_BGM_SINGLE, e.noise, vol, ATTN_NONE); // restart
else
sound(e, CH_BGM_SINGLE, "", vol, ATTN_NONE);
bgmtime = gettime(GETTIME_CDTRACK);
}
+void Init_TargetMusic()
+{
+ music_default = spawn();
+ music_default.enttype = ENT_CLIENT_TRIGGER_MUSIC;
+ music_default.count = 0;
+ music_default.noise = "";
+ music_default.volume = 1;
+ music_default.fade_time = 2;
+ music_default.fade_rate = 2;
+ music_default.state = 2;
+}
+
void Net_TargetMusic()
{
float vol, fai, fao, tim, id;
if(tim == 0)
{
music_default = e;
- 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;
- }
}
else
{
me.TD(me, 1, 2, s);
me.TR(me);
me.TDempty(me, 0.2);
- s = makeXonoticDecibelsSlider(-40, 0, 0.4, "bgmvolume");
- makeMulti(s, "snd_channel8volume");
+ s = makeXonoticDecibelsSlider(-40, 0, 0.4, "musicvolume");
+#ifdef COMPAT_XON070_BGMVOLUME
+ makeMulti(s, "bgmvolume");
+#endif
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Music:")));
me.TD(me, 1, 2, s);
setDependentStringNotEqual(e, "mastervolume", "0");