[nexuiz-commits] r8101 - in trunk/data: maps qcsrc/common

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Oct 11 10:21:48 EDT 2009


Author: div0
Date: 2009-10-11 10:21:47 -0400 (Sun, 11 Oct 2009)
New Revision: 8101

Modified:
   trunk/data/maps/nr_piece-o-cake.mapinfo
   trunk/data/qcsrc/common/mapinfo.qc
Log:
better settemp #include and comment support for mapinfo


Modified: trunk/data/maps/nr_piece-o-cake.mapinfo
===================================================================
--- trunk/data/maps/nr_piece-o-cake.mapinfo	2009-10-11 13:00:24 UTC (rev 8100)
+++ trunk/data/maps/nr_piece-o-cake.mapinfo	2009-10-11 14:21:47 UTC (rev 8101)
@@ -4,7 +4,6 @@
 cdtrack 17
 type cts 20 5
 has weapons
+settemp_for_type cts #include balanceNexrun.cfg
 settemp_for_type all g_start_weapon_laser 0
 settemp_for_type all g_start_weapon_shotgun 0
-settemp_for_type cts #include physicsNexrun.cfg
-settemp_for_type cts #include weaponsNexrun.cfg

Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc	2009-10-11 13:00:24 UTC (rev 8100)
+++ trunk/data/qcsrc/common/mapinfo.qc	2009-10-11 14:21:47 UTC (rev 8101)
@@ -538,8 +538,36 @@
 void _MapInfo_Parse_Settemp(string pFilename, string acl, string s, float recurse)
 {
 	string t;
-	float fh;
+	float fh, o;
 	t = car(s); s = cdr(s);
+
+	// limited support of "" and comments
+	//   remove trailing and leading " of t
+	if(substring(t, 0, 1) == "\"")
+	{
+		if(substring(t, -1, 1) == "\"")
+			t = substring(t, 1, -2);
+	}
+
+	//   remove leading " of s
+	if(substring(s, 0, 1) == "\"")
+	{
+		s = substring(s, 1, -1);
+	}
+	//   remove trailing " of s, and all that follows (cvar description)
+	o = strstrofs(s, "\"", 0);
+	if(o >= 0)
+		s = substring(s, 0, o);
+	
+	//   remove // comments
+	o = strstrofs(s, "//", 0);
+	if(o >= 0)
+		s = substring(s, 0, o);
+	
+	//   remove trailing spaces
+	while(substring(s, -1, 1) == " ")
+		s = substring(s, 0, -2);
+
 	if(t == "#include")
 	{
 		if(recurse > 0)
@@ -564,6 +592,11 @@
 					if(substring(s, 0, 1) == "_")  // q3map style
 						continue;
 
+					if(substring(s, 0, 4) == "set ")
+						s = substring(s, 4, -1);
+					if(substring(s, 0, 5) == "seta ")
+						s = substring(s, 5, -1);
+
 					_MapInfo_Parse_Settemp(pFilename, acl, s, recurse - 1);
 				}
 				fclose(fh);



More information about the nexuiz-commits mailing list