r4010 - in trunk/data: qcsrc/server sound sound/debug sound/player

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Aug 4 03:27:46 EDT 2008


Author: div0
Date: 2008-08-04 03:27:38 -0400 (Mon, 04 Aug 2008)
New Revision: 4010

Added:
   trunk/data/sound/debug/
   trunk/data/sound/debug/v_death.wav
   trunk/data/sound/debug/v_drown.wav
   trunk/data/sound/debug/v_fall1.wav
   trunk/data/sound/debug/v_fall2.wav
   trunk/data/sound/debug/v_fall3.wav
   trunk/data/sound/debug/v_gasp.wav
   trunk/data/sound/debug/v_jump.wav
   trunk/data/sound/debug/v_pain100.wav
   trunk/data/sound/debug/v_pain25.wav
   trunk/data/sound/debug/v_pain50.wav
   trunk/data/sound/debug/v_pain75.wav
   trunk/data/sound/player/default.sounds
Removed:
   trunk/data/sound/player/default.sounds.example
Modified:
   trunk/data/qcsrc/server/cl_physics.qc
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/sv_main.qc
Log:
new stupidly recorded sounds for players


Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc	2008-08-03 15:34:55 UTC (rev 4009)
+++ trunk/data/qcsrc/server/cl_physics.qc	2008-08-04 07:27:38 UTC (rev 4010)
@@ -80,6 +80,8 @@
 		player_setanim(self.anim_duckjump, FALSE, TRUE, TRUE);
 	else
 		player_setanim(self.anim_jump, FALSE, TRUE, TRUE);
+
+	PlayerSound(playersound_jump, 0);
 }
 
 void CheckWaterJump()
@@ -453,5 +455,9 @@
 	if(self.flags & FL_ONGROUND)
 		self.lastground = time;
 
+	if(self.flags & FL_ONGROUND)
+		if not(self.lastflags & FL_ONGROUND)
+			PlayerSound(playersound_fall, 0);
+
 	self.lastflags = self.flags;
 };

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2008-08-03 15:34:55 UTC (rev 4009)
+++ trunk/data/qcsrc/server/cl_player.qc	2008-08-04 07:27:38 UTC (rev 4010)
@@ -354,6 +354,7 @@
 void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
 	local float take, save, waves, sdelay;
+	float painsequence;
 
 	damage = damage * bound(1.0, self.cvar_cl_handicap, 100.0);
 	if(sv_gentle > 0) {
@@ -362,23 +363,6 @@
 		pointparticles(particleeffectnum("blood"), hitloc, force, bound(0, damage, 200));
 	}
 
-	if (self.pain_finished < time)		//Don't switch pain sequences like crazy
-	{
-		if(sv_gentle < 1) {		
-			if (random() > 0.5)
-				player_setanim(self.anim_pain1, FALSE, TRUE, TRUE);
-			else
-				player_setanim(self.anim_pain2, FALSE, TRUE, TRUE);
-		}
-		self.pain_finished = time + 0.5;	//Supajoe
-
-		// throw off bot aim temporarily
-		local float shake;
-		shake = damage * 5 / (bound(0,skill,100) + 1);
-		self.v_angle_x = self.v_angle_x + (random() * 2 - 1) * shake;
-		self.v_angle_y = self.v_angle_y + (random() * 2 - 1) * shake;
-	}
-
 	if(g_arena)
 	if(numspawned < 2)
 		return;
@@ -399,7 +383,7 @@
 	else if (take > 30)
 		sound (self, CHAN_IMPACT, "misc/bodyimpact2.wav", 1, ATTN_NORM);
 	else if (take > 10)
-		sound (self, CHAN_IMPACT, "misc/bodyimpact1.wav", 1, ATTN_NORM);
+		sound (self, CHAN_IMPACT, "misc/bodyimpact1.wav", 1, ATTN_NORM); // FIXME possibly remove them?
 
 	if (take > 50)
 		TossGib (world, "models/gibs/chunk.mdl", hitloc, force * -0.1,1);
@@ -414,6 +398,33 @@
 			self.health = self.health - take;
 			// pause regeneration for 5 seconds
 			self.pauseregen_finished = max(self.pauseregen_finished, time + cvar("g_balance_pause_health_regen"));
