r6028 - in branches/nexuiz-2.0: . data/qcsrc/client data/qcsrc/common data/qcsrc/server data/scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Mar 1 06:27:13 EST 2009


Author: div0
Date: 2009-03-01 06:27:10 -0500 (Sun, 01 Mar 2009)
New Revision: 6028

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
   branches/nexuiz-2.0/data/qcsrc/common/util.qc
   branches/nexuiz-2.0/data/qcsrc/common/util.qh
   branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc
   branches/nexuiz-2.0/data/scripts/entities.def
Log:
r5982 | div0 | 2009-02-26 07:36:13 +0100 (Thu, 26 Feb 2009) | 2 lines
support originjitter/anglesjitter for ALL entities
r5983 | div0 | 2009-02-26 07:44:53 +0100 (Thu, 26 Feb 2009) | 12 lines
while we're at it: allow filtering entities by gametype like this:
"gametypefilter" "+ctf,kh"
or
"gametypefilter" "-lms"
or
"gametypefilter" "+teams"
r5984 | div0 | 2009-02-26 07:45:50 +0100 (Thu, 26 Feb 2009) | 2 lines
fix missing files in last commit
r5985 | div0 | 2009-02-26 07:54:16 +0100 (Thu, 26 Feb 2009) | 2 lines
work around fteqcc bug
r5986 | div0 | 2009-02-26 07:58:52 +0100 (Thu, 26 Feb 2009) | 2 lines
add the new entity keys
r5988 | div0 | 2009-02-26 08:37:51 +0100 (Thu, 26 Feb 2009) | 2 lines
add one more example to anglesjitter explanationr5991 | div0 | 2009-02-26 18:56:02 +0100 (Thu, 26 Feb 2009) | 2 lines
also add "anglejitter" for conveniencer6001 | div0 | 2009-02-27 06:23:37 +0100 (Fri, 27 Feb 2009) | 3 lines
anglejitter etc.: only touch the float fields when the jitter value is nonzero.
This change should do nothing, but MAYBE works better with the dodgy floats that way.

Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/.patchsets	2009-03-01 11:27:10 UTC (rev 6028)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-5981,5989-5989,5992-6000,6002-6008,6026-6026
+revisions_applied = 1-6008,6026-6026

Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-03-01 11:27:10 UTC (rev 6028)
@@ -408,12 +408,6 @@
 	drawfont = sbar_font;
 	digit = stringwidth("0123456789", FALSE) / 10;
 
-	subpattern = strcat(",", GametypeNameFromType(gametype), ",");
-	if(teamplay)
-		subpattern2 = ",teams,";
-	else
-		subpattern2 = ",noteams,";
-
 	for(i = 0; i < argc - 1; ++i)
 	{
 		str = argv(i+1);
@@ -424,22 +418,8 @@
 			pattern = substring(str, 0, slash);
 			str = substring(str, slash + 1, strlen(str) - (slash + 1));
 
-			if(substring(pattern, 0, 1) == "-")
-			{
-				pattern = substring(pattern, 1, strlen(pattern) - 1);
-				if(strstrofs(strcat(",", pattern, ","), subpattern, 0) >= 0)
-					continue;
-				if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) >= 0)
-					continue;
-			}
-			else
-			{
-				if(substring(pattern, 0, 1) == "+")
-					pattern = substring(pattern, 1, strlen(pattern) - 1);
-				if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
-				if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
-					continue;
-			}
+			if not(isGametypeInFilter(gametype, teamplay, pattern))
+				continue;
 		}
 
 		strunzone(sbar_title[sbar_num_fields]);

Modified: branches/nexuiz-2.0/data/qcsrc/common/util.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/util.qc	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/data/qcsrc/common/util.qc	2009-03-01 11:27:10 UTC (rev 6028)
@@ -1470,3 +1470,31 @@
 	else
 		return strcat(substring(theText, 0, textLengthUpToWidth(theText, maxWidth - tw("..."), tw)), "...");
 }
+
+float isGametypeInFilter(float gt, float tp, string pattern)
+{
+	string subpattern, subpattern2;
+	subpattern = strcat(",", GametypeNameFromType(gt), ",");
+	if(tp)
+		subpattern2 = ",teams,";
+	else
+		subpattern2 = ",noteams,";
+
+	if(substring(pattern, 0, 1) == "-")
+	{
+		pattern = substring(pattern, 1, strlen(pattern) - 1);
+		if(strstrofs(strcat(",", pattern, ","), subpattern, 0) >= 0)
+			return 0;
+		if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) >= 0)
+			return 0;
+	}
+	else
+	{
+		if(substring(pattern, 0, 1) == "+")
+			pattern = substring(pattern, 1, strlen(pattern) - 1);
+		if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
+		if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
+			return 0;
+	}
+	return 1;
+}

