From: Rudolf Polzer Date: Thu, 6 May 2010 06:43:26 +0000 (+0200) Subject: properly loop the track (needs the getsoundtime function!) X-Git-Tag: xonotic-v0.1.0preview~640^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a1499ddab0e1f69625aca53767776d931dff0fc1;p=xonotic%2Fxonotic-data.pk3dir.git properly loop the track (needs the getsoundtime function!) --- diff --git a/config_update.cfg b/config_update.cfg index 0143318be..372784dd7 100644 --- a/config_update.cfg +++ b/config_update.cfg @@ -20,3 +20,6 @@ _update_configversion_$g_configversion _update_generic set g_configversion 2 + +// we now use mastervolume +volume 1 diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index d373f9964..35abf9dbe 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1810,3 +1810,6 @@ seta cl_autodemo_delete_keeprecords 0 "when 1, records with a newly made race/ct // freeze camera set cl_lockview 0 "when 1, the camera does not move any more" + +// we now use mastervolume +volume 1 diff --git a/qcsrc/client/csqc_builtins.qc b/qcsrc/client/csqc_builtins.qc index d3e42cd98..c108a4ca0 100644 --- a/qcsrc/client/csqc_builtins.qc +++ b/qcsrc/client/csqc_builtins.qc @@ -308,3 +308,5 @@ float PI = 3.14159265358979323846264338327950288419716939937510582097494459 float log(float f) = #532; void(entity e, entity ignore) tracetoss = #64; + +float(entity e, float ch) getsoundtime = #533; // (DP_SND_GETSOUNDTIME) diff --git a/qcsrc/client/target_music.qc b/qcsrc/client/target_music.qc index 97faf6790..03cedcd81 100644 --- a/qcsrc/client/target_music.qc +++ b/qcsrc/client/target_music.qc @@ -17,6 +17,10 @@ void TargetMusic_Advance() for(e = world; (e = findfloat(e, enttype, ENT_CLIENT_TRIGGER_MUSIC)); ) { s0 = e.state; + if(getsoundtime(e, CHAN_VOICE) < 0) + { + s0 = -1; + } if(e == best) { // increase volume @@ -35,7 +39,10 @@ void TargetMusic_Advance() } if(e.state != s0) { - sound(e, CHAN_VOICE, "", e.volume * e.state * cvar("bgmvolume"), ATTN_NONE); + if(s0 < 0) + sound(e, CHAN_VOICE, e.noise, e.volume * e.state * cvar("bgmvolume"), ATTN_NONE); // restart + else + sound(e, CHAN_VOICE, "", e.volume * e.state * cvar("bgmvolume"), ATTN_NONE); } } music_trigger = world;