+
+			if (time > self.pain_finished)		//Don't switch pain sequences like crazy
+			{
+				self.pain_finished = time + 0.5;	//Supajoe
+
+				if(sv_gentle < 1) {		
+					if (random() > 0.5)
+						player_setanim(self.anim_pain1, FALSE, TRUE, TRUE);
+					else
+						player_setanim(self.anim_pain2, FALSE, TRUE, TRUE);
+
+					if(self.health > 75) // TODO make a "gentle" version?
+						PlayerSound(playersound_pain100, 0);
+					else if(self.health > 50)
+						PlayerSound(playersound_pain75, 0);
+					else if(self.health > 25)
+						PlayerSound(playersound_pain50, 0);
+					else if(self.health > 1)
+						PlayerSound(playersound_pain25, 0);
+				}
+
+				// throw off bot aim temporarily
+				local float shake;
+				shake = damage * 5 / (bound(0,skill,100) + 1);
+				self.v_angle_x = self.v_angle_x + (random() * 2 - 1) * shake;
+				self.v_angle_y = self.v_angle_y + (random() * 2 - 1) * shake;
+			}
 		}
 		else
 			self.max_armorvalue += (save + take);
@@ -446,6 +457,14 @@
 		float defer_ClientKill_Now_TeamChange;
 		defer_ClientKill_Now_TeamChange = FALSE;
 
+		if(sv_gentle < 1) // TODO make a "gentle" version?
+		{
+			if(deathtype == DEATH_DROWN)
+				PlayerSound(playersound_drown, 0);
+			else
+				PlayerSound(playersound_death, 0);
+		}
+
 		// get rid of kill indicator
 		if(self.killindicator)
 		{
@@ -729,20 +748,6 @@
 	WriteCoord(MSG_ONE, o_z);
 }
 
-#if 0
-.string playersound_attack;
-.string playersound_attackinfive;
-.string playersound_coverme;
-.string playersound_defend;
-.string playersound_freelance;
-.string playersound_incoming;
-.string playersound_meet;
-.string playersound_needhelp;
-.string playersound_seenflag;
-.string playersound_taunt;
-.string playersound_teamshoot;
-.float modelindex_for_playersound;
-
 float GetVoiceMessageTeamsayType(string type)
 {
 	if(type == "taunt")
@@ -780,9 +785,19 @@
 	GetPlayerSoundSampleField_notFound = 0;
 	switch(type)
 	{
-		case "attack":       return playersound_attack;
-		default:             return GetVoiceMessageSampleField(type);
+		case "death":        return playersound_death;
+		case "drown":        return playersound_drown;
+		case "fall":         return playersound_fall;
+		case "falling":      return playersound_falling;
+		case "gasp":         return playersound_gasp;
+		case "jump":         return playersound_jump;
+		case "pain25":       return playersound_pain25;
+		case "pain50":       return playersound_pain50;
+		case "pain75":       return playersound_pain75;
+		case "pain100":      return playersound_pain100;
 	}
+	GetPlayerSoundSampleField_notFound = 1;
+	return playersound_taunt;
 }
 
 void PrecachePlayerSounds(string f)
@@ -801,8 +816,15 @@
 			continue;
 		}
 		n = stof(argv(2));
-		for(i = 1; i <= n; ++i)
-			precache_sound(strcat(argv(1), ftos(i), ".wav"));
+		if(n > 0)
+		{
+			for(i = 1; i <= n; ++i)
+				precache_sound(strcat(argv(1), ftos(i), ".wav"));
+		}
+		else
+		{
+			precache_sound(strcat(argv(1), ".wav"));
+		}
 	}
 	fclose(fh);
 }
@@ -821,6 +843,8 @@
 			continue;
 		field = GetPlayerSoundSampleField(argv(0));
 		if(GetPlayerSoundSampleField_notFound)
+			field = GetVoiceMessageSampleField(argv(0));
+		if(GetPlayerSoundSampleField_notFound)
 			continue;
 		if(self.field)
 			strunzone(self.field);
@@ -829,6 +853,7 @@
 	fclose(fh);
 }
 
+.float modelindex_for_playersound;
 void UpdatePlayerSounds()
 {
 	if(self.modelindex == self.modelindex_for_playersound)
@@ -838,52 +863,60 @@
 	LoadPlayerSounds(strcat(self.model, ".sounds"));
 }
 
