X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftarget%2Fspeaker.qc;h=75f733c09eefa44d420a36c894beb88dfa05b791;hb=96e1acc3050bcb718e2f06702e5b88a60459a015;hp=7be8b91b4c2920cabe64093d1500ed0360cae748;hpb=1d4454eb627b54e4b01a36ccce32a2767b02416c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/target/speaker.qc b/qcsrc/common/triggers/target/speaker.qc index 7be8b91b4..75f733c09 100644 --- a/qcsrc/common/triggers/target/speaker.qc +++ b/qcsrc/common/triggers/target/speaker.qc @@ -2,21 +2,20 @@ // TODO add a way to do looped sounds with sound(); then complete this entity void target_speaker_use_off(); void target_speaker_use_activator() -{ +{SELFPARAM(); if (!IS_REAL_CLIENT(activator)) return; string snd; if(substring(self.noise, 0, 1) == "*") { - var .string sample; - sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); + var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); if(GetPlayerSoundSampleField_notFound) - snd = "misc/null.wav"; - else if(activator.sample == "") - snd = "misc/null.wav"; + snd = SND(Null); + else if(activator.(sample) == "") + snd = SND(Null); else { - tokenize_console(activator.sample); + tokenize_console(activator.(sample)); float n; n = stof(argv(1)); if(n > 0) @@ -31,19 +30,18 @@ void target_speaker_use_activator() soundto(MSG_ONE, self, CH_TRIGGER, snd, VOL_BASE * self.volume, self.atten); } void target_speaker_use_on() -{ +{SELFPARAM(); string snd; if(substring(self.noise, 0, 1) == "*") { - var .string sample; - sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); + var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); if(GetPlayerSoundSampleField_notFound) - snd = "misc/null.wav"; - else if(activator.sample == "") - snd = "misc/null.wav"; + snd = SND(Null); + else if(activator.(sample) == "") + snd = SND(Null); else { - tokenize_console(activator.sample); + tokenize_console(activator.(sample)); float n; n = stof(argv(1)); if(n > 0) @@ -54,17 +52,17 @@ void target_speaker_use_on() } else snd = self.noise; - sound(self, CH_TRIGGER_SINGLE, snd, VOL_BASE * self.volume, self.atten); + _sound(self, CH_TRIGGER_SINGLE, snd, VOL_BASE * self.volume, self.atten); if(self.spawnflags & 3) self.use = target_speaker_use_off; } void target_speaker_use_off() -{ - sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASE * self.volume, self.atten); +{SELFPARAM(); + sound(self, CH_TRIGGER_SINGLE, SND_Null, VOL_BASE * self.volume, self.atten); self.use = target_speaker_use_on; } void target_speaker_reset() -{ +{SELFPARAM(); if(self.spawnflags & 1) // LOOPED_ON { if(self.use == target_speaker_use_on) @@ -78,7 +76,7 @@ void target_speaker_reset() } void spawnfunc_target_speaker() -{ +{SELFPARAM(); // TODO: "*" prefix to sound file name // TODO: wait and random (just, HOW? random is not a field) if(self.noise)