[nexuiz-commits] r6326 - in trunk/data: qcsrc/server sound/misc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Mar 27 07:58:19 EDT 2009


Author: div0
Date: 2009-03-27 07:58:18 -0400 (Fri, 27 Mar 2009)
New Revision: 6326

Added:
   trunk/data/sound/misc/jetpack_fly.ogg
Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_physics.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
jetpack fly sound


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2009-03-27 10:48:47 UTC (rev 6325)
+++ trunk/data/qcsrc/server/cl_client.qc	2009-03-27 11:58:18 UTC (rev 6326)
@@ -1341,6 +1341,8 @@
 
 	if(!sv_foginterval && world.fog != "")
 		stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
+
+	SoundEntity_Attach(self);
 }
 
 /*
@@ -1370,6 +1372,8 @@
 		GameLogEcho(strcat(":part:", ftos(self.playerid)));
 	bprint ("^4",self.netname);
 	bprint ("^4 disconnected\n");
+	
+	SoundEntity_Detach(self);
 
 	DropAllRunes(self);
 	kh_Key_DropAll(self, TRUE);
@@ -1671,6 +1675,17 @@
 	if (time >= game_starttime)
 	if (time < self.spawnshieldtime)
 		self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+
+	if(self.items & IT_USING_JETPACK)
+	{
+		SoundEntity_StartSound(self, CHAN_PLAYER, "misc/jetpack_fly.wav", VOL_BASE, ATTN_IDLE);
+		self.modelflags |= MF_ROCKET;
+	}
+	else
+	{
+		SoundEntity_StopSound(self, CHAN_PLAYER);
+		self.modelflags &~= MF_ROCKET;
+	}
 }
 
 float CalcRegen(float current, float stable, float regenfactor)

Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc	2009-03-27 10:48:47 UTC (rev 6325)
+++ trunk/data/qcsrc/server/cl_physics.qc	2009-03-27 11:58:18 UTC (rev 6326)
@@ -390,7 +390,6 @@
 	if (clienttype(self) == CLIENTTYPE_BOT)
 		bot_think();
 
-	self.modelflags &~= MF_ROCKET;
 	self.items &~= IT_USING_JETPACK;
 
 	if (self.movetype == MOVETYPE_NONE && self.disableclientprediction != 2)
@@ -481,7 +480,7 @@
 
 	// if dead, behave differently
 	if (self.deadflag)
-		return;
+		goto end;
 
 	if (!self.fixangle && !g_bugrigs)
 	{
@@ -687,7 +686,6 @@
 			if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 				self.ammo_cells -= cvar("g_jetpack_ammo") * frametime * fvel * f;
 			self.flags &~= FL_ONGROUND;
-			self.modelflags |= MF_ROCKET;
 			self.items |= IT_USING_JETPACK;
 		}
 	}
@@ -799,6 +797,7 @@
 		}
 	}
 
+:end
 	if(self.flags & FL_ONGROUND)
 		self.lastground = time;
 

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-03-27 10:48:47 UTC (rev 6325)
+++ trunk/data/qcsrc/server/defs.qh	2009-03-27 11:58:18 UTC (rev 6326)
@@ -555,3 +555,5 @@
 float servertime, serverprevtime, serverframetime;
 
 void Drag_MoveDrag(entity from, entity to);
+
+.entity soundentity;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-03-27 10:48:47 UTC (rev 6325)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-03-27 11:58:18 UTC (rev 6326)
@@ -1384,6 +1384,9 @@
 	precache_sound ("misc/teleport.wav");
 	precache_sound ("player/lava.wav");
 	precache_sound ("player/slime.wav");
+	
+	if(g_jetpack)
+		precache_sound ("misc/jetpack_fly.wav");
 
 	// announcer sounds - male
 	precache_sound ("announcer/male/electrobitch.wav");
@@ -2141,3 +2144,39 @@
 	gettaginfo_relative_ent.frame = e.frame;
 	return gettaginfo(gettaginfo_relative_ent, tag);
 }
+
+void SoundEntity_StartSound(entity pl, float chan, string samp, float vol, float attn)
+{
+	float p;
+	p = pow(2, chan);
+	if(pl.soundentity.cnt & p)
+		return;
+	soundtoat(MSG_ALL, pl.soundentity, gettaginfo(pl.soundentity, 0), chan, samp, vol, attn);
+	pl.soundentity.cnt |= p;
+}
+
+void SoundEntity_StopSound(entity pl, float chan)
+{
+	float p;
+	p = pow(2, chan);
+	if(pl.soundentity.cnt & p)
+	{
+		stopsoundto(MSG_ALL, pl.soundentity, chan);
+		pl.soundentity.cnt &~= p;
+	}
+}
+
+void SoundEntity_Attach(entity pl)
+{
+	pl.soundentity = spawn();
+	pl.soundentity.classname = "soundentity";
+	setattachment(pl.soundentity, pl, "");
+	setmodel(pl.soundentity, "null");
+}
+
+void SoundEntity_Detach(entity pl)
+{
+	float i;
+	for(i = 0; i <= 7; ++i)
+		SoundEntity_StopSound(pl, i);
+}

Added: trunk/data/sound/misc/jetpack_fly.ogg
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/misc/jetpack_fly.ogg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the nexuiz-commits mailing list