]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/target/music.qc
Merge branch 'TimePath/globalforces' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / target / music.qc
index cbc584d863e2316335c19a14317258c174e690a0..ff195f03f9bff35a12f6adad94dfe66e1cec8656 100644 (file)
@@ -39,9 +39,9 @@ void target_music_kill()
        FOREACH_ENTITY_CLASS("target_music", true, {
                it.volume = 0;
         if (it.targetname == "")
-            WITHSELF(it, target_music_sendto(it, MSG_ALL, 1));
+            target_music_sendto(it, MSG_ALL, 1);
         else
-            WITHSELF(it, target_music_sendto(it, MSG_ALL, 0));
+            target_music_sendto(it, MSG_ALL, 0);
        });
 }
 void target_music_use(entity this, entity actor, entity trigger)
@@ -70,14 +70,14 @@ spawnfunc(target_music)
                target_music_sendto(this, MSG_INIT, 0);
 }
 void TargetMusic_RestoreGame()
-{SELFPARAM();
-       for(entity e = world; (e = find(e, classname, "target_music")); )
+{
+       FOREACH_ENTITY_CLASS("target_music", true,
        {
-               if(e.targetname == "")
-                       target_music_sendto(e, MSG_INIT, 1);
+               if(it.targetname == "")
+                       target_music_sendto(it, MSG_INIT, 1);
                else
-                       target_music_sendto(e, MSG_INIT, 0);
-       }
+                       target_music_sendto(it, MSG_INIT, 0);
+       });
 }
 // values:
 //   volume
@@ -188,7 +188,7 @@ void TargetMusic_Advance()
                        it.lastvol = vol;
                }
        });
-       music_trigger = world;
+       music_trigger = NULL;
        bgmtime = (best) ? getsoundtime(best, CH_BGM_SINGLE) : gettime(GETTIME_CDTRACK);
 }
 
@@ -223,7 +223,7 @@ void Net_TargetMusic()
                _sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
                if(getsoundtime(e, CH_BGM_SINGLE) < 0)
                {
-                       LOG_TRACEF("Cannot initialize sound %s\n", e.noise);
+                       LOG_TRACEF("Cannot initialize sound %s", e.noise);
                        strunzone(e.noise);
                        e.noise = string_null;
                }
@@ -252,20 +252,20 @@ void Net_TargetMusic()
        }
 }
 
-void Ent_TriggerMusic_Think()
-{SELFPARAM();
-       if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
+void Ent_TriggerMusic_Think(entity this)
+{
+       if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, this, NULL))
        {
-               music_trigger = self;
+               music_trigger = this;
        }
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
-void Ent_TriggerMusic_Remove()
-{SELFPARAM();
-       if(self.noise)
-               strunzone(self.noise);
-       self.noise = string_null;
+void Ent_TriggerMusic_Remove(entity this)
+{
+       if(this.noise)
+               strunzone(this.noise);
+       this.noise = string_null;
 }
 
 NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
@@ -310,7 +310,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
                        _sound(this, CH_BGM_SINGLE, this.noise, 0, ATTEN_NONE);
                        if(getsoundtime(this, CH_BGM_SINGLE) < 0)
                        {
-                               LOG_TRACEF("Cannot initialize sound %s\n", this.noise);
+                               LOG_TRACEF("Cannot initialize sound %s", this.noise);
                                strunzone(this.noise);
                                this.noise = string_null;
                        }
@@ -320,7 +320,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
        setorigin(this, this.origin);
        setsize(this, this.mins, this.maxs);
        this.cnt = 1;
-       this.think = Ent_TriggerMusic_Think;
+       setthink(this, Ent_TriggerMusic_Think);
        this.nextthink = time;
        return true;
 }