From: Mario <mario@smbclan.net>
Date: Fri, 1 Jan 2016 12:52:44 +0000 (+1000)
Subject: If teleporter has .noise set, use that sound instead
X-Git-Tag: xonotic-v0.8.2~1328
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0a6594ce564138492efeffc2c83d0ef002f47b51;p=xonotic%2Fxonotic-data.pk3dir.git

If teleporter has .noise set, use that sound instead
---

diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh
index 4bffd04ba..b2302f6d2 100644
--- a/qcsrc/common/constants.qh
+++ b/qcsrc/common/constants.qh
@@ -223,6 +223,8 @@ const int WATERLEVEL_NONE = 0;
 const int WATERLEVEL_WETFEET = 1;
 const int WATERLEVEL_SWIMMING = 2;
 const int WATERLEVEL_SUBMERGED = 3;
+
+// server flags
 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
 const int SERVERFLAG_TEAMPLAY = 2;
 const int SERVERFLAG_PLAYERSTATS = 4;
diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc
index b4dc20a7d..2d23dd636 100644
--- a/qcsrc/common/triggers/teleporters.qc
+++ b/qcsrc/common/triggers/teleporters.qc
@@ -85,7 +85,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
 		if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
 		{
 			if(tflags & TELEPORT_FLAG_SOUND)
-				sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM);
+				sound (player, CH_TRIGGER, ((teleporter.noise != "") ? teleporter.noise : SND_TELEPORT), VOL_BASE, ATTEN_NORM);
 			if(tflags & TELEPORT_FLAG_PARTICLES)
 			{
 				Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc
index c013eb867..37c4d1def 100644
--- a/qcsrc/common/triggers/trigger/teleport.qc
+++ b/qcsrc/common/triggers/trigger/teleport.qc
@@ -86,6 +86,9 @@ spawnfunc(trigger_teleport)
 	trigger_init(self);
 	self.use = trigger_teleport_use;
 
+	if(self.noise != "")
+		precache_sound(self.noise);
+
 	// this must be called to spawn the teleport waypoints for bots
 	InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);