Modified: branches/nexuiz-2.0/data/qcsrc/common/util.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/common/util.qh	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/data/qcsrc/common/util.qh	2009-03-01 11:27:10 UTC (rev 6028)
@@ -150,3 +150,5 @@
 
 string getWrappedLine_remaining;
 string getWrappedLine(float w, textLengthUpToWidth_widthFunction_t tw);
+
+float isGametypeInFilter(float gt, float tp, string pattern);

Modified: branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/data/qcsrc/server/sv_main.qc	2009-03-01 11:27:10 UTC (rev 6028)
@@ -187,3 +187,32 @@
 	FOR_EACH_PLAYER(self)
 		self.porto_forbidden = max(0, self.porto_forbidden - 1);
 }
+
+.vector originjitter;
+.vector anglesjitter;
+.float anglejitter;
+.string gametypefilter;
+void SV_OnEntityPreSpawnFunction()
+{
+	if(self.gametypefilter != "")
+	if not(isGametypeInFilter(game, teamplay, self.gametypefilter))
+	{
+		remove(self);
+		return;
+	}
+
+	if(self.originjitter_x != 0)
+		self.origin_x = self.origin_x + (random() * 2 - 1) * self.originjitter_x;
+	if(self.originjitter_y != 0)
+		self.origin_y = self.origin_y + (random() * 2 - 1) * self.originjitter_y;
+	if(self.originjitter_z != 0)
+		self.origin_z = self.origin_z + (random() * 2 - 1) * self.originjitter_z;
+	if(self.anglesjitter_x != 0)
+		self.angles_x = self.angles_x + (random() * 2 - 1) * self.anglesjitter_x;
+	if(self.anglesjitter_y != 0)
+		self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglesjitter_y;
+	if(self.anglesjitter_z != 0)
+		self.angles_z = self.angles_z + (random() * 2 - 1) * self.anglesjitter_z;
+	if(self.anglejitter != 0)
+		self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglejitter;
+}

Modified: branches/nexuiz-2.0/data/scripts/entities.def
===================================================================
--- branches/nexuiz-2.0/data/scripts/entities.def	2009-03-01 11:25:41 UTC (rev 6027)
+++ branches/nexuiz-2.0/data/scripts/entities.def	2009-03-01 11:27:10 UTC (rev 6028)
@@ -623,7 +623,7 @@
 /*QUAKED misc_gamemodel (0 .5 .8) (-8 -8 -8) (8 8 8) ALIGN_ORIGIN ALIGN_BOTTOM
 A way to load models from a map by the engine (e.g. self-animated zym models).
 Is non-solid by default.
-The keys below actually apply to most engine-loaded model entities as they are engine features; however, they are described here as they aren't overridden by game code in misc_models. Its q3map2 keys below will work on any brush entity!
+The keys below actually apply to most engine-loaded model entities as they are engine features; however, they are described here as they aren't overridden by game code in misc_gamemodel. Its q3map2 keys below will work on any brush entity!
 -------- KEYS --------
 model: when used as a point entity, file name of model to load; when used as a brush entity, do not specify that
 frame: animation frame to play (for self-animated zym models)
@@ -642,6 +642,10 @@
 lodmodel1: file name of the first LOD model replacement
 lodmodel2: file name of the second LOD model replacement
 targetname: when invoking it by a button etc., it changes the color to the initiator of the action (e.g. the one pressing a button). In Onslaught, this can be used to color control points for team who owns them. In other game types, this can be used as a fun feature.
+originjitter: a vector describing a random offset this entity will be moved on initial spawn. This corresponds to the "origin" field. Works on any non-q3map2-only entity.
+anglesjitter: a vector in the order "pitch yaw roll" describing a random angles change on this entity on initial spawn. The value 180 180 180 makes the angles entirely random and uniformly distributed (among euler angles). This corresponds to the "angles" field. Works on any non-q3map2-only entity.
+anglejitter: a float describing a random yaw angle change on this entity on initial spawn. The value 180 makes the yaw angle entirely random (maybe good for items). This corresponds to the "angle" field. Works on any non-q3map2-only entity.
+gametypefilter: either a + sign and a comma separated list of game types or the aliases "teams" and "noteams" to ONLY show the entity in the listed game types, or a - sign and a comma separated list of game types or the aliases "teams" and "noteams" to NOT show the entity in the listed game types. The syntax is the same as in sbar_columns_set strings. Works on any non-q3map2-only entity.
 -------- Q3MAP2 KEYS --------
 _frame: frame of model to include (set equal to frame if _castshadows is set)
 _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.




More information about the nexuiz-commits mailing list