From: Rudolf Polzer Date: Fri, 2 Aug 2013 10:31:16 +0000 (+0200) Subject: rename bgmvolume -> musicvolume; make bgmvolume controlled by target_music too. Prere... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=12f6661306dc18016713a9fc6a4ce6c771e76097;p=xonotic%2Fxonotic-data.pk3dir.git rename bgmvolume -> musicvolume; make bgmvolume controlled by target_music too. Prerequisite for music playlists. --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index c392e9a15..b2d36a476 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -85,7 +85,7 @@ freelook 1 sensitivity 6 v_gamma 1 viewsize 100 -bgmvolume 1 +seta musicvolume 1 volume 0.5 // fullscreen 1024x768x32bit vid_bitsperpixel 32 diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 8175695ab..0239dddda 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -3,7 +3,7 @@ float autocvar__hud_configure; 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; diff --git a/qcsrc/client/bgmscript.qc b/qcsrc/client/bgmscript.qc index 694bc0cc6..b71f1aca6 100644 --- a/qcsrc/client/bgmscript.qc +++ b/qcsrc/client/bgmscript.qc @@ -173,7 +173,7 @@ float BGMScript(entity e) if(e.bgmscript == "") return 1; - if(autocvar_bgmvolume <= 0) + if(autocvar_musicvolume <= 0) return -1; e.just_toggled = FALSE; diff --git a/qcsrc/client/target_music.qc b/qcsrc/client/target_music.qc index 4bbbf03bc..6ae591d77 100644 --- a/qcsrc/client/target_music.qc +++ b/qcsrc/client/target_music.qc @@ -1,8 +1,6 @@ -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; @@ -40,10 +38,12 @@ void TargetMusic_Advance() 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); @@ -58,6 +58,18 @@ void TargetMusic_Advance() 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; @@ -104,13 +116,6 @@ void Net_TargetMusic() 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 { diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index 1c2c1cc9f..0a740b168 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -12,6 +12,7 @@ //# define COMPAT_XON050_ENGINE # define COMPAT_NO_MOD_IS_XONOTIC # define COMPAT_XON060_DONTCRASH_CHECKPVS +# define COMPAT_XON070_BGMVOLUME #endif #ifdef FTEQCC diff --git a/qcsrc/menu/xonotic/dialog_settings_audio.c b/qcsrc/menu/xonotic/dialog_settings_audio.c index 108b984a1..cd17f3c8b 100644 --- a/qcsrc/menu/xonotic/dialog_settings_audio.c +++ b/qcsrc/menu/xonotic/dialog_settings_audio.c @@ -28,8 +28,10 @@ void XonoticAudioSettingsTab_fill(entity me) 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");