r4568 - in trunk/data/qcsrc: common server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Oct 1 08:42:35 EDT 2008


Author: div0
Date: 2008-10-01 08:42:34 -0400 (Wed, 01 Oct 2008)
New Revision: 4568

Modified:
   trunk/data/qcsrc/common/util.qc
   trunk/data/qcsrc/server/gamecommand.qc
Log:
leave a border around the minimaps


Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc	2008-10-01 11:22:17 UTC (rev 4567)
+++ trunk/data/qcsrc/common/util.qc	2008-10-01 12:42:34 UTC (rev 4568)
@@ -715,6 +715,8 @@
 #ifndef MENUQC
 void get_mi_min_max()
 {
+	vector extend;
+
 	if(mi_shortname)
 		strunzone(mi_shortname);
 	mi_shortname = mapname;
@@ -737,9 +739,24 @@
 	mi_picmax = mi_max;
 
 	// extend mi_picmax to get a square aspect ratio
-	mi_picmax_x = max(mi_picmax_x, mi_picmin_x + (mi_max_y - mi_min_y));
-	mi_picmax_y = max(mi_picmax_y, mi_picmin_y + (mi_max_x - mi_min_x));
+	// center the map in that area
+	extend = mi_picmax - mi_picmin;
+	if(extend_y > extend_x)
+	{
+		mi_picmin_x -= (extend_y - extend_x) * 0.5;
+		mi_picmax_x += (extend_y - extend_x) * 0.5;
+	}
+	else
+	{
+		mi_picmin_y -= (extend_x - extend_y) * 0.5;
+		mi_picmax_y += (extend_x - extend_y) * 0.5;
+	}
 
+	// add another some percent
+	extend = (mi_picmax - mi_picmin) * (1 / 64.0);
+	mi_picmin -= extend;
+	mi_picmax += extend;
+
 	// calculate the texcoords
 	mi_pictexcoord0 = mi_pictexcoord1 = mi_pictexcoord2 = mi_pictexcoord3 = '0 0 0';
 	// first the two corners of the origin

Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2008-10-01 11:22:17 UTC (rev 4567)
+++ trunk/data/qcsrc/server/gamecommand.qc	2008-10-01 12:42:34 UTC (rev 4568)
@@ -46,6 +46,15 @@
 	dz = (zsize / 256) * '0 0 1';
 	ma = '1 0 0' * w + '0 1 0' * h + dz;
 	o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+
+	if(x < world.mins_x - w)
+		return 0;
+	if(y < world.mins_y - h)
+		return 0;
+	if(x > world.maxs_x)
+		return 0;
+	if(y > world.maxs_y)
+		return 0;
 	
 	r = 0;
 	for(i = 0; i < 255; ++i)
@@ -77,7 +86,7 @@
 		get_mi_min_max();
 		self.size_x = 512;
 		self.size_y = 512;
-		self.mins = mi_min;
+		self.mins = mi_picmin;
 		self.maxs_x = (mi_picmax_x - mi_picmin_x) / self.size_x;
 		self.maxs_y = (mi_picmax_y - mi_picmin_y) / self.size_y;
 		self.maxs_z = mi_max_z - mi_min_z;




More information about the nexuiz-commits mailing list