r2398 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Apr 25 14:24:50 EDT 2007


Author: div0
Date: 2007-04-25 14:24:50 -0400 (Wed, 25 Apr 2007)
New Revision: 2398

Modified:
   trunk/data/qcsrc/server/builtins.qh
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/t_items.qc
   trunk/data/qcsrc/server/w_nex.qc
Log:
use play2() function (as preparation for sound packs)
do spawn point management only in info_player_deathmatch (Dresk)


Modified: trunk/data/qcsrc/server/builtins.qh
===================================================================
--- trunk/data/qcsrc/server/builtins.qh	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/builtins.qh	2007-04-25 18:24:50 UTC (rev 2398)
@@ -17,7 +17,7 @@
 void	traceline (vector v1, vector v2, float nomonst, entity forent)			= #16;
 entity	checkclient (void)								= #17;
 entity	find (entity start, .string fld, string match)					= #18;
-string	precache_sound (string s)							= #19;
+//string	precache_sound (string s)							= #19;
 string	precache_model (string s)							= #20;
 //void(entity client, string s)stuffcmd = #21;
 entity	findradius (vector org, float rad)						= #22;

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/cl_client.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -1,11 +1,11 @@
 void info_player_start (void)
 {
-	self.classname = "info_player_deathmatch";
-	relocate_spawnpoint();
+	info_player_deathmatch();
 }
 
 void info_player_deathmatch (void)
 {
+	self.classname = "info_player_deathmatch";
 	relocate_spawnpoint();
 }
 
@@ -1239,7 +1239,7 @@
 		{
 			self.respawn_countdown = number - 1;
 			if(ceil(self.death_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
-				stuffcmd(self, strcat("play2 announcer/robotic/", ftos(number), ".ogg\n"));
+				play2(self, strcat("announcer/robotic/", ftos(number), ".ogg"));
 		}
 	}
 }

Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/ctf.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -315,9 +315,8 @@
 */
 void() info_player_team1 =
 {
-	self.classname = "info_player_deathmatch";
 	self.team = 5; // red
-	relocate_spawnpoint();
+	info_player_deathmatch();
 };
 //self.team = 4;self.classname = "info_player_start";info_player_start();};
 
@@ -331,9 +330,8 @@
 */
 void() info_player_team2 =
 {
-	self.classname = "info_player_deathmatch";
 	self.team = 14; // blue
-	relocate_spawnpoint();
+	info_player_deathmatch();
 };
 //self.team = 13;self.classname = "info_player_start";info_player_start();};
 
@@ -347,9 +345,8 @@
 */
 void() info_player_team3 =
 {
-	self.classname = "info_player_deathmatch";
 	self.team = 10; // purple
-	relocate_spawnpoint();
+	info_player_deathmatch();
 };
 
 
@@ -363,9 +360,8 @@
 */
 void() info_player_team4 =
 {
-	self.classname = "info_player_deathmatch";
 	self.team = 13; // yellow
-	relocate_spawnpoint();
+	info_player_deathmatch();
 };
 
 

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/defs.qh	2007-04-25 18:24:50 UTC (rev 2398)
@@ -152,7 +152,6 @@
 float WEP_FIRST				= 1;
 float WEP_LAST				= 9;
 
-void(entity e, float chan, string samp, float vol, float atten) sound = #8;
 void(entity client, string s)	stuffcmd = #21;
 void(entity client, string s)	sprint = #24;
 vector(entity e, float sped)	aim = #44;

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/g_damage.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -249,37 +249,37 @@
 				if (attacker.killcount == 3)
 				{
 					bprint (a,"^7 made a ^1TRIPLE FRAG\n");
-					stuffcmd(attacker, "play2 announcer/male/03kills.ogg\n");
+					play2(attacker, "announcer/male/03kills.ogg");
 				}
 				else if (attacker.killcount == 5)
 				{
 					bprint (a,"^7 made a ^1FIVE FRAG COMBO\n");
-					stuffcmd(attacker, "play2 announcer/male/05kills.ogg\n");
+					play2(attacker, "announcer/male/05kills.ogg");
 				}
 				else if (attacker.killcount == 10)
 				{
 					bprint (a,"^7 is on a ^1RAGE\n");
-					stuffcmd(attacker, "play2 announcer/male/10kills.ogg\n");
+					play2(attacker, "announcer/male/10kills.ogg");
 				}
 				else if (attacker.killcount == 15)
 				{
 					bprint (a,"^7 has done a ^1MASSACRE!\n");
-					stuffcmd(attacker, "play2 announcer/male/15kills.ogg\n");
+					play2(attacker, "announcer/male/15kills.ogg");
 				}
 				else if (attacker.killcount == 20)
 				{
 					bprint (a,"^7 is ^1UNHUMAN!\n");
-					stuffcmd(attacker, "play2 announcer/male/20kills.ogg\n");
+					play2(attacker, "announcer/male/20kills.ogg");
 				}
 				else if (attacker.killcount == 25)
 				{
 					bprint (a,"^7 is a ^1DEATH INCARNATION!\n");
-					stuffcmd(attacker, "play2 announcer/male/25kills.ogg\n");
+					play2(attacker, "announcer/male/25kills.ogg");
 				}
 				else if (attacker.killcount == 30)
 				{
 					bprint (a,"^7 is maybe a ^1AIMBOTTER?!\n");
-					stuffcmd(attacker, "play2 announcer/male/30kills.ogg\n");
+					play2(attacker, "announcer/male/30kills.ogg");
 				}
 			}
 		}
