properly loop the track (needs the getsoundtime function!)
authorRudolf Polzer <divverent@alientrap.org>
Thu, 6 May 2010 06:43:26 +0000 (08:43 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 6 May 2010 06:43:26 +0000 (08:43 +0200)
config_update.cfg
defaultXonotic.cfg
qcsrc/client/csqc_builtins.qc
qcsrc/client/target_music.qc

index 0143318..372784d 100644 (file)
@@ -20,3 +20,6 @@ _update_configversion_$g_configversion
 _update_generic
 
 set g_configversion 2
+
+// we now use mastervolume
+volume 1
index d373f99..35abf9d 100644 (file)
@@ -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
index d3e42cd..c108a4c 100644 (file)
@@ -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)
index 97faf67..03cedcd 100644 (file)
@@ -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;