-void VoiceMessage(string type)
+void PlayerSound(.string samplefield, float teamsay)
 {
 	// TODO precache voice messages?
-	var string sample;
-	var float teamsay;
-	sample = self.(GetPlayerSoundSampleField(type));
+	float n;
+	string sample;
+	sample = self.samplefield;
 
-	if(GetPlayerSoundSampleField_notFound)
-	{
-		sprint(self, strcat("Invalid voice. Use one of: ", allvoicesamples, "\n"));
+	if(sample == "")
 		return;
-	}
 
-	if(!sample)
-		return;
-
-	teamsay = GetVoiceMessageTeamsayType(type);
-
 	tokenize(sample);
-	sample = strcat(argv(0), ftos(ceil(random() * stof(argv(1)))), ".wav"); // randomization
+	n = stof(argv(1));
+	if(n > 0)
+		sample = strcat(argv(0), ftos(ceil(random() * n)), ".wav"); // randomization
+	else
+		sample = strcat(argv(0), ".wav"); // randomization
 
-	if(teamsay == 2)
+	if(teamsay == 2) // only to last attacker
 	{
 		if(teams_matter)
 			if(self.pusher)
 				if(self.pusher.team == self.team)
 				{
-					soundto(self, self.pusher, CHAN_VOICE, sample, 1, ATTN_NONE);
-					soundto(self, self, CHAN_VOICE, sample, 1, ATTN_NONE);
+					soundto(self, self.pusher, CHAN_BODY, sample, 1, ATTN_NONE);
+					soundto(self, self, CHAN_BODY, sample, 1, ATTN_NONE);
 				}
 	}
-	else if(teamsay == 0 || !teams_matter)
+	else if(teamsay == 0) // to everyone
 	{
 		// broadcast the sound, but it's directional
-		sound(self, CHAN_VOICE, sample, 1, ATTN_NORM);
+		sound(self, CHAN_BODY, sample, 1, ATTN_NORM);
 	}
-	else if(teamsay == 1)
+	else if(teamsay == 1) // to the same team
 	{
 		entity e;
 		FOR_EACH_REALCLIENT(e)
-			if(e.team == self.team)
-				soundto(self, e, CHAN_VOICE, sample, 1, ATTN_NONE);
+			if(!teams_matter || e.team == self.team)
+				soundto(self, e, CHAN_BODY, sample, 1, ATTN_NONE);
 	}
 }
-#else
-void PrecachePlayerSounds(string f) { }
-void UpdatePlayerSounds() { }
-void VoiceMessage(string type) { sprint(self, "Sorry, voice command support is not done yet. Maybe later.\n"); }
-#endif
+
+void VoiceMessage(string type)
+{
+	var .string sample;
+	var float teamsay;
+	sample = GetVoiceMessageSampleField(type);
+
+	if(GetPlayerSoundSampleField_notFound)
+	{
+		sprint(self, strcat("Invalid voice. Use one of: ", allvoicesamples, "\n"));
+		return;
+	}
+
+	teamsay = GetVoiceMessageTeamsayType(type);
+
+	PlayerSound(sample, teamsay);
+}

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-08-03 15:34:55 UTC (rev 4009)
+++ trunk/data/qcsrc/server/defs.qh	2008-08-04 07:27:38 UTC (rev 4010)
@@ -444,3 +444,31 @@
 
 .float Version;
 .float(entity to) SendEntity;
+
+// player sounds, voice messages
+.string playersound_attack;
+.string playersound_attackinfive;
+.string playersound_coverme;
+.string playersound_defend;
+.string playersound_freelance;
+.string playersound_incoming;
+.string playersound_meet;
+.string playersound_needhelp;
+.string playersound_seenflag;
+.string playersound_taunt;
+.string playersound_teamshoot;
+.string playersound_death;
+.string playersound_drown;
+.string playersound_fall; // known broken, FIXME
+.string playersound_falling; // not yet implemented, FIXME
+.string playersound_gasp;
+.string playersound_jump;
+.string playersound_pain25;
+.string playersound_pain50;
+.string playersound_pain75;
+.string playersound_pain100;
+void PrecachePlayerSounds(string f);
+void LoadPlayerSounds(string f);
+void UpdatePlayerSounds();
+void PlayerSound(.string samplefield, float teamsay); // 0 is normal, 1 is team, 2 is last attacker
+void VoiceMessage(string type);