@@ -304,7 +304,7 @@
 				bprint ("^1",s, "^1 died\n");
 			GiveFrags(targ, targ, -1);
 			if(targ.frags == -5) {
-				stuffcmd(targ, "play2 announcer/male/botlike.ogg\n");
+				play2(targ, "announcer/male/botlike.ogg");
 			}
 
 			if (targ.killcount > 2)
@@ -414,7 +414,7 @@
 		}
 		else if (deathtype == IT_NEX && targ.items & IT_STRENGTH)
 		{
-			if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
+			if(clienttype(attacker) == CLIENTTYPE_REAL) play2(attacker, "announcer/male/yoda.ogg");
 		}
 		if (deathtype == IT_LASER)
 		{
@@ -433,7 +433,7 @@
 	} else {
 		if (deathtype == IT_NEX && !targ.deadflag && !(attacker.flags & FL_ONGROUND) && !(targ.flags & FL_ONGROUND) && attacker.waterlevel < 2 && targ.waterlevel < 2 && attacker.killcount != 3 && attacker.killcount != 5 && attacker.killcount != 10 && attacker.killcount != 15 && attacker.killcount != 20 && attacker.killcount != 25 && attacker.killcount != 30)
 		{
-			if(clienttype(attacker) == CLIENTTYPE_REAL)  stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
+			if(clienttype(attacker) == CLIENTTYPE_REAL)  play2(attacker, "announcer/male/yoda.ogg");
 		}
 	}
 

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/g_world.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -76,6 +76,16 @@
 	if(world_already_spawned)
 		error("world already spawned - you may have EXACTLY ONE worldspawn!");
 	world_already_spawned = TRUE;
+
+	/*
+	TODO sound pack system
+	// initialize sound pack system
+	soundpack = cvar_string("g_soundpack");
+	if(soundpack != "")
+		soundpack = strcat(soundpack, "/");
+	soundpack = strzone(soundpack);
+	*/
+
 	// Precache all player models
 	// Workaround for "invisible players"
 	precache_model("models/player/carni.zym");
@@ -1845,7 +1855,7 @@
 
 		// notify about keep-two
 		if(keeptwo != 0 && mapvote_keeptwotime == 0)
-			stuffcmd(other, "\nplay2 misc/invshot.wav\n");
+			play2(other, "misc/invshot.wav");
 
 		// clear possibly invalid votes
 		if(mapvote_maps[other.mapvote - 1] == "")
@@ -1932,12 +1942,12 @@
 		if(self.classname == "spectator")
 		{
 			if(self.enemy.hitsound)
-				stuffcmd(self, "play2 misc/hit.wav\n");
+				play2(self, "misc/hit.wav");
 		}
 		else
 		{
 			if(self.hitsound)
-				stuffcmd(self, "play2 misc/hit.wav\n");
+				play2(self, "misc/hit.wav");
 		}
 	}
 	FOR_EACH_CLIENT(self)

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -1,3 +1,5 @@
+void() info_player_deathmatch; // needed for the other spawnpoints
+
 void move_out_of_solid_expand(entity e, vector by)
 {
 	float eps = 0.0625;
@@ -703,3 +705,30 @@
 	g_pickup_healthmega                = cvar("g_pickup_healthmega");
 	g_pickup_healthmega_max            = cvar("g_pickup_healthmega_max");
 }
