r5482 - in trunk/data: . qcsrc/menu/nexuiz qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jan 10 10:34:07 EST 2009


Author: div0
Date: 2009-01-10 10:34:07 -0500 (Sat, 10 Jan 2009)
New Revision: 5482

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_weapons.c
   trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
cl_voice_directional (play all voices directioanlly)


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/defaultNexuiz.cfg	2009-01-10 15:34:07 UTC (rev 5482)
@@ -124,7 +124,8 @@
 
 // taunts and voices
 seta cl_autotaunt 0.65
-seta cl_taunt_directional 1
+seta cl_voice_directional 1 // 0 = all voices are non-directional, 1 = all voices are directional
+seta cl_voice_directional_taunt_attenuation 0.5
 
 // server settings
 hostname "Nexuiz Server"

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_weapons.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_weapons.c	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_weapons.c	2009-01-10 15:34:07 UTC (rev 5482)
@@ -24,19 +24,24 @@
 void fillNexuizWeaponsDialog(entity me)
 {
 	entity e;
+	float h0, h;
+
+	h = me.rows - 6;
+	
 	me.TR(me);
 		me.TD(me, 1, 4, makeNexuizTextLabel(0, "Weapon priority list:"));
 	me.TR(me);
-		me.TD(me, me.rows - 5, 3, e = me.weaponsList = makeNexuizWeaponsList());
-	me.gotoRC(me, (me.rows - 5) / 2, 3);
+		h0 = me.currentRow;
+		me.TD(me, h, 3, e = me.weaponsList = makeNexuizWeaponsList());
+	me.gotoRC(me, h0 + h / 2 - 1, 3);
 		me.TD(me, 1, 1, e = makeNexuizButton("Up", '0 0 0'));
 			e.onClick = WeaponsList_MoveUp_Click;
 			e.onClickEntity = me.weaponsList;
-	me.gotoRC(me, (me.rows - 5) / 2 + 1, 3);
+	me.gotoRC(me, h0 + h / 2, 3);
 		me.TD(me, 1, 1, e = makeNexuizButton("Down", '0 0 0'));
 			e.onClick = WeaponsList_MoveDown_Click;
 			e.onClickEntity = me.weaponsList;
-	me.gotoRC(me, me.rows - 5, 0);
+	me.gotoRC(me, h0 + h, 0);
 		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_weaponpriority_useforcycling", "Use priority list for weapon cycling"));
 	me.TR(me);
 		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_autoswitch", "Auto switch weapons on pickup"));

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c	2009-01-10 15:34:07 UTC (rev 5482)
@@ -127,9 +127,20 @@
 		setDependent(e, "snd_channels", 1.5, 0.5);
 	me.TR(me);
 	me.TR(me);
-		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_taunt_directional", "Play taunts directionally"));
+		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_voice_directional", "Play voice messages directionally"));
 	me.TR(me);
+		me.TDempty(me, 0.2);
+		me.TD(me, 1, 0.8, e = makeNexuizTextLabel(0, "Taunt range:"));
+		me.TD(me, 1, 1.8, e = makeNexuizTextSlider("cl_voice_directional_taunt_attenuation"));
+			e.addValue(e, "Very short", "3");
+			e.addValue(e, "Short", "2");
+			e.addValue(e, "Normal", "0.5");
+			e.addValue(e, "Long", "0.25");
+			e.addValue(e, "Full", "0.015625");
+			e.configureNexuizTextSliderValues(e);
+	me.TR(me);
 		sl = makeNexuizSlider(0.15, 1, 0.05, "cl_autotaunt");
+			sl.valueDisplayMultiplier = 100;
 		me.TD(me, 1, 1, e = makeNexuizSliderCheckBox(0, 1, sl, "Automatic taunts"));
 		if(sl.value != e.savedValue)
 			e.savedValue = 0.65; // default
@@ -138,9 +149,9 @@
 		me.TD(me, 1, 2, sl);
 	me.TR(me);
 	me.TR(me);
-		me.TD(me, 1, 2.8, e = makeNexuizCheckBox(0, "cl_hitsound", "Hit indicator"));
+		me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_hitsound", "Hit indicator"));
 
 	me.gotoRC(me, me.rows - 1, 0);
-		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "snd_restart; sendcvar cl_hitsound; sendcvar cl_autotaunt", COMMANDBUTTON_APPLY));
+		me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply immediately", '0 0 0', "snd_restart; sendcvar cl_hitsound; sendcvar cl_autotaunt; sendcvar cl_voice_directional; sendcvar cl_voice_directional_taunt_attenuation", COMMANDBUTTON_APPLY));
 }
 #endif

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/server/cl_player.qc	2009-01-10 15:34:07 UTC (rev 5482)
@@ -761,7 +761,7 @@
 
 .float floodcontrol_chat;
 .float floodcontrol_chatteam;