Modified: trunk/data/qcsrc/server/sv_main.qc
===================================================================
--- trunk/data/qcsrc/server/sv_main.qc	2008-08-03 15:34:55 UTC (rev 4009)
+++ trunk/data/qcsrc/server/sv_main.qc	2008-08-04 07:27:38 UTC (rev 4010)
@@ -24,6 +24,8 @@
 				}
 				if (self.waterlevel != 3)
 				{
+					if(self.air_finished < time + 9)
+						PlayerSound(playersound_gasp, 0);
 					self.air_finished = time + 12;
 					self.dmg = 2;
 				}
@@ -77,23 +79,7 @@
 				if (self.deadflag)
 					dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * cvar("g_balance_falldamage_factor");
 				else
-				{
-					if (self.oldvelocity_z < self.velocity_z - 160)
-					{
-						local float soundrandom;
-						soundrandom = random() * 4;
-						if (soundrandom < 1)
-							sound (self, CHAN_BODY, "misc/hitground1.wav", 1, ATTN_NORM);
-						else if (soundrandom < 2)
-							sound (self, CHAN_BODY, "misc/hitground2.wav", 1, ATTN_NORM);
-						else if (soundrandom < 3)
-							sound (self, CHAN_BODY, "misc/hitground3.wav", 1, ATTN_NORM);
-						else if (soundrandom < 4)
-							sound (self, CHAN_BODY, "misc/hitground4.wav", 1, ATTN_NORM);
-						self.nextstep = time + 0.3 + random() * 0.1;
-					}
 					dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage"));
-				}
 				if (dm > 0)
 					Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0');
 				else if(vlen(self.velocity) > 100000 && cvar("developer"))

Added: trunk/data/sound/debug/v_death.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_death.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_drown.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_drown.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_fall1.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_fall1.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_fall2.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_fall2.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_fall3.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_fall3.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_gasp.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_gasp.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_jump.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_jump.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_pain100.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_pain100.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_pain25.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_pain25.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_pain50.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_pain50.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/debug/v_pain75.wav
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/debug/v_pain75.wav
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Copied: trunk/data/sound/player/default.sounds (from rev 4009, trunk/data/sound/player/default.sounds.example)
===================================================================
--- trunk/data/sound/player/default.sounds	                        (rev 0)
+++ trunk/data/sound/player/default.sounds	2008-08-04 07:27:38 UTC (rev 4010)
@@ -0,0 +1,24 @@
+//attack sound/player/voice/attack 1
+//attackinfive sound/player/voice/attackinfive 1
+//coverme sound/player/voice/coverme 1
+//defend sound/player/voice/defend 1
+//freelance sound/player/voice/freelance 1
+//incoming sound/player/voice/incoming 1
+//meet sound/player/voice/meet 1
+//needhelp sound/player/voice/needhelp 1
+//seenflag sound/player/voice/seenflag 2
+//taunt sound/player/voice/taunt 9
+//teamshoot sound/player/voice/teamshoot 5
+death sound/debug/v_death 0
+drown sound/debug/v_drown 0
+fall sound/debug/v_fall 3
+//fall misc/hitground 4
+falling sound/debug/v_falling 0
+gasp sound/debug/v_gasp 0
+jump sound/debug/v_jump 0
+pain25 sound/debug/v_pain25 0
+pain50 sound/debug/v_pain50 0
+pain75 sound/debug/v_pain75 0
+pain100 sound/debug/v_pain100 0
+
+// TODO take out ALL the debug sounds, before I will remove them again! Deadline is Oct 1 2008.

Deleted: trunk/data/sound/player/default.sounds.example
===================================================================
--- trunk/data/sound/player/default.sounds.example	2008-08-03 15:34:55 UTC (rev 4009)
+++ trunk/data/sound/player/default.sounds.example	2008-08-04 07:27:38 UTC (rev 4010)
@@ -1,11 +0,0 @@
-attack sound/player/voice/attack 1
-attackinfive sound/player/voice/attackinfive 1
-coverme sound/player/voice/coverme 1
-defend sound/player/voice/defend 1
-freelance sound/player/voice/freelance 1
-incoming sound/player/voice/incoming 1
-meet sound/player/voice/meet 1
-needhelp sound/player/voice/needhelp 1
-seenflag sound/player/voice/seenflag 2
-taunt sound/player/voice/taunt 9
-teamshoot sound/player/voice/teamshoot 5




More information about the nexuiz-commits mailing list