X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftarget%2Fmusic.qc;h=488ed0999b094cbcbeb015452b09d58728d065bb;hp=4594c90d971823dafc7c6efc8bc2c3249b5dd260;hb=ef74e1ba8e890befb4a4892a96d244a66c05fd48;hpb=1e85850478a0174700ab365d6a642a2a420d78f8 diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 4594c90d9..488ed0999 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -19,7 +19,7 @@ // when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0) // when targetname is not set, THIS ONE is default void target_music_sendto(float to, float is) -{ +{SELFPARAM(); WriteByte(to, SVC_TEMPENTITY); WriteByte(to, TE_CSQC_TARGET_MUSIC); WriteShort(to, num_for_edict(self)); @@ -30,7 +30,7 @@ void target_music_sendto(float to, float is) WriteString(to, self.noise); } void target_music_reset() -{ +{SELFPARAM(); if(self.targetname == "") target_music_sendto(MSG_ALL, 1); } @@ -47,7 +47,7 @@ void target_music_use() FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); } } void spawnfunc_target_music() -{ +{SELFPARAM(); self.use = target_music_use; self.reset = target_music_reset; if(!self.volume) @@ -58,9 +58,10 @@ void spawnfunc_target_music() target_music_sendto(MSG_INIT, 0); } void TargetMusic_RestoreGame() -{ - for(self = world; (self = find(self, classname, "target_music")); ) +{SELFPARAM(); + for(entity e = world; (e = find(e, classname, "target_music")); ) { + setself(e); if(self.targetname == "") target_music_sendto(MSG_INIT, 1); else @@ -76,7 +77,7 @@ void TargetMusic_RestoreGame() // 1 = START_OFF // when triggered, it is disabled/enabled for everyone float trigger_music_SendEntity(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC); sf &= ~0x80; if(self.cnt) @@ -115,17 +116,17 @@ float trigger_music_SendEntity(entity to, float sf) return 1; } void trigger_music_reset() -{ +{SELFPARAM(); self.cnt = !(self.spawnflags & 1); self.SendFlags |= 0x80; } void trigger_music_use() -{ +{SELFPARAM(); self.cnt = !self.cnt; self.SendFlags |= 0x80; } void spawnfunc_trigger_music() -{ +{SELFPARAM(); if(self.model != "") setmodel(self, self.model); if(!self.volume) @@ -225,7 +226,7 @@ void Net_TargetMusic() sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE); if(getsoundtime(e, CH_BGM_SINGLE) < 0) { - dprintf("Cannot initialize sound %s\n", e.noise); + LOG_TRACEF("Cannot initialize sound %s\n", e.noise); strunzone(e.noise); e.noise = string_null; } @@ -255,7 +256,7 @@ void Net_TargetMusic() } void Ent_TriggerMusic_Think() -{ +{SELFPARAM(); if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world)) { music_trigger = self; @@ -264,14 +265,14 @@ void Ent_TriggerMusic_Think() } void Ent_TriggerMusic_Remove() -{ +{SELFPARAM(); if(self.noise) strunzone(self.noise); self.noise = string_null; } void Ent_ReadTriggerMusic() -{ +{SELFPARAM(); int f = ReadByte(); if(f & 4) { @@ -312,7 +313,7 @@ void Ent_ReadTriggerMusic() sound(self, CH_BGM_SINGLE, self.noise, 0, ATTEN_NONE); if(getsoundtime(self, CH_BGM_SINGLE) < 0) { - dprintf("Cannot initialize sound %s\n", self.noise); + LOG_TRACEF("Cannot initialize sound %s\n", self.noise); strunzone(self.noise); self.noise = string_null; }