-void Say(entity source, float teamsay, string msgin)
+void Say(entity source, float teamsay, string msgin, float floodcontrol)
 {
 	string msgstr, colorstr, cmsgstr, namestr;
 	float flood;
@@ -814,6 +814,7 @@
 
 	// FLOOD CONTROL
 	flood = 0;
+	if(floodcontrol)
 	{
 		float flood_spl;
 		float flood_burst;
@@ -1045,7 +1046,12 @@
 			{
 				msg_entity = self.pusher;
 				if(clienttype(msg_entity) == CLIENTTYPE_REAL)
-					soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
+				{
+					if(msg_entity.cvar_cl_voice_directional)
+						soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_MIN);
+					else
+						soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
+				}
 			}
 	}
 	else if(teamsay == 2) // only to last attacker and self
@@ -1055,7 +1061,12 @@
 			{
 				msg_entity = self.pusher;
 				if(clienttype(msg_entity) == CLIENTTYPE_REAL)
-					soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
+				{
+					if(msg_entity.cvar_cl_voice_directional)
+						soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_MIN);
+					else
+						soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
+				}
 				msg_entity = self;
 				if(clienttype(msg_entity) == CLIENTTYPE_REAL)
 					soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
@@ -1063,25 +1074,22 @@
 	}
 	else if(teamsay == 0) // to everyone
 	{
+		// note: player sound
 		// broadcast the sound, but it's directional
 		sound(self, chan, sample, VOL_BASE, ATTN_NORM);
 	}
 	else if(teamsay == 1) // to the same team
 	{
-		if(teams_matter)
-		{
-			entity e;
-			FOR_EACH_REALCLIENT(e)
-				if(!teams_matter || e.team == self.team)
-				{
-					msg_entity = e;
+		entity e;
+		FOR_EACH_REALCLIENT(e)
+			if(!teams_matter || e.team == self.team)
+			{
+				msg_entity = e;
+				if(msg_entity.cvar_cl_voice_directional)
+					soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_MIN);
+				else
 					soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
-				}
-		}
-		else
-		{
-			sound(self, chan, sample, VOL_BASE, ATTN_NONE);
-		}
+			}
 	}
 	else if(teamsay == 4) // auto taunt
 	{
@@ -1091,8 +1099,8 @@
 		if (tauntrand < e.cvar_cl_autotaunt)
 		{
 			msg_entity = e;
-			if (e.cvar_cl_taunt_directional)
-				soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_MIN);
+			if (e.cvar_cl_voice_directional)
+				soundto(MSG_ONE, self, chan, sample, VOL_BASE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));
 			else
 				soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
 		}
@@ -1102,8 +1110,8 @@
 		FOR_EACH_REALCLIENT(e)
 		{
 			msg_entity = e;
-			if (e.cvar_cl_taunt_directional)
-				soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_MIN);
+			if (e.cvar_cl_voice_directional)
+				soundto(MSG_ONE, self, chan, sample, VOL_BASE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));
 			else
 				soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
 		}
@@ -1119,7 +1127,7 @@
 
 .float floodcontrol_voice;
 .float floodcontrol_voiceteam;
-void VoiceMessage(string type, string message)
+void VoiceMessage(string type, string msg)
 {
 	var .string sample;
 	var float teamsay, ownteam;
@@ -1155,8 +1163,8 @@
 	else
 		flood = 1;
 
-	if (message != "")
-		Say(self, ownteam, message);
+	if (msg != "")
+		Say(self, ownteam, msg, 0);
 
 	if (!flood)
 		PlayerSound(sample, CHAN_VOICE, teamsay);

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/server/clientcommands.qc	2009-01-10 15:34:07 UTC (rev 5482)
@@ -231,11 +231,11 @@
 			VoiceMessage(argv(1), "");
 	} else if(argv(0) == "say") {
 		if(tokens >= 2)
-			Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+			Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
 		//clientcommand(self, formatmessage(s));
 	} else if(argv(0) == "say_team") {
 		if(tokens >= 2)
-			Say(self, TRUE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+			Say(self, TRUE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
 		//clientcommand(self, formatmessage(s));
 	} else if(argv(0) == "info") {
 		cmd = cvar_string(strcat("sv_info_", argv(1)));

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/server/constants.qh	2009-01-10 15:34:07 UTC (rev 5482)
@@ -146,6 +146,7 @@
 float	ATTN_NORM				= 0.5;
 float	ATTN_IDLE				= 2;
 float	ATTN_STATIC				= 3;
+float	ATTN_MAX   				= 3.984375;
 
 float	UPDATE_GENERAL				= 0;
 float	UPDATE_STATIC				= 1;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/server/defs.qh	2009-01-10 15:34:07 UTC (rev 5482)
@@ -477,7 +477,8 @@
 
 // autotaunt system
 .float cvar_cl_autotaunt;
-.float cvar_cl_taunt_directional;
+.float cvar_cl_voice_directional;
+.float cvar_cl_voice_directional_taunt_attenuation;
 
 .float version_mismatch;
 

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-01-10 15:05:47 UTC (rev 5481)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-01-10 15:34:07 UTC (rev 5482)
@@ -550,7 +550,8 @@
 	GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
 	GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
 	GetCvars_handleFloat(s, f, cvar_cl_autotaunt, "cl_autotaunt");
-	GetCvars_handleFloat(s, f, cvar_cl_taunt_directional, "cl_taunt_directional");
+	GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
+	GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
 	GetCvars_handleFloat(s, f, cvar_cl_hitsound, "cl_hitsound");
 
 	// fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)




More information about the nexuiz-commits mailing list