+
+/*
+// TODO sound pack system
+string soundpack;
+
+string precache_sound_builtin (string s) = #19;
+void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
+string precache_sound(string s)
+{
+	return precache_sound_builtin(strcat(soundpack, s));
+}
+void play2(entity e, string filename)
+{
+	stuffcmd(e, strcat("play2 ", soundpack, filename, "\n"));
+}
+void sound(entity e, float chan, string samp, float vol, float atten)
+{
+	sound_builtin(e, chan, strcat(soundpack, samp), vol, atten);
+}
+*/
+
+string precache_sound (string s) = #19;
+void(entity e, float chan, string samp, float vol, float atten) sound = #8;
+void play2(entity e, string filename)
+{
+	stuffcmd(e, strcat("play2 ", filename, "\n"));
+}

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/t_items.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -54,12 +54,12 @@
 			// play some cool sounds ;)
 			centerprint(other, "\n");
 			if(other.health <= 5)
-				stuffcmd(other, "play2 announcer/robotic/lastsecond.ogg\n");
+				play2(other, "announcer/robotic/lastsecond.ogg");
 			else if(other.health < 50)
-				stuffcmd(other, "play2 announcer/robotic/narrowly.ogg\n");
+				play2(other, "announcer/robotic/narrowly.ogg");
 			// sound not available
 			// else if(self.items == IT_CELLS)
-			//	stuffcmd(other, "play2 announce/robotic/ammo.ogg\n");
+			//	play2(other, "announce/robotic/ammo.ogg");
 
 			if (self.items & IT_NEX)
 				W_GiveWeapon (other, IT_NEX, "Nex");
@@ -73,7 +73,7 @@
 		{
 			pickedup = TRUE;
 			// sound not available
-			// stuffcmd(other, "play2 announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.ogg\n");
+			// play2(other, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.ogg");
 			other.armorvalue = other.armorvalue + cvar("g_minstagib_extralives");
 			sprint(other, "^3You picked up some extra lives\n");
 		}
@@ -83,7 +83,7 @@
 		{
 			pickedup = TRUE;
 			// sound not available
-			// stuffcmd(other, "play2 announce/robotic/invisible.ogg\n");
+			// play2(other, "announce/robotic/invisible.ogg");
 			other.strength_finished = max(other.strength_finished, time) + cvar("g_balance_powerup_strength_time");
 		}
 
@@ -92,7 +92,7 @@
 		{
 			pickedup = TRUE;
 			// sound not available
-			// stuffcmd(other, "play2 announce/robotic/speed.ogg\n");
+			// play2(other, "announce/robotic/speed.ogg");
 			other.invincible_finished = max(other.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
 		}
 	}

Modified: trunk/data/qcsrc/server/w_nex.qc
===================================================================
--- trunk/data/qcsrc/server/w_nex.qc	2007-04-25 17:24:02 UTC (rev 2397)
+++ trunk/data/qcsrc/server/w_nex.qc	2007-04-25 18:24:50 UTC (rev 2398)
@@ -69,67 +69,67 @@
 		{
 			centerprint(self, "you're dead now...\n");
 			Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/terminated.ogg\n");
+			play2(self, "announcer/robotic/terminated.ogg");
 		}
 		if (self.health == 10)
 		{
 			centerprint(self, "^11^7 second left to find some ammo\n");
 			Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/1.ogg\n");
+			play2(self, "announcer/robotic/1.ogg");
 		}
 		if (self.health == 20)
 		{
 			centerprint(self, "^12^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/2.ogg\n");
+			play2(self, "announcer/robotic/2.ogg");
 		}
 		if (self.health == 30)
 		{
 			centerprint(self, "^13^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/3.ogg\n");
+			play2(self, "announcer/robotic/3.ogg");
 		}
 		if (self.health == 40)
 		{
 			centerprint(self, "^14^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/4.ogg\n");
+			play2(self, "announcer/robotic/4.ogg");
 		}
 		if (self.health == 50)
 		{
 			centerprint(self, "^15^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/5.ogg\n");
+			play2(self, "announcer/robotic/5.ogg");
 		}
 		if (self.health == 60)
 		{
 			centerprint(self, "^36^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/6.ogg\n");
+			play2(self, "announcer/robotic/6.ogg");
 		}
 		if (self.health == 70)
 		{
 			centerprint(self, "^37^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/7.ogg\n");
+			play2(self, "announcer/robotic/7.ogg");
 		}
 		if (self.health == 80)
 		{
 			centerprint(self, "^38^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/8.ogg\n");
+			play2(self, "announcer/robotic/8.ogg");
 		}
 		if (self.health == 90)
 		{
 			centerprint(self, "^39^7 seconds left to find some ammo\n");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/9.ogg\n");
+			play2(self, "announcer/robotic/9.ogg");
 		}
 		if (self.health == 100)
 		{
 			centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
 			Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-			stuffcmd(self, "play2 announcer/robotic/10.ogg\n");
+			play2(self, "announcer/robotic/10.ogg");
 		}
 	}
 	self.minstagib_nextthink = time + 1;




More information about the nexuiz-commits mailing list